@nocobase/app 2.0.0-alpha.64 → 2.0.0-alpha.65

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,52 +0,0 @@
1
- "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[9897],{88754:function(ot,Ur,ie){ie.d(Ur,{v:function(){return le}});var Q=ie(87462),cr={epsilon:1e-12,matrix:"Matrix",number:"number",precision:64,predictable:!1,randomSeed:null},A=["Matrix","Array"],tr=["number","BigNumber","Fraction"];function Pe(L,$e){function Se(Me){if(Me){var Ae=mapObject(L,clone);ir(Me,"matrix",A),ir(Me,"number",tr),deepExtend(L,Me);var fe=mapObject(L,clone),ne=mapObject(Me,clone);return $e("config",fe,Ae,ne),fe}else return mapObject(L,clone)}return Se.MATRIX_OPTIONS=A,Se.NUMBER_OPTIONS=tr,Object.keys(DEFAULT_CONFIG).forEach(Me=>{Object.defineProperty(Se,Me,{get:()=>L[Me],enumerable:!0,configurable:!0})}),Se}function Te(L,$e){return L.indexOf($e)!==-1}function ir(L,$e,Se){L[$e]!==void 0&&!Te(Se,L[$e])&&console.warn('Warning: Unknown value "'+L[$e]+'" for configuration option "'+$e+'". Available options: '+Se.map(Me=>JSON.stringify(Me)).join(", ")+".")}var le=function($e){if($e)throw new Error(`The global config is readonly.
2
- Please create a mathjs instance if you want to change the default configuration.
3
- Example:
4
-
5
- import { create, all } from 'mathjs';
6
- const mathjs = create(all);
7
- mathjs.config({ number: 'BigNumber' });
8
- `);return Object.freeze(cr)};(0,Q.Z)(le,cr,{MATRIX_OPTIONS:A,NUMBER_OPTIONS:tr})},83362:function(ot,Ur,ie){ie.d(Ur,{ku:function(){return ea}});var Q=ie(87462),cr=ie(88754),A=ie(77707),tr=ie(66736),Pe=ie(75150),Te=ie(42711),ir="Chain",le=["?on","math"],L=(0,Te.d5)(ir,le,xe=>{var{on:ce,math:F}=xe;function U(W){if(!(this instanceof U))throw new SyntaxError("Constructor must be called with the new operator");(0,A.qg)(W)?this.value=W.value:this.value=W}U.prototype.type="Chain",U.prototype.isChain=!0,U.prototype.done=function(){return this.value},U.prototype.valueOf=function(){return this.value},U.prototype.toString=function(){return(0,tr.WU)(this.value)},U.prototype.toJSON=function(){return{mathjs:"Chain",value:this.value}},U.fromJSON=function(W){return new U(W.value)};function y(W,G){typeof G=="function"&&(U.prototype[W]=R(G))}function _(W,G){(0,Pe.Vo)(U.prototype,W,function(){var oe=G();if(typeof oe=="function")return R(oe)})}function R(W){return function(){for(var G=[this.value],k=0;k<arguments.length;k++)G[k+1]=arguments[k];return new U(W.apply(W,G))}}U.createProxy=function(W,G){if(typeof W=="string")y(W,G);else{var k=function(er){(0,Pe.nr)(W,er)&&q[er]===void 0&&_(er,()=>W[er])};for(var oe in W)k(oe)}};var q={expression:!0,docs:!0,type:!0,classes:!0,json:!0,error:!0,isChain:!0};return U.createProxy(F),ce&&ce("import",function(W,G,k){k||_(W,G)}),U},{isClass:!0}),$e=new Set(["end"]),Se=ie(32538),Me="Node",Ae=["mathWithTransform"],fe=(0,Te.d5)(Me,Ae,xe=>{var{mathWithTransform:ce}=xe;function F(){if(!(this instanceof F))throw new SyntaxError("Constructor must be called with the new operator")}F.prototype.evaluate=function(y){return this.compile().evaluate(y)},F.prototype.type="Node",F.prototype.isNode=!0,F.prototype.comment="",F.prototype.compile=function(){var y=this._compile(ce,{}),_={},R=null;function q(W){var G=(0,Se.df)(W);return U(G),y(G,_,R)}return{evaluate:q}},F.prototype._compile=function(y,_){throw new Error("Method _compile should be implemented by type "+this.type)},F.prototype.forEach=function(y){throw new Error("Cannot run forEach on a Node interface")},F.prototype.map=function(y){throw new Error("Cannot run map on a Node interface")},F.prototype._ifNode=function(y){if(!(0,A.UG)(y))throw new TypeError("Callback function must return a Node");return y},F.prototype.traverse=function(y){y(this,null,null);function _(R,q){R.forEach(function(W,G,k){q(W,G,k),_(W,q)})}_(this,y)},F.prototype.transform=function(y){function _(R,q,W){var G=y(R,q,W);return G!==R?G:R.map(_)}return _(this,null,null)},F.prototype.filter=function(y){var _=[];return this.traverse(function(R,q,W){y(R,q,W)&&_.push(R)}),_},F.prototype.clone=function(){throw new Error("Cannot clone a Node interface")},F.prototype.cloneDeep=function(){return this.map(function(y){return y.cloneDeep()})},F.prototype.equals=function(y){return y?(0,Pe.J5)(this,y):!1},F.prototype.toString=function(y){var _=this._getCustomString(y);return typeof _<"u"?_:this._toString(y)},F.prototype.toJSON=function(){throw new Error("Cannot serialize object: toJSON not implemented by "+this.type)},F.prototype.toHTML=function(y){var _=this._getCustomString(y);return typeof _<"u"?_:this.toHTML(y)},F.prototype._toString=function(){throw new Error("_toString not implemented for "+this.type)},F.prototype.toTex=function(y){var _=this._getCustomString(y);return typeof _<"u"?_:this._toTex(y)},F.prototype._toTex=function(y){throw new Error("_toTex not implemented for "+this.type)},F.prototype._getCustomString=function(y){if(y&&typeof y=="object")switch(typeof y.handler){case"object":case"undefined":return;case"function":return y.handler(this,y);default:throw new TypeError("Object or function expected as callback")}},F.prototype.getIdentifier=function(){return this.type},F.prototype.getContent=function(){return this};function U(y){for(var _ of[...$e])if(y.has(_))throw new Error('Scope contains an illegal symbol, "'+_+'" is a reserved keyword')}return F},{isClass:!0,isNode:!0}),ne=ie(75259),X="ObjectNode",de=["Node"],Ie=(0,Te.d5)(X,de,xe=>{var{Node:ce}=xe;function F(U){if(!(this instanceof F))throw new SyntaxError("Constructor must be called with the new operator");if(this.properties=U||{},U&&(typeof U!="object"||!Object.keys(U).every(function(y){return(0,A.UG)(U[y])})))throw new TypeError("Object containing Nodes expected")}return F.prototype=new ce,F.prototype.type="ObjectNode",F.prototype.isObjectNode=!0,F.prototype._compile=function(U,y){var _={};for(var R in this.properties)if((0,Pe.nr)(this.properties,R)){var q=(0,tr.Pz)(R),W=JSON.parse(q);if(!(0,ne.pp)(this.properties,W))throw new Error('No access to property "'+W+'"');_[W]=this.properties[R]._compile(U,y)}return function(k,oe,Ee){var er={};for(var He in _)(0,Pe.nr)(_,He)&&(er[He]=_[He](k,oe,Ee));return er}},F.prototype.forEach=function(U){for(var y in this.properties)(0,Pe.nr)(this.properties,y)&&U(this.properties[y],"properties["+(0,tr.Pz)(y)+"]",this)},F.prototype.map=function(U){var y={};for(var _ in this.properties)(0,Pe.nr)(this.properties,_)&&(y[_]=this._ifNode(U(this.properties[_],"properties["+(0,tr.Pz)(_)+"]",this)));return new F(y)},F.prototype.clone=function(){var U={};for(var y in this.properties)(0,Pe.nr)(this.properties,y)&&(U[y]=this.properties[y]);return new F(U)},F.prototype._toString=function(U){var y=[];for(var _ in this.properties)(0,Pe.nr)(this.properties,_)&&y.push((0,tr.Pz)(_)+": "+this.properties[_].toString(U));return"{"+y.join(", ")+"}"},F.prototype.toJSON=function(){return{mathjs:"ObjectNode",properties:this.properties}},F.fromJSON=function(U){return new F(U.properties)},F.prototype.toHTML=function(U){var y=[];for(var _ in this.properties)(0,Pe.nr)(this.properties,_)&&y.push('<span class="math-symbol math-property">'+(0,tr.YU)(_)+'</span><span class="math-operator math-assignment-operator math-property-assignment-operator math-binary-operator">:</span>'+this.properties[_].toHTML(U));return'<span class="math-parenthesis math-curly-parenthesis">{</span>'+y.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-curly-parenthesis">}</span>'},F.prototype._toTex=function(U){var y=[];for(var _ in this.properties)(0,Pe.nr)(this.properties,_)&&y.push("\\mathbf{"+_+":} & "+this.properties[_].toTex(U)+"\\\\");return"\\left\\{\\begin{array}{ll}".concat(y.join(`
9
- `),"\\end{array}\\right\\}")},F},{isClass:!0,isNode:!0}),Oe=ie(58775),ue=[{AssignmentNode:{},FunctionAssignmentNode:{}},{ConditionalNode:{latexLeftParens:!1,latexRightParens:!1,latexParens:!1}},{"OperatorNode:or":{associativity:"left",associativeWith:[]}},{"OperatorNode:xor":{associativity:"left",associativeWith:[]}},{"OperatorNode:and":{associativity:"left",associativeWith:[]}},{"OperatorNode:bitOr":{associativity:"left",associativeWith:[]}},{"OperatorNode:bitXor":{associativity:"left",associativeWith:[]}},{"OperatorNode:bitAnd":{associativity:"left",associativeWith:[]}},{"OperatorNode:equal":{associativity:"left",associativeWith:[]},"OperatorNode:unequal":{associativity:"left",associativeWith:[]},"OperatorNode:smaller":{associativity:"left",associativeWith:[]},"OperatorNode:larger":{associativity:"left",associativeWith:[]},"OperatorNode:smallerEq":{associativity:"left",associativeWith:[]},"OperatorNode:largerEq":{associativity:"left",associativeWith:[]},RelationalNode:{associativity:"left",associativeWith:[]}},{"OperatorNode:leftShift":{associativity:"left",associativeWith:[]},"OperatorNode:rightArithShift":{associativity:"left",associativeWith:[]},"OperatorNode:rightLogShift":{associativity:"left",associativeWith:[]}},{"OperatorNode:to":{associativity:"left",associativeWith:[]}},{RangeNode:{}},{"OperatorNode:add":{associativity:"left",associativeWith:["OperatorNode:add","OperatorNode:subtract"]},"OperatorNode:subtract":{associativity:"left",associativeWith:[]}},{"OperatorNode:multiply":{associativity:"left",associativeWith:["OperatorNode:multiply","OperatorNode:divide","Operator:dotMultiply","Operator:dotDivide"]},"OperatorNode:divide":{associativity:"left",associativeWith:[],latexLeftParens:!1,latexRightParens:!1,latexParens:!1},"OperatorNode:dotMultiply":{associativity:"left",associativeWith:["OperatorNode:multiply","OperatorNode:divide","OperatorNode:dotMultiply","OperatorNode:doDivide"]},"OperatorNode:dotDivide":{associativity:"left",associativeWith:[]},"OperatorNode:mod":{associativity:"left",associativeWith:[]}},{"OperatorNode:unaryPlus":{associativity:"right"},"OperatorNode:unaryMinus":{associativity:"right"},"OperatorNode:bitNot":{associativity:"right"},"OperatorNode:not":{associativity:"right"}},{"OperatorNode:pow":{associativity:"right",associativeWith:[],latexRightParens:!1},"OperatorNode:dotPow":{associativity:"right",associativeWith:[]}},{"OperatorNode:factorial":{associativity:"left"}},{"OperatorNode:transpose":{associativity:"left"}}];function ge(xe,ce){var F=xe;ce!=="keep"&&(F=xe.getContent());for(var U=F.getIdentifier(),y=0;y<ue.length;y++)if(U in ue[y])return y;return null}function Re(xe,ce){var F=xe;ce!=="keep"&&(F=xe.getContent());var U=F.getIdentifier(),y=ge(F,ce);if(y===null)return null;var _=ue[y][U];if((0,Pe.nr)(_,"associativity")){if(_.associativity==="left")return"left";if(_.associativity==="right")return"right";throw Error("'"+U+"' has the invalid associativity '"+_.associativity+"'.")}return null}function Ze(xe,ce,F){var U=F!=="keep"?xe.getContent():xe,y=F!=="keep"?xe.getContent():ce,_=U.getIdentifier(),R=y.getIdentifier(),q=ge(U,F);if(q===null)return null;var W=ue[q][_];if((0,Pe.nr)(W,"associativeWith")&&W.associativeWith instanceof Array){for(var G=0;G<W.associativeWith.length;G++)if(W.associativeWith[G]===R)return!0;return!1}return null}var Qe=ie(77928),vr={Alpha:"A",alpha:"\\alpha",Beta:"B",beta:"\\beta",Gamma:"\\Gamma",gamma:"\\gamma",Delta:"\\Delta",delta:"\\delta",Epsilon:"E",epsilon:"\\epsilon",varepsilon:"\\varepsilon",Zeta:"Z",zeta:"\\zeta",Eta:"H",eta:"\\eta",Theta:"\\Theta",theta:"\\theta",vartheta:"\\vartheta",Iota:"I",iota:"\\iota",Kappa:"K",kappa:"\\kappa",varkappa:"\\varkappa",Lambda:"\\Lambda",lambda:"\\lambda",Mu:"M",mu:"\\mu",Nu:"N",nu:"\\nu",Xi:"\\Xi",xi:"\\xi",Omicron:"O",omicron:"o",Pi:"\\Pi",pi:"\\pi",varpi:"\\varpi",Rho:"P",rho:"\\rho",varrho:"\\varrho",Sigma:"\\Sigma",sigma:"\\sigma",varsigma:"\\varsigma",Tau:"T",tau:"\\tau",Upsilon:"\\Upsilon",upsilon:"\\upsilon",Phi:"\\Phi",phi:"\\phi",varphi:"\\varphi",Chi:"X",chi:"\\chi",Psi:"\\Psi",psi:"\\psi",Omega:"\\Omega",omega:"\\omega",true:"\\mathrm{True}",false:"\\mathrm{False}",i:"i",inf:"\\infty",Inf:"\\infty",infinity:"\\infty",Infinity:"\\infty",oo:"\\infty",lim:"\\lim",undefined:"\\mathbf{?}"},Ye={transpose:"^\\top",ctranspose:"^H",factorial:"!",pow:"^",dotPow:".^\\wedge",unaryPlus:"+",unaryMinus:"-",bitNot:"\\~",not:"\\neg",multiply:"\\cdot",divide:"\\frac",dotMultiply:".\\cdot",dotDivide:".:",mod:"\\mod",add:"+",subtract:"-",to:"\\rightarrow",leftShift:"<<",rightArithShift:">>",rightLogShift:">>>",equal:"=",unequal:"\\neq",smaller:"<",larger:">",smallerEq:"\\leq",largerEq:"\\geq",bitAnd:"\\&",bitXor:"\\underline{|}",bitOr:"|",and:"\\wedge",xor:"\\veebar",or:"\\vee"},nt={abs:{1:"\\left|${args[0]}\\right|"},add:{2:"\\left(${args[0]}".concat(Ye.add,"${args[1]}\\right)")},cbrt:{1:"\\sqrt[3]{${args[0]}}"},ceil:{1:"\\left\\lceil${args[0]}\\right\\rceil"},cube:{1:"\\left(${args[0]}\\right)^3"},divide:{2:"\\frac{${args[0]}}{${args[1]}}"},dotDivide:{2:"\\left(${args[0]}".concat(Ye.dotDivide,"${args[1]}\\right)")},dotMultiply:{2:"\\left(${args[0]}".concat(Ye.dotMultiply,"${args[1]}\\right)")},dotPow:{2:"\\left(${args[0]}".concat(Ye.dotPow,"${args[1]}\\right)")},exp:{1:"\\exp\\left(${args[0]}\\right)"},expm1:"\\left(e".concat(Ye.pow,"{${args[0]}}-1\\right)"),fix:{1:"\\mathrm{${name}}\\left(${args[0]}\\right)"},floor:{1:"\\left\\lfloor${args[0]}\\right\\rfloor"},gcd:"\\gcd\\left(${args}\\right)",hypot:"\\hypot\\left(${args}\\right)",log:{1:"\\ln\\left(${args[0]}\\right)",2:"\\log_{${args[1]}}\\left(${args[0]}\\right)"},log10:{1:"\\log_{10}\\left(${args[0]}\\right)"},log1p:{1:"\\ln\\left(${args[0]}+1\\right)",2:"\\log_{${args[1]}}\\left(${args[0]}+1\\right)"},log2:"\\log_{2}\\left(${args[0]}\\right)",mod:{2:"\\left(${args[0]}".concat(Ye.mod,"${args[1]}\\right)")},multiply:{2:"\\left(${args[0]}".concat(Ye.multiply,"${args[1]}\\right)")},norm:{1:"\\left\\|${args[0]}\\right\\|",2:void 0},nthRoot:{2:"\\sqrt[${args[1]}]{${args[0]}}"},nthRoots:{2:"\\{y : $y^{args[1]} = {${args[0]}}\\}"},pow:{2:"\\left(${args[0]}\\right)".concat(Ye.pow,"{${args[1]}}")},round:{1:"\\left\\lfloor${args[0]}\\right\\rceil",2:void 0},sign:{1:"\\mathrm{${name}}\\left(${args[0]}\\right)"},sqrt:{1:"\\sqrt{${args[0]}}"},square:{1:"\\left(${args[0]}\\right)^2"},subtract:{2:"\\left(${args[0]}".concat(Ye.subtract,"${args[1]}\\right)")},unaryMinus:{1:"".concat(Ye.unaryMinus,"\\left(${args[0]}\\right)")},unaryPlus:{1:"".concat(Ye.unaryPlus,"\\left(${args[0]}\\right)")},bitAnd:{2:"\\left(${args[0]}".concat(Ye.bitAnd,"${args[1]}\\right)")},bitNot:{1:Ye.bitNot+"\\left(${args[0]}\\right)"},bitOr:{2:"\\left(${args[0]}".concat(Ye.bitOr,"${args[1]}\\right)")},bitXor:{2:"\\left(${args[0]}".concat(Ye.bitXor,"${args[1]}\\right)")},leftShift:{2:"\\left(${args[0]}".concat(Ye.leftShift,"${args[1]}\\right)")},rightArithShift:{2:"\\left(${args[0]}".concat(Ye.rightArithShift,"${args[1]}\\right)")},rightLogShift:{2:"\\left(${args[0]}".concat(Ye.rightLogShift,"${args[1]}\\right)")},bellNumbers:{1:"\\mathrm{B}_{${args[0]}}"},catalan:{1:"\\mathrm{C}_{${args[0]}}"},stirlingS2:{2:"\\mathrm{S}\\left(${args}\\right)"},arg:{1:"\\arg\\left(${args[0]}\\right)"},conj:{1:"\\left(${args[0]}\\right)^*"},im:{1:"\\Im\\left\\lbrace${args[0]}\\right\\rbrace"},re:{1:"\\Re\\left\\lbrace${args[0]}\\right\\rbrace"},and:{2:"\\left(${args[0]}".concat(Ye.and,"${args[1]}\\right)")},not:{1:Ye.not+"\\left(${args[0]}\\right)"},or:{2:"\\left(${args[0]}".concat(Ye.or,"${args[1]}\\right)")},xor:{2:"\\left(${args[0]}".concat(Ye.xor,"${args[1]}\\right)")},cross:{2:"\\left(${args[0]}\\right)\\times\\left(${args[1]}\\right)"},ctranspose:{1:"\\left(${args[0]}\\right)".concat(Ye.ctranspose)},det:{1:"\\det\\left(${args[0]}\\right)"},dot:{2:"\\left(${args[0]}\\cdot${args[1]}\\right)"},expm:{1:"\\exp\\left(${args[0]}\\right)"},inv:{1:"\\left(${args[0]}\\right)^{-1}"},pinv:{1:"\\left(${args[0]}\\right)^{+}"},sqrtm:{1:"{${args[0]}}".concat(Ye.pow,"{\\frac{1}{2}}")},trace:{1:"\\mathrm{tr}\\left(${args[0]}\\right)"},transpose:{1:"\\left(${args[0]}\\right)".concat(Ye.transpose)},combinations:{2:"\\binom{${args[0]}}{${args[1]}}"},combinationsWithRep:{2:"\\left(\\!\\!{\\binom{${args[0]}}{${args[1]}}}\\!\\!\\right)"},factorial:{1:"\\left(${args[0]}\\right)".concat(Ye.factorial)},gamma:{1:"\\Gamma\\left(${args[0]}\\right)"},lgamma:{1:"\\ln\\Gamma\\left(${args[0]}\\right)"},equal:{2:"\\left(${args[0]}".concat(Ye.equal,"${args[1]}\\right)")},larger:{2:"\\left(${args[0]}".concat(Ye.larger,"${args[1]}\\right)")},largerEq:{2:"\\left(${args[0]}".concat(Ye.largerEq,"${args[1]}\\right)")},smaller:{2:"\\left(${args[0]}".concat(Ye.smaller,"${args[1]}\\right)")},smallerEq:{2:"\\left(${args[0]}".concat(Ye.smallerEq,"${args[1]}\\right)")},unequal:{2:"\\left(${args[0]}".concat(Ye.unequal,"${args[1]}\\right)")},erf:{1:"erf\\left(${args[0]}\\right)"},max:"\\max\\left(${args}\\right)",min:"\\min\\left(${args}\\right)",variance:"\\mathrm{Var}\\left(${args}\\right)",acos:{1:"\\cos^{-1}\\left(${args[0]}\\right)"},acosh:{1:"\\cosh^{-1}\\left(${args[0]}\\right)"},acot:{1:"\\cot^{-1}\\left(${args[0]}\\right)"},acoth:{1:"\\coth^{-1}\\left(${args[0]}\\right)"},acsc:{1:"\\csc^{-1}\\left(${args[0]}\\right)"},acsch:{1:"\\mathrm{csch}^{-1}\\left(${args[0]}\\right)"},asec:{1:"\\sec^{-1}\\left(${args[0]}\\right)"},asech:{1:"\\mathrm{sech}^{-1}\\left(${args[0]}\\right)"},asin:{1:"\\sin^{-1}\\left(${args[0]}\\right)"},asinh:{1:"\\sinh^{-1}\\left(${args[0]}\\right)"},atan:{1:"\\tan^{-1}\\left(${args[0]}\\right)"},atan2:{2:"\\mathrm{atan2}\\left(${args}\\right)"},atanh:{1:"\\tanh^{-1}\\left(${args[0]}\\right)"},cos:{1:"\\cos\\left(${args[0]}\\right)"},cosh:{1:"\\cosh\\left(${args[0]}\\right)"},cot:{1:"\\cot\\left(${args[0]}\\right)"},coth:{1:"\\coth\\left(${args[0]}\\right)"},csc:{1:"\\csc\\left(${args[0]}\\right)"},csch:{1:"\\mathrm{csch}\\left(${args[0]}\\right)"},sec:{1:"\\sec\\left(${args[0]}\\right)"},sech:{1:"\\mathrm{sech}\\left(${args[0]}\\right)"},sin:{1:"\\sin\\left(${args[0]}\\right)"},sinh:{1:"\\sinh\\left(${args[0]}\\right)"},tan:{1:"\\tan\\left(${args[0]}\\right)"},tanh:{1:"\\tanh\\left(${args[0]}\\right)"},to:{2:"\\left(${args[0]}".concat(Ye.to,"${args[1]}\\right)")},numeric:function(ce,F){return ce.args[0].toTex()},number:{0:"0",1:"\\left(${args[0]}\\right)",2:"\\left(\\left(${args[0]}\\right)${args[1]}\\right)"},string:{0:'\\mathtt{""}',1:"\\mathrm{string}\\left(${args[0]}\\right)"},bignumber:{0:"0",1:"\\left(${args[0]}\\right)"},complex:{0:"0",1:"\\left(${args[0]}\\right)",2:"\\left(\\left(${args[0]}\\right)+".concat(vr.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)"}},Le="\\mathrm{${name}}\\left(${args}\\right)",nr={deg:"^\\circ"};function Pr(xe){return Qe(xe,{preserveFormatting:!0})}function Ir(xe,ce){return ce=typeof ce>"u"?!1:ce,ce?(0,Pe.nr)(nr,xe)?nr[xe]:"\\mathrm{"+Pr(xe)+"}":(0,Pe.nr)(vr,xe)?vr[xe]:Pr(xe)}var he="OperatorNode",qe=["Node"],lr=(0,Te.d5)(he,qe,xe=>{var{Node:ce}=xe;function F(y,_,R,q,W){if(!(this instanceof F))throw new SyntaxError("Constructor must be called with the new operator");if(typeof y!="string")throw new TypeError('string expected for parameter "op"');if(typeof _!="string")throw new TypeError('string expected for parameter "fn"');if(!Array.isArray(R)||!R.every(A.UG))throw new TypeError('Array containing Nodes expected for parameter "args"');this.implicit=q===!0,this.isPercentage=W===!0,this.op=y,this.fn=_,this.args=R||[]}F.prototype=new ce,F.prototype.type="OperatorNode",F.prototype.isOperatorNode=!0,F.prototype._compile=function(y,_){if(typeof this.fn!="string"||!(0,ne.OJ)(y,this.fn))throw y[this.fn]?new Error('No access to function "'+this.fn+'"'):new Error("Function "+this.fn+' missing in provided namespace "math"');var R=(0,ne.YF)(y,this.fn),q=(0,Oe.UI)(this.args,function(oe){return oe._compile(y,_)});if(q.length===1){var W=q[0];return function(Ee,er,He){return R(W(Ee,er,He))}}else if(q.length===2){var G=q[0],k=q[1];return function(Ee,er,He){return R(G(Ee,er,He),k(Ee,er,He))}}else return function(Ee,er,He){return R.apply(null,(0,Oe.UI)(q,function(gr){return gr(Ee,er,He)}))}},F.prototype.forEach=function(y){for(var _=0;_<this.args.length;_++)y(this.args[_],"args["+_+"]",this)},F.prototype.map=function(y){for(var _=[],R=0;R<this.args.length;R++)_[R]=this._ifNode(y(this.args[R],"args["+R+"]",this));return new F(this.op,this.fn,_,this.implicit,this.isPercentage)},F.prototype.clone=function(){return new F(this.op,this.fn,this.args.slice(0),this.implicit,this.isPercentage)},F.prototype.isUnary=function(){return this.args.length===1},F.prototype.isBinary=function(){return this.args.length===2};function U(y,_,R,q,W){var G=ge(y,_),k=Re(y,_);if(_==="all"||q.length>2&&y.getIdentifier()!=="OperatorNode:add"&&y.getIdentifier()!=="OperatorNode:multiply")return q.map(function(dr){switch(dr.getContent().type){case"ArrayNode":case"ConstantNode":case"SymbolNode":case"ParenthesisNode":return!1;default:return!0}});var oe;switch(q.length){case 0:oe=[];break;case 1:{var Ee=ge(q[0],_);if(W&&Ee!==null){var er,He;if(_==="keep"?(er=q[0].getIdentifier(),He=y.getIdentifier()):(er=q[0].getContent().getIdentifier(),He=y.getContent().getIdentifier()),ue[G][He].latexLeftParens===!1){oe=[!1];break}if(ue[Ee][er].latexParens===!1){oe=[!1];break}}if(Ee===null){oe=[!1];break}if(Ee<=G){oe=[!0];break}oe=[!1]}break;case 2:{var gr,Nr=ge(q[0],_),Br=Ze(y,q[0],_);Nr===null?gr=!1:Nr===G&&k==="right"&&!Br||Nr<G?gr=!0:gr=!1;var ar,pe=ge(q[1],_),Z=Ze(y,q[1],_);if(pe===null?ar=!1:pe===G&&k==="left"&&!Z||pe<G?ar=!0:ar=!1,W){var me,se,je;_==="keep"?(me=y.getIdentifier(),se=y.args[0].getIdentifier(),je=y.args[1].getIdentifier()):(me=y.getContent().getIdentifier(),se=y.args[0].getContent().getIdentifier(),je=y.args[1].getContent().getIdentifier()),Nr!==null&&(ue[G][me].latexLeftParens===!1&&(gr=!1),ue[Nr][se].latexParens===!1&&(gr=!1)),pe!==null&&(ue[G][me].latexRightParens===!1&&(ar=!1),ue[pe][je].latexParens===!1&&(ar=!1))}oe=[gr,ar]}break;default:(y.getIdentifier()==="OperatorNode:add"||y.getIdentifier()==="OperatorNode:multiply")&&(oe=q.map(function(dr){var hr=ge(dr,_),or=Ze(y,dr,_),Fr=Re(dr,_);return hr===null?!1:G===hr&&k===Fr&&!or?!0:hr<G}));break}return q.length>=2&&y.getIdentifier()==="OperatorNode:multiply"&&y.implicit&&_==="auto"&&R==="hide"&&(oe=q.map(function(dr,hr){var or=dr.getIdentifier()==="ParenthesisNode";return!!(oe[hr]||or)})),oe}return F.prototype._toString=function(y){var _=y&&y.parenthesis?y.parenthesis:"keep",R=y&&y.implicit?y.implicit:"hide",q=this.args,W=U(this,_,R,q,!1);if(q.length===1){var G=Re(this,_),k=q[0].toString(y);W[0]&&(k="("+k+")");var oe=/[a-zA-Z]+/.test(this.op);return G==="right"?this.op+(oe?" ":"")+k:G==="left"?k+(oe?" ":"")+this.op:k+this.op}else if(q.length===2){var Ee=q[0].toString(y),er=q[1].toString(y);return W[0]&&(Ee="("+Ee+")"),W[1]&&(er="("+er+")"),this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&R==="hide"?Ee+" "+er:Ee+" "+this.op+" "+er}else if(q.length>2&&(this.getIdentifier()==="OperatorNode:add"||this.getIdentifier()==="OperatorNode:multiply")){var He=q.map(function(gr,Nr){return gr=gr.toString(y),W[Nr]&&(gr="("+gr+")"),gr});return this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&R==="hide"?He.join(" "):He.join(" "+this.op+" ")}else return this.fn+"("+this.args.join(", ")+")"},F.prototype.toJSON=function(){return{mathjs:"OperatorNode",op:this.op,fn:this.fn,args:this.args,implicit:this.implicit,isPercentage:this.isPercentage}},F.fromJSON=function(y){return new F(y.op,y.fn,y.args,y.implicit,y.isPercentage)},F.prototype.toHTML=function(y){var _=y&&y.parenthesis?y.parenthesis:"keep",R=y&&y.implicit?y.implicit:"hide",q=this.args,W=U(this,_,R,q,!1);if(q.length===1){var G=Re(this,_),k=q[0].toHTML(y);return W[0]&&(k='<span class="math-parenthesis math-round-parenthesis">(</span>'+k+'<span class="math-parenthesis math-round-parenthesis">)</span>'),G==="right"?'<span class="math-operator math-unary-operator math-lefthand-unary-operator">'+(0,tr.YU)(this.op)+"</span>"+k:k+'<span class="math-operator math-unary-operator math-righthand-unary-operator">'+(0,tr.YU)(this.op)+"</span>"}else if(q.length===2){var oe=q[0].toHTML(y),Ee=q[1].toHTML(y);return W[0]&&(oe='<span class="math-parenthesis math-round-parenthesis">(</span>'+oe+'<span class="math-parenthesis math-round-parenthesis">)</span>'),W[1]&&(Ee='<span class="math-parenthesis math-round-parenthesis">(</span>'+Ee+'<span class="math-parenthesis math-round-parenthesis">)</span>'),this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&R==="hide"?oe+'<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>'+Ee:oe+'<span class="math-operator math-binary-operator math-explicit-binary-operator">'+(0,tr.YU)(this.op)+"</span>"+Ee}else{var er=q.map(function(He,gr){return He=He.toHTML(y),W[gr]&&(He='<span class="math-parenthesis math-round-parenthesis">(</span>'+He+'<span class="math-parenthesis math-round-parenthesis">)</span>'),He});return q.length>2&&(this.getIdentifier()==="OperatorNode:add"||this.getIdentifier()==="OperatorNode:multiply")?this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&R==="hide"?er.join('<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>'):er.join('<span class="math-operator math-binary-operator math-explicit-binary-operator">'+(0,tr.YU)(this.op)+"</span>"):'<span class="math-function">'+(0,tr.YU)(this.fn)+'</span><span class="math-paranthesis math-round-parenthesis">(</span>'+er.join('<span class="math-separator">,</span>')+'<span class="math-paranthesis math-round-parenthesis">)</span>'}},F.prototype._toTex=function(y){var _=y&&y.parenthesis?y.parenthesis:"keep",R=y&&y.implicit?y.implicit:"hide",q=this.args,W=U(this,_,R,q,!0),G=Ye[this.fn];if(G=typeof G>"u"?this.op:G,q.length===1){var k=Re(this,_),oe=q[0].toTex(y);return W[0]&&(oe="\\left(".concat(oe,"\\right)")),k==="right"?G+oe:oe+G}else if(q.length===2){var Ee=q[0],er=Ee.toTex(y);W[0]&&(er="\\left(".concat(er,"\\right)"));var He=q[1],gr=He.toTex(y);W[1]&&(gr="\\left(".concat(gr,"\\right)"));var Nr;switch(_==="keep"?Nr=Ee.getIdentifier():Nr=Ee.getContent().getIdentifier(),this.getIdentifier()){case"OperatorNode:divide":return G+"{"+er+"}{"+gr+"}";case"OperatorNode:pow":switch(er="{"+er+"}",gr="{"+gr+"}",Nr){case"ConditionalNode":case"OperatorNode:divide":er="\\left(".concat(er,"\\right)")}break;case"OperatorNode:multiply":if(this.implicit&&R==="hide")return er+"~"+gr}return er+G+gr}else if(q.length>2&&(this.getIdentifier()==="OperatorNode:add"||this.getIdentifier()==="OperatorNode:multiply")){var Br=q.map(function(ar,pe){return ar=ar.toTex(y),W[pe]&&(ar="\\left(".concat(ar,"\\right)")),ar});return this.getIdentifier()==="OperatorNode:multiply"&&this.implicit?Br.join("~"):Br.join(G)}else return"\\mathrm{"+this.fn+"}\\left("+q.map(function(ar){return ar.toTex(y)}).join(",")+"\\right)"},F.prototype.getIdentifier=function(){return this.type+":"+this.fn},F},{isClass:!0,isNode:!0}),pr="ParenthesisNode",Er=["Node"],kr=(0,Te.d5)(pr,Er,xe=>{var{Node:ce}=xe;function F(U){if(!(this instanceof F))throw new SyntaxError("Constructor must be called with the new operator");if(!(0,A.UG)(U))throw new TypeError('Node expected for parameter "content"');this.content=U}return F.prototype=new ce,F.prototype.type="ParenthesisNode",F.prototype.isParenthesisNode=!0,F.prototype._compile=function(U,y){return this.content._compile(U,y)},F.prototype.getContent=function(){return this.content.getContent()},F.prototype.forEach=function(U){U(this.content,"content",this)},F.prototype.map=function(U){var y=U(this.content,"content",this);return new F(y)},F.prototype.clone=function(){return new F(this.content)},F.prototype._toString=function(U){return!U||U&&!U.parenthesis||U&&U.parenthesis==="keep"?"("+this.content.toString(U)+")":this.content.toString(U)},F.prototype.toJSON=function(){return{mathjs:"ParenthesisNode",content:this.content}},F.fromJSON=function(U){return new F(U.content)},F.prototype.toHTML=function(U){return!U||U&&!U.parenthesis||U&&U.parenthesis==="keep"?'<span class="math-parenthesis math-round-parenthesis">(</span>'+this.content.toHTML(U)+'<span class="math-parenthesis math-round-parenthesis">)</span>':this.content.toHTML(U)},F.prototype._toTex=function(U){return!U||U&&!U.parenthesis||U&&U.parenthesis==="keep"?"\\left(".concat(this.content.toTex(U),"\\right)"):this.content.toTex(U)},F},{isClass:!0,isNode:!0}),vt="RelationalNode",ht=["Node"],we=(0,Te.d5)(vt,ht,xe=>{var{Node:ce}=xe;function F(U,y){if(!(this instanceof F))throw new SyntaxError("Constructor must be called with the new operator");if(!Array.isArray(U))throw new TypeError("Parameter conditionals must be an array");if(!Array.isArray(y))throw new TypeError("Parameter params must be an array");if(U.length!==y.length-1)throw new TypeError("Parameter params must contain exactly one more element than parameter conditionals");this.conditionals=U,this.params=y}return F.prototype=new ce,F.prototype.type="RelationalNode",F.prototype.isRelationalNode=!0,F.prototype._compile=function(U,y){var _=this,R=this.params.map(q=>q._compile(U,y));return function(W,G,k){for(var oe,Ee=R[0](W,G,k),er=0;er<_.conditionals.length;er++){oe=Ee,Ee=R[er+1](W,G,k);var He=(0,ne.YF)(U,_.conditionals[er]);if(!He(oe,Ee))return!1}return!0}},F.prototype.forEach=function(U){this.params.forEach((y,_)=>U(y,"params["+_+"]",this),this)},F.prototype.map=function(U){return new F(this.conditionals.slice(),this.params.map((y,_)=>this._ifNode(U(y,"params["+_+"]",this)),this))},F.prototype.clone=function(){return new F(this.conditionals,this.params)},F.prototype._toString=function(U){for(var y=U&&U.parenthesis?U.parenthesis:"keep",_=ge(this,y),R=this.params.map(function(k,oe){var Ee=ge(k,y);return y==="all"||Ee!==null&&Ee<=_?"("+k.toString(U)+")":k.toString(U)}),q={equal:"==",unequal:"!=",smaller:"<",larger:">",smallerEq:"<=",largerEq:">="},W=R[0],G=0;G<this.conditionals.length;G++)W+=" "+q[this.conditionals[G]]+" "+R[G+1];return W},F.prototype.toJSON=function(){return{mathjs:"RelationalNode",conditionals:this.conditionals,params:this.params}},F.fromJSON=function(U){return new F(U.conditionals,U.params)},F.prototype.toHTML=function(U){for(var y=U&&U.parenthesis?U.parenthesis:"keep",_=ge(this,y),R=this.params.map(function(k,oe){var Ee=ge(k,y);return y==="all"||Ee!==null&&Ee<=_?'<span class="math-parenthesis math-round-parenthesis">(</span>'+k.toHTML(U)+'<span class="math-parenthesis math-round-parenthesis">)</span>':k.toHTML(U)}),q={equal:"==",unequal:"!=",smaller:"<",larger:">",smallerEq:"<=",largerEq:">="},W=R[0],G=0;G<this.conditionals.length;G++)W+='<span class="math-operator math-binary-operator math-explicit-binary-operator">'+(0,tr.YU)(q[this.conditionals[G]])+"</span>"+R[G+1];return W},F.prototype._toTex=function(U){for(var y=U&&U.parenthesis?U.parenthesis:"keep",_=ge(this,y),R=this.params.map(function(G,k){var oe=ge(G,y);return y==="all"||oe!==null&&oe<=_?"\\left("+G.toTex(U)+"\right)":G.toTex(U)}),q=R[0],W=0;W<this.conditionals.length;W++)q+=Ye[this.conditionals[W]]+R[W+1];return q},F},{isClass:!0,isNode:!0}),Jt="ArrayNode",Ms=["Node"],It=(0,Te.d5)(Jt,Ms,xe=>{var{Node:ce}=xe;function F(U){if(!(this instanceof F))throw new SyntaxError("Constructor must be called with the new operator");if(this.items=U||[],!Array.isArray(this.items)||!this.items.every(A.UG))throw new TypeError("Array containing Nodes expected")}return F.prototype=new ce,F.prototype.type="ArrayNode",F.prototype.isArrayNode=!0,F.prototype._compile=function(U,y){var _=(0,Oe.UI)(this.items,function(W){return W._compile(U,y)}),R=U.config.matrix!=="Array";if(R){var q=U.matrix;return function(G,k,oe){return q((0,Oe.UI)(_,function(Ee){return Ee(G,k,oe)}))}}else return function(G,k,oe){return(0,Oe.UI)(_,function(Ee){return Ee(G,k,oe)})}},F.prototype.forEach=function(U){for(var y=0;y<this.items.length;y++){var _=this.items[y];U(_,"items["+y+"]",this)}},F.prototype.map=function(U){for(var y=[],_=0;_<this.items.length;_++)y[_]=this._ifNode(U(this.items[_],"items["+_+"]",this));return new F(y)},F.prototype.clone=function(){return new F(this.items.slice(0))},F.prototype._toString=function(U){var y=this.items.map(function(_){return _.toString(U)});return"["+y.join(", ")+"]"},F.prototype.toJSON=function(){return{mathjs:"ArrayNode",items:this.items}},F.fromJSON=function(U){return new F(U.items)},F.prototype.toHTML=function(U){var y=this.items.map(function(_){return _.toHTML(U)});return'<span class="math-parenthesis math-square-parenthesis">[</span>'+y.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-square-parenthesis">]</span>'},F.prototype._toTex=function(U){function y(_,R){var q=_.some(A.j0)&&!_.every(A.j0),W=R||q,G=W?"&":"\\\\",k=_.map(function(oe){return oe.items?y(oe.items,!R):oe.toTex(U)}).join(G);return q||!W||W&&!R?"\\begin{bmatrix}"+k+"\\end{bmatrix}":k}return y(this.items,!1)},F},{isClass:!0,isNode:!0}),As="BlockNode",Ss=["ResultSet","Node"],_s=(0,Te.d5)(As,Ss,xe=>{var{ResultSet:ce,Node:F}=xe;function U(y){if(!(this instanceof U))throw new SyntaxError("Constructor must be called with the new operator");if(!Array.isArray(y))throw new Error("Array expected");this.blocks=y.map(function(_){var R=_&&_.node,q=_&&_.visible!==void 0?_.visible:!0;if(!(0,A.UG)(R))throw new TypeError('Property "node" must be a Node');if(typeof q!="boolean")throw new TypeError('Property "visible" must be a boolean');return{node:R,visible:q}})}return U.prototype=new F,U.prototype.type="BlockNode",U.prototype.isBlockNode=!0,U.prototype._compile=function(y,_){var R=(0,Oe.UI)(this.blocks,function(q){return{evaluate:q.node._compile(y,_),visible:q.visible}});return function(W,G,k){var oe=[];return(0,Oe.Ed)(R,function(er){var He=er.evaluate(W,G,k);er.visible&&oe.push(He)}),new ce(oe)}},U.prototype.forEach=function(y){for(var _=0;_<this.blocks.length;_++)y(this.blocks[_].node,"blocks["+_+"].node",this)},U.prototype.map=function(y){for(var _=[],R=0;R<this.blocks.length;R++){var q=this.blocks[R],W=this._ifNode(y(q.node,"blocks["+R+"].node",this));_[R]={node:W,visible:q.visible}}return new U(_)},U.prototype.clone=function(){var y=this.blocks.map(function(_){return{node:_.node,visible:_.visible}});return new U(y)},U.prototype._toString=function(y){return this.blocks.map(function(_){return _.node.toString(y)+(_.visible?"":";")}).join(`
10
- `)},U.prototype.toJSON=function(){return{mathjs:"BlockNode",blocks:this.blocks}},U.fromJSON=function(y){return new U(y.blocks)},U.prototype.toHTML=function(y){return this.blocks.map(function(_){return _.node.toHTML(y)+(_.visible?"":'<span class="math-separator">;</span>')}).join('<span class="math-separator"><br /></span>')},U.prototype._toTex=function(y){return this.blocks.map(function(_){return _.node.toTex(y)+(_.visible?"":";")}).join(`\\;\\;
11
- `)},U},{isClass:!0,isNode:!0}),Es="ConditionalNode",Cs=["Node"],Os=(0,Te.d5)(Es,Cs,xe=>{var{Node:ce}=xe;function F(y,_,R){if(!(this instanceof F))throw new SyntaxError("Constructor must be called with the new operator");if(!(0,A.UG)(y))throw new TypeError("Parameter condition must be a Node");if(!(0,A.UG)(_))throw new TypeError("Parameter trueExpr must be a Node");if(!(0,A.UG)(R))throw new TypeError("Parameter falseExpr must be a Node");this.condition=y,this.trueExpr=_,this.falseExpr=R}F.prototype=new ce,F.prototype.type="ConditionalNode",F.prototype.isConditionalNode=!0,F.prototype._compile=function(y,_){var R=this.condition._compile(y,_),q=this.trueExpr._compile(y,_),W=this.falseExpr._compile(y,_);return function(k,oe,Ee){return U(R(k,oe,Ee))?q(k,oe,Ee):W(k,oe,Ee)}},F.prototype.forEach=function(y){y(this.condition,"condition",this),y(this.trueExpr,"trueExpr",this),y(this.falseExpr,"falseExpr",this)},F.prototype.map=function(y){return new F(this._ifNode(y(this.condition,"condition",this)),this._ifNode(y(this.trueExpr,"trueExpr",this)),this._ifNode(y(this.falseExpr,"falseExpr",this)))},F.prototype.clone=function(){return new F(this.condition,this.trueExpr,this.falseExpr)},F.prototype._toString=function(y){var _=y&&y.parenthesis?y.parenthesis:"keep",R=ge(this,_),q=this.condition.toString(y),W=ge(this.condition,_);(_==="all"||this.condition.type==="OperatorNode"||W!==null&&W<=R)&&(q="("+q+")");var G=this.trueExpr.toString(y),k=ge(this.trueExpr,_);(_==="all"||this.trueExpr.type==="OperatorNode"||k!==null&&k<=R)&&(G="("+G+")");var oe=this.falseExpr.toString(y),Ee=ge(this.falseExpr,_);return(_==="all"||this.falseExpr.type==="OperatorNode"||Ee!==null&&Ee<=R)&&(oe="("+oe+")"),q+" ? "+G+" : "+oe},F.prototype.toJSON=function(){return{mathjs:"ConditionalNode",condition:this.condition,trueExpr:this.trueExpr,falseExpr:this.falseExpr}},F.fromJSON=function(y){return new F(y.condition,y.trueExpr,y.falseExpr)},F.prototype.toHTML=function(y){var _=y&&y.parenthesis?y.parenthesis:"keep",R=ge(this,_),q=this.condition.toHTML(y),W=ge(this.condition,_);(_==="all"||this.condition.type==="OperatorNode"||W!==null&&W<=R)&&(q='<span class="math-parenthesis math-round-parenthesis">(</span>'+q+'<span class="math-parenthesis math-round-parenthesis">)</span>');var G=this.trueExpr.toHTML(y),k=ge(this.trueExpr,_);(_==="all"||this.trueExpr.type==="OperatorNode"||k!==null&&k<=R)&&(G='<span class="math-parenthesis math-round-parenthesis">(</span>'+G+'<span class="math-parenthesis math-round-parenthesis">)</span>');var oe=this.falseExpr.toHTML(y),Ee=ge(this.falseExpr,_);return(_==="all"||this.falseExpr.type==="OperatorNode"||Ee!==null&&Ee<=R)&&(oe='<span class="math-parenthesis math-round-parenthesis">(</span>'+oe+'<span class="math-parenthesis math-round-parenthesis">)</span>'),q+'<span class="math-operator math-conditional-operator">?</span>'+G+'<span class="math-operator math-conditional-operator">:</span>'+oe},F.prototype._toTex=function(y){return"\\begin{cases} {"+this.trueExpr.toTex(y)+"}, &\\quad{\\text{if }\\;"+this.condition.toTex(y)+"}\\\\{"+this.falseExpr.toTex(y)+"}, &\\quad{\\text{otherwise}}\\end{cases}"};function U(y){if(typeof y=="number"||typeof y=="boolean"||typeof y=="string")return!!y;if(y){if((0,A.l9)(y))return!y.isZero();if((0,A.Mc)(y))return!!(y.re||y.im);if((0,A.wr)(y))return!!y.value}if(y==null)return!1;throw new TypeError('Unsupported type of condition "'+(0,A.kM)(y)+'"')}return F},{isClass:!0,isNode:!0}),Ds="ConstantNode",Bs=["Node"],Ts=(0,Te.d5)(Ds,Bs,xe=>{var{Node:ce}=xe;function F(U){if(!(this instanceof F))throw new SyntaxError("Constructor must be called with the new operator");this.value=U}return F.prototype=new ce,F.prototype.type="ConstantNode",F.prototype.isConstantNode=!0,F.prototype._compile=function(U,y){var _=this.value;return function(){return _}},F.prototype.forEach=function(U){},F.prototype.map=function(U){return this.clone()},F.prototype.clone=function(){return new F(this.value)},F.prototype._toString=function(U){return(0,tr.WU)(this.value,U)},F.prototype.toHTML=function(U){var y=this._toString(U);switch((0,A.kM)(this.value)){case"number":case"BigNumber":case"Fraction":return'<span class="math-number">'+y+"</span>";case"string":return'<span class="math-string">'+y+"</span>";case"boolean":return'<span class="math-boolean">'+y+"</span>";case"null":return'<span class="math-null-symbol">'+y+"</span>";case"undefined":return'<span class="math-undefined">'+y+"</span>";default:return'<span class="math-symbol">'+y+"</span>"}},F.prototype.toJSON=function(){return{mathjs:"ConstantNode",value:this.value}},F.fromJSON=function(U){return new F(U.value)},F.prototype._toTex=function(U){var y=this._toString(U);switch((0,A.kM)(this.value)){case"string":return"\\mathtt{"+Pr(y)+"}";case"number":case"BigNumber":{if(!isFinite(this.value))return this.value.valueOf()<0?"-\\infty":"\\infty";var _=y.toLowerCase().indexOf("e");if(_!==-1)return y.substring(0,_)+"\\cdot10^{"+y.substring(_+1)+"}"}return y;case"Fraction":return this.value.toLatex();default:return y}},F},{isClass:!0,isNode:!0}),Us="RangeNode",Rs=["Node"],Is=(0,Te.d5)(Us,Rs,xe=>{var{Node:ce}=xe;function F(y,_,R){if(!(this instanceof F))throw new SyntaxError("Constructor must be called with the new operator");if(!(0,A.UG)(y))throw new TypeError("Node expected");if(!(0,A.UG)(_))throw new TypeError("Node expected");if(R&&!(0,A.UG)(R))throw new TypeError("Node expected");if(arguments.length>3)throw new Error("Too many arguments");this.start=y,this.end=_,this.step=R||null}F.prototype=new ce,F.prototype.type="RangeNode",F.prototype.isRangeNode=!0,F.prototype.needsEnd=function(){var y=this.filter(function(_){return(0,A.FG)(_)&&_.name==="end"});return y.length>0},F.prototype._compile=function(y,_){var R=y.range,q=this.start._compile(y,_),W=this.end._compile(y,_);if(this.step){var G=this.step._compile(y,_);return function(oe,Ee,er){return R(q(oe,Ee,er),W(oe,Ee,er),G(oe,Ee,er))}}else return function(oe,Ee,er){return R(q(oe,Ee,er),W(oe,Ee,er))}},F.prototype.forEach=function(y){y(this.start,"start",this),y(this.end,"end",this),this.step&&y(this.step,"step",this)},F.prototype.map=function(y){return new F(this._ifNode(y(this.start,"start",this)),this._ifNode(y(this.end,"end",this)),this.step&&this._ifNode(y(this.step,"step",this)))},F.prototype.clone=function(){return new F(this.start,this.end,this.step&&this.step)};function U(y,_){var R=ge(y,_),q={},W=ge(y.start,_);if(q.start=W!==null&&W<=R||_==="all",y.step){var G=ge(y.step,_);q.step=G!==null&&G<=R||_==="all"}var k=ge(y.end,_);return q.end=k!==null&&k<=R||_==="all",q}return F.prototype._toString=function(y){var _=y&&y.parenthesis?y.parenthesis:"keep",R=U(this,_),q,W=this.start.toString(y);if(R.start&&(W="("+W+")"),q=W,this.step){var G=this.step.toString(y);R.step&&(G="("+G+")"),q+=":"+G}var k=this.end.toString(y);return R.end&&(k="("+k+")"),q+=":"+k,q},F.prototype.toJSON=function(){return{mathjs:"RangeNode",start:this.start,end:this.end,step:this.step}},F.fromJSON=function(y){return new F(y.start,y.end,y.step)},F.prototype.toHTML=function(y){var _=y&&y.parenthesis?y.parenthesis:"keep",R=U(this,_),q,W=this.start.toHTML(y);if(R.start&&(W='<span class="math-parenthesis math-round-parenthesis">(</span>'+W+'<span class="math-parenthesis math-round-parenthesis">)</span>'),q=W,this.step){var G=this.step.toHTML(y);R.step&&(G='<span class="math-parenthesis math-round-parenthesis">(</span>'+G+'<span class="math-parenthesis math-round-parenthesis">)</span>'),q+='<span class="math-operator math-range-operator">:</span>'+G}var k=this.end.toHTML(y);return R.end&&(k='<span class="math-parenthesis math-round-parenthesis">(</span>'+k+'<span class="math-parenthesis math-round-parenthesis">)</span>'),q+='<span class="math-operator math-range-operator">:</span>'+k,q},F.prototype._toTex=function(y){var _=y&&y.parenthesis?y.parenthesis:"keep",R=U(this,_),q=this.start.toTex(y);if(R.start&&(q="\\left(".concat(q,"\\right)")),this.step){var W=this.step.toTex(y);R.step&&(W="\\left(".concat(W,"\\right)")),q+=":"+W}var G=this.end.toTex(y);return R.end&&(G="\\left(".concat(G,"\\right)")),q+=":"+G,q},F},{isClass:!0,isNode:!0}),Fs="reviver",zs=["classes"],Ps=(0,Te.d5)(Fs,zs,xe=>{var{classes:ce}=xe;return function(U,y){var _=ce[y&&y.mathjs];return _&&typeof _.fromJSON=="function"?_.fromJSON(y):y}}),Ls="chain",qs=["typed","Chain"],Ws=(0,Te.d5)(Ls,qs,xe=>{var{typed:ce,Chain:F}=xe;return ce(Ls,{"":function(){return new F},any:function(y){return new F(y)}})}),Gs="FunctionAssignmentNode",Hs=["typed","Node"],ks=(0,Te.d5)(Gs,Hs,xe=>{var{typed:ce,Node:F}=xe;function U(_,R,q){if(!(this instanceof U))throw new SyntaxError("Constructor must be called with the new operator");if(typeof _!="string")throw new TypeError('String expected for parameter "name"');if(!Array.isArray(R))throw new TypeError('Array containing strings or objects expected for parameter "params"');if(!(0,A.UG)(q))throw new TypeError('Node expected for parameter "expr"');if($e.has(_))throw new Error('Illegal function name, "'+_+'" is a reserved keyword');this.name=_,this.params=R.map(function(W){return W&&W.name||W}),this.types=R.map(function(W){return W&&W.type||"any"}),this.expr=q}U.prototype=new F,U.prototype.type="FunctionAssignmentNode",U.prototype.isFunctionAssignmentNode=!0,U.prototype._compile=function(_,R){var q=Object.create(R);(0,Oe.Ed)(this.params,function(er){q[er]=!0});var W=this.expr._compile(_,q),G=this.name,k=this.params,oe=(0,Oe.v_)(this.types,","),Ee=G+"("+(0,Oe.v_)(this.params,", ")+")";return function(He,gr,Nr){var Br={};Br[oe]=function(){for(var pe=Object.create(gr),Z=0;Z<k.length;Z++)pe[k[Z]]=arguments[Z];return W(He,pe,Nr)};var ar=ce(G,Br);return ar.syntax=Ee,He.set(G,ar),ar}},U.prototype.forEach=function(_){_(this.expr,"expr",this)},U.prototype.map=function(_){var R=this._ifNode(_(this.expr,"expr",this));return new U(this.name,this.params.slice(0),R)},U.prototype.clone=function(){return new U(this.name,this.params.slice(0),this.expr)};function y(_,R){var q=ge(_,R),W=ge(_.expr,R);return R==="all"||W!==null&&W<=q}return U.prototype._toString=function(_){var R=_&&_.parenthesis?_.parenthesis:"keep",q=this.expr.toString(_);return y(this,R)&&(q="("+q+")"),this.name+"("+this.params.join(", ")+") = "+q},U.prototype.toJSON=function(){var _=this.types;return{mathjs:"FunctionAssignmentNode",name:this.name,params:this.params.map(function(R,q){return{name:R,type:_[q]}}),expr:this.expr}},U.fromJSON=function(_){return new U(_.name,_.params,_.expr)},U.prototype.toHTML=function(_){for(var R=_&&_.parenthesis?_.parenthesis:"keep",q=[],W=0;W<this.params.length;W++)q.push('<span class="math-symbol math-parameter">'+(0,tr.YU)(this.params[W])+"</span>");var G=this.expr.toHTML(_);return y(this,R)&&(G='<span class="math-parenthesis math-round-parenthesis">(</span>'+G+'<span class="math-parenthesis math-round-parenthesis">)</span>'),'<span class="math-function">'+(0,tr.YU)(this.name)+'</span><span class="math-parenthesis math-round-parenthesis">(</span>'+q.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>'+G},U.prototype._toTex=function(_){var R=_&&_.parenthesis?_.parenthesis:"keep",q=this.expr.toTex(_);return y(this,R)&&(q="\\left(".concat(q,"\\right)")),"\\mathrm{"+this.name+"}\\left("+this.params.map(Ir).join(",")+"\\right):="+q},U},{isClass:!0,isNode:!0}),$s=ie(30826);function Bt(xe){return xe&&xe.isIndexError?new $s.c(xe.index+1,xe.min+1,xe.max!==void 0?xe.max+1:void 0):xe}function Ra(xe){var{subset:ce}=xe;return function(U,y){try{if(Array.isArray(U))return ce(U,y);if(U&&typeof U.subset=="function")return U.subset(y);if(typeof U=="string")return ce(U,y);if(typeof U=="object"){if(!y.isObjectProperty())throw new TypeError("Cannot apply a numeric index as object property");return(0,ne.YF)(U,y.getObjectProperty())}else throw new TypeError("Cannot apply index: unsupported type of object")}catch(_){throw Bt(_)}}}var Vs="AccessorNode",Js=["subset","Node"],Zs=(0,Te.d5)(Vs,Js,xe=>{var{subset:ce,Node:F}=xe,U=Ra({subset:ce});function y(R,q){if(!(this instanceof y))throw new SyntaxError("Constructor must be called with the new operator");if(!(0,A.UG)(R))throw new TypeError('Node expected for parameter "object"');if(!(0,A.Cl)(q))throw new TypeError('IndexNode expected for parameter "index"');this.object=R||null,this.index=q,Object.defineProperty(this,"name",{get:function(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}.bind(this),set:function(){throw new Error("Cannot assign a new name, name is read-only")}})}y.prototype=new F,y.prototype.type="AccessorNode",y.prototype.isAccessorNode=!0,y.prototype._compile=function(R,q){var W=this.object._compile(R,q),G=this.index._compile(R,q);if(this.index.isObjectProperty()){var k=this.index.getObjectProperty();return function(Ee,er,He){return(0,ne.YF)(W(Ee,er,He),k)}}else return function(Ee,er,He){var gr=W(Ee,er,He),Nr=G(Ee,er,gr);return U(gr,Nr)}},y.prototype.forEach=function(R){R(this.object,"object",this),R(this.index,"index",this)},y.prototype.map=function(R){return new y(this._ifNode(R(this.object,"object",this)),this._ifNode(R(this.index,"index",this)))},y.prototype.clone=function(){return new y(this.object,this.index)},y.prototype._toString=function(R){var q=this.object.toString(R);return _(this.object)&&(q="("+q+")"),q+this.index.toString(R)},y.prototype.toHTML=function(R){var q=this.object.toHTML(R);return _(this.object)&&(q='<span class="math-parenthesis math-round-parenthesis">(</span>'+q+'<span class="math-parenthesis math-round-parenthesis">)</span>'),q+this.index.toHTML(R)},y.prototype._toTex=function(R){var q=this.object.toTex(R);return _(this.object)&&(q="\\left(' + object + '\\right)"),q+this.index.toTex(R)},y.prototype.toJSON=function(){return{mathjs:"AccessorNode",object:this.object,index:this.index}},y.fromJSON=function(R){return new y(R.object,R.index)};function _(R){return!((0,A.Yz)(R)||(0,A.j0)(R)||(0,A.nu)(R)||(0,A.VO)(R)||(0,A.Lr)(R)||(0,A.Ig)(R)||(0,A.FG)(R))}return y},{isClass:!0,isNode:!0});function Ks(xe){var{subset:ce,matrix:F}=xe;return function(y,_,R){try{if(Array.isArray(y))return F(y).subset(_,R).valueOf();if(y&&typeof y.subset=="function")return y.subset(_,R);if(typeof y=="string")return ce(y,_,R);if(typeof y=="object"){if(!_.isObjectProperty())throw TypeError("Cannot apply a numeric index as object property");return(0,ne.nI)(y,_.getObjectProperty(),R),y}else throw new TypeError("Cannot apply index: unsupported type of object")}catch(q){throw Bt(q)}}}var Ys="AssignmentNode",Xs=["subset","?matrix","Node"],Qs=(0,Te.d5)(Ys,Xs,xe=>{var{subset:ce,matrix:F,Node:U}=xe,y=Ra({subset:ce}),_=Ks({subset:ce,matrix:F});function R(W,G,k){if(!(this instanceof R))throw new SyntaxError("Constructor must be called with the new operator");if(this.object=W,this.index=k?G:null,this.value=k||G,!(0,A.FG)(W)&&!(0,A.Yz)(W))throw new TypeError('SymbolNode or AccessorNode expected as "object"');if((0,A.FG)(W)&&W.name==="end")throw new Error('Cannot assign to symbol "end"');if(this.index&&!(0,A.Cl)(this.index))throw new TypeError('IndexNode expected as "index"');if(!(0,A.UG)(this.value))throw new TypeError('Node expected as "value"');Object.defineProperty(this,"name",{get:function(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}.bind(this),set:function(){throw new Error("Cannot assign a new name, name is read-only")}})}R.prototype=new U,R.prototype.type="AssignmentNode",R.prototype.isAssignmentNode=!0,R.prototype._compile=function(W,G){var k=this.object._compile(W,G),oe=this.index?this.index._compile(W,G):null,Ee=this.value._compile(W,G),er=this.object.name;if(this.index)if(this.index.isObjectProperty()){var He=this.index.getObjectProperty();return function(pe,Z,me){var se=k(pe,Z,me),je=Ee(pe,Z,me);return(0,ne.nI)(se,He,je),je}}else{if((0,A.FG)(this.object))return function(pe,Z,me){var se=k(pe,Z,me),je=Ee(pe,Z,me),dr=oe(pe,Z,se);return pe.set(er,_(se,dr,je)),je};var gr=this.object.object._compile(W,G);if(this.object.index.isObjectProperty()){var Nr=this.object.index.getObjectProperty();return function(pe,Z,me){var se=gr(pe,Z,me),je=(0,ne.YF)(se,Nr),dr=oe(pe,Z,je),hr=Ee(pe,Z,me);return(0,ne.nI)(se,Nr,_(je,dr,hr)),hr}}else{var Br=this.object.index._compile(W,G);return function(pe,Z,me){var se=gr(pe,Z,me),je=Br(pe,Z,se),dr=y(se,je),hr=oe(pe,Z,dr),or=Ee(pe,Z,me);return _(se,je,_(dr,hr,or)),or}}}else{if(!(0,A.FG)(this.object))throw new TypeError("SymbolNode expected as object");return function(pe,Z,me){var se=Ee(pe,Z,me);return pe.set(er,se),se}}},R.prototype.forEach=function(W){W(this.object,"object",this),this.index&&W(this.index,"index",this),W(this.value,"value",this)},R.prototype.map=function(W){var G=this._ifNode(W(this.object,"object",this)),k=this.index?this._ifNode(W(this.index,"index",this)):null,oe=this._ifNode(W(this.value,"value",this));return new R(G,k,oe)},R.prototype.clone=function(){return new R(this.object,this.index,this.value)};function q(W,G){G||(G="keep");var k=ge(W,G),oe=ge(W.value,G);return G==="all"||oe!==null&&oe<=k}return R.prototype._toString=function(W){var G=this.object.toString(W),k=this.index?this.index.toString(W):"",oe=this.value.toString(W);return q(this,W&&W.parenthesis)&&(oe="("+oe+")"),G+k+" = "+oe},R.prototype.toJSON=function(){return{mathjs:"AssignmentNode",object:this.object,index:this.index,value:this.value}},R.fromJSON=function(W){return new R(W.object,W.index,W.value)},R.prototype.toHTML=function(W){var G=this.object.toHTML(W),k=this.index?this.index.toHTML(W):"",oe=this.value.toHTML(W);return q(this,W&&W.parenthesis)&&(oe='<span class="math-paranthesis math-round-parenthesis">(</span>'+oe+'<span class="math-paranthesis math-round-parenthesis">)</span>'),G+k+'<span class="math-operator math-assignment-operator math-variable-assignment-operator math-binary-operator">=</span>'+oe},R.prototype._toTex=function(W){var G=this.object.toTex(W),k=this.index?this.index.toTex(W):"",oe=this.value.toTex(W);return q(this,W&&W.parenthesis)&&(oe="\\left(".concat(oe,"\\right)")),G+k+":="+oe},R},{isClass:!0,isNode:!0}),js="IndexNode",eu=["Node","size"],ru=(0,Te.d5)(js,eu,xe=>{var{Node:ce,size:F}=xe;function U(y,_){if(!(this instanceof U))throw new SyntaxError("Constructor must be called with the new operator");if(this.dimensions=y,this.dotNotation=_||!1,!Array.isArray(y)||!y.every(A.UG))throw new TypeError('Array containing Nodes expected for parameter "dimensions"');if(this.dotNotation&&!this.isObjectProperty())throw new Error("dotNotation only applicable for object properties")}return U.prototype=new ce,U.prototype.type="IndexNode",U.prototype.isIndexNode=!0,U.prototype._compile=function(y,_){var R=(0,Oe.UI)(this.dimensions,function(W,G){var k=W.filter(er=>er.isSymbolNode&&er.name==="end").length>0;if(k){var oe=Object.create(_);oe.end=!0;var Ee=W._compile(y,oe);return function(He,gr,Nr){if(!(0,A.SW)(Nr)&&!(0,A.kJ)(Nr)&&!(0,A.HD)(Nr))throw new TypeError('Cannot resolve "end": context must be a Matrix, Array, or string but is '+(0,A.kM)(Nr));var Br=F(Nr).valueOf(),ar=Object.create(gr);return ar.end=Br[G],Ee(He,ar,Nr)}}else return W._compile(y,_)}),q=(0,ne.YF)(y,"index");return function(G,k,oe){var Ee=(0,Oe.UI)(R,function(er){return er(G,k,oe)});return q(...Ee)}},U.prototype.forEach=function(y){for(var _=0;_<this.dimensions.length;_++)y(this.dimensions[_],"dimensions["+_+"]",this)},U.prototype.map=function(y){for(var _=[],R=0;R<this.dimensions.length;R++)_[R]=this._ifNode(y(this.dimensions[R],"dimensions["+R+"]",this));return new U(_,this.dotNotation)},U.prototype.clone=function(){return new U(this.dimensions.slice(0),this.dotNotation)},U.prototype.isObjectProperty=function(){return this.dimensions.length===1&&(0,A.nu)(this.dimensions[0])&&typeof this.dimensions[0].value=="string"},U.prototype.getObjectProperty=function(){return this.isObjectProperty()?this.dimensions[0].value:null},U.prototype._toString=function(y){return this.dotNotation?"."+this.getObjectProperty():"["+this.dimensions.join(", ")+"]"},U.prototype.toJSON=function(){return{mathjs:"IndexNode",dimensions:this.dimensions,dotNotation:this.dotNotation}},U.fromJSON=function(y){return new U(y.dimensions,y.dotNotation)},U.prototype.toHTML=function(y){for(var _=[],R=0;R<this.dimensions.length;R++)_[R]=this.dimensions[R].toHTML();return this.dotNotation?'<span class="math-operator math-accessor-operator">.</span><span class="math-symbol math-property">'+(0,tr.YU)(this.getObjectProperty())+"</span>":'<span class="math-parenthesis math-square-parenthesis">[</span>'+_.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-square-parenthesis">]</span>'},U.prototype._toTex=function(y){var _=this.dimensions.map(function(R){return R.toTex(y)});return this.dotNotation?"."+this.getObjectProperty():"_{"+_.join(",")+"}"},U},{isClass:!0,isNode:!0}),tu="SymbolNode",nu=["math","?Unit","Node"],au=(0,Te.d5)(tu,nu,xe=>{var{math:ce,Unit:F,Node:U}=xe;function y(R){return F?F.isValuelessUnit(R):!1}function _(R){if(!(this instanceof _))throw new SyntaxError("Constructor must be called with the new operator");if(typeof R!="string")throw new TypeError('String expected for parameter "name"');this.name=R}return _.prototype=new U,_.prototype.type="SymbolNode",_.prototype.isSymbolNode=!0,_.prototype._compile=function(R,q){var W=this.name;if(q[W]===!0)return function(k,oe,Ee){return oe[W]};if(W in R)return function(k,oe,Ee){return k.has(W)?k.get(W):(0,ne.YF)(R,W)};var G=y(W);return function(k,oe,Ee){return k.has(W)?k.get(W):G?new F(null,W):_.onUndefinedSymbol(W)}},_.prototype.forEach=function(R){},_.prototype.map=function(R){return this.clone()},_.onUndefinedSymbol=function(R){throw new Error("Undefined symbol "+R)},_.prototype.clone=function(){return new _(this.name)},_.prototype._toString=function(R){return this.name},_.prototype.toHTML=function(R){var q=(0,tr.YU)(this.name);return q==="true"||q==="false"?'<span class="math-symbol math-boolean">'+q+"</span>":q==="i"?'<span class="math-symbol math-imaginary-symbol">'+q+"</span>":q==="Infinity"?'<span class="math-symbol math-infinity-symbol">'+q+"</span>":q==="NaN"?'<span class="math-symbol math-nan-symbol">'+q+"</span>":q==="null"?'<span class="math-symbol math-null-symbol">'+q+"</span>":q==="undefined"?'<span class="math-symbol math-undefined-symbol">'+q+"</span>":'<span class="math-symbol">'+q+"</span>"},_.prototype.toJSON=function(){return{mathjs:"SymbolNode",name:this.name}},_.fromJSON=function(R){return new _(R.name)},_.prototype._toTex=function(R){var q=!1;typeof ce[this.name]>"u"&&y(this.name)&&(q=!0);var W=Ir(this.name,q);return W[0]==="\\"?W:" "+W},_},{isClass:!0,isNode:!0});function On(xe){for(var ce=arguments.length,F=new Array(ce>1?ce-1:0),U=1;U<ce;U++)F[U-1]=arguments[U];return typeof xe.createSubScope=="function"?(0,Se.f0)(xe.createSubScope(),...F):(0,Se.f0)((0,Se.dg)(),xe,...F)}var iu="FunctionNode",ou=["math","Node","SymbolNode"],su=(0,Te.d5)(iu,ou,xe=>{var{math:ce,Node:F,SymbolNode:U}=xe;function y(G,k){if(!(this instanceof y))throw new SyntaxError("Constructor must be called with the new operator");if(typeof G=="string"&&(G=new U(G)),!(0,A.UG)(G))throw new TypeError('Node expected as parameter "fn"');if(!Array.isArray(k)||!k.every(A.UG))throw new TypeError('Array containing Nodes expected for parameter "args"');this.fn=G,this.args=k||[],Object.defineProperty(this,"name",{get:function(){return this.fn.name||""}.bind(this),set:function(){throw new Error("Cannot assign a new name, name is read-only")}})}y.prototype=new F,y.prototype.type="FunctionNode",y.prototype.isFunctionNode=!0;var _=G=>(0,tr.WU)(G,{truncate:78});y.prototype._compile=function(G,k){if(!(this instanceof y))throw new TypeError("No valid FunctionNode");var oe=this.args.map(dr=>dr._compile(G,k));if((0,A.FG)(this.fn)){var Ee=this.fn.name;if(k[Ee]){var Br=this.args;return function(hr,or,Fr){var _e=or[Ee];if(typeof _e!="function")throw new TypeError("Argument '".concat(Ee,"' was not a function; received: ").concat(_(_e)));if(_e.rawArgs)return _e(Br,G,On(hr,or),hr);var ke=oe.map(at=>at(hr,or,Fr));return _e.apply(_e,ke)}}else{var er=Ee in G?(0,ne.YF)(G,Ee):void 0,He=typeof er=="function"&&er.rawArgs===!0,gr=dr=>{var hr;if(dr.has(Ee))hr=dr.get(Ee);else if(Ee in G)hr=(0,ne.YF)(G,Ee);else return y.onUndefinedFunction(Ee);if(typeof hr=="function")return hr;throw new TypeError("'".concat(Ee,`' is not a function; its value is:
12
- `).concat(_(hr)))};if(He){var Nr=this.args;return function(hr,or,Fr){var _e=gr(hr);return _e(Nr,G,On(hr,or),hr)}}else switch(oe.length){case 0:return function(hr,or,Fr){var _e=gr(hr);return _e()};case 1:return function(hr,or,Fr){var _e=gr(hr),ke=oe[0];return _e(ke(hr,or,Fr))};case 2:return function(hr,or,Fr){var _e=gr(hr),ke=oe[0],at=oe[1];return _e(ke(hr,or,Fr),at(hr,or,Fr))};default:return function(hr,or,Fr){var _e=gr(hr),ke=oe.map(at=>at(hr,or,Fr));return _e(...ke)}}}}else if((0,A.Yz)(this.fn)&&(0,A.Cl)(this.fn.index)&&this.fn.index.isObjectProperty()){var ar=this.fn.object._compile(G,k),pe=this.fn.index.getObjectProperty(),Z=this.args;return function(hr,or,Fr){var _e=ar(hr,or,Fr);(0,ne.np)(_e,pe);var ke=_e[pe]&&_e[pe].rawArgs;if(ke)return _e[pe](Z,G,On(hr,or),hr);var at=oe.map(Ne=>Ne(hr,or,Fr));return _e[pe].apply(_e,at)}}else{var me=this.fn.toString(),se=this.fn._compile(G,k),je=this.args;return function(hr,or,Fr){var _e=se(hr,or,Fr);if(typeof _e!="function")throw new TypeError("Expression '".concat(me,"' did not evaluate to a function; value is:")+`
13
- `.concat(_(_e)));if(_e.rawArgs)return _e(je,G,On(hr,or),hr);var ke=oe.map(at=>at(hr,or,Fr));return _e.apply(_e,ke)}}},y.prototype.forEach=function(G){G(this.fn,"fn",this);for(var k=0;k<this.args.length;k++)G(this.args[k],"args["+k+"]",this)},y.prototype.map=function(G){for(var k=this._ifNode(G(this.fn,"fn",this)),oe=[],Ee=0;Ee<this.args.length;Ee++)oe[Ee]=this._ifNode(G(this.args[Ee],"args["+Ee+"]",this));return new y(k,oe)},y.prototype.clone=function(){return new y(this.fn,this.args.slice(0))},y.onUndefinedFunction=function(G){throw new Error("Undefined function "+G)};var R=y.prototype.toString;y.prototype.toString=function(G){var k,oe=this.fn.toString(G);return G&&typeof G.handler=="object"&&(0,Pe.nr)(G.handler,oe)&&(k=G.handler[oe](this,G)),typeof k<"u"?k:R.call(this,G)},y.prototype._toString=function(G){var k=this.args.map(function(Ee){return Ee.toString(G)}),oe=(0,A.l7)(this.fn)?"("+this.fn.toString(G)+")":this.fn.toString(G);return oe+"("+k.join(", ")+")"},y.prototype.toJSON=function(){return{mathjs:"FunctionNode",fn:this.fn,args:this.args}},y.fromJSON=function(G){return new y(G.fn,G.args)},y.prototype.toHTML=function(G){var k=this.args.map(function(oe){return oe.toHTML(G)});return'<span class="math-function">'+(0,tr.YU)(this.fn)+'</span><span class="math-paranthesis math-round-parenthesis">(</span>'+k.join('<span class="math-separator">,</span>')+'<span class="math-paranthesis math-round-parenthesis">)</span>'};function q(G,k,oe){for(var Ee="",er=/\$(?:\{([a-z_][a-z_0-9]*)(?:\[([0-9]+)\])?\}|\$)/gi,He=0,gr;(gr=er.exec(G))!==null;)if(Ee+=G.substring(He,gr.index),He=gr.index,gr[0]==="$$")Ee+="$",He++;else{He+=gr[0].length;var Nr=k[gr[1]];if(!Nr)throw new ReferenceError("Template: Property "+gr[1]+" does not exist.");if(gr[2]===void 0)switch(typeof Nr){case"string":Ee+=Nr;break;case"object":if((0,A.UG)(Nr))Ee+=Nr.toTex(oe);else if(Array.isArray(Nr))Ee+=Nr.map(function(Br,ar){if((0,A.UG)(Br))return Br.toTex(oe);throw new TypeError("Template: "+gr[1]+"["+ar+"] is not a Node.")}).join(",");else throw new TypeError("Template: "+gr[1]+" has to be a Node, String or array of Nodes");break;default:throw new TypeError("Template: "+gr[1]+" has to be a Node, String or array of Nodes")}else if((0,A.UG)(Nr[gr[2]]&&Nr[gr[2]]))Ee+=Nr[gr[2]].toTex(oe);else throw new TypeError("Template: "+gr[1]+"["+gr[2]+"] is not a Node.")}return Ee+=G.slice(He),Ee}var W=y.prototype.toTex;return y.prototype.toTex=function(G){var k;return G&&typeof G.handler=="object"&&(0,Pe.nr)(G.handler,this.name)&&(k=G.handler[this.name](this,G)),typeof k<"u"?k:W.call(this,G)},y.prototype._toTex=function(G){var k=this.args.map(function(er){return er.toTex(G)}),oe;nt[this.name]&&(oe=nt[this.name]),ce[this.name]&&(typeof ce[this.name].toTex=="function"||typeof ce[this.name].toTex=="object"||typeof ce[this.name].toTex=="string")&&(oe=ce[this.name].toTex);var Ee;switch(typeof oe){case"function":Ee=oe(this,G);break;case"string":Ee=q(oe,this,G);break;case"object":switch(typeof oe[k.length]){case"function":Ee=oe[k.length](this,G);break;case"string":Ee=q(oe[k.length],this,G);break}}return typeof Ee<"u"?Ee:q(Le,this,G)},y.prototype.getIdentifier=function(){return this.type+":"+this.name},y},{isClass:!0,isNode:!0}),$n=ie(28337),Ia="parse",uu=["typed","numeric","config","AccessorNode","ArrayNode","AssignmentNode","BlockNode","ConditionalNode","ConstantNode","FunctionAssignmentNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","RangeNode","RelationalNode","SymbolNode"],cu=(0,Te.d5)(Ia,uu,xe=>{var{typed:ce,numeric:F,config:U,AccessorNode:y,ArrayNode:_,AssignmentNode:R,BlockNode:q,ConditionalNode:W,ConstantNode:G,FunctionAssignmentNode:k,FunctionNode:oe,IndexNode:Ee,ObjectNode:er,OperatorNode:He,ParenthesisNode:gr,RangeNode:Nr,RelationalNode:Br,SymbolNode:ar}=xe,pe=ce(Ia,{string:function(J){return Xr(J,{})},"Array | Matrix":function(J){return Z(J,{})},"string, Object":function(J,Be){var fr=Be.nodes!==void 0?Be.nodes:{};return Xr(J,fr)},"Array | Matrix, Object":Z});function Z(x){var J=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Be=J.nodes!==void 0?J.nodes:{};return(0,$n.Fh)(x,function(fr){if(typeof fr!="string")throw new TypeError("String expected");return Xr(fr,Be)})}var me={NULL:0,DELIMITER:1,NUMBER:2,SYMBOL:3,UNKNOWN:4},se={",":!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},je={mod:!0,to:!0,in:!0,and:!0,xor:!0,or:!0,not:!0},dr={true:!0,false:!1,null:null,undefined:void 0},hr=["NaN","Infinity"];function or(){return{extraNodes:{},expression:"",comment:"",index:0,token:"",tokenType:me.NULL,nestingLevel:0,conditionalLevel:null}}function Fr(x,J){return x.expression.substr(x.index,J)}function _e(x){return Fr(x,1)}function ke(x){x.index++}function at(x){return x.expression.charAt(x.index-1)}function Ne(x){return x.expression.charAt(x.index+1)}function ae(x){for(x.tokenType=me.NULL,x.token="",x.comment="";;){if(_e(x)==="#")for(;_e(x)!==`
14
- `&&_e(x)!=="";)x.comment+=_e(x),ke(x);if(pe.isWhitespace(_e(x),x.nestingLevel))ke(x);else break}if(_e(x)===""){x.tokenType=me.DELIMITER;return}if(_e(x)===`
15
- `&&!x.nestingLevel){x.tokenType=me.DELIMITER,x.token=_e(x),ke(x);return}var J=_e(x),Be=Fr(x,2),fr=Fr(x,3);if(fr.length===3&&se[fr]){x.tokenType=me.DELIMITER,x.token=fr,ke(x),ke(x),ke(x);return}if(Be.length===2&&se[Be]){x.tokenType=me.DELIMITER,x.token=Be,ke(x),ke(x);return}if(se[J]){x.tokenType=me.DELIMITER,x.token=J,ke(x);return}if(pe.isDigitDot(J)){x.tokenType=me.NUMBER;var Vr=Fr(x,2);if(Vr==="0b"||Vr==="0o"||Vr==="0x"){for(x.token+=_e(x),ke(x),x.token+=_e(x),ke(x);pe.isHexDigit(_e(x));)x.token+=_e(x),ke(x);if(_e(x)===".")for(x.token+=".",ke(x);pe.isHexDigit(_e(x));)x.token+=_e(x),ke(x);else if(_e(x)==="i")for(x.token+="i",ke(x);pe.isDigit(_e(x));)x.token+=_e(x),ke(x);return}if(_e(x)==="."){if(x.token+=_e(x),ke(x),!pe.isDigit(_e(x))){x.tokenType=me.DELIMITER;return}}else{for(;pe.isDigit(_e(x));)x.token+=_e(x),ke(x);pe.isDecimalMark(_e(x),Ne(x))&&(x.token+=_e(x),ke(x))}for(;pe.isDigit(_e(x));)x.token+=_e(x),ke(x);if(_e(x)==="E"||_e(x)==="e"){if(pe.isDigit(Ne(x))||Ne(x)==="-"||Ne(x)==="+"){if(x.token+=_e(x),ke(x),(_e(x)==="+"||_e(x)==="-")&&(x.token+=_e(x),ke(x)),!pe.isDigit(_e(x)))throw lt(x,'Digit expected, got "'+_e(x)+'"');for(;pe.isDigit(_e(x));)x.token+=_e(x),ke(x);if(pe.isDecimalMark(_e(x),Ne(x)))throw lt(x,'Digit expected, got "'+_e(x)+'"')}else if(Ne(x)===".")throw ke(x),lt(x,'Digit expected, got "'+_e(x)+'"')}return}if(pe.isAlpha(_e(x),at(x),Ne(x))){for(;pe.isAlpha(_e(x),at(x),Ne(x))||pe.isDigit(_e(x));)x.token+=_e(x),ke(x);(0,Pe.nr)(je,x.token)?x.tokenType=me.DELIMITER:x.tokenType=me.SYMBOL;return}for(x.tokenType=me.UNKNOWN;_e(x)!=="";)x.token+=_e(x),ke(x);throw lt(x,'Syntax error in part "'+x.token+'"')}function xr(x){do ae(x);while(x.token===`
16
- `)}function _r(x){x.nestingLevel++}function Tr(x){x.nestingLevel--}pe.isAlpha=function(J,Be,fr){return pe.isValidLatinOrGreek(J)||pe.isValidMathSymbol(J,fr)||pe.isValidMathSymbol(Be,J)},pe.isValidLatinOrGreek=function(J){return/^[a-zA-Z_$\u00C0-\u02AF\u0370-\u03FF\u2100-\u214F]$/.test(J)},pe.isValidMathSymbol=function(J,Be){return/^[\uD835]$/.test(J)&&/^[\uDC00-\uDFFF]$/.test(Be)&&/^[^\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(Be)},pe.isWhitespace=function(J,Be){return J===" "||J===" "||J===`
17
- `&&Be>0},pe.isDecimalMark=function(J,Be){return J==="."&&Be!=="/"&&Be!=="*"&&Be!=="^"},pe.isDigitDot=function(J){return J>="0"&&J<="9"||J==="."},pe.isDigit=function(J){return J>="0"&&J<="9"},pe.isHexDigit=function(J){return J>="0"&&J<="9"||J>="a"&&J<="f"||J>="A"&&J<="F"};function Xr(x,J){var Be=or();(0,Q.Z)(Be,{expression:x,extraNodes:J}),ae(Be);var fr=jr(Be);if(Be.token!=="")throw Be.tokenType===me.DELIMITER?ls(Be,"Unexpected operator "+Be.token):lt(Be,'Unexpected part "'+Be.token+'"');return fr}function jr(x){var J,Be=[],fr;for(x.token!==""&&x.token!==`
18
- `&&x.token!==";"&&(J=Cr(x),J.comment=x.comment);x.token===`
19
- `||x.token===";";)Be.length===0&&J&&(fr=x.token!==";",Be.push({node:J,visible:fr})),ae(x),x.token!==`
20
- `&&x.token!==";"&&x.token!==""&&(J=Cr(x),J.comment=x.comment,fr=x.token!==";",Be.push({node:J,visible:fr}));return Be.length>0?new q(Be):(J||(J=new G(void 0),J.comment=x.comment),J)}function Cr(x){var J,Be,fr,Vr,tt=et(x);if(x.token==="="){if((0,A.FG)(tt))return J=tt.name,xr(x),fr=Cr(x),new R(new ar(J),fr);if((0,A.Yz)(tt))return xr(x),fr=Cr(x),new R(tt.object,tt.index,fr);if((0,A.VO)(tt)&&(0,A.FG)(tt.fn)&&(Vr=!0,Be=[],J=tt.name,tt.args.forEach(function(Gt,fs){(0,A.FG)(Gt)?Be[fs]=Gt.name:Vr=!1}),Vr))return xr(x),fr=Cr(x),new k(J,Be,fr);throw lt(x,"Invalid left hand side of assignment operator =")}return tt}function et(x){for(var J=rt(x);x.token==="?";){var Be=x.conditionalLevel;x.conditionalLevel=x.nestingLevel,xr(x);var fr=J,Vr=Cr(x);if(x.token!==":")throw lt(x,"False part of conditional expression expected");x.conditionalLevel=null,xr(x);var tt=Cr(x);J=new W(fr,Vr,tt),x.conditionalLevel=Be}return J}function rt(x){for(var J=ut(x);x.token==="or";)xr(x),J=new He("or","or",[J,ut(x)]);return J}function ut(x){for(var J=Mt(x);x.token==="xor";)xr(x),J=new He("xor","xor",[J,Mt(x)]);return J}function Mt(x){for(var J=bt(x);x.token==="and";)xr(x),J=new He("and","and",[J,bt(x)]);return J}function bt(x){for(var J=Zr(x);x.token==="|";)xr(x),J=new He("|","bitOr",[J,Zr(x)]);return J}function Zr(x){for(var J=ct(x);x.token==="^|";)xr(x),J=new He("^|","bitXor",[J,ct(x)]);return J}function ct(x){for(var J=$r(x);x.token==="&";)xr(x),J=new He("&","bitAnd",[J,$r(x)]);return J}function $r(x){for(var J=[xt(x)],Be=[],fr={"==":"equal","!=":"unequal","<":"smaller",">":"larger","<=":"smallerEq",">=":"largerEq"};(0,Pe.nr)(fr,x.token);){var Vr={name:x.token,fn:fr[x.token]};Be.push(Vr),xr(x),J.push(xt(x))}return J.length===1?J[0]:J.length===2?new He(Be[0].name,Be[0].fn,J):new Br(Be.map(tt=>tt.fn),J)}function xt(x){var J,Be,fr,Vr;J=qt(x);for(var tt={"<<":"leftShift",">>":"rightArithShift",">>>":"rightLogShift"};(0,Pe.nr)(tt,x.token);)Be=x.token,fr=tt[Be],xr(x),Vr=[J,qt(x)],J=new He(Be,fr,Vr);return J}function qt(x){var J,Be,fr,Vr;J=Rt(x);for(var tt={to:"to",in:"to"};(0,Pe.nr)(tt,x.token);)Be=x.token,fr=tt[Be],xr(x),Be==="in"&&x.token===""?J=new He("*","multiply",[J,new ar("in")],!0):(Vr=[J,Rt(x)],J=new He(Be,fr,Vr));return J}function Rt(x){var J,Be=[];if(x.token===":"?J=new G(1):J=nn(x),x.token===":"&&x.conditionalLevel!==x.nestingLevel){for(Be.push(J);x.token===":"&&Be.length<3;)xr(x),x.token===")"||x.token==="]"||x.token===","||x.token===""?Be.push(new ar("end")):Be.push(nn(x));Be.length===3?J=new Nr(Be[0],Be[2],Be[1]):J=new Nr(Be[0],Be[1])}return J}function nn(x){var J,Be,fr,Vr;J=Qt(x);for(var tt={"+":"add","-":"subtract"};(0,Pe.nr)(tt,x.token);){Be=x.token,fr=tt[Be],xr(x);var Gt=Qt(x);Gt.isPercentage?Vr=[J,new He("*","multiply",[J,Gt])]:Vr=[J,Gt],J=new He(Be,fr,Vr)}return J}function Qt(x){var J,Be,fr,Vr;J=Pn(x),Be=J;for(var tt={"*":"multiply",".*":"dotMultiply","/":"divide","./":"dotDivide"};(0,Pe.nr)(tt,x.token);)fr=x.token,Vr=tt[fr],xr(x),Be=Pn(x),J=new He(fr,Vr,[J,Be]);return J}function Pn(x){var J,Be;for(J=Fe(x),Be=J;x.tokenType===me.SYMBOL||x.token==="in"&&(0,A.nu)(J)||x.tokenType===me.NUMBER&&!(0,A.nu)(Be)&&(!(0,A.bV)(Be)||Be.op==="!")||x.token==="(";)Be=Fe(x),J=new He("*","multiply",[J,Be],!0);return J}function Fe(x){for(var J=Je(x),Be=J,fr=[];x.token==="/"&&(0,A.nu)(Be);)if(fr.push((0,Q.Z)({},x)),xr(x),x.tokenType===me.NUMBER)if(fr.push((0,Q.Z)({},x)),xr(x),x.tokenType===me.SYMBOL||x.token==="(")(0,Q.Z)(x,fr.pop()),fr.pop(),Be=Je(x),J=new He("/","divide",[J,Be]);else{fr.pop(),(0,Q.Z)(x,fr.pop());break}else{(0,Q.Z)(x,fr.pop());break}return J}function Je(x){var J,Be,fr,Vr;J=rr(x);for(var tt={"%":"mod",mod:"mod"};(0,Pe.nr)(tt,x.token);)Be=x.token,fr=tt[Be],xr(x),Be==="%"&&x.tokenType===me.DELIMITER&&x.token!=="("?J=new He("/","divide",[J,new G(100)],!1,!0):(Vr=[J,rr(x)],J=new He(Be,fr,Vr));return J}function rr(x){var J,Be,fr,Vr={"-":"unaryMinus","+":"unaryPlus","~":"bitNot",not:"not"};return(0,Pe.nr)(Vr,x.token)?(fr=Vr[x.token],J=x.token,xr(x),Be=[rr(x)],new He(J,fr,Be)):Lr(x)}function Lr(x){var J,Be,fr,Vr;return J=Rr(x),(x.token==="^"||x.token===".^")&&(Be=x.token,fr=Be==="^"?"pow":"dotPow",xr(x),Vr=[J,rr(x)],J=new He(Be,fr,Vr)),J}function Rr(x){var J,Be,fr,Vr;J=Qr(x);for(var tt={"!":"factorial","'":"ctranspose"};(0,Pe.nr)(tt,x.token);)Be=x.token,fr=tt[Be],ae(x),Vr=[J],J=new He(Be,fr,Vr),J=gt(x,J);return J}function Qr(x){var J=[];if(x.tokenType===me.SYMBOL&&(0,Pe.nr)(x.extraNodes,x.token)){var Be=x.extraNodes[x.token];if(ae(x),x.token==="("){if(J=[],_r(x),ae(x),x.token!==")")for(J.push(Cr(x));x.token===",";)ae(x),J.push(Cr(x));if(x.token!==")")throw lt(x,"Parenthesis ) expected");Tr(x),ae(x)}return new Be(J)}return br(x)}function br(x){var J,Be;return x.tokenType===me.SYMBOL||x.tokenType===me.DELIMITER&&x.token in je?(Be=x.token,ae(x),(0,Pe.nr)(dr,Be)?J=new G(dr[Be]):hr.indexOf(Be)!==-1?J=new G(F(Be,"number")):J=new ar(Be),J=gt(x,J),J):Ot(x)}function gt(x,J,Be){for(var fr;(x.token==="("||x.token==="["||x.token===".")&&(!Be||Be.indexOf(x.token)!==-1);)if(fr=[],x.token==="(")if((0,A.FG)(J)||(0,A.Yz)(J)){if(_r(x),ae(x),x.token!==")")for(fr.push(Cr(x));x.token===",";)ae(x),fr.push(Cr(x));if(x.token!==")")throw lt(x,"Parenthesis ) expected");Tr(x),ae(x),J=new oe(J,fr)}else return J;else if(x.token==="["){if(_r(x),ae(x),x.token!=="]")for(fr.push(Cr(x));x.token===",";)ae(x),fr.push(Cr(x));if(x.token!=="]")throw lt(x,"Parenthesis ] expected");Tr(x),ae(x),J=new y(J,new Ee(fr))}else{if(ae(x),x.tokenType!==me.SYMBOL)throw lt(x,"Property name expected after dot");fr.push(new G(x.token)),ae(x);var Vr=!0;J=new y(J,new Ee(fr,Vr))}return J}function Ot(x){var J,Be;return x.token==='"'?(Be=Wt(x),J=new G(Be),J=gt(x,J),J):St(x)}function Wt(x){for(var J="";_e(x)!==""&&_e(x)!=='"';)_e(x)==="\\"&&(J+=_e(x),ke(x)),J+=_e(x),ke(x);if(ae(x),x.token!=='"')throw lt(x,'End of string " expected');return ae(x),JSON.parse('"'+J+'"')}function St(x){var J,Be;return x.token==="'"?(Be=Nt(x),J=new G(Be),J=gt(x,J),J):Ft(x)}function Nt(x){for(var J="";_e(x)!==""&&_e(x)!=="'";)_e(x)==="\\"&&(J+=_e(x),ke(x)),J+=_e(x),ke(x);if(ae(x),x.token!=="'")throw lt(x,"End of string ' expected");return ae(x),JSON.parse('"'+J+'"')}function Ft(x){var J,Be,fr,Vr;if(x.token==="["){if(_r(x),ae(x),x.token!=="]"){var tt=dn(x);if(x.token===";"){for(fr=1,Be=[tt];x.token===";";)ae(x),Be[fr]=dn(x),fr++;if(x.token!=="]")throw lt(x,"End of matrix ] expected");Tr(x),ae(x),Vr=Be[0].items.length;for(var Gt=1;Gt<fr;Gt++)if(Be[Gt].items.length!==Vr)throw ls(x,"Column dimensions mismatch ("+Be[Gt].items.length+" !== "+Vr+")");J=new _(Be)}else{if(x.token!=="]")throw lt(x,"End of matrix ] expected");Tr(x),ae(x),J=tt}}else Tr(x),ae(x),J=new _([]);return gt(x,J)}return Ln(x)}function dn(x){for(var J=[Cr(x)],Be=1;x.token===",";)ae(x),J[Be]=Cr(x),Be++;return new _(J)}function Ln(x){if(x.token==="{"){_r(x);var J,Be={};do if(ae(x),x.token!=="}"){if(x.token==='"')J=Wt(x);else if(x.token==="'")J=Nt(x);else if(x.tokenType===me.SYMBOL||x.tokenType===me.DELIMITER&&x.token in je)J=x.token,ae(x);else throw lt(x,"Symbol or string expected as object key");if(x.token!==":")throw lt(x,"Colon : expected after object key");ae(x),Be[J]=Cr(x)}while(x.token===",");if(x.token!=="}")throw lt(x,"Comma , or bracket } expected after object value");Tr(x),ae(x);var fr=new er(Be);return fr=gt(x,fr),fr}return jt(x)}function jt(x){var J;return x.tokenType===me.NUMBER?(J=x.token,ae(x),new G(F(J,U.number))):An(x)}function An(x){var J;if(x.token==="("){if(_r(x),ae(x),J=Cr(x),x.token!==")")throw lt(x,"Parenthesis ) expected");return Tr(x),ae(x),J=new gr(J),J=gt(x,J),J}return hn(x)}function hn(x){throw x.token===""?lt(x,"Unexpected end of expression"):lt(x,"Value expected")}function ra(x){return x.index-x.token.length+1}function lt(x,J){var Be=ra(x),fr=new SyntaxError(J+" (char "+Be+")");return fr.char=Be,fr}function ls(x,J){var Be=ra(x),fr=new SyntaxError(J+" (char "+Be+")");return fr.char=Be,fr}return pe}),lu="resolve",fu=["parse","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode"],mu=(0,Te.d5)(lu,fu,xe=>{var{parse:ce,ConstantNode:F,FunctionNode:U,OperatorNode:y,ParenthesisNode:_}=xe;function R(q,W){var G=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new Set;if(!W)return q;if((0,Se._N)(W)||(W=(0,Se.df)(W)),(0,A.FG)(q)){if(G.has(q.name)){var k=Array.from(G).join(", ");throw new ReferenceError("recursive loop of variable definitions among {".concat(k,"}"))}var oe=W.get(q.name);if((0,A.UG)(oe)){var Ee=new Set(G);return Ee.add(q.name),R(oe,W,Ee)}else return typeof oe=="number"?ce(String(oe)):oe!==void 0?new F(oe):q}else if((0,A.bV)(q)){var er=q.args.map(function(gr){return R(gr,W,G)});return new y(q.op,q.fn,er,q.implicit)}else{if((0,A.Ig)(q))return new _(R(q.content,W,G));if((0,A.VO)(q)){var He=q.args.map(function(gr){return R(gr,W,G)});return new U(q.name,He)}}return q.map(gr=>R(gr,W,G))}return R}),vu=ie(4942);function Fa(xe,ce){var F=Object.keys(xe);if(Object.getOwnPropertySymbols){var U=Object.getOwnPropertySymbols(xe);ce&&(U=U.filter(function(y){return Object.getOwnPropertyDescriptor(xe,y).enumerable})),F.push.apply(F,U)}return F}function va(xe){for(var ce=1;ce<arguments.length;ce++){var F=arguments[ce]!=null?arguments[ce]:{};ce%2?Fa(Object(F),!0).forEach(function(U){(0,vu.Z)(xe,U,F[U])}):Object.getOwnPropertyDescriptors?Object.defineProperties(xe,Object.getOwnPropertyDescriptors(F)):Fa(Object(F)).forEach(function(U){Object.defineProperty(xe,U,Object.getOwnPropertyDescriptor(F,U))})}return xe}var Hr="simplifyUtil",Vn=["FunctionNode","OperatorNode","SymbolNode"],en=(0,Te.d5)(Hr,Vn,xe=>{var{FunctionNode:ce,OperatorNode:F,SymbolNode:U}=xe,y=!0,_=!1,R="defaultF",q={add:{trivial:y,total:y,commutative:y,associative:y},unaryPlus:{trivial:y,total:y,commutative:y,associative:y},subtract:{trivial:_,total:y,commutative:_,associative:_},multiply:{trivial:y,total:y,commutative:y,associative:y},divide:{trivial:_,total:y,commutative:_,associative:_},paren:{trivial:y,total:y,commutative:y,associative:_},defaultF:{trivial:_,total:y,commutative:_,associative:_}},W={divide:{total:_},log:{total:_}},G={subtract:{total:_},abs:{trivial:y},log:{total:y}};function k(pe,Z){var me=arguments.length>2&&arguments[2]!==void 0?arguments[2]:q,se=R;if(typeof pe=="string"?se=pe:(0,A.bV)(pe)?se=pe.fn.toString():(0,A.VO)(pe)?se=pe.name:(0,A.Ig)(pe)&&(se="paren"),(0,Pe.nr)(me,se)){var je=me[se];if((0,Pe.nr)(je,Z))return je[Z];if((0,Pe.nr)(q,se))return q[se][Z]}if((0,Pe.nr)(me,R)){var dr=me[R];return(0,Pe.nr)(dr,Z)?dr[Z]:q[R][Z]}if((0,Pe.nr)(q,se)){var hr=q[se];if((0,Pe.nr)(hr,Z))return hr[Z]}return q[R][Z]}function oe(pe){var Z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:q;return k(pe,"commutative",Z)}function Ee(pe){var Z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:q;return k(pe,"associative",Z)}function er(pe,Z){var me=va({},pe);for(var se in Z)(0,Pe.nr)(pe,se)?me[se]=va(va({},Z[se]),pe[se]):me[se]=Z[se];return me}function He(pe,Z){if(!pe.args||pe.args.length===0)return pe;pe.args=gr(pe,Z);for(var me=0;me<pe.args.length;me++)He(pe.args[me],Z)}function gr(pe,Z){var me,se=[],je=function dr(hr){for(var or=0;or<hr.args.length;or++){var Fr=hr.args[or];(0,A.bV)(Fr)&&me===Fr.op?dr(Fr):se.push(Fr)}};return Ee(pe,Z)?(me=pe.op,je(pe),se):pe.args}function Nr(pe,Z){if(!(!pe.args||pe.args.length===0)){for(var me=ar(pe),se=pe.args.length,je=0;je<se;je++)Nr(pe.args[je],Z);if(se>2&&Ee(pe,Z)){for(var dr=pe.args.pop();pe.args.length>0;)dr=me([pe.args.pop(),dr]);pe.args=dr.args}}}function Br(pe,Z){if(!(!pe.args||pe.args.length===0)){for(var me=ar(pe),se=pe.args.length,je=0;je<se;je++)Br(pe.args[je],Z);if(se>2&&Ee(pe,Z)){for(var dr=pe.args.shift();pe.args.length>0;)dr=me([dr,pe.args.shift()]);pe.args=dr.args}}}function ar(pe){return(0,A.bV)(pe)?function(Z){try{return new F(pe.op,pe.fn,Z,pe.implicit)}catch(me){return console.error(me),[]}}:function(Z){return new ce(new U(pe.name),Z)}}return{createMakeNodeFunction:ar,hasProperty:k,isCommutative:oe,isAssociative:Ee,mergeContext:er,flatten:He,allChildren:gr,unflattenr:Nr,unflattenl:Br,defaultContext:q,realContext:W,positiveContext:G}}),pu="simplifyCore",du=["equal","isZero","add","subtract","multiply","divide","pow","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],hu=(0,Te.d5)(pu,du,xe=>{var{equal:ce,isZero:F,add:U,subtract:y,multiply:_,divide:R,pow:q,AccessorNode:W,ArrayNode:G,ConstantNode:k,FunctionNode:oe,IndexNode:Ee,ObjectNode:er,OperatorNode:He,ParenthesisNode:gr,SymbolNode:Nr}=xe,Br=new k(0),ar=new k(1),{hasProperty:pe,isCommutative:Z}=en({FunctionNode:oe,OperatorNode:He,SymbolNode:Nr});function me(se,je){var dr=je?je.context:void 0;if(pe(se,"trivial",dr)){if((0,A.VO)(se)&&se.args.length===1)return me(se.args[0],je);var hr=!1,or=0;if(se.forEach(Tr=>{++or,or===1&&(hr=me(Tr,je))}),or===1)return hr}if((0,A.bV)(se)&&se.isUnary()){var Fr=me(se.args[0],je);if(se.op==="-"){if((0,A.bV)(Fr)){if(Fr.isUnary()&&Fr.op==="-")return Fr.args[0];if(Fr.isBinary()&&Fr.fn==="subtract")return new He("-","subtract",[Fr.args[1],Fr.args[0]])}return new He(se.op,se.fn,[Fr])}}else if((0,A.bV)(se)&&se.isBinary()){var _e=me(se.args[0],je),ke=me(se.args[1],je);if(se.op==="+"){if((0,A.nu)(_e)){if(F(_e.value))return ke;if((0,A.nu)(ke))return new k(U(_e.value,ke.value))}return(0,A.nu)(ke)&&F(ke.value)?_e:(0,A.bV)(ke)&&ke.isUnary()&&ke.op==="-"?new He("-","subtract",[_e,ke.args[0]]):new He(se.op,se.fn,ke?[_e,ke]:[_e])}else if(se.op==="-"){if((0,A.nu)(_e)&&ke){if((0,A.nu)(ke))return new k(y(_e.value,ke.value));if(F(_e.value))return new He("-","unaryMinus",[ke])}if(se.fn==="subtract")return(0,A.nu)(ke)&&F(ke.value)?_e:(0,A.bV)(ke)&&ke.isUnary()&&ke.op==="-"?me(new He("+","add",[_e,ke.args[0]]),je):new He(se.op,se.fn,[_e,ke])}else if(se.op==="*"){if((0,A.nu)(_e)){if(F(_e.value))return Br;if(ce(_e.value,1))return ke;if((0,A.nu)(ke))return new k(_(_e.value,ke.value))}if((0,A.nu)(ke)){if(F(ke.value))return Br;if(ce(ke.value,1))return _e;if((0,A.bV)(_e)&&_e.isBinary()&&_e.op===se.op&&Z(se,dr)){var at=_e.args[0];if((0,A.nu)(at)){var Ne=new k(_(at.value,ke.value));return new He(se.op,se.fn,[Ne,_e.args[1]],se.implicit)}}return Z(se,dr)?new He(se.op,se.fn,[ke,_e],se.implicit):new He(se.op,se.fn,[_e,ke],se.implicit)}return new He(se.op,se.fn,[_e,ke],se.implicit)}else if(se.op==="/"){if((0,A.nu)(_e)){if(F(_e.value))return Br;if((0,A.nu)(ke)&&(ce(ke.value,1)||ce(ke.value,2)||ce(ke.value,4)))return new k(R(_e.value,ke.value))}return new He(se.op,se.fn,[_e,ke])}else if(se.op==="^"&&(0,A.nu)(ke)){if(F(ke.value))return ar;if(ce(ke.value,1))return _e;if((0,A.nu)(_e))return new k(q(_e.value,ke.value));if((0,A.bV)(_e)&&_e.isBinary()&&_e.op==="^"){var ae=_e.args[1];if((0,A.nu)(ae))return new He(se.op,se.fn,[_e.args[0],new k(_(ae.value,ke.value))])}}return new He(se.op,se.fn,[_e,ke])}else{if((0,A.VO)(se))return new oe(me(se.fn),se.args.map(Tr=>me(Tr,je)));if((0,A.j0)(se))return new G(se.items.map(Tr=>me(Tr,je)));if((0,A.Yz)(se))return new W(me(se.object,je),me(se.index,je));if((0,A.Cl)(se))return new Ee(se.dimensions.map(Tr=>me(Tr,je)));if((0,A.Lr)(se)){var xr={};for(var _r in se.properties)xr[_r]=me(se.properties[_r],je);return new er(xr)}}return se}return me}),za="compile",gu=["typed","parse"],yu=(0,Te.d5)(za,gu,xe=>{var{typed:ce,parse:F}=xe;return ce(za,{string:function(y){return F(y).compile()},"Array | Matrix":function(y){return(0,$n.Fh)(y,function(_){return F(_).compile()})}})}),xu="Help",bu=["parse"],Nu=(0,Te.d5)(xu,bu,xe=>{var{parse:ce}=xe;function F(U){if(!(this instanceof F))throw new SyntaxError("Constructor must be called with the new operator");if(!U)throw new Error('Argument "doc" missing');this.doc=U}return F.prototype.type="Help",F.prototype.isHelp=!0,F.prototype.toString=function(){var U=this.doc||{},y=`
21
- `;if(U.name&&(y+="Name: "+U.name+`
22
-
23
- `),U.category&&(y+="Category: "+U.category+`
24
-
25
- `),U.description&&(y+=`Description:
26
- `+U.description+`
27
-
28
- `),U.syntax&&(y+=`Syntax:
29
- `+U.syntax.join(`
30
- `)+`
31
-
32
- `),U.examples){y+=`Examples:
33
- `;for(var _={},R=0;R<U.examples.length;R++){var q=U.examples[R];y+=" "+q+`
34
- `;var W=void 0;try{W=ce(q).compile().evaluate(_)}catch(G){W=G}W!==void 0&&!(0,A.x1)(W)&&(y+=" "+(0,tr.WU)(W,{precision:14})+`
35
- `)}y+=`
36
- `}return U.mayThrow&&U.mayThrow.length&&(y+="Throws: "+U.mayThrow.join(", ")+`
37
-
38
- `),U.seealso&&U.seealso.length&&(y+="See also: "+U.seealso.join(", ")+`
39
- `),y},F.prototype.toJSON=function(){var U=(0,Pe.d9)(this.doc);return U.mathjs="Help",U},F.fromJSON=function(U){var y={};return Object.keys(U).filter(_=>_!=="mathjs").forEach(_=>{y[_]=U[_]}),new F(y)},F.prototype.valueOf=F.prototype.toString,F},{isClass:!0}),Pa="leafCount",wu=["parse","typed"],Mu=(0,Te.d5)(Pa,wu,xe=>{var{parse:ce,typed:F}=xe;function U(y){var _=0;return y.forEach(R=>{_+=U(R)}),_||1}return F(Pa,{string:function(_){return this(ce(_))},Node:function(_){return U(_)}})}),ze=ie(35337),Jr="simplifyConstant",Sr=["typed","config","mathWithTransform","matrix","?fraction","?bignumber","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","SymbolNode"],pt=(0,Te.d5)(Jr,Sr,xe=>{var{typed:ce,config:F,mathWithTransform:U,matrix:y,fraction:_,bignumber:R,AccessorNode:q,ArrayNode:W,ConstantNode:G,FunctionNode:k,IndexNode:oe,ObjectNode:Ee,OperatorNode:er,SymbolNode:He}=xe,{isCommutative:gr,isAssociative:Nr,allChildren:Br,createMakeNodeFunction:ar}=en({FunctionNode:k,OperatorNode:er,SymbolNode:He});function pe(Ne,ae){return je(at(Ne,ae))}function Z(Ne){return(0,A.yQ)(Ne)?Ne.valueOf():Ne instanceof Array?Ne.map(Z):(0,A.SW)(Ne)?y(Z(Ne.valueOf())):Ne}function me(Ne,ae,xr){try{return U[Ne].apply(null,ae)}catch{return ae=ae.map(Z),hr(U[Ne].apply(null,ae),xr)}}var se=ce({Fraction:Fr,number:function(ae){return ae<0?or(new G(-ae)):new G(ae)},BigNumber:function(ae){return ae<0?or(new G(-ae)):new G(ae)},Complex:function(ae){throw new Error("Cannot convert Complex number to Node")},string:function(ae){return new G(ae)},Matrix:function(ae){return new W(ae.valueOf().map(xr=>se(xr)))}});function je(Ne){return(0,A.UG)(Ne)?Ne:se(Ne)}function dr(Ne,ae){var xr=ae&&ae.exactFractions!==!1;if(xr&&isFinite(Ne)&&_){var _r=_(Ne),Tr=ae&&typeof ae.fractionsLimit=="number"?ae.fractionsLimit:1/0;if(_r.valueOf()===Ne&&_r.n<Tr&&_r.d<Tr)return _r}return Ne}var hr=ce({"string, Object":function(ae,xr){if(F.number==="BigNumber")return R===void 0&&(0,ze.R3)(),R(ae);if(F.number==="Fraction")return _===void 0&&(0,ze.nG)(),_(ae);var _r=parseFloat(ae);return dr(_r,xr)},"Fraction, Object":function(ae,xr){return ae},"BigNumber, Object":function(ae,xr){return ae},"number, Object":function(ae,xr){return dr(ae,xr)},"Complex, Object":function(ae,xr){return ae.im!==0?ae:dr(ae.re,xr)},"Matrix, Object":function(ae,xr){return y(dr(ae.valueOf()))},"Array, Object":function(ae,xr){return ae.map(dr)}});function or(Ne){return new er("-","unaryMinus",[Ne])}function Fr(Ne){var ae,xr=Ne.s*Ne.n;return xr<0?ae=new er("-","unaryMinus",[new G(-xr)]):ae=new G(xr),Ne.d===1?ae:new er("/","divide",[ae,new G(Ne.d)])}function _e(Ne,ae,xr){if(!(0,A.Cl)(ae))return new q(je(Ne),je(ae));if((0,A.j0)(Ne)||(0,A.SW)(Ne)){for(var _r=Array.from(ae.dimensions);_r.length>0;)if((0,A.nu)(_r[0])&&typeof _r[0].value!="string"){var Tr=hr(_r.shift().value,xr);(0,A.j0)(Ne)?Ne=Ne.items[Tr-1]:(Ne=Ne.valueOf()[Tr-1],Ne instanceof Array&&(Ne=y(Ne)))}else if(_r.length>1&&(0,A.nu)(_r[1])&&typeof _r[1].value!="string"){var Xr=hr(_r[1].value,xr),jr=[],Cr=(0,A.j0)(Ne)?Ne.items:Ne.valueOf();for(var et of Cr)if((0,A.j0)(et))jr.push(et.items[Xr-1]);else if((0,A.SW)(Ne))jr.push(et[Xr-1]);else break;if(jr.length===Cr.length)(0,A.j0)(Ne)?Ne=new W(jr):Ne=y(jr),_r.splice(1,1);else break}else break;return _r.length===ae.dimensions.length?new q(je(Ne),ae):_r.length>0?(ae=new oe(_r),new q(je(Ne),ae)):Ne}if((0,A.Lr)(Ne)&&ae.dimensions.length===1&&(0,A.nu)(ae.dimensions[0])){var rt=ae.dimensions[0].value;return rt in Ne.properties?Ne.properties[rt]:new G}return new q(je(Ne),ae)}function ke(Ne,ae,xr,_r){return ae.reduce(function(Tr,Xr){if(!(0,A.UG)(Tr)&&!(0,A.UG)(Xr)){try{return me(Ne,[Tr,Xr],_r)}catch{}Tr=se(Tr),Xr=se(Xr)}else(0,A.UG)(Tr)?(0,A.UG)(Xr)||(Xr=se(Xr)):Tr=se(Tr);return xr([Tr,Xr])})}function at(Ne,ae){switch(Ne.type){case"SymbolNode":return Ne;case"ConstantNode":switch(typeof Ne.value){case"number":return hr(Ne.value,ae);case"string":return Ne.value;default:if(!isNaN(Ne.value))return hr(Ne.value,ae)}return Ne;case"FunctionNode":if(U[Ne.name]&&U[Ne.name].rawArgs)return Ne;{var xr=["add","multiply"];if(xr.indexOf(Ne.name)===-1){var _r=Ne.args.map(xt=>at(xt,ae));if(!_r.some(A.UG))try{return me(Ne.name,_r,ae)}catch{}if(Ne.name==="size"&&_r.length===1&&(0,A.j0)(_r[0])){for(var Tr=[],Xr=_r[0];(0,A.j0)(Xr);)Tr.push(Xr.items.length),Xr=Xr.items[0];return y(Tr)}return new k(Ne.name,_r.map(je))}}case"OperatorNode":{var jr=Ne.fn.toString(),Cr,et,rt=ar(Ne);if((0,A.bV)(Ne)&&Ne.isUnary())Cr=[at(Ne.args[0],ae)],(0,A.UG)(Cr[0])?et=rt(Cr):et=me(jr,Cr,ae);else if(Nr(Ne,ae.context))if(Cr=Br(Ne,ae.context),Cr=Cr.map(xt=>at(xt,ae)),gr(jr,ae.context)){for(var ut=[],Mt=[],bt=0;bt<Cr.length;bt++)(0,A.UG)(Cr[bt])?Mt.push(Cr[bt]):ut.push(Cr[bt]);ut.length>1?(et=ke(jr,ut,rt,ae),Mt.unshift(et),et=ke(jr,Mt,rt,ae)):et=ke(jr,Cr,rt,ae)}else et=ke(jr,Cr,rt,ae);else Cr=Ne.args.map(xt=>at(xt,ae)),et=ke(jr,Cr,rt,ae);return et}case"ParenthesisNode":return at(Ne.content,ae);case"AccessorNode":return _e(at(Ne.object,ae),at(Ne.index,ae),ae);case"ArrayNode":{var Zr=Ne.items.map(xt=>at(xt,ae));return Zr.some(A.UG)?new W(Zr.map(je)):y(Zr)}case"IndexNode":return new oe(Ne.dimensions.map(xt=>pe(xt,ae)));case"ObjectNode":{var ct={};for(var $r in Ne.properties)ct[$r]=pe(Ne.properties[$r],ae);return new Ee(ct)}case"AssignmentNode":case"BlockNode":case"FunctionAssignmentNode":case"RangeNode":case"ConditionalNode":default:throw new Error("Unimplemented node type in simplifyConstant: ".concat(Ne.type))}}return pe}),Au="simplify",Su=["config","typed","parse","add","subtract","multiply","divide","pow","isZero","equal","resolve","simplifyCore","?fraction","?bignumber","mathWithTransform","matrix","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],_u=(0,Te.d5)(Au,Su,xe=>{var{config:ce,typed:F,parse:U,add:y,subtract:_,multiply:R,divide:q,pow:W,isZero:G,equal:k,resolve:oe,simplifyCore:Ee,fraction:er,bignumber:He,mathWithTransform:gr,matrix:Nr,AccessorNode:Br,ArrayNode:ar,ConstantNode:pe,FunctionNode:Z,IndexNode:me,ObjectNode:se,OperatorNode:je,ParenthesisNode:dr,SymbolNode:hr}=xe,or=pt({typed:F,config:ce,mathWithTransform:gr,matrix:Nr,fraction:er,bignumber:He,AccessorNode:Br,ArrayNode:ar,ConstantNode:pe,FunctionNode:Z,IndexNode:me,ObjectNode:se,OperatorNode:je,SymbolNode:hr}),{hasProperty:Fr,isCommutative:_e,isAssociative:ke,mergeContext:at,flatten:Ne,unflattenr:ae,unflattenl:xr,createMakeNodeFunction:_r,defaultContext:Tr,realContext:Xr,positiveContext:jr}=en({FunctionNode:Z,OperatorNode:je,SymbolNode:hr}),Cr=F("simplify",{string:function(Je){return this(U(Je),this.rules,(0,Se.dg)(),{})},"string, Map | Object":function(Je,rr){return this(U(Je),this.rules,rr,{})},"string, Map | Object, Object":function(Je,rr,Lr){return this(U(Je),this.rules,rr,Lr)},"string, Array":function(Je,rr){return this(U(Je),rr,(0,Se.dg)(),{})},"string, Array, Map | Object":function(Je,rr,Lr){return this(U(Je),rr,Lr,{})},"string, Array, Map | Object, Object":function(Je,rr,Lr,Rr){return this(U(Je),rr,Lr,Rr)},"Node, Map | Object":function(Je,rr){return this(Je,this.rules,rr,{})},"Node, Map | Object, Object":function(Je,rr,Lr){return this(Je,this.rules,rr,Lr)},Node:function(Je){return this(Je,this.rules,(0,Se.dg)(),{})},"Node, Array":function(Je,rr){return this(Je,rr,(0,Se.dg)(),{})},"Node, Array, Map | Object":function(Je,rr,Lr){return this(Je,rr,Lr,{})},"Node, Array, Object, Object":function(Je,rr,Lr,Rr){return this(Je,rr,(0,Se.df)(Lr),Rr)},"Node, Array, Map, Object":function(Je,rr,Lr,Rr){var Qr=Rr.consoleDebug;rr=Mt(rr,Rr.context);var br=oe(Je,Lr);br=et(br);for(var gt={},Ot=br.toString({parenthesis:"all"});!gt[Ot];){gt[Ot]=!0,bt=0;var Wt=Ot;Qr&&console.log("Working on: ",Ot);for(var St=0;St<rr.length;St++){var Nt="";if(typeof rr[St]=="function"?(br=rr[St](br,Rr),Qr&&(Nt=rr[St].name)):(Ne(br,Rr.context),br=$r(br,rr[St],Rr.context),Qr&&(Nt="".concat(rr[St].l.toString()," -> ").concat(rr[St].r.toString()))),Qr){var Ft=br.toString({parenthesis:"all"});Ft!==Wt&&(console.log("Applying",Nt,"produced",Ft),Wt=Ft)}xr(br,Rr.context)}Ot=br.toString({parenthesis:"all"})}return br}});Cr.defaultContext=Tr,Cr.realContext=Xr,Cr.positiveContext=jr;function et(Fe){return Fe.transform(function(Je,rr,Lr){return(0,A.Ig)(Je)?et(Je.content):Je})}var rt={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};Cr.rules=[Ee,{l:"log(e)",r:"1"},{s:"n-n1 -> n+-n1",assuming:{subtract:{total:!0}}},{s:"n-n -> 0",assuming:{subtract:{total:!1}}},{s:"-(c*v) -> v * (-c)",assuming:{multiply:{commutative:!0},subtract:{total:!0}}},{s:"-(c*v) -> (-c) * v",assuming:{multiply:{commutative:!1},subtract:{total:!0}}},{s:"-(v*c) -> v * (-c)",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:" v * ( v * n1 + n2)",r:"v^2 * n1 + v * n2"},{s:" v * (v^n4 * n1 + n2) -> v^(1+n4) * n1 + v * n2",assuming:{divide:{total:!0}}},{s:"v^n3 * ( v * n1 + n2) -> v^(n3+1) * n1 + v^n3 * n2",assuming:{divide:{total:!0}}},{s:"v^n3 * (v^n4 * n1 + n2) -> v^(n3+n4) * n1 + v^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}}},or,{s:"n+n -> 2*n",assuming:{add:{total:!0}}},{l:"n+-n",r:"0"},{l:"v*n + v",r:"v*(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*v + v -> (n+1)*v",assuming:{multiply:{commutative:!1}}},{s:"n1*n3 + n2*n3 -> (n1+n2)*n3",assuming:{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*c + c",r:"(n+1)*c"},{s:"c*n + c -> c*(n+1)",assuming:{multiply:{commutative:!1}}},or,{s:"(-n)*n1 -> -(n*n1)",assuming:{subtract:{total:!0}}},{s:"n1*(-n) -> -(n1*n)",assuming:{subtract:{total:!0},multiply:{commutative:!1}}},{s:"c+v -> v+c",assuming:{add:{commutative:!0}},imposeContext:{add:{commutative:!1}}},{s:"v*c -> c*v",assuming:{multiply:{commutative:!0}},imposeContext:{multiply:{commutative:!1}}},{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 ut(Fe,Je){var rr={};if(Fe.s){var Lr=Fe.s.split("->");if(Lr.length===2)rr.l=Lr[0],rr.r=Lr[1];else throw SyntaxError("Could not parse rule: "+Fe.s)}else rr.l=Fe.l,rr.r=Fe.r;rr.l=et(U(rr.l)),rr.r=et(U(rr.r));for(var Rr of["imposeContext","repeat","assuming"])Rr in Fe&&(rr[Rr]=Fe[Rr]);if(Fe.evaluate&&(rr.evaluate=U(Fe.evaluate)),ke(rr.l,Je)){var Qr=_r(rr.l),br=Zr();rr.expanded={},rr.expanded.l=Qr([rr.l.clone(),br]),Ne(rr.expanded.l,Je),ae(rr.expanded.l,Je),rr.expanded.r=Qr([rr.r,br])}return rr}function Mt(Fe,Je){for(var rr=[],Lr=0;Lr<Fe.length;Lr++){var Rr=Fe[Lr],Qr=void 0,br=typeof Rr;switch(br){case"string":Rr={s:Rr};case"object":Qr=ut(Rr,Je);break;case"function":Qr=Rr;break;default:throw TypeError("Unsupported type of rule: "+br)}rr.push(Qr)}return rr}var bt=0;function Zr(){return new hr("_p"+bt++)}function ct(Fe,Je,rr){var Lr=Fe;if(Fe)for(var Rr=0;Rr<Fe.length;++Rr){var Qr=$r(Fe[Rr],Je,rr);Qr!==Fe[Rr]&&(Lr===Fe&&(Lr=Fe.slice()),Lr[Rr]=Qr)}return Lr}function $r(Fe,Je,rr){if(Je.assuming){for(var Lr in Je.assuming)for(var Rr in Je.assuming[Lr])if(Fr(Lr,Rr,rr)!==Je.assuming[Lr][Rr])return Fe}var Qr=at(Je.imposeContext,rr),br=Fe;if(br instanceof je||br instanceof Z){var gt=ct(br.args,Je,rr);gt!==br.args&&(br=br.clone(),br.args=gt)}else if(br instanceof dr){if(br.content){var Ot=$r(br.content,Je,rr);Ot!==br.content&&(br=new dr(Ot))}}else if(br instanceof ar){var Wt=ct(br.items,Je,rr);Wt!==br.items&&(br=new ar(Wt))}else if(br instanceof Br){var St=br.object;br.object&&(St=$r(br.object,Je,rr));var Nt=br.index;br.index&&(Nt=$r(br.index,Je,rr)),(St!==br.object||Nt!==br.index)&&(br=new Br(St,Nt))}else if(br instanceof me){var Ft=ct(br.dimensions,Je,rr);Ft!==br.dimensions&&(br=new me(Ft))}else if(br instanceof se){var dn=!1,Ln={};for(var jt in br.properties)Ln[jt]=$r(br.properties[jt],Je,rr),Ln[jt]!==br.properties[jt]&&(dn=!0);dn&&(br=new se(Ln))}var An=Je.r,hn=Qt(Je.l,br,Qr)[0];if(!hn&&Je.expanded&&(An=Je.expanded.r,hn=Qt(Je.expanded.l,br,Qr)[0]),hn){var ra=br.implicit;br=An.clone(),ra&&"implicit"in An&&(br.implicit=!0),br=br.transform(function(lt){return lt.isSymbolNode&&(0,Pe.nr)(hn.placeholders,lt.name)?hn.placeholders[lt.name].clone():lt})}return Je.repeat&&br!==Fe&&(br=$r(br,Je,rr)),br}function xt(Fe,Je){var rr=[],Lr,Rr,Qr=_r(Fe);if(_e(Fe,Je))for(var br=0;br<Fe.args.length;br++)Rr=Fe.args.slice(0),Rr.splice(br,1),Lr=Rr.length===1?Rr[0]:Qr(Rr),rr.push(Qr([Fe.args[br],Lr]));else for(var gt=1;gt<Fe.args.length;gt++){var Ot=Fe.args[0];gt>1&&(Ot=Qr(Fe.args.slice(0,gt))),Rr=Fe.args.slice(gt),Lr=Rr.length===1?Rr[0]:Qr(Rr),rr.push(Qr([Ot,Lr]))}return rr}function qt(Fe,Je){var rr={placeholders:{}};if(!Fe.placeholders&&!Je.placeholders)return rr;if(Fe.placeholders){if(!Je.placeholders)return Fe}else return Je;for(var Lr in Fe.placeholders)if((0,Pe.nr)(Fe.placeholders,Lr)&&(rr.placeholders[Lr]=Fe.placeholders[Lr],(0,Pe.nr)(Je.placeholders,Lr)&&!Pn(Fe.placeholders[Lr],Je.placeholders[Lr])))return null;for(var Rr in Je.placeholders)(0,Pe.nr)(Je.placeholders,Rr)&&(rr.placeholders[Rr]=Je.placeholders[Rr]);return rr}function Rt(Fe,Je){var rr=[];if(Fe.length===0||Je.length===0)return rr;for(var Lr,Rr=0;Rr<Fe.length;Rr++)for(var Qr=0;Qr<Je.length;Qr++)Lr=qt(Fe[Rr],Je[Qr]),Lr&&rr.push(Lr);return rr}function nn(Fe){if(Fe.length===0)return Fe;for(var Je=Fe.reduce(Rt),rr=[],Lr={},Rr=0;Rr<Je.length;Rr++){var Qr=JSON.stringify(Je[Rr]);Lr[Qr]||(Lr[Qr]=!0,rr.push(Je[Rr]))}return rr}function Qt(Fe,Je,rr,Lr){var Rr=[{placeholders:{}}];if(Fe instanceof je&&Je instanceof je||Fe instanceof Z&&Je instanceof Z){if(Fe instanceof je){if(Fe.op!==Je.op||Fe.fn!==Je.fn)return[]}else if(Fe instanceof Z&&Fe.name!==Je.name)return[];if(Je.args.length===1&&Fe.args.length===1||!ke(Je,rr)&&Je.args.length===Fe.args.length||Lr){for(var Qr=[],br=0;br<Fe.args.length;br++){var gt=Qt(Fe.args[br],Je.args[br],rr);if(gt.length===0)break;Qr.push(gt)}if(Qr.length!==Fe.args.length){if(!_e(Je,rr)||Fe.args.length===1)return[];if(Fe.args.length>2)throw new Error("permuting >2 commutative non-associative rule arguments not yet implemented");var Ot=Qt(Fe.args[0],Je.args[1],rr);if(Ot.length===0)return[];var Wt=Qt(Fe.args[1],Je.args[0],rr);if(Wt.length===0)return[];Qr=[Ot,Wt]}Rr=nn(Qr)}else if(Je.args.length>=2&&Fe.args.length===2){for(var St=xt(Je,rr),Nt=[],Ft=0;Ft<St.length;Ft++){var dn=Qt(Fe,St[Ft],rr,!0);Nt=Nt.concat(dn)}return Nt}else{if(Fe.args.length>2)throw Error("Unexpected non-binary associative function: "+Fe.toString());return[]}}else if(Fe instanceof hr){if(Fe.name.length===0)throw new Error("Symbol in rule has 0 length...!?");if(rt[Fe.name]){if(Fe.name!==Je.name)return[]}else if(Fe.name[0]==="n"||Fe.name.substring(0,2)==="_p")Rr[0].placeholders[Fe.name]=Je;else if(Fe.name[0]==="v")if(!(0,A.nu)(Je))Rr[0].placeholders[Fe.name]=Je;else return[];else if(Fe.name[0]==="c")if(Je instanceof pe)Rr[0].placeholders[Fe.name]=Je;else return[];else throw new Error("Invalid symbol in rule: "+Fe.name)}else if(Fe instanceof pe){if(!k(Fe.value,Je.value))return[]}else return[];return Rr}function Pn(Fe,Je){if(Fe instanceof pe&&Je instanceof pe){if(!k(Fe.value,Je.value))return!1}else if(Fe instanceof hr&&Je instanceof hr){if(Fe.name!==Je.name)return!1}else if(Fe instanceof je&&Je instanceof je||Fe instanceof Z&&Je instanceof Z){if(Fe instanceof je){if(Fe.op!==Je.op||Fe.fn!==Je.fn)return!1}else if(Fe instanceof Z&&Fe.name!==Je.name)return!1;if(Fe.args.length!==Je.args.length)return!1;for(var rr=0;rr<Fe.args.length;rr++)if(!Pn(Fe.args[rr],Je.args[rr]))return!1}else return!1;return!0}return Cr}),La="symbolicEqual",Eu=["parse","simplify","typed","OperatorNode"],Cu=(0,Te.d5)(La,Eu,xe=>{var{parse:ce,simplify:F,typed:U,OperatorNode:y}=xe;return U(La,{"string, string":function(R,q){return this(ce(R),ce(q),{})},"string, string, Object":function(R,q,W){return this(ce(R),ce(q),W)},"Node, string":function(R,q){return this(R,ce(q),{})},"Node, string, Object":function(R,q,W){return this(R,ce(q),W)},"string, Node":function(R,q){return this(ce(R),q,{})},"string, Node, Object":function(R,q,W){return this(ce(R),q,W)},"Node, Node":function(R,q){return this(R,q,{})},"Node, Node, Object":function(R,q,W){var G=new y("-","subtract",[R,q]),k=F(G,{},W);return(0,A.nu)(k)&&!k.value}})}),pa="evaluate",Ou=["typed","parse"],qa=(0,Te.d5)(pa,Ou,xe=>{var{typed:ce,parse:F}=xe;return ce(pa,{string:function(y){var _=(0,Se.dg)();return F(y).compile().evaluate(_)},"string, Map | Object":function(y,_){return F(y).compile().evaluate(_)},"Array | Matrix":function(y){var _=(0,Se.dg)();return(0,$n.Fh)(y,function(R){return F(R).compile().evaluate(_)})},"Array | Matrix, Map | Object":function(y,_){return(0,$n.Fh)(y,function(R){return F(R).compile().evaluate(_)})}})}),Wa={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"]},Du={name:"false",category:"Constants",syntax:["false"],description:"Boolean value false",examples:["false"],seealso:["true"]},da={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:[]},Jn={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:[]},Bu={name:"LN10",category:"Constants",syntax:["LN10"],description:"Returns the natural logarithm of 10, approximately equal to 2.302",examples:["LN10","log(10)"],seealso:[]},ha={name:"LN2",category:"Constants",syntax:["LN2"],description:"Returns the natural logarithm of 2, approximately equal to 0.693",examples:["LN2","log(2)"],seealso:[]},Mr={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:[]},Ut={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:[]},Zt={name:"NaN",category:"Constants",syntax:["NaN"],description:"Not a number",examples:["NaN","0 / 0"],seealso:[]},Ga={name:"null",category:"Constants",syntax:["null"],description:"Value null",examples:["null"],seealso:["true","false"]},Ha={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:[]},ka={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"]},$a={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:[]},Tu={name:"SQRT2",category:"Constants",syntax:["SQRT2"],description:"Returns the square root of 2, approximately equal to 1.414",examples:["SQRT2","sqrt(2)"],seealso:[]},Va={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"]},Ja={name:"true",category:"Constants",syntax:["true"],description:"Boolean value true",examples:["true"],seealso:["false"]},Dn={name:"version",category:"Constants",syntax:["version"],description:"A string with the version number of math.js",examples:["version"],seealso:[]},Za={name:"bignumber",category:"Construction",syntax:["bignumber(x)"],description:"Create a big number from a number or string.",examples:["0.1 + 0.2","bignumber(0.1) + bignumber(0.2)",'bignumber("7.2")','bignumber("7.2e500")',"bignumber([0.1, 0.2, 0.3])"],seealso:["boolean","complex","fraction","index","matrix","string","unit"]},Ka={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"]},Ya={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"]},Xa={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"]},Qa={name:"fraction",category:"Construction",syntax:["fraction(num)","fraction(matrix)","fraction(num,den)","fraction({n: num, d: den})"],description:"Create a fraction from a number or from integer numerator and denominator.",examples:["fraction(0.125)","fraction(1, 3) + fraction(2, 5)","fraction({n: 333, d: 53})","fraction([sqrt(9), sqrt(10), sqrt(11)])"],seealso:["bignumber","boolean","complex","index","matrix","string","unit"]},Uu={name:"index",category:"Construction",syntax:["[start]","[start:end]","[start:step:end]","[start1, start 2, ...]","[start1:end1, start2:end2, ...]","[start1:step1:end1, start2:step2:end2, ...]"],description:"Create an index to get or replace a subset of a matrix",examples:["[]","[1, 2, 3]","A = [1, 2, 3; 4, 5, 6]","A[1, :]","A[1, 2] = 50","A[0:2, 0:2] = ones(2, 2)"],seealso:["bignumber","boolean","complex","matrix,","number","range","string","unit"]},ja={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"]},ei={name:"number",category:"Construction",syntax:["x","number(x)","number(unit, valuelessUnit)"],description:"Create a number or convert a string or boolean into a number.",examples:["2","2e3","4.05","number(2)",'number("7.2")',"number(true)","number([true, false, true, true])",'number(unit("52cm"), "m")'],seealso:["bignumber","boolean","complex","fraction","index","matrix","string","unit"]},Ru={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"]},ri={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"]},ti={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"]},ga={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"]},Iu={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:[]},ni={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:[]},ai={name:"typed",category:"Core",syntax:["typed(signatures)","typed(name, signatures)"],description:"Create a typed function.",examples:['double = typed({ "number": f(x)=x+x })',"double(2)",'double("hello")'],seealso:[]},ii={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"]},oi={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"]},Fu={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"]},si={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"]},zu={name:"lup",category:"Algebra",syntax:["lup(m)"],description:"Calculate the Matrix LU decomposition with partial pivoting. Matrix A is decomposed in three matrices (L, U, P) where P * A = L * U",examples:["lup([[2, 1], [1, 4]])","lup(matrix([[2, 1], [1, 4]]))","lup(sparse([[2, 1], [1, 4]]))"],seealso:["lusolve","lsolve","usolve","matrix","sparse","slu","qr"]},Pu={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"]},ui={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"]},Lu={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"]},qu={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"]},ci={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"]},Wu={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","evaluate"]},Gu={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"]},ft={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"]},Hu={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"]},ku={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"]},li={name:"abs",category:"Arithmetic",syntax:["abs(x)"],description:"Compute the absolute value.",examples:["abs(3.5)","abs(-4.2)"],seealso:["sign"]},fi={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"]},mi={name:"cbrt",category:"Arithmetic",syntax:["cbrt(x)","cbrt(x, allRoots)"],description:"Compute the cubic root value. If x = y * y * y, then y is the cubic root of x. When `x` is a number or complex number, an optional second argument `allRoots` can be provided to return all three cubic roots. If not provided, the principal root is returned",examples:["cbrt(64)","cube(4)","cbrt(-8)","cbrt(2 + 3i)","cbrt(8i)","cbrt(8i, true)","cbrt(27 m^3)"],seealso:["square","sqrt","cube","multiply"]},vi={name:"ceil",category:"Arithmetic",syntax:["ceil(x)"],description:"Round a value towards plus infinity. If x is complex, both real and imaginary part are rounded towards plus infinity.",examples:["ceil(3.2)","ceil(3.8)","ceil(-4.2)"],seealso:["floor","fix","round"]},pi={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"]},di={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"]},hi={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"]},$u={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"]},gi={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"]},Vu={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"]},Ju={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"]},yi={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"]},Zu={name:"fix",category:"Arithmetic",syntax:["fix(x)"],description:"Round a value towards zero. If x is complex, both real and imaginary part are rounded towards zero.",examples:["fix(3.2)","fix(3.8)","fix(-4.2)","fix(-4.8)"],seealso:["ceil","floor","round"]},Ku={name:"floor",category:"Arithmetic",syntax:["floor(x)"],description:"Round a value towards minus infinity.If x is complex, both real and imaginary part are rounded towards minus infinity.",examples:["floor(3.2)","floor(3.8)","floor(-4.2)"],seealso:["ceil","fix","round"]},xi={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"]},bi={name:"hypot",category:"Arithmetic",syntax:["hypot(a, b, c, ...)","hypot([a, b, c, ...])"],description:"Calculate the hypotenusa of a list with values. ",examples:["hypot(3, 4)","sqrt(3^2 + 4^2)","hypot(-2)","hypot([3, 4, 5])"],seealso:["abs","norm"]},Ni={name:"invmod",category:"Arithmetic",syntax:["invmod(a, b)"],description:"Calculate the (modular) multiplicative inverse of a modulo b. Solution to the equation ax \u2263 1 (mod b)",examples:["invmod(8, 12)=NaN","invmod(7, 13)=2","math.invmod(15151, 15122)=10429"],seealso:["gcd","xgcd"]},wi={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"]},Mi={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"]},Ai={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"]},Yu={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"]},Si={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"]},Xu={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"]},Qu={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"]},_i={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")']},ju={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"]},ec={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"]},Ei={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)","math.pow([[1, 2], [4, 3]], 2)","math.pow([[1, 2], [4, 3]], -1)"],seealso:["multiply","nthRoot","nthRoots","sqrt"]},rc={name:"round",category:"Arithmetic",syntax:["round(x)","round(x, n)"],description:"round a value towards the nearest integer.If x is complex, both real and imaginary part are rounded towards the nearest integer. When n is specified, the value is rounded to n decimals.",examples:["round(3.2)","round(3.8)","round(-4.2)","round(-4.8)","round(pi, 3)","round(123.45678, 2)"],seealso:["ceil","floor","fix"]},tc={name:"sign",category:"Arithmetic",syntax:["sign(x)"],description:"Compute the sign of a value. The sign of a value x is 1 when x>1, -1 when x<0, and 0 when x=0.",examples:["sign(3.5)","sign(-4.2)","sign(0)"],seealso:["abs"]},Ci={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"]},nc={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([[1, 2], [3, 4]])"],seealso:["sqrt","abs","square","multiply"]},ac={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"]},Oi={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"]},ic={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"]},oc={name:"unaryPlus",category:"Operators",syntax:["+x","unaryPlus(x)"],description:"Converts booleans and strings to numbers.",examples:["+true",'+"2"'],seealso:["add","subtract","unaryMinus"]},Di={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"]},sc={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"]},uc={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"]},cc={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"]},lc={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"]},fc={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"]},mc={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"]},vc={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"]},pc={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"]},Bi={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"]},dc={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"]},hc={name:"stirlingS2",category:"Combinatorics",syntax:["stirlingS2(n, k)"],description:"he Stirling numbers of the second kind, counts the number of ways to partition a set of n labelled objects into k nonempty unlabelled subsets. `stirlingS2` only takes integer arguments. The following condition must be enforced: k <= n. If n = k or k = 1, then s(n,k) = 1.",examples:["stirlingS2(5, 3)"],seealso:["bellNumbers"]},gc={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"]},yc={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"]},xc={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"]},bc={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"]},Bn={name:"evaluate",category:"Expression",syntax:["evaluate(expression)","evaluate([expr1, expr2, expr3, ...])"],description:"Evaluate an expression or an array with expressions.",examples:['evaluate("2 + 3")','evaluate("sqrt(" + 4 + ")")'],seealso:[]},Nc={name:"help",category:"Expression",syntax:["help(object)","help(string)"],description:"Display documentation on a function or data type.",examples:["help(sqrt)",'help("complex")'],seealso:[]},ya={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:[]},Zn={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:[]},wc={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"]},Mc={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"]},Ac={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"]},Sc={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"]},bn={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"]},Ti={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"]},Ui={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"]},Ri={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"]},Ii={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"]},Fi={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"]},zi={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"]},Pi={name:"diff",category:"Matrix",syntax:["diff(arr)","diff(arr, dim)"],description:["Create a new matrix or array with the difference of the passed matrix or array.","Dim parameter is optional and used to indicant the dimension of the array/matrix to apply the difference","If no dimension parameter is passed it is assumed as dimension 0","Dimension is zero-based in javascript and one-based in the parser","Arrays must be 'rectangular' meaning arrays like [1, 2]","If something is passed as a matrix it will be returned as a matrix but other than that all matrices are converted to arrays"],examples:["diff([1, 2, 4, 7, 0])","diff([1, 2, 4, 7, 0], 0)","diff(matrix([1, 2, 4, 7, 0]))","diff([[1, 2], [3, 4]])","diff([[1, 2], [3, 4]], 0)","diff([[1, 2], [3, 4]], 1)","diff([[1, 2], [3, 4]], bignumber(1))","diff(matrix([[1, 2], [3, 4]]), 1)","diff([[1, 2], matrix([3, 4])], 1)"],seealso:["subtract","partitionSelect"]},Li={name:"dot",category:"Matrix",syntax:["dot(A, B)","A * B"],description:"Calculate the dot product of two vectors. The dot product of A = [a1, a2, a3, ..., an] and B = [b1, b2, b3, ..., bn] is defined as dot(A, B) = a1 * b1 + a2 * b2 + a3 * b3 + ... + an * bn",examples:["dot([2, 4, 1], [2, 2, 3])","[2, 4, 1] * [2, 2, 3]"],seealso:["multiply","cross"]},_c={name:"eigs",category:"Matrix",syntax:["eigs(x)"],description:"Calculate the eigenvalues and eigenvectors of a real symmetric matrix",examples:["eigs([[5, 2.3], [2.3, 1]])"],seealso:["inv"]},Ec={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"]},qi={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"]},Cc={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"]},Oc={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"]},Wi={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"]},Dc={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"]},Bc={name:"pinv",category:"Matrix",syntax:["pinv(x)"],description:"Calculate the Moore\u2013Penrose inverse of a matrix",examples:["pinv([1, 2; 3, 4])","pinv([[1, 0], [0, 1], [0, 1]])","pinv(4)"],seealso:["inv"]},Kt={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"]},Gi={name:"map",category:"Matrix",syntax:["map(x, callback)"],description:"Create a new matrix or array with the results of the callback function executed on each entry of the matrix/array.",examples:["map([1, 2, 3], square)"],seealso:["filter","forEach"]},Hi={name:"matrixFromColumns",category:"Matrix",syntax:["math.matrixFromColumns(...arr)","math.matrixFromColumns(row1, row2)","math.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"]},Tc={name:"matrixFromFunction",category:"Matrix",syntax:["math.matrixFromFunction(size, fn)","math.matrixFromFunction(size, fn, format)","math.matrixFromFunction(size, fn, format, datatype)","math.matrixFromFunction(size, format, fn)","math.matrixFromFunction(size, format, datatype, fn)"],description:"Create a matrix by evaluating a generating function at each index.",examples:["f(I) = I[1] - I[2]","matrixFromFunction([3,3], f)","g(I) = I[1] - I[2] == 1 ? 4 : 0",'matrixFromFunction([100, 100], "sparse", g)',"matrixFromFunction([5], random)"],seealso:["matrix","matrixFromRows","matrixFromColumns","zeros"]},Uc={name:"matrixFromRows",category:"Matrix",syntax:["math.matrixFromRows(...arr)","math.matrixFromRows(row1, row2)","math.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"]},ki={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"]},Rc={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)'],seealso:["sort"]},Ic={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")',"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"]},Fc={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])"],seealso:["size","squeeze","resize"]},$i={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"]},zc={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], math.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"]},Pc={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"]},Vi={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"]},Lc={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"]},qc={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"])',"sortByLength(a, b) = size(a)[1] - size(b)[1]",'sort(["Langdon", "Tom", "Sara"], sortByLength)','sort(["10", "1", "2"], "natural")'],seealso:["map","filter","forEach"]},Ji={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"]},Wc={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"]},Gc={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"]},Zi={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"]},Hc={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"]},kc={name:"fft",category:"Matrix",syntax:["fft(x)"],description:"Calculate N-dimensional fourier transform",examples:["fft([[1, 0], [1, 0]])"],seealso:["ifft"]},Ki={name:"ifft",category:"Matrix",syntax:["ifft(x)"],description:"Calculate N-dimensional inverse fourier transform",examples:["ifft([[2, 2], [0, 0]])"],seealso:["fft"]},$c={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"]},Vc={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"]},$t={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"]},Jc={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"]},Kn={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(math.i)","lgamma(complex(1.1, 2))"],seealso:["gamma"]},Zc={name:"kldivergence",category:"Probability",syntax:["kldivergence(x, y)"],description:"Calculate the Kullback-Leibler (KL) divergence between two distributions.",examples:["kldivergence([0.7,0.5,0.4], [0.2,0.9,0.5])"],seealso:[]},Kc={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"]},dm={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"]},Yc={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"]},Xc={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"]},Qc={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"]},jc={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"]},el={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"]},Yt={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"]},Nn={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"]},rl={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"]},Yi={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"]},tl={name:"larger",category:"Relational",syntax:["x > y","larger(x, y)"],description:"Check if value x is larger than y. Returns true if x is larger than y, and false if not.",examples:["2 > 3","5 > 2*2","a = 3.3","b = 6-2.8","(a > b)","(b < a)","5 cm > 2 inch"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compare"]},nl={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"]},Xi={name:"smaller",category:"Relational",syntax:["x < y","smaller(x, y)"],description:"Check if value x is smaller than value y. Returns true if x is smaller than y, and false if not.",examples:["2 < 3","5 < 2*2","a = 3.3","b = 6-2.8","(a < b)","5 cm < 2 inch"],seealso:["equal","unequal","larger","smallerEq","largerEq","compare"]},al={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"]},il={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"]},ol={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"]},sl={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"]},ul={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"]},Qi={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"]},ji={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"]},cl={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"]},ll={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"]},fl={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"]},eo={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"]},ml={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"]},vl={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:[]},ro={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"]},pl={name:"max",category:"Statistics",syntax:["max(a, b, c, ...)","max(A)","max(A, dim)"],description:"Compute the maximum value of a list of values.",examples:["max(2, 3, 4, 1)","max([2, 3, 4, 1])","max([2, 5; 4, 3])","max([2, 5; 4, 3], 1)","max([2, 5; 4, 3], 2)","max(2.7, 7.1, -4.5, 2.0, 4.1)","min(2.7, 7.1, -4.5, 2.0, 4.1)"],seealso:["mean","median","min","prod","std","sum","variance"]},dl={name:"mean",category:"Statistics",syntax:["mean(a, b, c, ...)","mean(A)","mean(A, dim)"],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"]},to={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"]},hl={name:"min",category:"Statistics",syntax:["min(a, b, c, ...)","min(A)","min(A, dim)"],description:"Compute the minimum value of a list of values.",examples:["min(2, 3, 4, 1)","min([2, 3, 4, 1])","min([2, 5; 4, 3])","min([2, 5; 4, 3], 1)","min([2, 5; 4, 3], 2)","min(2.7, 7.1, -4.5, 2.0, 4.1)","max(2.7, 7.1, -4.5, 2.0, 4.1)"],seealso:["max","mean","median","prod","std","sum","variance"]},gl={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"]},no={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"]},yl={name:"quantileSeq",category:"Statistics",syntax:["quantileSeq(A, prob[, sorted])","quantileSeq(A, [prob1, prob2, ...][, sorted])","quantileSeq(A, N[, sorted])"],description:`Compute the prob order quantile of a matrix or a list with values. The sequence is sorted and the middle value is returned. Supported types of sequence values are: Number, BigNumber, Unit Supported types of probablity are: Number, BigNumber.
40
-
41
- In case of a (multi dimensional) array or matrix, the prob order quantile of all elements will be calculated.`,examples:["quantileSeq([3, -1, 5, 7], 0.5)","quantileSeq([3, -1, 5, 7], [1/3, 2/3])","quantileSeq([3, -1, 5, 7], 2)","quantileSeq([-1, 3, 5, 7], 0.5, true)"],seealso:["mean","median","min","max","prod","std","sum","variance"]},xl={name:"std",category:"Statistics",syntax:["std(a, b, c, ...)","std(A)","std(A, 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"]},ao={name:"cumsum",category:"Statistics",syntax:["cumsum(a, b, c, ...)","cumsum(A)"],description:"Compute the cumulative sum of all values.",examples:["cumsum(2, 3, 4, 1)","cumsum([2, 3, 4, 1])","cumsum([1, 2; 3, 4])","cumsum([1, 2; 3, 4], 1)","cumsum([1, 2; 3, 4], 2)"],seealso:["max","mean","median","min","prod","std","sum","variance"]},bl={name:"sum",category:"Statistics",syntax:["sum(a, b, c, ...)","sum(A)"],description:"Compute the sum of all values.",examples:["sum(2, 3, 4, 1)","sum([2, 3, 4, 1])","sum([2, 5; 4, 3])"],seealso:["max","mean","median","min","prod","std","sum","variance"]},Nl={name:"variance",category:"Statistics",syntax:["variance(a, b, c, ...)","variance(A)","variance(A, 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"]},Tn={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"]},wl={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"]},io={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"]},oo={name:"acoth",category:"Trigonometry",syntax:["acoth(x)"],description:"Calculate the hyperbolic arccotangent of a value, defined as `acoth(x) = (ln((x+1)/x) + ln(x/(x-1))) / 2`.",examples:["acoth(2)","acoth(0.5)"],seealso:["acsch","asech"]},so={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"]},uo={name:"acsch",category:"Trigonometry",syntax:["acsch(x)"],description:"Calculate the hyperbolic arccosecant of a value, defined as `acsch(x) = ln(1/x + sqrt(1/x^2 + 1))`.",examples:["acsch(0.5)"],seealso:["asech","acoth"]},co={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"]},Ml={name:"asech",category:"Trigonometry",syntax:["asech(x)"],description:"Calculate the inverse secant of a value.",examples:["asech(0.5)"],seealso:["acsch","acoth"]},Al={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"]},lo={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"]},Sl={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"]},_l={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"]},fo={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"]},El={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"]},Cl={name:"cosh",category:"Trigonometry",syntax:["cosh(x)"],description:"Compute the hyperbolic cosine of x in radians.",examples:["cosh(0.5)"],seealso:["sinh","tanh","coth"]},xa={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"]},mo={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"]},wn={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"]},vo={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"]},Ol={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"]},Dl={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"]},po={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"]},Yn={name:"sinh",category:"Trigonometry",syntax:["sinh(x)"],description:"Compute the hyperbolic sine of x in radians.",examples:["sinh(0.5)"],seealso:["cosh","tanh"]},ho={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"]},Bl={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"]},Tl={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:[]},go={name:"bin",category:"Utils",syntax:["bin(value)"],description:"Format a number as binary",examples:["bin(2)"],seealso:["oct","hex"]},Ul={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:[]},Rl={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"]},yo={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"]},Il={name:"hex",category:"Utils",syntax:["hex(value)"],description:"Format a number as hexadecimal",examples:["hex(240)"],seealso:["bin","oct"]},Fl={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"]},xo={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"]},zl={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"]},Pl={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"]},Ll={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"]},ql={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"]},Wl={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"]},Gl={name:"numeric",category:"Utils",syntax:["numeric(x)"],description:"Convert a numeric input to a specific numeric type: number, BigNumber, or Fraction.",examples:['numeric("4")','numeric("4", "number")','numeric("4", "BigNumber")','numeric("4", "Fraction)','numeric(4, "Fraction")','numeric(fraction(2, 5), "number)'],seealso:["number","fraction","bignumber","string","format"]},Hl={name:"oct",category:"Utils",syntax:["oct(value)"],description:"Format a number as octal",examples:["oct(56)"],seealso:["bin","hex"]},ba={name:"print",category:"Utils",syntax:["print(template, values)","print(template, values, precision)"],description:"Interpolate values into a string template.",examples:['print("Lucy is $age years old", {age: 5})','print("The value of pi is $pi", {pi: pi}, 3)','print("Hello, $user.name!", {user: {name: "John"}})','print("Values: $0, $1, $2", [6, 9, 4])'],seealso:["format"]},bo={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"]},No={bignumber:Za,boolean:Ka,complex:Ya,createUnit:Xa,fraction:Qa,index:Uu,matrix:ja,number:ei,sparse:Ru,splitUnit:ri,string:ti,unit:ga,e:Wa,E:Wa,false:Du,i:da,Infinity:Jn,LN2:ha,LN10:Bu,LOG2E:Ut,LOG10E:Mr,NaN:Zt,null:Ga,pi:ka,PI:ka,phi:Ha,SQRT1_2:$a,SQRT2:Tu,tau:Va,true:Ja,version:Dn,speedOfLight:{description:"Speed of light in vacuum",examples:["speedOfLight"]},gravitationConstant:{description:"Newtonian constant of gravitation",examples:["gravitationConstant"]},planckConstant:{description:"Planck constant",examples:["planckConstant"]},reducedPlanckConstant:{description:"Reduced Planck constant",examples:["reducedPlanckConstant"]},magneticConstant:{description:"Magnetic constant (vacuum permeability)",examples:["magneticConstant"]},electricConstant:{description:"Electric constant (vacuum permeability)",examples:["electricConstant"]},vacuumImpedance:{description:"Characteristic impedance of vacuum",examples:["vacuumImpedance"]},coulomb:{description:"Coulomb's constant",examples:["coulomb"]},elementaryCharge:{description:"Elementary charge",examples:["elementaryCharge"]},bohrMagneton:{description:"Borh magneton",examples:["bohrMagneton"]},conductanceQuantum:{description:"Conductance quantum",examples:["conductanceQuantum"]},inverseConductanceQuantum:{description:"Inverse conductance quantum",examples:["inverseConductanceQuantum"]},magneticFluxQuantum:{description:"Magnetic flux quantum",examples:["magneticFluxQuantum"]},nuclearMagneton:{description:"Nuclear magneton",examples:["nuclearMagneton"]},klitzing:{description:"Von Klitzing constant",examples:["klitzing"]},bohrRadius:{description:"Borh radius",examples:["bohrRadius"]},classicalElectronRadius:{description:"Classical electron radius",examples:["classicalElectronRadius"]},electronMass:{description:"Electron mass",examples:["electronMass"]},fermiCoupling:{description:"Fermi coupling constant",examples:["fermiCoupling"]},fineStructure:{description:"Fine-structure constant",examples:["fineStructure"]},hartreeEnergy:{description:"Hartree energy",examples:["hartreeEnergy"]},protonMass:{description:"Proton mass",examples:["protonMass"]},deuteronMass:{description:"Deuteron Mass",examples:["deuteronMass"]},neutronMass:{description:"Neutron mass",examples:["neutronMass"]},quantumOfCirculation:{description:"Quantum of circulation",examples:["quantumOfCirculation"]},rydberg:{description:"Rydberg constant",examples:["rydberg"]},thomsonCrossSection:{description:"Thomson cross section",examples:["thomsonCrossSection"]},weakMixingAngle:{description:"Weak mixing angle",examples:["weakMixingAngle"]},efimovFactor:{description:"Efimov factor",examples:["efimovFactor"]},atomicMass:{description:"Atomic mass constant",examples:["atomicMass"]},avogadro:{description:"Avogadro's number",examples:["avogadro"]},boltzmann:{description:"Boltzmann constant",examples:["boltzmann"]},faraday:{description:"Faraday constant",examples:["faraday"]},firstRadiation:{description:"First radiation constant",examples:["firstRadiation"]},loschmidt:{description:"Loschmidt constant at T=273.15 K and p=101.325 kPa",examples:["loschmidt"]},gasConstant:{description:"Gas constant",examples:["gasConstant"]},molarPlanckConstant:{description:"Molar Planck constant",examples:["molarPlanckConstant"]},molarVolume:{description:"Molar volume of an ideal gas at T=273.15 K and p=101.325 kPa",examples:["molarVolume"]},sackurTetrode:{description:"Sackur-Tetrode constant at T=1 K and p=101.325 kPa",examples:["sackurTetrode"]},secondRadiation:{description:"Second radiation constant",examples:["secondRadiation"]},stefanBoltzmann:{description:"Stefan-Boltzmann constant",examples:["stefanBoltzmann"]},wienDisplacement:{description:"Wien displacement law constant",examples:["wienDisplacement"]},molarMass:{description:"Molar mass constant",examples:["molarMass"]},molarMassC12:{description:"Molar mass constant of carbon-12",examples:["molarMassC12"]},gravity:{description:"Standard acceleration of gravity (standard acceleration of free-fall on Earth)",examples:["gravity"]},planckLength:{description:"Planck length",examples:["planckLength"]},planckMass:{description:"Planck mass",examples:["planckMass"]},planckTime:{description:"Planck time",examples:["planckTime"]},planckCharge:{description:"Planck charge",examples:["planckCharge"]},planckTemperature:{description:"Planck temperature",examples:["planckTemperature"]},derivative:ii,lsolve:Fu,lsolveAll:si,lup:zu,lusolve:Pu,leafCount:oi,resolve:qu,simplify:ci,simplifyCore:Wu,symbolicEqual:ft,rationalize:Lu,slu:Gu,usolve:Hu,usolveAll:ku,qr:ui,abs:li,add:fi,cbrt:mi,ceil:vi,cube:pi,divide:di,dotDivide:hi,dotMultiply:$u,dotPow:gi,exp:Vu,expm:Ju,expm1:yi,fix:Zu,floor:Ku,gcd:xi,hypot:bi,lcm:wi,log:Mi,log2:Si,log1p:Yu,log10:Ai,mod:Xu,multiply:Qu,norm:_i,nthRoot:ju,nthRoots:ec,pow:Ei,round:rc,sign:tc,sqrt:Ci,sqrtm:nc,square:ac,subtract:Oi,unaryMinus:ic,unaryPlus:oc,xgcd:Di,invmod:Ni,bitAnd:sc,bitNot:uc,bitOr:cc,bitXor:lc,leftShift:fc,rightArithShift:mc,rightLogShift:vc,bellNumbers:pc,catalan:Bi,composition:dc,stirlingS2:hc,config:Iu,import:ni,typed:ai,arg:gc,conj:yc,re:bc,im:xc,evaluate:Bn,help:Nc,distance:ya,intersect:Zn,and:wc,not:Mc,or:Ac,xor:Sc,concat:Ti,count:Ui,cross:Ri,column:bn,ctranspose:Ii,det:Fi,diag:zi,diff:Pi,dot:Li,getMatrixDataType:Oc,identity:Wi,filter:Ec,flatten:qi,forEach:Cc,inv:Dc,pinv:Bc,eigs:_c,kron:Kt,matrixFromFunction:Tc,matrixFromRows:Uc,matrixFromColumns:Hi,map:Gi,ones:ki,partitionSelect:Rc,range:Ic,resize:$i,reshape:Fc,rotate:zc,rotationMatrix:Pc,row:Vi,size:Lc,sort:qc,squeeze:Ji,subset:Wc,trace:Gc,transpose:Zi,zeros:Hc,fft:kc,ifft:Ki,combinations:$c,combinationsWithRep:Vc,factorial:$t,gamma:Jc,kldivergence:Zc,lgamma:Kn,multinomial:Kc,permutations:dm,pickRandom:Yc,random:Xc,randomInt:Qc,compare:jc,compareNatural:el,compareText:Yt,deepEqual:Nn,equal:rl,equalText:Yi,larger:tl,largerEq:nl,smaller:Xi,smallerEq:al,unequal:il,setCartesian:ol,setDifference:sl,setDistinct:ul,setIntersect:Qi,setIsSubset:ji,setMultiplicity:cl,setPowerset:ll,setSize:fl,setSymDifference:eo,setUnion:ml,erf:vl,cumsum:ao,mad:ro,max:pl,mean:dl,median:to,min:hl,mode:gl,prod:no,quantileSeq:yl,std:xl,sum:bl,variance:Nl,acos:Tn,acosh:wl,acot:io,acoth:oo,acsc:so,acsch:uo,asec:co,asech:Ml,asin:Al,asinh:lo,atan:Sl,atanh:fo,atan2:_l,cos:El,cosh:Cl,cot:xa,coth:mo,csc:wn,csch:vo,sec:Ol,sech:Dl,sin:po,sinh:Yn,tan:ho,tanh:Bl,to:Tl,clone:Ul,format:Rl,bin:go,oct:Hl,hex:Il,isNaN:xo,isInteger:Fl,isNegative:zl,isNumeric:Pl,hasNumericValue:yo,isPositive:Ll,isPrime:ql,isZero:Wl,print:ba,typeOf:bo,numeric:Gl},Na="help",wo=["typed","mathWithTransform","Help"],Mo=(0,Te.d5)(Na,wo,xe=>{var{typed:ce,mathWithTransform:F,Help:U}=xe;return ce(Na,{any:function(_){var R,q=_;if(typeof _!="string"){for(R in F)if((0,Pe.nr)(F,R)&&_===F[R]){q=R;break}}var W=(0,ne.YF)(No,q);if(!W){var G=typeof q=="function"?q.name:q;throw new Error('No documentation found on "'+G+'"')}return new U(W)}})}),kl="Parser",$l=["evaluate"],Vl=(0,Te.d5)(kl,$l,xe=>{var{evaluate:ce}=xe;function F(){if(!(this instanceof F))throw new SyntaxError("Constructor must be called with the new operator");Object.defineProperty(this,"scope",{value:(0,Se.dg)(),writable:!1})}return F.prototype.type="Parser",F.prototype.isParser=!0,F.prototype.evaluate=function(U){return ce(U,this.scope)},F.prototype.get=function(U){if(this.scope.has(U))return this.scope.get(U)},F.prototype.getAll=function(){return(0,Se.ru)(this.scope)},F.prototype.getAllAsMap=function(){return this.scope},F.prototype.set=function(U,y){return this.scope.set(U,y),y},F.prototype.remove=function(U){this.scope.delete(U)},F.prototype.clear=function(){this.scope.clear()},F},{isClass:!0}),wa=ie(36041),Ao="rationalize",Jl=["config","typed","equal","isZero","add","subtract","multiply","divide","pow","parse","simplifyCore","simplify","?bignumber","?fraction","mathWithTransform","matrix","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","SymbolNode","ParenthesisNode"],Zl=(0,Te.d5)(Ao,Jl,xe=>{var{config:ce,typed:F,equal:U,isZero:y,add:_,subtract:R,multiply:q,divide:W,pow:G,parse:k,simplifyCore:oe,simplify:Ee,fraction:er,bignumber:He,mathWithTransform:gr,matrix:Nr,AccessorNode:Br,ArrayNode:ar,ConstantNode:pe,FunctionNode:Z,IndexNode:me,ObjectNode:se,OperatorNode:je,SymbolNode:dr,ParenthesisNode:hr}=xe,or=pt({typed:F,config:ce,mathWithTransform:gr,matrix:Nr,fraction:er,bignumber:He,AccessorNode:Br,ArrayNode:ar,ConstantNode:pe,FunctionNode:Z,IndexNode:me,ObjectNode:se,OperatorNode:je,SymbolNode:dr});return F(Ao,{string:function(ae){return this(k(ae),{},!1)},"string, boolean":function(ae,xr){return this(k(ae),{},xr)},"string, Object":function(ae,xr){return this(k(ae),xr,!1)},"string, Object, boolean":function(ae,xr,_r){return this(k(ae),xr,_r)},Node:function(ae){return this(ae,{},!1)},"Node, boolean":function(ae,xr){return this(ae,{},xr)},"Node, Object":function(ae,xr){return this(ae,xr,!1)},"Node, Object, boolean":function(ae,xr,_r){var Tr=_e(),Xr=Fr(ae,xr,!0,Tr.firstRules),jr=Xr.variables.length,Cr={exactFractions:!1},et={exactFractions:!0};if(ae=Xr.expression,jr>=1){ae=ke(ae);var rt,ut,Mt=!0,bt=!1;ae=Ee(ae,Tr.firstRules,{},Cr);for(var Zr;ut=Mt?Tr.distrDivRules:Tr.sucDivRules,ae=Ee(ae,ut,{},et),Mt=!Mt,Zr=ae.toString(),Zr!==rt;)bt=!0,rt=Zr;bt&&(ae=Ee(ae,Tr.firstRulesAgain,{},Cr)),ae=Ee(ae,Tr.finalRules,{},Cr)}var ct=[],$r={};return ae.type==="OperatorNode"&&ae.isBinary()&&ae.op==="/"?(jr===1&&(ae.args[0]=at(ae.args[0],ct),ae.args[1]=at(ae.args[1])),_r&&($r.numerator=ae.args[0],$r.denominator=ae.args[1])):(jr===1&&(ae=at(ae,ct)),_r&&($r.numerator=ae,$r.denominator=null)),_r?($r.coefficients=ct,$r.variables=Xr.variables,$r.expression=ae,$r):ae}});function Fr(Ne,ae,xr,_r){var Tr=[],Xr=Ee(Ne,_r,ae,{exactFractions:!1});xr=!!xr;var jr="+-*"+(xr?"/":"");et(Xr);var Cr={};return Cr.expression=Xr,Cr.variables=Tr,Cr;function et(rt){var ut=rt.type;if(ut==="FunctionNode")throw new Error("There is an unsolved function call");if(ut==="OperatorNode")if(rt.op==="^"){if(rt.args[1].type!=="ConstantNode"||!(0,wa.U)(parseFloat(rt.args[1].value)))throw new Error("There is a non-integer exponent");et(rt.args[0])}else{if(jr.indexOf(rt.op)===-1)throw new Error("Operator "+rt.op+" invalid in polynomial expression");for(var Mt=0;Mt<rt.args.length;Mt++)et(rt.args[Mt])}else if(ut==="SymbolNode"){var bt=rt.name,Zr=Tr.indexOf(bt);Zr===-1&&Tr.push(bt)}else if(ut==="ParenthesisNode")et(rt.content);else if(ut!=="ConstantNode")throw new Error("type "+ut+" is not allowed in polynomial expression")}}function _e(){var Ne=[oe,{l:"n+n",r:"2*n"},{l:"n+-n",r:"0"},or,{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"}],ae=[{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)"}],xr=[{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))"}],Tr={};return Tr.firstRules=Ne.concat(ae,_r),Tr.distrDivRules=xr,Tr.sucDivRules=_r,Tr.firstRulesAgain=Ne.concat(ae),Tr.finalRules=[oe,{l:"n*-n",r:"-n^2"},{l:"n*n",r:"n^2"},or,{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))"}],Tr}function ke(Ne,ae,xr){var _r=Ne.type,Tr=arguments.length>1;if(_r==="OperatorNode"&&Ne.isBinary()){var Xr=!1,jr;if(Ne.op==="^"&&(Ne.args[0].type==="ParenthesisNode"||Ne.args[0].type==="OperatorNode")&&Ne.args[1].type==="ConstantNode"&&(jr=parseFloat(Ne.args[1].value),Xr=jr>=2&&(0,wa.U)(jr)),Xr){if(jr>2){var Cr=Ne.args[0],et=new je("^","pow",[Ne.args[0].cloneDeep(),new pe(jr-1)]);Ne=new je("*","multiply",[Cr,et])}else Ne=new je("*","multiply",[Ne.args[0],Ne.args[0].cloneDeep()]);Tr&&(xr==="content"?ae.content=Ne:ae.args[xr]=Ne)}}if(_r==="ParenthesisNode")ke(Ne.content,Ne,"content");else if(_r!=="ConstantNode"&&_r!=="SymbolNode")for(var rt=0;rt<Ne.args.length;rt++)ke(Ne.args[rt],Ne,rt);if(!Tr)return Ne}function at(Ne,ae){ae===void 0&&(ae=[]),ae[0]=0;var xr={};xr.cte=1,xr.oper="+",xr.fire="";var _r=0,Tr="";bt(Ne,null,xr),_r=ae.length-1;for(var Xr=!0,jr,Cr=_r;Cr>=0;Cr--)if(ae[Cr]!==0){var et=new pe(Xr?ae[Cr]:Math.abs(ae[Cr])),rt=ae[Cr]<0?"-":"+";if(Cr>0){var ut=new dr(Tr);if(Cr>1){var Mt=new pe(Cr);ut=new je("^","pow",[ut,Mt])}ae[Cr]===-1&&Xr?et=new je("-","unaryMinus",[ut]):Math.abs(ae[Cr])===1?et=ut:et=new je("*","multiply",[et,ut])}Xr?jr=et:rt==="+"?jr=new je("+","add",[jr,et]):jr=new je("-","subtract",[jr,et]),Xr=!1}if(Xr)return new pe(0);return jr;function bt(Zr,ct,$r){var xt=Zr.type;if(xt==="FunctionNode")throw new Error("There is an unsolved function call");if(xt==="OperatorNode"){if("+-*^".indexOf(Zr.op)===-1)throw new Error("Operator "+Zr.op+" invalid");if(ct!==null){if((Zr.fn==="unaryMinus"||Zr.fn==="pow")&&ct.fn!=="add"&&ct.fn!=="subtract"&&ct.fn!=="multiply")throw new Error("Invalid "+Zr.op+" placing");if((Zr.fn==="subtract"||Zr.fn==="add"||Zr.fn==="multiply")&&ct.fn!=="add"&&ct.fn!=="subtract")throw new Error("Invalid "+Zr.op+" placing");if((Zr.fn==="subtract"||Zr.fn==="add"||Zr.fn==="unaryMinus")&&$r.noFil!==0)throw new Error("Invalid "+Zr.op+" placing")}(Zr.op==="^"||Zr.op==="*")&&($r.fire=Zr.op);for(var qt=0;qt<Zr.args.length;qt++)Zr.fn==="unaryMinus"&&($r.oper="-"),(Zr.op==="+"||Zr.fn==="subtract")&&($r.fire="",$r.cte=1,$r.oper=qt===0?"+":Zr.op),$r.noFil=qt,bt(Zr.args[qt],Zr,$r)}else if(xt==="SymbolNode"){if(Zr.name!==Tr&&Tr!=="")throw new Error("There is more than one variable");if(Tr=Zr.name,ct===null){ae[1]=1;return}if(ct.op==="^"&&$r.noFil!==0)throw new Error("In power the variable should be the first parameter");if(ct.op==="*"&&$r.noFil!==1)throw new Error("In multiply the variable should be the second parameter");($r.fire===""||$r.fire==="*")&&(_r<1&&(ae[1]=0),ae[1]+=$r.cte*($r.oper==="+"?1:-1),_r=Math.max(1,_r))}else if(xt==="ConstantNode"){var Rt=parseFloat(Zr.value);if(ct===null){ae[0]=Rt;return}if(ct.op==="^"){if($r.noFil!==1)throw new Error("Constant cannot be powered");if(!(0,wa.U)(Rt)||Rt<=0)throw new Error("Non-integer exponent is not allowed");for(var nn=_r+1;nn<Rt;nn++)ae[nn]=0;Rt>_r&&(ae[Rt]=0),ae[Rt]+=$r.cte*($r.oper==="+"?1:-1),_r=Math.max(Rt,_r);return}$r.cte=Rt,$r.fire===""&&(ae[0]+=$r.cte*($r.oper==="+"?1:-1))}else throw new Error("Type "+xt+" is not allowed")}}}),So="derivative",Kl=["typed","config","parse","simplify","equal","isZero","numeric","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode","SymbolNode"],Yl=(0,Te.d5)(So,Kl,xe=>{var{typed:ce,config:F,parse:U,simplify:y,equal:_,isZero:R,numeric:q,ConstantNode:W,FunctionNode:G,OperatorNode:k,ParenthesisNode:oe,SymbolNode:Ee}=xe,er=ce("derivative",{"Node, SymbolNode, Object":function(Z,me,se){var je={};gr(je,Z,me.name);var dr=Nr(Z,je);return se.simplify?y(dr):dr},"Node, SymbolNode":function(Z,me){return this(Z,me,{simplify:!0})},"string, SymbolNode":function(Z,me){return this(U(Z),me)},"string, SymbolNode, Object":function(Z,me,se){return this(U(Z),me,se)},"string, string":function(Z,me){return this(U(Z),U(me))},"string, string, Object":function(Z,me,se){return this(U(Z),U(me),se)},"Node, string":function(Z,me){return this(Z,U(me))},"Node, string, Object":function(Z,me,se){return this(Z,U(me),se)}});er._simplify=!0,er.toTex=function(pe){return He.apply(null,pe.args)};var He=ce("_derivTex",{"Node, SymbolNode":function(Z,me){return(0,A.nu)(Z)&&(0,A.kM)(Z.value)==="string"?He(U(Z.value).toString(),me.toString(),1):He(Z.toTex(),me.toString(),1)},"Node, ConstantNode":function(Z,me){if((0,A.kM)(me.value)==="string")return He(Z,U(me.value));throw new Error("The second parameter to 'derivative' is a non-string constant")},"Node, SymbolNode, ConstantNode":function(Z,me,se){return He(Z.toString(),me.name,se.value)},"string, string, number":function(Z,me,se){var je;return se===1?je="{d\\over d"+me+"}":je="{d^{"+se+"}\\over d"+me+"^{"+se+"}}",je+"\\left[".concat(Z,"\\right]")}}),gr=ce("constTag",{"Object, ConstantNode, string":function(Z,me){return Z[me]=!0,!0},"Object, SymbolNode, string":function(Z,me,se){return me.name!==se?(Z[me]=!0,!0):!1},"Object, ParenthesisNode, string":function(Z,me,se){return gr(Z,me.content,se)},"Object, FunctionAssignmentNode, string":function(Z,me,se){return me.params.indexOf(se)===-1?(Z[me]=!0,!0):gr(Z,me.expr,se)},"Object, FunctionNode | OperatorNode, string":function(Z,me,se){if(me.args.length>0){for(var je=gr(Z,me.args[0],se),dr=1;dr<me.args.length;++dr)je=gr(Z,me.args[dr],se)&&je;if(je)return Z[me]=!0,!0}return!1}}),Nr=ce("_derivative",{"ConstantNode, Object":function(Z){return ar(0)},"SymbolNode, Object":function(Z,me){return me[Z]!==void 0?ar(0):ar(1)},"ParenthesisNode, Object":function(Z,me){return new oe(Nr(Z.content,me))},"FunctionAssignmentNode, Object":function(Z,me){return me[Z]!==void 0?ar(0):Nr(Z.expr,me)},"FunctionNode, Object":function(Z,me){if(Z.args.length!==1&&Br(Z),me[Z]!==void 0)return ar(0);var se=Z.args[0],je,dr=!1,hr=!1,or;switch(Z.name){case"cbrt":dr=!0,or=new k("*","multiply",[ar(3),new k("^","pow",[se,new k("/","divide",[ar(2),ar(3)])])]);break;case"sqrt":case"nthRoot":if(Z.args.length===1)dr=!0,or=new k("*","multiply",[ar(2),new G("sqrt",[se])]);else if(Z.args.length===2)return je=new k("/","divide",[ar(1),Z.args[1]]),me[je]=me[Z.args[1]],Nr(new k("^","pow",[se,je]),me);break;case"log10":je=ar(10);case"log":if(!je&&Z.args.length===1)or=se.clone(),dr=!0;else if(Z.args.length===1&&je||Z.args.length===2&&me[Z.args[1]]!==void 0)or=new k("*","multiply",[se.clone(),new G("log",[je||Z.args[1]])]),dr=!0;else if(Z.args.length===2)return Nr(new k("/","divide",[new G("log",[se]),new G("log",[Z.args[1]])]),me);break;case"pow":return me[je]=me[Z.args[1]],Nr(new k("^","pow",[se,Z.args[1]]),me);case"exp":or=new G("exp",[se.clone()]);break;case"sin":or=new G("cos",[se.clone()]);break;case"cos":or=new k("-","unaryMinus",[new G("sin",[se.clone()])]);break;case"tan":or=new k("^","pow",[new G("sec",[se.clone()]),ar(2)]);break;case"sec":or=new k("*","multiply",[Z,new G("tan",[se.clone()])]);break;case"csc":hr=!0,or=new k("*","multiply",[Z,new G("cot",[se.clone()])]);break;case"cot":hr=!0,or=new k("^","pow",[new G("csc",[se.clone()]),ar(2)]);break;case"asin":dr=!0,or=new G("sqrt",[new k("-","subtract",[ar(1),new k("^","pow",[se.clone(),ar(2)])])]);break;case"acos":dr=!0,hr=!0,or=new G("sqrt",[new k("-","subtract",[ar(1),new k("^","pow",[se.clone(),ar(2)])])]);break;case"atan":dr=!0,or=new k("+","add",[new k("^","pow",[se.clone(),ar(2)]),ar(1)]);break;case"asec":dr=!0,or=new k("*","multiply",[new G("abs",[se.clone()]),new G("sqrt",[new k("-","subtract",[new k("^","pow",[se.clone(),ar(2)]),ar(1)])])]);break;case"acsc":dr=!0,hr=!0,or=new k("*","multiply",[new G("abs",[se.clone()]),new G("sqrt",[new k("-","subtract",[new k("^","pow",[se.clone(),ar(2)]),ar(1)])])]);break;case"acot":dr=!0,hr=!0,or=new k("+","add",[new k("^","pow",[se.clone(),ar(2)]),ar(1)]);break;case"sinh":or=new G("cosh",[se.clone()]);break;case"cosh":or=new G("sinh",[se.clone()]);break;case"tanh":or=new k("^","pow",[new G("sech",[se.clone()]),ar(2)]);break;case"sech":hr=!0,or=new k("*","multiply",[Z,new G("tanh",[se.clone()])]);break;case"csch":hr=!0,or=new k("*","multiply",[Z,new G("coth",[se.clone()])]);break;case"coth":hr=!0,or=new k("^","pow",[new G("csch",[se.clone()]),ar(2)]);break;case"asinh":dr=!0,or=new G("sqrt",[new k("+","add",[new k("^","pow",[se.clone(),ar(2)]),ar(1)])]);break;case"acosh":dr=!0,or=new G("sqrt",[new k("-","subtract",[new k("^","pow",[se.clone(),ar(2)]),ar(1)])]);break;case"atanh":dr=!0,or=new k("-","subtract",[ar(1),new k("^","pow",[se.clone(),ar(2)])]);break;case"asech":dr=!0,hr=!0,or=new k("*","multiply",[se.clone(),new G("sqrt",[new k("-","subtract",[ar(1),new k("^","pow",[se.clone(),ar(2)])])])]);break;case"acsch":dr=!0,hr=!0,or=new k("*","multiply",[new G("abs",[se.clone()]),new G("sqrt",[new k("+","add",[new k("^","pow",[se.clone(),ar(2)]),ar(1)])])]);break;case"acoth":dr=!0,hr=!0,or=new k("-","subtract",[ar(1),new k("^","pow",[se.clone(),ar(2)])]);break;case"abs":or=new k("/","divide",[new G(new Ee("abs"),[se.clone()]),se.clone()]);break;case"gamma":default:throw new Error('Function "'+Z.name+'" is not supported by derivative, or a wrong number of arguments is passed')}var Fr,_e;dr?(Fr="/",_e="divide"):(Fr="*",_e="multiply");var ke=Nr(se,me);return hr&&(ke=new k("-","unaryMinus",[ke])),new k(Fr,_e,[ke,or])},"OperatorNode, Object":function(Z,me){if(me[Z]!==void 0)return ar(0);if(Z.op==="+")return new k(Z.op,Z.fn,Z.args.map(function(Ne){return Nr(Ne,me)}));if(Z.op==="-"){if(Z.isUnary())return new k(Z.op,Z.fn,[Nr(Z.args[0],me)]);if(Z.isBinary())return new k(Z.op,Z.fn,[Nr(Z.args[0],me),Nr(Z.args[1],me)])}if(Z.op==="*"){var se=Z.args.filter(function(Ne){return me[Ne]!==void 0});if(se.length>0){var je=Z.args.filter(function(Ne){return me[Ne]===void 0}),dr=je.length===1?je[0]:new k("*","multiply",je),hr=se.concat(Nr(dr,me));return new k("*","multiply",hr)}return new k("+","add",Z.args.map(function(Ne){return new k("*","multiply",Z.args.map(function(ae){return ae===Ne?Nr(ae,me):ae.clone()}))}))}if(Z.op==="/"&&Z.isBinary()){var or=Z.args[0],Fr=Z.args[1];return me[Fr]!==void 0?new k("/","divide",[Nr(or,me),Fr]):me[or]!==void 0?new k("*","multiply",[new k("-","unaryMinus",[or]),new k("/","divide",[Nr(Fr,me),new k("^","pow",[Fr.clone(),ar(2)])])]):new k("/","divide",[new k("-","subtract",[new k("*","multiply",[Nr(or,me),Fr.clone()]),new k("*","multiply",[or.clone(),Nr(Fr,me)])]),new k("^","pow",[Fr.clone(),ar(2)])])}if(Z.op==="^"&&Z.isBinary()){var _e=Z.args[0],ke=Z.args[1];if(me[_e]!==void 0)return(0,A.nu)(_e)&&(R(_e.value)||_(_e.value,1))?ar(0):new k("*","multiply",[Z,new k("*","multiply",[new G("log",[_e.clone()]),Nr(ke.clone(),me)])]);if(me[ke]!==void 0){if((0,A.nu)(ke)){if(R(ke.value))return ar(0);if(_(ke.value,1))return Nr(_e,me)}var at=new k("^","pow",[_e.clone(),new k("-","subtract",[ke,ar(1)])]);return new k("*","multiply",[ke.clone(),new k("*","multiply",[Nr(_e,me),at])])}return new k("*","multiply",[new k("^","pow",[_e.clone(),ke.clone()]),new k("+","add",[new k("*","multiply",[Nr(_e,me),new k("/","divide",[ke.clone(),_e.clone()])]),new k("*","multiply",[Nr(ke,me),new G("log",[_e.clone()])])])])}throw new Error('Operator "'+Z.op+'" is not supported by derivative, or a wrong number of arguments is passed')}});function Br(pe){if(!((pe.name==="log"||pe.name==="nthRoot"||pe.name==="pow")&&pe.args.length===2)){for(var Z=0;Z<pe.args.length;++Z)pe.args[Z]=ar(0);throw pe.compile().evaluate(),new Error("Expected TypeError, but none found")}}function ar(pe,Z){return new W(q(pe,Z||F.number))}return er}),Ma="parser",Xl=["typed","Parser"],Mn=(0,Te.d5)(Ma,Xl,xe=>{var{typed:ce,Parser:F}=xe;return ce(Ma,{"":function(){return new F}})}),Xn=ie(15356);function Aa(xe,ce,F){var U=xe.filter(function(q){return(0,A.FG)(q)&&!(q.name in ce)&&!F.has(q.name)})[0];if(!U)throw new Error('No undefined variable found in inline expression "'+xe+'"');var y=U.name,_=On(F),R=xe.compile();return function(W){return _.set(y,W),R.evaluate(_)}}var Ql="filter",_o=["typed"],jl=(0,Te.d5)(Ql,_o,xe=>{var{typed:ce}=xe;function F(y,_,R){var q,W;return y[0]&&(q=y[0].compile().evaluate(R)),y[1]&&((0,A.FG)(y[1])||(0,A.l7)(y[1])?W=y[1].compile().evaluate(R):W=Aa(y[1],_,R)),U(q,W)}F.rawArgs=!0;var U=ce("filter",{"Array, function":Eo,"Matrix, function":function(_,R){return _.create(Eo(_.toArray(),R))},"Array, RegExp":Oe.U_,"Matrix, RegExp":function(_,R){return _.create((0,Oe.U_)(_.toArray(),R))}});return F},{isTransformFunction:!0});function Eo(xe,ce){var F=(0,Xn.oV)(ce);return(0,Oe.hX)(xe,function(U,y,_){return F===1?ce(U):F===2?ce(U,[y+1]):ce(U,[y+1],_)})}var Co="forEach",Sa=["typed"],Oo=(0,Te.d5)(Co,Sa,xe=>{var{typed:ce}=xe;function F(y,_,R){var q,W;return y[0]&&(q=y[0].compile().evaluate(R)),y[1]&&((0,A.FG)(y[1])||(0,A.l7)(y[1])?W=y[1].compile().evaluate(R):W=Aa(y[1],_,R)),U(q,W)}F.rawArgs=!0;var U=ce("forEach",{"Array | Matrix, function":function(_,R){var q=(0,Xn.oV)(R),W=function G(k,oe){Array.isArray(k)?(0,Oe.Ed)(k,function(Ee,er){G(Ee,oe.concat(er+1))}):q===1?R(k):q===2?R(k,oe):R(k,oe,_)};W(_.valueOf(),[])}});return F},{isTransformFunction:!0}),ef="map",rf=["typed"],hm=(0,Te.d5)(ef,rf,xe=>{var{typed:ce}=xe;function F(y,_,R){var q,W;return y[0]&&(q=y[0].compile().evaluate(R)),y[1]&&((0,A.FG)(y[1])||(0,A.l7)(y[1])?W=y[1].compile().evaluate(R):W=Aa(y[1],_,R)),U(q,W)}F.rawArgs=!0;var U=ce("map",{"Array, function":function(_,R){return _a(_,R,_)},"Matrix, function":function(_,R){return _.create(_a(_.valueOf(),R,_))}});return F},{isTransformFunction:!0});function _a(xe,ce,F){var U=(0,Xn.oV)(ce);function y(_,R){return Array.isArray(_)?(0,Oe.UI)(_,function(q,W){return y(q,R.concat(W+1))}):U===1?ce(_):U===2?ce(_,R):ce(_,R,F)}return y(xe,[])}var tf=ie(38641),nf="apply",Do=["typed","isInteger"],af=(0,Te.d5)(nf,Do,xe=>{var{typed:ce,isInteger:F}=xe,U=(0,tf.j)({typed:ce,isInteger:F});return ce("apply",{"...any":function(_){var R=_[1];(0,A.hj)(R)?_[1]=R-1:(0,A.l9)(R)&&(_[1]=R.minus(1));try{return U.apply(null,_)}catch(q){throw Bt(q)}}})},{isTransformFunction:!0}),of=ie(88800);function rn(xe){if(xe.length===2&&(0,A.uZ)(xe[0])){xe=xe.slice();var ce=xe[1];(0,A.hj)(ce)?xe[1]=ce-1:(0,A.l9)(ce)&&(xe[1]=ce.minus(1))}return xe}var Bo="diff",sf=["typed","matrix","subtract","number","bignumber"],To=(0,Te.d5)(Bo,sf,xe=>{var{typed:ce,matrix:F,subtract:U,number:y,bignumber:_}=xe,R=(0,of.J)({typed:ce,matrix:F,subtract:U,number:y,bignumber:_});return ce(Bo,{"...any":function(W){W=rn(W);try{return R.apply(null,W)}catch(G){throw Bt(G)}}})},{isTransformFunction:!0}),uf=ie(37299),cf="subset",lf=["typed","matrix"],ff=(0,Te.d5)(cf,lf,xe=>{var{typed:ce,matrix:F}=xe,U=(0,uf.q)({typed:ce,matrix:F});return ce("subset",{"...any":function(_){try{return U.apply(null,_)}catch(R){throw Bt(R)}}})},{isTransformFunction:!0}),mf=ie(12155),Uo="concat",vf=["typed","matrix","isInteger"],pf=(0,Te.d5)(Uo,vf,xe=>{var{typed:ce,matrix:F,isInteger:U}=xe,y=(0,mf.k)({typed:ce,matrix:F,isInteger:U});return ce("concat",{"...any":function(R){var q=R.length-1,W=R[q];(0,A.hj)(W)?R[q]=W-1:(0,A.l9)(W)&&(R[q]=W.minus(1));try{return y.apply(null,R)}catch(G){throw Bt(G)}}})},{isTransformFunction:!0}),Ro=ie(15065),df="max",hf=["typed","config","numeric","larger"],Io=(0,Te.d5)(df,hf,xe=>{var{typed:ce,config:F,numeric:U,larger:y}=xe,_=(0,Ro.J)({typed:ce,config:F,numeric:U,larger:y});return ce("max",{"...any":function(q){q=rn(q);try{return _.apply(null,q)}catch(W){throw Bt(W)}}})},{isTransformFunction:!0}),gf=ie(35414),yf="min",Fo=["typed","config","numeric","smaller"],xf=(0,Te.d5)(yf,Fo,xe=>{var{typed:ce,config:F,numeric:U,smaller:y}=xe,_=(0,gf.D)({typed:ce,config:F,numeric:U,smaller:y});return ce("min",{"...any":function(q){q=rn(q);try{return _.apply(null,q)}catch(W){throw Bt(W)}}})},{isTransformFunction:!0}),bf=ie(39666),zo="range",Nf=["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq"],wf=(0,Te.d5)(zo,Nf,xe=>{var{typed:ce,config:F,matrix:U,bignumber:y,smaller:_,smallerEq:R,larger:q,largerEq:W}=xe,G=(0,bf.M)({typed:ce,config:F,matrix:U,bignumber:y,smaller:_,smallerEq:R,larger:q,largerEq:W});return ce("range",{"...any":function(oe){var Ee=oe.length-1,er=oe[Ee];return typeof er!="boolean"&&oe.push(!0),G.apply(null,oe)}})},{isTransformFunction:!0}),Po=ie(28596),Lo="sum",Mf=["typed","config","add","numeric"],qo=(0,Te.d5)(Lo,Mf,xe=>{var{typed:ce,config:F,add:U,numeric:y}=xe,_=(0,Po.O)({typed:ce,config:F,add:U,numeric:y});return ce(Lo,{"...any":function(q){q=rn(q);try{return _.apply(null,q)}catch(W){throw Bt(W)}}})},{isTransformFunction:!0}),Af=ie(21821),Wo="cumsum",Sf=["typed","add","unaryPlus"],Go=(0,Te.d5)(Wo,Sf,xe=>{var{typed:ce,add:F,unaryPlus:U}=xe,y=(0,Af.o)({typed:ce,add:F,unaryPlus:U});return ce(Wo,{"...any":function(R){if(R.length===2&&(0,A.uZ)(R[0])){var q=R[1];(0,A.hj)(q)?R[1]=q-1:(0,A.l9)(q)&&(R[1]=q.minus(1))}try{return y.apply(null,R)}catch(W){throw Bt(W)}}})},{isTransformFunction:!0}),_f=ie(21588),Ef="row",Ho=["typed","Index","matrix","range"],Cf=(0,Te.d5)(Ef,Ho,xe=>{var{typed:ce,Index:F,matrix:U,range:y}=xe,_=(0,_f.v)({typed:ce,Index:F,matrix:U,range:y});return ce("row",{"...any":function(q){var W=q.length-1,G=q[W];(0,A.hj)(G)&&(q[W]=G-1);try{return _.apply(null,q)}catch(k){throw Bt(k)}}})},{isTransformFunction:!0}),Of=ie(12800),ko="column",Df=["typed","Index","matrix","range"],Bf=(0,Te.d5)(ko,Df,xe=>{var{typed:ce,Index:F,matrix:U,range:y}=xe,_=(0,Of.w)({typed:ce,Index:F,matrix:U,range:y});return ce("column",{"...any":function(q){var W=q.length-1,G=q[W];(0,A.hj)(G)&&(q[W]=G-1);try{return _.apply(null,q)}catch(k){throw Bt(k)}}})},{isTransformFunction:!0}),$o="index",Vo=["Index"],Tf=(0,Te.d5)($o,Vo,xe=>{var{Index:ce}=xe;return function(){for(var U=[],y=0,_=arguments.length;y<_;y++){var R=arguments[y];if((0,A.bR)(R))R.start--,R.end-=R.step>0?0:2;else if(R&&R.isSet===!0)R=R.map(function(W){return W-1});else if((0,A.kJ)(R)||(0,A.SW)(R))R=R.map(function(W){return W-1});else if((0,A.hj)(R))R--;else if((0,A.l9)(R))R=R.toNumber()-1;else if(typeof R!="string")throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range");U[y]=R}var q=new ce;return ce.apply(q,U),q}},{isTransformFunction:!0}),Uf=ie(3592),Jo="mean",Rf=["typed","add","divide"],If=(0,Te.d5)(Jo,Rf,xe=>{var{typed:ce,add:F,divide:U}=xe,y=(0,Uf.Q)({typed:ce,add:F,divide:U});return ce("mean",{"...any":function(R){R=rn(R);try{return y.apply(null,R)}catch(q){throw Bt(q)}}})},{isTransformFunction:!0}),Zo=ie(34678),Ko="variance",Ff=["typed","add","subtract","multiply","divide","apply","isNaN"],Yo=(0,Te.d5)(Ko,Ff,xe=>{var{typed:ce,add:F,subtract:U,multiply:y,divide:_,apply:R,isNaN:q}=xe,W=(0,Zo.F)({typed:ce,add:F,subtract:U,multiply:y,divide:_,apply:R,isNaN:q});return ce(Ko,{"...any":function(k){k=rn(k);try{return W.apply(null,k)}catch(oe){throw Bt(oe)}}})},{isTransformFunction:!0}),zf=ie(2128),Pf="std",Xo=["typed","sqrt","variance"],Lf=(0,Te.d5)(Pf,Xo,xe=>{var{typed:ce,sqrt:F,variance:U}=xe,y=(0,zf.X)({typed:ce,sqrt:F,variance:U});return ce("std",{"...any":function(R){R=rn(R);try{return y.apply(null,R)}catch(q){throw Bt(q)}}})},{isTransformFunction:!0}),D=ie(6511),fn={},Un={},Qo={},Qn=L({math:fn}),Ct=fe({mathWithTransform:Un}),Rn=Ie({Node:Ct}),Xt=lr({Node:Ct}),mn=kr({Node:Ct}),jo=we({Node:Ct}),In=It({Node:Ct}),es=_s({Node:Ct,ResultSet:D.Z0z}),rs=Os({Node:Ct}),vn=Ts({Node:Ct}),ts=Is({Node:Ct}),qf=Ps({classes:Qo}),ns=Ws({Chain:Qn,typed:D.Gzl}),as=ks({Node:Ct,typed:D.Gzl}),Fn=Zs({Node:Ct,subset:D.P9L}),Ea=Qs({matrix:D.pIu,Node:Ct,subset:D.P9L}),zn=ru({Node:Ct,size:D.dpJ}),pn=au({Unit:D.fbc,Node:Ct,math:fn}),tn=su({Node:Ct,SymbolNode:pn,math:fn}),Vt=cu({AccessorNode:Fn,ArrayNode:In,AssignmentNode:Ea,BlockNode:es,ConditionalNode:rs,ConstantNode:vn,FunctionAssignmentNode:as,FunctionNode:tn,IndexNode:zn,ObjectNode:Rn,OperatorNode:Xt,ParenthesisNode:mn,RangeNode:ts,RelationalNode:jo,SymbolNode:pn,config:cr.v,numeric:D.uRn,typed:D.Gzl}),is=mu({ConstantNode:vn,FunctionNode:tn,OperatorNode:Xt,ParenthesisNode:mn,parse:Vt}),Ca=hu({AccessorNode:Fn,ArrayNode:In,ConstantNode:vn,FunctionNode:tn,IndexNode:zn,ObjectNode:Rn,OperatorNode:Xt,ParenthesisNode:mn,SymbolNode:pn,add:D.IHx,divide:D.csF,equal:D.DgJ,isZero:D.Fr9,multiply:D.JpY,pow:D.sQ3,subtract:D.$XF}),Wf=yu({parse:Vt,typed:D.Gzl}),os=Nu({parse:Vt}),ss=Mu({parse:Vt,typed:D.Gzl}),jn=_u({bignumber:D.edS,fraction:D.Pj$,AccessorNode:Fn,ArrayNode:In,ConstantNode:vn,FunctionNode:tn,IndexNode:zn,ObjectNode:Rn,OperatorNode:Xt,ParenthesisNode:mn,SymbolNode:pn,add:D.IHx,config:cr.v,divide:D.csF,equal:D.DgJ,isZero:D.Fr9,mathWithTransform:Un,matrix:D.pIu,multiply:D.JpY,parse:Vt,pow:D.sQ3,resolve:is,simplifyCore:Ca,subtract:D.$XF,typed:D.Gzl}),Gf=Cu({OperatorNode:Xt,parse:Vt,simplify:jn,typed:D.Gzl}),ea=qa({parse:Vt,typed:D.Gzl}),Hf=Mo({Help:os,mathWithTransform:Un,typed:D.Gzl}),us=Vl({evaluate:ea}),cs=Zl({bignumber:D.edS,fraction:D.Pj$,AccessorNode:Fn,ArrayNode:In,ConstantNode:vn,FunctionNode:tn,IndexNode:zn,ObjectNode:Rn,OperatorNode:Xt,ParenthesisNode:mn,SymbolNode:pn,add:D.IHx,config:cr.v,divide:D.csF,equal:D.DgJ,isZero:D.Fr9,mathWithTransform:Un,matrix:D.pIu,multiply:D.JpY,parse:Vt,pow:D.sQ3,simplify:jn,simplifyCore:Ca,subtract:D.$XF,typed:D.Gzl}),kf=Yl({ConstantNode:vn,FunctionNode:tn,OperatorNode:Xt,ParenthesisNode:mn,SymbolNode:pn,config:cr.v,equal:D.DgJ,isZero:D.Fr9,numeric:D.uRn,parse:Vt,simplify:jn,typed:D.Gzl}),$f=Mn({Parser:us,typed:D.Gzl});(0,Q.Z)(fn,{e:D.e,false:D.WJv,fineStructure:D.Oyo,i:D.i,Infinity:D.OvO,LN10:D.cw7,LOG10E:D.doM,NaN:D.xOA,null:D.OSG,phi:D.Skb,SQRT1_2:D.PNl,sackurTetrode:D.KO_,tau:D.BZ_,true:D.wcc,E:D.e,version:D.i83,efimovFactor:D.dvW,LN2:D.bZs,pi:D.pi,replacer:D.PHU,reviver:qf,SQRT2:D.vNo,typed:D.Gzl,unaryPlus:D.uKN,PI:D.pi,weakMixingAngle:D.Uud,abs:D.WnP,acos:D.Khb,acot:D.C6L,acsc:D.rcO,addScalar:D.scv,arg:D.R91,asech:D.lo8,asinh:D.VfV,atan:D.z4N,atanh:D.C80,bignumber:D.edS,bitNot:D.Pfe,boolean:D.O72,chain:ns,clone:D.d9v,combinations:D.BjO,complex:D.PYB,conj:D.ruJ,cosh:D.f9Y,coth:D.h6M,csc:D.QBQ,cube:D.kOm,equalScalar:D.kuq,erf:D.qNN,exp:D.Qqt,expm1:D.t$B,filter:D.hXT,forEach:D.Ed_,format:D.WUZ,getMatrixDataType:D.mOi,hex:D.$v1,im:D.im,isInteger:D.UaK,isNegative:D.nMy,isPositive:D.xPR,isZero:D.Fr9,LOG2E:D.wwJ,lgamma:D.KF1,log10:D.mvw,log2:D.k3Q,map:D.UID,multiplyScalar:D.cfl,not:D.ffD,number:D.Rxh,oct:D.jfK,pickRandom:D.sDj,print:D.S0v,random:D.MXc,re:D.re,sec:D.BEc,sign:D.Xxe,sin:D.O$l,splitUnit:D.jLI,square:D.h62,string:D.Z_8,tan:D.ORZ,typeOf:D.kM2,acosh:D.__u,acsch:D.KLC,apply:D.nnj,asec:D.PUJ,bin:D.Ly_,combinationsWithRep:D.d4C,cos:D.mCk,csch:D.RhL,isNaN:D.i2d,isPrime:D.e47,randomInt:D.Iyf,sech:D.Fbd,sinh:D.R_K,sparse:D.rVs,sqrt:D._b3,tanh:D.AEp,unaryMinus:D.T8F,acoth:D.trc,cot:D.oHe,fraction:D.Pj$,isNumeric:D.kEn,matrix:D.pIu,matrixFromFunction:D.ZcA,mod:D.wQq,nthRoot:D.C7f,numeric:D.uRn,or:D.or,prod:D.WVs,reshape:D.XLQ,size:D.dpJ,smaller:D.Nyh,squeeze:D.L9e,subset:D.P9L,subtract:D.$XF,to:D.to,transpose:D.p4s,xgcd:D.NpV,zeros:D.lls,and:D.xDy,bitAnd:D.hx9,bitXor:D.nNS,cbrt:D.eKn,compare:D.quX,compareText:D.cdM,concat:D.zoF,count:D.QXW,ctranspose:D.NZC,diag:D.Ka3,divideScalar:D.QgA,dotDivide:D.yVo,equal:D.DgJ,fft:D.kp_,flatten:D.xHg,gcd:D.thl,hasNumericValue:D.Hdk,hypot:D._mT,ifft:D.Sxn,kron:D.JvE,largerEq:D.Cr4,leftShift:D.w57,lsolve:D.wtJ,matrixFromColumns:D.ndY,min:D.VV$,mode:D.xJM,nthRoots:D.$$R,ones:D.iUs,partitionSelect:D.JeQ,resize:D.SIr,rightArithShift:D.nq0,round:D.NMM,smallerEq:D.Sq_,unequal:D.KPr,usolve:D.LDk,xor:D.dlQ,add:D.IHx,atan2:D.fvJ,bitOr:D.wKT,catalan:D.tjo,compareNatural:D.rn1,cumsum:D.zbp,deepEqual:D.vZr,diff:D.Hgg,dot:D.AKD,equalText:D.eZD,floor:D.GWj,identity:D.yRu,invmod:D.QNt,larger:D.TWx,log:D.cM7,lsolveAll:D.ER9,matrixFromRows:D.lPE,multiply:D.JpY,qr:D.qr,range:D.w6H,rightLogShift:D.LdX,setSize:D.yk3,slu:D.cEy,sum:D.Smz,trace:D.g49,usolveAll:D.bJ2,asin:D.ZRM,ceil:D.mDi,composition:D.ift,cross:D.kCc,det:D.Q8I,distance:D.TE$,dotMultiply:D.iOk,fix:D.zG0,intersect:D.wfr,lcm:D.uqG,log1p:D.Krr,max:D.Fp7,quantileSeq:D.pAO,row:D.O7B,setCartesian:D.$ZK,setDistinct:D.Z41,setIsSubset:D.TT1,setPowerset:D.ljT,sort:D.DYV,column:D.$QP,index:D.KzB,inv:D.JBn,pinv:D.mvk,pow:D.sQ3,setDifference:D.TVT,setMultiplicity:D.oNG,sqrtm:D.jXX,vacuumImpedance:D.tnB,wienDisplacement:D.bGh,atomicMass:D.uzo,bohrMagneton:D.Cl$,boltzmann:D.Rhk,conductanceQuantum:D.xk2,createUnit:D.JP7,deuteronMass:D.dEt,dotPow:D.qgo,electricConstant:D.dXo,elementaryCharge:D.iMQ,expm:D.Ege,faraday:D.Am2,firstRadiation:D.Vvs,gamma:D.yiU,gravitationConstant:D.H9q,hartreeEnergy:D.HQL,klitzing:D.$$$,loschmidt:D.PUn,magneticConstant:D.$nU,molarMass:D.ak$,molarPlanckConstant:D.kEb,neutronMass:D.li8,nuclearMagneton:D._A2,planckCharge:D.JaK,planckLength:D.gil,planckTemperature:D.XAT,protonMass:D.CxM,reducedPlanckConstant:D.vAu,rydberg:D.rMB,setIntersect:D.ff9,speedOfLight:D.bl5,stefanBoltzmann:D.yO5,thomsonCrossSection:D.bej,avogadro:D._vz,bohrRadius:D.tUn,coulomb:D.JPg,divide:D.csF,electronMass:D._G2,factorial:D.bLN,gravity:D.QXX,inverseConductanceQuantum:D.WSk,lup:D.xly,magneticFluxQuantum:D.oLv,molarMassC12:D.esS,multinomial:D.SJ_,parse:Vt,permutations:D.DW7,planckMass:D.kc5,quantumOfCirculation:D.TYM,resolve:is,secondRadiation:D.ahj,simplifyCore:Ca,stirlingS2:D.bAb,unit:D.bfT,bellNumbers:D.O7j,compile:Wf,eigs:D.Gq_,fermiCoupling:D.cIy,leafCount:ss,mean:D.J69,molarVolume:D.n4B,planckConstant:D.whQ,setSymDifference:D.V4s,simplify:jn,symbolicEqual:Gf,classicalElectronRadius:D._fe,evaluate:ea,help:Hf,lusolve:D.DU,median:D.C2o,rationalize:cs,setUnion:D.uyX,variance:D.CAK,derivative:kf,kldivergence:D.mYz,norm:D.KOy,planckTime:D.oTb,rotationMatrix:D.k8z,gasConstant:D.eOQ,parser:$f,std:D.qoR,mad:D.UFs,rotate:D.U1s,config:cr.v}),(0,Q.Z)(Un,fn,{filter:jl({typed:D.Gzl}),forEach:Oo({typed:D.Gzl}),map:hm({typed:D.Gzl}),apply:af({isInteger:D.UaK,typed:D.Gzl}),diff:To({bignumber:D.edS,matrix:D.pIu,number:D.Rxh,subtract:D.$XF,typed:D.Gzl}),subset:ff({matrix:D.pIu,typed:D.Gzl}),concat:pf({isInteger:D.UaK,matrix:D.pIu,typed:D.Gzl}),max:Io({config:cr.v,larger:D.TWx,numeric:D.uRn,typed:D.Gzl}),min:xf({config:cr.v,numeric:D.uRn,smaller:D.Nyh,typed:D.Gzl}),range:wf({bignumber:D.edS,matrix:D.pIu,config:cr.v,larger:D.TWx,largerEq:D.Cr4,smaller:D.Nyh,smallerEq:D.Sq_,typed:D.Gzl}),sum:qo({add:D.IHx,config:cr.v,numeric:D.uRn,typed:D.Gzl}),cumsum:Go({add:D.IHx,typed:D.Gzl,unaryPlus:D.uKN}),row:Cf({Index:D.gmE,matrix:D.pIu,range:D.w6H,typed:D.Gzl}),column:Bf({Index:D.gmE,matrix:D.pIu,range:D.w6H,typed:D.Gzl}),index:Tf({Index:D.gmE}),mean:If({add:D.IHx,divide:D.csF,typed:D.Gzl}),variance:Yo({add:D.IHx,apply:D.nnj,divide:D.csF,isNaN:D.i2d,multiply:D.JpY,subtract:D.$XF,typed:D.Gzl}),std:Lf({sqrt:D._b3,typed:D.Gzl,variance:D.CAK})}),(0,Q.Z)(Qo,{BigNumber:D.O$v,Chain:Qn,Complex:D.Zz9,Fraction:D.iAi,Matrix:D.y3G,Node:Ct,ObjectNode:Rn,OperatorNode:Xt,ParenthesisNode:mn,Range:D.e6w,RelationalNode:jo,ResultSet:D.Z0z,ArrayNode:In,BlockNode:es,ConditionalNode:rs,ConstantNode:vn,DenseMatrix:D.JfM,RangeNode:ts,FunctionAssignmentNode:as,SparseMatrix:D.A7i,AccessorNode:Fn,AssignmentNode:Ea,IndexNode:zn,FibonacciHeap:D.Q3n,ImmutableDenseMatrix:D.MUK,Index:D.gmE,Spa:D.HJh,Unit:D.fbc,SymbolNode:pn,FunctionNode:tn,Help:os,Parser:us}),Qn.createProxy(fn)},6511:function(ot,Ur,ie){ie.d(Ur,{O$v:function(){return ur},Zz9:function(){return mt},JfM:function(){return Kr},Q3n:function(){return Rp},iAi:function(){return qn},MUK:function(){return Fp},gmE:function(){return kt},cw7:function(){return ux},bZs:function(){return bx},doM:function(){return cx},wwJ:function(){return $x},y3G:function(){return ps},e6w:function(){return vx},Z0z:function(){return px},PNl:function(){return dx},vNo:function(){return Mx},HJh:function(){return qp},A7i:function(){return gn},fbc:function(){return Wr},OvO:function(){return sx},xOA:function(){return lx},WJv:function(){return ix},OSG:function(){return fx},wcc:function(){return gx},WnP:function(){return Ht},Khb:function(){return Sx},__u:function(){return ib},C6L:function(){return _x},trc:function(){return gb},rcO:function(){return Ex},KLC:function(){return ob},IHx:function(){return Tt},scv:function(){return At},xDy:function(){return Sb},nnj:function(){return hp},R91:function(){return Cx},PUJ:function(){return sb},lo8:function(){return Ox},ZRM:function(){return t1},VfV:function(){return Dx},z4N:function(){return cp},fvJ:function(){return kb},C80:function(){return Bx},uzo:function(){return M1},_vz:function(){return j1},O7j:function(){return vN},edS:function(){return Da},Ly_:function(){return ub},hx9:function(){return _b},Pfe:function(){return Tx},wKT:function(){return $b},nNS:function(){return Eb},Cl$:function(){return A1},tUn:function(){return eN},Rhk:function(){return S1},O72:function(){return Ux},tjo:function(){return Vb},eKn:function(){return Cb},mDi:function(){return Tp},_fe:function(){return yN},d9v:function(){return Rx},$QP:function(){return Pp},BjO:function(){return ds},d4C:function(){return cb},quX:function(){return ca},rn1:function(){return cn},cdM:function(){return bp},PYB:function(){return hs},ift:function(){return n1},zoF:function(){return am},xk2:function(){return _1},ruJ:function(){return ia},mCk:function(){return rm},f9Y:function(){return Ix},oHe:function(){return yb},h6M:function(){return Fx},JPg:function(){return rN},QXW:function(){return Ob},JP7:function(){return E1},kCc:function(){return a1},QBQ:function(){return zx},RhL:function(){return lb},NZC:function(){return im},kOm:function(){return Px},zbp:function(){return Jb},vZr:function(){return _p},Q8I:function(){return Up},dEt:function(){return C1},Ka3:function(){return Np},Hgg:function(){return Zb},TE$:function(){return i1},csF:function(){return ma},QgA:function(){return yt},AKD:function(){return Ns},yVo:function(){return xs},iOk:function(){return o1},qgo:function(){return O1},e:function(){return ax},dvW:function(){return xx},Gq_:function(){return $p},dXo:function(){return D1},_G2:function(){return tN},iMQ:function(){return B1},DgJ:function(){return Hn},kuq:function(){return it},eZD:function(){return Kb},qNN:function(){return Lx},Qqt:function(){return lp},Ege:function(){return T1},t$B:function(){return qx},bLN:function(){return ws},Am2:function(){return U1},cIy:function(){return pN},kp_:function(){return wp},hXT:function(){return Wx},Oyo:function(){return ox},Vvs:function(){return R1},zG0:function(){return Ip},xHg:function(){return Ta},GWj:function(){return Ep},Ed_:function(){return Gx},WUZ:function(){return Ba},Pj$:function(){return tm},yiU:function(){return Wp},eOQ:function(){return MN},thl:function(){return Db},mOi:function(){return Hx},H9q:function(){return I1},QXX:function(){return nN},HQL:function(){return F1},Hdk:function(){return Bb},$v1:function(){return kx},_mT:function(){return Tb},i:function(){return op},yRu:function(){return la},Sxn:function(){return Ub},im:function(){return fp},KzB:function(){return g1},wfr:function(){return s1},JBn:function(){return kn},WSk:function(){return aN},QNt:function(){return Yb},UaK:function(){return an},i2d:function(){return ys},nMy:function(){return oa},kEn:function(){return Gn},xPR:function(){return gs},e47:function(){return fb},Fr9:function(){return sa},mYz:function(){return NN},$$$:function(){return z1},JvE:function(){return Rb},TWx:function(){return ln},Cr4:function(){return om},uqG:function(){return u1},w57:function(){return Ib},KF1:function(){return Vx},cM7:function(){return cm},mvw:function(){return Jx},Krr:function(){return c1},k3Q:function(){return Zx},PUn:function(){return P1},wtJ:function(){return Mp},ER9:function(){return Xb},xly:function(){return Hp},DU:function(){return xN},UFs:function(){return SN},$nU:function(){return L1},oLv:function(){return iN},UID:function(){return mp},pIu:function(){return wr},ndY:function(){return Ap},ZcA:function(){return xb},lPE:function(){return Qb},Fp7:function(){return zp},J69:function(){return dN},C2o:function(){return Jp},VV$:function(){return Fb},wQq:function(){return gp},xJM:function(){return zb},ak$:function(){return q1},esS:function(){return oN},kEb:function(){return W1},n4B:function(){return hN},SJ_:function(){return sN},JpY:function(){return Dt},cfl:function(){return wt},li8:function(){return G1},KOy:function(){return Kp},ffD:function(){return vp},C7f:function(){return bb},$$R:function(){return Pb},_A2:function(){return H1},Rxh:function(){return Wn},uRn:function(){return ua},jfK:function(){return Kx},iUs:function(){return Lb},or:function(){return Nb},JeQ:function(){return sm},DW7:function(){return uN},Skb:function(){return mx},pi:function(){return Nx},sDj:function(){return Yx},mvk:function(){return y1},JaK:function(){return k1},whQ:function(){return gN},gil:function(){return $1},kc5:function(){return cN},XAT:function(){return V1},oTb:function(){return wN},sQ3:function(){return fa},S0v:function(){return Xx},WVs:function(){return yp},CxM:function(){return J1},qr:function(){return Cp},pAO:function(){return l1},TYM:function(){return lN},MXc:function(){return Qx},Iyf:function(){return mb},w6H:function(){return lm},re:function(){return pp},vAu:function(){return Z1},PHU:function(){return wx},XLQ:function(){return wb},SIr:function(){return qb},nq0:function(){return Wb},LdX:function(){return jb},U1s:function(){return _N},k8z:function(){return Yp},NMM:function(){return bs},O7B:function(){return f1},rMB:function(){return K1},KO_:function(){return hx},BEc:function(){return jx},Fbd:function(){return vb},ahj:function(){return fN},$ZK:function(){return m1},TVT:function(){return Lp},Z41:function(){return v1},ff9:function(){return Gp},TT1:function(){return p1},oNG:function(){return x1},ljT:function(){return d1},yk3:function(){return e1},V4s:function(){return Vp},uyX:function(){return bN},Xxe:function(){return dp},O$l:function(){return em},R_K:function(){return pb},dpJ:function(){return zt},cEy:function(){return Op},Nyh:function(){return on},Sq_:function(){return Sp},DYV:function(){return h1},rVs:function(){return db},bl5:function(){return Y1},jLI:function(){return eb},_b3:function(){return _n},jXX:function(){return b1},h62:function(){return rb},L9e:function(){return Mb},qoR:function(){return AN},yO5:function(){return X1},bAb:function(){return kp},Z_8:function(){return tb},P9L:function(){return sn},$XF:function(){return _t},Smz:function(){return Dp},ORZ:function(){return nb},AEp:function(){return hb},BZ_:function(){return sp},bej:function(){return Q1},to:function(){return Ab},g49:function(){return r1},p4s:function(){return nm},kM2:function(){return ab},Gzl:function(){return ee},T8F:function(){return yn},uKN:function(){return up},KPr:function(){return Gb},bfT:function(){return mN},LDk:function(){return um},bJ2:function(){return Bp},tnB:function(){return N1},CAK:function(){return Zp},i83:function(){return yx},Uud:function(){return Ax},bGh:function(){return w1},NpV:function(){return xp},dlQ:function(){return Hb},lls:function(){return un}});var Q=ie(88754),cr=ie(90482),A=ie(42711),tr="BigNumber",Pe=["?on","config"],Te=(0,A.d5)(tr,Pe,u=>{var{on:i,config:o}=u,t=cr.Z.clone({precision:o.precision,modulo:cr.Z.EUCLID});return t.prototype=Object.create(t.prototype),t.prototype.type="BigNumber",t.prototype.isBigNumber=!0,t.prototype.toJSON=function(){return{mathjs:"BigNumber",value:this.toString()}},t.fromJSON=function(r){return new t(r.value)},i&&i("config",function(r,s){r.precision!==s.precision&&t.config({precision:r.precision})}),t},{isClass:!0}),ir=ie(61977),le=ie(36041),L=ie(77707),$e="Complex",Se=[],Me=(0,A.d5)($e,Se,()=>(ir.prototype.type="Complex",ir.prototype.isComplex=!0,ir.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},ir.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},ir.prototype.format=function(u){var i="",o=this.im,t=this.re,r=(0,le.WU)(this.re,u),s=(0,le.WU)(this.im,u),p=(0,L.hj)(u)?u:u?u.precision:null;if(p!==null){var d=Math.pow(10,-p);Math.abs(t/o)<d&&(t=0),Math.abs(o/t)<d&&(o=0)}return o===0?i=r:t===0?o===1?i="i":o===-1?i="-i":i=s+"i":o<0?o===-1?i=r+" - i":i=r+" - "+s.substring(1)+"i":o===1?i=r+" + i":i=r+" + "+s+"i",i},ir.fromPolar=function(u){switch(arguments.length){case 1:{var i=arguments[0];if(typeof i=="object")return ir(i);throw new TypeError("Input has to be an object with r and phi keys.")}case 2:{var o=arguments[0],t=arguments[1];if((0,L.hj)(o)){if((0,L.wr)(t)&&t.hasBase("ANGLE")&&(t=t.toNumber("rad")),(0,L.hj)(t))return new ir({r:o,phi:t});throw new TypeError("Phi is not a number nor an angle unit.")}else throw new TypeError("Radius r is not a number.")}default:throw new SyntaxError("Wrong number of arguments in function fromPolar")}},ir.prototype.valueOf=ir.prototype.toString,ir.fromJSON=function(u){return new ir(u)},ir.compare=function(u,i){return u.re>i.re?1:u.re<i.re?-1:u.im>i.im?1:u.im<i.im?-1:0},ir),{isClass:!0}),Ae="10.6.4",fe=ie(15356),ne=(0,fe.HP)(function(u){return new u(1).exp()},{hasher:Oe}),X=(0,fe.HP)(function(u){return new u(1).plus(new u(5).sqrt()).div(2)},{hasher:Oe}),de=(0,fe.HP)(function(u){return u.acos(-1)},{hasher:Oe}),Ie=(0,fe.HP)(function(u){return de(u).times(2)},{hasher:Oe});function Oe(u){return u[0].precision}var ue=Math.PI,ge=2*Math.PI,Re=Math.E,Ze=1.618033988749895,Qe=(0,A.d5)("true",[],()=>!0),vr=(0,A.d5)("false",[],()=>!1),Ye=(0,A.d5)("null",[],()=>null),nt=It("Infinity",["config","?BigNumber"],u=>{var{config:i,BigNumber:o}=u;return i.number==="BigNumber"?new o(1/0):1/0}),Le=It("NaN",["config","?BigNumber"],u=>{var{config:i,BigNumber:o}=u;return i.number==="BigNumber"?new o(NaN):NaN}),nr=It("pi",["config","?BigNumber"],u=>{var{config:i,BigNumber:o}=u;return i.number==="BigNumber"?de(o):ue}),Pr=It("tau",["config","?BigNumber"],u=>{var{config:i,BigNumber:o}=u;return i.number==="BigNumber"?Ie(o):ge}),Ir=It("e",["config","?BigNumber"],u=>{var{config:i,BigNumber:o}=u;return i.number==="BigNumber"?ne(o):Re}),he=It("phi",["config","?BigNumber"],u=>{var{config:i,BigNumber:o}=u;return i.number==="BigNumber"?X(o):Ze}),qe=It("LN2",["config","?BigNumber"],u=>{var{config:i,BigNumber:o}=u;return i.number==="BigNumber"?new o(2).ln():Math.LN2}),lr=It("LN10",["config","?BigNumber"],u=>{var{config:i,BigNumber:o}=u;return i.number==="BigNumber"?new o(10).ln():Math.LN10}),pr=It("LOG2E",["config","?BigNumber"],u=>{var{config:i,BigNumber:o}=u;return i.number==="BigNumber"?new o(1).div(new o(2).ln()):Math.LOG2E}),Er=It("LOG10E",["config","?BigNumber"],u=>{var{config:i,BigNumber:o}=u;return i.number==="BigNumber"?new o(1).div(new o(10).ln()):Math.LOG10E}),kr=It("SQRT1_2",["config","?BigNumber"],u=>{var{config:i,BigNumber:o}=u;return i.number==="BigNumber"?new o("0.5").sqrt():Math.SQRT1_2}),vt=It("SQRT2",["config","?BigNumber"],u=>{var{config:i,BigNumber:o}=u;return i.number==="BigNumber"?new o(2).sqrt():Math.SQRT2}),ht=It("i",["Complex"],u=>{var{Complex:i}=u;return i.I}),we=null,Jt=null,Ms=(0,A.d5)("version",[],()=>Ae);function It(u,i,o){return(0,A.d5)(u,i,o,{recreateOnConfigChange:!0})}var As=Hr("speedOfLight","299792458","m s^-1"),Ss=Hr("gravitationConstant","6.67430e-11","m^3 kg^-1 s^-2"),_s=Hr("planckConstant","6.62607015e-34","J s"),Es=Hr("reducedPlanckConstant","1.0545718176461565e-34","J s"),Cs=Hr("magneticConstant","1.25663706212e-6","N A^-2"),Os=Hr("electricConstant","8.8541878128e-12","F m^-1"),Ds=Hr("vacuumImpedance","376.730313667","ohm"),Bs=Hr("coulomb","8.987551792261171e9","N m^2 C^-2"),Ts=Hr("elementaryCharge","1.602176634e-19","C"),Us=Hr("bohrMagneton","9.2740100783e-24","J T^-1"),Rs=Hr("conductanceQuantum","7.748091729863649e-5","S"),Is=Hr("inverseConductanceQuantum","12906.403729652257","ohm"),Fs=Hr("magneticFluxQuantum","2.0678338484619295e-15","Wb"),zs=Hr("nuclearMagneton","5.0507837461e-27","J T^-1"),Ps=Hr("klitzing","25812.807459304513","ohm"),Ls=null,qs=Hr("bohrRadius","5.29177210903e-11","m"),Ws=Hr("classicalElectronRadius","2.8179403262e-15","m"),Gs=Hr("electronMass","9.1093837015e-31","kg"),Hs=Hr("fermiCoupling","1.1663787e-5","GeV^-2"),ks=Vn("fineStructure",.0072973525693),$s=Hr("hartreeEnergy","4.3597447222071e-18","J"),Bt=Hr("protonMass","1.67262192369e-27","kg"),Ra=Hr("deuteronMass","3.3435830926e-27","kg"),Vs=Hr("neutronMass","1.6749271613e-27","kg"),Js=Hr("quantumOfCirculation","3.6369475516e-4","m^2 s^-1"),Zs=Hr("rydberg","10973731.568160","m^-1"),Ks=Hr("thomsonCrossSection","6.6524587321e-29","m^2"),Ys=Vn("weakMixingAngle",.2229),Xs=Vn("efimovFactor",22.7),Qs=Hr("atomicMass","1.66053906660e-27","kg"),js=Hr("avogadro","6.02214076e23","mol^-1"),eu=Hr("boltzmann","1.380649e-23","J K^-1"),ru=Hr("faraday","96485.33212331001","C mol^-1"),tu=Hr("firstRadiation","3.7417718521927573e-16","W m^2"),nu=Hr("loschmidt","2.686780111798444e25","m^-3"),au=Hr("gasConstant","8.31446261815324","J K^-1 mol^-1"),On=Hr("molarPlanckConstant","3.990312712893431e-10","J s mol^-1"),iu=Hr("molarVolume","0.022413969545014137","m^3 mol^-1"),ou=Vn("sackurTetrode",-1.16487052358),su=Hr("secondRadiation","0.014387768775039337","m K"),$n=Hr("stefanBoltzmann","5.67037441918443e-8","W m^-2 K^-4"),Ia=Hr("wienDisplacement","2.897771955e-3","m K"),uu=Hr("molarMass","0.99999999965e-3","kg mol^-1"),cu=Hr("molarMassC12","11.9999999958e-3","kg mol^-1"),lu=Hr("gravity","9.80665","m s^-2"),fu=Hr("planckLength","1.616255e-35","m"),mu=Hr("planckMass","2.176435e-8","kg"),vu=Hr("planckTime","5.391245e-44","s"),Fa=Hr("planckCharge","1.87554603778e-18","C"),va=Hr("planckTemperature","1.416785e+32","K");function Hr(u,i,o){var t=["config","Unit","BigNumber"];return(0,A.d5)(u,t,r=>{var{config:s,Unit:p,BigNumber:d}=r,v=s.number==="BigNumber"?new d(i):parseFloat(i),m=new p(v,o);return m.fixPrefix=!0,m})}function Vn(u,i){var o=["config","BigNumber"];return(0,A.d5)(u,o,t=>{var{config:r,BigNumber:s}=t;return r.number==="BigNumber"?new s(i):i})}var en=ie(39752),pu="Fraction",du=[],hu=(0,A.d5)(pu,du,()=>(en.Z.prototype.type="Fraction",en.Z.prototype.isFraction=!0,en.Z.prototype.toJSON=function(){return{mathjs:"Fraction",n:this.s*this.n,d:this.d}},en.Z.fromJSON=function(u){return new en.Z(u)},en.Z),{isClass:!0}),za="Matrix",gu=[],yu=(0,A.d5)(za,gu,()=>{function u(){if(!(this instanceof u))throw new SyntaxError("Constructor must be called with the new operator")}return u.prototype.type="Matrix",u.prototype.isMatrix=!0,u.prototype.storage=function(){throw new Error("Cannot invoke storage on a Matrix interface")},u.prototype.datatype=function(){throw new Error("Cannot invoke datatype on a Matrix interface")},u.prototype.create=function(i,o){throw new Error("Cannot invoke create on a Matrix interface")},u.prototype.subset=function(i,o,t){throw new Error("Cannot invoke subset on a Matrix interface")},u.prototype.get=function(i){throw new Error("Cannot invoke get on a Matrix interface")},u.prototype.set=function(i,o,t){throw new Error("Cannot invoke set on a Matrix interface")},u.prototype.resize=function(i,o){throw new Error("Cannot invoke resize on a Matrix interface")},u.prototype.reshape=function(i,o){throw new Error("Cannot invoke reshape on a Matrix interface")},u.prototype.clone=function(){throw new Error("Cannot invoke clone on a Matrix interface")},u.prototype.size=function(){throw new Error("Cannot invoke size on a Matrix interface")},u.prototype.map=function(i,o){throw new Error("Cannot invoke map on a Matrix interface")},u.prototype.forEach=function(i){throw new Error("Cannot invoke forEach on a Matrix interface")},u.prototype[Symbol.iterator]=function(){throw new Error("Cannot iterate a Matrix interface")},u.prototype.toArray=function(){throw new Error("Cannot invoke toArray on a Matrix interface")},u.prototype.valueOf=function(){throw new Error("Cannot invoke valueOf on a Matrix interface")},u.prototype.format=function(i){throw new Error("Cannot invoke format on a Matrix interface")},u.prototype.toString=function(){throw new Error("Cannot invoke toString on a Matrix interface")},u},{isClass:!0}),xu="Range",bu=[],Nu=(0,A.d5)(xu,bu,()=>{function u(i,o,t){if(!(this instanceof u))throw new SyntaxError("Constructor must be called with the new operator");var r=i!=null,s=o!=null,p=t!=null;if(r){if((0,L.l9)(i))i=i.toNumber();else if(typeof i!="number")throw new TypeError("Parameter start must be a number")}if(s){if((0,L.l9)(o))o=o.toNumber();else if(typeof o!="number")throw new TypeError("Parameter end must be a number")}if(p){if((0,L.l9)(t))t=t.toNumber();else if(typeof t!="number")throw new TypeError("Parameter step must be a number")}this.start=r?parseFloat(i):0,this.end=s?parseFloat(o):0,this.step=p?parseFloat(t):1}return u.prototype.type="Range",u.prototype.isRange=!0,u.parse=function(i){if(typeof i!="string")return null;var o=i.split(":"),t=o.map(function(s){return parseFloat(s)}),r=t.some(function(s){return isNaN(s)});if(r)return null;switch(t.length){case 2:return new u(t[0],t[1]);case 3:return new u(t[0],t[2],t[1]);default:return null}},u.prototype.clone=function(){return new u(this.start,this.end,this.step)},u.prototype.size=function(){var i=0,o=this.start,t=this.step,r=this.end,s=r-o;return(0,le.Xx)(t)===(0,le.Xx)(s)?i=Math.ceil(s/t):s===0&&(i=0),isNaN(i)&&(i=0),[i]},u.prototype.min=function(){var i=this.size()[0];if(i>0)return this.step>0?this.start:this.start+(i-1)*this.step},u.prototype.max=function(){var i=this.size()[0];if(i>0)return this.step>0?this.start+(i-1)*this.step:this.start},u.prototype.forEach=function(i){var o=this.start,t=this.step,r=this.end,s=0;if(t>0)for(;o<r;)i(o,[s],this),o+=t,s++;else if(t<0)for(;o>r;)i(o,[s],this),o+=t,s++},u.prototype.map=function(i){var o=[];return this.forEach(function(t,r,s){o[r[0]]=i(t,r,s)}),o},u.prototype.toArray=function(){var i=[];return this.forEach(function(o,t){i[t[0]]=o}),i},u.prototype.valueOf=function(){return this.toArray()},u.prototype.format=function(i){var o=(0,le.WU)(this.start,i);return this.step!==1&&(o+=":"+(0,le.WU)(this.step,i)),o+=":"+(0,le.WU)(this.end,i),o},u.prototype.toString=function(){return this.format()},u.prototype.toJSON=function(){return{mathjs:"Range",start:this.start,end:this.end,step:this.step}},u.fromJSON=function(i){return new u(i.start,i.end,i.step)},u},{isClass:!0}),Pa="ResultSet",wu=[],Mu=(0,A.d5)(Pa,wu,()=>{function u(i){if(!(this instanceof u))throw new SyntaxError("Constructor must be called with the new operator");this.entries=i||[]}return u.prototype.type="ResultSet",u.prototype.isResultSet=!0,u.prototype.valueOf=function(){return this.entries},u.prototype.toString=function(){return"["+this.entries.join(", ")+"]"},u.prototype.toJSON=function(){return{mathjs:"ResultSet",entries:this.entries}},u.fromJSON=function(i){return new u(i.entries)},u},{isClass:!0}),ze=ie(58775),Jr=ie(66736),Sr=ie(75150),pt=ie(89858),Au="DenseMatrix",Su=["Matrix"],_u=(0,A.d5)(Au,Su,u=>{var{Matrix:i}=u;function o(n,e){if(!(this instanceof o))throw new SyntaxError("Constructor must be called with the new operator");if(e&&!(0,L.HD)(e))throw new Error("Invalid datatype: "+e);if((0,L.SW)(n))n.type==="DenseMatrix"?(this._data=(0,Sr.d9)(n._data),this._size=(0,Sr.d9)(n._size),this._datatype=e||n._datatype):(this._data=n.toArray(),this._size=n.size(),this._datatype=e||n._datatype);else if(n&&(0,L.kJ)(n.data)&&(0,L.kJ)(n.size))this._data=n.data,this._size=n.size,(0,ze.Gu)(this._data,this._size),this._datatype=e||n.datatype;else if((0,L.kJ)(n))this._data=m(n),this._size=(0,ze.aJ)(this._data),(0,ze.Gu)(this._data,this._size),this._datatype=e;else{if(n)throw new TypeError("Unsupported type of data ("+(0,L.kM)(n)+")");this._data=[],this._size=[0],this._datatype=e}}o.prototype=new i,o.prototype.createDenseMatrix=function(n,e){return new o(n,e)},o.prototype.type="DenseMatrix",o.prototype.isDenseMatrix=!0,o.prototype.getDataType=function(){return(0,ze.$q)(this._data,L.kM)},o.prototype.storage=function(){return"dense"},o.prototype.datatype=function(){return this._datatype},o.prototype.create=function(n,e){return new o(n,e)},o.prototype.subset=function(n,e,a){switch(arguments.length){case 1:return t(this,n);case 2:case 3:return s(this,n,e,a);default:throw new SyntaxError("Wrong number of arguments")}},o.prototype.get=function(n){if(!(0,L.kJ)(n))throw new TypeError("Array expected");if(n.length!==this._size.length)throw new pt.m(n.length,this._size.length);for(var e=0;e<n.length;e++)(0,ze.Ls)(n[e],this._size[e]);for(var a=this._data,l=0,c=n.length;l<c;l++){var f=n[l];(0,ze.Ls)(f,a.length),a=a[f]}return a},o.prototype.set=function(n,e,a){if(!(0,L.kJ)(n))throw new TypeError("Array expected");if(n.length<this._size.length)throw new pt.m(n.length,this._size.length,"<");var l,c,f,b=n.map(function(E){return E+1});v(this,b,a);var w=this._data;for(l=0,c=n.length-1;l<c;l++)f=n[l],(0,ze.Ls)(f,w.length),w=w[f];return f=n[n.length-1],(0,ze.Ls)(f,w.length),w[f]=e,this};function t(n,e){if(!(0,L.dh)(e))throw new TypeError("Invalid index");var a=e.isScalar();if(a)return n.get(e.min());var l=e.size();if(l.length!==n._size.length)throw new pt.m(l.length,n._size.length);for(var c=e.min(),f=e.max(),b=0,w=n._size.length;b<w;b++)(0,ze.Ls)(c[b],n._size[b]),(0,ze.Ls)(f[b],n._size[b]);return new o(r(n._data,e,l.length,0),n._datatype)}function r(n,e,a,l){var c=l===a-1,f=e.dimension(l);return c?f.map(function(b){return(0,ze.Ls)(b,n.length),n[b]}).valueOf():f.map(function(b){(0,ze.Ls)(b,n.length);var w=n[b];return r(w,e,a,l+1)}).valueOf()}function s(n,e,a,l){if(!e||e.isIndex!==!0)throw new TypeError("Invalid index");var c=e.size(),f=e.isScalar(),b;if((0,L.SW)(a)?(b=a.size(),a=a.valueOf()):b=(0,ze.aJ)(a),f){if(b.length!==0)throw new TypeError("Scalar expected");n.set(e.min(),a,l)}else{if(c.length<n._size.length)throw new pt.m(c.length,n._size.length,"<");if(b.length<c.length){for(var w=0,E=0;c[w]===1&&b[w]===1;)w++;for(;c[w]===1;)E++,w++;a=(0,ze.f4)(a,c.length,E,b)}if(!(0,Sr.J5)(c,b))throw new pt.m(c,b,">");var g=e.max().map(function(h){return h+1});v(n,g,l);var S=c.length,N=0;p(n._data,e,a,S,N)}return n}function p(n,e,a,l,c){var f=c===l-1,b=e.dimension(c);f?b.forEach(function(w,E){(0,ze.Ls)(w),n[w]=a[E[0]]}):b.forEach(function(w,E){(0,ze.Ls)(w),p(n[w],e,a[E[0]],l,c+1)})}o.prototype.resize=function(n,e,a){if(!(0,L.uZ)(n))throw new TypeError("Array or Matrix expected");var l=n.valueOf().map(f=>Array.isArray(f)&&f.length===1?f[0]:f),c=a?this.clone():this;return d(c,l,e)};function d(n,e,a){if(e.length===0){for(var l=n._data;(0,L.kJ)(l);)l=l[0];return l}return n._size=e.slice(0),n._data=(0,ze.SI)(n._data,n._size,a),n}o.prototype.reshape=function(n,e){var a=e?this.clone():this;a._data=(0,ze.XL)(a._data,n);var l=a._size.reduce((c,f)=>c*f);return a._size=(0,ze.eu)(n,l),a};function v(n,e,a){for(var l=n._size.slice(0),c=!1;l.length<e.length;)l.push(0),c=!0;for(var f=0,b=e.length;f<b;f++)e[f]>l[f]&&(l[f]=e[f],c=!0);c&&d(n,l,a)}o.prototype.clone=function(){var n=new o({data:(0,Sr.d9)(this._data),size:(0,Sr.d9)(this._size),datatype:this._datatype});return n},o.prototype.size=function(){return this._size.slice(0)},o.prototype.map=function(n){var e=this,a=function f(b,w){return(0,L.kJ)(b)?b.map(function(E,g){return f(E,w.concat(g))}):n(b,w,e)},l=a(this._data,[]),c=this._datatype!==void 0?(0,ze.$q)(l,L.kM):void 0;return new o(l,c)},o.prototype.forEach=function(n){var e=this,a=function l(c,f){(0,L.kJ)(c)?c.forEach(function(b,w){l(b,f.concat(w))}):n(c,f,e)};a(this._data,[])},o.prototype[Symbol.iterator]=function*(){var n=function*e(a,l){if((0,L.kJ)(a))for(var c=0;c<a.length;c++)yield*e(a[c],l.concat(c));else yield{value:a,index:l}};yield*n(this._data,[])},o.prototype.rows=function(){var n=[],e=this.size();if(e.length!==2)throw new TypeError("Rows can only be returned for a 2D matrix.");var a=this._data;for(var l of a)n.push(new o([l],this._datatype));return n},o.prototype.columns=function(){var n=this,e=[],a=this.size();if(a.length!==2)throw new TypeError("Rows can only be returned for a 2D matrix.");for(var l=this._data,c=function(w){var E=l.map(g=>[g[w]]);e.push(new o(E,n._datatype))},f=0;f<a[1];f++)c(f);return e},o.prototype.toArray=function(){return(0,Sr.d9)(this._data)},o.prototype.valueOf=function(){return this._data},o.prototype.format=function(n){return(0,Jr.WU)(this._data,n)},o.prototype.toString=function(){return(0,Jr.WU)(this._data)},o.prototype.toJSON=function(){return{mathjs:"DenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},o.prototype.diagonal=function(n){if(n){if((0,L.l9)(n)&&(n=n.toNumber()),!(0,L.hj)(n)||!(0,le.U)(n))throw new TypeError("The parameter k must be an integer number")}else n=0;for(var e=n>0?n:0,a=n<0?-n:0,l=this._size[0],c=this._size[1],f=Math.min(l-a,c-e),b=[],w=0;w<f;w++)b[w]=this._data[w+a][w+e];return new o({data:b,size:[f],datatype:this._datatype})},o.diagonal=function(n,e,a,l){if(!(0,L.kJ)(n))throw new TypeError("Array expected, size parameter");if(n.length!==2)throw new Error("Only two dimensions matrix are supported");if(n=n.map(function(C){if((0,L.l9)(C)&&(C=C.toNumber()),!(0,L.hj)(C)||!(0,le.U)(C)||C<1)throw new Error("Size values must be positive integers");return C}),a){if((0,L.l9)(a)&&(a=a.toNumber()),!(0,L.hj)(a)||!(0,le.U)(a))throw new TypeError("The parameter k must be an integer number")}else a=0;var c=a>0?a:0,f=a<0?-a:0,b=n[0],w=n[1],E=Math.min(b-f,w-c),g;if((0,L.kJ)(e)){if(e.length!==E)throw new Error("Invalid value array length");g=function(O){return e[O]}}else if((0,L.SW)(e)){var S=e.size();if(S.length!==1||S[0]!==E)throw new Error("Invalid matrix length");g=function(O){return e.get([O])}}else g=function(){return e};l||(l=(0,L.l9)(g(0))?g(0).mul(0):0);var N=[];if(n.length>0){N=(0,ze.SI)(N,n,l);for(var h=0;h<E;h++)N[h+f][h+c]=g(h)}return new o({data:N,size:[b,w]})},o.fromJSON=function(n){return new o(n)},o.prototype.swapRows=function(n,e){if(!(0,L.hj)(n)||!(0,le.U)(n)||!(0,L.hj)(e)||!(0,le.U)(e))throw new Error("Row index must be positive integers");if(this._size.length!==2)throw new Error("Only two dimensional matrix is supported");return(0,ze.Ls)(n,this._size[0]),(0,ze.Ls)(e,this._size[0]),o._swapRows(n,e,this._data),this},o._swapRows=function(n,e,a){var l=a[n];a[n]=a[e],a[e]=l};function m(n){for(var e=0,a=n.length;e<a;e++){var l=n[e];(0,L.kJ)(l)?n[e]=m(l):l&&l.isMatrix===!0&&(n[e]=m(l.valueOf()))}return n}return o},{isClass:!0}),La="replacer",Eu=[],Cu=(0,A.d5)(La,Eu,()=>function(i,o){return typeof o=="number"&&(!isFinite(o)||isNaN(o))?{mathjs:"number",value:String(o)}:o}),pa=ie(82287),Ou=ie(32538),qa=function(){return qa=pa.create,pa},Wa=["?BigNumber","?Complex","?DenseMatrix","?Fraction"],Du=(0,A.d5)("typed",Wa,function(i){var{BigNumber:o,Complex:t,DenseMatrix:r,Fraction:s}=i,p=qa();return p.types=[{name:"number",test:L.hj},{name:"Complex",test:L.Mc},{name:"BigNumber",test:L.l9},{name:"Fraction",test:L.yQ},{name:"Unit",test:L.wr},{name:"string",test:L.HD},{name:"Chain",test:L.qg},{name:"Array",test:L.kJ},{name:"Matrix",test:L.SW},{name:"DenseMatrix",test:L.jH},{name:"SparseMatrix",test:L.sA},{name:"Range",test:L.bR},{name:"Index",test:L.dh},{name:"boolean",test:L.jn},{name:"ResultSet",test:L.cB},{name:"Help",test:L.x1},{name:"function",test:L.mf},{name:"Date",test:L.J_},{name:"RegExp",test:L.Kj},{name:"null",test:L.Ft},{name:"undefined",test:L.o8},{name:"AccessorNode",test:L.Yz},{name:"ArrayNode",test:L.j0},{name:"AssignmentNode",test:L.Bp},{name:"BlockNode",test:L.zh},{name:"ConditionalNode",test:L.tS},{name:"ConstantNode",test:L.nu},{name:"FunctionNode",test:L.VO},{name:"FunctionAssignmentNode",test:L.l7},{name:"IndexNode",test:L.Cl},{name:"Node",test:L.UG},{name:"ObjectNode",test:L.Lr},{name:"OperatorNode",test:L.bV},{name:"ParenthesisNode",test:L.Ig},{name:"RangeNode",test:L.ex},{name:"SymbolNode",test:L.FG},{name:"Map",test:Ou._N},{name:"Object",test:L.Kn}],p.conversions=[{from:"number",to:"BigNumber",convert:function(v){if(o||da(v),(0,le.nz)(v)>15)throw new TypeError("Cannot implicitly convert a number with >15 significant digits to BigNumber (value: "+v+"). Use function bignumber(x) to convert to BigNumber.");return new o(v)}},{from:"number",to:"Complex",convert:function(v){return t||Jn(v),new t(v,0)}},{from:"number",to:"string",convert:function(v){return v+""}},{from:"BigNumber",to:"Complex",convert:function(v){return t||Jn(v),new t(v.toNumber(),0)}},{from:"Fraction",to:"BigNumber",convert:function(v){throw new TypeError("Cannot implicitly convert a Fraction to BigNumber or vice versa. Use function bignumber(x) to convert to BigNumber or fraction(x) to convert to Fraction.")}},{from:"Fraction",to:"Complex",convert:function(v){return t||Jn(v),new t(v.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(v){s||ha(v);var m=new s(v);if(m.valueOf()!==v)throw new TypeError("Cannot implicitly convert a number to a Fraction when there will be a loss of precision (value: "+v+"). Use function fraction(x) to convert to Fraction.");return m}},{from:"string",to:"number",convert:function(v){var m=Number(v);if(isNaN(m))throw new Error('Cannot convert "'+v+'" to a number');return m}},{from:"string",to:"BigNumber",convert:function(v){o||da(v);try{return new o(v)}catch{throw new Error('Cannot convert "'+v+'" to BigNumber')}}},{from:"string",to:"Fraction",convert:function(v){s||ha(v);try{return new s(v)}catch{throw new Error('Cannot convert "'+v+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(v){t||Jn(v);try{return new t(v)}catch{throw new Error('Cannot convert "'+v+'" to Complex')}}},{from:"boolean",to:"number",convert:function(v){return+v}},{from:"boolean",to:"BigNumber",convert:function(v){return o||da(v),new o(+v)}},{from:"boolean",to:"Fraction",convert:function(v){return s||ha(v),new s(+v)}},{from:"boolean",to:"string",convert:function(v){return String(v)}},{from:"Array",to:"Matrix",convert:function(v){return r||Bu(),new r(v)}},{from:"Matrix",to:"Array",convert:function(v){return v.valueOf()}}],p});function da(u){throw new Error("Cannot convert value ".concat(u," into a BigNumber: no class 'BigNumber' provided"))}function Jn(u){throw new Error("Cannot convert value ".concat(u," into a Complex number: no class 'Complex' provided"))}function Bu(){throw new Error("Cannot convert array into a Matrix: no class 'DenseMatrix' provided")}function ha(u){throw new Error("Cannot convert value ".concat(u," into a Fraction, no class 'Fraction' provided."))}var Mr=ie(28337),Ut="number",Zt="number, number";function Ga(u){return Math.abs(u)}Ga.signature=Ut;function Ha(u,i){return u+i}Ha.signature=Zt;function ka(u,i){return u-i}ka.signature=Zt;function $a(u,i){return u*i}$a.signature=Zt;function Tu(u,i){return u/i}Tu.signature=Zt;function Va(u){return-u}Va.signature=Ut;function Ja(u){return u}Ja.signature=Ut;function Dn(u){return(0,le.eK)(u)}Dn.signature=Ut;function Za(u){return u*u*u}Za.signature=Ut;function Ka(u){return Math.exp(u)}Ka.signature=Ut;function Ya(u){return(0,le.t$)(u)}Ya.signature=Ut;function Xa(u,i){if(!(0,le.U)(u)||!(0,le.U)(i))throw new Error("Parameters in function gcd must be integer numbers");for(var o;i!==0;)o=u%i,u=i,i=o;return u<0?-u:u}Xa.signature=Zt;function Qa(u,i){if(!(0,le.U)(u)||!(0,le.U)(i))throw new Error("Parameters in function lcm must be integer numbers");if(u===0||i===0)return 0;for(var o,t=u*i;i!==0;)o=i,i=u%o,u=o;return Math.abs(t/u)}Qa.signature=Zt;function Uu(u,i){return i?Math.log(u)/Math.log(i):Math.log(u)}function ja(u){return(0,le.mv)(u)}ja.signature=Ut;function ei(u){return(0,le.k3)(u)}ei.signature=Ut;function Ru(u){return(0,le.Kr)(u)}Ru.signature=Ut;function ri(u,i){if(i>0)return u-i*Math.floor(u/i);if(i===0)return u;throw new Error("Cannot calculate mod for a negative divisor")}ri.signature=Zt;function ti(u){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2,o=i<0;if(o&&(i=-i),i===0)throw new Error("Root must be non-zero");if(u<0&&Math.abs(i)%2!==1)throw new Error("Root must be odd when a is negative.");if(u===0)return o?1/0:0;if(!isFinite(u))return o?0:u;var t=Math.pow(Math.abs(u),1/i);return t=u<0?-t:t,o?1/t:t}function ga(u){return(0,le.Xx)(u)}ga.signature=Ut;function Iu(u){return Math.sqrt(u)}Iu.signature=Ut;function ni(u){return u*u}ni.signature=Ut;function ai(u,i){var o,t,r,s=0,p=1,d=1,v=0;if(!(0,le.U)(u)||!(0,le.U)(i))throw new Error("Parameters in function xgcd must be integer numbers");for(;i;)t=Math.floor(u/i),r=u-t*i,o=s,s=p-t*s,p=o,o=d,d=v-t*d,v=o,u=i,i=r;var m;return u<0?m=[-u,-p,-v]:m=[u,u?p:0,v],m}ai.signature=Zt;function ii(u,i){return u*u<1&&i===1/0||u*u>1&&i===-1/0?0:Math.pow(u,i)}ii.signature=Zt;function oi(u){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(!(0,le.U)(i)||i<0||i>15)throw new Error("Number of decimals in function round must be an integer from 0 to 15 inclusive");return parseFloat((0,le.FH)(u,i))}function Fu(u){return Math.abs(u)}Fu.signature=Ut;var si="unaryPlus",zu=["typed","config","BigNumber"],Pu=(0,A.d5)(si,zu,u=>{var{typed:i,config:o,BigNumber:t}=u;return i(si,{number:Ja,Complex:function(s){return s},BigNumber:function(s){return s},Fraction:function(s){return s},Unit:function(s){return s.clone()},"Array | Matrix":function(s){return(0,Mr.Fh)(s,this,!0)},"boolean | string":function(s){return o.number==="BigNumber"?new t(+s):+s}})}),ui="abs",Lu=["typed"],qu=(0,A.d5)(ui,Lu,u=>{var{typed:i}=u;return i(ui,{number:Ga,Complex:function(t){return t.abs()},BigNumber:function(t){return t.abs()},Fraction:function(t){return t.abs()},"Array | Matrix":function(t){return(0,Mr.Fh)(t,this,!0)},Unit:function(t){return t.abs()}})}),ci="acos",Wu=["typed","config","Complex"],Gu=(0,A.d5)(ci,Wu,u=>{var{typed:i,config:o,Complex:t}=u;return i(ci,{number:function(s){return s>=-1&&s<=1||o.predictable?Math.acos(s):new t(s,0).acos()},Complex:function(s){return s.acos()},BigNumber:function(s){return s.acos()},"Array | Matrix":function(s){return(0,Mr.Fh)(s,this)}})}),ft="number",Hu="number, number";function ku(u){return Math.acos(u)}ku.signature=ft;function li(u){return(0,le.__)(u)}li.signature=ft;function fi(u){return Math.atan(1/u)}fi.signature=ft;function mi(u){return isFinite(u)?(Math.log((u+1)/u)+Math.log(u/(u-1)))/2:0}mi.signature=ft;function vi(u){return Math.asin(1/u)}vi.signature=ft;function pi(u){var i=1/u;return Math.log(i+Math.sqrt(i*i+1))}pi.signature=ft;function di(u){return Math.acos(1/u)}di.signature=ft;function hi(u){var i=1/u,o=Math.sqrt(i*i-1);return Math.log(o+i)}hi.signature=ft;function $u(u){return Math.asin(u)}$u.signature=ft;function gi(u){return(0,le.Vf)(u)}gi.signature=ft;function Vu(u){return Math.atan(u)}Vu.signature=ft;function Ju(u,i){return Math.atan2(u,i)}Ju.signature=Hu;function yi(u){return(0,le.C8)(u)}yi.signature=ft;function Zu(u){return Math.cos(u)}Zu.signature=ft;function Ku(u){return(0,le.f9)(u)}Ku.signature=ft;function xi(u){return 1/Math.tan(u)}xi.signature=ft;function bi(u){var i=Math.exp(2*u);return(i+1)/(i-1)}bi.signature=ft;function Ni(u){return 1/Math.sin(u)}Ni.signature=ft;function wi(u){return u===0?Number.POSITIVE_INFINITY:Math.abs(2/(Math.exp(u)-Math.exp(-u)))*(0,le.Xx)(u)}wi.signature=ft;function Mi(u){return 1/Math.cos(u)}Mi.signature=ft;function Ai(u){return 2/(Math.exp(u)+Math.exp(-u))}Ai.signature=ft;function Yu(u){return Math.sin(u)}Yu.signature=ft;function Si(u){return(0,le.R_)(u)}Si.signature=ft;function Xu(u){return Math.tan(u)}Xu.signature=ft;function Qu(u){return(0,le.AE)(u)}Qu.signature=ft;var _i="acot",ju=["typed","BigNumber"],ec=(0,A.d5)(_i,ju,u=>{var{typed:i,BigNumber:o}=u;return i(_i,{number:fi,Complex:function(r){return r.acot()},BigNumber:function(r){return new o(1).div(r).atan()},"Array | Matrix":function(r){return(0,Mr.Fh)(r,this)}})}),Ei="acsc",rc=["typed","config","Complex","BigNumber"],tc=(0,A.d5)(Ei,rc,u=>{var{typed:i,config:o,Complex:t,BigNumber:r}=u;return i(Ei,{number:function(p){return p<=-1||p>=1||o.predictable?vi(p):new t(p,0).acsc()},Complex:function(p){return p.acsc()},BigNumber:function(p){return new r(1).div(p).asin()},"Array | Matrix":function(p){return(0,Mr.Fh)(p,this)}})}),Ci="addScalar",nc=["typed"],ac=(0,A.d5)(Ci,nc,u=>{var{typed:i}=u;return i(Ci,{"number, number":Ha,"Complex, Complex":function(t,r){return t.add(r)},"BigNumber, BigNumber":function(t,r){return t.plus(r)},"Fraction, Fraction":function(t,r){return t.add(r)},"Unit, Unit":function(t,r){if(t.value===null||t.value===void 0)throw new Error("Parameter x contains a unit with undefined value");if(r.value===null||r.value===void 0)throw new Error("Parameter y contains a unit with undefined value");if(!t.equalBase(r))throw new Error("Units do not match");var s=t.clone();return s.value=this(s.value,r.value),s.fixPrefix=!1,s}})}),Oi="arg",ic=["typed"],oc=(0,A.d5)(Oi,ic,u=>{var{typed:i}=u;return i(Oi,{number:function(t){return Math.atan2(0,t)},BigNumber:function(t){return t.constructor.atan2(0,t)},Complex:function(t){return t.arg()},"Array | Matrix":function(t){return(0,Mr.Fh)(t,this)}})}),Di="asech",sc=["typed","config","Complex","BigNumber"],uc=(0,A.d5)(Di,sc,u=>{var{typed:i,config:o,Complex:t,BigNumber:r}=u;return i(Di,{number:function(p){if(p<=1&&p>=-1||o.predictable){var d=1/p;if(d>0||o.predictable)return hi(p);var v=Math.sqrt(d*d-1);return new t(Math.log(v-d),Math.PI)}return new t(p,0).asech()},Complex:function(p){return p.asech()},BigNumber:function(p){return new r(1).div(p).acosh()},"Array | Matrix":function(p){return(0,Mr.Fh)(p,this)}})}),cc="asinh",lc=["typed"],fc=(0,A.d5)(cc,lc,u=>{var{typed:i}=u;return i("asinh",{number:gi,Complex:function(t){return t.asinh()},BigNumber:function(t){return t.asinh()},"Array | Matrix":function(t){return(0,Mr.Fh)(t,this,!0)}})}),mc="atan",vc=["typed"],pc=(0,A.d5)(mc,vc,u=>{var{typed:i}=u;return i("atan",{number:function(t){return Math.atan(t)},Complex:function(t){return t.atan()},BigNumber:function(t){return t.atan()},"Array | Matrix":function(t){return(0,Mr.Fh)(t,this,!0)}})}),Bi="atanh",dc=["typed","config","Complex"],hc=(0,A.d5)(Bi,dc,u=>{var{typed:i,config:o,Complex:t}=u;return i(Bi,{number:function(s){return s<=1&&s>=-1||o.predictable?yi(s):new t(s,0).atanh()},Complex:function(s){return s.atanh()},BigNumber:function(s){return s.atanh()},"Array | Matrix":function(s){return(0,Mr.Fh)(s,this,!0)}})}),gc="bignumber",yc=["typed","BigNumber"],xc=(0,A.d5)(gc,yc,u=>{var{typed:i,BigNumber:o}=u;return i("bignumber",{"":function(){return new o(0)},number:function(r){return new o(r+"")},string:function(r){var s=r.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);if(s){var p=s[2],d=o(s[1]),v=new o(2).pow(Number(p));if(d.gt(v.sub(1)))throw new SyntaxError('String "'.concat(r,'" is out of range'));var m=new o(2).pow(Number(p)-1);return d.gte(m)?d.sub(v):d}return new o(r)},BigNumber:function(r){return r},Fraction:function(r){return new o(r.n).div(r.d).times(r.s)},null:function(r){return new o(0)},"Array | Matrix":function(r){return(0,Mr.Fh)(r,this)}})});function bc(u,i){if(u.isFinite()&&!u.isInteger()||i.isFinite()&&!i.isInteger())throw new Error("Integers expected in function bitAnd");var o=u.constructor;if(u.isNaN()||i.isNaN())return new o(NaN);if(u.isZero()||i.eq(-1)||u.eq(i))return u;if(i.isZero()||u.eq(-1))return i;if(!u.isFinite()||!i.isFinite()){if(!u.isFinite()&&!i.isFinite())return u.isNegative()===i.isNegative()?u:new o(0);if(!u.isFinite())return i.isNegative()?u:u.isNegative()?new o(0):i;if(!i.isFinite())return u.isNegative()?i:i.isNegative()?new o(0):u}return ya(u,i,function(t,r){return t&r})}function Bn(u){if(u.isFinite()&&!u.isInteger())throw new Error("Integer expected in function bitNot");var i=u.constructor,o=i.precision;i.config({precision:1e9});var t=u.plus(new i(1));return t.s=-t.s||null,i.config({precision:o}),t}function Nc(u,i){if(u.isFinite()&&!u.isInteger()||i.isFinite()&&!i.isInteger())throw new Error("Integers expected in function bitOr");var o=u.constructor;if(u.isNaN()||i.isNaN())return new o(NaN);var t=new o(-1);return u.isZero()||i.eq(t)||u.eq(i)?i:i.isZero()||u.eq(t)?u:!u.isFinite()||!i.isFinite()?!u.isFinite()&&!u.isNegative()&&i.isNegative()||u.isNegative()&&!i.isNegative()&&!i.isFinite()?t:u.isNegative()&&i.isNegative()?u.isFinite()?u:i:u.isFinite()?i:u:ya(u,i,function(r,s){return r|s})}function ya(u,i,o){var t=u.constructor,r,s,p=+(u.s<0),d=+(i.s<0);if(p){r=Zn(Bn(u));for(var v=0;v<r.length;++v)r[v]^=1}else r=Zn(u);if(d){s=Zn(Bn(i));for(var m=0;m<s.length;++m)s[m]^=1}else s=Zn(i);var n,e,a;r.length<=s.length?(n=r,e=s,a=p):(n=s,e=r,a=d);var l=n.length,c=e.length,f=o(p,d)^1,b=new t(f^1),w=new t(1),E=new t(2),g=t.precision;for(t.config({precision:1e9});l>0;)o(n[--l],e[--c])===f&&(b=b.plus(w)),w=w.times(E);for(;c>0;)o(a,e[--c])===f&&(b=b.plus(w)),w=w.times(E);return t.config({precision:g}),f===0&&(b.s=-b.s),b}function Zn(u){for(var i=u.d,o=i[0]+"",t=1;t<i.length;++t){for(var r=i[t]+"",s=7-r.length;s--;)r="0"+r;o+=r}for(var p=o.length;o.charAt(p)==="0";)p--;var d=u.e,v=o.slice(0,p+1||1),m=v.length;if(d>0)if(++d>m)for(d-=m;d--;)v+="0";else d<m&&(v=v.slice(0,d)+"."+v.slice(d));for(var n=[0],e=0;e<v.length;){for(var a=n.length;a--;)n[a]*=10;n[0]+=parseInt(v.charAt(e++));for(var l=0;l<n.length;++l)n[l]>1&&((n[l+1]===null||n[l+1]===void 0)&&(n[l+1]=0),n[l+1]+=n[l]>>1,n[l]&=1)}return n.reverse()}function wc(u,i){if(u.isFinite()&&!u.isInteger()||i.isFinite()&&!i.isInteger())throw new Error("Integers expected in function bitXor");var o=u.constructor;if(u.isNaN()||i.isNaN())return new o(NaN);if(u.isZero())return i;if(i.isZero())return u;if(u.eq(i))return new o(0);var t=new o(-1);return u.eq(t)?Bn(i):i.eq(t)?Bn(u):!u.isFinite()||!i.isFinite()?!u.isFinite()&&!i.isFinite()?t:new o(u.isNegative()===i.isNegative()?1/0:-1/0):ya(u,i,function(r,s){return r^s})}function Mc(u,i){if(u.isFinite()&&!u.isInteger()||i.isFinite()&&!i.isInteger())throw new Error("Integers expected in function leftShift");var o=u.constructor;return u.isNaN()||i.isNaN()||i.isNegative()&&!i.isZero()?new o(NaN):u.isZero()||i.isZero()?u:!u.isFinite()&&!i.isFinite()?new o(NaN):i.lt(55)?u.times(Math.pow(2,i.toNumber())+""):u.times(new o(2).pow(i))}function Ac(u,i){if(u.isFinite()&&!u.isInteger()||i.isFinite()&&!i.isInteger())throw new Error("Integers expected in function rightArithShift");var o=u.constructor;return u.isNaN()||i.isNaN()||i.isNegative()&&!i.isZero()?new o(NaN):u.isZero()||i.isZero()?u:i.isFinite()?i.lt(55)?u.div(Math.pow(2,i.toNumber())+"").floor():u.div(new o(2).pow(i)).floor():u.isNegative()?new o(-1):u.isFinite()?new o(0):new o(NaN)}var Sc="number",bn="number, number";function Ti(u,i){if(!(0,le.U)(u)||!(0,le.U)(i))throw new Error("Integers expected in function bitAnd");return u&i}Ti.signature=bn;function Ui(u){if(!(0,le.U)(u))throw new Error("Integer expected in function bitNot");return~u}Ui.signature=Sc;function Ri(u,i){if(!(0,le.U)(u)||!(0,le.U)(i))throw new Error("Integers expected in function bitOr");return u|i}Ri.signature=bn;function Ii(u,i){if(!(0,le.U)(u)||!(0,le.U)(i))throw new Error("Integers expected in function bitXor");return u^i}Ii.signature=bn;function Fi(u,i){if(!(0,le.U)(u)||!(0,le.U)(i))throw new Error("Integers expected in function leftShift");return u<<i}Fi.signature=bn;function zi(u,i){if(!(0,le.U)(u)||!(0,le.U)(i))throw new Error("Integers expected in function rightArithShift");return u>>i}zi.signature=bn;function Pi(u,i){if(!(0,le.U)(u)||!(0,le.U)(i))throw new Error("Integers expected in function rightLogShift");return u>>>i}Pi.signature=bn;var Li="bitNot",_c=["typed"],Ec=(0,A.d5)(Li,_c,u=>{var{typed:i}=u;return i(Li,{number:Ui,BigNumber:Bn,"Array | Matrix":function(t){return(0,Mr.Fh)(t,this)}})}),qi="boolean",Cc=["typed"],Oc=(0,A.d5)(qi,Cc,u=>{var{typed:i}=u;return i(qi,{"":function(){return!1},boolean:function(t){return t},number:function(t){return!!t},null:function(t){return!1},BigNumber:function(t){return!t.isZero()},string:function(t){var r=t.toLowerCase();if(r==="true")return!0;if(r==="false")return!1;var s=Number(t);if(t!==""&&!isNaN(s))return!!s;throw new Error('Cannot convert "'+t+'" to a boolean')},"Array | Matrix":function(t){return(0,Mr.Fh)(t,this)}})}),Wi="clone",Dc=["typed"],Bc=(0,A.d5)(Wi,Dc,u=>{var{typed:i}=u;return i(Wi,{any:Sr.d9})});function Kt(u,i){if(i<u)return 1;if(i===u)return i;var o=i+u>>1;return Kt(u,o)*Kt(o+1,i)}function Gi(u,i){if(!(0,le.U)(u)||u<0)throw new TypeError("Positive integer value expected in function combinations");if(!(0,le.U)(i)||i<0)throw new TypeError("Positive integer value expected in function combinations");if(i>u)throw new TypeError("k must be less than or equal to n");for(var o=u-i,t=1,r=i<o?o+1:i+1,s=2,p=i<o?i:o,d=r;d<=u;++d)for(t*=d;s<=p&&t%s===0;)t/=s,++s;return s<=p&&(t/=Kt(s,p)),t}Gi.signature="number, number";var Hi="combinations",Tc=["typed"],Uc=(0,A.d5)(Hi,Tc,u=>{var{typed:i}=u;return i(Hi,{"number, number":Gi,"BigNumber, BigNumber":function(t,r){var s=t.constructor,p,d,v=t.minus(r),m=new s(1);if(!ki(t)||!ki(r))throw new TypeError("Positive integer value expected in function combinations");if(r.gt(t))throw new TypeError("k must be less than n in function combinations");if(p=m,r.lt(v))for(d=m;d.lte(v);d=d.plus(m))p=p.times(r.plus(d)).dividedBy(d);else for(d=m;d.lte(r);d=d.plus(m))p=p.times(v.plus(d)).dividedBy(d);return p}})});function ki(u){return u.isInteger()&&u.gte(0)}var Rc="complex",Ic=["typed","Complex"],Fc=(0,A.d5)(Rc,Ic,u=>{var{typed:i,Complex:o}=u;return i("complex",{"":function(){return o.ZERO},number:function(r){return new o(r,0)},"number, number":function(r,s){return new o(r,s)},"BigNumber, BigNumber":function(r,s){return new o(r.toNumber(),s.toNumber())},Fraction:function(r){return new o(r.valueOf(),0)},Complex:function(r){return r.clone()},string:function(r){return o(r)},null:function(r){return o(0)},Object:function(r){if("re"in r&&"im"in r)return new o(r.re,r.im);if("r"in r&&"phi"in r||"abs"in r&&"arg"in r)return new o(r);throw new Error("Expected object with properties (re and im) or (r and phi) or (abs and arg)")},"Array | Matrix":function(r){return(0,Mr.Fh)(r,this)}})}),$i="conj",zc=["typed"],Pc=(0,A.d5)($i,zc,u=>{var{typed:i}=u;return i($i,{number:function(t){return t},BigNumber:function(t){return t},Complex:function(t){return t.conjugate()},"Array | Matrix":function(t){return(0,Mr.Fh)(t,this)}})}),Vi="cosh",Lc=["typed"],qc=(0,A.d5)(Vi,Lc,u=>{var{typed:i}=u;return i(Vi,{number:le.f9,Complex:function(t){return t.cosh()},BigNumber:function(t){return t.cosh()},Unit:function(t){if(!t.hasBase(t.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cosh is no angle");return this(t.value)},"Array | Matrix":function(t){return(0,Mr.Fh)(t,this)}})}),Ji="coth",Wc=["typed","BigNumber"],Gc=(0,A.d5)(Ji,Wc,u=>{var{typed:i,BigNumber:o}=u;return i(Ji,{number:bi,Complex:function(r){return r.coth()},BigNumber:function(r){return new o(1).div(r.tanh())},Unit:function(r){if(!r.hasBase(r.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function coth is no angle");return this(r.value)},"Array | Matrix":function(r){return(0,Mr.Fh)(r,this)}})}),Zi="csc",Hc=["typed","BigNumber"],kc=(0,A.d5)(Zi,Hc,u=>{var{typed:i,BigNumber:o}=u;return i(Zi,{number:Ni,Complex:function(r){return r.csc()},BigNumber:function(r){return new o(1).div(r.sin())},Unit:function(r){if(!r.hasBase(r.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function csc is no angle");return this(r.value)},"Array | Matrix":function(r){return(0,Mr.Fh)(r,this)}})}),Ki="cube",$c=["typed"],Vc=(0,A.d5)(Ki,$c,u=>{var{typed:i}=u;return i(Ki,{number:Za,Complex:function(t){return t.mul(t).mul(t)},BigNumber:function(t){return t.times(t).times(t)},Fraction:function(t){return t.pow(3)},"Array | Matrix":function(t){return(0,Mr.Fh)(t,this,!0)},Unit:function(t){return t.pow(3)}})});function $t(u,i,o){if(o==null)return u.eq(i);if(u.eq(i))return!0;if(u.isNaN()||i.isNaN())return!1;if(u.isFinite()&&i.isFinite()){var t=u.minus(i).abs();if(t.isZero())return!0;var r=u.constructor.max(u.abs(),i.abs());return t.lte(r.times(o))}return!1}function Jc(u,i,o){return(0,le.RI)(u.re,i.re,o)&&(0,le.RI)(u.im,i.im,o)}var Kn="equalScalar",Zc=["typed","config"],Kc=(0,A.d5)(Kn,Zc,u=>{var{typed:i,config:o}=u;return i(Kn,{"boolean, boolean":function(r,s){return r===s},"number, number":function(r,s){return(0,le.RI)(r,s,o.epsilon)},"BigNumber, BigNumber":function(r,s){return r.eq(s)||$t(r,s,o.epsilon)},"Fraction, Fraction":function(r,s){return r.equals(s)},"Complex, Complex":function(r,s){return Jc(r,s,o.epsilon)},"Unit, Unit":function(r,s){if(!r.equalBase(s))throw new Error("Cannot compare units with different base");return this(r.value,s.value)}})}),dm=(0,A.d5)(Kn,["typed","config"],u=>{var{typed:i,config:o}=u;return i(Kn,{"number, number":function(r,s){return(0,le.RI)(r,s,o.epsilon)}})}),Yc="erf",Xc=["typed"],Qc=(0,A.d5)(Yc,Xc,u=>{var{typed:i}=u;return i("name",{number:function(p){var d=Math.abs(p);return d>=rl?(0,le.Xx)(p):d<=jc?(0,le.Xx)(p)*o(d):d<=4?(0,le.Xx)(p)*(1-t(d)):(0,le.Xx)(p)*(1-r(d))},"Array | Matrix":function(p){return(0,Mr.Fh)(p,this)}});function o(s){var p=s*s,d=Yt[0][4]*p,v=p,m;for(m=0;m<3;m+=1)d=(d+Yt[0][m])*p,v=(v+Nn[0][m])*p;return s*(d+Yt[0][3])/(v+Nn[0][3])}function t(s){var p=Yt[1][8]*s,d=s,v;for(v=0;v<7;v+=1)p=(p+Yt[1][v])*s,d=(d+Nn[1][v])*s;var m=(p+Yt[1][7])/(d+Nn[1][7]),n=parseInt(s*16)/16,e=(s-n)*(s+n);return Math.exp(-n*n)*Math.exp(-e)*m}function r(s){var p=1/(s*s),d=Yt[2][5]*p,v=p,m;for(m=0;m<4;m+=1)d=(d+Yt[2][m])*p,v=(v+Nn[2][m])*p;var n=p*(d+Yt[2][4])/(v+Nn[2][4]);n=(el-n)/s,p=parseInt(s*16)/16;var e=(s-p)*(s+p);return Math.exp(-p*p)*Math.exp(-e)*n}}),jc=.46875,el=.5641895835477563,Yt=[[3.1611237438705655,113.86415415105016,377.485237685302,3209.3775891384694,.18577770618460315],[.5641884969886701,8.883149794388377,66.11919063714163,298.6351381974001,881.952221241769,1712.0476126340707,2051.0783778260716,1230.3393547979972,21531153547440383e-24],[.30532663496123236,.36034489994980445,.12578172611122926,.016083785148742275,.0006587491615298378,.016315387137302097]],Nn=[[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]],rl=Math.pow(2,53),Yi="exp",tl=["typed"],nl=(0,A.d5)(Yi,tl,u=>{var{typed:i}=u;return i(Yi,{number:Ka,Complex:function(t){return t.exp()},BigNumber:function(t){return t.exp()},"Array | Matrix":function(t){return(0,Mr.Fh)(t,this)}})}),Xi="expm1",al=["typed","Complex"],il=(0,A.d5)(Xi,al,u=>{var{typed:i,Complex:o}=u;return i(Xi,{number:Ya,Complex:function(r){var s=Math.exp(r.re);return new o(s*Math.cos(r.im)-1,s*Math.sin(r.im))},BigNumber:function(r){return r.exp().minus(1)},"Array | Matrix":function(r){return(0,Mr.Fh)(r,this)}})}),ol="filter",sl=["typed"],ul=(0,A.d5)(ol,sl,u=>{var{typed:i}=u;return i("filter",{"Array, function":Qi,"Matrix, function":function(t,r){return t.create(Qi(t.toArray(),r))},"Array, RegExp":ze.U_,"Matrix, RegExp":function(t,r){return t.create((0,ze.U_)(t.toArray(),r))}})});function Qi(u,i){var o=(0,fe.oV)(i);return(0,ze.hX)(u,function(t,r,s){return o===1?i(t):o===2?i(t,[r]):i(t,[r],s)})}var ji="forEach",cl=["typed"],ll=(0,A.d5)(ji,cl,u=>{var{typed:i}=u;return i(ji,{"Array, function":fl,"Matrix, function":function(t,r){return t.forEach(r)}})});function fl(u,i){var o=(0,fe.oV)(i),t=function r(s,p){Array.isArray(s)?(0,ze.Ed)(s,function(d,v){r(d,p.concat(v))}):o===1?i(s):o===2?i(s,p):i(s,p,u)};t(u,[])}var eo="format",ml=["typed"],vl=(0,A.d5)(eo,ml,u=>{var{typed:i}=u;return i(eo,{any:Jr.WU,"any, Object | function | number":Jr.WU})}),ro="getMatrixDataType",pl=["typed"],dl=(0,A.d5)(ro,pl,u=>{var{typed:i}=u;return i(ro,{Array:function(t){return(0,ze.$q)(t,L.kM)},Matrix:function(t){return t.getDataType()}})}),to="hex",hl=["typed","format"],gl=(0,A.d5)(to,hl,u=>{var{typed:i,format:o}=u;return i(to,{"number | BigNumber":function(r){return o(r,{notation:"hex"})},"number | BigNumber, number":function(r,s){return o(r,{notation:"hex",wordSize:s})}})}),no="im",yl=["typed"],xl=(0,A.d5)(no,yl,u=>{var{typed:i}=u;return i(no,{number:function(t){return 0},BigNumber:function(t){return t.mul(0)},Fraction:function(t){return t.mul(0)},Complex:function(t){return t.im},"Array | Matrix":function(t){return(0,Mr.Fh)(t,this)}})}),ao="isInteger",bl=["typed"],Nl=(0,A.d5)(ao,bl,u=>{var{typed:i}=u;return i(ao,{number:le.U,BigNumber:function(t){return t.isInt()},Fraction:function(t){return t.d===1&&isFinite(t.n)},"Array | Matrix":function(t){return(0,Mr.Fh)(t,this)}})}),Tn="number";function wl(u){return(0,le.U)(u)}wl.signature=Tn;function io(u){return u<0}io.signature=Tn;function oo(u){return u>0}oo.signature=Tn;function so(u){return u===0}so.signature=Tn;function uo(u){return Number.isNaN(u)}uo.signature=Tn;var co="isNegative",Ml=["typed"],Al=(0,A.d5)(co,Ml,u=>{var{typed:i}=u;return i(co,{number:io,BigNumber:function(t){return t.isNeg()&&!t.isZero()&&!t.isNaN()},Fraction:function(t){return t.s<0},Unit:function(t){return this(t.value)},"Array | Matrix":function(t){return(0,Mr.Fh)(t,this)}})}),lo="isPositive",Sl=["typed"],_l=(0,A.d5)(lo,Sl,u=>{var{typed:i}=u;return i(lo,{number:oo,BigNumber:function(t){return!t.isNeg()&&!t.isZero()&&!t.isNaN()},Fraction:function(t){return t.s>0&&t.n>0},Unit:function(t){return this(t.value)},"Array | Matrix":function(t){return(0,Mr.Fh)(t,this)}})}),fo="isZero",El=["typed"],Cl=(0,A.d5)(fo,El,u=>{var{typed:i}=u;return i(fo,{number:so,BigNumber:function(t){return t.isZero()},Complex:function(t){return t.re===0&&t.im===0},Fraction:function(t){return t.d===1&&t.n===0},Unit:function(t){return this(t.value)},"Array | Matrix":function(t){return(0,Mr.Fh)(t,this)}})});function xa(u){var i;if((0,le.U)(u))return u<=0?isFinite(u)?1/0:NaN:u>171?1/0:Kt(1,u-1);if(u<.5)return Math.PI/(Math.sin(Math.PI*u)*xa(1-u));if(u>=171.35)return 1/0;if(u>85){var o=u*u,t=o*u,r=t*u,s=r*u;return Math.sqrt(2*Math.PI/u)*Math.pow(u/Math.E,u)*(1+1/(12*u)+1/(288*o)-139/(51840*t)-571/(2488320*r)+163879/(209018880*s)+5246819/(75246796800*s*u))}--u,i=wn[0];for(var p=1;p<wn.length;++p)i+=wn[p]/(u+p);var d=u+mo+.5;return Math.sqrt(2*Math.PI)*Math.pow(d,u+.5)*Math.exp(-d)*i}xa.signature="number";var mo=4.7421875,wn=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22],vo=.9189385332046728,Ol=5,Dl=7,po=[1.000000000190015,76.18009172947146,-86.50532032941678,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18];function Yn(u){if(u<0)return NaN;if(u===0)return 1/0;if(!isFinite(u))return u;if(u<.5)return Math.log(Math.PI/Math.sin(Math.PI*u))-Yn(1-u);u=u-1;for(var i=u+Ol+.5,o=po[0],t=Dl-1;t>=1;t--)o+=po[t]/(u+t);return vo+(u+.5)*Math.log(i)-i+Math.log(o)}Yn.signature="number";var ho="lgamma",Bl=["Complex","typed"],Tl=(0,A.d5)(ho,Bl,u=>{var{Complex:i,typed:o}=u,t=7,r=7,s=[-.029550653594771242,.00641025641025641,-.0019175269175269176,.0008417508417508417,-.0005952380952380953,.0007936507936507937,-.002777777777777778,.08333333333333333];return o(ho,{number:Yn,Complex:function(m){var n=6.283185307179586,e=1.1447298858494002,a=.1;if(m.isNaN())return new i(NaN,NaN);if(m.im===0)return new i(Yn(m.re),0);if(m.re>=t||Math.abs(m.im)>=r)return p(m);if(m.re<=a){var l=(0,le.JG)(n,m.im)*Math.floor(.5*m.re+.25),c=m.mul(Math.PI).sin().log(),f=this(new i(1-m.re,-m.im));return new i(e,l).sub(c).sub(f)}else return m.im>=0?d(m):d(m.conjugate()).conjugate()},BigNumber:function(){throw new Error("mathjs doesn't yet provide an implementation of the algorithm lgamma for BigNumber")}});function p(v){for(var m=v.sub(.5).mul(v.log()).sub(v).add(vo),n=new i(1,0).div(v),e=n.div(v),a=s[0],l=s[1],c=2*e.re,f=e.re*e.re+e.im*e.im,b=2;b<8;b++){var w=l;l=-f*a+s[b],a=c*a+w}var E=n.mul(e.mul(a).add(l));return m.add(E)}function d(v){var m=0,n=0,e=v;for(v=v.add(1);v.re<=t;){e=e.mul(v);var a=e.im<0?1:0;a!==0&&n===0&&m++,n=a,v=v.add(1)}return p(v).sub(e.log()).sub(new i(0,m*2*Math.PI*1))}}),go="log10",Ul=["typed","config","Complex"],Rl=(0,A.d5)(go,Ul,u=>{var{typed:i,config:o,Complex:t}=u;return i(go,{number:function(s){return s>=0||o.predictable?ja(s):new t(s,0).log().div(Math.LN10)},Complex:function(s){return new t(s).log().div(Math.LN10)},BigNumber:function(s){return!s.isNegative()||o.predictable?s.log():new t(s.toNumber(),0).log().div(Math.LN10)},"Array | Matrix":function(s){return(0,Mr.Fh)(s,this)}})}),yo="log2",Il=["typed","config","Complex"],Fl=(0,A.d5)(yo,Il,u=>{var{typed:i,config:o,Complex:t}=u;return i(yo,{number:function(p){return p>=0||o.predictable?ei(p):r(new t(p,0))},Complex:r,BigNumber:function(p){return!p.isNegative()||o.predictable?p.log(2):r(new t(p.toNumber(),0))},"Array | Matrix":function(p){return(0,Mr.Fh)(p,this)}});function r(s){var p=Math.sqrt(s.re*s.re+s.im*s.im);return new t(Math.log2?Math.log2(p):Math.log(p)/Math.LN2,Math.atan2(s.im,s.re)/Math.LN2)}}),xo="map",zl=["typed"],Pl=(0,A.d5)(xo,zl,u=>{var{typed:i}=u;return i(xo,{"Array, function":Ll,"Matrix, function":function(t,r){return t.map(r)}})});function Ll(u,i){var o=(0,fe.oV)(i),t=function r(s,p){if(Array.isArray(s))return s.map(function(m,n){return r(m,p.concat(n))});try{return o===1?i(s):o===2?i(s,p):i(s,p,u)}catch(m){if(m instanceof TypeError&&"data"in m&&m.data.category==="wrongType"){var d="map attempted to call '".concat(m.data.fn,"(").concat(s),v=JSON.stringify(p);throw o===2?d+=","+v:o!==1&&(d+=",".concat(v,",").concat(u)),d+=")' but argument ".concat(m.data.index+1," of type "),d+="".concat(m.data.actual," does not match expected type "),d+=m.data.expected.join(" or "),new TypeError(d)}throw m}};return t(u,[])}var ql="multiplyScalar",Wl=["typed"],Gl=(0,A.d5)(ql,Wl,u=>{var{typed:i}=u;return i("multiplyScalar",{"number, number":$a,"Complex, Complex":function(t,r){return t.mul(r)},"BigNumber, BigNumber":function(t,r){return t.times(r)},"Fraction, Fraction":function(t,r){return t.mul(r)},"number | Fraction | BigNumber | Complex, Unit":function(t,r){var s=r.clone();return s.value=s.value===null?s._normalize(t):this(s.value,t),s},"Unit, number | Fraction | BigNumber | Complex":function(t,r){var s=t.clone();return s.value=s.value===null?s._normalize(r):this(s.value,r),s},"Unit, Unit":function(t,r){return t.multiply(r)}})}),Hl="number",ba="number, number";function bo(u){return!u}bo.signature=Hl;function No(u,i){return!!(u||i)}No.signature=ba;function Na(u,i){return!!u!=!!i}Na.signature=ba;function wo(u,i){return!!(u&&i)}wo.signature=ba;var Mo="not",kl=["typed"],$l=(0,A.d5)(Mo,kl,u=>{var{typed:i}=u;return i(Mo,{number:bo,Complex:function(t){return t.re===0&&t.im===0},BigNumber:function(t){return t.isZero()||t.isNaN()},Unit:function(t){return t.value!==null?this(t.value):!0},"Array | Matrix":function(t){return(0,Mr.Fh)(t,this)}})}),Vl="number",wa=["typed"];function Ao(u){var i=u.match(/(0[box])([0-9a-fA-F]*)\.([0-9a-fA-F]*)/);if(i){var o={"0b":2,"0o":8,"0x":16}[i[1]],t=i[2],r=i[3];return{input:u,radix:o,integerPart:t,fractionalPart:r}}else return null}function Jl(u){for(var i=parseInt(u.integerPart,u.radix),o=0,t=0;t<u.fractionalPart.length;t++){var r=parseInt(u.fractionalPart[t],u.radix);o+=r/Math.pow(u.radix,t+1)}var s=i+o;if(isNaN(s))throw new SyntaxError('String "'+u.input+'" is no valid number');return s}var Zl=(0,A.d5)(Vl,wa,u=>{var{typed:i}=u,o=i("number",{"":function(){return 0},number:function(r){return r},string:function(r){if(r==="NaN")return NaN;var s=Ao(r);if(s)return Jl(s);var p=0,d=r.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);d&&(p=Number(d[2]),r=d[1]);var v=Number(r);if(isNaN(v))throw new SyntaxError('String "'+r+'" is no valid number');if(d){if(v>2**p-1)throw new SyntaxError('String "'.concat(r,'" is out of range'));v>=2**(p-1)&&(v=v-2**p)}return v},BigNumber:function(r){return r.toNumber()},Fraction:function(r){return r.valueOf()},Unit:function(r){throw new Error("Second argument with valueless unit expected")},null:function(r){return 0},"Unit, string | Unit":function(r,s){return r.toNumber(s)},"Array | Matrix":function(r){return(0,Mr.Fh)(r,this)}});return o.fromJSON=function(t){return parseFloat(t.value)},o}),So="oct",Kl=["typed","format"],Yl=(0,A.d5)(So,Kl,u=>{var{typed:i,format:o}=u;return i(So,{"number | BigNumber":function(r){return o(r,{notation:"oct"})},"number | BigNumber, number":function(r,s){return o(r,{notation:"oct",wordSize:s})}})}),Ma=ie(36377),Xl=Ma(Date.now());function Mn(u){var i;function o(r){i=r===null?Xl:Ma(String(r))}o(u);function t(){return i()}return t}var Xn="pickRandom",Aa=["typed","config","?on"],Ql=(0,A.d5)(Xn,Aa,u=>{var{typed:i,config:o,on:t}=u,r=Mn(o.randomSeed);return t&&t("config",function(p,d){p.randomSeed!==d.randomSeed&&(r=Mn(p.randomSeed))}),i(Xn,{"Array | Matrix":function(d){return s(d,{})},"Array | Matrix, Object":function(d,v){return s(d,v)},"Array | Matrix, number":function(d,v){return s(d,{number:v})},"Array | Matrix, Array | Matrix":function(d,v){return s(d,{weights:v})},"Array | Matrix, Array | Matrix, number":function(d,v,m){return s(d,{number:m,weights:v})},"Array | Matrix, number, Array | Matrix":function(d,v,m){return s(d,{number:v,weights:m})}});function s(p,d){var{number:v,weights:m,elementWise:n=!0}=d,e=typeof v>"u";e&&(v=1);var a=(0,L.SW)(p)?p.create:(0,L.SW)(m)?m.create:null;p=p.valueOf(),m&&(m=m.valueOf()),n===!0&&(p=(0,ze.xH)(p),m=(0,ze.xH)(m));var l=0;if(typeof m<"u"){if(m.length!==p.length)throw new Error("Weights must have the same length as possibles");for(var c=0,f=m.length;c<f;c++){if(!(0,L.hj)(m[c])||m[c]<0)throw new Error("Weights must be an array of positive numbers");l+=m[c]}}for(var b=p.length,w=[],E;w.length<v;){if(typeof m>"u")E=p[Math.floor(r()*b)];else for(var g=r()*l,S=0,N=p.length;S<N;S++)if(g-=m[S],g<0){E=p[S];break}w.push(E)}return e?w[0]:a?a(w):w}}),_o="print",jl=["typed"],Eo=(0,A.d5)(_o,jl,u=>{var{typed:i}=u;return i(_o,{"string, Object | Array":Co,"string, Object | Array, number | Object":Co})});function Co(u,i,o){return u.replace(/\$([\w.]+)/g,function(t,r){for(var s=r.split("."),p=i[s.shift()];s.length&&p!==void 0;){var d=s.shift();p=d?p[d]:p+"."}return p!==void 0?(0,L.HD)(p)?p:(0,Jr.WU)(p,o):t})}function Sa(u,i){var o=[];if(u=u.slice(0),u.length>1)for(var t=0,r=u.shift();t<r;t++)o.push(Sa(u,i));else for(var s=0,p=u.shift();s<p;s++)o.push(i());return o}var Oo="random",ef=["typed","config","?on"],rf=(0,A.d5)(Oo,ef,u=>{var{typed:i,config:o,on:t}=u,r=Mn(o.randomSeed);return t&&t("config",function(d,v){d.randomSeed!==v.randomSeed&&(r=Mn(d.randomSeed))}),i(Oo,{"":()=>p(0,1),number:d=>p(0,d),"number, number":(d,v)=>p(d,v),"Array | Matrix":d=>s(d,0,1),"Array | Matrix, number":(d,v)=>s(d,0,v),"Array | Matrix, number, number":(d,v,m)=>s(d,v,m)});function s(d,v,m){var n=Sa(d.valueOf(),()=>p(v,m));return(0,L.SW)(d)?d.create(n):n}function p(d,v){return d+r()*(v-d)}}),hm=null,_a="re",tf=["typed"],nf=(0,A.d5)(_a,tf,u=>{var{typed:i}=u;return i(_a,{number:function(t){return t},BigNumber:function(t){return t},Fraction:function(t){return t},Complex:function(t){return t.re},"Array | Matrix":function(t){return(0,Mr.Fh)(t,this)}})}),Do="sec",af=["typed","BigNumber"],of=(0,A.d5)(Do,af,u=>{var{typed:i,BigNumber:o}=u;return i(Do,{number:Mi,Complex:function(r){return r.sec()},BigNumber:function(r){return new o(1).div(r.cos())},Unit:function(r){if(!r.hasBase(r.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function sec is no angle");return this(r.value)},"Array | Matrix":function(r){return(0,Mr.Fh)(r,this)}})}),rn="sign",Bo=["typed","BigNumber","Fraction","complex"],sf=(0,A.d5)(rn,Bo,u=>{var{typed:i,BigNumber:o,complex:t,Fraction:r}=u;return i(rn,{number:ga,Complex:function(p){return p.im===0?t(ga(p.re)):p.sign()},BigNumber:function(p){return new o(p.cmp(0))},Fraction:function(p){return new r(p.s,1)},"Array | Matrix":function(p){return(0,Mr.Fh)(p,this,!0)},Unit:function(p){if(!p._isDerived()&&p.units[0].unit.offset!==0)throw new TypeError("sign is ambiguous for units with offset");return this(p.value)}})}),To="sin",uf=["typed"],cf=(0,A.d5)(To,uf,u=>{var{typed:i}=u;return i(To,{number:Math.sin,Complex:function(t){return t.sin()},BigNumber:function(t){return t.sin()},Unit:function(t){if(!t.hasBase(t.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function sin is no angle");return this(t.value)},"Array | Matrix":function(t){return(0,Mr.Fh)(t,this,!0)}})}),lf="SparseMatrix",ff=["typed","equalScalar","Matrix"],mf=(0,A.d5)(lf,ff,u=>{var{typed:i,equalScalar:o,Matrix:t}=u;function r(f,b){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");if(b&&!(0,L.HD)(b))throw new Error("Invalid datatype: "+b);if((0,L.SW)(f))s(this,f,b);else if(f&&(0,L.kJ)(f.index)&&(0,L.kJ)(f.ptr)&&(0,L.kJ)(f.size))this._values=f.values,this._index=f.index,this._ptr=f.ptr,this._size=f.size,this._datatype=b||f.datatype;else if((0,L.kJ)(f))p(this,f,b);else{if(f)throw new TypeError("Unsupported type of data ("+(0,L.kM)(f)+")");this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=b}}function s(f,b,w){b.type==="SparseMatrix"?(f._values=b._values?(0,Sr.d9)(b._values):void 0,f._index=(0,Sr.d9)(b._index),f._ptr=(0,Sr.d9)(b._ptr),f._size=(0,Sr.d9)(b._size),f._datatype=w||b._datatype):p(f,b.valueOf(),w||b._datatype)}function p(f,b,w){f._values=[],f._index=[],f._ptr=[],f._datatype=w;var E=b.length,g=0,S=o,N=0;if((0,L.HD)(w)&&(S=i.find(o,[w,w])||o,N=i.convert(0,w)),E>0){var h=0;do{f._ptr.push(f._index.length);for(var C=0;C<E;C++){var O=b[C];if((0,L.kJ)(O)){if(h===0&&g<O.length&&(g=O.length),h<O.length){var T=O[h];S(T,N)||(f._values.push(T),f._index.push(C))}}else h===0&&g<1&&(g=1),S(O,N)||(f._values.push(O),f._index.push(C))}h++}while(h<g)}f._ptr.push(f._index.length),f._size=[E,g]}r.prototype=new t,r.prototype.createSparseMatrix=function(f,b){return new r(f,b)},r.prototype.type="SparseMatrix",r.prototype.isSparseMatrix=!0,r.prototype.getDataType=function(){return(0,ze.$q)(this._values,L.kM)},r.prototype.storage=function(){return"sparse"},r.prototype.datatype=function(){return this._datatype},r.prototype.create=function(f,b){return new r(f,b)},r.prototype.density=function(){var f=this._size[0],b=this._size[1];return f!==0&&b!==0?this._index.length/(f*b):0},r.prototype.subset=function(f,b,w){if(!this._values)throw new Error("Cannot invoke subset on a Pattern only matrix");switch(arguments.length){case 1:return d(this,f);case 2:case 3:return v(this,f,b,w);default:throw new SyntaxError("Wrong number of arguments")}};function d(f,b){if(!(0,L.dh)(b))throw new TypeError("Invalid index");var w=b.isScalar();if(w)return f.get(b.min());var E=b.size();if(E.length!==f._size.length)throw new pt.m(E.length,f._size.length);var g,S,N,h,C=b.min(),O=b.max();for(g=0,S=f._size.length;g<S;g++)(0,ze.Ls)(C[g],f._size[g]),(0,ze.Ls)(O[g],f._size[g]);var T=f._values,M=f._index,P=f._ptr,z=b.dimension(0),$=b.dimension(1),V=[],te=[];z.forEach(function(B,j){te[B]=j[0],V[B]=!0});var K=T?[]:void 0,I=[],ve=[];return $.forEach(function(B){for(ve.push(I.length),N=P[B],h=P[B+1];N<h;N++)g=M[N],V[g]===!0&&(I.push(te[g]),K&&K.push(T[N]))}),ve.push(I.length),new r({values:K,index:I,ptr:ve,size:E,datatype:f._datatype})}function v(f,b,w,E){if(!b||b.isIndex!==!0)throw new TypeError("Invalid index");var g=b.size(),S=b.isScalar(),N;if((0,L.SW)(w)?(N=w.size(),w=w.toArray()):N=(0,ze.aJ)(w),S){if(N.length!==0)throw new TypeError("Scalar expected");f.set(b.min(),w,E)}else{if(g.length!==1&&g.length!==2)throw new pt.m(g.length,f._size.length,"<");if(N.length<g.length){for(var h=0,C=0;g[h]===1&&N[h]===1;)h++;for(;g[h]===1;)C++,h++;w=(0,ze.f4)(w,g.length,C,N)}if(!(0,Sr.J5)(g,N))throw new pt.m(g,N,">");if(g.length===1){var O=b.dimension(0);O.forEach(function(P,z){(0,ze.Ls)(P),f.set([P,0],w[z[0]],E)})}else{var T=b.dimension(0),M=b.dimension(1);T.forEach(function(P,z){(0,ze.Ls)(P),M.forEach(function($,V){(0,ze.Ls)($),f.set([P,$],w[z[0]][V[0]],E)})})}}return f}r.prototype.get=function(f){if(!(0,L.kJ)(f))throw new TypeError("Array expected");if(f.length!==this._size.length)throw new pt.m(f.length,this._size.length);if(!this._values)throw new Error("Cannot invoke get on a Pattern only matrix");var b=f[0],w=f[1];(0,ze.Ls)(b,this._size[0]),(0,ze.Ls)(w,this._size[1]);var E=m(b,this._ptr[w],this._ptr[w+1],this._index);return E<this._ptr[w+1]&&this._index[E]===b?this._values[E]:0},r.prototype.set=function(f,b,w){if(!(0,L.kJ)(f))throw new TypeError("Array expected");if(f.length!==this._size.length)throw new pt.m(f.length,this._size.length);if(!this._values)throw new Error("Cannot invoke set on a Pattern only matrix");var E=f[0],g=f[1],S=this._size[0],N=this._size[1],h=o,C=0;(0,L.HD)(this._datatype)&&(h=i.find(o,[this._datatype,this._datatype])||o,C=i.convert(0,this._datatype)),(E>S-1||g>N-1)&&(a(this,Math.max(E+1,S),Math.max(g+1,N),w),S=this._size[0],N=this._size[1]),(0,ze.Ls)(E,S),(0,ze.Ls)(g,N);var O=m(E,this._ptr[g],this._ptr[g+1],this._index);return O<this._ptr[g+1]&&this._index[O]===E?h(b,C)?n(O,g,this._values,this._index,this._ptr):this._values[O]=b:e(O,E,g,b,this._values,this._index,this._ptr),this};function m(f,b,w,E){if(w-b===0)return w;for(var g=b;g<w;g++)if(E[g]===f)return g;return b}function n(f,b,w,E,g){w.splice(f,1),E.splice(f,1);for(var S=b+1;S<g.length;S++)g[S]--}function e(f,b,w,E,g,S,N){g.splice(f,0,E),S.splice(f,0,b);for(var h=w+1;h<N.length;h++)N[h]++}r.prototype.resize=function(f,b,w){if(!(0,L.uZ)(f))throw new TypeError("Array or Matrix expected");var E=f.valueOf().map(S=>Array.isArray(S)&&S.length===1?S[0]:S);if(E.length!==2)throw new Error("Only two dimensions matrix are supported");E.forEach(function(S){if(!(0,L.hj)(S)||!(0,le.U)(S)||S<0)throw new TypeError("Invalid size, must contain positive integers (size: "+(0,Jr.WU)(E)+")")});var g=w?this.clone():this;return a(g,E[0],E[1],b)};function a(f,b,w,E){var g=E||0,S=o,N=0;(0,L.HD)(f._datatype)&&(S=i.find(o,[f._datatype,f._datatype])||o,N=i.convert(0,f._datatype),g=i.convert(g,f._datatype));var h=!S(g,N),C=f._size[0],O=f._size[1],T,M,P;if(w>O){for(M=O;M<w;M++)if(f._ptr[M]=f._values.length,h)for(T=0;T<C;T++)f._values.push(g),f._index.push(T);f._ptr[w]=f._values.length}else w<O&&(f._ptr.splice(w+1,O-w),f._values.splice(f._ptr[w],f._values.length),f._index.splice(f._ptr[w],f._index.length));if(O=w,b>C){if(h){var z=0;for(M=0;M<O;M++){f._ptr[M]=f._ptr[M]+z,P=f._ptr[M+1]+z;var $=0;for(T=C;T<b;T++,$++)f._values.splice(P+$,0,g),f._index.splice(P+$,0,T),z++}f._ptr[O]=f._values.length}}else if(b<C){var V=0;for(M=0;M<O;M++){f._ptr[M]=f._ptr[M]-V;var te=f._ptr[M],K=f._ptr[M+1]-V;for(P=te;P<K;P++)T=f._index[P],T>b-1&&(f._values.splice(P,1),f._index.splice(P,1),V++)}f._ptr[M]=f._values.length}return f._size[0]=b,f._size[1]=w,f}r.prototype.reshape=function(f,b){if(!(0,L.kJ)(f))throw new TypeError("Array expected");if(f.length!==2)throw new Error("Sparse matrices can only be reshaped in two dimensions");f.forEach(function(B){if(!(0,L.hj)(B)||!(0,le.U)(B)||B<=-2||B===0)throw new TypeError("Invalid size, must contain positive integers or -1 (size: "+(0,Jr.WU)(f)+")")});var w=this._size[0]*this._size[1];f=(0,ze.eu)(f,w);var E=f[0]*f[1];if(w!==E)throw new Error("Reshaping sparse matrix will result in the wrong number of elements");var g=b?this.clone():this;if(this._size[0]===f[0]&&this._size[1]===f[1])return g;for(var S=[],N=0;N<g._ptr.length;N++)for(var h=0;h<g._ptr[N+1]-g._ptr[N];h++)S.push(N);for(var C=g._values.slice(),O=g._index.slice(),T=0;T<g._index.length;T++){var M=O[T],P=S[T],z=M*g._size[1]+P;S[T]=z%f[1],O[T]=Math.floor(z/f[1])}g._values.length=0,g._index.length=0,g._ptr.length=f[1]+1,g._size=f.slice();for(var $=0;$<g._ptr.length;$++)g._ptr[$]=0;for(var V=0;V<C.length;V++){var te=O[V],K=S[V],I=C[V],ve=m(te,g._ptr[K],g._ptr[K+1],g._index);e(ve,te,K,I,g._values,g._index,g._ptr)}return g},r.prototype.clone=function(){var f=new r({values:this._values?(0,Sr.d9)(this._values):void 0,index:(0,Sr.d9)(this._index),ptr:(0,Sr.d9)(this._ptr),size:(0,Sr.d9)(this._size),datatype:this._datatype});return f},r.prototype.size=function(){return this._size.slice(0)},r.prototype.map=function(f,b){if(!this._values)throw new Error("Cannot invoke map on a Pattern only matrix");var w=this,E=this._size[0],g=this._size[1],S=function(h,C,O){return f(h,[C,O],w)};return l(this,0,E-1,0,g-1,S,b)};function l(f,b,w,E,g,S,N){var h=[],C=[],O=[],T=o,M=0;(0,L.HD)(f._datatype)&&(T=i.find(o,[f._datatype,f._datatype])||o,M=i.convert(0,f._datatype));for(var P=function(re,be,Ge){re=S(re,be,Ge),T(re,M)||(h.push(re),C.push(be))},z=E;z<=g;z++){O.push(h.length);var $=f._ptr[z],V=f._ptr[z+1];if(N)for(var te=$;te<V;te++){var K=f._index[te];K>=b&&K<=w&&P(f._values[te],K-b,z-E)}else{for(var I={},ve=$;ve<V;ve++){var B=f._index[ve];I[B]=f._values[ve]}for(var j=b;j<=w;j++){var ye=j in I?I[j]:0;P(ye,j-b,z-E)}}}return O.push(h.length),new r({values:h,index:C,ptr:O,size:[w-b+1,g-E+1]})}r.prototype.forEach=function(f,b){if(!this._values)throw new Error("Cannot invoke forEach on a Pattern only matrix");for(var w=this,E=this._size[0],g=this._size[1],S=0;S<g;S++){var N=this._ptr[S],h=this._ptr[S+1];if(b)for(var C=N;C<h;C++){var O=this._index[C];f(this._values[C],[O,S],w)}else{for(var T={},M=N;M<h;M++){var P=this._index[M];T[P]=this._values[M]}for(var z=0;z<E;z++){var $=z in T?T[z]:0;f($,[z,S],w)}}}},r.prototype[Symbol.iterator]=function*(){if(!this._values)throw new Error("Cannot iterate a Pattern only matrix");for(var f=this._size[1],b=0;b<f;b++)for(var w=this._ptr[b],E=this._ptr[b+1],g=w;g<E;g++){var S=this._index[g];yield{value:this._values[g],index:[S,b]}}},r.prototype.toArray=function(){return c(this._values,this._index,this._ptr,this._size,!0)},r.prototype.valueOf=function(){return c(this._values,this._index,this._ptr,this._size,!1)};function c(f,b,w,E,g){var S=E[0],N=E[1],h=[],C,O;for(C=0;C<S;C++)for(h[C]=[],O=0;O<N;O++)h[C][O]=0;for(O=0;O<N;O++)for(var T=w[O],M=w[O+1],P=T;P<M;P++)C=b[P],h[C][O]=f?g?(0,Sr.d9)(f[P]):f[P]:1;return h}return r.prototype.format=function(f){for(var b=this._size[0],w=this._size[1],E=this.density(),g="Sparse Matrix ["+(0,Jr.WU)(b,f)+" x "+(0,Jr.WU)(w,f)+"] density: "+(0,Jr.WU)(E,f)+`
42
- `,S=0;S<w;S++)for(var N=this._ptr[S],h=this._ptr[S+1],C=N;C<h;C++){var O=this._index[C];g+=`
43
- (`+(0,Jr.WU)(O,f)+", "+(0,Jr.WU)(S,f)+") ==> "+(this._values?(0,Jr.WU)(this._values[C],f):"X")}return g},r.prototype.toString=function(){return(0,Jr.WU)(this.toArray())},r.prototype.toJSON=function(){return{mathjs:"SparseMatrix",values:this._values,index:this._index,ptr:this._ptr,size:this._size,datatype:this._datatype}},r.prototype.diagonal=function(f){if(f){if((0,L.l9)(f)&&(f=f.toNumber()),!(0,L.hj)(f)||!(0,le.U)(f))throw new TypeError("The parameter k must be an integer number")}else f=0;var b=f>0?f:0,w=f<0?-f:0,E=this._size[0],g=this._size[1],S=Math.min(E-w,g-b),N=[],h=[],C=[];C[0]=0;for(var O=b;O<g&&N.length<S;O++)for(var T=this._ptr[O],M=this._ptr[O+1],P=T;P<M;P++){var z=this._index[P];if(z===O-b+w){N.push(this._values[P]),h[N.length-1]=z-w;break}}return C.push(N.length),new r({values:N,index:h,ptr:C,size:[S,1]})},r.fromJSON=function(f){return new r(f)},r.diagonal=function(f,b,w,E,g){if(!(0,L.kJ)(f))throw new TypeError("Array expected, size parameter");if(f.length!==2)throw new Error("Only two dimensions matrix are supported");if(f=f.map(function(B){if((0,L.l9)(B)&&(B=B.toNumber()),!(0,L.hj)(B)||!(0,le.U)(B)||B<1)throw new Error("Size values must be positive integers");return B}),w){if((0,L.l9)(w)&&(w=w.toNumber()),!(0,L.hj)(w)||!(0,le.U)(w))throw new TypeError("The parameter k must be an integer number")}else w=0;var S=o,N=0;(0,L.HD)(g)&&(S=i.find(o,[g,g])||o,N=i.convert(0,g));var h=w>0?w:0,C=w<0?-w:0,O=f[0],T=f[1],M=Math.min(O-C,T-h),P;if((0,L.kJ)(b)){if(b.length!==M)throw new Error("Invalid value array length");P=function(j){return b[j]}}else if((0,L.SW)(b)){var z=b.size();if(z.length!==1||z[0]!==M)throw new Error("Invalid matrix length");P=function(j){return b.get([j])}}else P=function(){return b};for(var $=[],V=[],te=[],K=0;K<T;K++){te.push($.length);var I=K-h;if(I>=0&&I<M){var ve=P(I);S(ve,N)||(V.push(I+C),$.push(ve))}}return te.push($.length),new r({values:$,index:V,ptr:te,size:[O,T]})},r.prototype.swapRows=function(f,b){if(!(0,L.hj)(f)||!(0,le.U)(f)||!(0,L.hj)(b)||!(0,le.U)(b))throw new Error("Row index must be positive integers");if(this._size.length!==2)throw new Error("Only two dimensional matrix is supported");return(0,ze.Ls)(f,this._size[0]),(0,ze.Ls)(b,this._size[0]),r._swapRows(f,b,this._size[1],this._values,this._index,this._ptr),this},r._forEachRow=function(f,b,w,E,g){for(var S=E[f],N=E[f+1],h=S;h<N;h++)g(w[h],b[h])},r._swapRows=function(f,b,w,E,g,S){for(var N=0;N<w;N++){var h=S[N],C=S[N+1],O=m(f,h,C,g),T=m(b,h,C,g);if(O<C&&T<C&&g[O]===f&&g[T]===b){if(E){var M=E[O];E[O]=E[T],E[T]=M}continue}if(O<C&&g[O]===f&&(T>=C||g[T]!==b)){var P=E?E[O]:void 0;g.splice(T,0,b),E&&E.splice(T,0,P),g.splice(T<=O?O+1:O,1),E&&E.splice(T<=O?O+1:O,1);continue}if(T<C&&g[T]===b&&(O>=C||g[O]!==f)){var z=E?E[T]:void 0;g.splice(O,0,f),E&&E.splice(O,0,z),g.splice(O<=T?T+1:T,1),E&&E.splice(O<=T?T+1:T,1)}}},r},{isClass:!0}),Uo="splitUnit",vf=["typed"],pf=(0,A.d5)(Uo,vf,u=>{var{typed:i}=u;return i(Uo,{"Unit, Array":function(t,r){return t.splitUnit(r)}})}),Ro="square",df=["typed"],hf=(0,A.d5)(Ro,df,u=>{var{typed:i}=u;return i(Ro,{number:ni,Complex:function(t){return t.mul(t)},BigNumber:function(t){return t.times(t)},Fraction:function(t){return t.mul(t)},"Array | Matrix":function(t){return(0,Mr.Fh)(t,this,!0)},Unit:function(t){return t.pow(2)}})}),Io="string",gf=["typed"],yf=(0,A.d5)(Io,gf,u=>{var{typed:i}=u;return i(Io,{"":function(){return""},number:le.WU,null:function(t){return"null"},boolean:function(t){return t+""},string:function(t){return t},"Array | Matrix":function(t){return(0,Mr.Fh)(t,this)},any:function(t){return String(t)}})}),Fo="tan",xf=["typed"],bf=(0,A.d5)(Fo,xf,u=>{var{typed:i}=u;return i(Fo,{number:Math.tan,Complex:function(t){return t.tan()},BigNumber:function(t){return t.tan()},Unit:function(t){if(!t.hasBase(t.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function tan is no angle");return this(t.value)},"Array | Matrix":function(t){return(0,Mr.Fh)(t,this,!0)}})}),zo="typeOf",Nf=["typed"],wf=(0,A.d5)(zo,Nf,u=>{var{typed:i}=u;return i(zo,{any:L.kM})}),Po="acosh",Lo=["typed","config","Complex"],Mf=(0,A.d5)(Po,Lo,u=>{var{typed:i,config:o,Complex:t}=u;return i(Po,{number:function(s){return s>=1||o.predictable?li(s):s<=-1?new t(Math.log(Math.sqrt(s*s-1)-s),Math.PI):new t(s,0).acosh()},Complex:function(s){return s.acosh()},BigNumber:function(s){return s.acosh()},"Array | Matrix":function(s){return(0,Mr.Fh)(s,this)}})}),qo="acsch",Af=["typed","BigNumber"],Wo=(0,A.d5)(qo,Af,u=>{var{typed:i,BigNumber:o}=u;return i(qo,{number:pi,Complex:function(r){return r.acsch()},BigNumber:function(r){return new o(1).div(r).asinh()},"Array | Matrix":function(r){return(0,Mr.Fh)(r,this)}})}),Sf=ie(38641),Go="asec",_f=["typed","config","Complex","BigNumber"],Ef=(0,A.d5)(Go,_f,u=>{var{typed:i,config:o,Complex:t,BigNumber:r}=u;return i(Go,{number:function(p){return p<=-1||p>=1||o.predictable?di(p):new t(p,0).asec()},Complex:function(p){return p.asec()},BigNumber:function(p){return new r(1).div(p).acos()},"Array | Matrix":function(p){return(0,Mr.Fh)(p,this)}})}),Ho="bin",Cf=["typed","format"],Of=(0,A.d5)(Ho,Cf,u=>{var{typed:i,format:o}=u;return i(Ho,{"number | BigNumber":function(r){return o(r,{notation:"bin"})},"number | BigNumber, number":function(r,s){return o(r,{notation:"bin",wordSize:s})}})}),ko="combinationsWithRep",Df=["typed"],Bf=(0,A.d5)(ko,Df,u=>{var{typed:i}=u;return i(ko,{"number, number":function(t,r){if(!(0,le.U)(t)||t<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(!(0,le.U)(r)||r<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(t<1)throw new TypeError("k must be less than or equal to n + k - 1");if(r<t-1){var s=Kt(t,t+r-1);return s/Kt(1,r)}var p=Kt(r+1,t+r-1);return p/Kt(1,t-1)},"BigNumber, BigNumber":function(t,r){var s=t.constructor,p,d,v=new s(1),m=t.minus(v);if(!$o(t)||!$o(r))throw new TypeError("Positive integer value expected in function combinationsWithRep");if(t.lt(v))throw new TypeError("k must be less than or equal to n + k - 1 in function combinationsWithRep");if(p=v,r.lt(m))for(d=v;d.lte(m);d=d.plus(v))p=p.times(r.plus(d)).dividedBy(d);else for(d=v;d.lte(r);d=d.plus(v))p=p.times(m.plus(d)).dividedBy(d);return p}})});function $o(u){return u.isInteger()&&u.gte(0)}var Vo="cos",Tf=["typed"],Uf=(0,A.d5)(Vo,Tf,u=>{var{typed:i}=u;return i(Vo,{number:Math.cos,Complex:function(t){return t.cos()},BigNumber:function(t){return t.cos()},Unit:function(t){if(!t.hasBase(t.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cos is no angle");return this(t.value)},"Array | Matrix":function(t){return(0,Mr.Fh)(t,this)}})}),Jo="csch",Rf=["typed","BigNumber"],If=(0,A.d5)(Jo,Rf,u=>{var{typed:i,BigNumber:o}=u;return i(Jo,{number:wi,Complex:function(r){return r.csch()},BigNumber:function(r){return new o(1).div(r.sinh())},Unit:function(r){if(!r.hasBase(r.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function csch is no angle");return this(r.value)},"Array | Matrix":function(r){return(0,Mr.Fh)(r,this)}})}),Zo="isNaN",Ko=["typed"],Ff=(0,A.d5)(Zo,Ko,u=>{var{typed:i}=u;return i(Zo,{number:uo,BigNumber:function(t){return t.isNaN()},Fraction:function(t){return!1},Complex:function(t){return t.isNaN()},Unit:function(t){return Number.isNaN(t.value)},"Array | Matrix":function(t){return(0,Mr.Fh)(t,Number.isNaN)}})}),Yo="isPrime",zf=["typed"],Pf=(0,A.d5)(Yo,zf,u=>{var{typed:i}=u;return i(Yo,{number:function(t){if(t*0!==0)return!1;if(t<=3)return t>1;if(t%2===0||t%3===0)return!1;for(var r=5;r*r<=t;r+=6)if(t%r===0||t%(r+2)===0)return!1;return!0},BigNumber:function(t){if(t.toNumber()*0!==0)return!1;if(t.lte(3))return t.gt(1);if(t.mod(2).eq(0)||t.mod(3).eq(0))return!1;if(t.lt(Math.pow(2,32))){for(var r=t.toNumber(),s=5;s*s<=r;s+=6)if(r%s===0||r%(s+2)===0)return!1;return!0}function p(E,g,S){for(var N=1;!g.eq(0);)g.mod(2).eq(0)?(g=g.div(2),E=E.mul(E).mod(S)):(g=g.sub(1),N=E.mul(N).mod(S));return N}var d=t.constructor.clone({precision:t.toFixed(0).length*2});t=new d(t);for(var v=0,m=t.sub(1);m.mod(2).eq(0);)m=m.div(2),v+=1;var n=null;if(t.lt("3317044064679887385961981"))n=[2,3,5,7,11,13,17,19,23,29,31,37,41].filter(E=>E<t);else{var e=Math.min(t.toNumber()-2,Math.floor(2*Math.pow(t.toFixed(0).length*Math.log(10),2)));n=[];for(var a=2;a<=e;a+=1)n.push(e)}for(var l=0;l<n.length;l+=1){var c=n[l],f=p(t.sub(t).add(c),m,t);if(!f.eq(1)){for(var b=0,w=f;!w.eq(t.sub(1));b+=1,w=w.mul(w).mod(t))if(b===v-1)return!1}}return!0},"Array | Matrix":function(t){return(0,Mr.Fh)(t,this)}})}),Xo="randomInt",Lf=["typed","config","?on"],D=(0,A.d5)(Xo,Lf,u=>{var{typed:i,config:o,on:t}=u,r=Mn(o.randomSeed);return t&&t("config",function(d,v){d.randomSeed!==v.randomSeed&&(r=Mn(d.randomSeed))}),i(Xo,{"":()=>p(0,1),number:d=>p(0,d),"number, number":(d,v)=>p(d,v),"Array | Matrix":d=>s(d,0,1),"Array | Matrix, number":(d,v)=>s(d,0,v),"Array | Matrix, number, number":(d,v,m)=>s(d,v,m)});function s(d,v,m){var n=Sa(d.valueOf(),()=>p(v,m));return(0,L.SW)(d)?d.create(n):n}function p(d,v){return Math.floor(d+r()*(v-d))}}),fn="sech",Un=["typed","BigNumber"],Qo=(0,A.d5)(fn,Un,u=>{var{typed:i,BigNumber:o}=u;return i(fn,{number:Ai,Complex:function(r){return r.sech()},BigNumber:function(r){return new o(1).div(r.cosh())},Unit:function(r){if(!r.hasBase(r.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function sech is no angle");return this(r.value)},"Array | Matrix":function(r){return(0,Mr.Fh)(r,this)}})}),Qn="sinh",Ct=["typed"],Rn=(0,A.d5)(Qn,Ct,u=>{var{typed:i}=u;return i(Qn,{number:Si,Complex:function(t){return t.sinh()},BigNumber:function(t){return t.sinh()},Unit:function(t){if(!t.hasBase(t.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function sinh is no angle");return this(t.value)},"Array | Matrix":function(t){return(0,Mr.Fh)(t,this,!0)}})}),Xt="sparse",mn=["typed","SparseMatrix"],jo=(0,A.d5)(Xt,mn,u=>{var{typed:i,SparseMatrix:o}=u;return i(Xt,{"":function(){return new o([])},string:function(r){return new o([],r)},"Array | Matrix":function(r){return new o(r)},"Array | Matrix, string":function(r,s){return new o(r,s)}})}),In="sqrt",es=["config","typed","Complex"],rs=(0,A.d5)(In,es,u=>{var{config:i,typed:o,Complex:t}=u;return o("sqrt",{number:r,Complex:function(p){return p.sqrt()},BigNumber:function(p){return!p.isNegative()||i.predictable?p.sqrt():r(p.toNumber())},"Array | Matrix":function(p){return(0,Mr.Fh)(p,this,!0)},Unit:function(p){return p.pow(.5)}});function r(s){return isNaN(s)?NaN:s>=0||i.predictable?Math.sqrt(s):new t(s,0).sqrt()}}),vn="tanh",ts=["typed"],qf=(0,A.d5)(vn,ts,u=>{var{typed:i}=u;return i("tanh",{number:le.AE,Complex:function(t){return t.tanh()},BigNumber:function(t){return t.tanh()},Unit:function(t){if(!t.hasBase(t.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function tanh is no angle");return this(t.value)},"Array | Matrix":function(t){return(0,Mr.Fh)(t,this,!0)}})}),ns="unaryMinus",as=["typed"],Fn=(0,A.d5)(ns,as,u=>{var{typed:i}=u;return i(ns,{number:Va,Complex:function(t){return t.neg()},BigNumber:function(t){return t.neg()},Fraction:function(t){return t.neg()},Unit:function(t){var r=t.clone();return r.value=this(t.value),r},"Array | Matrix":function(t){return(0,Mr.Fh)(t,this,!0)}})}),Ea="acoth",zn=["typed","config","Complex","BigNumber"],pn=(0,A.d5)(Ea,zn,u=>{var{typed:i,config:o,Complex:t,BigNumber:r}=u;return i(Ea,{number:function(p){return p>=1||p<=-1||o.predictable?mi(p):new t(p,0).acoth()},Complex:function(p){return p.acoth()},BigNumber:function(p){return new r(1).div(p).atanh()},"Array | Matrix":function(p){return(0,Mr.Fh)(p,this)}})}),tn="cot",Vt=["typed","BigNumber"],is=(0,A.d5)(tn,Vt,u=>{var{typed:i,BigNumber:o}=u;return i(tn,{number:xi,Complex:function(r){return r.cot()},BigNumber:function(r){return new o(1).div(r.tan())},Unit:function(r){if(!r.hasBase(r.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cot is no angle");return this(r.value)},"Array | Matrix":function(r){return(0,Mr.Fh)(r,this)}})}),Ca="fraction",Wf=["typed","Fraction"],os=(0,A.d5)(Ca,Wf,u=>{var{typed:i,Fraction:o}=u;return i("fraction",{number:function(r){if(!isFinite(r)||isNaN(r))throw new Error(r+" cannot be represented as a fraction");return new o(r)},string:function(r){return new o(r)},"number, number":function(r,s){return new o(r,s)},null:function(r){return new o(0)},BigNumber:function(r){return new o(r.toString())},Fraction:function(r){return r},Object:function(r){return new o(r)},"Array | Matrix":function(r){return(0,Mr.Fh)(r,this)}})}),ss="isNumeric",jn=["typed"],Gf=(0,A.d5)(ss,jn,u=>{var{typed:i}=u;return i(ss,{"number | BigNumber | Fraction | boolean":function(){return!0},"Complex | Unit | string | null | undefined | Node":function(){return!1},"Array | Matrix":function(t){return(0,Mr.Fh)(t,this)}})}),ea="matrix",Hf=["typed","Matrix","DenseMatrix","SparseMatrix"],us=(0,A.d5)(ea,Hf,u=>{var{typed:i,Matrix:o,DenseMatrix:t,SparseMatrix:r}=u;return i(ea,{"":function(){return s([])},string:function(d){return s([],d)},"string, string":function(d,v){return s([],d,v)},Array:function(d){return s(d)},Matrix:function(d){return s(d,d.storage())},"Array | Matrix, string":s,"Array | Matrix, string, string":s});function s(p,d,v){if(d==="dense"||d==="default"||d===void 0)return new t(p,v);if(d==="sparse")return new r(p,v);throw new TypeError("Unknown matrix type "+JSON.stringify(d)+".")}}),cs="matrixFromFunction",kf=["typed","matrix","isZero"],$f=(0,A.d5)(cs,kf,u=>{var{typed:i,matrix:o,isZero:t}=u;return i(cs,{"Array | Matrix, function, string, string":function(p,d,v,m){return r(p,d,v,m)},"Array | Matrix, function, string":function(p,d,v){return r(p,d,v)},"Matrix, function":function(p,d){return r(p,d,"dense")},"Array, function":function(p,d){return r(p,d,"dense").toArray()},"Array | Matrix, string, function":function(p,d,v){return r(p,v,d)},"Array | Matrix, string, string, function":function(p,d,v,m){return r(p,m,d,v)}});function r(s,p,d,v){var m;return v!==void 0?m=o(d,v):m=o(d),m.resize(s),m.forEach(function(n,e){var a=p(e);t(a)||m.set(e,a)}),m}}),xe="algorithm02",ce=["typed","equalScalar"],F=(0,A.d5)(xe,ce,u=>{var{typed:i,equalScalar:o}=u;return function(r,s,p,d){var v=r._data,m=r._size,n=r._datatype,e=s._values,a=s._index,l=s._ptr,c=s._size,f=s._datatype;if(m.length!==c.length)throw new pt.m(m.length,c.length);if(m[0]!==c[0]||m[1]!==c[1])throw new RangeError("Dimension mismatch. Matrix A ("+m+") must match Matrix B ("+c+")");if(!e)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var b=m[0],w=m[1],E,g=o,S=0,N=p;typeof n=="string"&&n===f&&(E=n,g=i.find(o,[E,E]),S=i.convert(0,E),N=i.find(p,[E,E]));for(var h=[],C=[],O=[],T=0;T<w;T++){O[T]=C.length;for(var M=l[T],P=l[T+1],z=M;z<P;z++){var $=a[z],V=d?N(e[z],v[$][T]):N(v[$][T],e[z]);g(V,S)||(C.push($),h.push(V))}}return O[w]=C.length,s.createSparseMatrix({values:h,index:C,ptr:O,size:[b,w],datatype:E})}}),U="algorithm03",y=["typed"],_=(0,A.d5)(U,y,u=>{var{typed:i}=u;return function(t,r,s,p){var d=t._data,v=t._size,m=t._datatype,n=r._values,e=r._index,a=r._ptr,l=r._size,c=r._datatype;if(v.length!==l.length)throw new pt.m(v.length,l.length);if(v[0]!==l[0]||v[1]!==l[1])throw new RangeError("Dimension mismatch. Matrix A ("+v+") must match Matrix B ("+l+")");if(!n)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var f=v[0],b=v[1],w,E=0,g=s;typeof m=="string"&&m===c&&(w=m,E=i.convert(0,w),g=i.find(s,[w,w]));for(var S=[],N=0;N<f;N++)S[N]=[];for(var h=[],C=[],O=0;O<b;O++){for(var T=O+1,M=a[O],P=a[O+1],z=M;z<P;z++){var $=e[z];h[$]=p?g(n[z],d[$][O]):g(d[$][O],n[z]),C[$]=T}for(var V=0;V<f;V++)C[V]===T?S[V][O]=h[V]:S[V][O]=p?g(E,d[V][O]):g(d[V][O],E)}return t.createDenseMatrix({data:S,size:[f,b],datatype:w})}}),R="algorithm05",q=["typed","equalScalar"],W=(0,A.d5)(R,q,u=>{var{typed:i,equalScalar:o}=u;return function(r,s,p){var d=r._values,v=r._index,m=r._ptr,n=r._size,e=r._datatype,a=s._values,l=s._index,c=s._ptr,f=s._size,b=s._datatype;if(n.length!==f.length)throw new pt.m(n.length,f.length);if(n[0]!==f[0]||n[1]!==f[1])throw new RangeError("Dimension mismatch. Matrix A ("+n+") must match Matrix B ("+f+")");var w=n[0],E=n[1],g,S=o,N=0,h=p;typeof e=="string"&&e===b&&(g=e,S=i.find(o,[g,g]),N=i.convert(0,g),h=i.find(p,[g,g]));var C=d&&a?[]:void 0,O=[],T=[],M=C?[]:void 0,P=C?[]:void 0,z=[],$=[],V,te,K,I;for(te=0;te<E;te++){T[te]=O.length;var ve=te+1;for(K=m[te],I=m[te+1];K<I;K++)V=v[K],O.push(V),z[V]=ve,M&&(M[V]=d[K]);for(K=c[te],I=c[te+1];K<I;K++)V=l[K],z[V]!==ve&&O.push(V),$[V]=ve,P&&(P[V]=a[K]);if(C)for(K=T[te];K<O.length;){V=O[K];var B=z[V],j=$[V];if(B===ve||j===ve){var ye=B===ve?M[V]:N,Ve=j===ve?P[V]:N,re=h(ye,Ve);S(re,N)?O.splice(K,1):(C.push(re),K++)}}}return T[E]=O.length,r.createSparseMatrix({values:C,index:O,ptr:T,size:[w,E],datatype:g})}}),G="algorithm11",k=["typed","equalScalar"],oe=(0,A.d5)(G,k,u=>{var{typed:i,equalScalar:o}=u;return function(r,s,p,d){var v=r._values,m=r._index,n=r._ptr,e=r._size,a=r._datatype;if(!v)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var l=e[0],c=e[1],f,b=o,w=0,E=p;typeof a=="string"&&(f=a,b=i.find(o,[f,f]),w=i.convert(0,f),s=i.convert(s,f),E=i.find(p,[f,f]));for(var g=[],S=[],N=[],h=0;h<c;h++){N[h]=S.length;for(var C=n[h],O=n[h+1],T=C;T<O;T++){var M=m[T],P=d?E(s,v[T]):E(v[T],s);b(P,w)||(S.push(M),g.push(P))}}return N[c]=S.length,r.createSparseMatrix({values:g,index:S,ptr:N,size:[l,c],datatype:f})}}),Ee="algorithm12",er=["typed","DenseMatrix"],He=(0,A.d5)(Ee,er,u=>{var{typed:i,DenseMatrix:o}=u;return function(r,s,p,d){var v=r._values,m=r._index,n=r._ptr,e=r._size,a=r._datatype;if(!v)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var l=e[0],c=e[1],f,b=p;typeof a=="string"&&(f=a,s=i.convert(s,f),b=i.find(p,[f,f]));for(var w=[],E=[],g=[],S=0;S<c;S++){for(var N=S+1,h=n[S],C=n[S+1],O=h;O<C;O++){var T=m[O];E[T]=v[O],g[T]=N}for(var M=0;M<l;M++)S===0&&(w[M]=[]),g[M]===N?w[M][S]=d?b(s,E[M]):b(E[M],s):w[M][S]=d?b(s,0):b(0,s)}return new o({data:w,size:[l,c],datatype:f})}}),gr="algorithm13",Nr=["typed"],Br=(0,A.d5)(gr,Nr,u=>{var{typed:i}=u;return function(r,s,p){var d=r._data,v=r._size,m=r._datatype,n=s._data,e=s._size,a=s._datatype,l=[];if(v.length!==e.length)throw new pt.m(v.length,e.length);for(var c=0;c<v.length;c++){if(v[c]!==e[c])throw new RangeError("Dimension mismatch. Matrix A ("+v+") must match Matrix B ("+e+")");l[c]=v[c]}var f,b=p;typeof m=="string"&&m===a&&(f=m,b=i.find(p,[f,f]));var w=l.length>0?o(b,0,l,l[0],d,n):[];return r.createDenseMatrix({data:w,size:l,datatype:f})};function o(t,r,s,p,d,v){var m=[];if(r===s.length-1)for(var n=0;n<p;n++)m[n]=t(d[n],v[n]);else for(var e=0;e<p;e++)m[e]=o(t,r+1,s,s[r+1],d[e],v[e]);return m}}),ar="algorithm14",pe=["typed"],Z=(0,A.d5)(ar,pe,u=>{var{typed:i}=u;return function(r,s,p,d){var v=r._data,m=r._size,n=r._datatype,e,a=p;typeof n=="string"&&(e=n,s=i.convert(s,e),a=i.find(p,[e,e]));var l=m.length>0?o(a,0,m,m[0],v,s,d):[];return r.createDenseMatrix({data:l,size:(0,Sr.d9)(m),datatype:e})};function o(t,r,s,p,d,v,m){var n=[];if(r===s.length-1)for(var e=0;e<p;e++)n[e]=m?t(v,d[e]):t(d[e],v);else for(var a=0;a<p;a++)n[a]=o(t,r+1,s,s[r+1],d[a],v,m);return n}}),me="mod",se=["typed","matrix","equalScalar","DenseMatrix"],je=(0,A.d5)(me,se,u=>{var{typed:i,matrix:o,equalScalar:t,DenseMatrix:r}=u,s=F({typed:i,equalScalar:t}),p=_({typed:i}),d=W({typed:i,equalScalar:t}),v=oe({typed:i,equalScalar:t}),m=He({typed:i,DenseMatrix:r}),n=Br({typed:i}),e=Z({typed:i});return i(me,{"number, number":ri,"BigNumber, BigNumber":function(l,c){if(c.isNeg())throw new Error("Cannot calculate mod for a negative divisor");return c.isZero()?l:l.mod(c)},"Fraction, Fraction":function(l,c){if(c.compare(0)<0)throw new Error("Cannot calculate mod for a negative divisor");return l.compare(0)>=0?l.mod(c):l.mod(c).add(c).mod(c)},"SparseMatrix, SparseMatrix":function(l,c){return d(l,c,this,!1)},"SparseMatrix, DenseMatrix":function(l,c){return s(c,l,this,!0)},"DenseMatrix, SparseMatrix":function(l,c){return p(l,c,this,!1)},"DenseMatrix, DenseMatrix":function(l,c){return n(l,c,this)},"Array, Array":function(l,c){return this(o(l),o(c)).valueOf()},"Array, Matrix":function(l,c){return this(o(l),c)},"Matrix, Array":function(l,c){return this(l,o(c))},"SparseMatrix, any":function(l,c){return v(l,c,this,!1)},"DenseMatrix, any":function(l,c){return e(l,c,this,!1)},"any, SparseMatrix":function(l,c){return m(c,l,this,!0)},"any, DenseMatrix":function(l,c){return e(c,l,this,!0)},"Array, any":function(l,c){return e(o(l),c,this,!1).valueOf()},"any, Array":function(l,c){return e(o(c),l,this,!0).valueOf()}})}),dr="algorithm01",hr=["typed"],or=(0,A.d5)(dr,hr,u=>{var{typed:i}=u;return function(t,r,s,p){var d=t._data,v=t._size,m=t._datatype,n=r._values,e=r._index,a=r._ptr,l=r._size,c=r._datatype;if(v.length!==l.length)throw new pt.m(v.length,l.length);if(v[0]!==l[0]||v[1]!==l[1])throw new RangeError("Dimension mismatch. Matrix A ("+v+") must match Matrix B ("+l+")");if(!n)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var f=v[0],b=v[1],w=typeof m=="string"&&m===c?m:void 0,E=w?i.find(s,[w,w]):s,g,S,N=[];for(g=0;g<f;g++)N[g]=[];var h=[],C=[];for(S=0;S<b;S++){for(var O=S+1,T=a[S],M=a[S+1],P=T;P<M;P++)g=e[P],h[g]=p?E(n[P],d[g][S]):E(d[g][S],n[P]),C[g]=O;for(g=0;g<f;g++)C[g]===O?N[g][S]=h[g]:N[g][S]=d[g][S]}return t.createDenseMatrix({data:N,size:[f,b],datatype:w})}}),Fr="algorithm06",_e=["typed","equalScalar"],ke=(0,A.d5)(Fr,_e,u=>{var{typed:i,equalScalar:o}=u;return function(r,s,p){var d=r._values,v=r._size,m=r._datatype,n=s._values,e=s._size,a=s._datatype;if(v.length!==e.length)throw new pt.m(v.length,e.length);if(v[0]!==e[0]||v[1]!==e[1])throw new RangeError("Dimension mismatch. Matrix A ("+v+") must match Matrix B ("+e+")");var l=v[0],c=v[1],f,b=o,w=0,E=p;typeof m=="string"&&m===a&&(f=m,b=i.find(o,[f,f]),w=i.convert(0,f),E=i.find(p,[f,f]));for(var g=d&&n?[]:void 0,S=[],N=[],h=g?[]:void 0,C=[],O=[],T=0;T<c;T++){N[T]=S.length;var M=T+1;if((0,Mr.U6)(r,T,C,h,O,M,S,E),(0,Mr.U6)(s,T,C,h,O,M,S,E),h)for(var P=N[T];P<S.length;){var z=S[P];if(O[z]===M){var $=h[z];b($,w)?S.splice(P,1):(g.push($),P++)}else S.splice(P,1)}else for(var V=N[T];V<S.length;){var te=S[V];O[te]!==M?S.splice(V,1):V++}}return N[c]=S.length,r.createSparseMatrix({values:g,index:S,ptr:N,size:[l,c],datatype:f})}}),at="nthRoot",Ne=["typed","matrix","equalScalar","BigNumber"],ae=(0,A.d5)(at,Ne,u=>{var{typed:i,matrix:o,equalScalar:t,BigNumber:r}=u,s=or({typed:i}),p=F({typed:i,equalScalar:t}),d=ke({typed:i,equalScalar:t}),v=oe({typed:i,equalScalar:t}),m=Br({typed:i}),n=Z({typed:i}),e="Complex number not supported in function nthRoot. Use nthRoots instead.";return i(at,{number:ti,"number, number":ti,BigNumber:function(c){return a(c,new r(2))},Complex:function(c){throw new Error(e)},"Complex, number":function(c,f){throw new Error(e)},"BigNumber, BigNumber":a,"Array | Matrix":function(c){return this(c,2)},"SparseMatrix, SparseMatrix":function(c,f){if(f.density()===1)return d(c,f,this);throw new Error("Root must be non-zero")},"SparseMatrix, DenseMatrix":function(c,f){return p(f,c,this,!0)},"DenseMatrix, SparseMatrix":function(c,f){if(f.density()===1)return s(c,f,this,!1);throw new Error("Root must be non-zero")},"DenseMatrix, DenseMatrix":function(c,f){return m(c,f,this)},"Array, Array":function(c,f){return this(o(c),o(f)).valueOf()},"Array, Matrix":function(c,f){return this(o(c),f)},"Matrix, Array":function(c,f){return this(c,o(f))},"SparseMatrix, number | BigNumber":function(c,f){return v(c,f,this,!1)},"DenseMatrix, number | BigNumber":function(c,f){return n(c,f,this,!1)},"number | BigNumber, SparseMatrix":function(c,f){if(f.density()===1)return v(f,c,this,!0);throw new Error("Root must be non-zero")},"number | BigNumber, DenseMatrix":function(c,f){return n(f,c,this,!0)},"Array, number | BigNumber":function(c,f){return this(o(c),f).valueOf()},"number | BigNumber, Array":function(c,f){return this(c,o(f)).valueOf()}});function a(l,c){var f=r.precision,b=r.clone({precision:f+2}),w=new r(0),E=new b(1),g=c.isNegative();if(g&&(c=c.neg()),c.isZero())throw new Error("Root must be non-zero");if(l.isNegative()&&!c.abs().mod(2).equals(1))throw new Error("Root must be odd when a is negative.");if(l.isZero())return g?new b(1/0):0;if(!l.isFinite())return g?w:l;var S=l.abs().pow(E.div(c));return S=l.isNeg()?S.neg():S,new r((g?E.div(S):S).toPrecision(f))}}),xr=null,_r=ie(35337),Tr="numeric",Xr=["number","?bignumber","?fraction"],jr=(0,A.d5)(Tr,Xr,u=>{var{number:i,bignumber:o,fraction:t}=u,r={string:!0,number:!0,BigNumber:!0,Fraction:!0},s={number:p=>i(p),BigNumber:o?p=>o(p):_r.R3,Fraction:t?p=>t(p):_r.nG};return function(d,v){var m=(0,L.kM)(d);if(!(m in r))throw new TypeError("Cannot convert "+d+' of type "'+m+'"; valid input types are '+Object.keys(r).join(", "));if(!(v in s))throw new TypeError("Cannot convert "+d+' to type "'+v+'"; valid output types are '+Object.keys(s).join(", "));return v===m?d:s[v](d)}}),Cr="or",et=["typed","matrix","equalScalar","DenseMatrix"],rt=(0,A.d5)(Cr,et,u=>{var{typed:i,matrix:o,equalScalar:t,DenseMatrix:r}=u,s=_({typed:i}),p=W({typed:i,equalScalar:t}),d=He({typed:i,DenseMatrix:r}),v=Br({typed:i}),m=Z({typed:i});return i(Cr,{"number, number":No,"Complex, Complex":function(e,a){return e.re!==0||e.im!==0||a.re!==0||a.im!==0},"BigNumber, BigNumber":function(e,a){return!e.isZero()&&!e.isNaN()||!a.isZero()&&!a.isNaN()},"Unit, Unit":function(e,a){return this(e.value||0,a.value||0)},"SparseMatrix, SparseMatrix":function(e,a){return p(e,a,this)},"SparseMatrix, DenseMatrix":function(e,a){return s(a,e,this,!0)},"DenseMatrix, SparseMatrix":function(e,a){return s(e,a,this,!1)},"DenseMatrix, DenseMatrix":function(e,a){return v(e,a,this)},"Array, Array":function(e,a){return this(o(e),o(a)).valueOf()},"Array, Matrix":function(e,a){return this(o(e),a)},"Matrix, Array":function(e,a){return this(e,o(a))},"SparseMatrix, any":function(e,a){return d(e,a,this,!1)},"DenseMatrix, any":function(e,a){return m(e,a,this,!1)},"any, SparseMatrix":function(e,a){return d(a,e,this,!0)},"any, DenseMatrix":function(e,a){return m(a,e,this,!0)},"Array, any":function(e,a){return m(o(e),a,this,!1).valueOf()},"any, Array":function(e,a){return m(o(a),e,this,!0).valueOf()}})}),ut=ie(44690),Mt="prod",bt=["typed","config","multiplyScalar","numeric"],Zr=(0,A.d5)(Mt,bt,u=>{var{typed:i,config:o,multiplyScalar:t,numeric:r}=u;return i(Mt,{"Array | Matrix":s,"Array | Matrix, number | BigNumber":function(d,v){throw new Error("prod(A, dim) is not yet supported")},"...":function(d){return s(d)}});function s(p){var d;if((0,Mr.Et)(p,function(v){try{d=d===void 0?v:t(d,v)}catch(m){throw(0,ut.x)(m,"prod",v)}}),typeof d=="string"&&(d=r(d,o.number)),d===void 0)throw new Error("Cannot calculate prod of an empty array");return d}}),ct="reshape",$r=["typed","isInteger","matrix"],xt=(0,A.d5)(ct,$r,u=>{var{typed:i,isInteger:o}=u;return i(ct,{"Matrix, Array":function(r,s){return r.reshape(s)},"Array, Array":function(r,s){return s.forEach(function(p){if(!o(p))throw new TypeError("Invalid size for dimension: "+p)}),(0,ze.XL)(r,s)}})}),qt="size",Rt=["typed","config","?matrix"],nn=(0,A.d5)(qt,Rt,u=>{var{typed:i,config:o,matrix:t}=u;return i(qt,{Matrix:function(s){return s.create(s.size())},Array:ze.aJ,string:function(s){return o.matrix==="Array"?[s.length]:t([s.length])},"number | Complex | BigNumber | Unit | boolean | null":function(s){return o.matrix==="Array"?[]:t?t([]):(0,_r.kX)()}})}),Qt="algorithm07",Pn=["typed","DenseMatrix"],Fe=(0,A.d5)(Qt,Pn,u=>{var{typed:i,DenseMatrix:o}=u;return function(s,p,d){var v=s._size,m=s._datatype,n=p._size,e=p._datatype;if(v.length!==n.length)throw new pt.m(v.length,n.length);if(v[0]!==n[0]||v[1]!==n[1])throw new RangeError("Dimension mismatch. Matrix A ("+v+") must match Matrix B ("+n+")");var a=v[0],l=v[1],c,f=0,b=d;typeof m=="string"&&m===e&&(c=m,f=i.convert(0,c),b=i.find(d,[c,c]));var w,E,g=[];for(w=0;w<a;w++)g[w]=[];var S=[],N=[],h=[],C=[];for(E=0;E<l;E++){var O=E+1;for(t(s,E,h,S,O),t(p,E,C,N,O),w=0;w<a;w++){var T=h[w]===O?S[w]:f,M=C[w]===O?N[w]:f;g[w][E]=b(T,M)}}return new o({data:g,size:[a,l],datatype:c})};function t(r,s,p,d,v){for(var m=r._values,n=r._index,e=r._ptr,a=e[s],l=e[s+1];a<l;a++){var c=n[a];p[c]=v,d[c]=m[a]}}}),Je="smaller",rr=["typed","config","matrix","DenseMatrix"],Lr=(0,A.d5)(Je,rr,u=>{var{typed:i,config:o,matrix:t,DenseMatrix:r}=u,s=_({typed:i}),p=Fe({typed:i,DenseMatrix:r}),d=He({typed:i,DenseMatrix:r}),v=Br({typed:i}),m=Z({typed:i});return i(Je,{"boolean, boolean":function(e,a){return e<a},"number, number":function(e,a){return e<a&&!(0,le.RI)(e,a,o.epsilon)},"BigNumber, BigNumber":function(e,a){return e.lt(a)&&!$t(e,a,o.epsilon)},"Fraction, Fraction":function(e,a){return e.compare(a)===-1},"Complex, Complex":function(e,a){throw new TypeError("No ordering relation is defined for complex numbers")},"Unit, Unit":function(e,a){if(!e.equalBase(a))throw new Error("Cannot compare units with different base");return this(e.value,a.value)},"SparseMatrix, SparseMatrix":function(e,a){return p(e,a,this)},"SparseMatrix, DenseMatrix":function(e,a){return s(a,e,this,!0)},"DenseMatrix, SparseMatrix":function(e,a){return s(e,a,this,!1)},"DenseMatrix, DenseMatrix":function(e,a){return v(e,a,this)},"Array, Array":function(e,a){return this(t(e),t(a)).valueOf()},"Array, Matrix":function(e,a){return this(t(e),a)},"Matrix, Array":function(e,a){return this(e,t(a))},"SparseMatrix, any":function(e,a){return d(e,a,this,!1)},"DenseMatrix, any":function(e,a){return m(e,a,this,!1)},"any, SparseMatrix":function(e,a){return d(a,e,this,!0)},"any, DenseMatrix":function(e,a){return m(a,e,this,!0)},"Array, any":function(e,a){return m(t(e),a,this,!1).valueOf()},"any, Array":function(e,a){return m(t(a),e,this,!0).valueOf()}})}),Rr=null,Qr="squeeze",br=["typed","matrix"],gt=(0,A.d5)(Qr,br,u=>{var{typed:i,matrix:o}=u;return i(Qr,{Array:function(r){return(0,ze.L9)((0,Sr.d9)(r))},Matrix:function(r){var s=(0,ze.L9)(r.toArray());return Array.isArray(s)?o(s):s},any:function(r){return(0,Sr.d9)(r)}})}),Ot=ie(37299),Wt="algorithm10",St=["typed","DenseMatrix"],Nt=(0,A.d5)(Wt,St,u=>{var{typed:i,DenseMatrix:o}=u;return function(r,s,p,d){var v=r._values,m=r._index,n=r._ptr,e=r._size,a=r._datatype;if(!v)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var l=e[0],c=e[1],f,b=p;typeof a=="string"&&(f=a,s=i.convert(s,f),b=i.find(p,[f,f]));for(var w=[],E=[],g=[],S=0;S<c;S++){for(var N=S+1,h=n[S],C=n[S+1],O=h;O<C;O++){var T=m[O];E[T]=v[O],g[T]=N}for(var M=0;M<l;M++)S===0&&(w[M]=[]),g[M]===N?w[M][S]=d?b(s,E[M]):b(E[M],s):w[M][S]=s}return new o({data:w,size:[l,c],datatype:f})}}),Ft="subtract",dn=["typed","matrix","equalScalar","addScalar","unaryMinus","DenseMatrix"],Ln=(0,A.d5)(Ft,dn,u=>{var{typed:i,matrix:o,equalScalar:t,addScalar:r,unaryMinus:s,DenseMatrix:p}=u,d=or({typed:i}),v=_({typed:i}),m=W({typed:i,equalScalar:t}),n=Nt({typed:i,DenseMatrix:p}),e=Br({typed:i}),a=Z({typed:i});return i(Ft,{"number, number":function(c,f){return c-f},"Complex, Complex":function(c,f){return c.sub(f)},"BigNumber, BigNumber":function(c,f){return c.minus(f)},"Fraction, Fraction":function(c,f){return c.sub(f)},"Unit, Unit":function(c,f){if(c.value===null)throw new Error("Parameter x contains a unit with undefined value");if(f.value===null)throw new Error("Parameter y contains a unit with undefined value");if(!c.equalBase(f))throw new Error("Units do not match");var b=c.clone();return b.value=this(b.value,f.value),b.fixPrefix=!1,b},"SparseMatrix, SparseMatrix":function(c,f){return jt(c,f),m(c,f,this)},"SparseMatrix, DenseMatrix":function(c,f){return jt(c,f),v(f,c,this,!0)},"DenseMatrix, SparseMatrix":function(c,f){return jt(c,f),d(c,f,this,!1)},"DenseMatrix, DenseMatrix":function(c,f){return jt(c,f),e(c,f,this)},"Array, Array":function(c,f){return this(o(c),o(f)).valueOf()},"Array, Matrix":function(c,f){return this(o(c),f)},"Matrix, Array":function(c,f){return this(c,o(f))},"SparseMatrix, any":function(c,f){return n(c,s(f),r)},"DenseMatrix, any":function(c,f){return a(c,f,this)},"any, SparseMatrix":function(c,f){return n(f,c,this,!0)},"any, DenseMatrix":function(c,f){return a(f,c,this,!0)},"Array, any":function(c,f){return a(o(c),f,this,!1).valueOf()},"any, Array":function(c,f){return a(o(f),c,this,!0).valueOf()}})});function jt(u,i){var o=u.size(),t=i.size();if(o.length!==t.length)throw new pt.m(o.length,t.length)}var An="to",hn=["typed","matrix"],ra=(0,A.d5)(An,hn,u=>{var{typed:i,matrix:o}=u,t=Br({typed:i}),r=Z({typed:i});return i(An,{"Unit, Unit | string":function(p,d){return p.to(d)},"Matrix, Matrix":function(p,d){return t(p,d,this)},"Array, Array":function(p,d){return this(o(p),o(d)).valueOf()},"Array, Matrix":function(p,d){return this(o(p),d)},"Matrix, Array":function(p,d){return this(p,o(d))},"Matrix, any":function(p,d){return r(p,d,this,!1)},"any, Matrix":function(p,d){return r(d,p,this,!0)},"Array, any":function(p,d){return r(o(p),d,this,!1).valueOf()},"any, Array":function(p,d){return r(o(d),p,this,!0).valueOf()}})}),lt="transpose",ls=["typed","matrix"],x=(0,A.d5)(lt,ls,u=>{var{typed:i,matrix:o}=u;return i("transpose",{Array:function(p){return this(o(p)).valueOf()},Matrix:function(p){var d=p.size(),v;switch(d.length){case 1:v=p.clone();break;case 2:{var m=d[0],n=d[1];if(n===0)throw new RangeError("Cannot transpose a 2D matrix with no columns (size: "+(0,Jr.WU)(d)+")");switch(p.storage()){case"dense":v=t(p,m,n);break;case"sparse":v=r(p,m,n);break}}break;default:throw new RangeError("Matrix must be a vector or two dimensional (size: "+(0,Jr.WU)(this._size)+")")}return v},any:function(p){return(0,Sr.d9)(p)}});function t(s,p,d){for(var v=s._data,m=[],n,e=0;e<d;e++){n=m[e]=[];for(var a=0;a<p;a++)n[a]=(0,Sr.d9)(v[a][e])}return s.createDenseMatrix({data:m,size:[d,p],datatype:s._datatype})}function r(s,p,d){for(var v=s._values,m=s._index,n=s._ptr,e=v?[]:void 0,a=[],l=[],c=[],f=0;f<p;f++)c[f]=0;var b,w,E;for(b=0,w=m.length;b<w;b++)c[m[b]]++;for(var g=0,S=0;S<p;S++)l.push(g),g+=c[S],c[S]=l[S];for(l.push(g),E=0;E<d;E++)for(var N=n[E],h=n[E+1],C=N;C<h;C++){var O=c[m[C]]++;a[O]=E,v&&(e[O]=(0,Sr.d9)(v[C]))}return s.createSparseMatrix({values:e,index:a,ptr:l,size:[d,p],datatype:s._datatype})}}),J="xgcd",Be=["typed","config","matrix","BigNumber"],fr=(0,A.d5)(J,Be,u=>{var{typed:i,config:o,matrix:t,BigNumber:r}=u;return i(J,{"number, number":function(d,v){var m=ai(d,v);return o.matrix==="Array"?m:t(m)},"BigNumber, BigNumber":s});function s(p,d){var v,m,n,e=new r(0),a=new r(1),l=e,c=a,f=a,b=e;if(!p.isInt()||!d.isInt())throw new Error("Parameters in function xgcd must be integer numbers");for(;!d.isZero();)m=p.div(d).floor(),n=p.mod(d),v=l,l=c.minus(m.times(l)),c=v,v=f,f=b.minus(m.times(f)),b=v,p=d,d=n;var w;return p.lt(e)?w=[p.neg(),c.neg(),b.neg()]:w=[p,p.isZero()?0:c,b],o.matrix==="Array"?w:t(w)}}),Vr="zeros",tt=["typed","config","matrix","BigNumber"],Gt=(0,A.d5)(Vr,tt,u=>{var{typed:i,config:o,matrix:t,BigNumber:r}=u;return i(Vr,{"":function(){return o.matrix==="Array"?s([]):s([],"default")},"...number | BigNumber | string":function(m){var n=m[m.length-1];if(typeof n=="string"){var e=m.pop();return s(m,e)}else return o.matrix==="Array"?s(m):s(m,"default")},Array:s,Matrix:function(m){var n=m.storage();return s(m.valueOf(),n)},"Array | Matrix, string":function(m,n){return s(m.valueOf(),n)}});function s(v,m){var n=p(v),e=n?new r(0):0;if(d(v),m){var a=t(m);return v.length>0?a.resize(v,e):a}else{var l=[];return v.length>0?(0,ze.SI)(l,v,e):l}}function p(v){var m=!1;return v.forEach(function(n,e,a){(0,L.l9)(n)&&(m=!0,a[e]=n.toNumber())}),m}function d(v){v.forEach(function(m){if(typeof m!="number"||!(0,le.U)(m)||m<0)throw new Error("Parameters in function zeros must be positive integers")})}}),fs="and",jp=["typed","matrix","equalScalar","zeros","not"],ed=(0,A.d5)(fs,jp,u=>{var{typed:i,matrix:o,equalScalar:t,zeros:r,not:s}=u,p=F({typed:i,equalScalar:t}),d=ke({typed:i,equalScalar:t}),v=oe({typed:i,equalScalar:t}),m=Br({typed:i}),n=Z({typed:i});return i(fs,{"number, number":wo,"Complex, Complex":function(a,l){return(a.re!==0||a.im!==0)&&(l.re!==0||l.im!==0)},"BigNumber, BigNumber":function(a,l){return!a.isZero()&&!l.isZero()&&!a.isNaN()&&!l.isNaN()},"Unit, Unit":function(a,l){return this(a.value||0,l.value||0)},"SparseMatrix, SparseMatrix":function(a,l){return d(a,l,this,!1)},"SparseMatrix, DenseMatrix":function(a,l){return p(l,a,this,!0)},"DenseMatrix, SparseMatrix":function(a,l){return p(a,l,this,!1)},"DenseMatrix, DenseMatrix":function(a,l){return m(a,l,this)},"Array, Array":function(a,l){return this(o(a),o(l)).valueOf()},"Array, Matrix":function(a,l){return this(o(a),l)},"Matrix, Array":function(a,l){return this(a,o(l))},"SparseMatrix, any":function(a,l){return s(l)?r(a.size(),a.storage()):v(a,l,this,!1)},"DenseMatrix, any":function(a,l){return s(l)?r(a.size(),a.storage()):n(a,l,this,!1)},"any, SparseMatrix":function(a,l){return s(a)?r(a.size(),a.storage()):v(l,a,this,!0)},"any, DenseMatrix":function(a,l){return s(a)?r(a.size(),a.storage()):n(l,a,this,!0)},"Array, any":function(a,l){return this(o(a),l).valueOf()},"any, Array":function(a,l){return this(a,o(l)).valueOf()}})}),gm="bitAnd",rd=["typed","matrix","equalScalar"],td=(0,A.d5)(gm,rd,u=>{var{typed:i,matrix:o,equalScalar:t}=u,r=F({typed:i,equalScalar:t}),s=ke({typed:i,equalScalar:t}),p=oe({typed:i,equalScalar:t}),d=Br({typed:i}),v=Z({typed:i});return i(gm,{"number, number":Ti,"BigNumber, BigNumber":bc,"SparseMatrix, SparseMatrix":function(n,e){return s(n,e,this,!1)},"SparseMatrix, DenseMatrix":function(n,e){return r(e,n,this,!0)},"DenseMatrix, SparseMatrix":function(n,e){return r(n,e,this,!1)},"DenseMatrix, DenseMatrix":function(n,e){return d(n,e,this)},"Array, Array":function(n,e){return this(o(n),o(e)).valueOf()},"Array, Matrix":function(n,e){return this(o(n),e)},"Matrix, Array":function(n,e){return this(n,o(e))},"SparseMatrix, any":function(n,e){return p(n,e,this,!1)},"DenseMatrix, any":function(n,e){return v(n,e,this,!1)},"any, SparseMatrix":function(n,e){return p(e,n,this,!0)},"any, DenseMatrix":function(n,e){return v(e,n,this,!0)},"Array, any":function(n,e){return v(o(n),e,this,!1).valueOf()},"any, Array":function(n,e){return v(o(e),n,this,!0).valueOf()}})}),ym="bitXor",nd=["typed","matrix","DenseMatrix"],ad=(0,A.d5)(ym,nd,u=>{var{typed:i,matrix:o,DenseMatrix:t}=u,r=_({typed:i}),s=Fe({typed:i,DenseMatrix:t}),p=He({typed:i,DenseMatrix:t}),d=Br({typed:i}),v=Z({typed:i});return i(ym,{"number, number":Ii,"BigNumber, BigNumber":wc,"SparseMatrix, SparseMatrix":function(n,e){return s(n,e,this)},"SparseMatrix, DenseMatrix":function(n,e){return r(e,n,this,!0)},"DenseMatrix, SparseMatrix":function(n,e){return r(n,e,this,!1)},"DenseMatrix, DenseMatrix":function(n,e){return d(n,e,this)},"Array, Array":function(n,e){return this(o(n),o(e)).valueOf()},"Array, Matrix":function(n,e){return this(o(n),e)},"Matrix, Array":function(n,e){return this(n,o(e))},"SparseMatrix, any":function(n,e){return p(n,e,this,!1)},"DenseMatrix, any":function(n,e){return v(n,e,this,!1)},"any, SparseMatrix":function(n,e){return p(e,n,this,!0)},"any, DenseMatrix":function(n,e){return v(e,n,this,!0)},"Array, any":function(n,e){return v(o(n),e,this,!1).valueOf()},"any, Array":function(n,e){return v(o(e),n,this,!0).valueOf()}})}),xm="cbrt",id=["config","typed","isNegative","unaryMinus","matrix","Complex","BigNumber","Fraction"],od=(0,A.d5)(xm,id,u=>{var{config:i,typed:o,isNegative:t,unaryMinus:r,matrix:s,Complex:p,BigNumber:d,Fraction:v}=u;return o(xm,{number:Dn,Complex:m,"Complex, boolean":m,BigNumber:function(a){return a.cbrt()},Unit:n,"Array | Matrix":function(a){return(0,Mr.Fh)(a,this,!0)}});function m(e,a){var l=e.arg()/3,c=e.abs(),f=new p(Dn(c),0).mul(new p(0,l).exp());if(a){var b=[f,new p(Dn(c),0).mul(new p(0,l+Math.PI*2/3).exp()),new p(Dn(c),0).mul(new p(0,l-Math.PI*2/3).exp())];return i.matrix==="Array"?b:s(b)}else return f}function n(e){if(e.value&&(0,L.Mc)(e.value)){var a=e.clone();return a.value=1,a=a.pow(1/3),a.value=m(e.value),a}else{var l=t(e.value);l&&(e.value=r(e.value));var c;(0,L.l9)(e.value)?c=new d(1).div(3):(0,L.yQ)(e.value)?c=new v(1,3):c=1/3;var f=e.pow(c);return l&&(f.value=r(f.value)),f}}}),bm="compare",sd=["typed","config","matrix","equalScalar","BigNumber","Fraction","DenseMatrix"],ud=(0,A.d5)(bm,sd,u=>{var{typed:i,config:o,equalScalar:t,matrix:r,BigNumber:s,Fraction:p,DenseMatrix:d}=u,v=_({typed:i}),m=W({typed:i,equalScalar:t}),n=He({typed:i,DenseMatrix:d}),e=Br({typed:i}),a=Z({typed:i});return i(bm,{"boolean, boolean":function(c,f){return c===f?0:c>f?1:-1},"number, number":function(c,f){return(0,le.RI)(c,f,o.epsilon)?0:c>f?1:-1},"BigNumber, BigNumber":function(c,f){return $t(c,f,o.epsilon)?new s(0):new s(c.cmp(f))},"Fraction, Fraction":function(c,f){return new p(c.compare(f))},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")},"Unit, Unit":function(c,f){if(!c.equalBase(f))throw new Error("Cannot compare units with different base");return this(c.value,f.value)},"SparseMatrix, SparseMatrix":function(c,f){return m(c,f,this)},"SparseMatrix, DenseMatrix":function(c,f){return v(f,c,this,!0)},"DenseMatrix, SparseMatrix":function(c,f){return v(c,f,this,!1)},"DenseMatrix, DenseMatrix":function(c,f){return e(c,f,this)},"Array, Array":function(c,f){return this(r(c),r(f)).valueOf()},"Array, Matrix":function(c,f){return this(r(c),f)},"Matrix, Array":function(c,f){return this(c,r(f))},"SparseMatrix, any":function(c,f){return n(c,f,this,!1)},"DenseMatrix, any":function(c,f){return a(c,f,this,!1)},"any, SparseMatrix":function(c,f){return n(f,c,this,!0)},"any, DenseMatrix":function(c,f){return a(f,c,this,!0)},"Array, any":function(c,f){return a(r(c),f,this,!1).valueOf()},"any, Array":function(c,f){return a(r(f),c,this,!0).valueOf()}})}),EN=null,Nm="compareText",cd=["typed","matrix"],ld=(0,A.d5)(Nm,cd,u=>{var{typed:i,matrix:o}=u,t=Br({typed:i}),r=Z({typed:i});return i(Nm,{"any, any":Jr.cd,"DenseMatrix, DenseMatrix":function(p,d){return t(p,d,Jr.cd)},"Array, Array":function(p,d){return this(o(p),o(d)).valueOf()},"Array, Matrix":function(p,d){return this(o(p),d)},"Matrix, Array":function(p,d){return this(p,o(d))},"DenseMatrix, any":function(p,d){return r(p,d,Jr.cd,!1)},"any, DenseMatrix":function(p,d){return r(d,p,Jr.cd,!0)},"Array, any":function(p,d){return r(o(p),d,Jr.cd,!1).valueOf()},"any, Array":function(p,d){return r(o(d),p,Jr.cd,!0).valueOf()}})}),CN=null,fd=ie(12155),wm="count",md=["typed","size","prod"],vd=(0,A.d5)(wm,md,u=>{var{typed:i,size:o,prod:t}=u;return i(wm,{string:function(s){return s.length},"Matrix | Array":function(s){return t(o(s))}})}),Mm="ctranspose",pd=["typed","transpose","conj"],dd=(0,A.d5)(Mm,pd,u=>{var{typed:i,transpose:o,conj:t}=u;return i(Mm,{any:function(s){return t(o(s))}})}),Am="diag",hd=["typed","matrix","DenseMatrix","SparseMatrix"],gd=(0,A.d5)(Am,hd,u=>{var{typed:i,matrix:o,DenseMatrix:t,SparseMatrix:r}=u;return i(Am,{Array:function(m){return s(m,0,(0,ze.aJ)(m),null)},"Array, number":function(m,n){return s(m,n,(0,ze.aJ)(m),null)},"Array, BigNumber":function(m,n){return s(m,n.toNumber(),(0,ze.aJ)(m),null)},"Array, string":function(m,n){return s(m,0,(0,ze.aJ)(m),n)},"Array, number, string":function(m,n,e){return s(m,n,(0,ze.aJ)(m),e)},"Array, BigNumber, string":function(m,n,e){return s(m,n.toNumber(),(0,ze.aJ)(m),e)},Matrix:function(m){return s(m,0,m.size(),m.storage())},"Matrix, number":function(m,n){return s(m,n,m.size(),m.storage())},"Matrix, BigNumber":function(m,n){return s(m,n.toNumber(),m.size(),m.storage())},"Matrix, string":function(m,n){return s(m,0,m.size(),n)},"Matrix, number, string":function(m,n,e){return s(m,n,m.size(),e)},"Matrix, BigNumber, string":function(m,n,e){return s(m,n.toNumber(),m.size(),e)}});function s(v,m,n,e){if(!(0,le.U)(m))throw new TypeError("Second parameter in function diag must be an integer");var a=m>0?m:0,l=m<0?-m:0;switch(n.length){case 1:return p(v,m,e,n[0],l,a);case 2:return d(v,m,e,n,l,a)}throw new RangeError("Matrix for function diag must be 2 dimensional")}function p(v,m,n,e,a,l){var c=[e+a,e+l];if(n&&n!=="sparse"&&n!=="dense")throw new TypeError("Unknown matrix type ".concat(n,'"'));var f=n==="sparse"?r.diagonal(c,v,m):t.diagonal(c,v,m);return n!==null?f:f.valueOf()}function d(v,m,n,e,a,l){if((0,L.SW)(v)){var c=v.diagonal(m);return n!==null?n!==c.storage()?o(c,n):c:c.valueOf()}for(var f=Math.min(e[0]-a,e[1]-l),b=[],w=0;w<f;w++)b[w]=v[w+a][w+l];return n!==null?o(b):b}}),Sm="divideScalar",yd=["typed","numeric"],xd=(0,A.d5)(Sm,yd,u=>{var{typed:i,numeric:o}=u;return i(Sm,{"number, number":function(r,s){return r/s},"Complex, Complex":function(r,s){return r.div(s)},"BigNumber, BigNumber":function(r,s){return r.div(s)},"Fraction, Fraction":function(r,s){return r.div(s)},"Unit, number | Fraction | BigNumber":function(r,s){var p=r.clone(),d=o(1,(0,L.kM)(s));return p.value=this(p.value===null?p._normalize(d):p.value,s),p},"number | Fraction | BigNumber, Unit":function(r,s){var p=s.clone();p=p.pow(-1);var d=o(1,(0,L.kM)(r));return p.value=this(r,s.value===null?s._normalize(d):s.value),p},"Unit, Unit":function(r,s){return r.divide(s)}})}),_m="dotDivide",bd=["typed","matrix","equalScalar","divideScalar","DenseMatrix"],Nd=(0,A.d5)(_m,bd,u=>{var{typed:i,matrix:o,equalScalar:t,divideScalar:r,DenseMatrix:s}=u,p=F({typed:i,equalScalar:t}),d=_({typed:i}),v=Fe({typed:i,DenseMatrix:s}),m=oe({typed:i,equalScalar:t}),n=He({typed:i,DenseMatrix:s}),e=Br({typed:i}),a=Z({typed:i});return i(_m,{"any, any":r,"SparseMatrix, SparseMatrix":function(c,f){return v(c,f,r,!1)},"SparseMatrix, DenseMatrix":function(c,f){return p(f,c,r,!0)},"DenseMatrix, SparseMatrix":function(c,f){return d(c,f,r,!1)},"DenseMatrix, DenseMatrix":function(c,f){return e(c,f,r)},"Array, Array":function(c,f){return this(o(c),o(f)).valueOf()},"Array, Matrix":function(c,f){return this(o(c),f)},"Matrix, Array":function(c,f){return this(c,o(f))},"SparseMatrix, any":function(c,f){return m(c,f,r,!1)},"DenseMatrix, any":function(c,f){return a(c,f,r,!1)},"any, SparseMatrix":function(c,f){return n(f,c,r,!0)},"any, DenseMatrix":function(c,f){return a(f,c,r,!0)},"Array, any":function(c,f){return a(o(c),f,r,!1).valueOf()},"any, Array":function(c,f){return a(o(f),c,r,!0).valueOf()}})}),ms="equal",wd=["typed","matrix","equalScalar","DenseMatrix"],Md=(0,A.d5)(ms,wd,u=>{var{typed:i,matrix:o,equalScalar:t,DenseMatrix:r}=u,s=_({typed:i}),p=Fe({typed:i,DenseMatrix:r}),d=He({typed:i,DenseMatrix:r}),v=Br({typed:i}),m=Z({typed:i});return i(ms,{"any, any":function(e,a){return e===null?a===null:a===null?e===null:e===void 0?a===void 0:a===void 0?e===void 0:t(e,a)},"SparseMatrix, SparseMatrix":function(e,a){return p(e,a,t)},"SparseMatrix, DenseMatrix":function(e,a){return s(a,e,t,!0)},"DenseMatrix, SparseMatrix":function(e,a){return s(e,a,t,!1)},"DenseMatrix, DenseMatrix":function(e,a){return v(e,a,t)},"Array, Array":function(e,a){return this(o(e),o(a)).valueOf()},"Array, Matrix":function(e,a){return this(o(e),a)},"Matrix, Array":function(e,a){return this(e,o(a))},"SparseMatrix, any":function(e,a){return d(e,a,t,!1)},"DenseMatrix, any":function(e,a){return m(e,a,t,!1)},"any, SparseMatrix":function(e,a){return d(a,e,t,!0)},"any, DenseMatrix":function(e,a){return m(a,e,t,!0)},"Array, any":function(e,a){return m(o(e),a,t,!1).valueOf()},"any, Array":function(e,a){return m(o(a),e,t,!0).valueOf()}})}),ON=(0,A.d5)(ms,["typed","equalScalar"],u=>{var{typed:i,equalScalar:o}=u;return i(ms,{"any, any":function(r,s){return r===null?s===null:s===null?r===null:r===void 0?s===void 0:s===void 0?r===void 0:o(r,s)}})}),Em="fft",Ad=["typed","matrix","addScalar","multiplyScalar","divideScalar","exp","tau","i"],Sd=(0,A.d5)(Em,Ad,u=>{var{typed:i,matrix:o,addScalar:t,multiplyScalar:r,divideScalar:s,exp:p,tau:d,i:v}=u;return i(Em,{Array:m,Matrix:function(l){return l.create(m(l.toArray()))}});function m(a){var l=(0,ze.aJ)(a);return l.length===1?e(a,l[0]):n(a.map(c=>m(c,l.slice(1))),0)}function n(a,l){var c=(0,ze.aJ)(a);if(l!==0)return new Array(c[0]).fill(0).map((b,w)=>n(a[w],l-1));if(c.length===1)return e(a);function f(b){var w=(0,ze.aJ)(b);return new Array(w[1]).fill(0).map((E,g)=>new Array(w[0]).fill(0).map((S,N)=>b[N][g]))}return f(n(f(a),1))}function e(a){var l=a.length;if(l===1)return[a[0]];if(l%2===0){for(var c=[...e(a.filter((E,g)=>g%2===0),l/2),...e(a.filter((E,g)=>g%2===1),l/2)],f=0;f<l/2;f++){var b=c[f],w=r(c[f+l/2],p(r(r(d,v),s(-f,l))));c[f]=t(b,w),c[f+l/2]=t(b,r(-1,w))}return c}throw new Error("Can only calculate FFT of power-of-two size")}}),Cm="flatten",_d=["typed","matrix"],Ed=(0,A.d5)(Cm,_d,u=>{var{typed:i,matrix:o}=u;return i(Cm,{Array:function(r){return(0,ze.xH)((0,Sr.d9)(r))},Matrix:function(r){var s=(0,ze.xH)((0,Sr.d9)(r.toArray()));return o(s)}})}),Cd="algorithm04",Od=["typed","equalScalar"],Vf=(0,A.d5)(Cd,Od,u=>{var{typed:i,equalScalar:o}=u;return function(r,s,p){var d=r._values,v=r._index,m=r._ptr,n=r._size,e=r._datatype,a=s._values,l=s._index,c=s._ptr,f=s._size,b=s._datatype;if(n.length!==f.length)throw new pt.m(n.length,f.length);if(n[0]!==f[0]||n[1]!==f[1])throw new RangeError("Dimension mismatch. Matrix A ("+n+") must match Matrix B ("+f+")");var w=n[0],E=n[1],g,S=o,N=0,h=p;typeof e=="string"&&e===b&&(g=e,S=i.find(o,[g,g]),N=i.convert(0,g),h=i.find(p,[g,g]));var C=d&&a?[]:void 0,O=[],T=[],M=d&&a?[]:void 0,P=d&&a?[]:void 0,z=[],$=[],V,te,K,I,ve;for(te=0;te<E;te++){T[te]=O.length;var B=te+1;for(I=m[te],ve=m[te+1],K=I;K<ve;K++)V=v[K],O.push(V),z[V]=B,M&&(M[V]=d[K]);for(I=c[te],ve=c[te+1],K=I;K<ve;K++)if(V=l[K],z[V]===B){if(M){var j=h(M[V],a[K]);S(j,N)?z[V]=null:M[V]=j}}else O.push(V),$[V]=B,P&&(P[V]=a[K]);if(M&&P)for(K=T[te];K<O.length;)V=O[K],z[V]===B?(C[K]=M[V],K++):$[V]===B?(C[K]=P[V],K++):O.splice(K,1)}return T[E]=O.length,r.createSparseMatrix({values:C,index:O,ptr:T,size:[w,E],datatype:g})}}),Om="gcd",Dd=["typed","matrix","equalScalar","BigNumber","DenseMatrix"],Bd=(0,A.d5)(Om,Dd,u=>{var{typed:i,matrix:o,equalScalar:t,BigNumber:r,DenseMatrix:s}=u,p=or({typed:i}),d=Vf({typed:i,equalScalar:t}),v=Nt({typed:i,DenseMatrix:s}),m=Br({typed:i}),n=Z({typed:i});return i(Om,{"number, number":Xa,"BigNumber, BigNumber":e,"Fraction, Fraction":function(l,c){return l.gcd(c)},"SparseMatrix, SparseMatrix":function(l,c){return d(l,c,this)},"SparseMatrix, DenseMatrix":function(l,c){return p(c,l,this,!0)},"DenseMatrix, SparseMatrix":function(l,c){return p(l,c,this,!1)},"DenseMatrix, DenseMatrix":function(l,c){return m(l,c,this)},"Array, Array":function(l,c){return this(o(l),o(c)).valueOf()},"Array, Matrix":function(l,c){return this(o(l),c)},"Matrix, Array":function(l,c){return this(l,o(c))},"SparseMatrix, number | BigNumber":function(l,c){return v(l,c,this,!1)},"DenseMatrix, number | BigNumber":function(l,c){return n(l,c,this,!1)},"number | BigNumber, SparseMatrix":function(l,c){return v(c,l,this,!0)},"number | BigNumber, DenseMatrix":function(l,c){return n(c,l,this,!0)},"Array, number | BigNumber":function(l,c){return n(o(l),c,this,!1).valueOf()},"number | BigNumber, Array":function(l,c){return n(o(c),l,this,!0).valueOf()},"Array | Matrix | number | BigNumber, Array | Matrix | number | BigNumber, ...Array | Matrix | number | BigNumber":function(l,c,f){for(var b=this(l,c),w=0;w<f.length;w++)b=this(b,f[w]);return b}});function e(a,l){if(!a.isInt()||!l.isInt())throw new Error("Parameters in function gcd must be integer numbers");for(var c=new r(0);!l.isZero();){var f=a.mod(l);a=l,l=f}return a.lt(c)?a.neg():a}}),Dm="hasNumericValue",Td=["typed","isNumeric"],Ud=(0,A.d5)(Dm,Td,u=>{var{typed:i,isNumeric:o}=u;return i(Dm,{string:function(r){return r.trim().length>0&&!isNaN(Number(r))},any:function(r){return o(r)}})}),Bm="hypot",Rd=["typed","abs","addScalar","divideScalar","multiplyScalar","sqrt","smaller","isPositive"],Id=(0,A.d5)(Bm,Rd,u=>{var{typed:i,abs:o,addScalar:t,divideScalar:r,multiplyScalar:s,sqrt:p,smaller:d,isPositive:v}=u;return i(Bm,{"... number | BigNumber":m,Array:function(e){return this.apply(this,(0,ze.xH)(e))},Matrix:function(e){return this.apply(this,(0,ze.xH)(e.toArray()))}});function m(n){for(var e=0,a=0,l=0;l<n.length;l++){var c=o(n[l]);d(a,c)?(e=s(e,s(r(a,c),r(a,c))),e=t(e,1),a=c):e=t(e,v(c)?s(r(c,a),r(c,a)):c)}return s(a,p(e))}}),Tm="ifft",Fd=["typed","fft","dotDivide","conj"],zd=(0,A.d5)(Tm,Fd,u=>{var{typed:i,fft:o,dotDivide:t,conj:r}=u;return i(Tm,{"Array | Matrix":function(p){var d=(0,L.SW)(p)?p.size():(0,ze.aJ)(p);return t(r(o(r(p))),d.reduce((v,m)=>v*m,1))}})}),Um="kron",Pd=["typed","matrix","multiplyScalar"],Ld=(0,A.d5)(Um,Pd,u=>{var{typed:i,matrix:o,multiplyScalar:t}=u;return i(Um,{"Matrix, Matrix":function(p,d){return o(r(p.toArray(),d.toArray()))},"Matrix, Array":function(p,d){return o(r(p.toArray(),d))},"Array, Matrix":function(p,d){return o(r(p,d.toArray()))},"Array, Array":r});function r(s,p){if((0,ze.aJ)(s).length===1&&(s=[s]),(0,ze.aJ)(p).length===1&&(p=[p]),(0,ze.aJ)(s).length>2||(0,ze.aJ)(p).length>2)throw new RangeError("Vectors with dimensions greater then 2 are not supported expected (Size x = "+JSON.stringify(s.length)+", y = "+JSON.stringify(p.length)+")");var d=[],v=[];return s.map(function(m){return p.map(function(n){return v=[],d.push(v),m.map(function(e){return n.map(function(a){return v.push(t(e,a))})})})})&&d}}),Rm="largerEq",qd=["typed","config","matrix","DenseMatrix"],Wd=(0,A.d5)(Rm,qd,u=>{var{typed:i,config:o,matrix:t,DenseMatrix:r}=u,s=_({typed:i}),p=Fe({typed:i,DenseMatrix:r}),d=He({typed:i,DenseMatrix:r}),v=Br({typed:i}),m=Z({typed:i});return i(Rm,{"boolean, boolean":function(e,a){return e>=a},"number, number":function(e,a){return e>=a||(0,le.RI)(e,a,o.epsilon)},"BigNumber, BigNumber":function(e,a){return e.gte(a)||$t(e,a,o.epsilon)},"Fraction, Fraction":function(e,a){return e.compare(a)!==-1},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")},"Unit, Unit":function(e,a){if(!e.equalBase(a))throw new Error("Cannot compare units with different base");return this(e.value,a.value)},"SparseMatrix, SparseMatrix":function(e,a){return p(e,a,this)},"SparseMatrix, DenseMatrix":function(e,a){return s(a,e,this,!0)},"DenseMatrix, SparseMatrix":function(e,a){return s(e,a,this,!1)},"DenseMatrix, DenseMatrix":function(e,a){return v(e,a,this)},"Array, Array":function(e,a){return this(t(e),t(a)).valueOf()},"Array, Matrix":function(e,a){return this(t(e),a)},"Matrix, Array":function(e,a){return this(e,t(a))},"SparseMatrix, any":function(e,a){return d(e,a,this,!1)},"DenseMatrix, any":function(e,a){return m(e,a,this,!1)},"any, SparseMatrix":function(e,a){return d(a,e,this,!0)},"any, DenseMatrix":function(e,a){return m(a,e,this,!0)},"Array, any":function(e,a){return m(t(e),a,this,!1).valueOf()},"any, Array":function(e,a){return m(t(a),e,this,!0).valueOf()}})}),DN=null,Gd="algorithm08",Hd=["typed","equalScalar"],Jf=(0,A.d5)(Gd,Hd,u=>{var{typed:i,equalScalar:o}=u;return function(r,s,p){var d=r._values,v=r._index,m=r._ptr,n=r._size,e=r._datatype,a=s._values,l=s._index,c=s._ptr,f=s._size,b=s._datatype;if(n.length!==f.length)throw new pt.m(n.length,f.length);if(n[0]!==f[0]||n[1]!==f[1])throw new RangeError("Dimension mismatch. Matrix A ("+n+") must match Matrix B ("+f+")");if(!d||!a)throw new Error("Cannot perform operation on Pattern Sparse Matrices");var w=n[0],E=n[1],g,S=o,N=0,h=p;typeof e=="string"&&e===b&&(g=e,S=i.find(o,[g,g]),N=i.convert(0,g),h=i.find(p,[g,g]));for(var C=[],O=[],T=[],M=[],P=[],z,$,V,te,K=0;K<E;K++){T[K]=O.length;var I=K+1;for($=m[K],V=m[K+1],z=$;z<V;z++)te=v[z],P[te]=I,M[te]=d[z],O.push(te);for($=c[K],V=c[K+1],z=$;z<V;z++)te=l[z],P[te]===I&&(M[te]=h(M[te],a[z]));for(z=T[K];z<O.length;){te=O[z];var ve=M[te];S(ve,N)?O.splice(z,1):(C.push(ve),z++)}}return T[E]=O.length,r.createSparseMatrix({values:C,index:O,ptr:T,size:[w,E],datatype:g})}}),Im="leftShift",kd=["typed","matrix","equalScalar","zeros","DenseMatrix"],$d=(0,A.d5)(Im,kd,u=>{var{typed:i,matrix:o,equalScalar:t,zeros:r,DenseMatrix:s}=u,p=or({typed:i}),d=F({typed:i,equalScalar:t}),v=Jf({typed:i,equalScalar:t}),m=Nt({typed:i,DenseMatrix:s}),n=oe({typed:i,equalScalar:t}),e=Br({typed:i}),a=Z({typed:i});return i(Im,{"number, number":Fi,"BigNumber, BigNumber":Mc,"SparseMatrix, SparseMatrix":function(c,f){return v(c,f,this,!1)},"SparseMatrix, DenseMatrix":function(c,f){return d(f,c,this,!0)},"DenseMatrix, SparseMatrix":function(c,f){return p(c,f,this,!1)},"DenseMatrix, DenseMatrix":function(c,f){return e(c,f,this)},"Array, Array":function(c,f){return this(o(c),o(f)).valueOf()},"Array, Matrix":function(c,f){return this(o(c),f)},"Matrix, Array":function(c,f){return this(c,o(f))},"SparseMatrix, number | BigNumber":function(c,f){return t(f,0)?c.clone():n(c,f,this,!1)},"DenseMatrix, number | BigNumber":function(c,f){return t(f,0)?c.clone():a(c,f,this,!1)},"number | BigNumber, SparseMatrix":function(c,f){return t(c,0)?r(f.size(),f.storage()):m(f,c,this,!0)},"number | BigNumber, DenseMatrix":function(c,f){return t(c,0)?r(f.size(),f.storage()):a(f,c,this,!0)},"Array, number | BigNumber":function(c,f){return this(o(c),f).valueOf()},"number | BigNumber, Array":function(c,f){return this(c,o(f)).valueOf()}})});function Oa(u){var{DenseMatrix:i}=u;return function(t,r,s){var p=t.size();if(p.length!==2)throw new RangeError("Matrix must be two dimensional (size: "+(0,Jr.WU)(p)+")");var d=p[0],v=p[1];if(d!==v)throw new RangeError("Matrix must be square (size: "+(0,Jr.WU)(p)+")");var m=[];if((0,L.SW)(r)){var n=r.size(),e=r._data;if(n.length===1){if(n[0]!==d)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var a=0;a<d;a++)m[a]=[e[a]];return new i({data:m,size:[d,1],datatype:r._datatype})}if(n.length===2){if(n[0]!==d||n[1]!==1)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");if((0,L.jH)(r)){if(s){m=[];for(var l=0;l<d;l++)m[l]=[e[l][0]];return new i({data:m,size:[d,1],datatype:r._datatype})}return r}if((0,L.sA)(r)){for(var c=0;c<d;c++)m[c]=[0];for(var f=r._values,b=r._index,w=r._ptr,E=w[1],g=w[0];g<E;g++){var S=b[g];m[S][0]=f[g]}return new i({data:m,size:[d,1],datatype:r._datatype})}}throw new RangeError("Dimension mismatch. The right side has to be either 1- or 2-dimensional vector.")}if((0,L.kJ)(r)){var N=(0,ze.aJ)(r);if(N.length===1){if(N[0]!==d)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var h=0;h<d;h++)m[h]=[r[h]];return new i({data:m,size:[d,1]})}if(N.length===2){if(N[0]!==d||N[1]!==1)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var C=0;C<d;C++)m[C]=[r[C][0]];return new i({data:m,size:[d,1]})}throw new RangeError("Dimension mismatch. The right side has to be either 1- or 2-dimensional vector.")}}}var Fm="lsolve",Vd=["typed","matrix","divideScalar","multiplyScalar","subtract","equalScalar","DenseMatrix"],Jd=(0,A.d5)(Fm,Vd,u=>{var{typed:i,matrix:o,divideScalar:t,multiplyScalar:r,subtract:s,equalScalar:p,DenseMatrix:d}=u,v=Oa({DenseMatrix:d});return i(Fm,{"SparseMatrix, Array | Matrix":function(a,l){return n(a,l)},"DenseMatrix, Array | Matrix":function(a,l){return m(a,l)},"Array, Array | Matrix":function(a,l){var c=o(a),f=m(c,l);return f.valueOf()}});function m(e,a){a=v(e,a,!0);for(var l=a._data,c=e._size[0],f=e._size[1],b=[],w=e._data,E=0;E<f;E++){var g=l[E][0]||0,S=void 0;if(p(g,0))S=0;else{var N=w[E][E];if(p(N,0))throw new Error("Linear system cannot be solved since matrix is singular");S=t(g,N);for(var h=E+1;h<c;h++)l[h]=[s(l[h][0]||0,r(S,w[h][E]))]}b[E]=[S]}return new d({data:b,size:[c,1]})}function n(e,a){a=v(e,a,!0);for(var l=a._data,c=e._size[0],f=e._size[1],b=e._values,w=e._index,E=e._ptr,g=[],S=0;S<f;S++){var N=l[S][0]||0;if(p(N,0))g[S]=[0];else{for(var h=0,C=[],O=[],T=E[S],M=E[S+1],P=T;P<M;P++){var z=w[P];z===S?h=b[P]:z>S&&(C.push(b[P]),O.push(z))}if(p(h,0))throw new Error("Linear system cannot be solved since matrix is singular");for(var $=t(N,h),V=0,te=O.length;V<te;V++){var K=O[V];l[K]=[s(l[K][0]||0,r($,C[V]))]}g[S]=[$]}}return new d({data:g,size:[c,1]})}}),zm="matrixFromColumns",Zd=["typed","matrix","flatten","size"],Kd=(0,A.d5)(zm,Zd,u=>{var{typed:i,matrix:o,flatten:t,size:r}=u;return i(zm,{"...Array":function(v){return s(v)},"...Matrix":function(v){return o(s(v.map(m=>m.toArray())))}});function s(d){if(d.length===0)throw new TypeError("At least one column is needed to construct a matrix.");for(var v=p(d[0]),m=[],n=0;n<v;n++)m[n]=[];for(var e of d){var a=p(e);if(a!==v)throw new TypeError("The vectors had different length: "+(v|0)+" \u2260 "+(a|0));for(var l=t(e),c=0;c<v;c++)m[c].push(l[c])}return m}function p(d){var v=r(d);if(v.length===1)return v[0];if(v.length===2){if(v[0]===1)return v[1];if(v[1]===1)return v[0];throw new TypeError("At least one of the arguments is not a vector.")}else throw new TypeError("Only one- or two-dimensional vectors are supported.")}}),Yd=ie(35414),Pm="mode",Xd=["typed","isNaN","isNumeric"],Qd=(0,A.d5)(Pm,Xd,u=>{var{typed:i,isNaN:o,isNumeric:t}=u;return i(Pm,{"Array | Matrix":r,"...":function(p){return r(p)}});function r(s){s=(0,ze.xH)(s.valueOf());var p=s.length;if(p===0)throw new Error("Cannot calculate mode of an empty array");for(var d={},v=[],m=0,n=0;n<s.length;n++){var e=s[n];if(t(e)&&o(e))throw new Error("Cannot calculate mode of an array containing NaN values");e in d||(d[e]=0),d[e]++,d[e]===m?v.push(e):d[e]>m&&(m=d[e],v=[e])}return v}}),Lm="nthRoots",jd=["config","typed","divideScalar","Complex"],eh=(0,A.d5)(Lm,jd,u=>{var{typed:i,config:o,divideScalar:t,Complex:r}=u,s=[function(v){return new r(v,0)},function(v){return new r(0,v)},function(v){return new r(-v,0)},function(v){return new r(0,-v)}];function p(d,v){if(v<0)throw new Error("Root must be greater than zero");if(v===0)throw new Error("Root must be non-zero");if(v%1!==0)throw new Error("Root must be an integer");if(d===0||d.abs()===0)return[new r(0,0)];var m=typeof d=="number",n;(m||d.re===0||d.im===0)&&(m?n=2*+(d<0):d.im===0?n=2*+(d.re<0):n=2*+(d.im<0)+1);for(var e=d.arg(),a=d.abs(),l=[],c=Math.pow(a,1/v),f=0;f<v;f++){var b=(n+4*f)/v;if(b===Math.round(b)){l.push(s[b%4](c));continue}l.push(new r({r:c,phi:(e+2*Math.PI*f)/v}))}return l}return i(Lm,{Complex:function(v){return p(v,2)},"Complex, number":p})}),rh="ones",th=["typed","config","matrix","BigNumber"],nh=(0,A.d5)(rh,th,u=>{var{typed:i,config:o,matrix:t,BigNumber:r}=u;return i("ones",{"":function(){return o.matrix==="Array"?s([]):s([],"default")},"...number | BigNumber | string":function(m){var n=m[m.length-1];if(typeof n=="string"){var e=m.pop();return s(m,e)}else return o.matrix==="Array"?s(m):s(m,"default")},Array:s,Matrix:function(m){var n=m.storage();return s(m.valueOf(),n)},"Array | Matrix, string":function(m,n){return s(m.valueOf(),n)}});function s(v,m){var n=p(v),e=n?new r(1):1;if(d(v),m){var a=t(m);return v.length>0?a.resize(v,e):a}else{var l=[];return v.length>0?(0,ze.SI)(l,v,e):l}}function p(v){var m=!1;return v.forEach(function(n,e,a){(0,L.l9)(n)&&(m=!0,a[e]=n.toNumber())}),m}function d(v){v.forEach(function(m){if(typeof m!="number"||!(0,le.U)(m)||m<0)throw new Error("Parameters in function ones must be positive integers")})}}),qm="partitionSelect",ah=["typed","isNumeric","isNaN","compare"],ih=(0,A.d5)(qm,ah,u=>{var{typed:i,isNumeric:o,isNaN:t,compare:r}=u,s=r,p=(m,n)=>-r(m,n);return i(qm,{"Array | Matrix, number":function(n,e){return d(n,e,s)},"Array | Matrix, number, string":function(n,e,a){if(a==="asc")return d(n,e,s);if(a==="desc")return d(n,e,p);throw new Error('Compare string must be "asc" or "desc"')},"Array | Matrix, number, function":d});function d(m,n,e){if(!(0,le.U)(n)||n<0)throw new Error("k must be a non-negative integer");if((0,L.SW)(m)){var a=m.size();if(a.length>1)throw new Error("Only one dimensional matrices supported");return v(m.valueOf(),n,e)}if(Array.isArray(m))return v(m,n,e)}function v(m,n,e){if(n>=m.length)throw new Error("k out of bounds");for(var a=0;a<m.length;a++)if(o(m[a])&&t(m[a]))return m[a];for(var l=0,c=m.length-1;l<c;){for(var f=l,b=c,w=m[Math.floor(Math.random()*(c-l+1))+l];f<b;)if(e(m[f],w)>=0){var E=m[b];m[b]=m[f],m[f]=E,--b}else++f;e(m[f],w)>0&&--f,n<=f?c=f:l=f+1}return m[n]}});function ta(u,i,o,t){if(!(this instanceof ta))throw new SyntaxError("Constructor must be called with the new operator");this.fn=u,this.count=i,this.min=o,this.max=t,this.message="Wrong number of arguments in function "+u+" ("+i+" provided, "+o+(t!=null?"-"+t:"")+" expected)",this.stack=new Error().stack}ta.prototype=new Error,ta.prototype.constructor=Error,ta.prototype.name="ArgumentsError",ta.prototype.isArgumentsError=!0;var oh="resize",sh=["config","matrix"],uh=(0,A.d5)(oh,sh,u=>{var{config:i,matrix:o}=u;return function(s,p,d){if(arguments.length!==2&&arguments.length!==3)throw new ta("resize",arguments.length,2,3);if((0,L.SW)(p)&&(p=p.valueOf()),(0,L.l9)(p[0])&&(p=p.map(function(n){return(0,L.l9)(n)?n.toNumber():n})),(0,L.SW)(s))return s.resize(p,d,!0);if(typeof s=="string")return t(s,p,d);var v=Array.isArray(s)?!1:i.matrix!=="Array";if(p.length===0){for(;Array.isArray(s);)s=s[0];return(0,Sr.d9)(s)}else{Array.isArray(s)||(s=[s]),s=(0,Sr.d9)(s);var m=(0,ze.SI)(s,p,d);return v?o(m):m}};function t(r,s,p){if(p!==void 0){if(typeof p!="string"||p.length!==1)throw new TypeError("Single character expected as defaultValue")}else p=" ";if(s.length!==1)throw new pt.m(s.length,1);var d=s[0];if(typeof d!="number"||!(0,le.U)(d))throw new TypeError("Invalid size, must contain positive integers (size: "+(0,Jr.WU)(s)+")");if(r.length>d)return r.substring(0,d);if(r.length<d){for(var v=r,m=0,n=d-r.length;m<n;m++)v+=p;return v}else return r}}),Wm="rightArithShift",ch=["typed","matrix","equalScalar","zeros","DenseMatrix"],lh=(0,A.d5)(Wm,ch,u=>{var{typed:i,matrix:o,equalScalar:t,zeros:r,DenseMatrix:s}=u,p=or({typed:i}),d=F({typed:i,equalScalar:t}),v=Jf({typed:i,equalScalar:t}),m=Nt({typed:i,DenseMatrix:s}),n=oe({typed:i,equalScalar:t}),e=Br({typed:i}),a=Z({typed:i});return i(Wm,{"number, number":zi,"BigNumber, BigNumber":Ac,"SparseMatrix, SparseMatrix":function(c,f){return v(c,f,this,!1)},"SparseMatrix, DenseMatrix":function(c,f){return d(f,c,this,!0)},"DenseMatrix, SparseMatrix":function(c,f){return p(c,f,this,!1)},"DenseMatrix, DenseMatrix":function(c,f){return e(c,f,this)},"Array, Array":function(c,f){return this(o(c),o(f)).valueOf()},"Array, Matrix":function(c,f){return this(o(c),f)},"Matrix, Array":function(c,f){return this(c,o(f))},"SparseMatrix, number | BigNumber":function(c,f){return t(f,0)?c.clone():n(c,f,this,!1)},"DenseMatrix, number | BigNumber":function(c,f){return t(f,0)?c.clone():a(c,f,this,!1)},"number | BigNumber, SparseMatrix":function(c,f){return t(c,0)?r(f.size(),f.storage()):m(f,c,this,!0)},"number | BigNumber, DenseMatrix":function(c,f){return t(c,0)?r(f.size(),f.storage()):a(f,c,this,!0)},"Array, number | BigNumber":function(c,f){return this(o(c),f).valueOf()},"number | BigNumber, Array":function(c,f){return this(c,o(f)).valueOf()}})}),na="Number of decimals in function round must be an integer",Gm="round",fh=["typed","matrix","equalScalar","zeros","BigNumber","DenseMatrix"],mh=(0,A.d5)(Gm,fh,u=>{var{typed:i,matrix:o,equalScalar:t,zeros:r,BigNumber:s,DenseMatrix:p}=u,d=oe({typed:i,equalScalar:t}),v=He({typed:i,DenseMatrix:p}),m=Z({typed:i});return i(Gm,{number:oi,"number, number":oi,"number, BigNumber":function(e,a){if(!a.isInteger())throw new TypeError(na);return new s(e).toDecimalPlaces(a.toNumber())},Complex:function(e){return e.round()},"Complex, number":function(e,a){if(a%1)throw new TypeError(na);return e.round(a)},"Complex, BigNumber":function(e,a){if(!a.isInteger())throw new TypeError(na);var l=a.toNumber();return e.round(l)},BigNumber:function(e){return e.toDecimalPlaces(0)},"BigNumber, BigNumber":function(e,a){if(!a.isInteger())throw new TypeError(na);return e.toDecimalPlaces(a.toNumber())},Fraction:function(e){return e.round()},"Fraction, number":function(e,a){if(a%1)throw new TypeError(na);return e.round(a)},"Fraction, BigNumber":function(e,a){if(!a.isInteger())throw new TypeError(na);return e.round(a.toNumber())},"Array | Matrix":function(e){return(0,Mr.Fh)(e,this,!0)},"SparseMatrix, number | BigNumber":function(e,a){return d(e,a,this,!1)},"DenseMatrix, number | BigNumber":function(e,a){return m(e,a,this,!1)},"Array, number | BigNumber":function(e,a){return m(o(e),a,this,!1).valueOf()},"number | Complex | BigNumber | Fraction, SparseMatrix":function(e,a){return t(e,0)?r(a.size(),a.storage()):v(a,e,this,!0)},"number | Complex | BigNumber | Fraction, DenseMatrix":function(e,a){return t(e,0)?r(a.size(),a.storage()):m(a,e,this,!0)},"number | Complex | BigNumber | Fraction, Array":function(e,a){return m(o(a),e,this,!0).valueOf()}})}),Hm="smallerEq",vh=["typed","config","matrix","DenseMatrix"],ph=(0,A.d5)(Hm,vh,u=>{var{typed:i,config:o,matrix:t,DenseMatrix:r}=u,s=_({typed:i}),p=Fe({typed:i,DenseMatrix:r}),d=He({typed:i,DenseMatrix:r}),v=Br({typed:i}),m=Z({typed:i});return i(Hm,{"boolean, boolean":function(e,a){return e<=a},"number, number":function(e,a){return e<=a||(0,le.RI)(e,a,o.epsilon)},"BigNumber, BigNumber":function(e,a){return e.lte(a)||$t(e,a,o.epsilon)},"Fraction, Fraction":function(e,a){return e.compare(a)!==1},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")},"Unit, Unit":function(e,a){if(!e.equalBase(a))throw new Error("Cannot compare units with different base");return this(e.value,a.value)},"SparseMatrix, SparseMatrix":function(e,a){return p(e,a,this)},"SparseMatrix, DenseMatrix":function(e,a){return s(a,e,this,!0)},"DenseMatrix, SparseMatrix":function(e,a){return s(e,a,this,!1)},"DenseMatrix, DenseMatrix":function(e,a){return v(e,a,this)},"Array, Array":function(e,a){return this(t(e),t(a)).valueOf()},"Array, Matrix":function(e,a){return this(t(e),a)},"Matrix, Array":function(e,a){return this(e,t(a))},"SparseMatrix, any":function(e,a){return d(e,a,this,!1)},"DenseMatrix, any":function(e,a){return m(e,a,this,!1)},"any, SparseMatrix":function(e,a){return d(a,e,this,!0)},"any, DenseMatrix":function(e,a){return m(a,e,this,!0)},"Array, any":function(e,a){return m(t(e),a,this,!1).valueOf()},"any, Array":function(e,a){return m(t(a),e,this,!0).valueOf()}})}),BN=null,Zf="unequal",dh=["typed","config","equalScalar","matrix","DenseMatrix"],hh=(0,A.d5)(Zf,dh,u=>{var{typed:i,config:o,equalScalar:t,matrix:r,DenseMatrix:s}=u,p=_({typed:i}),d=Fe({typed:i,DenseMatrix:s}),v=He({typed:i,DenseMatrix:s}),m=Br({typed:i}),n=Z({typed:i});return i("unequal",{"any, any":function(l,c){return l===null?c!==null:c===null?l!==null:l===void 0?c!==void 0:c===void 0?l!==void 0:e(l,c)},"SparseMatrix, SparseMatrix":function(l,c){return d(l,c,e)},"SparseMatrix, DenseMatrix":function(l,c){return p(c,l,e,!0)},"DenseMatrix, SparseMatrix":function(l,c){return p(l,c,e,!1)},"DenseMatrix, DenseMatrix":function(l,c){return m(l,c,e)},"Array, Array":function(l,c){return this(r(l),r(c)).valueOf()},"Array, Matrix":function(l,c){return this(r(l),c)},"Matrix, Array":function(l,c){return this(l,r(c))},"SparseMatrix, any":function(l,c){return v(l,c,e,!1)},"DenseMatrix, any":function(l,c){return n(l,c,e,!1)},"any, SparseMatrix":function(l,c){return v(c,l,e,!0)},"any, DenseMatrix":function(l,c){return n(c,l,e,!0)},"Array, any":function(l,c){return n(r(l),c,e,!1).valueOf()},"any, Array":function(l,c){return n(r(c),l,e,!0).valueOf()}});function e(a,l){return!t(a,l)}}),TN=(0,A.d5)(Zf,["typed","equalScalar"],u=>{var{typed:i,equalScalar:o}=u;return i(Zf,{"any, any":function(r,s){return r===null?s!==null:s===null?r!==null:r===void 0?s!==void 0:s===void 0?r!==void 0:!o(r,s)}})}),km="usolve",gh=["typed","matrix","divideScalar","multiplyScalar","subtract","equalScalar","DenseMatrix"],yh=(0,A.d5)(km,gh,u=>{var{typed:i,matrix:o,divideScalar:t,multiplyScalar:r,subtract:s,equalScalar:p,DenseMatrix:d}=u,v=Oa({DenseMatrix:d});return i(km,{"SparseMatrix, Array | Matrix":function(a,l){return n(a,l)},"DenseMatrix, Array | Matrix":function(a,l){return m(a,l)},"Array, Array | Matrix":function(a,l){var c=o(a),f=m(c,l);return f.valueOf()}});function m(e,a){a=v(e,a,!0);for(var l=a._data,c=e._size[0],f=e._size[1],b=[],w=e._data,E=f-1;E>=0;E--){var g=l[E][0]||0,S=void 0;if(p(g,0))S=0;else{var N=w[E][E];if(p(N,0))throw new Error("Linear system cannot be solved since matrix is singular");S=t(g,N);for(var h=E-1;h>=0;h--)l[h]=[s(l[h][0]||0,r(S,w[h][E]))]}b[E]=[S]}return new d({data:b,size:[c,1]})}function n(e,a){a=v(e,a,!0);for(var l=a._data,c=e._size[0],f=e._size[1],b=e._values,w=e._index,E=e._ptr,g=[],S=f-1;S>=0;S--){var N=l[S][0]||0;if(p(N,0))g[S]=[0];else{for(var h=0,C=[],O=[],T=E[S],M=E[S+1],P=M-1;P>=T;P--){var z=w[P];z===S?h=b[P]:z<S&&(C.push(b[P]),O.push(z))}if(p(h,0))throw new Error("Linear system cannot be solved since matrix is singular");for(var $=t(N,h),V=0,te=O.length;V<te;V++){var K=O[V];l[K]=[s(l[K][0],r($,C[V]))]}g[S]=[$]}}return new d({data:g,size:[c,1]})}}),$m="xor",xh=["typed","matrix","DenseMatrix"],bh=(0,A.d5)($m,xh,u=>{var{typed:i,matrix:o,DenseMatrix:t}=u,r=_({typed:i}),s=Fe({typed:i,DenseMatrix:t}),p=He({typed:i,DenseMatrix:t}),d=Br({typed:i}),v=Z({typed:i});return i($m,{"number, number":Na,"Complex, Complex":function(n,e){return(n.re!==0||n.im!==0)!=(e.re!==0||e.im!==0)},"BigNumber, BigNumber":function(n,e){return(!n.isZero()&&!n.isNaN())!=(!e.isZero()&&!e.isNaN())},"Unit, Unit":function(n,e){return this(n.value||0,e.value||0)},"SparseMatrix, SparseMatrix":function(n,e){return s(n,e,this)},"SparseMatrix, DenseMatrix":function(n,e){return r(e,n,this,!0)},"DenseMatrix, SparseMatrix":function(n,e){return r(n,e,this,!1)},"DenseMatrix, DenseMatrix":function(n,e){return d(n,e,this)},"Array, Array":function(n,e){return this(o(n),o(e)).valueOf()},"Array, Matrix":function(n,e){return this(o(n),e)},"Matrix, Array":function(n,e){return this(n,o(e))},"SparseMatrix, any":function(n,e){return p(n,e,this,!1)},"DenseMatrix, any":function(n,e){return v(n,e,this,!1)},"any, SparseMatrix":function(n,e){return p(e,n,this,!0)},"any, DenseMatrix":function(n,e){return v(e,n,this,!0)},"Array, any":function(n,e){return v(o(n),e,this,!1).valueOf()},"any, Array":function(n,e){return v(o(e),n,this,!0).valueOf()}})}),Vm="add",Nh=["typed","matrix","addScalar","equalScalar","DenseMatrix","SparseMatrix"],wh=(0,A.d5)(Vm,Nh,u=>{var{typed:i,matrix:o,addScalar:t,equalScalar:r,DenseMatrix:s,SparseMatrix:p}=u,d=or({typed:i}),v=Vf({typed:i,equalScalar:r}),m=Nt({typed:i,DenseMatrix:s}),n=Br({typed:i}),e=Z({typed:i});return i(Vm,(0,Sr.l7)({"DenseMatrix, DenseMatrix":function(l,c){return n(l,c,t)},"DenseMatrix, SparseMatrix":function(l,c){return d(l,c,t,!1)},"SparseMatrix, DenseMatrix":function(l,c){return d(c,l,t,!0)},"SparseMatrix, SparseMatrix":function(l,c){return v(l,c,t)},"Array, Array":function(l,c){return this(o(l),o(c)).valueOf()},"Array, Matrix":function(l,c){return this(o(l),c)},"Matrix, Array":function(l,c){return this(l,o(c))},"DenseMatrix, any":function(l,c){return e(l,c,t,!1)},"SparseMatrix, any":function(l,c){return m(l,c,t,!1)},"any, DenseMatrix":function(l,c){return e(c,l,t,!0)},"any, SparseMatrix":function(l,c){return m(c,l,t,!0)},"Array, any":function(l,c){return e(o(l),c,t,!1).valueOf()},"any, Array":function(l,c){return e(o(c),l,t,!0).valueOf()},"any, any":t,"any, any, ...any":function(l,c,f){for(var b=this(l,c),w=0;w<f.length;w++)b=this(b,f[w]);return b}},t.signatures))}),Mh="algorithm09",Ah=["typed","equalScalar"],Jm=(0,A.d5)(Mh,Ah,u=>{var{typed:i,equalScalar:o}=u;return function(r,s,p){var d=r._values,v=r._index,m=r._ptr,n=r._size,e=r._datatype,a=s._values,l=s._index,c=s._ptr,f=s._size,b=s._datatype;if(n.length!==f.length)throw new pt.m(n.length,f.length);if(n[0]!==f[0]||n[1]!==f[1])throw new RangeError("Dimension mismatch. Matrix A ("+n+") must match Matrix B ("+f+")");var w=n[0],E=n[1],g,S=o,N=0,h=p;typeof e=="string"&&e===b&&(g=e,S=i.find(o,[g,g]),N=i.convert(0,g),h=i.find(p,[g,g]));var C=d&&a?[]:void 0,O=[],T=[],M=C?[]:void 0,P=[],z,$,V,te,K;for($=0;$<E;$++){T[$]=O.length;var I=$+1;if(M)for(te=c[$],K=c[$+1],V=te;V<K;V++)z=l[V],P[z]=I,M[z]=a[V];for(te=m[$],K=m[$+1],V=te;V<K;V++)if(z=v[V],M){var ve=P[z]===I?M[z]:N,B=h(d[V],ve);S(B,N)||(O.push(z),C.push(B))}else O.push(z)}return T[E]=O.length,r.createSparseMatrix({values:C,index:O,ptr:T,size:[w,E],datatype:g})}}),Zm="atan2",Sh=["typed","matrix","equalScalar","BigNumber","DenseMatrix"],_h=(0,A.d5)(Zm,Sh,u=>{var{typed:i,matrix:o,equalScalar:t,BigNumber:r,DenseMatrix:s}=u,p=F({typed:i,equalScalar:t}),d=_({typed:i}),v=Jm({typed:i,equalScalar:t}),m=oe({typed:i,equalScalar:t}),n=He({typed:i,DenseMatrix:s}),e=Br({typed:i}),a=Z({typed:i});return i(Zm,{"number, number":Math.atan2,"BigNumber, BigNumber":function(c,f){return r.atan2(c,f)},"SparseMatrix, SparseMatrix":function(c,f){return v(c,f,this,!1)},"SparseMatrix, DenseMatrix":function(c,f){return p(f,c,this,!0)},"DenseMatrix, SparseMatrix":function(c,f){return d(c,f,this,!1)},"DenseMatrix, DenseMatrix":function(c,f){return e(c,f,this)},"Array, Array":function(c,f){return this(o(c),o(f)).valueOf()},"Array, Matrix":function(c,f){return this(o(c),f)},"Matrix, Array":function(c,f){return this(c,o(f))},"SparseMatrix, number | BigNumber":function(c,f){return m(c,f,this,!1)},"DenseMatrix, number | BigNumber":function(c,f){return a(c,f,this,!1)},"number | BigNumber, SparseMatrix":function(c,f){return n(f,c,this,!0)},"number | BigNumber, DenseMatrix":function(c,f){return a(f,c,this,!0)},"Array, number | BigNumber":function(c,f){return a(o(c),f,this,!1).valueOf()},"number | BigNumber, Array":function(c,f){return a(o(f),c,this,!0).valueOf()}})}),Km="bitOr",Eh=["typed","matrix","equalScalar","DenseMatrix"],Ch=(0,A.d5)(Km,Eh,u=>{var{typed:i,matrix:o,equalScalar:t,DenseMatrix:r}=u,s=or({typed:i}),p=Vf({typed:i,equalScalar:t}),d=Nt({typed:i,DenseMatrix:r}),v=Br({typed:i}),m=Z({typed:i});return i(Km,{"number, number":Ri,"BigNumber, BigNumber":Nc,"SparseMatrix, SparseMatrix":function(e,a){return p(e,a,this)},"SparseMatrix, DenseMatrix":function(e,a){return s(a,e,this,!0)},"DenseMatrix, SparseMatrix":function(e,a){return s(e,a,this,!1)},"DenseMatrix, DenseMatrix":function(e,a){return v(e,a,this)},"Array, Array":function(e,a){return this(o(e),o(a)).valueOf()},"Array, Matrix":function(e,a){return this(o(e),a)},"Matrix, Array":function(e,a){return this(e,o(a))},"SparseMatrix, any":function(e,a){return d(e,a,this,!1)},"DenseMatrix, any":function(e,a){return m(e,a,this,!1)},"any, SparseMatrix":function(e,a){return d(a,e,this,!0)},"any, DenseMatrix":function(e,a){return m(a,e,this,!0)},"Array, any":function(e,a){return m(o(e),a,this,!1).valueOf()},"any, Array":function(e,a){return m(o(a),e,this,!0).valueOf()}})}),Ym="catalan",Oh=["typed","addScalar","divideScalar","multiplyScalar","combinations","isNegative","isInteger"],Dh=(0,A.d5)(Ym,Oh,u=>{var{typed:i,addScalar:o,divideScalar:t,multiplyScalar:r,combinations:s,isNegative:p,isInteger:d}=u;return i(Ym,{"number | BigNumber":function(m){if(!d(m)||p(m))throw new TypeError("Non-negative integer value expected in function catalan");return t(s(r(m,2),m),o(m,1))}})}),aa=ie(63228),Xm="compareNatural",Bh=["typed","compare"],Th=(0,A.d5)(Xm,Bh,u=>{var{typed:i,compare:o}=u,t=o.signatures["boolean,boolean"];return i(Xm,{"any, any":function(v,m){var n=(0,L.kM)(v),e=(0,L.kM)(m),a;if((n==="number"||n==="BigNumber"||n==="Fraction")&&(e==="number"||e==="BigNumber"||e==="Fraction"))return a=o(v,m),a.toString()!=="0"?a>0?1:-1:aa(n,e);if(n==="Array"||n==="Matrix"||e==="Array"||e==="Matrix")return a=r(this,v,m),a!==0?a:aa(n,e);if(n!==e)return aa(n,e);if(n==="Complex")return Uh(v,m);if(n==="Unit")return v.equalBase(m)?this(v.value,m.value):s(this,v.formatUnits(),m.formatUnits());if(n==="boolean")return t(v,m);if(n==="string")return aa(v,m);if(n==="Object")return p(this,v,m);if(n==="null"||n==="undefined")return 0;throw new TypeError('Unsupported type of value "'+n+'"')}});function r(d,v,m){return(0,L.sA)(v)&&(0,L.sA)(m)?s(d,v.toJSON().values,m.toJSON().values):(0,L.sA)(v)?r(d,v.toArray(),m):(0,L.sA)(m)?r(d,v,m.toArray()):(0,L.jH)(v)?r(d,v.toJSON().data,m):(0,L.jH)(m)?r(d,v,m.toJSON().data):Array.isArray(v)?Array.isArray(m)?s(d,v,m):r(d,v,[m]):r(d,[v],m)}function s(d,v,m){for(var n=0,e=Math.min(v.length,m.length);n<e;n++){var a=d(v[n],m[n]);if(a!==0)return a}return v.length>m.length?1:v.length<m.length?-1:0}function p(d,v,m){var n=Object.keys(v),e=Object.keys(m);n.sort(aa),e.sort(aa);var a=s(d,n,e);if(a!==0)return a;for(var l=0;l<n.length;l++){var c=d(v[n[l]],m[e[l]]);if(c!==0)return c}return 0}});function Uh(u,i){return u.re>i.re?1:u.re<i.re?-1:u.im>i.im?1:u.im<i.im?-1:0}var Rh=ie(21821),Qm="deepEqual",Ih=["typed","equal"],Fh=(0,A.d5)(Qm,Ih,u=>{var{typed:i,equal:o}=u;return i(Qm,{"any, any":function(s,p){return t(s.valueOf(),p.valueOf())}});function t(r,s){if(Array.isArray(r))if(Array.isArray(s)){var p=r.length;if(p!==s.length)return!1;for(var d=0;d<p;d++)if(!t(r[d],s[d]))return!1;return!0}else return!1;else return Array.isArray(s)?!1:o(r,s)}}),zh=ie(88800),jm="dot",Ph=["typed","addScalar","multiplyScalar","conj","size"],Lh=(0,A.d5)(jm,Ph,u=>{var{typed:i,addScalar:o,multiplyScalar:t,conj:r,size:s}=u;return i(jm,{"Array | DenseMatrix, Array | DenseMatrix":d,"SparseMatrix, SparseMatrix":v});function p(n,e){var a=m(n),l=m(e),c,f;if(a.length===1)c=a[0];else if(a.length===2&&a[1]===1)c=a[0];else throw new RangeError("Expected a column vector, instead got a matrix of size ("+a.join(", ")+")");if(l.length===1)f=l[0];else if(l.length===2&&l[1]===1)f=l[0];else throw new RangeError("Expected a column vector, instead got a matrix of size ("+l.join(", ")+")");if(c!==f)throw new RangeError("Vectors must have equal length ("+c+" != "+f+")");if(c===0)throw new RangeError("Cannot calculate the dot product of empty vectors");return c}function d(n,e){var a=p(n,e),l=(0,L.SW)(n)?n._data:n,c=(0,L.SW)(n)?n._datatype:void 0,f=(0,L.SW)(e)?e._data:e,b=(0,L.SW)(e)?e._datatype:void 0,w=m(n).length===2,E=m(e).length===2,g=o,S=t;if(c&&b&&c===b&&typeof c=="string"){var N=c;g=i.find(o,[N,N]),S=i.find(t,[N,N])}if(!w&&!E){for(var h=S(r(l[0]),f[0]),C=1;C<a;C++)h=g(h,S(r(l[C]),f[C]));return h}if(!w&&E){for(var O=S(r(l[0]),f[0][0]),T=1;T<a;T++)O=g(O,S(r(l[T]),f[T][0]));return O}if(w&&!E){for(var M=S(r(l[0][0]),f[0]),P=1;P<a;P++)M=g(M,S(r(l[P][0]),f[P]));return M}if(w&&E){for(var z=S(r(l[0][0]),f[0][0]),$=1;$<a;$++)z=g(z,S(r(l[$][0]),f[$][0]));return z}}function v(n,e){p(n,e);for(var a=n._index,l=n._values,c=e._index,f=e._values,b=0,w=o,E=t,g=0,S=0;g<a.length&&S<c.length;){var N=a[g],h=c[S];if(N<h){g++;continue}if(N>h){S++;continue}N===h&&(b=w(b,E(l[g],f[S])),g++,S++)}return b}function m(n){return(0,L.SW)(n)?n.size():s(n)}}),ev="equalText",qh=["typed","compareText","isZero"],Wh=(0,A.d5)(ev,qh,u=>{var{typed:i,compareText:o,isZero:t}=u;return i(ev,{"any, any":function(s,p){return t(o(s,p))}})}),Kf="floor",Gh=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],Hh=(0,A.d5)(Kf,["typed","config","round"],u=>{var{typed:i,config:o,round:t}=u;return i(Kf,{number:function(s){return(0,le.RI)(s,t(s),o.epsilon)?t(s):Math.floor(s)},"number, number":function(s,p){if((0,le.RI)(s,t(s,p),o.epsilon))return t(s,p);var[d,v]="".concat(s,"e").split("e"),m=Math.floor(Number("".concat(d,"e").concat(Number(v)+p)));return[d,v]="".concat(m,"e").split("e"),Number("".concat(d,"e").concat(Number(v)-p))}})}),kh=(0,A.d5)(Kf,Gh,u=>{var{typed:i,config:o,round:t,matrix:r,equalScalar:s,zeros:p,DenseMatrix:d}=u,v=oe({typed:i,equalScalar:s}),m=He({typed:i,DenseMatrix:d}),n=Z({typed:i}),e=Hh({typed:i,config:o,round:t});return i("floor",{number:e.signatures.number,"number,number":e.signatures["number,number"],Complex:function(l){return l.floor()},"Complex, number":function(l,c){return l.floor(c)},"Complex, BigNumber":function(l,c){return l.floor(c.toNumber())},BigNumber:function(l){return $t(l,t(l),o.epsilon)?t(l):l.floor()},"BigNumber, BigNumber":function(l,c){return $t(l,t(l,c),o.epsilon)?t(l,c):l.toDecimalPlaces(c.toNumber(),cr.Z.ROUND_FLOOR)},Fraction:function(l){return l.floor()},"Fraction, number":function(l,c){return l.floor(c)},"Fraction, BigNumber":function(l,c){return l.floor(c.toNumber())},"Array | Matrix":function(l){return(0,Mr.Fh)(l,this,!0)},"Array, number | BigNumber":function(l,c){return(0,Mr.Fh)(l,f=>this(f,c),!0)},"SparseMatrix, number | BigNumber":function(l,c){return v(l,c,this,!1)},"DenseMatrix, number | BigNumber":function(l,c){return n(l,c,this,!1)},"number | Complex | Fraction | BigNumber, Array":function(l,c){return n(r(c),l,this,!0).valueOf()},"number | Complex | Fraction | BigNumber, Matrix":function(l,c){return s(l,0)?p(c.size(),c.storage()):c.storage()==="dense"?n(c,l,this,!0):m(c,l,this,!0)}})}),rv="identity",$h=["typed","config","matrix","BigNumber","DenseMatrix","SparseMatrix"],Vh=(0,A.d5)(rv,$h,u=>{var{typed:i,config:o,matrix:t,BigNumber:r,DenseMatrix:s,SparseMatrix:p}=u;return i(rv,{"":function(){return o.matrix==="Matrix"?t([]):[]},string:function(n){return t(n)},"number | BigNumber":function(n){return v(n,n,o.matrix==="Matrix"?"dense":void 0)},"number | BigNumber, string":function(n,e){return v(n,n,e)},"number | BigNumber, number | BigNumber":function(n,e){return v(n,e,o.matrix==="Matrix"?"dense":void 0)},"number | BigNumber, number | BigNumber, string":function(n,e,a){return v(n,e,a)},Array:function(n){return d(n)},"Array, string":function(n,e){return d(n,e)},Matrix:function(n){return d(n.valueOf(),n.storage())},"Matrix, string":function(n,e){return d(n.valueOf(),e)}});function d(m,n){switch(m.length){case 0:return n?t(n):[];case 1:return v(m[0],m[0],n);case 2:return v(m[0],m[1],n);default:throw new Error("Vector containing two values expected")}}function v(m,n,e){var a=(0,L.l9)(m)||(0,L.l9)(n)?r:null;if((0,L.l9)(m)&&(m=m.toNumber()),(0,L.l9)(n)&&(n=n.toNumber()),!(0,le.U)(m)||m<1)throw new Error("Parameters in function identity must be positive integers");if(!(0,le.U)(n)||n<1)throw new Error("Parameters in function identity must be positive integers");var l=a?new r(1):1,c=a?new a(0):0,f=[m,n];if(e){if(e==="sparse")return p.diagonal(f,l,0,c);if(e==="dense")return s.diagonal(f,l,0,c);throw new TypeError('Unknown matrix type "'.concat(e,'"'))}for(var b=(0,ze.SI)([],f,c),w=m<n?m:n,E=0;E<w;E++)b[E][E]=l;return b}}),tv="invmod",Jh=["typed","config","BigNumber","xgcd","equal","smaller","mod","add","isInteger"],Zh=(0,A.d5)(tv,Jh,u=>{var{typed:i,config:o,BigNumber:t,xgcd:r,equal:s,smaller:p,mod:d,add:v,isInteger:m}=u;return i(tv,{"number, number":n,"BigNumber, BigNumber":n});function n(e,a){if(!m(e)||!m(a))throw new Error("Parameters in function invmod must be integer numbers");if(e=d(e,a),s(a,0))throw new Error("Divisor must be non zero");var l=r(e,a);l=l.valueOf();var[c,f]=l;return s(c,t(1))?(f=d(f,a),p(f,t(0))&&(f=v(f,a)),f):NaN}}),nv="larger",Kh=["typed","config","matrix","DenseMatrix"],Yh=(0,A.d5)(nv,Kh,u=>{var{typed:i,config:o,matrix:t,DenseMatrix:r}=u,s=_({typed:i}),p=Fe({typed:i,DenseMatrix:r}),d=He({typed:i,DenseMatrix:r}),v=Br({typed:i}),m=Z({typed:i});return i(nv,{"boolean, boolean":function(e,a){return e>a},"number, number":function(e,a){return e>a&&!(0,le.RI)(e,a,o.epsilon)},"BigNumber, BigNumber":function(e,a){return e.gt(a)&&!$t(e,a,o.epsilon)},"Fraction, Fraction":function(e,a){return e.compare(a)===1},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")},"Unit, Unit":function(e,a){if(!e.equalBase(a))throw new Error("Cannot compare units with different base");return this(e.value,a.value)},"SparseMatrix, SparseMatrix":function(e,a){return p(e,a,this)},"SparseMatrix, DenseMatrix":function(e,a){return s(a,e,this,!0)},"DenseMatrix, SparseMatrix":function(e,a){return s(e,a,this,!1)},"DenseMatrix, DenseMatrix":function(e,a){return v(e,a,this)},"Array, Array":function(e,a){return this(t(e),t(a)).valueOf()},"Array, Matrix":function(e,a){return this(t(e),a)},"Matrix, Array":function(e,a){return this(e,t(a))},"SparseMatrix, any":function(e,a){return d(e,a,this,!1)},"DenseMatrix, any":function(e,a){return m(e,a,this,!1)},"any, SparseMatrix":function(e,a){return d(a,e,this,!0)},"any, DenseMatrix":function(e,a){return m(a,e,this,!0)},"Array, any":function(e,a){return m(t(e),a,this,!1).valueOf()},"any, Array":function(e,a){return m(t(a),e,this,!0).valueOf()}})}),UN=null,av="log",Xh=["config","typed","divideScalar","Complex"],Qh=(0,A.d5)(av,Xh,u=>{var{typed:i,config:o,divideScalar:t,Complex:r}=u;return i(av,{number:function(p){return p>=0||o.predictable?Uu(p):new r(p,0).log()},Complex:function(p){return p.log()},BigNumber:function(p){return!p.isNegative()||o.predictable?p.ln():new r(p.toNumber(),0).log()},"Array | Matrix":function(p){return(0,Mr.Fh)(p,this)},"any, any":function(p,d){return t(this(p),this(d))}})}),iv="lsolveAll",jh=["typed","matrix","divideScalar","multiplyScalar","subtract","equalScalar","DenseMatrix"],eg=(0,A.d5)(iv,jh,u=>{var{typed:i,matrix:o,divideScalar:t,multiplyScalar:r,subtract:s,equalScalar:p,DenseMatrix:d}=u,v=Oa({DenseMatrix:d});return i(iv,{"SparseMatrix, Array | Matrix":function(a,l){return n(a,l)},"DenseMatrix, Array | Matrix":function(a,l){return m(a,l)},"Array, Array | Matrix":function(a,l){var c=o(a),f=m(c,l);return f.map(b=>b.valueOf())}});function m(e,a){for(var l=[v(e,a,!0)._data.map(O=>O[0])],c=e._data,f=e._size[0],b=e._size[1],w=0;w<b;w++)for(var E=l.length,g=0;g<E;g++){var S=l[g];if(p(c[w][w],0))if(p(S[w],0)){if(g===0){var h=[...S];h[w]=1;for(var C=w+1;C<b;C++)h[C]=s(h[C],c[C][w]);l.push(h)}}else{if(g===0)return[];l.splice(g,1),g-=1,E-=1}else{S[w]=t(S[w],c[w][w]);for(var N=w+1;N<b;N++)S[N]=s(S[N],r(S[w],c[N][w]))}}return l.map(O=>new d({data:O.map(T=>[T]),size:[f,1]}))}function n(e,a){for(var l=[v(e,a,!0)._data.map(ye=>ye[0])],c=e._size[0],f=e._size[1],b=e._values,w=e._index,E=e._ptr,g=0;g<f;g++)for(var S=l.length,N=0;N<S;N++){for(var h=l[N],C=[],O=[],T=E[g],M=E[g+1],P=0,z=T;z<M;z++){var $=w[z];$===g?P=b[z]:$>g&&(C.push(b[z]),O.push($))}if(p(P,0))if(p(h[g],0)){if(N===0){var I=[...h];I[g]=1;for(var ve=0,B=O.length;ve<B;ve++){var j=O[ve];I[j]=s(I[j],C[ve])}l.push(I)}}else{if(N===0)return[];l.splice(N,1),N-=1,S-=1}else{h[g]=t(h[g],P);for(var V=0,te=O.length;V<te;V++){var K=O[V];h[K]=s(h[K],r(h[g],C[V]))}}}return l.map(ye=>new d({data:ye.map(Ve=>[Ve]),size:[c,1]}))}}),ov="matrixFromRows",rg=["typed","matrix","flatten","size"],tg=(0,A.d5)(ov,rg,u=>{var{typed:i,matrix:o,flatten:t,size:r}=u;return i(ov,{"...Array":function(v){return s(v)},"...Matrix":function(v){return o(s(v.map(m=>m.toArray())))}});function s(d){if(d.length===0)throw new TypeError("At least one row is needed to construct a matrix.");var v=p(d[0]),m=[];for(var n of d){var e=p(n);if(e!==v)throw new TypeError("The vectors had different length: "+(v|0)+" \u2260 "+(e|0));m.push(t(n))}return m}function p(d){var v=r(d);if(v.length===1)return v[0];if(v.length===2){if(v[0]===1)return v[1];if(v[1]===1)return v[0];throw new TypeError("At least one of the arguments is not a vector.")}else throw new TypeError("Only one- or two-dimensional vectors are supported.")}}),sv="multiply",ng=["typed","matrix","addScalar","multiplyScalar","equalScalar","dot"],ag=(0,A.d5)(sv,ng,u=>{var{typed:i,matrix:o,addScalar:t,multiplyScalar:r,equalScalar:s,dot:p}=u,d=oe({typed:i,equalScalar:s}),v=Z({typed:i});function m(N,h){switch(N.length){case 1:switch(h.length){case 1:if(N[0]!==h[0])throw new RangeError("Dimension mismatch in multiplication. Vectors must have the same length");break;case 2:if(N[0]!==h[0])throw new RangeError("Dimension mismatch in multiplication. Vector length ("+N[0]+") must match Matrix rows ("+h[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+h.length+" dimensions)")}break;case 2:switch(h.length){case 1:if(N[1]!==h[0])throw new RangeError("Dimension mismatch in multiplication. Matrix columns ("+N[1]+") must match Vector length ("+h[0]+")");break;case 2:if(N[1]!==h[0])throw new RangeError("Dimension mismatch in multiplication. Matrix A columns ("+N[1]+") must match Matrix B rows ("+h[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+h.length+" dimensions)")}break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix A has "+N.length+" dimensions)")}}function n(N,h,C){if(C===0)throw new Error("Cannot multiply two empty vectors");return p(N,h)}function e(N,h){if(h.storage()!=="dense")throw new Error("Support for SparseMatrix not implemented");return a(N,h)}function a(N,h){var C=N._data,O=N._size,T=N._datatype,M=h._data,P=h._size,z=h._datatype,$=O[0],V=P[1],te,K=t,I=r;T&&z&&T===z&&typeof T=="string"&&(te=T,K=i.find(t,[te,te]),I=i.find(r,[te,te]));for(var ve=[],B=0;B<V;B++){for(var j=I(C[0],M[0][B]),ye=1;ye<$;ye++)j=K(j,I(C[ye],M[ye][B]));ve[B]=j}return N.createDenseMatrix({data:ve,size:[V],datatype:te})}var l=i("_multiplyMatrixVector",{"DenseMatrix, any":f,"SparseMatrix, any":E}),c=i("_multiplyMatrixMatrix",{"DenseMatrix, DenseMatrix":b,"DenseMatrix, SparseMatrix":w,"SparseMatrix, DenseMatrix":g,"SparseMatrix, SparseMatrix":S});function f(N,h){var C=N._data,O=N._size,T=N._datatype,M=h._data,P=h._datatype,z=O[0],$=O[1],V,te=t,K=r;T&&P&&T===P&&typeof T=="string"&&(V=T,te=i.find(t,[V,V]),K=i.find(r,[V,V]));for(var I=[],ve=0;ve<z;ve++){for(var B=C[ve],j=K(B[0],M[0]),ye=1;ye<$;ye++)j=te(j,K(B[ye],M[ye]));I[ve]=j}return N.createDenseMatrix({data:I,size:[z],datatype:V})}function b(N,h){var C=N._data,O=N._size,T=N._datatype,M=h._data,P=h._size,z=h._datatype,$=O[0],V=O[1],te=P[1],K,I=t,ve=r;T&&z&&T===z&&typeof T=="string"&&(K=T,I=i.find(t,[K,K]),ve=i.find(r,[K,K]));for(var B=[],j=0;j<$;j++){var ye=C[j];B[j]=[];for(var Ve=0;Ve<te;Ve++){for(var re=ve(ye[0],M[0][Ve]),be=1;be<V;be++)re=I(re,ve(ye[be],M[be][Ve]));B[j][Ve]=re}}return N.createDenseMatrix({data:B,size:[$,te],datatype:K})}function w(N,h){var C=N._data,O=N._size,T=N._datatype,M=h._values,P=h._index,z=h._ptr,$=h._size,V=h._datatype;if(!M)throw new Error("Cannot multiply Dense Matrix times Pattern only Matrix");var te=O[0],K=$[1],I,ve=t,B=r,j=s,ye=0;T&&V&&T===V&&typeof T=="string"&&(I=T,ve=i.find(t,[I,I]),B=i.find(r,[I,I]),j=i.find(s,[I,I]),ye=i.convert(0,I));for(var Ve=[],re=[],be=[],Ge=h.createSparseMatrix({values:Ve,index:re,ptr:be,size:[te,K],datatype:I}),De=0;De<K;De++){be[De]=re.length;var Ke=z[De],sr=z[De+1];if(sr>Ke)for(var yr=0,We=0;We<te;We++){for(var qr=We+1,zr=void 0,Ar=Ke;Ar<sr;Ar++){var Dr=P[Ar];yr!==qr?(zr=B(C[We][Dr],M[Ar]),yr=qr):zr=ve(zr,B(C[We][Dr],M[Ar]))}yr===qr&&!j(zr,ye)&&(re.push(We),Ve.push(zr))}}return be[K]=re.length,Ge}function E(N,h){var C=N._values,O=N._index,T=N._ptr,M=N._datatype;if(!C)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var P=h._data,z=h._datatype,$=N._size[0],V=h._size[0],te=[],K=[],I=[],ve,B=t,j=r,ye=s,Ve=0;M&&z&&M===z&&typeof M=="string"&&(ve=M,B=i.find(t,[ve,ve]),j=i.find(r,[ve,ve]),ye=i.find(s,[ve,ve]),Ve=i.convert(0,ve));var re=[],be=[];I[0]=0;for(var Ge=0;Ge<V;Ge++){var De=P[Ge];if(!ye(De,Ve))for(var Ke=T[Ge],sr=T[Ge+1],yr=Ke;yr<sr;yr++){var We=O[yr];be[We]?re[We]=B(re[We],j(De,C[yr])):(be[We]=!0,K.push(We),re[We]=j(De,C[yr]))}}for(var qr=K.length,zr=0;zr<qr;zr++){var Ar=K[zr];te[zr]=re[Ar]}return I[1]=K.length,N.createSparseMatrix({values:te,index:K,ptr:I,size:[$,1],datatype:ve})}function g(N,h){var C=N._values,O=N._index,T=N._ptr,M=N._datatype;if(!C)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var P=h._data,z=h._datatype,$=N._size[0],V=h._size[0],te=h._size[1],K,I=t,ve=r,B=s,j=0;M&&z&&M===z&&typeof M=="string"&&(K=M,I=i.find(t,[K,K]),ve=i.find(r,[K,K]),B=i.find(s,[K,K]),j=i.convert(0,K));for(var ye=[],Ve=[],re=[],be=N.createSparseMatrix({values:ye,index:Ve,ptr:re,size:[$,te],datatype:K}),Ge=[],De=[],Ke=0;Ke<te;Ke++){re[Ke]=Ve.length;for(var sr=Ke+1,yr=0;yr<V;yr++){var We=P[yr][Ke];if(!B(We,j))for(var qr=T[yr],zr=T[yr+1],Ar=qr;Ar<zr;Ar++){var Dr=O[Ar];De[Dr]!==sr?(De[Dr]=sr,Ve.push(Dr),Ge[Dr]=ve(We,C[Ar])):Ge[Dr]=I(Ge[Dr],ve(We,C[Ar]))}}for(var H=re[Ke],Y=Ve.length,Ue=H;Ue<Y;Ue++){var Ce=Ve[Ue];ye[Ue]=Ge[Ce]}}return re[te]=Ve.length,be}function S(N,h){var C=N._values,O=N._index,T=N._ptr,M=N._datatype,P=h._values,z=h._index,$=h._ptr,V=h._datatype,te=N._size[0],K=h._size[1],I=C&&P,ve,B=t,j=r;M&&V&&M===V&&typeof M=="string"&&(ve=M,B=i.find(t,[ve,ve]),j=i.find(r,[ve,ve]));for(var ye=I?[]:void 0,Ve=[],re=[],be=N.createSparseMatrix({values:ye,index:Ve,ptr:re,size:[te,K],datatype:ve}),Ge=I?[]:void 0,De=[],Ke,sr,yr,We,qr,zr,Ar,Dr,H=0;H<K;H++){re[H]=Ve.length;var Y=H+1;for(qr=$[H],zr=$[H+1],We=qr;We<zr;We++)if(Dr=z[We],I)for(sr=T[Dr],yr=T[Dr+1],Ke=sr;Ke<yr;Ke++)Ar=O[Ke],De[Ar]!==Y?(De[Ar]=Y,Ve.push(Ar),Ge[Ar]=j(P[We],C[Ke])):Ge[Ar]=B(Ge[Ar],j(P[We],C[Ke]));else for(sr=T[Dr],yr=T[Dr+1],Ke=sr;Ke<yr;Ke++)Ar=O[Ke],De[Ar]!==Y&&(De[Ar]=Y,Ve.push(Ar));if(I)for(var Ue=re[H],Ce=Ve.length,Xe=Ue;Xe<Ce;Xe++){var mr=Ve[Xe];ye[Xe]=Ge[mr]}}return re[K]=Ve.length,be}return i(sv,(0,Sr.l7)({"Array, Array":function(h,C){m((0,ze.aJ)(h),(0,ze.aJ)(C));var O=this(o(h),o(C));return(0,L.SW)(O)?O.valueOf():O},"Matrix, Matrix":function(h,C){var O=h.size(),T=C.size();return m(O,T),O.length===1?T.length===1?n(h,C,O[0]):e(h,C):T.length===1?l(h,C):c(h,C)},"Matrix, Array":function(h,C){return this(h,o(C))},"Array, Matrix":function(h,C){return this(o(h,C.storage()),C)},"SparseMatrix, any":function(h,C){return d(h,C,r,!1)},"DenseMatrix, any":function(h,C){return v(h,C,r,!1)},"any, SparseMatrix":function(h,C){return d(C,h,r,!0)},"any, DenseMatrix":function(h,C){return v(C,h,r,!0)},"Array, any":function(h,C){return v(o(h),C,r,!1).valueOf()},"any, Array":function(h,C){return v(o(C),h,r,!0).valueOf()},"any, any":r,"any, any, ...any":function(h,C,O){for(var T=this(h,C),M=0;M<O.length;M++)T=this(T,O[M]);return T}},r.signatures))}),vs=ie(87462),uv="qr",ig=["typed","matrix","zeros","identity","isZero","equal","sign","sqrt","conj","unaryMinus","addScalar","divideScalar","multiplyScalar","subtract","complex"],og=(0,A.d5)(uv,ig,u=>{var{typed:i,matrix:o,zeros:t,identity:r,isZero:s,equal:p,sign:d,sqrt:v,conj:m,unaryMinus:n,addScalar:e,divideScalar:a,multiplyScalar:l,subtract:c,complex:f}=u;return(0,vs.Z)(i(uv,{DenseMatrix:function(S){return w(S)},SparseMatrix:function(S){return E(S)},Array:function(S){var N=o(S),h=w(N);return{Q:h.Q.valueOf(),R:h.R.valueOf()}}}),{_denseQRimpl:b});function b(g){var S=g._size[0],N=g._size[1],h=r([S],"dense"),C=h._data,O=g.clone(),T=O._data,M,P,z,$=t([S],"");for(z=0;z<Math.min(N,S);++z){var V=T[z][z],te=n(p(V,0)?1:d(V)),K=m(te),I=0;for(M=z;M<S;M++)I=e(I,l(T[M][z],m(T[M][z])));var ve=l(te,v(I));if(!s(ve)){var B=c(V,ve);for($[z]=1,M=z+1;M<S;M++)$[M]=a(T[M][z],B);var j=n(m(a(B,ve))),ye=void 0;for(P=z;P<N;P++){for(ye=0,M=z;M<S;M++)ye=e(ye,l(m($[M]),T[M][P]));for(ye=l(ye,j),M=z;M<S;M++)T[M][P]=l(c(T[M][P],l($[M],ye)),K)}for(M=0;M<S;M++){for(ye=0,P=z;P<S;P++)ye=e(ye,l(C[M][P],$[P]));for(ye=l(ye,j),P=z;P<S;++P)C[M][P]=a(c(C[M][P],l(ye,m($[P]))),K)}}}return{Q:h,R:O,toString:function(){return"Q: "+this.Q.toString()+`
44
- R: `+this.R.toString()}}}function w(g){var S=b(g),N=S.R._data;if(g._data.length>0)for(var h=N[0][0].type==="Complex"?f(0):0,C=0;C<N.length;++C)for(var O=0;O<C&&O<(N[0]||[]).length;++O)N[C][O]=h;return S}function E(g){throw new Error("qr not implemented for sparse matrices yet")}}),sg=ie(39666),cv="rightLogShift",ug=["typed","matrix","equalScalar","zeros","DenseMatrix"],cg=(0,A.d5)(cv,ug,u=>{var{typed:i,matrix:o,equalScalar:t,zeros:r,DenseMatrix:s}=u,p=or({typed:i}),d=F({typed:i,equalScalar:t}),v=Jf({typed:i,equalScalar:t}),m=Nt({typed:i,DenseMatrix:s}),n=oe({typed:i,equalScalar:t}),e=Br({typed:i}),a=Z({typed:i});return i(cv,{"number, number":Pi,"SparseMatrix, SparseMatrix":function(c,f){return v(c,f,this,!1)},"SparseMatrix, DenseMatrix":function(c,f){return d(f,c,this,!0)},"DenseMatrix, SparseMatrix":function(c,f){return p(c,f,this,!1)},"DenseMatrix, DenseMatrix":function(c,f){return e(c,f,this)},"Array, Array":function(c,f){return this(o(c),o(f)).valueOf()},"Array, Matrix":function(c,f){return this(o(c),f)},"Matrix, Array":function(c,f){return this(c,o(f))},"SparseMatrix, number | BigNumber":function(c,f){return t(f,0)?c.clone():n(c,f,this,!1)},"DenseMatrix, number | BigNumber":function(c,f){return t(f,0)?c.clone():a(c,f,this,!1)},"number | BigNumber, SparseMatrix":function(c,f){return t(c,0)?r(f.size(),f.storage()):m(f,c,this,!0)},"number | BigNumber, DenseMatrix":function(c,f){return t(c,0)?r(f.size(),f.storage()):a(f,c,this,!0)},"Array, number | BigNumber":function(c,f){return this(o(c),f).valueOf()},"number | BigNumber, Array":function(c,f){return this(c,o(f)).valueOf()}})}),lv="setSize",lg=["typed","compareNatural"],fg=(0,A.d5)(lv,lg,u=>{var{typed:i,compareNatural:o}=u;return i(lv,{"Array | Matrix":function(r){return Array.isArray(r)?(0,ze.xH)(r).length:(0,ze.xH)(r.toArray()).length},"Array | Matrix, boolean":function(r,s){if(s===!1||r.length===0)return Array.isArray(r)?(0,ze.xH)(r).length:(0,ze.xH)(r.toArray()).length;for(var p=(0,ze.xH)(Array.isArray(r)?r:r.toArray()).sort(o),d=1,v=1;v<p.length;v++)o(p[v],p[v-1])!==0&&d++;return d}})});function mg(u,i,o,t){for(var r=u._values,s=u._index,p=u._ptr,d=u._size,v=u._datatype,m=d[0],n=d[1],e=t&&u._values?[]:null,a=[],l=[],c=0,f=0;f<n;f++){l[f]=c;for(var b=o?o[f]:f,w=p[b],E=p[b+1],g=w;g<E;g++){var S=i?i[s[g]]:s[g];a[c]=S,e&&(e[c]=r[g]),c++}}return l[n]=c,u.createSparseMatrix({values:e,index:a,ptr:l,size:[m,n],datatype:v})}function fv(u,i,o,t,r,s,p){var d=0;for(o[p]=u;d>=0;){var v=o[p+d],m=o[t+v];m===-1?(d--,s[i++]=v):(o[t+v]=o[r+m],++d,o[p+d]=m)}return i}function vg(u,i){if(!u)return null;var o=0,t,r=[],s=[],p=0,d=i,v=2*i;for(t=0;t<i;t++)s[p+t]=-1;for(t=i-1;t>=0;t--)u[t]!==-1&&(s[d+t]=s[p+u[t]],s[p+u[t]]=t);for(t=0;t<i;t++)u[t]===-1&&(o=fv(t,o,s,p,d,r,v));return r}function pg(u,i){if(!u)return null;var o=u._index,t=u._ptr,r=u._size,s=r[0],p=r[1],d=[],v=[],m=0,n=p,e,a;if(i)for(e=0;e<s;e++)v[n+e]=-1;for(var l=0;l<p;l++){d[l]=-1,v[m+l]=-1;for(var c=t[l],f=t[l+1],b=c;b<f;b++){var w=o[b];for(e=i?v[n+w]:w;e!==-1&&e<l;e=a)a=v[m+e],v[m+e]=l,a===-1&&(d[e]=l);i&&(v[n+w]=l)}}return d}function dg(u,i,o){for(var t=u._values,r=u._index,s=u._ptr,p=u._size,d=p[1],v=0,m=0;m<d;m++){var n=s[m];for(s[m]=v;n<s[m+1];n++)i(r[n],m,t?t[n]:1,o)&&(r[v]=r[n],t&&(t[v]=t[n]),v++)}return s[d]=v,r.splice(v,r.length-v),t&&t.splice(v,t.length-v),v}function Sn(u){return-u-2}var hg="csAmd",gg=["add","multiply","transpose"],yg=(0,A.d5)(hg,gg,u=>{var{add:i,multiply:o,transpose:t}=u;return function(n,e){if(!e||n<=0||n>3)return null;var a=e._size,l=a[0],c=a[1],f=0,b=Math.max(16,10*Math.sqrt(c));b=Math.min(c-2,b);var w=r(n,e,l,c,b);dg(w,v,null);for(var E=w._index,g=w._ptr,S=g[c],N=[],h=[],C=0,O=c+1,T=2*(c+1),M=3*(c+1),P=4*(c+1),z=5*(c+1),$=6*(c+1),V=7*(c+1),te=N,K=s(c,g,h,C,M,te,T,V,O,$,P,z),I=p(c,g,h,z,P,$,b,O,M,te,T),ve=0,B,j,ye,Ve,re,be,Ge,De,Ke,sr,yr,We,qr,zr,Ar,Dr;I<c;){for(ye=-1;ve<c&&(ye=h[M+ve])===-1;ve++);h[T+ye]!==-1&&(te[h[T+ye]]=-1),h[M+ve]=h[T+ye];var H=h[P+ye],Y=h[O+ye];I+=Y;var Ue=0;h[O+ye]=-Y;var Ce=g[ye],Xe=H===0?Ce:S,mr=Xe;for(Ve=1;Ve<=H+1;Ve++){for(Ve>H?(be=ye,Ge=Ce,De=h[C+ye]-H):(be=E[Ce++],Ge=g[be],De=h[C+be]),re=1;re<=De;re++)B=E[Ge++],!((Ke=h[O+B])<=0)&&(Ue+=Ke,h[O+B]=-Ke,E[mr++]=B,h[T+B]!==-1&&(te[h[T+B]]=te[B]),te[B]!==-1?h[T+te[B]]=h[T+B]:h[M+h[z+B]]=h[T+B]);be!==ye&&(g[be]=Sn(ye),h[$+be]=0)}for(H!==0&&(S=mr),h[z+ye]=Ue,g[ye]=Xe,h[C+ye]=mr-Xe,h[P+ye]=-2,K=d(K,f,h,$,c),sr=Xe;sr<mr;sr++)if(B=E[sr],!((yr=h[P+B])<=0)){Ke=-h[O+B];var Or=K-Ke;for(Ce=g[B],We=g[B]+yr-1;Ce<=We;Ce++)be=E[Ce],h[$+be]>=K?h[$+be]-=Ke:h[$+be]!==0&&(h[$+be]=h[z+be]+Or)}for(sr=Xe;sr<mr;sr++){for(B=E[sr],We=g[B],qr=We+h[P+B]-1,zr=We,Ar=0,Dr=0,Ce=We;Ce<=qr;Ce++)if(be=E[Ce],h[$+be]!==0){var Gr=h[$+be]-K;Gr>0?(Dr+=Gr,E[zr++]=be,Ar+=be):(g[be]=Sn(ye),h[$+be]=0)}h[P+B]=zr-We+1;var Yr=zr,dt=We+h[C+B];for(Ce=qr+1;Ce<dt;Ce++){j=E[Ce];var st=h[O+j];st<=0||(Dr+=st,E[zr++]=j,Ar+=j)}Dr===0?(g[B]=Sn(ye),Ke=-h[O+B],Ue-=Ke,Y+=Ke,I+=Ke,h[O+B]=0,h[P+B]=-1):(h[z+B]=Math.min(h[z+B],Dr),E[zr]=E[Yr],E[Yr]=E[We],E[We]=ye,h[C+B]=zr-We+1,Ar=(Ar<0?-Ar:Ar)%c,h[T+B]=h[V+Ar],h[V+Ar]=B,te[B]=Ar)}for(h[z+ye]=Ue,f=Math.max(f,Ue),K=d(K+f,f,h,$,c),sr=Xe;sr<mr;sr++)if(B=E[sr],!(h[O+B]>=0))for(Ar=te[B],B=h[V+Ar],h[V+Ar]=-1;B!==-1&&h[T+B]!==-1;B=h[T+B],K++){for(De=h[C+B],yr=h[P+B],Ce=g[B]+1;Ce<=g[B]+De-1;Ce++)h[$+E[Ce]]=K;var Et=B;for(j=h[T+B];j!==-1;){var Pt=h[C+j]===De&&h[P+j]===yr;for(Ce=g[j]+1;Pt&&Ce<=g[j]+De-1;Ce++)h[$+E[Ce]]!==K&&(Pt=0);Pt?(g[j]=Sn(B),h[O+B]+=h[O+j],h[O+j]=0,h[P+j]=-1,j=h[T+j],h[T+Et]=j):(Et=j,j=h[T+j])}}for(Ce=Xe,sr=Xe;sr<mr;sr++)B=E[sr],!((Ke=-h[O+B])<=0)&&(h[O+B]=Ke,Dr=h[z+B]+Ue-Ke,Dr=Math.min(Dr,c-I-Ke),h[M+Dr]!==-1&&(te[h[M+Dr]]=B),h[T+B]=h[M+Dr],te[B]=-1,h[M+Dr]=B,ve=Math.min(ve,Dr),h[z+B]=Dr,E[Ce++]=B);h[O+ye]=Y,(h[C+ye]=Ce-Xe)===0&&(g[ye]=-1,h[$+ye]=0),H!==0&&(S=Ce)}for(B=0;B<c;B++)g[B]=Sn(g[B]);for(j=0;j<=c;j++)h[M+j]=-1;for(j=c;j>=0;j--)h[O+j]>0||(h[T+j]=h[M+g[j]],h[M+g[j]]=j);for(be=c;be>=0;be--)h[O+be]<=0||g[be]!==-1&&(h[T+be]=h[M+g[be]],h[M+g[be]]=be);for(ye=0,B=0;B<=c;B++)g[B]===-1&&(ye=fv(B,ye,h,M,T,N,$));return N.splice(N.length-1,1),N};function r(m,n,e,a,l){var c=t(n);if(m===1&&a===e)return i(n,c);if(m===2){for(var f=c._index,b=c._ptr,w=0,E=0;E<e;E++){var g=b[E];if(b[E]=w,!(b[E+1]-g>l))for(var S=b[E+1];g<S;g++)f[w++]=f[g]}return b[e]=w,n=t(c),o(c,n)}return o(c,n)}function s(m,n,e,a,l,c,f,b,w,E,g,S){for(var N=0;N<m;N++)e[a+N]=n[N+1]-n[N];e[a+m]=0;for(var h=0;h<=m;h++)e[l+h]=-1,c[h]=-1,e[f+h]=-1,e[b+h]=-1,e[w+h]=1,e[E+h]=1,e[g+h]=0,e[S+h]=e[a+h];var C=d(0,0,e,E,m);return e[g+m]=-2,n[m]=-1,e[E+m]=0,C}function p(m,n,e,a,l,c,f,b,w,E,g){for(var S=0,N=0;N<m;N++){var h=e[a+N];if(h===0)e[l+N]=-2,S++,n[N]=-1,e[c+N]=0;else if(h>f)e[b+N]=0,e[l+N]=-1,S++,n[N]=Sn(m),e[b+m]++;else{var C=e[w+h];C!==-1&&(E[C]=N),e[g+N]=e[w+h],e[w+h]=N}}return S}function d(m,n,e,a,l){if(m<2||m+n<0){for(var c=0;c<l;c++)e[a+c]!==0&&(e[a+c]=1);m=2}return m}function v(m,n){return m!==n}});function xg(u,i,o,t,r,s,p){var d,v,m=0,n;if(u<=i||o[t+i]<=o[r+u])return-1;o[r+u]=o[t+i];var e=o[s+u];if(o[s+u]=i,e===-1)m=1,n=u;else{for(m=2,n=e;n!==o[p+n];n=o[p+n]);for(d=e;d!==n;d=v)v=o[p+d],o[p+d]=n}return{jleaf:m,q:n}}var bg="csCounts",Ng=["transpose"],wg=(0,A.d5)(bg,Ng,u=>{var{transpose:i}=u;return function(o,t,r,s){if(!o||!t||!r)return null;var p=o._size,d=p[0],v=p[1],m,n,e,a,l,c,f,b=4*v+(s?v+d+1:0),w=[],E=0,g=v,S=2*v,N=3*v,h=4*v,C=5*v+1;for(e=0;e<b;e++)w[e]=-1;var O=[],T=i(o),M=T._index,P=T._ptr;for(e=0;e<v;e++)for(n=r[e],O[n]=w[N+n]===-1?1:0;n!==-1&&w[N+n]===-1;n=t[n])w[N+n]=e;if(s){for(e=0;e<v;e++)w[r[e]]=e;for(m=0;m<d;m++){for(e=v,c=P[m],f=P[m+1],l=c;l<f;l++)e=Math.min(e,w[M[l]]);w[C+m]=w[h+e],w[h+e]=m}}for(m=0;m<v;m++)w[E+m]=m;for(e=0;e<v;e++){for(n=r[e],t[n]!==-1&&O[t[n]]--,a=s?w[h+e]:n;a!==-1;a=s?w[C+a]:-1)for(l=P[a];l<P[a+1];l++){m=M[l];var z=xg(m,n,w,N,g,S,E);z.jleaf>=1&&O[n]++,z.jleaf===2&&O[z.q]--}t[n]!==-1&&(w[E+n]=t[n])}for(n=0;n<v;n++)t[n]!==-1&&(O[t[n]]+=O[n]);return O}}),Mg="csSqr",Ag=["add","multiply","transpose"],Sg=(0,A.d5)(Mg,Ag,u=>{var{add:i,multiply:o,transpose:t}=u,r=yg({add:i,multiply:o,transpose:t}),s=wg({transpose:t});return function(v,m,n){var e=m._ptr,a=m._size,l=a[1],c,f={};if(f.q=r(v,m),v&&!f.q)return null;if(n){var b=v?mg(m,null,f.q,0):m;f.parent=pg(b,1);var w=vg(f.parent,l);if(f.cp=s(b,f.parent,w,1),b&&f.parent&&f.cp&&p(b,f))for(f.unz=0,c=0;c<l;c++)f.unz+=f.cp[c]}else f.unz=4*e[l]+l,f.lnz=f.unz;return f};function p(d,v){var m=d._ptr,n=d._index,e=d._size,a=e[0],l=e[1];v.pinv=[],v.leftmost=[];var c=v.parent,f=v.pinv,b=v.leftmost,w=[],E=0,g=a,S=a+l,N=a+2*l,h,C,O,T,M;for(C=0;C<l;C++)w[g+C]=-1,w[S+C]=-1,w[N+C]=0;for(h=0;h<a;h++)b[h]=-1;for(C=l-1;C>=0;C--)for(T=m[C],M=m[C+1],O=T;O<M;O++)b[n[O]]=C;for(h=a-1;h>=0;h--)f[h]=-1,C=b[h],C!==-1&&(w[N+C]++===0&&(w[S+C]=h),w[E+h]=w[g+C],w[g+C]=h);for(v.lnz=0,v.m2=a,C=0;C<l;C++)if(h=w[g+C],v.lnz++,h<0&&(h=v.m2++),f[h]=C,!(--N[C]<=0)){v.lnz+=w[N+C];var P=c[C];P!==-1&&(w[N+P]===0&&(w[S+P]=w[S+C]),w[E+w[S+C]]=w[g+P],w[g+P]=w[E+h],w[N+P]+=w[N+C])}for(h=0;h<a;h++)f[h]<0&&(f[h]=C++);return!0}});function Yf(u,i){return u[i]<0}function mv(u,i){u[i]=Sn(u[i])}function vv(u){return u<0?Sn(u):u}function _g(u,i,o,t,r){var s=i._index,p=i._ptr,d=i._size,v=d[1],m,n,e,a=0;for(t[0]=u;a>=0;){u=t[a];var l=r?r[u]:u;Yf(p,u)||(mv(p,u),t[v+a]=l<0?0:vv(p[l]));var c=1;for(n=t[v+a],e=l<0?0:vv(p[l+1]);n<e;n++)if(m=s[n],!Yf(p,m)){t[v+a]=n,t[++a]=m,c=0;break}c&&(a--,t[--o]=u)}return o}function Eg(u,i,o,t,r){var s=u._ptr,p=u._size,d=i._index,v=i._ptr,m=p[1],n,e,a,l=m;for(e=v[o],a=v[o+1],n=e;n<a;n++){var c=d[n];Yf(s,c)||(l=_g(c,u,l,t,r))}for(n=l;n<m;n++)mv(s,t[n]);return l}var Cg="csSpsolve",Og=["divideScalar","multiply","subtract"],Dg=(0,A.d5)(Cg,Og,u=>{var{divideScalar:i,multiply:o,subtract:t}=u;return function(s,p,d,v,m,n,e){var a=s._values,l=s._index,c=s._ptr,f=s._size,b=f[1],w=p._values,E=p._index,g=p._ptr,S,N,h,C,O=Eg(s,p,d,v,n);for(S=O;S<b;S++)m[v[S]]=0;for(N=g[d],h=g[d+1],S=N;S<h;S++)m[E[S]]=w[S];for(var T=O;T<b;T++){var M=v[T],P=n?n[M]:M;if(!(P<0))for(N=c[P],h=c[P+1],m[M]=i(m[M],a[e?N:h-1]),S=e?N+1:N,C=e?h:h-1;S<C;S++){var z=l[S];m[z]=t(m[z],o(a[S],m[M]))}}return O}}),Bg="csLu",Tg=["abs","divideScalar","multiply","subtract","larger","largerEq","SparseMatrix"],Ug=(0,A.d5)(Bg,Tg,u=>{var{abs:i,divideScalar:o,multiply:t,subtract:r,larger:s,largerEq:p,SparseMatrix:d}=u,v=Dg({divideScalar:o,multiply:t,subtract:r});return function(n,e,a){if(!n)return null;var l=n._size,c=l[1],f,b=100,w=100;e&&(f=e.q,b=e.lnz||b,w=e.unz||w);var E=[],g=[],S=[],N=new d({values:E,index:g,ptr:S,size:[c,c]}),h=[],C=[],O=[],T=new d({values:h,index:C,ptr:O,size:[c,c]}),M=[],P,z,$=[],V=[];for(P=0;P<c;P++)$[P]=0,M[P]=-1,S[P+1]=0;b=0,w=0;for(var te=0;te<c;te++){S[te]=b,O[te]=w;var K=f?f[te]:te,I=v(N,n,K,V,$,M,1),ve=-1,B=-1;for(z=I;z<c;z++)if(P=V[z],M[P]<0){var j=i($[P]);s(j,B)&&(B=j,ve=P)}else C[w]=M[P],h[w++]=$[P];if(ve===-1||B<=0)return null;M[K]<0&&p(i($[K]),t(B,a))&&(ve=K);var ye=$[ve];for(C[w]=te,h[w++]=ye,M[ve]=te,g[b]=ve,E[b++]=1,z=I;z<c;z++)P=V[z],M[P]<0&&(g[b]=P,E[b++]=o($[P],ye)),$[P]=0}for(S[c]=b,O[c]=w,z=0;z<b;z++)g[z]=M[g[z]];return E.splice(b,E.length-b),g.splice(b,g.length-b),h.splice(w,h.length-w),C.splice(w,C.length-w),{L:N,U:T,pinv:M}}}),pv="slu",Rg=["typed","abs","add","multiply","transpose","divideScalar","subtract","larger","largerEq","SparseMatrix"],Ig=(0,A.d5)(pv,Rg,u=>{var{typed:i,abs:o,add:t,multiply:r,transpose:s,divideScalar:p,subtract:d,larger:v,largerEq:m,SparseMatrix:n}=u,e=Sg({add:t,multiply:r,transpose:s}),a=Ug({abs:o,divideScalar:p,multiply:r,subtract:d,larger:v,largerEq:m,SparseMatrix:n});return i(pv,{"SparseMatrix, number, number":function(c,f,b){if(!(0,le.U)(f)||f<0||f>3)throw new Error("Symbolic Ordering and Analysis order must be an integer number in the interval [0, 3]");if(b<0||b>1)throw new Error("Partial pivoting threshold must be a number from 0 to 1");var w=e(f,c,!1),E=a(c,w,b);return{L:E.L,U:E.U,p:E.pinv,q:w.q,toString:function(){return"L: "+this.L.toString()+`
45
- U: `+this.U.toString()+`
46
- p: `+this.p.toString()+(this.q?`
47
- q: `+this.q.toString():"")+`
48
- `}}}})}),Fg=ie(28596),zg="trace",Pg=["typed","matrix","add"],Lg=(0,A.d5)(zg,Pg,u=>{var{typed:i,matrix:o,add:t}=u;return i("trace",{Array:function(d){return r(o(d))},SparseMatrix:s,DenseMatrix:r,any:Sr.d9});function r(p){var d=p._size,v=p._data;switch(d.length){case 1:if(d[0]===1)return(0,Sr.d9)(v[0]);throw new RangeError("Matrix must be square (size: "+(0,Jr.WU)(d)+")");case 2:{var m=d[0],n=d[1];if(m===n){for(var e=0,a=0;a<m;a++)e=t(e,v[a][a]);return e}else throw new RangeError("Matrix must be square (size: "+(0,Jr.WU)(d)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+(0,Jr.WU)(d)+")")}}function s(p){var d=p._values,v=p._index,m=p._ptr,n=p._size,e=n[0],a=n[1];if(e===a){var l=0;if(d.length>0)for(var c=0;c<a;c++)for(var f=m[c],b=m[c+1],w=f;w<b;w++){var E=v[w];if(E===c){l=t(l,d[w]);break}if(E>c)break}return l}throw new RangeError("Matrix must be square (size: "+(0,Jr.WU)(n)+")")}}),dv="usolveAll",qg=["typed","matrix","divideScalar","multiplyScalar","subtract","equalScalar","DenseMatrix"],Wg=(0,A.d5)(dv,qg,u=>{var{typed:i,matrix:o,divideScalar:t,multiplyScalar:r,subtract:s,equalScalar:p,DenseMatrix:d}=u,v=Oa({DenseMatrix:d});return i(dv,{"SparseMatrix, Array | Matrix":function(a,l){return n(a,l)},"DenseMatrix, Array | Matrix":function(a,l){return m(a,l)},"Array, Array | Matrix":function(a,l){var c=o(a),f=m(c,l);return f.map(b=>b.valueOf())}});function m(e,a){for(var l=[v(e,a,!0)._data.map(O=>O[0])],c=e._data,f=e._size[0],b=e._size[1],w=b-1;w>=0;w--)for(var E=l.length,g=0;g<E;g++){var S=l[g];if(p(c[w][w],0))if(p(S[w],0)){if(g===0){var h=[...S];h[w]=1;for(var C=w-1;C>=0;C--)h[C]=s(h[C],c[C][w]);l.push(h)}}else{if(g===0)return[];l.splice(g,1),g-=1,E-=1}else{S[w]=t(S[w],c[w][w]);for(var N=w-1;N>=0;N--)S[N]=s(S[N],r(S[w],c[N][w]))}}return l.map(O=>new d({data:O.map(T=>[T]),size:[f,1]}))}function n(e,a){for(var l=[v(e,a,!0)._data.map(ye=>ye[0])],c=e._size[0],f=e._size[1],b=e._values,w=e._index,E=e._ptr,g=f-1;g>=0;g--)for(var S=l.length,N=0;N<S;N++){for(var h=l[N],C=[],O=[],T=E[g],M=E[g+1],P=0,z=M-1;z>=T;z--){var $=w[z];$===g?P=b[z]:$<g&&(C.push(b[z]),O.push($))}if(p(P,0))if(p(h[g],0)){if(N===0){var I=[...h];I[g]=1;for(var ve=0,B=O.length;ve<B;ve++){var j=O[ve];I[j]=s(I[j],C[ve])}l.push(I)}}else{if(N===0)return[];l.splice(N,1),N-=1,S-=1}else{h[g]=t(h[g],P);for(var V=0,te=O.length;V<te;V++){var K=O[V];h[K]=s(h[K],r(h[g],C[V]))}}}return l.map(ye=>new d({data:ye.map(Ve=>[Ve]),size:[c,1]}))}}),hv="asin",Gg=["typed","config","Complex"],Hg=(0,A.d5)(hv,Gg,u=>{var{typed:i,config:o,Complex:t}=u;return i(hv,{number:function(s){return s>=-1&&s<=1||o.predictable?Math.asin(s):new t(s,0).asin()},Complex:function(s){return s.asin()},BigNumber:function(s){return s.asin()},"Array | Matrix":function(s){return(0,Mr.Fh)(s,this,!0)}})}),Xf="ceil",kg=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],$g=(0,A.d5)(Xf,["typed","config","round"],u=>{var{typed:i,config:o,round:t}=u;return i(Xf,{number:function(s){return(0,le.RI)(s,t(s),o.epsilon)?t(s):Math.ceil(s)},"number, number":function(s,p){if((0,le.RI)(s,t(s,p),o.epsilon))return t(s,p);var[d,v]="".concat(s,"e").split("e"),m=Math.ceil(Number("".concat(d,"e").concat(Number(v)+p)));return[d,v]="".concat(m,"e").split("e"),Number("".concat(d,"e").concat(Number(v)-p))}})}),Vg=(0,A.d5)(Xf,kg,u=>{var{typed:i,config:o,round:t,matrix:r,equalScalar:s,zeros:p,DenseMatrix:d}=u,v=oe({typed:i,equalScalar:s}),m=He({typed:i,DenseMatrix:d}),n=Z({typed:i}),e=$g({typed:i,config:o,round:t});return i("ceil",{number:e.signatures.number,"number,number":e.signatures["number,number"],Complex:function(l){return l.ceil()},"Complex, number":function(l,c){return l.ceil(c)},"Complex, BigNumber":function(l,c){return l.ceil(c.toNumber())},BigNumber:function(l){return $t(l,t(l),o.epsilon)?t(l):l.ceil()},"BigNumber, BigNumber":function(l,c){return $t(l,t(l,c),o.epsilon)?t(l,c):l.toDecimalPlaces(c.toNumber(),cr.Z.ROUND_CEIL)},Fraction:function(l){return l.ceil()},"Fraction, number":function(l,c){return l.ceil(c)},"Fraction, BigNumber":function(l,c){return l.ceil(c.toNumber())},"Array | Matrix":function(l){return(0,Mr.Fh)(l,this,!0)},"Array, number | BigNumber":function(l,c){return(0,Mr.Fh)(l,f=>this(f,c),!0)},"SparseMatrix, number | BigNumber":function(l,c){return v(l,c,this,!1)},"DenseMatrix, number | BigNumber":function(l,c){return n(l,c,this,!1)},"number | Complex | Fraction | BigNumber, Array":function(l,c){return n(r(c),l,this,!0).valueOf()},"number | Complex | Fraction | BigNumber, Matrix":function(l,c){return s(l,0)?p(c.size(),c.storage()):c.storage()==="dense"?n(c,l,this,!0):m(c,l,this,!0)}})}),gv="composition",Jg=["typed","addScalar","combinations","isNegative","isPositive","isInteger","larger"],Zg=(0,A.d5)(gv,Jg,u=>{var{typed:i,addScalar:o,combinations:t,isPositive:r,isNegative:s,isInteger:p,larger:d}=u;return i(gv,{"number | BigNumber, number | BigNumber":function(m,n){if(!p(m)||!r(m)||!p(n)||!r(n))throw new TypeError("Positive integer value expected in function composition");if(d(n,m))throw new TypeError("k must be less than or equal to n in function composition");return t(o(m,-1),o(n,-1))}})}),yv="cross",Kg=["typed","matrix","subtract","multiply"],Yg=(0,A.d5)(yv,Kg,u=>{var{typed:i,matrix:o,subtract:t,multiply:r}=u;return i(yv,{"Matrix, Matrix":function(d,v){return o(s(d.toArray(),v.toArray()))},"Matrix, Array":function(d,v){return o(s(d.toArray(),v))},"Array, Matrix":function(d,v){return o(s(d,v.toArray()))},"Array, Array":s});function s(p,d){var v=Math.max((0,ze.aJ)(p).length,(0,ze.aJ)(d).length);p=(0,ze.L9)(p),d=(0,ze.L9)(d);var m=(0,ze.aJ)(p),n=(0,ze.aJ)(d);if(m.length!==1||n.length!==1||m[0]!==3||n[0]!==3)throw new RangeError("Vectors with length 3 expected (Size A = ["+m.join(", ")+"], B = ["+n.join(", ")+"])");var e=[t(r(p[1],d[2]),r(p[2],d[1])),t(r(p[2],d[0]),r(p[0],d[2])),t(r(p[0],d[1]),r(p[1],d[0]))];return v>1?[e]:e}}),xv="det",Xg=["typed","matrix","subtract","multiply","divideScalar","isZero","unaryMinus"],Qg=(0,A.d5)(xv,Xg,u=>{var{typed:i,matrix:o,subtract:t,multiply:r,divideScalar:s,isZero:p,unaryMinus:d}=u;return i(xv,{any:function(n){return(0,Sr.d9)(n)},"Array | Matrix":function(n){var e;switch((0,L.SW)(n)?e=n.size():Array.isArray(n)?(n=o(n),e=n.size()):e=[],e.length){case 0:return(0,Sr.d9)(n);case 1:if(e[0]===1)return(0,Sr.d9)(n.valueOf()[0]);throw new RangeError("Matrix must be square (size: "+(0,Jr.WU)(e)+")");case 2:{var a=e[0],l=e[1];if(a===l)return v(n.clone().valueOf(),a,l);throw new RangeError("Matrix must be square (size: "+(0,Jr.WU)(e)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+(0,Jr.WU)(e)+")")}}});function v(m,n,e){if(n===1)return(0,Sr.d9)(m[0][0]);if(n===2)return t(r(m[0][0],m[1][1]),r(m[1][0],m[0][1]));for(var a=!1,l=new Array(n).fill(0).map((C,O)=>O),c=0;c<n;c++){var f=l[c];if(p(m[f][c])){var b=void 0;for(b=c+1;b<n;b++)if(!p(m[l[b]][c])){f=l[b],l[b]=l[c],l[c]=f,a=!a;break}if(b===n)return m[f][c]}for(var w=m[f][c],E=c===0?1:m[l[c-1]][c-1],g=c+1;g<n;g++)for(var S=l[g],N=c+1;N<n;N++)m[S][N]=s(t(r(m[S][N],w),r(m[S][c],m[f][N])),E)}var h=m[l[n-1]][n-1];return a?d(h):h}}),bv="distance",jg=["typed","addScalar","subtract","divideScalar","multiplyScalar","unaryMinus","sqrt","abs"],ey=(0,A.d5)(bv,jg,u=>{var{typed:i,addScalar:o,subtract:t,multiplyScalar:r,divideScalar:s,unaryMinus:p,sqrt:d,abs:v}=u;return i(bv,{"Array, Array, Array":function(N,h,C){if(N.length===2&&h.length===2&&C.length===2){if(!n(N))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!n(h))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!n(C))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");var O=s(t(C[1],C[0]),t(h[1],h[0])),T=r(r(O,O),h[0]),M=p(r(O,h[0])),P=N[1];return b(N[0],N[1],T,M,P)}else throw new TypeError("Invalid Arguments: Try again")},"Object, Object, Object":function(N,h,C){if(Object.keys(N).length===2&&Object.keys(h).length===2&&Object.keys(C).length===2){if(!n(N))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!n(h))throw new TypeError("Values of lineOnePtX and lineOnePtY should be numbers or BigNumbers");if(!n(C))throw new TypeError("Values of lineTwoPtX and lineTwoPtY should be numbers or BigNumbers");if("pointX"in N&&"pointY"in N&&"lineOnePtX"in h&&"lineOnePtY"in h&&"lineTwoPtX"in C&&"lineTwoPtY"in C){var O=s(t(C.lineTwoPtY,C.lineTwoPtX),t(h.lineOnePtY,h.lineOnePtX)),T=r(r(O,O),h.lineOnePtX),M=p(r(O,h.lineOnePtX)),P=N.pointX;return b(N.pointX,N.pointY,T,M,P)}else throw new TypeError("Key names do not match")}else throw new TypeError("Invalid Arguments: Try again")},"Array, Array":function(N,h){if(N.length===2&&h.length===3){if(!n(N))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!e(h))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");return b(N[0],N[1],h[0],h[1],h[2])}else if(N.length===3&&h.length===6){if(!e(N))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!l(h))throw new TypeError("Array with 6 numbers or BigNumbers expected for second argument");return w(N[0],N[1],N[2],h[0],h[1],h[2],h[3],h[4],h[5])}else if(N.length===h.length&&N.length>0){if(!a(N))throw new TypeError("All values of an array should be numbers or BigNumbers");if(!a(h))throw new TypeError("All values of an array should be numbers or BigNumbers");return E(N,h)}else throw new TypeError("Invalid Arguments: Try again")},"Object, Object":function(N,h){if(Object.keys(N).length===2&&Object.keys(h).length===3){if(!n(N))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!e(h))throw new TypeError("Values of xCoeffLine, yCoeffLine and constant should be numbers or BigNumbers");if("pointX"in N&&"pointY"in N&&"xCoeffLine"in h&&"yCoeffLine"in h&&"constant"in h)return b(N.pointX,N.pointY,h.xCoeffLine,h.yCoeffLine,h.constant);throw new TypeError("Key names do not match")}else if(Object.keys(N).length===3&&Object.keys(h).length===6){if(!e(N))throw new TypeError("Values of pointX, pointY and pointZ should be numbers or BigNumbers");if(!l(h))throw new TypeError("Values of x0, y0, z0, a, b and c should be numbers or BigNumbers");if("pointX"in N&&"pointY"in N&&"x0"in h&&"y0"in h&&"z0"in h&&"a"in h&&"b"in h&&"c"in h)return w(N.pointX,N.pointY,N.pointZ,h.x0,h.y0,h.z0,h.a,h.b,h.c);throw new TypeError("Key names do not match")}else if(Object.keys(N).length===2&&Object.keys(h).length===2){if(!n(N))throw new TypeError("Values of pointOneX and pointOneY should be numbers or BigNumbers");if(!n(h))throw new TypeError("Values of pointTwoX and pointTwoY should be numbers or BigNumbers");if("pointOneX"in N&&"pointOneY"in N&&"pointTwoX"in h&&"pointTwoY"in h)return E([N.pointOneX,N.pointOneY],[h.pointTwoX,h.pointTwoY]);throw new TypeError("Key names do not match")}else if(Object.keys(N).length===3&&Object.keys(h).length===3){if(!e(N))throw new TypeError("Values of pointOneX, pointOneY and pointOneZ should be numbers or BigNumbers");if(!e(h))throw new TypeError("Values of pointTwoX, pointTwoY and pointTwoZ should be numbers or BigNumbers");if("pointOneX"in N&&"pointOneY"in N&&"pointOneZ"in N&&"pointTwoX"in h&&"pointTwoY"in h&&"pointTwoZ"in h)return E([N.pointOneX,N.pointOneY,N.pointOneZ],[h.pointTwoX,h.pointTwoY,h.pointTwoZ]);throw new TypeError("Key names do not match")}else throw new TypeError("Invalid Arguments: Try again")},Array:function(N){if(!f(N))throw new TypeError("Incorrect array format entered for pairwise distance calculation");return g(N)}});function m(S){return typeof S=="number"||(0,L.l9)(S)}function n(S){return S.constructor!==Array&&(S=c(S)),m(S[0])&&m(S[1])}function e(S){return S.constructor!==Array&&(S=c(S)),m(S[0])&&m(S[1])&&m(S[2])}function a(S){return Array.isArray(S)||(S=c(S)),S.every(m)}function l(S){return S.constructor!==Array&&(S=c(S)),m(S[0])&&m(S[1])&&m(S[2])&&m(S[3])&&m(S[4])&&m(S[5])}function c(S){for(var N=Object.keys(S),h=[],C=0;C<N.length;C++)h.push(S[N[C]]);return h}function f(S){if(S[0].length===2&&m(S[0][0])&&m(S[0][1])){if(S.some(N=>N.length!==2||!m(N[0])||!m(N[1])))return!1}else if(S[0].length===3&&m(S[0][0])&&m(S[0][1])&&m(S[0][2])){if(S.some(N=>N.length!==3||!m(N[0])||!m(N[1])||!m(N[2])))return!1}else return!1;return!0}function b(S,N,h,C,O){var T=v(o(o(r(h,S),r(C,N)),O)),M=d(o(r(h,h),r(C,C)));return s(T,M)}function w(S,N,h,C,O,T,M,P,z){var $=[t(r(t(O,N),z),r(t(T,h),P)),t(r(t(T,h),M),r(t(C,S),z)),t(r(t(C,S),P),r(t(O,N),M))];$=d(o(o(r($[0],$[0]),r($[1],$[1])),r($[2],$[2])));var V=d(o(o(r(M,M),r(P,P)),r(z,z)));return s($,V)}function E(S,N){for(var h=S.length,C=0,O=0,T=0;T<h;T++)O=t(S[T],N[T]),C=o(r(O,O),C);return d(C)}function g(S){for(var N=[],h=[],C=[],O=0;O<S.length-1;O++)for(var T=O+1;T<S.length;T++)S[0].length===2?(h=[S[O][0],S[O][1]],C=[S[T][0],S[T][1]]):S[0].length===3&&(h=[S[O][0],S[O][1],S[O][2]],C=[S[T][0],S[T][1],S[T][2]]),N.push(E(h,C));return N}}),Nv="dotMultiply",ry=["typed","matrix","equalScalar","multiplyScalar"],ty=(0,A.d5)(Nv,ry,u=>{var{typed:i,matrix:o,equalScalar:t,multiplyScalar:r}=u,s=F({typed:i,equalScalar:t}),p=Jm({typed:i,equalScalar:t}),d=oe({typed:i,equalScalar:t}),v=Br({typed:i}),m=Z({typed:i});return i(Nv,{"any, any":r,"SparseMatrix, SparseMatrix":function(e,a){return p(e,a,r,!1)},"SparseMatrix, DenseMatrix":function(e,a){return s(a,e,r,!0)},"DenseMatrix, SparseMatrix":function(e,a){return s(e,a,r,!1)},"DenseMatrix, DenseMatrix":function(e,a){return v(e,a,r)},"Array, Array":function(e,a){return this(o(e),o(a)).valueOf()},"Array, Matrix":function(e,a){return this(o(e),a)},"Matrix, Array":function(e,a){return this(e,o(a))},"SparseMatrix, any":function(e,a){return d(e,a,r,!1)},"DenseMatrix, any":function(e,a){return m(e,a,r,!1)},"any, SparseMatrix":function(e,a){return d(a,e,r,!0)},"any, DenseMatrix":function(e,a){return m(a,e,r,!0)},"Array, any":function(e,a){return m(o(e),a,r,!1).valueOf()},"any, Array":function(e,a){return m(o(a),e,r,!0).valueOf()}})}),ny="FibonacciHeap",ay=["smaller","larger"],iy=(0,A.d5)(ny,ay,u=>{var{smaller:i,larger:o}=u,t=1/Math.log((1+Math.sqrt(5))/2);function r(){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");this._minimum=null,this._size=0}r.prototype.type="FibonacciHeap",r.prototype.isFibonacciHeap=!0,r.prototype.insert=function(n,e){var a={key:n,value:e,degree:0};if(this._minimum){var l=this._minimum;a.left=l,a.right=l.right,l.right=a,a.right.left=a,i(n,l.key)&&(this._minimum=a)}else a.left=a,a.right=a,this._minimum=a;return this._size++,a},r.prototype.size=function(){return this._size},r.prototype.clear=function(){this._minimum=null,this._size=0},r.prototype.isEmpty=function(){return this._size===0},r.prototype.extractMinimum=function(){var n=this._minimum;if(n===null)return n;for(var e=this._minimum,a=n.degree,l=n.child;a>0;){var c=l.right;l.left.right=l.right,l.right.left=l.left,l.left=e,l.right=e.right,e.right=l,l.right.left=l,l.parent=null,l=c,a--}return n.left.right=n.right,n.right.left=n.left,n===n.right?e=null:(e=n.right,e=m(e,this._size)),this._size--,this._minimum=e,n},r.prototype.remove=function(n){this._minimum=s(this._minimum,n,-1),this.extractMinimum()};function s(n,e,a){e.key=a;var l=e.parent;return l&&i(e.key,l.key)&&(p(n,e,l),d(n,l)),i(e.key,n.key)&&(n=e),n}function p(n,e,a){e.left.right=e.right,e.right.left=e.left,a.degree--,a.child===e&&(a.child=e.right),a.degree===0&&(a.child=null),e.left=n,e.right=n.right,n.right=e,e.right.left=e,e.parent=null,e.mark=!1}function d(n,e){var a=e.parent;a&&(e.mark?(p(n,e,a),d(a)):e.mark=!0)}var v=function(e,a){e.left.right=e.right,e.right.left=e.left,e.parent=a,a.child?(e.left=a.child,e.right=a.child.right,a.child.right=e,e.right.left=e):(a.child=e,e.right=e,e.left=e),a.degree++,e.mark=!1};function m(n,e){var a=Math.floor(Math.log(e)*t)+1,l=new Array(a),c=0,f=n;if(f)for(c++,f=f.right;f!==n;)c++,f=f.right;for(var b;c>0;){for(var w=f.degree,E=f.right;b=l[w],!!b;){if(o(f.key,b.key)){var g=b;b=f,f=g}v(b,f),l[w]=null,w++}l[w]=f,f=E,c--}n=null;for(var S=0;S<a;S++)b=l[S],b&&(n?(b.left.right=b.right,b.right.left=b.left,b.left=n,b.right=n.right,n.right=b,b.right.left=b,i(b.key,n.key)&&(n=b)):n=b);return n}return r},{isClass:!0}),Qf="fix",oy=["typed","Complex","matrix","ceil","floor","equalScalar","zeros","DenseMatrix"],sy=(0,A.d5)(Qf,["typed","ceil","floor"],u=>{var{typed:i,ceil:o,floor:t}=u;return i(Qf,{number:function(s){return s>0?t(s):o(s)},"number, number":function(s,p){return s>0?t(s,p):o(s,p)}})}),uy=(0,A.d5)(Qf,oy,u=>{var{typed:i,Complex:o,matrix:t,ceil:r,floor:s,equalScalar:p,zeros:d,DenseMatrix:v}=u,m=He({typed:i,DenseMatrix:v}),n=Z({typed:i}),e=sy({typed:i,ceil:r,floor:s});return i("fix",{number:e.signatures.number,"number, number | BigNumber":e.signatures["number,number"],Complex:function(l){return new o(l.re>0?Math.floor(l.re):Math.ceil(l.re),l.im>0?Math.floor(l.im):Math.ceil(l.im))},"Complex, number":function(l,c){return new o(l.re>0?s(l.re,c):r(l.re,c),l.im>0?s(l.im,c):r(l.im,c))},"Complex, BigNumber":function(l,c){var f=c.toNumber();return new o(l.re>0?s(l.re,f):r(l.re,f),l.im>0?s(l.im,f):r(l.im,f))},BigNumber:function(l){return l.isNegative()?r(l):s(l)},"BigNumber, number | BigNumber":function(l,c){return l.isNegative()?r(l,c):s(l,c)},Fraction:function(l){return l.s<0?l.ceil():l.floor()},"Fraction, number | BigNumber":function(l,c){return l.s<0?r(l,c):s(l,c)},"Array | Matrix":function(l){return(0,Mr.Fh)(l,this,!0)},"Array | Matrix, number | BigNumber":function(l,c){return(0,Mr.Fh)(l,f=>this(f,c),!0)},"number | Complex | Fraction | BigNumber, Array":function(l,c){return n(t(c),l,this,!0).valueOf()},"number | Complex | Fraction | BigNumber, Matrix":function(l,c){return p(l,0)?d(c.size(),c.storage()):c.storage()==="dense"?n(c,l,this,!0):m(c,l,this,!0)}})}),cy="ImmutableDenseMatrix",ly=["smaller","DenseMatrix"],fy=(0,A.d5)(cy,ly,u=>{var{smaller:i,DenseMatrix:o}=u;function t(r,s){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");if(s&&!(0,L.HD)(s))throw new Error("Invalid datatype: "+s);if((0,L.SW)(r)||(0,L.kJ)(r)){var p=new o(r,s);this._data=p._data,this._size=p._size,this._datatype=p._datatype,this._min=null,this._max=null}else if(r&&(0,L.kJ)(r.data)&&(0,L.kJ)(r.size))this._data=r.data,this._size=r.size,this._datatype=r.datatype,this._min=typeof r.min<"u"?r.min:null,this._max=typeof r.max<"u"?r.max:null;else{if(r)throw new TypeError("Unsupported type of data ("+(0,L.kM)(r)+")");this._data=[],this._size=[0],this._datatype=s,this._min=null,this._max=null}}return t.prototype=new o,t.prototype.type="ImmutableDenseMatrix",t.prototype.isImmutableDenseMatrix=!0,t.prototype.subset=function(r){switch(arguments.length){case 1:{var s=o.prototype.subset.call(this,r);return(0,L.SW)(s)?new t({data:s._data,size:s._size,datatype:s._datatype}):s}case 2:case 3:throw new Error("Cannot invoke set subset on an Immutable Matrix instance");default:throw new SyntaxError("Wrong number of arguments")}},t.prototype.set=function(){throw new Error("Cannot invoke set on an Immutable Matrix instance")},t.prototype.resize=function(){throw new Error("Cannot invoke resize on an Immutable Matrix instance")},t.prototype.reshape=function(){throw new Error("Cannot invoke reshape on an Immutable Matrix instance")},t.prototype.clone=function(){return new t({data:(0,Sr.d9)(this._data),size:(0,Sr.d9)(this._size),datatype:this._datatype})},t.prototype.toJSON=function(){return{mathjs:"ImmutableDenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},t.fromJSON=function(r){return new t(r)},t.prototype.swapRows=function(){throw new Error("Cannot invoke swapRows on an Immutable Matrix instance")},t.prototype.min=function(){if(this._min===null){var r=null;this.forEach(function(s){(r===null||i(s,r))&&(r=s)}),this._min=r!==null?r:void 0}return this._min},t.prototype.max=function(){if(this._max===null){var r=null;this.forEach(function(s){(r===null||i(r,s))&&(r=s)}),this._max=r!==null?r:void 0}return this._max},t},{isClass:!0}),my="Index",vy=["ImmutableDenseMatrix"],py=(0,A.d5)(my,vy,u=>{var{ImmutableDenseMatrix:i}=u;function o(r){if(!(this instanceof o))throw new SyntaxError("Constructor must be called with the new operator");this._dimensions=[],this._isScalar=!0;for(var s=0,p=arguments.length;s<p;s++){var d=arguments[s];if((0,L.bR)(d))this._dimensions.push(d),this._isScalar=!1;else if(Array.isArray(d)||(0,L.SW)(d)){var v=t(d.valueOf());this._dimensions.push(v);var m=v.size();(m.length!==1||m[0]!==1)&&(this._isScalar=!1)}else if(typeof d=="number")this._dimensions.push(t([d]));else if(typeof d=="string")this._dimensions.push(d);else throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range")}}o.prototype.type="Index",o.prototype.isIndex=!0;function t(r){for(var s=0,p=r.length;s<p;s++)if(typeof r[s]!="number"||!(0,le.U)(r[s]))throw new TypeError("Index parameters must be positive integer numbers");return new i(r)}return o.prototype.clone=function(){var r=new o;return r._dimensions=(0,Sr.d9)(this._dimensions),r._isScalar=this._isScalar,r},o.create=function(r){var s=new o;return o.apply(s,r),s},o.prototype.size=function(){for(var r=[],s=0,p=this._dimensions.length;s<p;s++){var d=this._dimensions[s];r[s]=typeof d=="string"?1:d.size()[0]}return r},o.prototype.max=function(){for(var r=[],s=0,p=this._dimensions.length;s<p;s++){var d=this._dimensions[s];r[s]=typeof d=="string"?d:d.max()}return r},o.prototype.min=function(){for(var r=[],s=0,p=this._dimensions.length;s<p;s++){var d=this._dimensions[s];r[s]=typeof d=="string"?d:d.min()}return r},o.prototype.forEach=function(r){for(var s=0,p=this._dimensions.length;s<p;s++)r(this._dimensions[s],s,this)},o.prototype.dimension=function(r){return this._dimensions[r]||null},o.prototype.isObjectProperty=function(){return this._dimensions.length===1&&typeof this._dimensions[0]=="string"},o.prototype.getObjectProperty=function(){return this.isObjectProperty()?this._dimensions[0]:null},o.prototype.isScalar=function(){return this._isScalar},o.prototype.toArray=function(){for(var r=[],s=0,p=this._dimensions.length;s<p;s++){var d=this._dimensions[s];r.push(typeof d=="string"?d:d.toArray())}return r},o.prototype.valueOf=o.prototype.toArray,o.prototype.toString=function(){for(var r=[],s=0,p=this._dimensions.length;s<p;s++){var d=this._dimensions[s];typeof d=="string"?r.push(JSON.stringify(d)):r.push(d.toString())}return"["+r.join(", ")+"]"},o.prototype.toJSON=function(){return{mathjs:"Index",dimensions:this._dimensions}},o.fromJSON=function(r){return o.create(r.dimensions)},o},{isClass:!0}),dy="intersect",hy=["typed","config","abs","add","addScalar","matrix","multiply","multiplyScalar","divideScalar","subtract","smaller","equalScalar","flatten","isZero","isNumeric"],gy=(0,A.d5)(dy,hy,u=>{var{typed:i,config:o,abs:t,add:r,addScalar:s,matrix:p,multiply:d,multiplyScalar:v,divideScalar:m,subtract:n,smaller:e,equalScalar:a,flatten:l,isZero:c,isNumeric:f}=u;return i("intersect",{"Array, Array, Array":b,"Array, Array, Array, Array":w,"Matrix, Matrix, Matrix":function(P,z,$){var V=b(P.valueOf(),z.valueOf(),$.valueOf());return V===null?null:p(V)},"Matrix, Matrix, Matrix, Matrix":function(P,z,$,V){var te=w(P.valueOf(),z.valueOf(),$.valueOf(),V.valueOf());return te===null?null:p(te)}});function b(M,P,z){if(M=E(M),P=E(P),z=E(z),!S(M))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!S(P))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!N(z))throw new TypeError("Array with 4 numbers expected as third argument");return T(M[0],M[1],M[2],P[0],P[1],P[2],z[0],z[1],z[2],z[3])}function w(M,P,z,$){if(M=E(M),P=E(P),z=E(z),$=E($),M.length===2){if(!g(M))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!g(P))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!g(z))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(!g($))throw new TypeError("Array with 2 numbers or BigNumbers expected for fourth argument");return h(M,P,z,$)}else if(M.length===3){if(!S(M))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!S(P))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!S(z))throw new TypeError("Array with 3 numbers or BigNumbers expected for third argument");if(!S($))throw new TypeError("Array with 3 numbers or BigNumbers expected for fourth argument");return O(M[0],M[1],M[2],P[0],P[1],P[2],z[0],z[1],z[2],$[0],$[1],$[2])}else throw new TypeError("Arrays with two or thee dimensional points expected")}function E(M){return M.length===1?M[0]:M.length>1&&Array.isArray(M[0])&&M.every(P=>Array.isArray(P)&&P.length===1)?l(M):M}function g(M){return M.length===2&&f(M[0])&&f(M[1])}function S(M){return M.length===3&&f(M[0])&&f(M[1])&&f(M[2])}function N(M){return M.length===4&&f(M[0])&&f(M[1])&&f(M[2])&&f(M[3])}function h(M,P,z,$){var V=M,te=z,K=n(V,P),I=n(te,$),ve=n(v(K[0],I[1]),v(I[0],K[1]));if(c(ve)||e(t(ve),o.epsilon))return null;var B=v(I[0],V[1]),j=v(I[1],V[0]),ye=v(I[0],te[1]),Ve=v(I[1],te[0]),re=m(s(n(n(B,j),ye),Ve),ve);return r(d(K,re),V)}function C(M,P,z,$,V,te,K,I,ve,B,j,ye){var Ve=v(n(M,P),n(z,$)),re=v(n(V,te),n(K,I)),be=v(n(ve,B),n(j,ye));return s(s(Ve,re),be)}function O(M,P,z,$,V,te,K,I,ve,B,j,ye){var Ve=C(M,K,B,K,P,I,j,I,z,ve,ye,ve),re=C(B,K,$,M,j,I,V,P,ye,ve,te,z),be=C(M,K,$,M,P,I,V,P,z,ve,te,z),Ge=C(B,K,B,K,j,I,j,I,ye,ve,ye,ve),De=C($,M,$,M,V,P,V,P,te,z,te,z),Ke=n(v(Ve,re),v(be,Ge)),sr=n(v(De,Ge),v(re,re));if(c(sr))return null;var yr=m(Ke,sr),We=m(s(Ve,v(yr,re)),Ge),qr=s(M,v(yr,n($,M))),zr=s(P,v(yr,n(V,P))),Ar=s(z,v(yr,n(te,z))),Dr=s(K,v(We,n(B,K))),H=s(I,v(We,n(j,I))),Y=s(ve,v(We,n(ye,ve)));return a(qr,Dr)&&a(zr,H)&&a(Ar,Y)?[qr,zr,Ar]:null}function T(M,P,z,$,V,te,K,I,ve,B){var j=v(M,K),ye=v($,K),Ve=v(P,I),re=v(V,I),be=v(z,ve),Ge=v(te,ve),De=n(n(n(B,j),Ve),be),Ke=n(n(n(s(s(ye,re),Ge),j),Ve),be),sr=m(De,Ke),yr=s(M,v(sr,n($,M))),We=s(P,v(sr,n(V,P))),qr=s(z,v(sr,n(te,z)));return[yr,We,qr]}}),wv="lcm",yy=["typed","matrix","equalScalar"],xy=(0,A.d5)(wv,yy,u=>{var{typed:i,matrix:o,equalScalar:t}=u,r=F({typed:i,equalScalar:t}),s=ke({typed:i,equalScalar:t}),p=oe({typed:i,equalScalar:t}),d=Br({typed:i}),v=Z({typed:i});return i(wv,{"number, number":Qa,"BigNumber, BigNumber":m,"Fraction, Fraction":function(e,a){return e.lcm(a)},"SparseMatrix, SparseMatrix":function(e,a){return s(e,a,this)},"SparseMatrix, DenseMatrix":function(e,a){return r(a,e,this,!0)},"DenseMatrix, SparseMatrix":function(e,a){return r(e,a,this,!1)},"DenseMatrix, DenseMatrix":function(e,a){return d(e,a,this)},"Array, Array":function(e,a){return this(o(e),o(a)).valueOf()},"Array, Matrix":function(e,a){return this(o(e),a)},"Matrix, Array":function(e,a){return this(e,o(a))},"SparseMatrix, number | BigNumber":function(e,a){return p(e,a,this,!1)},"DenseMatrix, number | BigNumber":function(e,a){return v(e,a,this,!1)},"number | BigNumber, SparseMatrix":function(e,a){return p(a,e,this,!0)},"number | BigNumber, DenseMatrix":function(e,a){return v(a,e,this,!0)},"Array, number | BigNumber":function(e,a){return v(o(e),a,this,!1).valueOf()},"number | BigNumber, Array":function(e,a){return v(o(a),e,this,!0).valueOf()},"Array | Matrix | number | BigNumber, Array | Matrix | number | BigNumber, ...Array | Matrix | number | BigNumber":function(e,a,l){for(var c=this(e,a),f=0;f<l.length;f++)c=this(c,l[f]);return c}});function m(n,e){if(!n.isInt()||!e.isInt())throw new Error("Parameters in function lcm must be integer numbers");if(n.isZero())return n;if(e.isZero())return e;for(var a=n.times(e);!e.isZero();){var l=e;e=n.mod(l),n=l}return a.div(n).abs()}}),Mv="log1p",by=["typed","config","divideScalar","log","Complex"],Ny=(0,A.d5)(Mv,by,u=>{var{typed:i,config:o,divideScalar:t,log:r,Complex:s}=u;return i(Mv,{number:function(v){return v>=-1||o.predictable?(0,le.Kr)(v):p(new s(v,0))},Complex:p,BigNumber:function(v){var m=v.plus(1);return!m.isNegative()||o.predictable?m.ln():p(new s(v.toNumber(),0))},"Array | Matrix":function(v){return(0,Mr.Fh)(v,this)},"any, any":function(v,m){return t(this(v),r(m))}});function p(d){var v=d.re+1;return new s(Math.log(Math.sqrt(v*v+d.im*d.im)),Math.atan2(d.im,v))}}),wy=ie(15065),My="quantileSeq",Ay=["typed","add","multiply","partitionSelect","compare"],Sy=(0,A.d5)(My,Ay,u=>{var{typed:i,add:o,multiply:t,partitionSelect:r,compare:s}=u;function p(m,n,e){var a,l,c;if(arguments.length<2||arguments.length>3)throw new SyntaxError("Function quantileSeq requires two or three parameters");if((0,L.uZ)(m)){if(e=e||!1,typeof e=="boolean"){if(l=m.valueOf(),(0,L.hj)(n)){if(n<0)throw new Error("N/prob must be non-negative");if(n<=1)return d(l,n,e);if(n>1){if(!(0,le.U)(n))throw new Error("N must be a positive integer");var f=n+1;a=new Array(n);for(var b=0;b<n;)a[b]=d(l,++b/f,e);return a}}if((0,L.l9)(n)){var w=n.constructor;if(n.isNegative())throw new Error("N/prob must be non-negative");if(c=new w(1),n.lte(c))return new w(d(l,n,e));if(n.gt(c)){if(!n.isInteger())throw new Error("N must be a positive integer");var E=n.toNumber();if(E>4294967295)throw new Error("N must be less than or equal to 2^32-1, as that is the maximum length of an Array");var g=new w(E+1);a=new Array(E);for(var S=0;S<E;)a[S]=new w(d(l,new w(++S).div(g),e));return a}}if(Array.isArray(n)){a=new Array(n.length);for(var N=0;N<a.length;++N){var h=n[N];if((0,L.hj)(h)){if(h<0||h>1)throw new Error("Probability must be between 0 and 1, inclusive")}else if((0,L.l9)(h)){if(c=new h.constructor(1),h.isNegative()||h.gt(c))throw new Error("Probability must be between 0 and 1, inclusive")}else throw new TypeError("Unexpected type of argument in function quantileSeq");a[N]=d(l,h,e)}return a}throw new TypeError("Unexpected type of argument in function quantileSeq")}throw new TypeError("Unexpected type of argument in function quantileSeq")}throw new TypeError("Unexpected type of argument in function quantileSeq")}function d(m,n,e){var a=(0,ze.xH)(m),l=a.length;if(l===0)throw new Error("Cannot calculate quantile of an empty sequence");if((0,L.hj)(n)){var c=n*(l-1),f=c%1;if(f===0){var b=e?a[c]:r(a,c);return v(b),b}var w=Math.floor(c),E,g;if(e)E=a[w],g=a[w+1];else{g=r(a,w+1),E=a[w];for(var S=0;S<w;++S)s(a[S],E)>0&&(E=a[S])}return v(E),v(g),o(t(E,1-f),t(g,f))}var N=n.times(l-1);if(N.isInteger()){N=N.toNumber();var h=e?a[N]:r(a,N);return v(h),h}var C=N.floor(),O=N.minus(C),T=C.toNumber(),M,P;if(e)M=a[T],P=a[T+1];else{P=r(a,T+1),M=a[T];for(var z=0;z<T;++z)s(a[z],M)>0&&(M=a[z])}v(M),v(P);var $=new O.constructor(1);return o(t(M,$.minus(O)),t(P,O))}var v=i({"number | BigNumber | Unit":function(n){return n}});return p}),_y=ie(21588),Av="setCartesian",Ey=["typed","size","subset","compareNatural","Index","DenseMatrix"],Cy=(0,A.d5)(Av,Ey,u=>{var{typed:i,size:o,subset:t,compareNatural:r,Index:s,DenseMatrix:p}=u;return i(Av,{"Array | Matrix, Array | Matrix":function(v,m){var n=[];if(t(o(v),new s(0))!==0&&t(o(m),new s(0))!==0){var e=(0,ze.xH)(Array.isArray(v)?v:v.toArray()).sort(r),a=(0,ze.xH)(Array.isArray(m)?m:m.toArray()).sort(r);n=[];for(var l=0;l<e.length;l++)for(var c=0;c<a.length;c++)n.push([e[l],a[c]])}return Array.isArray(v)&&Array.isArray(m)?n:new p(n)}})}),Sv="setDistinct",Oy=["typed","size","subset","compareNatural","Index","DenseMatrix"],Dy=(0,A.d5)(Sv,Oy,u=>{var{typed:i,size:o,subset:t,compareNatural:r,Index:s,DenseMatrix:p}=u;return i(Sv,{"Array | Matrix":function(v){var m;if(t(o(v),new s(0))===0)m=[];else{var n=(0,ze.xH)(Array.isArray(v)?v:v.toArray()).sort(r);m=[],m.push(n[0]);for(var e=1;e<n.length;e++)r(n[e],n[e-1])!==0&&m.push(n[e])}return Array.isArray(v)?m:new p(m)}})}),_v="setIsSubset",By=["typed","size","subset","compareNatural","Index"],Ty=(0,A.d5)(_v,By,u=>{var{typed:i,size:o,subset:t,compareNatural:r,Index:s}=u;return i(_v,{"Array | Matrix, Array | Matrix":function(d,v){if(t(o(d),new s(0))===0)return!0;if(t(o(v),new s(0))===0)return!1;for(var m=(0,ze.yV)((0,ze.xH)(Array.isArray(d)?d:d.toArray()).sort(r)),n=(0,ze.yV)((0,ze.xH)(Array.isArray(v)?v:v.toArray()).sort(r)),e,a=0;a<m.length;a++){e=!1;for(var l=0;l<n.length;l++)if(r(m[a].value,n[l].value)===0&&m[a].identifier===n[l].identifier){e=!0;break}if(e===!1)return!1}return!0}})}),Ev="setPowerset",Uy=["typed","size","subset","compareNatural","Index"],Ry=(0,A.d5)(Ev,Uy,u=>{var{typed:i,size:o,subset:t,compareNatural:r,Index:s}=u;return i(Ev,{"Array | Matrix":function(m){if(t(o(m),new s(0))===0)return[];for(var n=(0,ze.xH)(Array.isArray(m)?m:m.toArray()).sort(r),e=[],a=0;a.toString(2).length<=n.length;)e.push(p(n,a.toString(2).split("").reverse())),a++;return d(e)}});function p(v,m){for(var n=[],e=0;e<m.length;e++)m[e]==="1"&&n.push(v[e]);return n}function d(v){for(var m=[],n=v.length-1;n>0;n--)for(var e=0;e<n;e++)v[e].length>v[e+1].length&&(m=v[e],v[e]=v[e+1],v[e+1]=m);return v}}),Cv="sort",Iy=["typed","matrix","compare","compareNatural"],Fy=(0,A.d5)(Cv,Iy,u=>{var{typed:i,matrix:o,compare:t,compareNatural:r}=u,s=t,p=(n,e)=>-t(n,e);return i(Cv,{Array:function(e){return v(e),e.sort(s)},Matrix:function(e){return m(e),o(e.toArray().sort(s),e.storage())},"Array, function":function(e,a){return v(e),e.sort(a)},"Matrix, function":function(e,a){return m(e),o(e.toArray().sort(a),e.storage())},"Array, string":function(e,a){return v(e),e.sort(d(a))},"Matrix, string":function(e,a){return m(e),o(e.toArray().sort(d(a)),e.storage())}});function d(n){if(n==="asc")return s;if(n==="desc")return p;if(n==="natural")return r;throw new Error('String "asc", "desc", or "natural" expected')}function v(n){if((0,ze.aJ)(n).length!==1)throw new Error("One dimensional array expected")}function m(n){if(n.size().length!==1)throw new Error("One dimensional matrix expected")}}),zy=ie(12800),Ov="index",Py=["typed","Index"],Ly=(0,A.d5)(Ov,Py,u=>{var{typed:i,Index:o}=u;return i(Ov,{"...number | string | BigNumber | Range | Array | Matrix":function(r){var s=r.map(function(d){return(0,L.l9)(d)?d.toNumber():Array.isArray(d)||(0,L.SW)(d)?d.map(function(v){return(0,L.l9)(v)?v.toNumber():v}):d}),p=new o;return o.apply(p,s),p}})}),Dv="inv",qy=["typed","matrix","divideScalar","addScalar","multiply","unaryMinus","det","identity","abs"],Wy=(0,A.d5)(Dv,qy,u=>{var{typed:i,matrix:o,divideScalar:t,addScalar:r,multiply:s,unaryMinus:p,det:d,identity:v,abs:m}=u;return i(Dv,{"Array | Matrix":function(a){var l=(0,L.SW)(a)?a.size():(0,ze.aJ)(a);switch(l.length){case 1:if(l[0]===1)return(0,L.SW)(a)?o([t(1,a.valueOf()[0])]):[t(1,a[0])];throw new RangeError("Matrix must be square (size: "+(0,Jr.WU)(l)+")");case 2:{var c=l[0],f=l[1];if(c===f)return(0,L.SW)(a)?o(n(a.valueOf(),c,f),a.storage()):n(a,c,f);throw new RangeError("Matrix must be square (size: "+(0,Jr.WU)(l)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+(0,Jr.WU)(l)+")")}},any:function(a){return t(1,a)}});function n(e,a,l){var c,f,b,w,E;if(a===1){if(w=e[0][0],w===0)throw Error("Cannot calculate inverse, determinant is zero");return[[t(1,w)]]}else if(a===2){var g=d(e);if(g===0)throw Error("Cannot calculate inverse, determinant is zero");return[[t(e[1][1],g),t(p(e[0][1]),g)],[t(p(e[1][0]),g),t(e[0][0],g)]]}else{var S=e.concat();for(c=0;c<a;c++)S[c]=S[c].concat();for(var N=v(a).valueOf(),h=0;h<l;h++){var C=m(S[h][h]),O=h;for(c=h+1;c<a;)m(S[c][h])>C&&(C=m(S[c][h]),O=c),c++;if(C===0)throw Error("Cannot calculate inverse, determinant is zero");c=O,c!==h&&(E=S[h],S[h]=S[c],S[c]=E,E=N[h],N[h]=N[c],N[c]=E);var T=S[h],M=N[h];for(c=0;c<a;c++){var P=S[c],z=N[c];if(c!==h){if(P[h]!==0){for(b=t(p(P[h]),T[h]),f=h;f<l;f++)P[f]=r(P[f],s(b,T[f]));for(f=0;f<l;f++)z[f]=r(z[f],s(b,M[f]))}}else{for(b=T[h],f=h;f<l;f++)P[f]=t(P[f],b);for(f=0;f<l;f++)z[f]=t(z[f],b)}}}return N}}}),Bv="pinv",Gy=["typed","matrix","inv","deepEqual","equal","dotDivide","dot","ctranspose","divideScalar","multiply","add","Complex"],Hy=(0,A.d5)(Bv,Gy,u=>{var{typed:i,matrix:o,inv:t,deepEqual:r,equal:s,dotDivide:p,dot:d,ctranspose:v,divideScalar:m,multiply:n,add:e,Complex:a}=u;return i(Bv,{"Array | Matrix":function(g){var S=(0,L.SW)(g)?g.size():(0,ze.aJ)(g);switch(S.length){case 1:return w(g)?v(g):S[0]===1?t(g):p(v(g),d(g,g));case 2:{if(w(g))return v(g);var N=S[0],h=S[1];if(N===h)try{return t(g)}catch(C){if(!(C instanceof Error&&C.message.match(/Cannot calculate inverse, determinant is zero/)))throw C}return(0,L.SW)(g)?o(l(g.valueOf(),N,h),g.storage()):l(g,N,h)}default:throw new RangeError("Matrix must be two dimensional (size: "+(0,Jr.WU)(S)+")")}},any:function(g){return s(g,0)?(0,Sr.d9)(g):m(1,g)}});function l(E,g,S){var{C:N,F:h}=f(E,g,S),C=n(t(n(v(N),N)),v(N)),O=n(v(h),t(n(h,v(h))));return n(O,C)}function c(E,g,S){for(var N=(0,Sr.d9)(E),h=0,C=0;C<g;C++){if(S<=h)return N;for(var O=C;b(N[O][h]);)if(O++,g===O&&(O=C,h++,S===h))return N;[N[O],N[C]]=[N[C],N[O]];for(var T=N[C][h],M=0;M<S;M++)N[C][M]=p(N[C][M],T);for(var P=0;P<g;P++)if(P!==C){T=N[P][h];for(var z=0;z<S;z++)N[P][z]=e(N[P][z],n(-1,n(T,N[C][z])))}h++}return N}function f(E,g,S){var N=c(E,g,S),h=E.map((O,T)=>O.filter((M,P)=>P<g&&!b(d(N[P],N[P])))),C=N.filter((O,T)=>!b(d(N[T],N[T])));return{C:h,F:C}}function b(E){return s(e(E,a(1,1)),e(0,a(1,1)))}function w(E){return r(e(E,a(1,1)),e(n(E,0),a(1,1)))}}),Tv="pow",ky=["typed","config","identity","multiply","matrix","inv","fraction","number","Complex"],$y=(0,A.d5)(Tv,ky,u=>{var{typed:i,config:o,identity:t,multiply:r,matrix:s,inv:p,number:d,fraction:v,Complex:m}=u;return i(Tv,{"number, number":n,"Complex, Complex":function(c,f){return c.pow(f)},"BigNumber, BigNumber":function(c,f){return f.isInteger()||c>=0||o.predictable?c.pow(f):new m(c.toNumber(),0).pow(f.toNumber(),0)},"Fraction, Fraction":function(c,f){var b=c.pow(f);if(b!=null)return b;if(o.predictable)throw new Error("Result of pow is non-rational and cannot be expressed as a fraction");return n(c.valueOf(),f.valueOf())},"Array, number":e,"Array, BigNumber":function(c,f){return e(c,f.toNumber())},"Matrix, number":a,"Matrix, BigNumber":function(c,f){return a(c,f.toNumber())},"Unit, number | BigNumber":function(c,f){return c.pow(f)}});function n(l,c){if(o.predictable&&!(0,le.U)(c)&&l<0)try{var f=v(c),b=d(f);if((c===b||Math.abs((c-b)/c)<1e-14)&&f.d%2===1)return(f.n%2===0?1:-1)*Math.pow(-l,c)}catch{}return o.predictable&&(l<-1&&c===1/0||l>-1&&l<0&&c===-1/0)?NaN:(0,le.U)(c)||l>=0||o.predictable?ii(l,c):l*l<1&&c===1/0||l*l>1&&c===-1/0?0:new m(l,0).pow(c,0)}function e(l,c){if(!(0,le.U)(c))throw new TypeError("For A^b, b must be an integer (value is "+c+")");var f=(0,ze.aJ)(l);if(f.length!==2)throw new Error("For A^b, A must be 2 dimensional (A has "+f.length+" dimensions)");if(f[0]!==f[1])throw new Error("For A^b, A must be square (size is "+f[0]+"x"+f[1]+")");if(c<0)try{return e(p(l),-c)}catch(E){throw E.message==="Cannot calculate inverse, determinant is zero"?new TypeError("For A^b, when A is not invertible, b must be a positive integer (value is "+c+")"):E}for(var b=t(f[0]).valueOf(),w=l;c>=1;)(c&1)===1&&(b=r(w,b)),c>>=1,w=r(w,w);return b}function a(l,c){return s(e(l.valueOf(),c))}}),Uv="setDifference",Vy=["typed","size","subset","compareNatural","Index","DenseMatrix"],Jy=(0,A.d5)(Uv,Vy,u=>{var{typed:i,size:o,subset:t,compareNatural:r,Index:s,DenseMatrix:p}=u;return i(Uv,{"Array | Matrix, Array | Matrix":function(v,m){var n;if(t(o(v),new s(0))===0)n=[];else{if(t(o(m),new s(0))===0)return(0,ze.xH)(v.toArray());var e=(0,ze.yV)((0,ze.xH)(Array.isArray(v)?v:v.toArray()).sort(r)),a=(0,ze.yV)((0,ze.xH)(Array.isArray(m)?m:m.toArray()).sort(r));n=[];for(var l,c=0;c<e.length;c++){l=!1;for(var f=0;f<a.length;f++)if(r(e[c].value,a[f].value)===0&&e[c].identifier===a[f].identifier){l=!0;break}l||n.push(e[c])}}return Array.isArray(v)&&Array.isArray(m)?(0,ze.D$)(n):new p((0,ze.D$)(n))}})}),Rv="setMultiplicity",Zy=["typed","size","subset","compareNatural","Index"],Ky=(0,A.d5)(Rv,Zy,u=>{var{typed:i,size:o,subset:t,compareNatural:r,Index:s}=u;return i(Rv,{"number | BigNumber | Fraction | Complex, Array | Matrix":function(d,v){if(t(o(v),new s(0))===0)return 0;for(var m=(0,ze.xH)(Array.isArray(v)?v:v.toArray()),n=0,e=0;e<m.length;e++)r(m[e],d)===0&&n++;return n}})}),Yy="Spa",Xy=["addScalar","equalScalar","FibonacciHeap"],Qy=(0,A.d5)(Yy,Xy,u=>{var{addScalar:i,equalScalar:o,FibonacciHeap:t}=u;function r(){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");this._values=[],this._heap=new t}return r.prototype.type="Spa",r.prototype.isSpa=!0,r.prototype.set=function(s,p){if(this._values[s])this._values[s].value=p;else{var d=this._heap.insert(s,p);this._values[s]=d}},r.prototype.get=function(s){var p=this._values[s];return p?p.value:0},r.prototype.accumulate=function(s,p){var d=this._values[s];d?d.value=i(d.value,p):(d=this._heap.insert(s,p),this._values[s]=d)},r.prototype.forEach=function(s,p,d){var v=this._heap,m=this._values,n=[],e=v.extractMinimum();for(e&&n.push(e);e&&e.key<=p;)e.key>=s&&(o(e.value,0)||d(e.key,e.value,this)),e=v.extractMinimum(),e&&n.push(e);for(var a=0;a<n.length;a++){var l=n[a];e=v.insert(l.key,l.value),m[e.key]=e}},r.prototype.swap=function(s,p){var d=this._values[s],v=this._values[p];if(!d&&v)d=this._heap.insert(s,v.value),this._heap.remove(v),this._values[s]=d,this._values[p]=void 0;else if(d&&!v)v=this._heap.insert(p,d.value),this._heap.remove(d),this._values[p]=v,this._values[s]=void 0;else if(d&&v){var m=d.value;d.value=v.value,v.value=m}},r},{isClass:!0}),Iv="sqrtm",jy=["typed","abs","add","multiply","sqrt","subtract","inv","size","max","identity"],e0=(0,A.d5)(Iv,jy,u=>{var{typed:i,abs:o,add:t,multiply:r,sqrt:s,subtract:p,inv:d,size:v,max:m,identity:n}=u,e=1e3,a=1e-6;function l(c){var f,b=0,w=c,E=n(v(c));do{var g=w;if(w=r(.5,t(g,d(E))),E=r(.5,t(E,d(g))),f=m(o(p(w,g))),f>a&&++b>e)throw new Error("computing square root of matrix: iterative method could not converge")}while(f>a);return w}return i(Iv,{"Array | Matrix":function(f){var b=(0,L.SW)(f)?f.size():(0,ze.aJ)(f);switch(b.length){case 1:if(b[0]===1)return s(f);throw new RangeError("Matrix must be square (size: "+(0,Jr.WU)(b)+")");case 2:{var w=b[0],E=b[1];if(w===E)return l(f);throw new RangeError("Matrix must be square (size: "+(0,Jr.WU)(b)+")")}default:throw new RangeError("Matrix must be at most two dimensional (size: "+(0,Jr.WU)(b)+")")}}})}),r0=ie(4942);function Fv(u,i){var o=Object.keys(u);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(u);i&&(t=t.filter(function(r){return Object.getOwnPropertyDescriptor(u,r).enumerable})),o.push.apply(o,t)}return o}function jf(u){for(var i=1;i<arguments.length;i++){var o=arguments[i]!=null?arguments[i]:{};i%2?Fv(Object(o),!0).forEach(function(t){(0,r0.Z)(u,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(o)):Fv(Object(o)).forEach(function(t){Object.defineProperty(u,t,Object.getOwnPropertyDescriptor(o,t))})}return u}var t0="Unit",n0=["?on","config","addScalar","subtract","multiplyScalar","divideScalar","pow","abs","fix","round","equal","isNumeric","format","number","Complex","BigNumber","Fraction"],a0=(0,A.d5)(t0,n0,u=>{var{on:i,config:o,addScalar:t,subtract:r,multiplyScalar:s,divideScalar:p,pow:d,abs:v,fix:m,round:n,equal:e,isNumeric:a,format:l,number:c,Complex:f,BigNumber:b,Fraction:w}=u,E=c;function g(H,Y){if(!(this instanceof g))throw new Error("Constructor must be called with the new operator");if(!(H==null||a(H)||(0,L.Mc)(H)))throw new TypeError("First parameter in Unit constructor must be number, BigNumber, Fraction, Complex, or undefined");if(Y!==void 0&&(typeof Y!="string"||Y===""))throw new TypeError("Second parameter in Unit constructor must be a string");if(Y!==void 0){var Ue=g.parse(Y);this.units=Ue.units,this.dimensions=Ue.dimensions}else{this.units=[{unit:Ve,prefix:I.NONE,power:0}],this.dimensions=[];for(var Ce=0;Ce<ve.length;Ce++)this.dimensions[Ce]=0}this.value=H!=null?this._normalize(H):null,this.fixPrefix=!1,this.skipAutomaticSimplification=!0}g.prototype.type="Unit",g.prototype.isUnit=!0;var S,N,h;function C(){for(;h===" "||h===" ";)M()}function O(H){return H>="0"&&H<="9"||H==="."}function T(H){return H>="0"&&H<="9"}function M(){N++,h=S.charAt(N)}function P(H){N=H,h=S.charAt(N)}function z(){var H="",Y=N;if(h==="+"?M():h==="-"&&(H+=h,M()),!O(h))return P(Y),null;if(h==="."){if(H+=h,M(),!T(h))return P(Y),null}else{for(;T(h);)H+=h,M();h==="."&&(H+=h,M())}for(;T(h);)H+=h,M();if(h==="E"||h==="e"){var Ue="",Ce=N;if(Ue+=h,M(),(h==="+"||h==="-")&&(Ue+=h,M()),!T(h))return P(Ce),H;for(H=H+Ue;T(h);)H+=h,M()}return H}function $(){for(var H="";T(h)||g.isValidAlpha(h);)H+=h,M();var Y=H.charAt(0);return g.isValidAlpha(Y)?H:null}function V(H){return h===H?(M(),H):null}g.parse=function(H,Y){if(Y=Y||{},S=H,N=-1,h="",typeof S!="string")throw new TypeError("Invalid argument in Unit.parse, string expected");var Ue=new g;Ue.units=[];var Ce=1,Xe=!1;M(),C();var mr=z(),Or=null;if(mr){if(o.number==="BigNumber")Or=new b(mr);else if(o.number==="Fraction")try{Or=new w(mr)}catch{Or=parseFloat(mr)}else Or=parseFloat(mr);C(),V("*")?(Ce=1,Xe=!0):V("/")&&(Ce=-1,Xe=!0)}for(var Gr=[],Yr=1;;){for(C();h==="(";)Gr.push(Ce),Yr*=Ce,Ce=1,M(),C();var dt=void 0;if(h){var st=h;if(dt=$(),dt===null)throw new SyntaxError('Unexpected "'+st+'" in "'+S+'" at index '+N.toString())}else break;var Et=te(dt);if(Et===null)throw new SyntaxError('Unit "'+dt+'" not found.');var Pt=Ce*Yr;if(C(),V("^")){C();var xn=z();if(xn===null)throw new SyntaxError('In "'+H+'", "^" must be followed by a floating-point number');Pt*=xn}Ue.units.push({unit:Et.unit,prefix:Et.prefix,power:Pt});for(var Lt=0;Lt<ve.length;Lt++)Ue.dimensions[Lt]+=(Et.unit.dimensions[Lt]||0)*Pt;for(C();h===")";){if(Gr.length===0)throw new SyntaxError('Unmatched ")" in "'+S+'" at index '+N.toString());Yr/=Gr.pop(),M(),C()}if(Xe=!1,V("*")?(Ce=1,Xe=!0):V("/")?(Ce=-1,Xe=!0):Ce=1,Et.unit.base){var En=Et.unit.base.key;De.auto[En]={unit:Et.unit,prefix:Et.prefix}}}if(C(),h)throw new SyntaxError('Could not parse: "'+H+'"');if(Xe)throw new SyntaxError('Trailing characters: "'+H+'"');if(Gr.length!==0)throw new SyntaxError('Unmatched "(" in "'+S+'"');if(Ue.units.length===0&&!Y.allowNoUnits)throw new SyntaxError('"'+H+'" contains no units');return Ue.value=Or!==void 0?Ue._normalize(Or):null,Ue},g.prototype.clone=function(){var H=new g;H.fixPrefix=this.fixPrefix,H.skipAutomaticSimplification=this.skipAutomaticSimplification,H.value=(0,Sr.d9)(this.value),H.dimensions=this.dimensions.slice(0),H.units=[];for(var Y=0;Y<this.units.length;Y++){H.units[Y]={};for(var Ue in this.units[Y])(0,Sr.nr)(this.units[Y],Ue)&&(H.units[Y][Ue]=this.units[Y][Ue])}return H},g.prototype._isDerived=function(){return this.units.length===0?!1:this.units.length>1||Math.abs(this.units[0].power-1)>1e-15},g.prototype._normalize=function(H){if(H==null||this.units.length===0)return H;for(var Y=H,Ue=g._getNumberConverter((0,L.kM)(H)),Ce=0;Ce<this.units.length;Ce++){var Xe=Ue(this.units[Ce].unit.value),mr=Ue(this.units[Ce].prefix.value),Or=Ue(this.units[Ce].power);Y=s(Y,d(s(Xe,mr),Or))}return Y},g.prototype._denormalize=function(H,Y){if(H==null||this.units.length===0)return H;for(var Ue=H,Ce=g._getNumberConverter((0,L.kM)(H)),Xe=0;Xe<this.units.length;Xe++){var mr=Ce(this.units[Xe].unit.value),Or=Ce(this.units[Xe].prefix.value),Gr=Ce(this.units[Xe].power);Ue=p(Ue,d(s(mr,Or),Gr))}return Ue};var te=(0,fe.HP)(H=>{if((0,Sr.nr)(re,H)){var Y=re[H],Ue=Y.prefixes[""];return{unit:Y,prefix:Ue}}for(var Ce in re)if((0,Sr.nr)(re,Ce)&&(0,Jr.pn)(H,Ce)){var Xe=re[Ce],mr=H.length-Ce.length,Or=H.substring(0,mr),Gr=(0,Sr.nr)(Xe.prefixes,Or)?Xe.prefixes[Or]:void 0;if(Gr!==void 0)return{unit:Xe,prefix:Gr}}return null},{hasher:H=>H[0],limit:100});g.isValuelessUnit=function(H){return te(H)!==null},g.prototype.hasBase=function(H){if(typeof H=="string"&&(H=B[H]),!H)return!1;for(var Y=0;Y<ve.length;Y++)if(Math.abs((this.dimensions[Y]||0)-(H.dimensions[Y]||0))>1e-12)return!1;return!0},g.prototype.equalBase=function(H){for(var Y=0;Y<ve.length;Y++)if(Math.abs((this.dimensions[Y]||0)-(H.dimensions[Y]||0))>1e-12)return!1;return!0},g.prototype.equals=function(H){return this.equalBase(H)&&e(this.value,H.value)},g.prototype.multiply=function(H){for(var Y=this.clone(),Ue=0;Ue<ve.length;Ue++)Y.dimensions[Ue]=(this.dimensions[Ue]||0)+(H.dimensions[Ue]||0);for(var Ce=0;Ce<H.units.length;Ce++){var Xe=jf({},H.units[Ce]);Y.units.push(Xe)}if(this.value!==null||H.value!==null){var mr=this.value===null?this._normalize(1):this.value,Or=H.value===null?H._normalize(1):H.value;Y.value=s(mr,Or)}else Y.value=null;return Y.skipAutomaticSimplification=!1,K(Y)},g.prototype.divide=function(H){for(var Y=this.clone(),Ue=0;Ue<ve.length;Ue++)Y.dimensions[Ue]=(this.dimensions[Ue]||0)-(H.dimensions[Ue]||0);for(var Ce=0;Ce<H.units.length;Ce++){var Xe=jf(jf({},H.units[Ce]),{},{power:-H.units[Ce].power});Y.units.push(Xe)}if(this.value!==null||H.value!==null){var mr=this.value===null?this._normalize(1):this.value,Or=H.value===null?H._normalize(1):H.value;Y.value=p(mr,Or)}else Y.value=null;return Y.skipAutomaticSimplification=!1,K(Y)},g.prototype.pow=function(H){for(var Y=this.clone(),Ue=0;Ue<ve.length;Ue++)Y.dimensions[Ue]=(this.dimensions[Ue]||0)*H;for(var Ce=0;Ce<Y.units.length;Ce++)Y.units[Ce].power*=H;return Y.value!==null?Y.value=d(Y.value,H):Y.value=null,Y.skipAutomaticSimplification=!1,K(Y)};function K(H){return H.equalBase(B.NONE)&&H.value!==null&&!o.predictable?H.value:H}g.prototype.abs=function(){var H=this.clone();if(H.value!==null)if(H._isDerived()||H.units[0].unit.offset===0)H.value=v(H.value);else{var Y=g._getNumberConverter((0,L.kM)(H.value)),Ue=Y(H.units[0].unit.value),Ce=Y(H.units[0].unit.offset),Xe=s(Ue,Ce);H.value=r(v(t(H.value,Xe)),Xe)}for(var mr in H.units)(H.units[mr].unit.name==="VA"||H.units[mr].unit.name==="VAR")&&(H.units[mr].unit=re.W);return H},g.prototype.to=function(H){var Y=this.value===null?this._normalize(1):this.value,Ue;if(typeof H=="string")Ue=g.parse(H);else if((0,L.wr)(H))Ue=H.clone();else throw new Error("String or Unit expected as parameter");if(!this.equalBase(Ue))throw new Error("Units do not match ('".concat(Ue.toString(),"' != '").concat(this.toString(),"')"));if(Ue.value!==null)throw new Error("Cannot convert to a unit with a value");if(this.value===null||this._isDerived()||this.units[0].unit.offset===Ue.units[0].unit.offset)Ue.value=(0,Sr.d9)(Y);else{var Ce=g._getNumberConverter((0,L.kM)(Y)),Xe=Ce(this.units[0].unit.value),mr=Ce(this.units[0].unit.offset),Or=s(Xe,mr),Gr=Ce(Ue.units[0].unit.value),Yr=Ce(Ue.units[0].unit.offset),dt=s(Gr,Yr);Ue.value=r(t(Y,Or),dt)}return Ue.fixPrefix=!0,Ue.skipAutomaticSimplification=!0,Ue},g.prototype.toNumber=function(H){return E(this.toNumeric(H))},g.prototype.toNumeric=function(H){var Y;return H?Y=this.to(H):Y=this.clone(),Y._isDerived()||Y.units.length===0?Y._denormalize(Y.value):Y._denormalize(Y.value,Y.units[0].prefix.value)},g.prototype.toString=function(){return this.format()},g.prototype.toJSON=function(){return{mathjs:"Unit",value:this._denormalize(this.value),unit:this.formatUnits(),fixPrefix:this.fixPrefix}},g.fromJSON=function(H){var Y=new g(H.value,H.unit);return Y.fixPrefix=H.fixPrefix||!1,Y},g.prototype.valueOf=g.prototype.toString,g.prototype.simplify=function(){var H=this.clone(),Y=[],Ue;for(var Ce in Ke)if((0,Sr.nr)(Ke,Ce)&&H.hasBase(B[Ce])){Ue=Ce;break}if(Ue==="NONE")H.units=[];else{var Xe;if(Ue&&(0,Sr.nr)(Ke,Ue)&&(Xe=Ke[Ue]),Xe)H.units=[{unit:Xe.unit,prefix:Xe.prefix,power:1}];else{for(var mr=!1,Or=0;Or<ve.length;Or++){var Gr=ve[Or];Math.abs(H.dimensions[Or]||0)>1e-12&&((0,Sr.nr)(Ke,Gr)?Y.push({unit:Ke[Gr].unit,prefix:Ke[Gr].prefix,power:H.dimensions[Or]||0}):mr=!0)}Y.length<H.units.length&&!mr&&(H.units=Y)}}return H},g.prototype.toSI=function(){for(var H=this.clone(),Y=[],Ue=0;Ue<ve.length;Ue++){var Ce=ve[Ue];if(Math.abs(H.dimensions[Ue]||0)>1e-12)if((0,Sr.nr)(De.si,Ce))Y.push({unit:De.si[Ce].unit,prefix:De.si[Ce].prefix,power:H.dimensions[Ue]||0});else throw new Error("Cannot express custom unit "+Ce+" in SI units")}return H.units=Y,H.fixPrefix=!0,H.skipAutomaticSimplification=!0,H},g.prototype.formatUnits=function(){for(var H="",Y="",Ue=0,Ce=0,Xe=0;Xe<this.units.length;Xe++)this.units[Xe].power>0?(Ue++,H+=" "+this.units[Xe].prefix.name+this.units[Xe].unit.name,Math.abs(this.units[Xe].power-1)>1e-15&&(H+="^"+this.units[Xe].power)):this.units[Xe].power<0&&Ce++;if(Ce>0)for(var mr=0;mr<this.units.length;mr++)this.units[mr].power<0&&(Ue>0?(Y+=" "+this.units[mr].prefix.name+this.units[mr].unit.name,Math.abs(this.units[mr].power+1)>1e-15&&(Y+="^"+-this.units[mr].power)):(Y+=" "+this.units[mr].prefix.name+this.units[mr].unit.name,Y+="^"+this.units[mr].power));H=H.substr(1),Y=Y.substr(1),Ue>1&&Ce>0&&(H="("+H+")"),Ce>1&&Ue>0&&(Y="("+Y+")");var Or=H;return Ue>0&&Ce>0&&(Or+=" / "),Or+=Y,Or},g.prototype.format=function(H){var Y=this.skipAutomaticSimplification||this.value===null?this.clone():this.simplify(),Ue=!1;typeof Y.value<"u"&&Y.value!==null&&(0,L.Mc)(Y.value)&&(Ue=Math.abs(Y.value.re)<1e-14);for(var Ce in Y.units)(0,Sr.nr)(Y.units,Ce)&&Y.units[Ce].unit&&(Y.units[Ce].unit.name==="VA"&&Ue?Y.units[Ce].unit=re.VAR:Y.units[Ce].unit.name==="VAR"&&!Ue&&(Y.units[Ce].unit=re.VA));Y.units.length===1&&!Y.fixPrefix&&Math.abs(Y.units[0].power-Math.round(Y.units[0].power))<1e-14&&(Y.units[0].prefix=Y._bestPrefix());var Xe=Y._denormalize(Y.value),mr=Y.value!==null?l(Xe,H||{}):"",Or=Y.formatUnits();return Y.value&&(0,L.Mc)(Y.value)&&(mr="("+mr+")"),Or.length>0&&mr.length>0&&(mr+=" "),mr+=Or,mr},g.prototype._bestPrefix=function(){if(this.units.length!==1)throw new Error("Can only compute the best prefix for single units with integer powers, like kg, s^2, N^-1, and so forth!");if(Math.abs(this.units[0].power-Math.round(this.units[0].power))>=1e-14)throw new Error("Can only compute the best prefix for single units with integer powers, like kg, s^2, N^-1, and so forth!");var H=this.value!==null?v(this.value):0,Y=v(this.units[0].unit.value),Ue=this.units[0].prefix;if(H===0)return Ue;var Ce=this.units[0].power,Xe=Math.log(H/Math.pow(Ue.value*Y,Ce))/Math.LN10-1.2;if(Xe>-2.200001&&Xe<1.800001)return Ue;Xe=Math.abs(Xe);var mr=this.units[0].unit.prefixes;for(var Or in mr)if((0,Sr.nr)(mr,Or)){var Gr=mr[Or];if(Gr.scientific){var Yr=Math.abs(Math.log(H/Math.pow(Gr.value*Y,Ce))/Math.LN10-1.2);(Yr<Xe||Yr===Xe&&Gr.name.length<Ue.name.length)&&(Ue=Gr,Xe=Yr)}}return Ue},g.prototype.splitUnit=function(H){for(var Y=this.clone(),Ue=[],Ce=0;Ce<H.length&&(Y=Y.to(H[Ce]),Ce!==H.length-1);Ce++){var Xe=Y.toNumeric(),mr=n(Xe),Or=void 0,Gr=e(mr,Xe);Gr?Or=mr:Or=m(Y.toNumeric());var Yr=new g(Or,H[Ce].toString());Ue.push(Yr),Y=r(Y,Yr)}for(var dt=0,st=0;st<Ue.length;st++)dt=t(dt,Ue[st].value);return e(dt,this.value)&&(Y.value=0),Ue.push(Y),Ue};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:1e12,scientific:!0},P:{name:"P",value:1e15,scientific:!0},E:{name:"E",value:1e18,scientific:!0},Z:{name:"Z",value:1e21,scientific:!0},Y:{name:"Y",value:1e24,scientific:!0},d:{name:"d",value:.1,scientific:!1},c:{name:"c",value:.01,scientific:!1},m:{name:"m",value:.001,scientific:!0},u:{name:"u",value:1e-6,scientific:!0},n:{name:"n",value:1e-9,scientific:!0},p:{name:"p",value:1e-12,scientific:!0},f:{name:"f",value:1e-15,scientific:!0},a:{name:"a",value:1e-18,scientific:!0},z:{name:"z",value:1e-21,scientific:!0},y:{name:"y",value:1e-24,scientific:!0}},LONG:{"":{name:"",value:1,scientific:!0},deca:{name:"deca",value:10,scientific:!1},hecto:{name:"hecto",value:100,scientific:!1},kilo:{name:"kilo",value:1e3,scientific:!0},mega:{name:"mega",value:1e6,scientific:!0},giga:{name:"giga",value:1e9,scientific:!0},tera:{name:"tera",value:1e12,scientific:!0},peta:{name:"peta",value:1e15,scientific:!0},exa:{name:"exa",value:1e18,scientific:!0},zetta:{name:"zetta",value:1e21,scientific:!0},yotta:{name:"yotta",value:1e24,scientific:!0},deci:{name:"deci",value:.1,scientific:!1},centi:{name:"centi",value:.01,scientific:!1},milli:{name:"milli",value:.001,scientific:!0},micro:{name:"micro",value:1e-6,scientific:!0},nano:{name:"nano",value:1e-9,scientific:!0},pico:{name:"pico",value:1e-12,scientific:!0},femto:{name:"femto",value:1e-15,scientific:!0},atto:{name:"atto",value:1e-18,scientific:!0},zepto:{name:"zepto",value:1e-21,scientific:!0},yocto:{name:"yocto",value:1e-24,scientific:!0}},SQUARED:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:100,scientific:!1},h:{name:"h",value:1e4,scientific:!1},k:{name:"k",value:1e6,scientific:!0},M:{name:"M",value:1e12,scientific:!0},G:{name:"G",value:1e18,scientific:!0},T:{name:"T",value:1e24,scientific:!0},P:{name:"P",value:1e30,scientific:!0},E:{name:"E",value:1e36,scientific:!0},Z:{name:"Z",value:1e42,scientific:!0},Y:{name:"Y",value:1e48,scientific:!0},d:{name:"d",value:.01,scientific:!1},c:{name:"c",value:1e-4,scientific:!1},m:{name:"m",value:1e-6,scientific:!0},u:{name:"u",value:1e-12,scientific:!0},n:{name:"n",value:1e-18,scientific:!0},p:{name:"p",value:1e-24,scientific:!0},f:{name:"f",value:1e-30,scientific:!0},a:{name:"a",value:1e-36,scientific:!0},z:{name:"z",value:1e-42,scientific:!0},y:{name:"y",value:1e-48,scientific:!0}},CUBIC:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:1e3,scientific:!1},h:{name:"h",value:1e6,scientific:!1},k:{name:"k",value:1e9,scientific:!0},M:{name:"M",value:1e18,scientific:!0},G:{name:"G",value:1e27,scientific:!0},T:{name:"T",value:1e36,scientific:!0},P:{name:"P",value:1e45,scientific:!0},E:{name:"E",value:1e54,scientific:!0},Z:{name:"Z",value:1e63,scientific:!0},Y:{name:"Y",value:1e72,scientific:!0},d:{name:"d",value:.001,scientific:!1},c:{name:"c",value:1e-6,scientific:!1},m:{name:"m",value:1e-9,scientific:!0},u:{name:"u",value:1e-18,scientific:!0},n:{name:"n",value:1e-27,scientific:!0},p:{name:"p",value:1e-36,scientific:!0},f:{name:"f",value:1e-45,scientific:!0},a:{name:"a",value:1e-54,scientific:!0},z:{name:"z",value:1e-63,scientific:!0},y:{name:"y",value:1e-72,scientific:!0}},BINARY_SHORT_SI:{"":{name:"",value:1,scientific:!0},k:{name:"k",value:1e3,scientific:!0},M:{name:"M",value:1e6,scientific:!0},G:{name:"G",value:1e9,scientific:!0},T:{name:"T",value:1e12,scientific:!0},P:{name:"P",value:1e15,scientific:!0},E:{name:"E",value:1e18,scientific:!0},Z:{name:"Z",value:1e21,scientific:!0},Y:{name:"Y",value:1e24,scientific:!0}},BINARY_SHORT_IEC:{"":{name:"",value:1,scientific:!0},Ki:{name:"Ki",value:1024,scientific:!0},Mi:{name:"Mi",value:Math.pow(1024,2),scientific:!0},Gi:{name:"Gi",value:Math.pow(1024,3),scientific:!0},Ti:{name:"Ti",value:Math.pow(1024,4),scientific:!0},Pi:{name:"Pi",value:Math.pow(1024,5),scientific:!0},Ei:{name:"Ei",value:Math.pow(1024,6),scientific:!0},Zi:{name:"Zi",value:Math.pow(1024,7),scientific:!0},Yi:{name:"Yi",value:Math.pow(1024,8),scientific:!0}},BINARY_LONG_SI:{"":{name:"",value:1,scientific:!0},kilo:{name:"kilo",value:1e3,scientific:!0},mega:{name:"mega",value:1e6,scientific:!0},giga:{name:"giga",value:1e9,scientific:!0},tera:{name:"tera",value:1e12,scientific:!0},peta:{name:"peta",value:1e15,scientific:!0},exa:{name:"exa",value:1e18,scientific:!0},zetta:{name:"zetta",value:1e21,scientific:!0},yotta:{name:"yotta",value:1e24,scientific:!0}},BINARY_LONG_IEC:{"":{name:"",value:1,scientific:!0},kibi:{name:"kibi",value:1024,scientific:!0},mebi:{name:"mebi",value:Math.pow(1024,2),scientific:!0},gibi:{name:"gibi",value:Math.pow(1024,3),scientific:!0},tebi:{name:"tebi",value:Math.pow(1024,4),scientific:!0},pebi:{name:"pebi",value:Math.pow(1024,5),scientific:!0},exi:{name:"exi",value:Math.pow(1024,6),scientific:!0},zebi:{name:"zebi",value:Math.pow(1024,7),scientific:!0},yobi:{name:"yobi",value:Math.pow(1024,8),scientific:!0}},BTU:{"":{name:"",value:1,scientific:!0},MM:{name:"MM",value:1e6,scientific:!0}}};I.SHORTLONG=(0,vs.Z)({},I.SHORT,I.LONG),I.BINARY_SHORT=(0,vs.Z)({},I.BINARY_SHORT_SI,I.BINARY_SHORT_IEC),I.BINARY_LONG=(0,vs.Z)({},I.BINARY_LONG_SI,I.BINARY_LONG_IEC);var ve=["MASS","LENGTH","TIME","CURRENT","TEMPERATURE","LUMINOUS_INTENSITY","AMOUNT_OF_SUBSTANCE","ANGLE","BIT"],B={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 j in B)(0,Sr.nr)(B,j)&&(B[j].key=j);var ye={},Ve={name:"",base:ye,value:1,offset:0,dimensions:ve.map(H=>0)},re={meter:{name:"meter",base:B.LENGTH,prefixes:I.LONG,value:1,offset:0},inch:{name:"inch",base:B.LENGTH,prefixes:I.NONE,value:.0254,offset:0},foot:{name:"foot",base:B.LENGTH,prefixes:I.NONE,value:.3048,offset:0},yard:{name:"yard",base:B.LENGTH,prefixes:I.NONE,value:.9144,offset:0},mile:{name:"mile",base:B.LENGTH,prefixes:I.NONE,value:1609.344,offset:0},link:{name:"link",base:B.LENGTH,prefixes:I.NONE,value:.201168,offset:0},rod:{name:"rod",base:B.LENGTH,prefixes:I.NONE,value:5.0292,offset:0},chain:{name:"chain",base:B.LENGTH,prefixes:I.NONE,value:20.1168,offset:0},angstrom:{name:"angstrom",base:B.LENGTH,prefixes:I.NONE,value:1e-10,offset:0},m:{name:"m",base:B.LENGTH,prefixes:I.SHORT,value:1,offset:0},in:{name:"in",base:B.LENGTH,prefixes:I.NONE,value:.0254,offset:0},ft:{name:"ft",base:B.LENGTH,prefixes:I.NONE,value:.3048,offset:0},yd:{name:"yd",base:B.LENGTH,prefixes:I.NONE,value:.9144,offset:0},mi:{name:"mi",base:B.LENGTH,prefixes:I.NONE,value:1609.344,offset:0},li:{name:"li",base:B.LENGTH,prefixes:I.NONE,value:.201168,offset:0},rd:{name:"rd",base:B.LENGTH,prefixes:I.NONE,value:5.02921,offset:0},ch:{name:"ch",base:B.LENGTH,prefixes:I.NONE,value:20.1168,offset:0},mil:{name:"mil",base:B.LENGTH,prefixes:I.NONE,value:254e-7,offset:0},m2:{name:"m2",base:B.SURFACE,prefixes:I.SQUARED,value:1,offset:0},sqin:{name:"sqin",base:B.SURFACE,prefixes:I.NONE,value:64516e-8,offset:0},sqft:{name:"sqft",base:B.SURFACE,prefixes:I.NONE,value:.09290304,offset:0},sqyd:{name:"sqyd",base:B.SURFACE,prefixes:I.NONE,value:.83612736,offset:0},sqmi:{name:"sqmi",base:B.SURFACE,prefixes:I.NONE,value:2589988110336e-6,offset:0},sqrd:{name:"sqrd",base:B.SURFACE,prefixes:I.NONE,value:25.29295,offset:0},sqch:{name:"sqch",base:B.SURFACE,prefixes:I.NONE,value:404.6873,offset:0},sqmil:{name:"sqmil",base:B.SURFACE,prefixes:I.NONE,value:64516e-14,offset:0},acre:{name:"acre",base:B.SURFACE,prefixes:I.NONE,value:4046.86,offset:0},hectare:{name:"hectare",base:B.SURFACE,prefixes:I.NONE,value:1e4,offset:0},m3:{name:"m3",base:B.VOLUME,prefixes:I.CUBIC,value:1,offset:0},L:{name:"L",base:B.VOLUME,prefixes:I.SHORT,value:.001,offset:0},l:{name:"l",base:B.VOLUME,prefixes:I.SHORT,value:.001,offset:0},litre:{name:"litre",base:B.VOLUME,prefixes:I.LONG,value:.001,offset:0},cuin:{name:"cuin",base:B.VOLUME,prefixes:I.NONE,value:16387064e-12,offset:0},cuft:{name:"cuft",base:B.VOLUME,prefixes:I.NONE,value:.028316846592,offset:0},cuyd:{name:"cuyd",base:B.VOLUME,prefixes:I.NONE,value:.764554857984,offset:0},teaspoon:{name:"teaspoon",base:B.VOLUME,prefixes:I.NONE,value:5e-6,offset:0},tablespoon:{name:"tablespoon",base:B.VOLUME,prefixes:I.NONE,value:15e-6,offset:0},drop:{name:"drop",base:B.VOLUME,prefixes:I.NONE,value:5e-8,offset:0},gtt:{name:"gtt",base:B.VOLUME,prefixes:I.NONE,value:5e-8,offset:0},minim:{name:"minim",base:B.VOLUME,prefixes:I.NONE,value:6161152e-14,offset:0},fluiddram:{name:"fluiddram",base:B.VOLUME,prefixes:I.NONE,value:36966911e-13,offset:0},fluidounce:{name:"fluidounce",base:B.VOLUME,prefixes:I.NONE,value:2957353e-11,offset:0},gill:{name:"gill",base:B.VOLUME,prefixes:I.NONE,value:.0001182941,offset:0},cc:{name:"cc",base:B.VOLUME,prefixes:I.NONE,value:1e-6,offset:0},cup:{name:"cup",base:B.VOLUME,prefixes:I.NONE,value:.0002365882,offset:0},pint:{name:"pint",base:B.VOLUME,prefixes:I.NONE,value:.0004731765,offset:0},quart:{name:"quart",base:B.VOLUME,prefixes:I.NONE,value:.0009463529,offset:0},gallon:{name:"gallon",base:B.VOLUME,prefixes:I.NONE,value:.003785412,offset:0},beerbarrel:{name:"beerbarrel",base:B.VOLUME,prefixes:I.NONE,value:.1173478,offset:0},oilbarrel:{name:"oilbarrel",base:B.VOLUME,prefixes:I.NONE,value:.1589873,offset:0},hogshead:{name:"hogshead",base:B.VOLUME,prefixes:I.NONE,value:.238481,offset:0},fldr:{name:"fldr",base:B.VOLUME,prefixes:I.NONE,value:36966911e-13,offset:0},floz:{name:"floz",base:B.VOLUME,prefixes:I.NONE,value:2957353e-11,offset:0},gi:{name:"gi",base:B.VOLUME,prefixes:I.NONE,value:.0001182941,offset:0},cp:{name:"cp",base:B.VOLUME,prefixes:I.NONE,value:.0002365882,offset:0},pt:{name:"pt",base:B.VOLUME,prefixes:I.NONE,value:.0004731765,offset:0},qt:{name:"qt",base:B.VOLUME,prefixes:I.NONE,value:.0009463529,offset:0},gal:{name:"gal",base:B.VOLUME,prefixes:I.NONE,value:.003785412,offset:0},bbl:{name:"bbl",base:B.VOLUME,prefixes:I.NONE,value:.1173478,offset:0},obl:{name:"obl",base:B.VOLUME,prefixes:I.NONE,value:.1589873,offset:0},g:{name:"g",base:B.MASS,prefixes:I.SHORT,value:.001,offset:0},gram:{name:"gram",base:B.MASS,prefixes:I.LONG,value:.001,offset:0},ton:{name:"ton",base:B.MASS,prefixes:I.SHORT,value:907.18474,offset:0},t:{name:"t",base:B.MASS,prefixes:I.SHORT,value:1e3,offset:0},tonne:{name:"tonne",base:B.MASS,prefixes:I.LONG,value:1e3,offset:0},grain:{name:"grain",base:B.MASS,prefixes:I.NONE,value:6479891e-11,offset:0},dram:{name:"dram",base:B.MASS,prefixes:I.NONE,value:.0017718451953125,offset:0},ounce:{name:"ounce",base:B.MASS,prefixes:I.NONE,value:.028349523125,offset:0},poundmass:{name:"poundmass",base:B.MASS,prefixes:I.NONE,value:.45359237,offset:0},hundredweight:{name:"hundredweight",base:B.MASS,prefixes:I.NONE,value:45.359237,offset:0},stick:{name:"stick",base:B.MASS,prefixes:I.NONE,value:.115,offset:0},stone:{name:"stone",base:B.MASS,prefixes:I.NONE,value:6.35029318,offset:0},gr:{name:"gr",base:B.MASS,prefixes:I.NONE,value:6479891e-11,offset:0},dr:{name:"dr",base:B.MASS,prefixes:I.NONE,value:.0017718451953125,offset:0},oz:{name:"oz",base:B.MASS,prefixes:I.NONE,value:.028349523125,offset:0},lbm:{name:"lbm",base:B.MASS,prefixes:I.NONE,value:.45359237,offset:0},cwt:{name:"cwt",base:B.MASS,prefixes:I.NONE,value:45.359237,offset:0},s:{name:"s",base:B.TIME,prefixes:I.SHORT,value:1,offset:0},min:{name:"min",base:B.TIME,prefixes:I.NONE,value:60,offset:0},h:{name:"h",base:B.TIME,prefixes:I.NONE,value:3600,offset:0},second:{name:"second",base:B.TIME,prefixes:I.LONG,value:1,offset:0},sec:{name:"sec",base:B.TIME,prefixes:I.LONG,value:1,offset:0},minute:{name:"minute",base:B.TIME,prefixes:I.NONE,value:60,offset:0},hour:{name:"hour",base:B.TIME,prefixes:I.NONE,value:3600,offset:0},day:{name:"day",base:B.TIME,prefixes:I.NONE,value:86400,offset:0},week:{name:"week",base:B.TIME,prefixes:I.NONE,value:7*86400,offset:0},month:{name:"month",base:B.TIME,prefixes:I.NONE,value:2629800,offset:0},year:{name:"year",base:B.TIME,prefixes:I.NONE,value:31557600,offset:0},decade:{name:"decade",base:B.TIME,prefixes:I.NONE,value:315576e3,offset:0},century:{name:"century",base:B.TIME,prefixes:I.NONE,value:315576e4,offset:0},millennium:{name:"millennium",base:B.TIME,prefixes:I.NONE,value:315576e5,offset:0},hertz:{name:"Hertz",base:B.FREQUENCY,prefixes:I.LONG,value:1,offset:0,reciprocal:!0},Hz:{name:"Hz",base:B.FREQUENCY,prefixes:I.SHORT,value:1,offset:0,reciprocal:!0},rad:{name:"rad",base:B.ANGLE,prefixes:I.SHORT,value:1,offset:0},radian:{name:"radian",base:B.ANGLE,prefixes:I.LONG,value:1,offset:0},deg:{name:"deg",base:B.ANGLE,prefixes:I.SHORT,value:null,offset:0},degree:{name:"degree",base:B.ANGLE,prefixes:I.LONG,value:null,offset:0},grad:{name:"grad",base:B.ANGLE,prefixes:I.SHORT,value:null,offset:0},gradian:{name:"gradian",base:B.ANGLE,prefixes:I.LONG,value:null,offset:0},cycle:{name:"cycle",base:B.ANGLE,prefixes:I.NONE,value:null,offset:0},arcsec:{name:"arcsec",base:B.ANGLE,prefixes:I.NONE,value:null,offset:0},arcmin:{name:"arcmin",base:B.ANGLE,prefixes:I.NONE,value:null,offset:0},A:{name:"A",base:B.CURRENT,prefixes:I.SHORT,value:1,offset:0},ampere:{name:"ampere",base:B.CURRENT,prefixes:I.LONG,value:1,offset:0},K:{name:"K",base:B.TEMPERATURE,prefixes:I.NONE,value:1,offset:0},degC:{name:"degC",base:B.TEMPERATURE,prefixes:I.NONE,value:1,offset:273.15},degF:{name:"degF",base:B.TEMPERATURE,prefixes:I.NONE,value:1/1.8,offset:459.67},degR:{name:"degR",base:B.TEMPERATURE,prefixes:I.NONE,value:1/1.8,offset:0},kelvin:{name:"kelvin",base:B.TEMPERATURE,prefixes:I.NONE,value:1,offset:0},celsius:{name:"celsius",base:B.TEMPERATURE,prefixes:I.NONE,value:1,offset:273.15},fahrenheit:{name:"fahrenheit",base:B.TEMPERATURE,prefixes:I.NONE,value:1/1.8,offset:459.67},rankine:{name:"rankine",base:B.TEMPERATURE,prefixes:I.NONE,value:1/1.8,offset:0},mol:{name:"mol",base:B.AMOUNT_OF_SUBSTANCE,prefixes:I.SHORT,value:1,offset:0},mole:{name:"mole",base:B.AMOUNT_OF_SUBSTANCE,prefixes:I.LONG,value:1,offset:0},cd:{name:"cd",base:B.LUMINOUS_INTENSITY,prefixes:I.SHORT,value:1,offset:0},candela:{name:"candela",base:B.LUMINOUS_INTENSITY,prefixes:I.LONG,value:1,offset:0},N:{name:"N",base:B.FORCE,prefixes:I.SHORT,value:1,offset:0},newton:{name:"newton",base:B.FORCE,prefixes:I.LONG,value:1,offset:0},dyn:{name:"dyn",base:B.FORCE,prefixes:I.SHORT,value:1e-5,offset:0},dyne:{name:"dyne",base:B.FORCE,prefixes:I.LONG,value:1e-5,offset:0},lbf:{name:"lbf",base:B.FORCE,prefixes:I.NONE,value:4.4482216152605,offset:0},poundforce:{name:"poundforce",base:B.FORCE,prefixes:I.NONE,value:4.4482216152605,offset:0},kip:{name:"kip",base:B.FORCE,prefixes:I.LONG,value:4448.2216,offset:0},kilogramforce:{name:"kilogramforce",base:B.FORCE,prefixes:I.NONE,value:9.80665,offset:0},J:{name:"J",base:B.ENERGY,prefixes:I.SHORT,value:1,offset:0},joule:{name:"joule",base:B.ENERGY,prefixes:I.SHORT,value:1,offset:0},erg:{name:"erg",base:B.ENERGY,prefixes:I.NONE,value:1e-7,offset:0},Wh:{name:"Wh",base:B.ENERGY,prefixes:I.SHORT,value:3600,offset:0},BTU:{name:"BTU",base:B.ENERGY,prefixes:I.BTU,value:1055.05585262,offset:0},eV:{name:"eV",base:B.ENERGY,prefixes:I.SHORT,value:1602176565e-28,offset:0},electronvolt:{name:"electronvolt",base:B.ENERGY,prefixes:I.LONG,value:1602176565e-28,offset:0},W:{name:"W",base:B.POWER,prefixes:I.SHORT,value:1,offset:0},watt:{name:"watt",base:B.POWER,prefixes:I.LONG,value:1,offset:0},hp:{name:"hp",base:B.POWER,prefixes:I.NONE,value:745.6998715386,offset:0},VAR:{name:"VAR",base:B.POWER,prefixes:I.SHORT,value:f.I,offset:0},VA:{name:"VA",base:B.POWER,prefixes:I.SHORT,value:1,offset:0},Pa:{name:"Pa",base:B.PRESSURE,prefixes:I.SHORT,value:1,offset:0},psi:{name:"psi",base:B.PRESSURE,prefixes:I.NONE,value:6894.75729276459,offset:0},atm:{name:"atm",base:B.PRESSURE,prefixes:I.NONE,value:101325,offset:0},bar:{name:"bar",base:B.PRESSURE,prefixes:I.SHORTLONG,value:1e5,offset:0},torr:{name:"torr",base:B.PRESSURE,prefixes:I.NONE,value:133.322,offset:0},mmHg:{name:"mmHg",base:B.PRESSURE,prefixes:I.NONE,value:133.322,offset:0},mmH2O:{name:"mmH2O",base:B.PRESSURE,prefixes:I.NONE,value:9.80665,offset:0},cmH2O:{name:"cmH2O",base:B.PRESSURE,prefixes:I.NONE,value:98.0665,offset:0},coulomb:{name:"coulomb",base:B.ELECTRIC_CHARGE,prefixes:I.LONG,value:1,offset:0},C:{name:"C",base:B.ELECTRIC_CHARGE,prefixes:I.SHORT,value:1,offset:0},farad:{name:"farad",base:B.ELECTRIC_CAPACITANCE,prefixes:I.LONG,value:1,offset:0},F:{name:"F",base:B.ELECTRIC_CAPACITANCE,prefixes:I.SHORT,value:1,offset:0},volt:{name:"volt",base:B.ELECTRIC_POTENTIAL,prefixes:I.LONG,value:1,offset:0},V:{name:"V",base:B.ELECTRIC_POTENTIAL,prefixes:I.SHORT,value:1,offset:0},ohm:{name:"ohm",base:B.ELECTRIC_RESISTANCE,prefixes:I.SHORTLONG,value:1,offset:0},henry:{name:"henry",base:B.ELECTRIC_INDUCTANCE,prefixes:I.LONG,value:1,offset:0},H:{name:"H",base:B.ELECTRIC_INDUCTANCE,prefixes:I.SHORT,value:1,offset:0},siemens:{name:"siemens",base:B.ELECTRIC_CONDUCTANCE,prefixes:I.LONG,value:1,offset:0},S:{name:"S",base:B.ELECTRIC_CONDUCTANCE,prefixes:I.SHORT,value:1,offset:0},weber:{name:"weber",base:B.MAGNETIC_FLUX,prefixes:I.LONG,value:1,offset:0},Wb:{name:"Wb",base:B.MAGNETIC_FLUX,prefixes:I.SHORT,value:1,offset:0},tesla:{name:"tesla",base:B.MAGNETIC_FLUX_DENSITY,prefixes:I.LONG,value:1,offset:0},T:{name:"T",base:B.MAGNETIC_FLUX_DENSITY,prefixes:I.SHORT,value:1,offset:0},b:{name:"b",base:B.BIT,prefixes:I.BINARY_SHORT,value:1,offset:0},bits:{name:"bits",base:B.BIT,prefixes:I.BINARY_LONG,value:1,offset:0},B:{name:"B",base:B.BIT,prefixes:I.BINARY_SHORT,value:8,offset:0},bytes:{name:"bytes",base:B.BIT,prefixes:I.BINARY_LONG,value:8,offset:0}},be={meters:"meter",inches:"inch",feet:"foot",yards:"yard",miles:"mile",links:"link",rods:"rod",chains:"chain",angstroms:"angstrom",lt:"l",litres:"litre",liter:"litre",liters:"litre",teaspoons:"teaspoon",tablespoons:"tablespoon",minims:"minim",fluiddrams:"fluiddram",fluidounces:"fluidounce",gills:"gill",cups:"cup",pints:"pint",quarts:"quart",gallons:"gallon",beerbarrels:"beerbarrel",oilbarrels:"oilbarrel",hogsheads:"hogshead",gtts:"gtt",grams:"gram",tons:"ton",tonnes:"tonne",grains:"grain",drams:"dram",ounces:"ounce",poundmasses:"poundmass",hundredweights:"hundredweight",sticks:"stick",lb:"lbm",lbs:"lbm",kips:"kip",kgf:"kilogramforce",acres:"acre",hectares:"hectare",sqfeet:"sqft",sqyard:"sqyd",sqmile:"sqmi",sqmiles:"sqmi",mmhg:"mmHg",mmh2o:"mmH2O",cmh2o:"cmH2O",seconds:"second",secs:"second",minutes:"minute",mins:"minute",hours:"hour",hr:"hour",hrs:"hour",days:"day",weeks:"week",months:"month",years:"year",decades:"decade",centuries:"century",millennia:"millennium",hertz:"hertz",radians:"radian",degrees:"degree",gradians:"gradian",cycles:"cycle",arcsecond:"arcsec",arcseconds:"arcsec",arcminute:"arcmin",arcminutes:"arcmin",BTUs:"BTU",watts:"watt",joules:"joule",amperes:"ampere",coulombs:"coulomb",volts:"volt",ohms:"ohm",farads:"farad",webers:"weber",teslas:"tesla",electronvolts:"electronvolt",moles:"mole",bit:"bits",byte:"bytes"};function Ge(H){if(H.number==="BigNumber"){var Y=de(b);re.rad.value=new b(1),re.deg.value=Y.div(180),re.grad.value=Y.div(200),re.cycle.value=Y.times(2),re.arcsec.value=Y.div(648e3),re.arcmin.value=Y.div(10800)}else re.rad.value=1,re.deg.value=Math.PI/180,re.grad.value=Math.PI/200,re.cycle.value=Math.PI*2,re.arcsec.value=Math.PI/648e3,re.arcmin.value=Math.PI/10800;re.radian.value=re.rad.value,re.degree.value=re.deg.value,re.gradian.value=re.grad.value}Ge(o),i&&i("config",function(H,Y){H.number!==Y.number&&Ge(H)});var De={si:{NONE:{unit:Ve,prefix:I.NONE[""]},LENGTH:{unit:re.m,prefix:I.SHORT[""]},MASS:{unit:re.g,prefix:I.SHORT.k},TIME:{unit:re.s,prefix:I.SHORT[""]},CURRENT:{unit:re.A,prefix:I.SHORT[""]},TEMPERATURE:{unit:re.K,prefix:I.SHORT[""]},LUMINOUS_INTENSITY:{unit:re.cd,prefix:I.SHORT[""]},AMOUNT_OF_SUBSTANCE:{unit:re.mol,prefix:I.SHORT[""]},ANGLE:{unit:re.rad,prefix:I.SHORT[""]},BIT:{unit:re.bits,prefix:I.SHORT[""]},FORCE:{unit:re.N,prefix:I.SHORT[""]},ENERGY:{unit:re.J,prefix:I.SHORT[""]},POWER:{unit:re.W,prefix:I.SHORT[""]},PRESSURE:{unit:re.Pa,prefix:I.SHORT[""]},ELECTRIC_CHARGE:{unit:re.C,prefix:I.SHORT[""]},ELECTRIC_CAPACITANCE:{unit:re.F,prefix:I.SHORT[""]},ELECTRIC_POTENTIAL:{unit:re.V,prefix:I.SHORT[""]},ELECTRIC_RESISTANCE:{unit:re.ohm,prefix:I.SHORT[""]},ELECTRIC_INDUCTANCE:{unit:re.H,prefix:I.SHORT[""]},ELECTRIC_CONDUCTANCE:{unit:re.S,prefix:I.SHORT[""]},MAGNETIC_FLUX:{unit:re.Wb,prefix:I.SHORT[""]},MAGNETIC_FLUX_DENSITY:{unit:re.T,prefix:I.SHORT[""]},FREQUENCY:{unit:re.Hz,prefix:I.SHORT[""]}}};De.cgs=JSON.parse(JSON.stringify(De.si)),De.cgs.LENGTH={unit:re.m,prefix:I.SHORT.c},De.cgs.MASS={unit:re.g,prefix:I.SHORT[""]},De.cgs.FORCE={unit:re.dyn,prefix:I.SHORT[""]},De.cgs.ENERGY={unit:re.erg,prefix:I.NONE[""]},De.us=JSON.parse(JSON.stringify(De.si)),De.us.LENGTH={unit:re.ft,prefix:I.NONE[""]},De.us.MASS={unit:re.lbm,prefix:I.NONE[""]},De.us.TEMPERATURE={unit:re.degF,prefix:I.NONE[""]},De.us.FORCE={unit:re.lbf,prefix:I.NONE[""]},De.us.ENERGY={unit:re.BTU,prefix:I.BTU[""]},De.us.POWER={unit:re.hp,prefix:I.NONE[""]},De.us.PRESSURE={unit:re.psi,prefix:I.NONE[""]},De.auto=JSON.parse(JSON.stringify(De.si));var Ke=De.auto;g.setUnitSystem=function(H){if((0,Sr.nr)(De,H))Ke=De[H];else throw new Error("Unit system "+H+" does not exist. Choices are: "+Object.keys(De).join(", "))},g.getUnitSystem=function(){for(var H in De)if((0,Sr.nr)(De,H)&&De[H]===Ke)return H},g.typeConverters={BigNumber:function(Y){return new b(Y+"")},Fraction:function(Y){return new w(Y)},Complex:function(Y){return Y},number:function(Y){return Y}},g._getNumberConverter=function(H){if(!g.typeConverters[H])throw new TypeError('Unsupported type "'+H+'"');return g.typeConverters[H]};for(var sr in re)if((0,Sr.nr)(re,sr)){var yr=re[sr];yr.dimensions=yr.base.dimensions}for(var We in be)if((0,Sr.nr)(be,We)){var qr=re[be[We]],zr={};for(var Ar in qr)(0,Sr.nr)(qr,Ar)&&(zr[Ar]=qr[Ar]);zr.name=We,re[We]=zr}g.isValidAlpha=function(Y){return/^[a-zA-Z]$/.test(Y)};function Dr(H){for(var Y=0;Y<H.length;Y++){if(h=H.charAt(Y),Y===0&&!g.isValidAlpha(h))throw new Error('Invalid unit name (must begin with alpha character): "'+H+'"');if(Y>0&&!(g.isValidAlpha(h)||T(h)))throw new Error('Invalid unit name (only alphanumeric characters are allowed): "'+H+'"')}}return g.createUnit=function(H,Y){if(typeof H!="object")throw new TypeError("createUnit expects first parameter to be of type 'Object'");if(Y&&Y.override){for(var Ue in H)if((0,Sr.nr)(H,Ue)&&g.deleteUnit(Ue),H[Ue].aliases)for(var Ce=0;Ce<H[Ue].aliases.length;Ce++)g.deleteUnit(H[Ue].aliases[Ce])}var Xe;for(var mr in H)(0,Sr.nr)(H,mr)&&(Xe=g.createUnitSingle(mr,H[mr]));return Xe},g.createUnitSingle=function(H,Y,Ue){if((typeof Y>"u"||Y===null)&&(Y={}),typeof H!="string")throw new TypeError("createUnitSingle expects first parameter to be of type 'string'");if((0,Sr.nr)(re,H))throw new Error('Cannot create unit "'+H+'": a unit with that name already exists');Dr(H);var Ce=null,Xe=[],mr=0,Or,Gr,Yr;if(Y&&Y.type==="Unit")Ce=Y.clone();else if(typeof Y=="string")Y!==""&&(Or=Y);else if(typeof Y=="object")Or=Y.definition,Gr=Y.prefixes,mr=Y.offset,Yr=Y.baseName,Y.aliases&&(Xe=Y.aliases.valueOf());else throw new TypeError('Cannot create unit "'+H+'" from "'+Y.toString()+'": expecting "string" or "Unit" or "Object"');if(Xe){for(var dt=0;dt<Xe.length;dt++)if((0,Sr.nr)(re,Xe[dt]))throw new Error('Cannot create alias "'+Xe[dt]+'": a unit with that name already exists')}if(Or&&typeof Or=="string"&&!Ce)try{Ce=g.parse(Or,{allowNoUnits:!0})}catch(pm){throw pm.message='Could not create unit "'+H+'" from "'+Or+'": '+pm.message,pm}else Or&&Or.type==="Unit"&&(Ce=Or.clone());Xe=Xe||[],mr=mr||0,Gr&&Gr.toUpperCase?Gr=I[Gr.toUpperCase()]||I.NONE:Gr=I.NONE;var st={};if(Ce){st={name:H,value:Ce.value,dimensions:Ce.dimensions.slice(0),prefixes:Gr,offset:mr};var Lt=!1;for(var En in B)if((0,Sr.nr)(B,En)){for(var Ua=!0,Cn=0;Cn<ve.length;Cn++)if(Math.abs((st.dimensions[Cn]||0)-(B[En].dimensions[Cn]||0))>1e-12){Ua=!1;break}if(Ua){Lt=!0,st.base=B[En];break}}if(!Lt){Yr=Yr||H+"_STUFF";var Xp={dimensions:Ce.dimensions.slice(0)};Xp.key=Yr,B[Yr]=Xp,Ke[Yr]={unit:st,prefix:I.NONE[""]},st.base=B[Yr]}}else{if(Yr=Yr||H+"_STUFF",ve.indexOf(Yr)>=0)throw new Error('Cannot create new base unit "'+H+'": a base unit with that name already exists (and cannot be overridden)');ve.push(Yr);for(var Et in B)(0,Sr.nr)(B,Et)&&(B[Et].dimensions[ve.length-1]=0);for(var Pt={dimensions:[]},xn=0;xn<ve.length;xn++)Pt.dimensions[xn]=0;Pt.dimensions[ve.length-1]=1,Pt.key=Yr,B[Yr]=Pt,st={name:H,value:1,dimensions:B[Yr].dimensions.slice(0),prefixes:Gr,offset:mr,base:B[Yr]},Ke[Yr]={unit:st,prefix:I.NONE[""]}}g.UNITS[H]=st;for(var fm=0;fm<Xe.length;fm++){var Qp=Xe[fm],mm={};for(var vm in st)(0,Sr.nr)(st,vm)&&(mm[vm]=st[vm]);mm.name=Qp,g.UNITS[Qp]=mm}return delete te.cache,new g(null,H)},g.deleteUnit=function(H){delete g.UNITS[H]},g.PREFIXES=I,g.BASE_DIMENSIONS=ve,g.BASE_UNITS=B,g.UNIT_SYSTEMS=De,g.UNITS=re,g},{isClass:!0}),zv="createUnit",i0=["typed","Unit"],o0=(0,A.d5)(zv,i0,u=>{var{typed:i,Unit:o}=u;return i(zv,{"Object, Object":function(r,s){return o.createUnit(r,s)},Object:function(r){return o.createUnit(r,{})},"string, Unit | string | Object, Object":function(r,s,p){var d={};return d[r]=s,o.createUnit(d,p)},"string, Unit | string | Object":function(r,s){var p={};return p[r]=s,o.createUnit(p,{})},string:function(r){var s={};return s[r]={},o.createUnit(s,{})}})}),Pv="dotPow",s0=["typed","equalScalar","matrix","pow","DenseMatrix"],u0=(0,A.d5)(Pv,s0,u=>{var{typed:i,equalScalar:o,matrix:t,pow:r,DenseMatrix:s}=u,p=_({typed:i}),d=Fe({typed:i,DenseMatrix:s}),v=oe({typed:i,equalScalar:o}),m=He({typed:i,DenseMatrix:s}),n=Br({typed:i}),e=Z({typed:i});return i(Pv,{"any, any":r,"SparseMatrix, SparseMatrix":function(l,c){return d(l,c,r,!1)},"SparseMatrix, DenseMatrix":function(l,c){return p(c,l,r,!0)},"DenseMatrix, SparseMatrix":function(l,c){return p(l,c,r,!1)},"DenseMatrix, DenseMatrix":function(l,c){return n(l,c,r)},"Array, Array":function(l,c){return this(t(l),t(c)).valueOf()},"Array, Matrix":function(l,c){return this(t(l),c)},"Matrix, Array":function(l,c){return this(l,t(c))},"SparseMatrix, any":function(l,c){return v(l,c,this,!1)},"DenseMatrix, any":function(l,c){return e(l,c,this,!1)},"any, SparseMatrix":function(l,c){return m(c,l,this,!0)},"any, DenseMatrix":function(l,c){return e(c,l,this,!0)},"Array, any":function(l,c){return e(t(l),c,this,!1).valueOf()},"any, Array":function(l,c){return e(t(c),l,this,!0).valueOf()}})}),Lv="expm",c0=["typed","abs","add","identity","inv","multiply"],l0=(0,A.d5)(Lv,c0,u=>{var{typed:i,abs:o,add:t,identity:r,inv:s,multiply:p}=u;return i(Lv,{Matrix:function(e){var a=e.size();if(a.length!==2||a[0]!==a[1])throw new RangeError("Matrix must be square (size: "+(0,Jr.WU)(a)+")");for(var l=a[0],c=1e-15,f=d(e),b=v(f,c),w=b.q,E=b.j,g=p(e,Math.pow(2,-E)),S=r(l),N=r(l),h=1,C=g,O=-1,T=1;T<=w;T++)T>1&&(C=p(C,g),O=-O),h=h*(w-T+1)/((2*w-T+1)*T),S=t(S,p(h,C)),N=t(N,p(h*O,C));for(var M=p(s(N),S),P=0;P<E;P++)M=p(M,M);return(0,L.sA)(e)?e.createSparseMatrix(M):M}});function d(n){for(var e=n.size()[0],a=0,l=0;l<e;l++){for(var c=0,f=0;f<e;f++)c+=o(n.get([l,f]));a=Math.max(c,a)}return a}function v(n,e){for(var a=30,l=0;l<a;l++)for(var c=0;c<=l;c++){var f=l-c;if(m(n,c,f)<e)return{q:c,j:f}}throw new Error("Could not find acceptable parameters to compute the matrix exponential (try increasing maxSearchSize in expm.js)")}function m(n,e,a){for(var l=1,c=2;c<=e;c++)l*=c;for(var f=l,b=e+1;b<=2*e;b++)f*=b;var w=f*(2*e+1);return 8*Math.pow(n/Math.pow(2,a),2*e)*l*l/(f*w)}}),qv="gamma",f0=["typed","config","multiplyScalar","pow","BigNumber","Complex"],m0=(0,A.d5)(qv,f0,u=>{var{typed:i,config:o,multiplyScalar:t,pow:r,BigNumber:s,Complex:p}=u;return i(qv,{number:xa,Complex:function(m){if(m.im===0)return this(m.re);if(m.re<.5){var n=new p(1-m.re,-m.im),e=new p(Math.PI*m.re,Math.PI*m.im);return new p(Math.PI).div(e.sin()).div(this(n))}m=new p(m.re-1,m.im);for(var a=new p(wn[0],0),l=1;l<wn.length;++l){var c=new p(wn[l],0);a=a.add(c.div(m.add(l)))}var f=new p(m.re+mo+.5,m.im),b=Math.sqrt(2*Math.PI),w=f.pow(m.add(.5)),E=f.neg().exp();return a.mul(b).mul(w).mul(E)},BigNumber:function(m){if(m.isInteger())return m.isNegative()||m.isZero()?new s(1/0):d(m.minus(1));if(!m.isFinite())return new s(m.isNegative()?NaN:1/0);throw new Error("Integer BigNumber expected")},"Array | Matrix":function(m){return(0,Mr.Fh)(m,this)}});function d(v){if(v<8)return new s([1,1,2,6,24,120,720,5040][v]);var m=o.precision+(Math.log(v.toNumber())|0),n=s.clone({precision:m});if(v%2===1)return v.times(d(new s(v-1)));for(var e=v,a=new n(v),l=v.toNumber();e>2;)e-=2,l+=e,a=a.times(l);return new s(a.toPrecision(s.precision))}}),Wv="setIntersect",v0=["typed","size","subset","compareNatural","Index","DenseMatrix"],p0=(0,A.d5)(Wv,v0,u=>{var{typed:i,size:o,subset:t,compareNatural:r,Index:s,DenseMatrix:p}=u;return i(Wv,{"Array | Matrix, Array | Matrix":function(v,m){var n;if(t(o(v),new s(0))===0||t(o(m),new s(0))===0)n=[];else{var e=(0,ze.yV)((0,ze.xH)(Array.isArray(v)?v:v.toArray()).sort(r)),a=(0,ze.yV)((0,ze.xH)(Array.isArray(m)?m:m.toArray()).sort(r));n=[];for(var l=0;l<e.length;l++)for(var c=0;c<a.length;c++)if(r(e[l].value,a[c].value)===0&&e[l].identifier===a[c].identifier){n.push(e[l]);break}}return Array.isArray(v)&&Array.isArray(m)?(0,ze.D$)(n):new p((0,ze.D$)(n))}})}),d0="divide",h0=["typed","matrix","multiply","equalScalar","divideScalar","inv"],g0=(0,A.d5)(d0,h0,u=>{var{typed:i,matrix:o,multiply:t,equalScalar:r,divideScalar:s,inv:p}=u,d=oe({typed:i,equalScalar:r}),v=Z({typed:i});return i("divide",(0,Sr.l7)({"Array | Matrix, Array | Matrix":function(n,e){return t(n,p(e))},"DenseMatrix, any":function(n,e){return v(n,e,s,!1)},"SparseMatrix, any":function(n,e){return d(n,e,s,!1)},"Array, any":function(n,e){return v(o(n),e,s,!1).valueOf()},"any, Array | Matrix":function(n,e){return t(n,p(e))}},s.signatures))}),Gv="factorial",y0=["typed","gamma"],x0=(0,A.d5)(Gv,y0,u=>{var{typed:i,gamma:o}=u;return i(Gv,{number:function(r){if(r<0)throw new Error("Value must be non-negative");return o(r+1)},BigNumber:function(r){if(r.isNegative())throw new Error("Value must be non-negative");return o(r.plus(1))},"Array | Matrix":function(r){return(0,Mr.Fh)(r,this)}})}),Hv="lup",b0=["typed","matrix","abs","addScalar","divideScalar","multiplyScalar","subtract","larger","equalScalar","unaryMinus","DenseMatrix","SparseMatrix","Spa"],N0=(0,A.d5)(Hv,b0,u=>{var{typed:i,matrix:o,abs:t,addScalar:r,divideScalar:s,multiplyScalar:p,subtract:d,larger:v,equalScalar:m,unaryMinus:n,DenseMatrix:e,SparseMatrix:a,Spa:l}=u;return i(Hv,{DenseMatrix:function(w){return c(w)},SparseMatrix:function(w){return f(w)},Array:function(w){var E=o(w),g=c(E);return{L:g.L.valueOf(),U:g.U.valueOf(),p:g.p}}});function c(b){var w=b._size[0],E=b._size[1],g=Math.min(w,E),S=(0,Sr.d9)(b._data),N=[],h=[w,g],C=[],O=[g,E],T,M,P,z=[];for(T=0;T<w;T++)z[T]=T;for(M=0;M<E;M++){if(M>0)for(T=0;T<w;T++){var $=Math.min(T,M),V=0;for(P=0;P<$;P++)V=r(V,p(S[T][P],S[P][M]));S[T][M]=d(S[T][M],V)}var te=M,K=0,I=0;for(T=M;T<w;T++){var ve=S[T][M],B=t(ve);v(B,K)&&(te=T,K=B,I=ve)}if(M!==te&&(z[M]=[z[te],z[te]=z[M]][0],e._swapRows(M,te,S)),M<w)for(T=M+1;T<w;T++){var j=S[T][M];m(j,0)||(S[T][M]=s(S[T][M],I))}}for(M=0;M<E;M++)for(T=0;T<w;T++){if(M===0&&(T<E&&(C[T]=[]),N[T]=[]),T<M){T<E&&(C[T][M]=S[T][M]),M<w&&(N[T][M]=0);continue}if(T===M){T<E&&(C[T][M]=S[T][M]),M<w&&(N[T][M]=1);continue}T<E&&(C[T][M]=0),M<w&&(N[T][M]=S[T][M])}var ye=new e({data:N,size:h}),Ve=new e({data:C,size:O}),re=[];for(T=0,g=z.length;T<g;T++)re[z[T]]=T;return{L:ye,U:Ve,p:re,toString:function(){return"L: "+this.L.toString()+`
49
- U: `+this.U.toString()+`
50
- P: `+this.p}}}function f(b){var w=b._size[0],E=b._size[1],g=Math.min(w,E),S=b._values,N=b._index,h=b._ptr,C=[],O=[],T=[],M=[w,g],P=[],z=[],$=[],V=[g,E],te,K,I,ve=[],B=[];for(te=0;te<w;te++)ve[te]=te,B[te]=te;var j=function(re,be){var Ge=B[re],De=B[be];ve[Ge]=be,ve[De]=re,B[re]=De,B[be]=Ge},ye=function(){var re=new l;K<w&&(T.push(C.length),C.push(1),O.push(K)),$.push(P.length);var be=h[K],Ge=h[K+1];for(I=be;I<Ge;I++)te=N[I],re.set(ve[te],S[I]);K>0&&re.forEach(0,K-1,function(yr,We){a._forEachRow(yr,C,O,T,function(qr,zr){qr>yr&&re.accumulate(qr,n(p(zr,We)))})});var De=K,Ke=re.get(K),sr=t(Ke);re.forEach(K+1,w-1,function(yr,We){var qr=t(We);v(qr,sr)&&(De=yr,sr=qr,Ke=We)}),K!==De&&(a._swapRows(K,De,M[1],C,O,T),a._swapRows(K,De,V[1],P,z,$),re.swap(K,De),j(K,De)),re.forEach(0,w-1,function(yr,We){yr<=K?(P.push(We),z.push(yr)):(We=s(We,Ke),m(We,0)||(C.push(We),O.push(yr)))})};for(K=0;K<E;K++)ye();return $.push(P.length),T.push(C.length),{L:new a({values:C,index:O,ptr:T,size:M}),U:new a({values:P,index:z,ptr:$,size:V}),p:ve,toString:function(){return"L: "+this.L.toString()+`
51
- U: `+this.U.toString()+`
52
- P: `+this.p}}}}),kv="multinomial",w0=["typed","add","divide","multiply","factorial","isInteger","isPositive"],M0=(0,A.d5)(kv,w0,u=>{var{typed:i,add:o,divide:t,multiply:r,factorial:s,isInteger:p,isPositive:d}=u;return i(kv,{"Array | Matrix":function(m){var n=0,e=1;return(0,Mr.Et)(m,function(a){if(!p(a)||!d(a))throw new TypeError("Positive integer value expected in function multinomial");n=o(n,a),e=r(e,s(a))}),t(s(n),e)}})}),$v="permutations",A0=["typed","factorial"],S0=(0,A.d5)($v,A0,u=>{var{typed:i,factorial:o}=u;return i($v,{"number | BigNumber":o,"number, number":function(r,s){if(!(0,le.U)(r)||r<0)throw new TypeError("Positive integer value expected in function permutations");if(!(0,le.U)(s)||s<0)throw new TypeError("Positive integer value expected in function permutations");if(s>r)throw new TypeError("second argument k must be less than or equal to first argument n");return Kt(r-s+1,r)},"BigNumber, BigNumber":function(r,s){var p,d;if(!Vv(r)||!Vv(s))throw new TypeError("Positive integer value expected in function permutations");if(s.gt(r))throw new TypeError("second argument k must be less than or equal to first argument n");var v=r.mul(0).add(1);for(p=v,d=r.minus(s).plus(1);d.lte(r);d=d.plus(1))p=p.times(d);return p}})});function Vv(u){return u.isInteger()&&u.gte(0)}var Jv="stirlingS2",_0=["typed","addScalar","subtract","multiplyScalar","divideScalar","pow","factorial","combinations","isNegative","isInteger","number","?bignumber","larger"],E0=(0,A.d5)(Jv,_0,u=>{var{typed:i,addScalar:o,subtract:t,multiplyScalar:r,divideScalar:s,pow:p,factorial:d,combinations:v,isNegative:m,isInteger:n,number:e,bignumber:a,larger:l}=u,c=[],f=[];return i(Jv,{"number | BigNumber, number | BigNumber":function(w,E){if(!n(w)||m(w)||!n(E)||m(E))throw new TypeError("Non-negative integer value expected in function stirlingS2");if(l(E,w))throw new TypeError("k must be less than or equal to n in function stirlingS2");var g=!((0,L.hj)(w)&&(0,L.hj)(E)),S=g?f:c,N=g?a:e,h=e(w),C=e(E);if(S[h]&&S[h].length>C)return S[h][C];for(var O=0;O<=h;++O)if(S[O]||(S[O]=[N(O===0?1:0)]),O!==0)for(var T=S[O],M=S[O-1],P=T.length;P<=O&&P<=C;++P)P===O?T[P]=1:T[P]=o(r(N(P),M[P]),M[P-1]);return S[h][C]}})}),Zv="unit",C0=["typed","Unit"],O0=(0,A.d5)(Zv,C0,u=>{var{typed:i,Unit:o}=u;return i(Zv,{Unit:function(r){return r.clone()},string:function(r){return o.isValuelessUnit(r)?new o(null,r):o.parse(r,{allowNoUnits:!0})},"number | BigNumber | Fraction | Complex, string":function(r,s){return new o(r,s)},"Array | Matrix":function(r){return(0,Mr.Fh)(r,this)}})}),Kv="bellNumbers",D0=["typed","addScalar","isNegative","isInteger","stirlingS2"],B0=(0,A.d5)(Kv,D0,u=>{var{typed:i,addScalar:o,isNegative:t,isInteger:r,stirlingS2:s}=u;return i(Kv,{"number | BigNumber":function(d){if(!r(d)||t(d))throw new TypeError("Non-negative integer value expected in function bellNumbers");for(var v=0,m=0;m<=d;m++)v=o(v,s(d,m));return v}})});function T0(u){var{addScalar:i,subtract:o,flatten:t,multiply:r,multiplyScalar:s,divideScalar:p,sqrt:d,abs:v,bignumber:m,diag:n,inv:e,qr:a,usolve:l,usolveAll:c,equal:f,complex:b,larger:w,smaller:E,matrixFromColumns:g,dot:S}=u;function N(j,ye,Ve,re,be){be===void 0&&(be=!0);var Ge=h(j,ye,Ve,re,be);C(j,ye,Ve,re,be,Ge);var{values:De,C:Ke}=O(j,ye,Ve,re,be),sr;return be&&(sr=T(j,ye,Ke,Ge,De,Ve,re),sr=g(...sr)),{values:De,vectors:sr}}function h(j,ye,Ve,re,be){var Ge=re==="BigNumber",De=re==="Complex",Ke=Ge?m(0):0,sr=Ge?m(1):De?b(1):1,yr=Ge?m(1):1,We=Ge?m(10):2,qr=s(We,We),zr;be&&(zr=Array(ye).fill(sr));for(var Ar=!1;!Ar;){Ar=!0;for(var Dr=0;Dr<ye;Dr++){for(var H=Ke,Y=Ke,Ue=0;Ue<ye;Ue++)if(Dr!==Ue){var Ce=v(j[Dr][Ue]);H=i(H,Ce),Y=i(Y,Ce)}if(!f(H,0)&&!f(Y,0)){for(var Xe=yr,mr=H,Or=p(Y,We),Gr=s(Y,We);E(mr,Or);)mr=s(mr,qr),Xe=s(Xe,We);for(;w(mr,Gr);)mr=p(mr,qr),Xe=p(Xe,We);var Yr=E(p(i(mr,Y),Xe),s(i(H,Y),.95));if(Yr){Ar=!1;for(var dt=p(1,Xe),st=0;st<ye;st++)Dr!==st&&(j[Dr][st]=s(j[Dr][st],Xe),j[st][Dr]=s(j[st][Dr],dt));be&&(zr[Dr]=s(zr[Dr],Xe))}}}}return n(zr)}function C(j,ye,Ve,re,be,Ge){var De=re==="BigNumber",Ke=re==="Complex",sr=De?m(0):Ke?b(0):0;De&&(Ve=m(Ve));for(var yr=0;yr<ye-2;yr++){for(var We=0,qr=sr,zr=yr+1;zr<ye;zr++){var Ar=j[zr][yr];E(v(qr),v(Ar))&&(qr=Ar,We=zr)}if(!E(v(qr),Ve)){if(We!==yr+1){var Dr=j[We];j[We]=j[yr+1],j[yr+1]=Dr;for(var H=0;H<ye;H++){var Y=j[H][We];j[H][We]=j[H][yr+1],j[H][yr+1]=Y}if(be){var Ue=Ge[We];Ge[We]=Ge[yr+1],Ge[yr+1]=Ue}}for(var Ce=yr+2;Ce<ye;Ce++){var Xe=p(j[Ce][yr],qr);if(Xe!==0){for(var mr=0;mr<ye;mr++)j[Ce][mr]=o(j[Ce][mr],s(Xe,j[yr+1][mr]));for(var Or=0;Or<ye;Or++)j[Or][yr+1]=i(j[Or][yr+1],s(Xe,j[Or][Ce]));if(be)for(var Gr=0;Gr<ye;Gr++)Ge[Ce][Gr]=o(Ge[Ce][Gr],s(Xe,Ge[yr+1][Gr]))}}}}return Ge}function O(j,ye,Ve,re,be){var Ge=re==="BigNumber",De=re==="Complex",Ke=Ge?m(1):De?b(1):1;Ge&&(Ve=m(Ve));for(var sr=(0,Sr.d9)(j),yr=[],We=ye,qr=[],zr=be?n(Array(ye).fill(Ke)):void 0,Ar=be?n(Array(We).fill(Ke)):void 0,Dr=0;Dr<=100;){Dr+=1;for(var H=0,Y=0;Y<We;Y++)sr[Y][Y]=o(sr[Y][Y],H);var{Q:Ue,R:Ce}=a(sr);sr=r(Ce,Ue);for(var Xe=0;Xe<We;Xe++)sr[Xe][Xe]=i(sr[Xe][Xe],H);if(be&&(Ar=r(Ar,Ue)),We===1||E(v(sr[We-1][We-2]),Ve)){Dr=0,yr.push(sr[We-1][We-1]),be&&(qr.unshift([[1]]),z(Ar,ye),zr=r(zr,Ar),We>1&&(Ar=n(Array(We-1).fill(Ke)))),We-=1,sr.pop();for(var mr=0;mr<We;mr++)sr[mr].pop()}else if(We===2||E(v(sr[We-2][We-3]),Ve)){Dr=0;var Or=M(sr[We-2][We-2],sr[We-2][We-1],sr[We-1][We-2],sr[We-1][We-1]);yr.push(...Or),be&&(qr.unshift(P(sr[We-2][We-2],sr[We-2][We-1],sr[We-1][We-2],sr[We-1][We-1],Or[0],Or[1],Ve,re)),z(Ar,ye),zr=r(zr,Ar),We>2&&(Ar=n(Array(We-2).fill(Ke)))),We-=2,sr.pop(),sr.pop();for(var Gr=0;Gr<We;Gr++)sr[Gr].pop(),sr[Gr].pop()}if(We===0)break}if(yr.sort((st,Et)=>+o(v(st),v(Et))),Dr>100){var Yr=Error("The eigenvalues failed to converge. Only found these eigenvalues: "+yr.join(", "));throw Yr.values=yr,Yr.vectors=[],Yr}var dt=be?r(zr,$(qr,ye)):void 0;return{values:yr,C:dt}}function T(j,ye,Ve,re,be,Ge,De){var Ke=e(Ve),sr=r(Ke,j,Ve),yr=De==="BigNumber",We=De==="Complex",qr=yr?m(0):We?b(0):0,zr=yr?m(1):We?b(1):1,Ar=[],Dr=[];for(var H of be){var Y=V(Ar,H,f);Y===-1?(Ar.push(H),Dr.push(1)):Dr[Y]+=1}for(var Ue=[],Ce=Ar.length,Xe=Array(ye).fill(qr),mr=n(Array(ye).fill(zr)),Or=[],Gr=function(Et){var Pt=Ar[Et],xn=o(sr,r(Pt,mr)),Lt=c(xn,Xe);for(Lt.shift();Lt.length<Dr[Et];){var En=te(xn,ye,Lt,Ge,De);if(En==null){Or.push(Pt);break}Lt.push(En)}var Ua=r(e(re),Ve);Lt=Lt.map(Cn=>r(Ua,Cn)),Ue.push(...Lt.map(Cn=>t(Cn)))},Yr=0;Yr<Ce;Yr++)Gr(Yr);if(Or.length!==0){var dt=new Error("Failed to find eigenvectors for the following eigenvalues: "+Or.join(", "));throw dt.values=be,dt.vectors=Ue,dt}return Ue}function M(j,ye,Ve,re){var be=i(j,re),Ge=o(s(j,re),s(ye,Ve)),De=s(be,.5),Ke=s(d(o(s(be,be),s(4,Ge))),.5);return[i(De,Ke),o(De,Ke)]}function P(j,ye,Ve,re,be,Ge,De,Ke){var sr=Ke==="BigNumber",yr=Ke==="Complex",We=sr?m(0):yr?b(0):0,qr=sr?m(1):yr?b(1):1;if(E(v(Ve),De))return[[qr,We],[We,qr]];if(w(v(o(be,Ge)),De))return[[o(be,re),o(Ge,re)],[Ve,Ve]];var zr=o(j,be),Ar=o(ye,be),Dr=o(Ve,be),H=o(re,be);return E(v(Ar),De)?[[zr,qr],[Dr,We]]:[[Ar,We],[H,qr]]}function z(j,ye){for(var Ve=0;Ve<j.length;Ve++)j[Ve].push(...Array(ye-j[Ve].length).fill(0));for(var re=j.length;re<ye;re++)j.push(Array(ye).fill(0)),j[re][re]=1;return j}function $(j,ye){for(var Ve=[],re=0;re<ye;re++)Ve[re]=Array(ye).fill(0);var be=0;for(var Ge of j){for(var De=Ge.length,Ke=0;Ke<De;Ke++)for(var sr=0;sr<De;sr++)Ve[be+Ke][be+sr]=Ge[Ke][sr];be+=De}return Ve}function V(j,ye,Ve){for(var re=0;re<j.length;re++)if(Ve(j[re],ye))return re;return-1}function te(j,ye,Ve,re,be){for(var Ge=be==="BigNumber"?m(1e3):1e3,De,Ke=0;De=K(ye,Ve,be),De=l(j,De),!w(ve(De),Ge);)if(++Ke>=5)return null;for(Ke=0;;){var sr=l(j,De);if(E(ve(I(De,[sr])),re))break;if(++Ke>=10)return null;De=B(sr)}return De}function K(j,ye,Ve){var re=Ve==="BigNumber",be=Ve==="Complex",Ge=Array(j).fill(0).map(De=>2*Math.random()-1);return re&&(Ge=Ge.map(De=>m(De))),be&&(Ge=Ge.map(De=>b(De))),Ge=I(Ge,ye),B(Ge,Ve)}function I(j,ye){for(var Ve of ye)j=o(j,r(p(S(Ve,j),S(Ve,Ve)),Ve));return j}function ve(j){return v(d(S(j,j)))}function B(j,ye){var Ve=ye==="BigNumber",re=ye==="Complex",be=Ve?m(1):re?b(1):1;return r(p(be,ve(j)),j)}return N}function U0(u){var{config:i,addScalar:o,subtract:t,abs:r,atan:s,cos:p,sin:d,multiplyScalar:v,inv:m,bignumber:n,multiply:e,add:a}=u;function l(M,P){var z=arguments.length>2&&arguments[2]!==void 0?arguments[2]:i.epsilon,$=arguments.length>3?arguments[3]:void 0;if($==="number")return c(M,z);if($==="BigNumber")return f(M,z);throw TypeError("Unsupported data type: "+$)}function c(M,P){for(var z=M.length,$=Math.abs(P/z),V,te=new Array(z),K=0;K<z;K++)te[K]=T(z,0),te[K][K]=1;for(var I=h(M);Math.abs(I[1])>=Math.abs($);){var ve=I[0][0],B=I[0][1];V=b(M[ve][ve],M[B][B],M[ve][B]),M=N(M,V,ve,B),te=E(te,V,ve,B),I=h(M)}for(var j=T(z,0),ye=0;ye<z;ye++)j[ye]=M[ye][ye];return O((0,Sr.d9)(j),(0,Sr.d9)(te))}function f(M,P){for(var z=M.length,$=r(P/z),V,te=new Array(z),K=0;K<z;K++)te[K]=T(z,0),te[K][K]=1;for(var I=C(M);r(I[1])>=r($);){var ve=I[0][0],B=I[0][1];V=w(M[ve][ve],M[B][B],M[ve][B]),M=S(M,V,ve,B),te=g(te,V,ve,B),I=C(M)}for(var j=T(z,0),ye=0;ye<z;ye++)j[ye]=M[ye][ye];return O((0,Sr.d9)(j),(0,Sr.d9)(te))}function b(M,P,z){var $=P-M;return Math.abs($)<=i.epsilon?Math.PI/4:.5*Math.atan(2*z/(P-M))}function w(M,P,z){var $=t(P,M);return r($)<=i.epsilon?n(-1).acos().div(4):v(.5,s(e(2,z,m($))))}function E(M,P,z,$){for(var V=M.length,te=Math.cos(P),K=Math.sin(P),I=T(V,0),ve=T(V,0),B=0;B<V;B++)I[B]=te*M[B][z]-K*M[B][$],ve[B]=K*M[B][z]+te*M[B][$];for(var j=0;j<V;j++)M[j][z]=I[j],M[j][$]=ve[j];return M}function g(M,P,z,$){for(var V=M.length,te=p(P),K=d(P),I=T(V,n(0)),ve=T(V,n(0)),B=0;B<V;B++)I[B]=t(v(te,M[B][z]),v(K,M[B][$])),ve[B]=o(v(K,M[B][z]),v(te,M[B][$]));for(var j=0;j<V;j++)M[j][z]=I[j],M[j][$]=ve[j];return M}function S(M,P,z,$){for(var V=M.length,te=n(p(P)),K=n(d(P)),I=v(te,te),ve=v(K,K),B=T(V,n(0)),j=T(V,n(0)),ye=e(n(2),te,K,M[z][$]),Ve=o(t(v(I,M[z][z]),ye),v(ve,M[$][$])),re=a(v(ve,M[z][z]),ye,v(I,M[$][$])),be=0;be<V;be++)B[be]=t(v(te,M[z][be]),v(K,M[$][be])),j[be]=o(v(K,M[z][be]),v(te,M[$][be]));M[z][z]=Ve,M[$][$]=re,M[z][$]=n(0),M[$][z]=n(0);for(var Ge=0;Ge<V;Ge++)Ge!==z&&Ge!==$&&(M[z][Ge]=B[Ge],M[Ge][z]=B[Ge],M[$][Ge]=j[Ge],M[Ge][$]=j[Ge]);return M}function N(M,P,z,$){for(var V=M.length,te=Math.cos(P),K=Math.sin(P),I=te*te,ve=K*K,B=T(V,0),j=T(V,0),ye=I*M[z][z]-2*te*K*M[z][$]+ve*M[$][$],Ve=ve*M[z][z]+2*te*K*M[z][$]+I*M[$][$],re=0;re<V;re++)B[re]=te*M[z][re]-K*M[$][re],j[re]=K*M[z][re]+te*M[$][re];M[z][z]=ye,M[$][$]=Ve,M[z][$]=0,M[$][z]=0;for(var be=0;be<V;be++)be!==z&&be!==$&&(M[z][be]=B[be],M[be][z]=B[be],M[$][be]=j[be],M[be][$]=j[be]);return M}function h(M){for(var P=M.length,z=0,$=[0,1],V=0;V<P;V++)for(var te=V+1;te<P;te++)Math.abs(z)<Math.abs(M[V][te])&&(z=Math.abs(M[V][te]),$=[V,te]);return[$,z]}function C(M){for(var P=M.length,z=0,$=[0,1],V=0;V<P;V++)for(var te=V+1;te<P;te++)r(z)<r(M[V][te])&&(z=r(M[V][te]),$=[V,te]);return[$,z]}function O(M,P){for(var z=M.length,$=Array(z),V=Array(z),te=0;te<z;te++)V[te]=Array(z);for(var K=0;K<z;K++){for(var I=0,ve=M[0],B=0;B<M.length;B++)r(M[B])<r(ve)&&(I=B,ve=M[I]);$[K]=M.splice(I,1)[0];for(var j=0;j<z;j++)V[j][K]=P[j][I],P[j].splice(I,1)}return{values:$,vectors:V}}function T(M,P){for(var z=new Array(M),$=0;$<M;$++)z[$]=P;return z}return l}var R0="eigs",I0=["config","typed","matrix","addScalar","equal","subtract","abs","atan","cos","sin","multiplyScalar","divideScalar","inv","bignumber","multiply","add","larger","column","flatten","number","complex","sqrt","diag","qr","usolve","usolveAll","im","re","smaller","matrixFromColumns","dot"],F0=(0,A.d5)(R0,I0,u=>{var{config:i,typed:o,matrix:t,addScalar:r,subtract:s,equal:p,abs:d,atan:v,cos:m,sin:n,multiplyScalar:e,divideScalar:a,inv:l,bignumber:c,multiply:f,add:b,larger:w,column:E,flatten:g,number:S,complex:N,sqrt:h,diag:C,qr:O,usolve:T,usolveAll:M,im:P,re:z,smaller:$,matrixFromColumns:V,dot:te}=u,K=U0({config:i,addScalar:r,subtract:s,column:E,flatten:g,equal:p,abs:d,atan:v,cos:m,sin:n,multiplyScalar:e,inv:l,bignumber:c,complex:N,multiply:f,add:b}),I=T0({config:i,addScalar:r,subtract:s,multiply:f,multiplyScalar:e,flatten:g,divideScalar:a,sqrt:h,abs:d,bignumber:c,diag:C,qr:O,inv:l,usolve:T,usolveAll:M,equal:p,complex:N,larger:w,smaller:$,matrixFromColumns:V,dot:te});return o("eigs",{Array:function(be){var Ge=t(be);return ve(Ge)},"Array, number|BigNumber":function(be,Ge){var De=t(be);return ve(De,Ge)},Matrix:function(be){var{values:Ge,vectors:De}=ve(be);return{values:t(Ge),vectors:t(De)}},"Matrix, number|BigNumber":function(be,Ge){var{values:De,vectors:Ke}=ve(be,Ge);return{values:t(De),vectors:t(Ke)}}});function ve(re,be){be===void 0&&(be=i.epsilon);var Ge=re.size();if(Ge.length!==2||Ge[0]!==Ge[1])throw new RangeError("Matrix must be square (size: "+(0,Jr.WU)(Ge)+")");var De=re.toArray(),Ke=Ge[0];if(j(De,Ke,be)&&(ye(De,Ke),B(De,Ke,be))){var sr=Ve(re,De,Ke);return K(De,Ke,be,sr)}var yr=Ve(re,De,Ke);return I(De,Ke,be,yr)}function B(re,be,Ge){for(var De=0;De<be;De++)for(var Ke=De;Ke<be;Ke++)if(w(c(d(s(re[De][Ke],re[Ke][De]))),Ge))return!1;return!0}function j(re,be,Ge){for(var De=0;De<be;De++)for(var Ke=0;Ke<be;Ke++)if(w(c(d(P(re[De][Ke]))),Ge))return!1;return!0}function ye(re,be){for(var Ge=0;Ge<be;Ge++)for(var De=0;De<be;De++)re[Ge][De]=z(re[Ge][De])}function Ve(re,be,Ge){var De=re.datatype();if(De==="number"||De==="BigNumber"||De==="Complex")return De;for(var Ke=!1,sr=!1,yr=!1,We=0;We<Ge;We++)for(var qr=0;qr<Ge;qr++){var zr=be[We][qr];if((0,L.hj)(zr)||(0,L.yQ)(zr))Ke=!0;else if((0,L.l9)(zr))sr=!0;else if((0,L.Mc)(zr))yr=!0;else throw TypeError("Unsupported type in Matrix: "+(0,L.kM)(zr))}if(sr&&yr&&console.warn("Complex BigNumbers not supported, this operation will lose precission."),yr){for(var Ar=0;Ar<Ge;Ar++)for(var Dr=0;Dr<Ge;Dr++)be[Ar][Dr]=N(be[Ar][Dr]);return"Complex"}if(sr){for(var H=0;H<Ge;H++)for(var Y=0;Y<Ge;Y++)be[H][Y]=c(be[H][Y]);return"BigNumber"}if(Ke){for(var Ue=0;Ue<Ge;Ue++)for(var Ce=0;Ce<Ge;Ce++)be[Ue][Ce]=S(be[Ue][Ce]);return"number"}else throw TypeError("Matrix contains unsupported types only.")}}),z0=ie(3592),Yv="setSymDifference",P0=["typed","size","concat","subset","setDifference","Index"],L0=(0,A.d5)(Yv,P0,u=>{var{typed:i,size:o,concat:t,subset:r,setDifference:s,Index:p}=u;return i(Yv,{"Array | Matrix, Array | Matrix":function(v,m){if(r(o(v),new p(0))===0)return(0,ze.xH)(m);if(r(o(m),new p(0))===0)return(0,ze.xH)(v);var n=(0,ze.xH)(v),e=(0,ze.xH)(m);return t(s(n,e),s(e,n))}})});function Xv(u,i){var o,t=i.length,r=[];if(u)for(o=0;o<t;o++)r[u[o]]=i[o];else for(o=0;o<t;o++)r[o]=i[o];return r}var Qv="lusolve",q0=["typed","matrix","lup","slu","usolve","lsolve","DenseMatrix"],W0=(0,A.d5)(Qv,q0,u=>{var{typed:i,matrix:o,lup:t,slu:r,usolve:s,lsolve:p,DenseMatrix:d}=u,v=Oa({DenseMatrix:d});return i(Qv,{"Array, Array | Matrix":function(a,l){a=o(a);var c=t(a),f=n(c.L,c.U,c.p,null,l);return f.valueOf()},"DenseMatrix, Array | Matrix":function(a,l){var c=t(a);return n(c.L,c.U,c.p,null,l)},"SparseMatrix, Array | Matrix":function(a,l){var c=t(a);return n(c.L,c.U,c.p,null,l)},"SparseMatrix, Array | Matrix, number, number":function(a,l,c,f){var b=r(a,c,f);return n(b.L,b.U,b.p,b.q,l)},"Object, Array | Matrix":function(a,l){return n(a.L,a.U,a.p,a.q,l)}});function m(e){if((0,L.SW)(e))return e;if((0,L.kJ)(e))return o(e);throw new TypeError("Invalid Matrix LU decomposition")}function n(e,a,l,c,f){e=m(e),a=m(a),l&&(f=v(e,f,!0),f._data=Xv(l,f._data));var b=p(e,f),w=s(a,b);return c&&(w._data=Xv(c,w._data)),w}}),jv="median",G0=["typed","add","divide","compare","partitionSelect"],H0=(0,A.d5)(jv,G0,u=>{var{typed:i,add:o,divide:t,compare:r,partitionSelect:s}=u;function p(m){try{m=(0,ze.xH)(m.valueOf());var n=m.length;if(n===0)throw new Error("Cannot calculate median of an empty array");if(n%2===0){for(var e=n/2-1,a=s(m,e+1),l=m[e],c=0;c<e;++c)r(m[c],l)>0&&(l=m[c]);return v(l,a)}else{var f=s(m,(n-1)/2);return d(f)}}catch(b){throw(0,ut.x)(b,"median")}}var d=i({"number | BigNumber | Complex | Unit":function(n){return n}}),v=i({"number | BigNumber | Complex | Unit, number | BigNumber | Complex | Unit":function(n,e){return t(o(n,e),2)}});return i(jv,{"Array | Matrix":p,"Array | Matrix, number | BigNumber":function(n,e){throw new Error("median(A, dim) is not yet supported")},"...":function(n){if((0,Mr.CQ)(n))throw new TypeError("Scalar values expected in function median");return p(n)}})}),ep="setUnion",k0=["typed","size","concat","subset","setIntersect","setSymDifference","Index"],$0=(0,A.d5)(ep,k0,u=>{var{typed:i,size:o,concat:t,subset:r,setIntersect:s,setSymDifference:p,Index:d}=u;return i(ep,{"Array | Matrix, Array | Matrix":function(m,n){if(r(o(m),new d(0))===0)return(0,ze.xH)(n);if(r(o(n),new d(0))===0)return(0,ze.xH)(m);var e=(0,ze.xH)(m),a=(0,ze.xH)(n);return t(p(e,a),s(e,a))}})}),V0=ie(34678),rp="kldivergence",J0=["typed","matrix","divide","sum","multiply","dotDivide","log","isNumeric"],Z0=(0,A.d5)(rp,J0,u=>{var{typed:i,matrix:o,divide:t,sum:r,multiply:s,dotDivide:p,log:d,isNumeric:v}=u;return i(rp,{"Array, Array":function(e,a){return m(o(e),o(a))},"Matrix, Array":function(e,a){return m(e,o(a))},"Array, Matrix":function(e,a){return m(o(e),a)},"Matrix, Matrix":function(e,a){return m(e,a)}});function m(n,e){var a=e.size().length,l=n.size().length;if(a>1)throw new Error("first object must be one dimensional");if(l>1)throw new Error("second object must be one dimensional");if(a!==l)throw new Error("Length of two vectors must be equal");var c=r(n);if(c===0)throw new Error("Sum of elements in first object must be non zero");var f=r(e);if(f===0)throw new Error("Sum of elements in second object must be non zero");var b=t(n,r(n)),w=t(e,r(e)),E=r(s(b,d(p(b,w))));return v(E)?E:Number.NaN}}),tp="norm",K0=["typed","abs","add","pow","conj","sqrt","multiply","equalScalar","larger","smaller","matrix","ctranspose","eigs"],Y0=(0,A.d5)(tp,K0,u=>{var{typed:i,abs:o,add:t,pow:r,conj:s,sqrt:p,multiply:d,equalScalar:v,larger:m,smaller:n,matrix:e,ctranspose:a,eigs:l}=u;return i(tp,{number:Math.abs,Complex:function(O){return O.abs()},BigNumber:function(O){return O.abs()},boolean:function(O){return Math.abs(O)},Array:function(O){return h(e(O),2)},Matrix:function(O){return h(O,2)},"number | Complex | BigNumber | boolean, number | BigNumber | string":function(O){return this(O)},"Array, number | BigNumber | string":function(O,T){return h(e(O),T)},"Matrix, number | BigNumber | string":function(O,T){return h(O,T)}});function c(C){var O=0;return C.forEach(function(T){var M=o(T);m(M,O)&&(O=M)},!0),O}function f(C){var O;return C.forEach(function(T){var M=o(T);(!O||n(M,O))&&(O=M)},!0),O||0}function b(C,O){if(O===Number.POSITIVE_INFINITY||O==="inf")return c(C);if(O===Number.NEGATIVE_INFINITY||O==="-inf")return f(C);if(O==="fro")return h(C,2);if(typeof O=="number"&&!isNaN(O)){if(!v(O,0)){var T=0;return C.forEach(function(M){T=t(r(o(M),O),T)},!0),r(T,1/O)}return Number.POSITIVE_INFINITY}throw new Error("Unsupported parameter value")}function w(C){var O=0;return C.forEach(function(T,M){O=t(O,d(T,s(T)))}),o(p(O))}function E(C){var O=[],T=0;return C.forEach(function(M,P){var z=P[1],$=t(O[z]||0,o(M));m($,T)&&(T=$),O[z]=$},!0),T}function g(C){var O=C.size();if(O[0]!==O[1])throw new RangeError("Invalid matrix dimensions");var T=a(C),M=d(T,C),P=l(M).values.toArray(),z=P[P.length-1];return o(p(z))}function S(C){var O=[],T=0;return C.forEach(function(M,P){var z=P[0],$=t(O[z]||0,o(M));m($,T)&&(T=$),O[z]=$},!0),T}function N(C,O){if(O===1)return E(C);if(O===Number.POSITIVE_INFINITY||O==="inf")return S(C);if(O==="fro")return w(C);if(O===2)return g(C);throw new Error("Unsupported parameter value "+O)}function h(C,O){var T=C.size();if(T.length===1)return b(C,O);if(T.length===2){if(T[0]&&T[1])return N(C,O);throw new RangeError("Invalid matrix dimensions")}}}),np="rotationMatrix",X0=["typed","config","multiplyScalar","addScalar","unaryMinus","norm","matrix","BigNumber","DenseMatrix","SparseMatrix","cos","sin"],Q0=(0,A.d5)(np,X0,u=>{var{typed:i,config:o,multiplyScalar:t,addScalar:r,unaryMinus:s,norm:p,BigNumber:d,matrix:v,DenseMatrix:m,SparseMatrix:n,cos:e,sin:a}=u;return i(np,{"":function(){return o.matrix==="Matrix"?v([]):[]},string:function(g){return v(g)},"number | BigNumber | Complex | Unit":function(g){return l(g,o.matrix==="Matrix"?"dense":void 0)},"number | BigNumber | Complex | Unit, string":function(g,S){return l(g,S)},"number | BigNumber | Complex | Unit, Array":function(g,S){var N=v(S);return c(N),w(g,N,void 0)},"number | BigNumber | Complex | Unit, Matrix":function(g,S){c(S);var N=S.storage()||(o.matrix==="Matrix"?"dense":void 0);return w(g,S,N)},"number | BigNumber | Complex | Unit, Array, string":function(g,S,N){var h=v(S);return c(h),w(g,h,N)},"number | BigNumber | Complex | Unit, Matrix, string":function(g,S,N){return c(S),w(g,S,N)}});function l(E,g){var S=(0,L.l9)(E),N=S?new d(-1):-1,h=e(E),C=a(E),O=[[h,t(N,C)],[C,h]];return b(O,g)}function c(E){var g=E.size();if(g.length<1||g[0]!==3)throw new RangeError("Vector must be of dimensions 1x3")}function f(E){return E.reduce((g,S)=>t(g,S))}function b(E,g){if(g){if(g==="sparse")return new n(E);if(g==="dense")return new m(E);throw new TypeError('Unknown matrix type "'.concat(g,'"'))}return E}function w(E,g,S){var N=p(g);if(N===0)throw new RangeError("Rotation around zero vector");var h=(0,L.l9)(E)?d:null,C=h?new h(1):1,O=h?new h(-1):-1,T=h?new h(g.get([0])/N):g.get([0])/N,M=h?new h(g.get([1])/N):g.get([1])/N,P=h?new h(g.get([2])/N):g.get([2])/N,z=e(E),$=r(C,s(z)),V=a(E),te=r(z,f([T,T,$])),K=r(f([T,M,$]),f([O,P,V])),I=r(f([T,P,$]),f([M,V])),ve=r(f([T,M,$]),f([P,V])),B=r(z,f([M,M,$])),j=r(f([M,P,$]),f([O,T,V])),ye=r(f([T,P,$]),f([O,M,V])),Ve=r(f([M,P,$]),f([T,V])),re=r(z,f([P,P,$])),be=[[te,K,I],[ve,B,j],[ye,Ve,re]];return b(be,S)}}),j0=ie(2128),ap="mad",ex=["typed","abs","map","median","subtract"],rx=(0,A.d5)(ap,ex,u=>{var{typed:i,abs:o,map:t,median:r,subtract:s}=u;return i(ap,{"Array | Matrix":p,"...":function(v){return p(v)}});function p(d){if(d=(0,ze.xH)(d.valueOf()),d.length===0)throw new Error("Cannot calculate median absolute deviation (mad) of an empty array");try{var v=r(d);return r(t(d,function(m){return o(s(m,v))}))}catch(m){throw m instanceof TypeError&&m.message.indexOf("median")!==-1?new TypeError(m.message.replace("median","mad")):(0,ut.x)(m,"mad")}}}),ip="rotate",tx=["typed","multiply","rotationMatrix"],nx=(0,A.d5)(ip,tx,u=>{var{typed:i,multiply:o,rotationMatrix:t}=u;return i(ip,{"Array , number | BigNumber | Complex | Unit":function(p,d){r(p,2);var v=o(t(d),p);return v.toArray()},"Matrix , number | BigNumber | Complex | Unit":function(p,d){return r(p,2),o(t(d),p)},"Array, number | BigNumber | Complex | Unit, Array | Matrix":function(p,d,v){r(p,3);var m=o(t(d,v),p);return m},"Matrix, number | BigNumber | Complex | Unit, Array | Matrix":function(p,d,v){return r(p,3),o(t(d,v),p)}});function r(s,p){var d=Array.isArray(s)?(0,ze.aJ)(s):s.size();if(d.length>2)throw new RangeError("Vector must be of dimensions 1x".concat(p));if(d.length===2&&d[1]!==1)throw new RangeError("Vector must be of dimensions 1x".concat(p));if(d[0]!==p)throw new RangeError("Vector must be of dimensions 1x".concat(p))}}),ur=Te({config:Q.v}),mt=Me({}),ax=Ir({BigNumber:ur,config:Q.v}),ix=vr({}),ox=ks({BigNumber:ur,config:Q.v}),qn=hu({}),op=ht({Complex:mt}),sx=nt({BigNumber:ur,config:Q.v}),ux=lr({BigNumber:ur,config:Q.v}),cx=Er({BigNumber:ur,config:Q.v}),ps=yu({}),lx=Le({BigNumber:ur,config:Q.v}),fx=Ye({}),mx=he({BigNumber:ur,config:Q.v}),vx=Nu({}),px=Mu({}),dx=kr({BigNumber:ur,config:Q.v}),hx=ou({BigNumber:ur,config:Q.v}),sp=Pr({BigNumber:ur,config:Q.v}),gx=Qe({}),yx=Ms({}),Kr=_u({Matrix:ps}),xx=Xs({BigNumber:ur,config:Q.v}),bx=qe({BigNumber:ur,config:Q.v}),Nx=nr({BigNumber:ur,config:Q.v}),wx=Cu({}),Mx=vt({BigNumber:ur,config:Q.v}),ee=Du({BigNumber:ur,Complex:mt,DenseMatrix:Kr,Fraction:qn}),up=Pu({BigNumber:ur,config:Q.v,typed:ee}),Ax=Ys({BigNumber:ur,config:Q.v}),Ht=qu({typed:ee}),Sx=Gu({Complex:mt,config:Q.v,typed:ee}),_x=ec({BigNumber:ur,typed:ee}),Ex=tc({BigNumber:ur,Complex:mt,config:Q.v,typed:ee}),At=ac({typed:ee}),Cx=oc({typed:ee}),Ox=uc({BigNumber:ur,Complex:mt,config:Q.v,typed:ee}),Dx=fc({typed:ee}),cp=pc({typed:ee}),Bx=hc({Complex:mt,config:Q.v,typed:ee}),Da=xc({BigNumber:ur,typed:ee}),Tx=Ec({typed:ee}),Ux=Oc({typed:ee}),Rx=Bc({typed:ee}),ds=Uc({typed:ee}),hs=Fc({Complex:mt,typed:ee}),ia=Pc({typed:ee}),Ix=qc({typed:ee}),Fx=Gc({BigNumber:ur,typed:ee}),zx=kc({BigNumber:ur,typed:ee}),Px=Vc({typed:ee}),it=Kc({config:Q.v,typed:ee}),Lx=Qc({typed:ee}),lp=nl({typed:ee}),qx=il({Complex:mt,typed:ee}),Wx=ul({typed:ee}),Gx=ll({typed:ee}),Ba=vl({typed:ee}),Hx=dl({typed:ee}),kx=gl({format:Ba,typed:ee}),fp=xl({typed:ee}),an=Nl({typed:ee}),oa=Al({typed:ee}),gs=_l({typed:ee}),sa=Cl({typed:ee}),$x=pr({BigNumber:ur,config:Q.v}),Vx=Tl({Complex:mt,typed:ee}),Jx=Rl({Complex:mt,config:Q.v,typed:ee}),Zx=Fl({Complex:mt,config:Q.v,typed:ee}),mp=Pl({typed:ee}),wt=Gl({typed:ee}),vp=$l({typed:ee}),Wn=Zl({typed:ee}),Kx=Yl({format:Ba,typed:ee}),Yx=Ql({config:Q.v,typed:ee}),Xx=Eo({typed:ee}),Qx=rf({config:Q.v,typed:ee}),pp=nf({typed:ee}),jx=of({BigNumber:ur,typed:ee}),dp=sf({BigNumber:ur,Fraction:qn,complex:hs,typed:ee}),em=cf({typed:ee}),gn=mf({Matrix:ps,equalScalar:it,typed:ee}),eb=pf({typed:ee}),rb=hf({typed:ee}),tb=yf({typed:ee}),nb=bf({typed:ee}),ab=wf({typed:ee}),ib=Mf({Complex:mt,config:Q.v,typed:ee}),ob=Wo({BigNumber:ur,typed:ee}),hp=(0,Sf.j)({isInteger:an,typed:ee}),sb=Ef({BigNumber:ur,Complex:mt,config:Q.v,typed:ee}),ub=Of({format:Ba,typed:ee}),cb=Bf({typed:ee}),rm=Uf({typed:ee}),lb=If({BigNumber:ur,typed:ee}),ys=Ff({typed:ee}),fb=Pf({typed:ee}),mb=D({config:Q.v,typed:ee}),vb=Qo({BigNumber:ur,typed:ee}),pb=Rn({typed:ee}),db=jo({SparseMatrix:gn,typed:ee}),_n=rs({Complex:mt,config:Q.v,typed:ee}),hb=qf({typed:ee}),yn=Fn({typed:ee}),gb=pn({BigNumber:ur,Complex:mt,config:Q.v,typed:ee}),yb=is({BigNumber:ur,typed:ee}),tm=os({Fraction:qn,typed:ee}),Gn=Gf({typed:ee}),wr=us({DenseMatrix:Kr,Matrix:ps,SparseMatrix:gn,typed:ee}),xb=$f({isZero:sa,matrix:wr,typed:ee}),gp=je({DenseMatrix:Kr,equalScalar:it,matrix:wr,typed:ee}),bb=ae({BigNumber:ur,equalScalar:it,matrix:wr,typed:ee}),ua=jr({bignumber:Da,fraction:tm,number:Wn}),Nb=rt({DenseMatrix:Kr,equalScalar:it,matrix:wr,typed:ee}),yp=Zr({config:Q.v,multiplyScalar:wt,numeric:ua,typed:ee}),wb=xt({isInteger:an,matrix:wr,typed:ee}),zt=nn({matrix:wr,config:Q.v,typed:ee}),on=Lr({DenseMatrix:Kr,config:Q.v,matrix:wr,typed:ee}),Mb=gt({matrix:wr,typed:ee}),sn=(0,Ot.q)({matrix:wr,typed:ee}),_t=Ln({DenseMatrix:Kr,addScalar:At,equalScalar:it,matrix:wr,typed:ee,unaryMinus:yn}),Ab=ra({matrix:wr,typed:ee}),nm=x({matrix:wr,typed:ee}),xp=fr({BigNumber:ur,config:Q.v,matrix:wr,typed:ee}),un=Gt({BigNumber:ur,config:Q.v,matrix:wr,typed:ee}),Sb=ed({equalScalar:it,matrix:wr,not:vp,typed:ee,zeros:un}),_b=td({equalScalar:it,matrix:wr,typed:ee}),Eb=ad({DenseMatrix:Kr,matrix:wr,typed:ee}),Cb=od({BigNumber:ur,Complex:mt,Fraction:qn,config:Q.v,isNegative:oa,matrix:wr,typed:ee,unaryMinus:yn}),ca=ud({BigNumber:ur,DenseMatrix:Kr,Fraction:qn,config:Q.v,equalScalar:it,matrix:wr,typed:ee}),bp=ld({matrix:wr,typed:ee}),am=(0,fd.k)({isInteger:an,matrix:wr,typed:ee}),Ob=vd({prod:yp,size:zt,typed:ee}),im=dd({conj:ia,transpose:nm,typed:ee}),Np=gd({DenseMatrix:Kr,SparseMatrix:gn,matrix:wr,typed:ee}),yt=xd({numeric:ua,typed:ee}),xs=Nd({DenseMatrix:Kr,divideScalar:yt,equalScalar:it,matrix:wr,typed:ee}),Hn=Md({DenseMatrix:Kr,equalScalar:it,matrix:wr,typed:ee}),wp=Sd({addScalar:At,divideScalar:yt,exp:lp,i:op,matrix:wr,multiplyScalar:wt,tau:sp,typed:ee}),Ta=Ed({matrix:wr,typed:ee}),Db=Bd({BigNumber:ur,DenseMatrix:Kr,equalScalar:it,matrix:wr,typed:ee}),Bb=Ud({isNumeric:Gn,typed:ee}),Tb=Id({abs:Ht,addScalar:At,divideScalar:yt,isPositive:gs,multiplyScalar:wt,smaller:on,sqrt:_n,typed:ee}),Ub=zd({conj:ia,dotDivide:xs,fft:wp,typed:ee}),Rb=Ld({matrix:wr,multiplyScalar:wt,typed:ee}),om=Wd({DenseMatrix:Kr,config:Q.v,matrix:wr,typed:ee}),Ib=$d({DenseMatrix:Kr,equalScalar:it,matrix:wr,typed:ee,zeros:un}),Mp=Jd({DenseMatrix:Kr,divideScalar:yt,equalScalar:it,matrix:wr,multiplyScalar:wt,subtract:_t,typed:ee}),Ap=Kd({flatten:Ta,matrix:wr,size:zt,typed:ee}),Fb=(0,Yd.D)({config:Q.v,numeric:ua,smaller:on,typed:ee}),zb=Qd({isNaN:ys,isNumeric:Gn,typed:ee}),Pb=eh({Complex:mt,config:Q.v,divideScalar:yt,typed:ee}),Lb=nh({BigNumber:ur,config:Q.v,matrix:wr,typed:ee}),sm=ih({compare:ca,isNaN:ys,isNumeric:Gn,typed:ee}),qb=uh({config:Q.v,matrix:wr}),Wb=lh({DenseMatrix:Kr,equalScalar:it,matrix:wr,typed:ee,zeros:un}),bs=mh({BigNumber:ur,DenseMatrix:Kr,equalScalar:it,matrix:wr,typed:ee,zeros:un}),Sp=ph({DenseMatrix:Kr,config:Q.v,matrix:wr,typed:ee}),Gb=hh({DenseMatrix:Kr,config:Q.v,equalScalar:it,matrix:wr,typed:ee}),um=yh({DenseMatrix:Kr,divideScalar:yt,equalScalar:it,matrix:wr,multiplyScalar:wt,subtract:_t,typed:ee}),Hb=bh({DenseMatrix:Kr,matrix:wr,typed:ee}),Tt=wh({DenseMatrix:Kr,SparseMatrix:gn,addScalar:At,equalScalar:it,matrix:wr,typed:ee}),kb=_h({BigNumber:ur,DenseMatrix:Kr,equalScalar:it,matrix:wr,typed:ee}),$b=Ch({DenseMatrix:Kr,equalScalar:it,matrix:wr,typed:ee}),Vb=Dh({addScalar:At,combinations:ds,divideScalar:yt,isInteger:an,isNegative:oa,multiplyScalar:wt,typed:ee}),cn=Th({compare:ca,typed:ee}),Jb=(0,Rh.o)({add:Tt,typed:ee,unaryPlus:up}),_p=Fh({equal:Hn,typed:ee}),Zb=(0,zh.J)({matrix:wr,number:Wn,subtract:_t,typed:ee}),Ns=Lh({addScalar:At,conj:ia,multiplyScalar:wt,size:zt,typed:ee}),Kb=Wh({compareText:bp,isZero:sa,typed:ee}),Ep=kh({DenseMatrix:Kr,config:Q.v,equalScalar:it,matrix:wr,round:bs,typed:ee,zeros:un}),la=Vh({BigNumber:ur,DenseMatrix:Kr,SparseMatrix:gn,config:Q.v,matrix:wr,typed:ee}),Yb=Zh({BigNumber:ur,add:Tt,config:Q.v,equal:Hn,isInteger:an,mod:gp,smaller:on,typed:ee,xgcd:xp}),ln=Yh({DenseMatrix:Kr,config:Q.v,matrix:wr,typed:ee}),cm=Qh({Complex:mt,config:Q.v,divideScalar:yt,typed:ee}),Xb=eg({DenseMatrix:Kr,divideScalar:yt,equalScalar:it,matrix:wr,multiplyScalar:wt,subtract:_t,typed:ee}),Qb=tg({flatten:Ta,matrix:wr,size:zt,typed:ee}),Dt=ag({addScalar:At,dot:Ns,equalScalar:it,matrix:wr,multiplyScalar:wt,typed:ee}),Cp=og({addScalar:At,complex:hs,conj:ia,divideScalar:yt,equal:Hn,identity:la,isZero:sa,matrix:wr,multiplyScalar:wt,sign:dp,sqrt:_n,subtract:_t,typed:ee,unaryMinus:yn,zeros:un}),lm=(0,sg.M)({bignumber:Da,matrix:wr,config:Q.v,larger:ln,largerEq:om,smaller:on,smallerEq:Sp,typed:ee}),jb=cg({DenseMatrix:Kr,equalScalar:it,matrix:wr,typed:ee,zeros:un}),e1=fg({compareNatural:cn,typed:ee}),Op=Ig({SparseMatrix:gn,abs:Ht,add:Tt,divideScalar:yt,larger:ln,largerEq:om,multiply:Dt,subtract:_t,transpose:nm,typed:ee}),Dp=(0,Fg.O)({add:Tt,config:Q.v,numeric:ua,typed:ee}),r1=Lg({add:Tt,matrix:wr,typed:ee}),Bp=Wg({DenseMatrix:Kr,divideScalar:yt,equalScalar:it,matrix:wr,multiplyScalar:wt,subtract:_t,typed:ee}),t1=Hg({Complex:mt,config:Q.v,typed:ee}),Tp=Vg({DenseMatrix:Kr,config:Q.v,equalScalar:it,matrix:wr,round:bs,typed:ee,zeros:un}),n1=Zg({addScalar:At,combinations:ds,isInteger:an,isNegative:oa,isPositive:gs,larger:ln,typed:ee}),a1=Yg({matrix:wr,multiply:Dt,subtract:_t,typed:ee}),Up=Qg({divideScalar:yt,isZero:sa,matrix:wr,multiply:Dt,subtract:_t,typed:ee,unaryMinus:yn}),i1=ey({abs:Ht,addScalar:At,divideScalar:yt,multiplyScalar:wt,sqrt:_n,subtract:_t,typed:ee,unaryMinus:yn}),o1=ty({equalScalar:it,matrix:wr,multiplyScalar:wt,typed:ee}),Rp=iy({larger:ln,smaller:on}),Ip=uy({Complex:mt,DenseMatrix:Kr,ceil:Tp,equalScalar:it,floor:Ep,matrix:wr,typed:ee,zeros:un}),Fp=fy({DenseMatrix:Kr,smaller:on}),kt=py({ImmutableDenseMatrix:Fp}),s1=gy({abs:Ht,add:Tt,addScalar:At,config:Q.v,divideScalar:yt,equalScalar:it,flatten:Ta,isNumeric:Gn,isZero:sa,matrix:wr,multiply:Dt,multiplyScalar:wt,smaller:on,subtract:_t,typed:ee}),u1=xy({equalScalar:it,matrix:wr,typed:ee}),c1=Ny({Complex:mt,config:Q.v,divideScalar:yt,log:cm,typed:ee}),zp=(0,wy.J)({config:Q.v,larger:ln,numeric:ua,typed:ee}),l1=Sy({add:Tt,compare:ca,multiply:Dt,partitionSelect:sm,typed:ee}),f1=(0,_y.v)({Index:kt,matrix:wr,range:lm,typed:ee}),m1=Cy({DenseMatrix:Kr,Index:kt,compareNatural:cn,size:zt,subset:sn,typed:ee}),v1=Dy({DenseMatrix:Kr,Index:kt,compareNatural:cn,size:zt,subset:sn,typed:ee}),p1=Ty({Index:kt,compareNatural:cn,size:zt,subset:sn,typed:ee}),d1=Ry({Index:kt,compareNatural:cn,size:zt,subset:sn,typed:ee}),h1=Fy({compare:ca,compareNatural:cn,matrix:wr,typed:ee}),Pp=(0,zy.w)({Index:kt,matrix:wr,range:lm,typed:ee}),g1=Ly({Index:kt,typed:ee}),kn=Wy({abs:Ht,addScalar:At,det:Up,divideScalar:yt,identity:la,matrix:wr,multiply:Dt,typed:ee,unaryMinus:yn}),y1=Hy({Complex:mt,add:Tt,ctranspose:im,deepEqual:_p,divideScalar:yt,dot:Ns,dotDivide:xs,equal:Hn,inv:kn,matrix:wr,multiply:Dt,typed:ee}),fa=$y({Complex:mt,config:Q.v,fraction:tm,identity:la,inv:kn,matrix:wr,multiply:Dt,number:Wn,typed:ee}),Lp=Jy({DenseMatrix:Kr,Index:kt,compareNatural:cn,size:zt,subset:sn,typed:ee}),x1=Ky({Index:kt,compareNatural:cn,size:zt,subset:sn,typed:ee}),qp=Qy({FibonacciHeap:Rp,addScalar:At,equalScalar:it}),b1=e0({abs:Ht,add:Tt,identity:la,inv:kn,max:zp,multiply:Dt,size:zt,sqrt:_n,subtract:_t,typed:ee}),Wr=a0({BigNumber:ur,Complex:mt,Fraction:qn,abs:Ht,addScalar:At,config:Q.v,divideScalar:yt,equal:Hn,fix:Ip,format:Ba,isNumeric:Gn,multiplyScalar:wt,number:Wn,pow:fa,round:bs,subtract:_t}),N1=Ds({BigNumber:ur,Unit:Wr,config:Q.v}),w1=Ia({BigNumber:ur,Unit:Wr,config:Q.v}),M1=Qs({BigNumber:ur,Unit:Wr,config:Q.v}),A1=Us({BigNumber:ur,Unit:Wr,config:Q.v}),S1=eu({BigNumber:ur,Unit:Wr,config:Q.v}),_1=Rs({BigNumber:ur,Unit:Wr,config:Q.v}),E1=o0({Unit:Wr,typed:ee}),C1=Ra({BigNumber:ur,Unit:Wr,config:Q.v}),O1=u0({DenseMatrix:Kr,equalScalar:it,matrix:wr,pow:fa,typed:ee}),D1=Os({BigNumber:ur,Unit:Wr,config:Q.v}),B1=Ts({BigNumber:ur,Unit:Wr,config:Q.v}),T1=l0({abs:Ht,add:Tt,identity:la,inv:kn,multiply:Dt,typed:ee}),U1=ru({BigNumber:ur,Unit:Wr,config:Q.v}),R1=tu({BigNumber:ur,Unit:Wr,config:Q.v}),Wp=m0({BigNumber:ur,Complex:mt,config:Q.v,multiplyScalar:wt,pow:fa,typed:ee}),I1=Ss({BigNumber:ur,Unit:Wr,config:Q.v}),F1=$s({BigNumber:ur,Unit:Wr,config:Q.v}),z1=Ps({BigNumber:ur,Unit:Wr,config:Q.v}),P1=nu({BigNumber:ur,Unit:Wr,config:Q.v}),L1=Cs({BigNumber:ur,Unit:Wr,config:Q.v}),q1=uu({BigNumber:ur,Unit:Wr,config:Q.v}),W1=On({BigNumber:ur,Unit:Wr,config:Q.v}),G1=Vs({BigNumber:ur,Unit:Wr,config:Q.v}),H1=zs({BigNumber:ur,Unit:Wr,config:Q.v}),k1=Fa({BigNumber:ur,Unit:Wr,config:Q.v}),$1=fu({BigNumber:ur,Unit:Wr,config:Q.v}),V1=va({BigNumber:ur,Unit:Wr,config:Q.v}),J1=Bt({BigNumber:ur,Unit:Wr,config:Q.v}),Z1=Es({BigNumber:ur,Unit:Wr,config:Q.v}),K1=Zs({BigNumber:ur,Unit:Wr,config:Q.v}),Gp=p0({DenseMatrix:Kr,Index:kt,compareNatural:cn,size:zt,subset:sn,typed:ee}),Y1=As({BigNumber:ur,Unit:Wr,config:Q.v}),X1=$n({BigNumber:ur,Unit:Wr,config:Q.v}),Q1=Ks({BigNumber:ur,Unit:Wr,config:Q.v}),j1=js({BigNumber:ur,Unit:Wr,config:Q.v}),eN=qs({BigNumber:ur,Unit:Wr,config:Q.v}),rN=Bs({BigNumber:ur,Unit:Wr,config:Q.v}),ma=g0({divideScalar:yt,equalScalar:it,inv:kn,matrix:wr,multiply:Dt,typed:ee}),tN=Gs({BigNumber:ur,Unit:Wr,config:Q.v}),ws=x0({gamma:Wp,typed:ee}),nN=lu({BigNumber:ur,Unit:Wr,config:Q.v}),aN=Is({BigNumber:ur,Unit:Wr,config:Q.v}),Hp=N0({DenseMatrix:Kr,Spa:qp,SparseMatrix:gn,abs:Ht,addScalar:At,divideScalar:yt,equalScalar:it,larger:ln,matrix:wr,multiplyScalar:wt,subtract:_t,typed:ee,unaryMinus:yn}),iN=Fs({BigNumber:ur,Unit:Wr,config:Q.v}),oN=cu({BigNumber:ur,Unit:Wr,config:Q.v}),sN=M0({add:Tt,divide:ma,factorial:ws,isInteger:an,isPositive:gs,multiply:Dt,typed:ee}),uN=S0({factorial:ws,typed:ee}),cN=mu({BigNumber:ur,Unit:Wr,config:Q.v}),lN=Js({BigNumber:ur,Unit:Wr,config:Q.v}),fN=su({BigNumber:ur,Unit:Wr,config:Q.v}),kp=E0({bignumber:Da,addScalar:At,combinations:ds,divideScalar:yt,factorial:ws,isInteger:an,isNegative:oa,larger:ln,multiplyScalar:wt,number:Wn,pow:fa,subtract:_t,typed:ee}),mN=O0({Unit:Wr,typed:ee}),vN=B0({addScalar:At,isInteger:an,isNegative:oa,stirlingS2:kp,typed:ee}),$p=F0({abs:Ht,add:Tt,addScalar:At,atan:cp,bignumber:Da,column:Pp,complex:hs,config:Q.v,cos:rm,diag:Np,divideScalar:yt,dot:Ns,equal:Hn,flatten:Ta,im:fp,inv:kn,larger:ln,matrix:wr,matrixFromColumns:Ap,multiply:Dt,multiplyScalar:wt,number:Wn,qr:Cp,re:pp,sin:em,smaller:on,sqrt:_n,subtract:_t,typed:ee,usolve:um,usolveAll:Bp}),pN=Hs({BigNumber:ur,Unit:Wr,config:Q.v}),dN=(0,z0.Q)({add:Tt,divide:ma,typed:ee}),hN=iu({BigNumber:ur,Unit:Wr,config:Q.v}),gN=_s({BigNumber:ur,Unit:Wr,config:Q.v}),Vp=L0({Index:kt,concat:am,setDifference:Lp,size:zt,subset:sn,typed:ee}),yN=Ws({BigNumber:ur,Unit:Wr,config:Q.v}),xN=W0({DenseMatrix:Kr,lsolve:Mp,lup:Hp,matrix:wr,slu:Op,typed:ee,usolve:um}),Jp=H0({add:Tt,compare:ca,divide:ma,partitionSelect:sm,typed:ee}),bN=$0({Index:kt,concat:am,setIntersect:Gp,setSymDifference:Vp,size:zt,subset:sn,typed:ee}),Zp=(0,V0.F)({add:Tt,apply:hp,divide:ma,isNaN:ys,multiply:Dt,subtract:_t,typed:ee}),NN=Z0({divide:ma,dotDivide:xs,isNumeric:Gn,log:cm,matrix:wr,multiply:Dt,sum:Dp,typed:ee}),Kp=Y0({abs:Ht,add:Tt,conj:ia,ctranspose:im,eigs:$p,equalScalar:it,larger:ln,matrix:wr,multiply:Dt,pow:fa,smaller:on,sqrt:_n,typed:ee}),wN=vu({BigNumber:ur,Unit:Wr,config:Q.v}),Yp=Q0({BigNumber:ur,DenseMatrix:Kr,SparseMatrix:gn,addScalar:At,config:Q.v,cos:rm,matrix:wr,multiplyScalar:wt,norm:Kp,sin:em,typed:ee,unaryMinus:yn}),MN=au({BigNumber:ur,Unit:Wr,config:Q.v}),AN=(0,j0.X)({sqrt:_n,typed:ee,variance:Zp}),SN=rx({abs:Ht,map:mp,median:Jp,subtract:_t,typed:ee}),_N=nx({multiply:Dt,rotationMatrix:Yp,typed:ee})},89858:function(ot,Ur,ie){ie.d(Ur,{m:function(){return Q}});function Q(cr,A,tr){if(!(this instanceof Q))throw new SyntaxError("Constructor must be called with the new operator");this.actual=cr,this.expected=A,this.relation=tr,this.message="Dimension mismatch ("+(Array.isArray(cr)?"["+cr.join(", ")+"]":cr)+" "+(this.relation||"!=")+" "+(Array.isArray(A)?"["+A.join(", ")+"]":A)+")",this.stack=new Error().stack}Q.prototype=new RangeError,Q.prototype.constructor=RangeError,Q.prototype.name="DimensionError",Q.prototype.isDimensionError=!0},30826:function(ot,Ur,ie){ie.d(Ur,{c:function(){return Q}});function Q(cr,A,tr){if(!(this instanceof Q))throw new SyntaxError("Constructor must be called with the new operator");this.index=cr,arguments.length<3?(this.min=0,this.max=A):(this.min=A,this.max=tr),this.min!==void 0&&this.index<this.min?this.message="Index out of range ("+this.index+" < "+this.min+")":this.max!==void 0&&this.index>=this.max?this.message="Index out of range ("+this.index+" > "+(this.max-1)+")":this.message="Index out of range ("+this.index+")",this.stack=new Error().stack}Q.prototype=new RangeError,Q.prototype.constructor=RangeError,Q.prototype.name="IndexError",Q.prototype.isIndexError=!0},38641:function(ot,Ur,ie){ie.d(Ur,{j:function(){return ir}});var Q=ie(42711),cr=ie(58775),A=ie(77707),tr=ie(30826),Pe="apply",Te=["typed","isInteger"],ir=(0,Q.d5)(Pe,Te,$e=>{var{typed:Se,isInteger:Me}=$e;return Se(Pe,{"Array | Matrix, number | BigNumber, function":function(fe,ne,X){if(!Me(ne))throw new TypeError("Integer number expected for dimension");var de=Array.isArray(fe)?(0,cr.aJ)(fe):fe.size();if(ne<0||ne>=de.length)throw new tr.c(ne,de.length);return(0,A.SW)(fe)?fe.create(le(fe.valueOf(),ne,X)):le(fe,ne,X)}})});function le($e,Se,Me){var Ae,fe,ne;if(Se<=0)if(Array.isArray($e[0])){for(ne=L($e),fe=[],Ae=0;Ae<ne.length;Ae++)fe[Ae]=le(ne[Ae],Se-1,Me);return fe}else return Me($e);else{for(fe=[],Ae=0;Ae<$e.length;Ae++)fe[Ae]=le($e[Ae],Se-1,Me);return fe}}function L($e){var Se=$e.length,Me=$e[0].length,Ae,fe,ne=[];for(fe=0;fe<Me;fe++){var X=[];for(Ae=0;Ae<Se;Ae++)X.push($e[Ae][fe]);ne.push(X)}return ne}},12800:function(ot,Ur,ie){ie.d(Ur,{w:function(){return Te}});var Q=ie(42711),cr=ie(75150),A=ie(58775),tr="column",Pe=["typed","Index","matrix","range"],Te=(0,Q.d5)(tr,Pe,ir=>{var{typed:le,Index:L,matrix:$e,range:Se}=ir;return le(tr,{"Matrix, number":Me,"Array, number":function(fe,ne){return Me($e((0,cr.d9)(fe)),ne).valueOf()}});function Me(Ae,fe){if(Ae.size().length!==2)throw new Error("Only two dimensional matrix is supported");(0,A.Ls)(fe,Ae.size()[1]);var ne=Se(0,Ae.size()[0]),X=new L(ne,fe);return Ae.subset(X)}})},12155:function(ot,Ur,ie){ie.d(Ur,{k:function(){return L}});var Q=ie(77707),cr=ie(75150),A=ie(58775),tr=ie(30826),Pe=ie(89858),Te=ie(42711),ir="concat",le=["typed","matrix","isInteger"],L=(0,Te.d5)(ir,le,Se=>{var{typed:Me,matrix:Ae,isInteger:fe}=Se;return Me(ir,{"...Array | Matrix | number | BigNumber":function(X){var de,Ie=X.length,Oe=-1,ue,ge=!1,Re=[];for(de=0;de<Ie;de++){var Ze=X[de];if((0,Q.SW)(Ze)&&(ge=!0),(0,Q.hj)(Ze)||(0,Q.l9)(Ze)){if(de!==Ie-1)throw new Error("Dimension must be specified as last argument");if(ue=Oe,Oe=Ze.valueOf(),!fe(Oe))throw new TypeError("Integer number expected for dimension");if(Oe<0||de>0&&Oe>ue)throw new tr.c(Oe,ue+1)}else{var Qe=(0,cr.d9)(Ze).valueOf(),vr=(0,A.aJ)(Qe);if(Re[de]=Qe,ue=Oe,Oe=vr.length-1,de>0&&Oe!==ue)throw new Pe.m(ue+1,Oe+1)}}if(Re.length===0)throw new SyntaxError("At least one matrix expected");for(var Ye=Re.shift();Re.length;)Ye=$e(Ye,Re.shift(),Oe,0);return ge?Ae(Ye):Ye},"...string":function(X){return X.join("")}})});function $e(Se,Me,Ae,fe){if(fe<Ae){if(Se.length!==Me.length)throw new Pe.m(Se.length,Me.length);for(var ne=[],X=0;X<Se.length;X++)ne[X]=$e(Se[X],Me[X],Ae,fe+1);return ne}else return Se.concat(Me)}},88800:function(ot,Ur,ie){ie.d(Ur,{J:function(){return Te}});var Q=ie(42711),cr=ie(36041),A=ie(77707),tr="diff",Pe=["typed","matrix","subtract","number"],Te=(0,Q.d5)(tr,Pe,ir=>{var{typed:le,matrix:L,subtract:$e,number:Se}=ir;return le(tr,{"Array | Matrix":function(de){return(0,A.SW)(de)?L(Ae(de.toArray())):Ae(de)},"Array | Matrix, number":function(de,Ie){if(!(0,cr.U)(Ie))throw new RangeError("Dimension must be a whole number");return(0,A.SW)(de)?L(Me(de.toArray(),Ie)):Me(de,Ie)},"Array | Matrix, BigNumber":function(de,Ie){return this(de,Se(Ie))}});function Me(X,de){if((0,A.SW)(X)&&(X=X.toArray()),!Array.isArray(X))throw RangeError("Array/Matrix does not have that many dimensions");if(de>0){var Ie=[];return X.forEach(Oe=>{Ie.push(Me(Oe,de-1))}),Ie}else{if(de===0)return Ae(X);throw RangeError("Cannot have negative dimension")}}function Ae(X){var de=[],Ie=X.length;if(Ie<2)return X;for(var Oe=1;Oe<Ie;Oe++)de.push(fe(X[Oe-1],X[Oe]));return de}function fe(X,de){(0,A.SW)(X)&&(X=X.toArray()),(0,A.SW)(de)&&(de=de.toArray());var Ie=Array.isArray(X),Oe=Array.isArray(de);if(Ie&&Oe)return ne(X,de);if(!Ie&&!Oe)return $e(de,X);throw TypeError("Cannot calculate difference between 1 array and 1 non-array")}function ne(X,de){if(X.length!==de.length)throw RangeError("Not all sub-arrays have the same length");for(var Ie=[],Oe=X.length,ue=0;ue<Oe;ue++)Ie.push(fe(X[ue],de[ue]));return Ie}})},39666:function(ot,Ur,ie){ie.d(Ur,{M:function(){return Pe}});var Q=ie(42711),cr=ie(35337),A="range",tr=["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq"],Pe=(0,Q.d5)(A,tr,Te=>{var{typed:ir,config:le,matrix:L,bignumber:$e,smaller:Se,smallerEq:Me,larger:Ae,largerEq:fe}=Te;return ir(A,{string:X,"string, boolean":X,"number, number":function(Ze,Qe){return ne(de(Ze,Qe,1))},"number, number, number":function(Ze,Qe,vr){return ne(de(Ze,Qe,vr))},"number, number, boolean":function(Ze,Qe,vr){return ne(vr?Ie(Ze,Qe,1):de(Ze,Qe,1))},"number, number, number, boolean":function(Ze,Qe,vr,Ye){return ne(Ye?Ie(Ze,Qe,vr):de(Ze,Qe,vr))},"BigNumber, BigNumber":function(Ze,Qe){var vr=Ze.constructor;return ne(Oe(Ze,Qe,new vr(1)))},"BigNumber, BigNumber, BigNumber":function(Ze,Qe,vr){return ne(Oe(Ze,Qe,vr))},"BigNumber, BigNumber, boolean":function(Ze,Qe,vr){var Ye=Ze.constructor;return ne(vr?ue(Ze,Qe,new Ye(1)):Oe(Ze,Qe,new Ye(1)))},"BigNumber, BigNumber, BigNumber, boolean":function(Ze,Qe,vr,Ye){return ne(Ye?ue(Ze,Qe,vr):Oe(Ze,Qe,vr))}});function ne(Re){return le.matrix==="Matrix"?L?L(Re):(0,cr.kX)():Re}function X(Re,Ze){var Qe=ge(Re);if(!Qe)throw new SyntaxError('String "'+Re+'" is no valid range');var vr;return le.number==="BigNumber"?($e===void 0&&(0,cr.R3)(),vr=Ze?ue:Oe,ne(vr($e(Qe.start),$e(Qe.end),$e(Qe.step)))):(vr=Ze?Ie:de,ne(vr(Qe.start,Qe.end,Qe.step)))}function de(Re,Ze,Qe){var vr=[],Ye=Re;if(Qe>0)for(;Se(Ye,Ze);)vr.push(Ye),Ye+=Qe;else if(Qe<0)for(;Ae(Ye,Ze);)vr.push(Ye),Ye+=Qe;return vr}function Ie(Re,Ze,Qe){var vr=[],Ye=Re;if(Qe>0)for(;Me(Ye,Ze);)vr.push(Ye),Ye+=Qe;else if(Qe<0)for(;fe(Ye,Ze);)vr.push(Ye),Ye+=Qe;return vr}function Oe(Re,Ze,Qe){var vr=$e(0),Ye=[],nt=Re;if(Qe.gt(vr))for(;Se(nt,Ze);)Ye.push(nt),nt=nt.plus(Qe);else if(Qe.lt(vr))for(;Ae(nt,Ze);)Ye.push(nt),nt=nt.plus(Qe);return Ye}function ue(Re,Ze,Qe){var vr=$e(0),Ye=[],nt=Re;if(Qe.gt(vr))for(;Me(nt,Ze);)Ye.push(nt),nt=nt.plus(Qe);else if(Qe.lt(vr))for(;fe(nt,Ze);)Ye.push(nt),nt=nt.plus(Qe);return Ye}function ge(Re){var Ze=Re.split(":"),Qe=Ze.map(function(Ye){return Number(Ye)}),vr=Qe.some(function(Ye){return isNaN(Ye)});if(vr)return null;switch(Qe.length){case 2:return{start:Qe[0],end:Qe[1],step:1};case 3:return{start:Qe[0],end:Qe[2],step:Qe[1]};default:return null}}})},21588:function(ot,Ur,ie){ie.d(Ur,{v:function(){return Te}});var Q=ie(42711),cr=ie(75150),A=ie(58775),tr="row",Pe=["typed","Index","matrix","range"],Te=(0,Q.d5)(tr,Pe,ir=>{var{typed:le,Index:L,matrix:$e,range:Se}=ir;return le(tr,{"Matrix, number":Me,"Array, number":function(fe,ne){return Me($e((0,cr.d9)(fe)),ne).valueOf()}});function Me(Ae,fe){if(Ae.size().length!==2)throw new Error("Only two dimensional matrix is supported");(0,A.Ls)(fe,Ae.size()[0]);var ne=Se(0,Ae.size()[1]),X=new L(fe,ne);return Ae.subset(X)}})},37299:function(ot,Ur,ie){ie.d(Ur,{q:function(){return L}});var Q=ie(77707),cr=ie(75150),A=ie(58775),tr=ie(75259),Pe=ie(89858),Te=ie(42711),ir="subset",le=["typed","matrix"],L=(0,Te.d5)(ir,le,fe=>{var{typed:ne,matrix:X}=fe;return ne(ir,{"Array, Index":function(Ie,Oe){var ue=X(Ie),ge=ue.subset(Oe);return Oe.isScalar()?ge:ge.valueOf()},"Matrix, Index":function(Ie,Oe){return Ie.subset(Oe)},"Object, Index":Me,"string, Index":$e,"Array, Index, any":function(Ie,Oe,ue){return X((0,cr.d9)(Ie)).subset(Oe,ue,void 0).valueOf()},"Array, Index, any, any":function(Ie,Oe,ue,ge){return X((0,cr.d9)(Ie)).subset(Oe,ue,ge).valueOf()},"Matrix, Index, any":function(Ie,Oe,ue){return Ie.clone().subset(Oe,ue)},"Matrix, Index, any, any":function(Ie,Oe,ue,ge){return Ie.clone().subset(Oe,ue,ge)},"string, Index, string":Se,"string, Index, string, string":Se,"Object, Index, any":Ae})});function $e(fe,ne){if(!(0,Q.dh)(ne))throw new TypeError("Index expected");if(ne.size().length!==1)throw new Pe.m(ne.size().length,1);var X=fe.length;(0,A.Ls)(ne.min()[0],X),(0,A.Ls)(ne.max()[0],X);var de=ne.dimension(0),Ie="";return de.forEach(function(Oe){Ie+=fe.charAt(Oe)}),Ie}function Se(fe,ne,X,de){if(!ne||ne.isIndex!==!0)throw new TypeError("Index expected");if(ne.size().length!==1)throw new Pe.m(ne.size().length,1);if(de!==void 0){if(typeof de!="string"||de.length!==1)throw new TypeError("Single character expected as defaultValue")}else de=" ";var Ie=ne.dimension(0),Oe=Ie.size()[0];if(Oe!==X.length)throw new Pe.m(Ie.size()[0],X.length);var ue=fe.length;(0,A.Ls)(ne.min()[0]),(0,A.Ls)(ne.max()[0]);for(var ge=[],Re=0;Re<ue;Re++)ge[Re]=fe.charAt(Re);if(Ie.forEach(function(vr,Ye){ge[vr]=X.charAt(Ye[0])}),ge.length>ue)for(var Ze=ue-1,Qe=ge.length;Ze<Qe;Ze++)ge[Ze]||(ge[Ze]=de);return ge.join("")}function Me(fe,ne){if(ne.size().length!==1)throw new Pe.m(ne.size(),1);var X=ne.dimension(0);if(typeof X!="string")throw new TypeError("String expected as index to retrieve an object property");return(0,tr.YF)(fe,X)}function Ae(fe,ne,X){if(ne.size().length!==1)throw new Pe.m(ne.size(),1);var de=ne.dimension(0);if(typeof de!="string")throw new TypeError("String expected as index to retrieve an object property");var Ie=(0,cr.d9)(fe);return(0,tr.nI)(Ie,de,X),Ie}},21821:function(ot,Ur,ie){ie.d(Ur,{o:function(){return L}});var Q=ie(28337),cr=ie(42711),A=ie(79887),tr=ie(44690),Pe=ie(58775),Te=ie(30826),ir="cumsum",le=["typed","add","unaryPlus"],L=(0,cr.d5)(ir,le,$e=>{var{typed:Se,add:Me,unaryPlus:Ae}=$e;return Se(ir,{Array:fe,Matrix:function(Oe){return Oe.create(fe(Oe.valueOf()))},"Array, number | BigNumber":X,"Matrix, number | BigNumber":function(Oe,ue){return Oe.create(X(Oe.valueOf(),ue))},"...":function(Oe){if((0,Q.CQ)(Oe))throw new TypeError("All values expected to be scalar in function cumsum");return fe(Oe)}});function fe(Ie){try{return ne(Ie)}catch(Oe){throw(0,tr.x)(Oe,ir)}}function ne(Ie){if(Ie.length===0)return[];for(var Oe=[Ae(Ie[0])],ue=1;ue<Ie.length;++ue)Oe.push(Me(Oe[ue-1],Ie[ue]));return Oe}function X(Ie,Oe){var ue=(0,Pe.aJ)(Ie);if(Oe<0||Oe>=ue.length)throw new Te.c(Oe,ue.length);try{return de(Ie,Oe)}catch(ge){throw(0,tr.x)(ge,ir)}}function de(Ie,Oe){var ue,ge,Re;if(Oe<=0){var Ze=Ie[0][0];if(Array.isArray(Ze)){for(Re=(0,A.c)(Ie),ge=[],ue=0;ue<Re.length;ue++)ge[ue]=de(Re[ue],Oe-1);return ge}else return ne(Ie)}else{for(ge=[],ue=0;ue<Ie.length;ue++)ge[ue]=de(Ie[ue],Oe-1);return ge}}})},15065:function(ot,Ur,ie){ie.d(Ur,{J:function(){return Te}});var Q=ie(28337),cr=ie(42711),A=ie(44690),tr="max",Pe=["typed","config","numeric","larger"],Te=(0,cr.d5)(tr,Pe,ir=>{var{typed:le,config:L,numeric:$e,larger:Se}=ir;return le(tr,{"Array | Matrix":Ae,"Array | Matrix, number | BigNumber":function(ne,X){return(0,Q.u4)(ne,X.valueOf(),Me)},"...":function(ne){if((0,Q.CQ)(ne))throw new TypeError("Scalar values expected in function max");return Ae(ne)}});function Me(fe,ne){try{return Se(fe,ne)?fe:ne}catch(X){throw(0,A.x)(X,"max",ne)}}function Ae(fe){var ne;if((0,Q.Et)(fe,function(X){try{isNaN(X)&&typeof X=="number"?ne=NaN:(ne===void 0||Se(X,ne))&&(ne=X)}catch(de){throw(0,A.x)(de,"max",X)}}),ne===void 0)throw new Error("Cannot calculate max of an empty array");return typeof ne=="string"&&(ne=$e(ne,L.number)),ne}})},3592:function(ot,Ur,ie){ie.d(Ur,{Q:function(){return ir}});var Q=ie(28337),cr=ie(58775),A=ie(42711),tr=ie(44690),Pe="mean",Te=["typed","add","divide"],ir=(0,A.d5)(Pe,Te,le=>{var{typed:L,add:$e,divide:Se}=le;return L(Pe,{"Array | Matrix":Ae,"Array | Matrix, number | BigNumber":Me,"...":function(ne){if((0,Q.CQ)(ne))throw new TypeError("Scalar values expected in function mean");return Ae(ne)}});function Me(fe,ne){try{var X=(0,Q.u4)(fe,ne,$e),de=Array.isArray(fe)?(0,cr.aJ)(fe):fe.size();return Se(X,de[ne])}catch(Ie){throw(0,tr.x)(Ie,"mean")}}function Ae(fe){var ne,X=0;if((0,Q.Et)(fe,function(de){try{ne=ne===void 0?de:$e(ne,de),X++}catch(Ie){throw(0,tr.x)(Ie,"mean",de)}}),X===0)throw new Error("Cannot calculate the mean of an empty array");return Se(ne,X)}})},35414:function(ot,Ur,ie){ie.d(Ur,{D:function(){return Te}});var Q=ie(28337),cr=ie(42711),A=ie(44690),tr="min",Pe=["typed","config","numeric","smaller"],Te=(0,cr.d5)(tr,Pe,ir=>{var{typed:le,config:L,numeric:$e,smaller:Se}=ir;return le(tr,{"Array | Matrix":Ae,"Array | Matrix, number | BigNumber":function(ne,X){return(0,Q.u4)(ne,X.valueOf(),Me)},"...":function(ne){if((0,Q.CQ)(ne))throw new TypeError("Scalar values expected in function min");return Ae(ne)}});function Me(fe,ne){try{return Se(fe,ne)?fe:ne}catch(X){throw(0,A.x)(X,"min",ne)}}function Ae(fe){var ne;if((0,Q.Et)(fe,function(X){try{isNaN(X)&&typeof X=="number"?ne=NaN:(ne===void 0||Se(X,ne))&&(ne=X)}catch(de){throw(0,A.x)(de,"min",X)}}),ne===void 0)throw new Error("Cannot calculate min of an empty array");return typeof ne=="string"&&(ne=$e(ne,L.number)),ne}})},2128:function(ot,Ur,ie){ie.d(Ur,{X:function(){return tr}});var Q=ie(42711),cr="std",A=["typed","sqrt","variance"],tr=(0,Q.d5)(cr,A,Pe=>{var{typed:Te,sqrt:ir,variance:le}=Pe;return Te(cr,{"Array | Matrix":L,"Array | Matrix, string":L,"Array | Matrix, number | BigNumber":L,"Array | Matrix, number | BigNumber, string":L,"...":function(Se){return L(Se)}});function L($e,Se){if($e.length===0)throw new SyntaxError("Function std requires one or more parameters (0 provided)");try{return ir(le.apply(null,arguments))}catch(Me){throw Me instanceof TypeError&&Me.message.indexOf(" variance")!==-1?new TypeError(Me.message.replace(" variance"," std")):Me}}})},28596:function(ot,Ur,ie){ie.d(Ur,{O:function(){return Te}});var Q=ie(28337),cr=ie(42711),A=ie(44690),tr="sum",Pe=["typed","config","add","numeric"],Te=(0,cr.d5)(tr,Pe,ir=>{var{typed:le,config:L,add:$e,numeric:Se}=ir;return le(tr,{"Array | Matrix":Me,"Array | Matrix, number | BigNumber":Ae,"...":function(ne){if((0,Q.CQ)(ne))throw new TypeError("Scalar values expected in function sum");return Me(ne)}});function Me(fe){var ne;return(0,Q.Et)(fe,function(X){try{ne=ne===void 0?X:$e(ne,X)}catch(de){throw(0,A.x)(de,"sum",X)}}),ne===void 0&&(ne=Se(0,L.number)),typeof ne=="string"&&(ne=Se(ne,L.number)),ne}function Ae(fe,ne){try{var X=(0,Q.u4)(fe,ne,$e);return X}catch(de){throw(0,A.x)(de,"sum")}}})},44690:function(ot,Ur,ie){ie.d(Ur,{x:function(){return cr}});var Q=ie(77707);function cr(A,tr,Pe){var Te;return String(A).indexOf("Unexpected type")!==-1?(Te=arguments.length>2?" (type: "+(0,Q.kM)(Pe)+", value: "+JSON.stringify(Pe)+")":" (type: "+A.data.actual+")",new TypeError("Cannot calculate "+tr+", unexpected type of argument"+Te)):String(A).indexOf("complex numbers")!==-1?(Te=arguments.length>2?" (type: "+(0,Q.kM)(Pe)+", value: "+JSON.stringify(Pe)+")":"",new TypeError("Cannot calculate "+tr+", no ordering relation is defined for complex numbers"+Te)):A}},34678:function(ot,Ur,ie){ie.d(Ur,{F:function(){return le}});var Q=ie(28337),cr=ie(77707),A=ie(42711),tr=ie(44690),Pe="unbiased",Te="variance",ir=["typed","add","subtract","multiply","divide","apply","isNaN"],le=(0,A.d5)(Te,ir,L=>{var{typed:$e,add:Se,subtract:Me,multiply:Ae,divide:fe,apply:ne,isNaN:X}=L;return $e(Te,{"Array | Matrix":function(ue){return de(ue,Pe)},"Array | Matrix, string":de,"Array | Matrix, number | BigNumber":function(ue,ge){return Ie(ue,ge,Pe)},"Array | Matrix, number | BigNumber, string":Ie,"...":function(ue){return de(ue,Pe)}});function de(Oe,ue){var ge,Re=0;if(Oe.length===0)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");if((0,Q.Et)(Oe,function(vr){try{ge=ge===void 0?vr:Se(ge,vr),Re++}catch(Ye){throw(0,tr.x)(Ye,"variance",vr)}}),Re===0)throw new Error("Cannot calculate variance of an empty array");var Ze=fe(ge,Re);if(ge=void 0,(0,Q.Et)(Oe,function(vr){var Ye=Me(vr,Ze);ge=ge===void 0?Ae(Ye,Ye):Se(ge,Ae(Ye,Ye))}),X(ge))return ge;switch(ue){case"uncorrected":return fe(ge,Re);case"biased":return fe(ge,Re+1);case"unbiased":{var Qe=(0,cr.l9)(ge)?ge.mul(0):0;return Re===1?Qe:fe(ge,Re-1)}default:throw new Error('Unknown normalization "'+ue+'". Choose "unbiased" (default), "uncorrected", or "biased".')}}function Ie(Oe,ue,ge){try{if(Oe.length===0)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");return ne(Oe,ue,Re=>de(Re,ge))}catch(Re){throw(0,tr.x)(Re,"variance")}}})},58775:function(ot,Ur,ie){ie.d(Ur,{$q:function(){return Le},D$:function(){return nt},Ed:function(){return Re},Gu:function(){return le},L9:function(){return X},Ls:function(){return L},SI:function(){return $e},UI:function(){return ge},U_:function(){return Qe},XL:function(){return Me},aJ:function(){return Te},eu:function(){return Ae},f4:function(){return Ie},hX:function(){return Ze},v_:function(){return vr},xH:function(){return ue},yV:function(){return Ye}});var Q=ie(36041),cr=ie(77707),A=ie(66736),tr=ie(89858),Pe=ie(30826);function Te(he){for(var qe=[];Array.isArray(he);)qe.push(he.length),he=he[0];return qe}function ir(he,qe,lr){var pr,Er=he.length;if(Er!==qe[lr])throw new tr.m(Er,qe[lr]);if(lr<qe.length-1){var kr=lr+1;for(pr=0;pr<Er;pr++){var vt=he[pr];if(!Array.isArray(vt))throw new tr.m(qe.length-1,qe.length,"<");ir(he[pr],qe,kr)}}else for(pr=0;pr<Er;pr++)if(Array.isArray(he[pr]))throw new tr.m(qe.length+1,qe.length,">")}function le(he,qe){var lr=qe.length===0;if(lr){if(Array.isArray(he))throw new tr.m(he.length,0)}else ir(he,qe,0)}function L(he,qe){if(!(0,cr.hj)(he)||!(0,Q.U)(he))throw new TypeError("Index must be an integer (value: "+he+")");if(he<0||typeof qe=="number"&&he>=qe)throw new Pe.c(he,qe)}function $e(he,qe,lr){if(!Array.isArray(he)||!Array.isArray(qe))throw new TypeError("Array expected");if(qe.length===0)throw new Error("Resizing to scalar is not supported");qe.forEach(function(Er){if(!(0,cr.hj)(Er)||!(0,Q.U)(Er)||Er<0)throw new TypeError("Invalid size, must contain positive integers (size: "+(0,A.WU)(qe)+")")});var pr=lr!==void 0?lr:0;return Se(he,qe,0,pr),he}function Se(he,qe,lr,pr){var Er,kr,vt=he.length,ht=qe[lr],we=Math.min(vt,ht);if(he.length=ht,lr<qe.length-1){var Jt=lr+1;for(Er=0;Er<we;Er++)kr=he[Er],Array.isArray(kr)||(kr=[kr],he[Er]=kr),Se(kr,qe,Jt,pr);for(Er=we;Er<ht;Er++)kr=[],he[Er]=kr,Se(kr,qe,Jt,pr)}else{for(Er=0;Er<we;Er++)for(;Array.isArray(he[Er]);)he[Er]=he[Er][0];for(Er=we;Er<ht;Er++)he[Er]=pr}}function Me(he,qe){var lr=ue(he),pr=lr.length;if(!Array.isArray(he)||!Array.isArray(qe))throw new TypeError("Array expected");if(qe.length===0)throw new tr.m(0,pr,"!=");qe=Ae(qe,pr);var Er=fe(qe);if(pr!==Er)throw new tr.m(Er,pr,"!=");try{return ne(lr,qe)}catch(kr){throw kr instanceof tr.m?new tr.m(Er,pr,"!="):kr}}function Ae(he,qe){var lr=fe(he),pr=he.slice(),Er=-1,kr=he.indexOf(Er),vt=he.indexOf(Er,kr+1)>=0;if(vt)throw new Error("More than one wildcard in sizes");var ht=kr>=0,we=qe%lr===0;if(ht)if(we)pr[kr]=-qe/lr;else throw new Error("Could not replace wildcard, since "+qe+" is no multiple of "+-lr);return pr}function fe(he){return he.reduce((qe,lr)=>qe*lr,1)}function ne(he,qe){for(var lr=he,pr,Er=qe.length-1;Er>0;Er--){var kr=qe[Er];pr=[];for(var vt=lr.length/kr,ht=0;ht<vt;ht++)pr.push(lr.slice(ht*kr,(ht+1)*kr));lr=pr}return lr}function X(he,qe){for(var lr=qe||Te(he);Array.isArray(he)&&he.length===1;)he=he[0],lr.shift();for(var pr=lr.length;lr[pr-1]===1;)pr--;return pr<lr.length&&(he=de(he,pr,0),lr.length=pr),he}function de(he,qe,lr){var pr,Er;if(lr<qe){var kr=lr+1;for(pr=0,Er=he.length;pr<Er;pr++)he[pr]=de(he[pr],qe,kr)}else for(;Array.isArray(he);)he=he[0];return he}function Ie(he,qe,lr,pr){var Er=pr||Te(he);if(lr)for(var kr=0;kr<lr;kr++)he=[he],Er.unshift(1);for(he=Oe(he,qe,0);Er.length<qe;)Er.push(1);return he}function Oe(he,qe,lr){var pr,Er;if(Array.isArray(he)){var kr=lr+1;for(pr=0,Er=he.length;pr<Er;pr++)he[pr]=Oe(he[pr],qe,kr)}else for(var vt=lr;vt<qe;vt++)he=[he];return he}function ue(he){if(!Array.isArray(he))return he;var qe=[];return he.forEach(function lr(pr){Array.isArray(pr)?pr.forEach(lr):qe.push(pr)}),qe}function ge(he,qe){return Array.prototype.map.call(he,qe)}function Re(he,qe){Array.prototype.forEach.call(he,qe)}function Ze(he,qe){if(Te(he).length!==1)throw new Error("Only one dimensional matrices supported");return Array.prototype.filter.call(he,qe)}function Qe(he,qe){if(Te(he).length!==1)throw new Error("Only one dimensional matrices supported");return Array.prototype.filter.call(he,lr=>qe.test(lr))}function vr(he,qe){return Array.prototype.join.call(he,qe)}function Ye(he){if(!Array.isArray(he))throw new TypeError("Array input expected");if(he.length===0)return he;var qe=[],lr=0;qe[0]={value:he[0],identifier:0};for(var pr=1;pr<he.length;pr++)he[pr]===he[pr-1]?lr++:lr=0,qe.push({value:he[pr],identifier:lr});return qe}function nt(he){if(!Array.isArray(he))throw new TypeError("Array input expected");if(he.length===0)return he;for(var qe=[],lr=0;lr<he.length;lr++)qe.push(he[lr].value);return qe}function Le(he,qe){for(var lr,pr=0,Er=0;Er<he.length;Er++){var kr=he[Er],vt=Array.isArray(kr);if(Er===0&&vt&&(pr=kr.length),vt&&kr.length!==pr)return;var ht=vt?Le(kr,qe):qe(kr);if(lr===void 0)lr=ht;else if(lr!==ht)return"mixed"}return lr}function nr(he){return he[he.length-1]}function Pr(he){return he.slice(0,he.length-1)}function Ir(he,qe){return he.indexOf(qe)!==-1}},28337:function(ot,Ur,ie){ie.d(Ur,{CQ:function(){return Pe},Et:function(){return Te},Fh:function(){return ir},U6:function(){return $e},u4:function(){return le}});var Q=ie(77707),cr=ie(30826),A=ie(58775),tr=ie(79887);function Pe(Se){for(var Me=0;Me<Se.length;Me++)if((0,Q.uZ)(Se[Me]))return!0;return!1}function Te(Se,Me){(0,Q.SW)(Se)&&(Se=Se.valueOf());for(var Ae=0,fe=Se.length;Ae<fe;Ae++){var ne=Se[Ae];Array.isArray(ne)?Te(ne,Me):Me(ne)}}function ir(Se,Me,Ae){return Se&&typeof Se.map=="function"?Se.map(function(fe){return ir(fe,Me,Ae)}):Me(Se)}function le(Se,Me,Ae){var fe=Array.isArray(Se)?(0,A.aJ)(Se):Se.size();if(Me<0||Me>=fe.length)throw new cr.c(Me,fe.length);return(0,Q.SW)(Se)?Se.create(L(Se.valueOf(),Me,Ae)):L(Se,Me,Ae)}function L(Se,Me,Ae){var fe,ne,X,de;if(Me<=0)if(Array.isArray(Se[0])){for(de=(0,tr.c)(Se),ne=[],fe=0;fe<de.length;fe++)ne[fe]=L(de[fe],Me-1,Ae);return ne}else{for(X=Se[0],fe=1;fe<Se.length;fe++)X=Ae(X,Se[fe]);return X}else{for(ne=[],fe=0;fe<Se.length;fe++)ne[fe]=L(Se[fe],Me-1,Ae);return ne}}function $e(Se,Me,Ae,fe,ne,X,de,Ie,Oe,ue,ge){var Re=Se._values,Ze=Se._index,Qe=Se._ptr,vr,Ye,nt,Le;if(fe)for(Ye=Qe[Me],nt=Qe[Me+1],vr=Ye;vr<nt;vr++)Le=Ze[vr],Ae[Le]!==X?(Ae[Le]=X,de.push(Le),ue?(fe[Le]=Oe?Ie(Re[vr],ge):Ie(ge,Re[vr]),ne[Le]=X):fe[Le]=Re[vr]):(fe[Le]=Oe?Ie(Re[vr],fe[Le]):Ie(fe[Le],Re[vr]),ne[Le]=X);else for(Ye=Qe[Me],nt=Qe[Me+1],vr=Ye;vr<nt;vr++)Le=Ze[vr],Ae[Le]!==X?(Ae[Le]=X,de.push(Le)):ne[Le]=X}},75259:function(ot,Ur,ie){ie.d(Ur,{OJ:function(){return le},YF:function(){return cr},Z8:function(){return Pe},nI:function(){return A},np:function(){return ir},pp:function(){return Te}});var Q=ie(75150);function cr(Me,Ae){if(L(Me)&&Te(Me,Ae))return Me[Ae];throw typeof Me[Ae]=="function"&&le(Me,Ae)?new Error('Cannot access method "'+Ae+'" as a property'):new Error('No access to property "'+Ae+'"')}function A(Me,Ae,fe){if(L(Me)&&Te(Me,Ae))return Me[Ae]=fe,fe;throw new Error('No access to property "'+Ae+'"')}function tr(Me){return Object.keys(Me).filter(Ae=>hasOwnProperty(Me,Ae))}function Pe(Me,Ae){return Ae in Me}function Te(Me,Ae){return!Me||typeof Me!="object"?!1:(0,Q.nr)($e,Ae)?!0:!(Ae in Object.prototype||Ae in Function.prototype)}function ir(Me,Ae){if(!le(Me,Ae))throw new Error('No access to method "'+Ae+'"')}function le(Me,Ae){return Me==null||typeof Me[Ae]!="function"||(0,Q.nr)(Me,Ae)&&Object.getPrototypeOf&&Ae in Object.getPrototypeOf(Me)?!1:(0,Q.nr)(Se,Ae)?!0:!(Ae in Object.prototype||Ae in Function.prototype)}function L(Me){return typeof Me=="object"&&Me&&Me.constructor===Object}var $e={length:!0,name:!0},Se={toString:!0,valueOf:!0,toLocaleString:!0}},42711:function(ot,Ur,ie){ie.d(Ur,{d5:function(){return cr}});var Q=ie(75150);function cr(L,$e,Se,Me){function Ae(fe){var ne=(0,Q.W6)(fe,$e.map(le));return Te(L,$e,fe),Se(ne)}return Ae.isFactory=!0,Ae.fn=L,Ae.dependencies=$e.slice().sort(),Me&&(Ae.meta=Me),Ae}function A(L){var $e={};L.forEach(fe=>{$e[fe.fn]=fe});function Se(fe,ne){return!!(Pe(fe)&&(contains(fe.dependencies,ne.fn||ne.name)||fe.dependencies.some(X=>Se($e[X],ne))))}var Me=[];function Ae(fe){for(var ne=0;ne<Me.length&&!Se(Me[ne],fe);)ne++;Me.splice(ne,0,fe)}return L.filter(Pe).forEach(Ae),L.filter(fe=>!Pe(fe)).forEach(Ae),Me}function tr(L){var $e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return A(L).forEach(Se=>Se($e)),$e}function Pe(L){return typeof L=="function"&&typeof L.fn=="string"&&Array.isArray(L.dependencies)}function Te(L,$e,Se){var Me=$e.filter(fe=>!ir(fe)).every(fe=>Se[fe]!==void 0);if(!Me){var Ae=$e.filter(fe=>Se[fe]===void 0);throw new Error('Cannot create function "'.concat(L,'", ')+"some dependencies are missing: ".concat(Ae.map(fe=>'"'.concat(fe,'"')).join(", "),"."))}}function ir(L){return L&&L[0]==="?"}function le(L){return L&&L[0]==="?"?L.slice(1):L}},15356:function(ot,Ur,ie){ie.d(Ur,{oV:function(){return tr},HP:function(){return cr}});function Q(Pe){var Te=0,ir=1,le=Object.create(null),L=Object.create(null),$e=0,Se=function(Ae){var fe=L[Ae];if(fe&&(delete le[fe],delete L[Ae],--Te,ir===fe)){if(!Te){$e=0,ir=1;return}for(;!hasOwnProperty.call(le,++ir););}};return Pe=Math.abs(Pe),{hit:function(Ae){var fe=L[Ae],ne=++$e;if(le[ne]=Ae,L[Ae]=ne,!fe)return++Te,Te<=Pe?void 0:(Ae=le[ir],Se(Ae),Ae);if(delete le[fe],ir===fe)for(;!hasOwnProperty.call(le,++ir););},delete:Se,clear:function(){Te=$e=0,ir=1,le=Object.create(null),L=Object.create(null)}}}function cr(Pe){var{hasher:Te,limit:ir}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return ir=ir??Number.POSITIVE_INFINITY,Te=Te??JSON.stringify,function le(){typeof le.cache!="object"&&(le.cache={values:new Map,lru:Q(ir||Number.POSITIVE_INFINITY)});for(var L=[],$e=0;$e<arguments.length;$e++)L[$e]=arguments[$e];var Se=Te(L);if(le.cache.values.has(Se))return le.cache.lru.hit(Se),le.cache.values.get(Se);var Me=Pe.apply(Pe,L);return le.cache.values.set(Se,Me),le.cache.values.delete(le.cache.lru.hit(Se)),Me}}function A(Pe,Te){var ir=function le(){for(var L=[],$e=0;$e<arguments.length;$e++)L[$e]=arguments[$e];for(var Se=0;Se<le.cache.length;Se++){var Me=le.cache[Se];if(Te(L,Me.args))return Me.res}var Ae=Pe.apply(Pe,L);return le.cache.unshift({args:L,res:Ae}),Ae};return ir.cache=[],ir}function tr(Pe){return Object.keys(Pe.signatures||{}).reduce(function(Te,ir){var le=(ir.match(/,/g)||[]).length+1;return Math.max(Te,le)},-1)}},77707:function(ot,Ur,ie){ie.d(Ur,{Bp:function(){return vr},Cl:function(){return Ir},FG:function(){return kr},Ft:function(){return ge},HD:function(){return Te},Ig:function(){return pr},J_:function(){return Ie},Kj:function(){return Oe},Kn:function(){return ue},Lr:function(){return qe},Mc:function(){return A},SW:function(){return le},UG:function(){return he},VO:function(){return Pr},Yz:function(){return Ze},bR:function(){return Me},bV:function(){return lr},cB:function(){return ne},dh:function(){return Ae},ex:function(){return Er},hj:function(){return Q},j0:function(){return Qe},jH:function(){return $e},jn:function(){return fe},kJ:function(){return ir},kM:function(){return ht},l7:function(){return nr},l9:function(){return cr},mf:function(){return de},nu:function(){return Le},o8:function(){return Re},qg:function(){return vt},sA:function(){return Se},tS:function(){return nt},uZ:function(){return L},wr:function(){return Pe},x1:function(){return X},yQ:function(){return tr},zh:function(){return Ye}});function Q(we){return typeof we=="number"}function cr(we){return!we||typeof we!="object"||typeof we.constructor!="function"?!1:we.isBigNumber===!0&&typeof we.constructor.prototype=="object"&&we.constructor.prototype.isBigNumber===!0||typeof we.constructor.isDecimal=="function"&&we.constructor.isDecimal(we)===!0}function A(we){return we&&typeof we=="object"&&Object.getPrototypeOf(we).isComplex===!0||!1}function tr(we){return we&&typeof we=="object"&&Object.getPrototypeOf(we).isFraction===!0||!1}function Pe(we){return we&&we.constructor.prototype.isUnit===!0||!1}function Te(we){return typeof we=="string"}var ir=Array.isArray;function le(we){return we&&we.constructor.prototype.isMatrix===!0||!1}function L(we){return Array.isArray(we)||le(we)}function $e(we){return we&&we.isDenseMatrix&&we.constructor.prototype.isMatrix===!0||!1}function Se(we){return we&&we.isSparseMatrix&&we.constructor.prototype.isMatrix===!0||!1}function Me(we){return we&&we.constructor.prototype.isRange===!0||!1}function Ae(we){return we&&we.constructor.prototype.isIndex===!0||!1}function fe(we){return typeof we=="boolean"}function ne(we){return we&&we.constructor.prototype.isResultSet===!0||!1}function X(we){return we&&we.constructor.prototype.isHelp===!0||!1}function de(we){return typeof we=="function"}function Ie(we){return we instanceof Date}function Oe(we){return we instanceof RegExp}function ue(we){return!!(we&&typeof we=="object"&&we.constructor===Object&&!A(we)&&!tr(we))}function ge(we){return we===null}function Re(we){return we===void 0}function Ze(we){return we&&we.isAccessorNode===!0&&we.constructor.prototype.isNode===!0||!1}function Qe(we){return we&&we.isArrayNode===!0&&we.constructor.prototype.isNode===!0||!1}function vr(we){return we&&we.isAssignmentNode===!0&&we.constructor.prototype.isNode===!0||!1}function Ye(we){return we&&we.isBlockNode===!0&&we.constructor.prototype.isNode===!0||!1}function nt(we){return we&&we.isConditionalNode===!0&&we.constructor.prototype.isNode===!0||!1}function Le(we){return we&&we.isConstantNode===!0&&we.constructor.prototype.isNode===!0||!1}function nr(we){return we&&we.isFunctionAssignmentNode===!0&&we.constructor.prototype.isNode===!0||!1}function Pr(we){return we&&we.isFunctionNode===!0&&we.constructor.prototype.isNode===!0||!1}function Ir(we){return we&&we.isIndexNode===!0&&we.constructor.prototype.isNode===!0||!1}function he(we){return we&&we.isNode===!0&&we.constructor.prototype.isNode===!0||!1}function qe(we){return we&&we.isObjectNode===!0&&we.constructor.prototype.isNode===!0||!1}function lr(we){return we&&we.isOperatorNode===!0&&we.constructor.prototype.isNode===!0||!1}function pr(we){return we&&we.isParenthesisNode===!0&&we.constructor.prototype.isNode===!0||!1}function Er(we){return we&&we.isRangeNode===!0&&we.constructor.prototype.isNode===!0||!1}function kr(we){return we&&we.isSymbolNode===!0&&we.constructor.prototype.isNode===!0||!1}function vt(we){return we&&we.constructor.prototype.isChain===!0||!1}function ht(we){var Jt=typeof we;return Jt==="object"?we===null?"null":Array.isArray(we)?"Array":we instanceof Date?"Date":we instanceof RegExp?"RegExp":cr(we)?"BigNumber":A(we)?"Complex":tr(we)?"Fraction":le(we)?"Matrix":Pe(we)?"Unit":Ae(we)?"Index":Me(we)?"Range":ne(we)?"ResultSet":he(we)?we.type:vt(we)?"Chain":X(we)?"Help":"Object":Jt==="function"?"Function":Jt}},32538:function(ot,Ur,ie){ie.d(Ur,{_N:function(){return ir},df:function(){return Pe},dg:function(){return tr},f0:function(){return le},ru:function(){return Te}});var Q=ie(75259),cr=ie(77707);class A{constructor($e){this.wrappedObject=$e}keys(){return Object.keys(this.wrappedObject)}get($e){return(0,Q.YF)(this.wrappedObject,$e)}set($e,Se){return(0,Q.nI)(this.wrappedObject,$e,Se),this}has($e){return(0,Q.Z8)(this.wrappedObject,$e)}}function tr(){return new Map}function Pe(L){if(!L)return tr();if(ir(L))return L;if((0,cr.Kn)(L))return new A(L);throw new Error("createMap can create maps from objects or Maps")}function Te(L){if(L instanceof A)return L.wrappedObject;var $e={};for(var Se of L.keys()){var Me=L.get(Se);(0,Q.nI)($e,Se,Me)}return $e}function ir(L){return L?L instanceof Map||L instanceof A||typeof L.set=="function"&&typeof L.get=="function"&&typeof L.keys=="function"&&typeof L.has=="function":!1}function le(L){for(var $e=arguments.length,Se=new Array($e>1?$e-1:0),Me=1;Me<$e;Me++)Se[Me-1]=arguments[Me];for(var Ae of Se)if(Ae){if(ir(Ae))for(var fe of Ae.keys())L.set(fe,Ae.get(fe));else if((0,cr.Kn)(Ae))for(var ne of Object.keys(Ae))L.set(ne,Ae[ne])}return L}},35337:function(ot,Ur,ie){ie.d(Ur,{R3:function(){return Q},kX:function(){return A},nG:function(){return cr}});function Q(){throw new Error('No "bignumber" implementation available')}function cr(){throw new Error('No "fraction" implementation available')}function A(){throw new Error('No "matrix" implementation available')}function tr(){throw new Error('No "index" implementation available')}function Pe(){throw new Error('No "matrix" implementation available')}},36041:function(ot,Ur,ie){ie.d(Ur,{AE:function(){return Ye},C8:function(){return Ze},FH:function(){return Ae},JG:function(){return nt},Kr:function(){return Te},RI:function(){return ue},R_:function(){return vr},U:function(){return cr},Vf:function(){return Re},WU:function(){return $e},Xx:function(){return A},__:function(){return ge},eK:function(){return ir},f9:function(){return Qe},k3:function(){return tr},mv:function(){return Pe},nz:function(){return Ie},t$:function(){return le}});var Q=ie(77707);function cr(Le){return typeof Le=="boolean"?!0:isFinite(Le)?Le===Math.round(Le):!1}var A=Math.sign||function(Le){return Le>0?1:Le<0?-1:0},tr=Math.log2||function(nr){return Math.log(nr)/Math.LN2},Pe=Math.log10||function(nr){return Math.log(nr)/Math.LN10},Te=Math.log1p||function(Le){return Math.log(Le+1)},ir=Math.cbrt||function(nr){if(nr===0)return nr;var Pr=nr<0,Ir;return Pr&&(nr=-nr),isFinite(nr)?(Ir=Math.exp(Math.log(nr)/3),Ir=(nr/(Ir*Ir)+2*Ir)/3):Ir=nr,Pr?-Ir:Ir},le=Math.expm1||function(nr){return nr>=2e-4||nr<=-2e-4?Math.exp(nr)-1:nr+nr*nr/2+nr*nr*nr/6};function L(Le,nr,Pr){var Ir={2:"0b",8:"0o",16:"0x"},he=Ir[nr],qe="";if(Pr){if(Pr<1)throw new Error("size must be in greater than 0");if(!cr(Pr))throw new Error("size must be an integer");if(Le>2**(Pr-1)-1||Le<-(2**(Pr-1)))throw new Error("Value must be in range [-2^".concat(Pr-1,", 2^").concat(Pr-1,"-1]"));if(!cr(Le))throw new Error("Value must be an integer");Le<0&&(Le=Le+2**Pr),qe="i".concat(Pr)}var lr="";return Le<0&&(Le=-Le,lr="-"),"".concat(lr).concat(he).concat(Le.toString(nr)).concat(qe)}function $e(Le,nr){if(typeof nr=="function")return nr(Le);if(Le===1/0)return"Infinity";if(Le===-1/0)return"-Infinity";if(isNaN(Le))return"NaN";var Pr="auto",Ir,he;if(nr&&(nr.notation&&(Pr=nr.notation),(0,Q.hj)(nr)?Ir=nr:(0,Q.hj)(nr.precision)&&(Ir=nr.precision),nr.wordSize&&(he=nr.wordSize,typeof he!="number")))throw new Error('Option "wordSize" must be a number');switch(Pr){case"fixed":return Ae(Le,Ir);case"exponential":return fe(Le,Ir);case"engineering":return Me(Le,Ir);case"bin":return L(Le,2,he);case"oct":return L(Le,8,he);case"hex":return L(Le,16,he);case"auto":return ne(Le,Ir,nr&&nr).replace(/((\.\d*?)(0+))($|e)/,function(){var qe=arguments[2],lr=arguments[4];return qe!=="."?qe+lr:lr});default:throw new Error('Unknown notation "'+Pr+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function Se(Le){var nr=String(Le).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!nr)throw new SyntaxError("Invalid number "+Le);var Pr=nr[1],Ir=nr[2],he=parseFloat(nr[4]||"0"),qe=Ir.indexOf(".");he+=qe!==-1?qe-1:Ir.length-1;var lr=Ir.replace(".","").replace(/^0*/,function(pr){return he-=pr.length,""}).replace(/0*$/,"").split("").map(function(pr){return parseInt(pr)});return lr.length===0&&(lr.push(0),he++),{sign:Pr,coefficients:lr,exponent:he}}function Me(Le,nr){if(isNaN(Le)||!isFinite(Le))return String(Le);var Pr=Se(Le),Ir=X(Pr,nr),he=Ir.exponent,qe=Ir.coefficients,lr=he%3===0?he:he<0?he-3-he%3:he-he%3;if((0,Q.hj)(nr))for(;nr>qe.length||he-lr+1>qe.length;)qe.push(0);else for(var pr=Math.abs(he-lr)-(qe.length-1),Er=0;Er<pr;Er++)qe.push(0);for(var kr=Math.abs(he-lr),vt=1;kr>0;)vt++,kr--;var ht=qe.slice(vt).join(""),we=(0,Q.hj)(nr)&&ht.length||ht.match(/[1-9]/)?"."+ht:"",Jt=qe.slice(0,vt).join("")+we+"e"+(he>=0?"+":"")+lr.toString();return Ir.sign+Jt}function Ae(Le,nr){if(isNaN(Le)||!isFinite(Le))return String(Le);var Pr=Se(Le),Ir=typeof nr=="number"?X(Pr,Pr.exponent+1+nr):Pr,he=Ir.coefficients,qe=Ir.exponent+1,lr=qe+(nr||0);return he.length<lr&&(he=he.concat(de(lr-he.length))),qe<0&&(he=de(-qe+1).concat(he),qe=1),qe<he.length&&he.splice(qe,0,qe===0?"0.":"."),Ir.sign+he.join("")}function fe(Le,nr){if(isNaN(Le)||!isFinite(Le))return String(Le);var Pr=Se(Le),Ir=nr?X(Pr,nr):Pr,he=Ir.coefficients,qe=Ir.exponent;he.length<nr&&(he=he.concat(de(nr-he.length)));var lr=he.shift();return Ir.sign+lr+(he.length>0?"."+he.join(""):"")+"e"+(qe>=0?"+":"")+qe}function ne(Le,nr,Pr){if(isNaN(Le)||!isFinite(Le))return String(Le);var Ir=Pr&&Pr.lowerExp!==void 0?Pr.lowerExp:-3,he=Pr&&Pr.upperExp!==void 0?Pr.upperExp:5,qe=Se(Le),lr=nr?X(qe,nr):qe;if(lr.exponent<Ir||lr.exponent>=he)return fe(Le,nr);var pr=lr.coefficients,Er=lr.exponent;pr.length<nr&&(pr=pr.concat(de(nr-pr.length))),pr=pr.concat(de(Er-pr.length+1+(pr.length<nr?nr-pr.length:0))),pr=de(-Er).concat(pr);var kr=Er>0?Er:0;return kr<pr.length-1&&pr.splice(kr+1,0,"."),lr.sign+pr.join("")}function X(Le,nr){for(var Pr={sign:Le.sign,coefficients:Le.coefficients,exponent:Le.exponent},Ir=Pr.coefficients;nr<=0;)Ir.unshift(0),Pr.exponent++,nr++;if(Ir.length>nr){var he=Ir.splice(nr,Ir.length-nr);if(he[0]>=5){var qe=nr-1;for(Ir[qe]++;Ir[qe]===10;)Ir.pop(),qe===0&&(Ir.unshift(0),Pr.exponent++,qe++),qe--,Ir[qe]++}}return Pr}function de(Le){for(var nr=[],Pr=0;Pr<Le;Pr++)nr.push(0);return nr}function Ie(Le){return Le.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length}var Oe=Number.EPSILON||2220446049250313e-31;function ue(Le,nr,Pr){if(Pr==null)return Le===nr;if(Le===nr)return!0;if(isNaN(Le)||isNaN(nr))return!1;if(isFinite(Le)&&isFinite(nr)){var Ir=Math.abs(Le-nr);return Ir<Oe?!0:Ir<=Math.max(Math.abs(Le),Math.abs(nr))*Pr}return!1}var ge=Math.acosh||function(Le){return Math.log(Math.sqrt(Le*Le-1)+Le)},Re=Math.asinh||function(Le){return Math.log(Math.sqrt(Le*Le+1)+Le)},Ze=Math.atanh||function(Le){return Math.log((1+Le)/(1-Le))/2},Qe=Math.cosh||function(Le){return(Math.exp(Le)+Math.exp(-Le))/2},vr=Math.sinh||function(Le){return(Math.exp(Le)-Math.exp(-Le))/2},Ye=Math.tanh||function(Le){var nr=Math.exp(2*Le);return(nr-1)/(nr+1)};function nt(Le,nr){var Pr=Le>0?!0:Le<0?!1:1/Le===1/0,Ir=nr>0?!0:nr<0?!1:1/nr===1/0;return Pr^Ir?-Le:Le}},75150:function(ot,Ur,ie){ie.d(Ur,{J5:function(){return Te},Vo:function(){return $e},W6:function(){return de},d9:function(){return cr},l7:function(){return tr},nr:function(){return Me}});var Q=ie(77707);function cr(ue){var ge=typeof ue;if(ge==="number"||ge==="string"||ge==="boolean"||ue===null||ue===void 0)return ue;if(typeof ue.clone=="function")return ue.clone();if(Array.isArray(ue))return ue.map(function(Re){return cr(Re)});if(ue instanceof Date)return new Date(ue.valueOf());if((0,Q.l9)(ue))return ue;if(ue instanceof RegExp)throw new TypeError("Cannot clone "+ue);return A(ue,cr)}function A(ue,ge){var Re={};for(var Ze in ue)Me(ue,Ze)&&(Re[Ze]=ge(ue[Ze]));return Re}function tr(ue,ge){for(var Re in ge)Me(ge,Re)&&(ue[Re]=ge[Re]);return ue}function Pe(ue,ge){if(Array.isArray(ge))throw new TypeError("Arrays are not supported by deepExtend");for(var Re in ge)if(Me(ge,Re)&&!(Re in Object.prototype)&&!(Re in Function.prototype))if(ge[Re]&&ge[Re].constructor===Object)ue[Re]===void 0&&(ue[Re]={}),ue[Re]&&ue[Re].constructor===Object?Pe(ue[Re],ge[Re]):ue[Re]=ge[Re];else{if(Array.isArray(ge[Re]))throw new TypeError("Arrays are not supported by deepExtend");ue[Re]=ge[Re]}return ue}function Te(ue,ge){var Re,Ze,Qe;if(Array.isArray(ue)){if(!Array.isArray(ge)||ue.length!==ge.length)return!1;for(Ze=0,Qe=ue.length;Ze<Qe;Ze++)if(!Te(ue[Ze],ge[Ze]))return!1;return!0}else{if(typeof ue=="function")return ue===ge;if(ue instanceof Object){if(Array.isArray(ge)||!(ge instanceof Object))return!1;for(Re in ue)if(!(Re in ge)||!Te(ue[Re],ge[Re]))return!1;for(Re in ge)if(!(Re in ue))return!1;return!0}else return ue===ge}}function ir(ue){var ge={};return le(ue,ge),ge}function le(ue,ge){for(var Re in ue)if(Me(ue,Re)){var Ze=ue[Re];typeof Ze=="object"&&Ze!==null?le(Ze,ge):ge[Re]=Ze}}function L(){try{if(Object.defineProperty)return Object.defineProperty({},"x",{get:function(){return null}}),!0}catch{}return!1}function $e(ue,ge,Re){var Ze=!0,Qe;Object.defineProperty(ue,ge,{get:function(){return Ze&&(Qe=Re(),Ze=!1),Qe},set:function(Ye){Qe=Ye,Ze=!1},configurable:!0,enumerable:!0})}function Se(ue,ge){if(ge&&typeof ge=="string")return Se(ue,ge.split("."));var Re=ue;if(ge)for(var Ze=0;Ze<ge.length;Ze++){var Qe=ge[Ze];Qe in Re||(Re[Qe]={}),Re=Re[Qe]}return Re}function Me(ue,ge){return ue&&Object.hasOwnProperty.call(ue,ge)}function Ae(ue){return ue&&typeof ue.factory=="function"}function fe(ue,ge){if(typeof ge=="string")return Oe(ge)?fe(ue,ge.split(".")):ue[ge];for(var Re=ue,Ze=0;Ze<ge.length;Ze++){var Qe=ge[Ze];Re=Re?Re[Qe]:void 0}return Re}function ne(ue,ge,Re){if(typeof ge=="string")return Oe(ge)?ne(ue,ge.split("."),Re):(ue[ge]=Re,ue);for(var Ze=ue,Qe=0;Qe<ge.length-1;Qe++){var vr=ge[Qe];Ze[vr]===void 0&&(Ze[vr]={}),Ze=Ze[vr]}if(ge.length>0){var Ye=ge[ge.length-1];Ze[Ye]=Re}return ue}function X(ue,ge,Re){for(var Ze={},Qe=0;Qe<ge.length;Qe++){var vr=ge[Qe],Ye=fe(ue,vr);Ye!==void 0&&ne(Ze,vr,Re?Re(Ye,vr):Ye)}return Ze}function de(ue,ge){for(var Re={},Ze=0;Ze<ge.length;Ze++){var Qe=ge[Ze],vr=ue[Qe];vr!==void 0&&(Re[Qe]=vr)}return Re}function Ie(ue){return Object.keys(ue).map(ge=>ue[ge])}function Oe(ue){return ue.indexOf(".")!==-1}},66736:function(ot,Ur,ie){ie.d(Ur,{cd:function(){return ne},pn:function(){return le},YU:function(){return Me},WU:function(){return L},Pz:function(){return Se}});var Q=ie(77707),cr=ie(36041);function A(X,de,Ie){var Oe=X.constructor,ue=new Oe(2),ge="";if(Ie){if(Ie<1)throw new Error("size must be in greater than 0");if(!(0,cr.U)(Ie))throw new Error("size must be an integer");if(X.greaterThan(ue.pow(Ie-1).sub(1))||X.lessThan(ue.pow(Ie-1).mul(-1)))throw new Error("Value must be in range [-2^".concat(Ie-1,", 2^").concat(Ie-1,"-1]"));if(!X.isInteger())throw new Error("Value must be an integer");X.lessThan(0)&&(X=X.add(ue.pow(Ie))),ge="i".concat(Ie)}switch(de){case 2:return"".concat(X.toBinary()).concat(ge);case 8:return"".concat(X.toOctal()).concat(ge);case 16:return"".concat(X.toHexadecimal()).concat(ge);default:throw new Error("Base ".concat(de," not supported "))}}function tr(X,de){if(typeof de=="function")return de(X);if(!X.isFinite())return X.isNaN()?"NaN":X.gt(0)?"Infinity":"-Infinity";var Ie="auto",Oe,ue;if(de!==void 0&&(de.notation&&(Ie=de.notation),typeof de=="number"?Oe=de:de.precision&&(Oe=de.precision),de.wordSize&&(ue=de.wordSize,typeof ue!="number")))throw new Error('Option "wordSize" must be a number');switch(Ie){case"fixed":return ir(X,Oe);case"exponential":return Te(X,Oe);case"engineering":return Pe(X,Oe);case"bin":return A(X,2,ue);case"oct":return A(X,8,ue);case"hex":return A(X,16,ue);case"auto":{var ge=de&&de.lowerExp!==void 0?de.lowerExp:-3,Re=de&&de.upperExp!==void 0?de.upperExp:5;if(X.isZero())return"0";var Ze,Qe=X.toSignificantDigits(Oe),vr=Qe.e;return vr>=ge&&vr<Re?Ze=Qe.toFixed():Ze=Te(X,Oe),Ze.replace(/((\.\d*?)(0+))($|e)/,function(){var Ye=arguments[2],nt=arguments[4];return Ye!=="."?Ye+nt:nt})}default:throw new Error('Unknown notation "'+Ie+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function Pe(X,de){var Ie=X.e,Oe=Ie%3===0?Ie:Ie<0?Ie-3-Ie%3:Ie-Ie%3,ue=X.mul(Math.pow(10,-Oe)),ge=ue.toPrecision(de);return ge.indexOf("e")!==-1&&(ge=ue.toString()),ge+"e"+(Ie>=0?"+":"")+Oe.toString()}function Te(X,de){return de!==void 0?X.toExponential(de-1):X.toExponential()}function ir(X,de){return X.toFixed(de)}function le(X,de){var Ie=X.length-de.length,Oe=X.length;return X.substring(Ie,Oe)===de}function L(X,de){var Ie=$e(X,de);return de&&typeof de=="object"&&"truncate"in de&&Ie.length>de.truncate?Ie.substring(0,de.truncate-3)+"...":Ie}function $e(X,de){if(typeof X=="number")return(0,cr.WU)(X,de);if((0,Q.l9)(X))return tr(X,de);if(fe(X))return!de||de.fraction!=="decimal"?X.s*X.n+"/"+X.d:X.toString();if(Array.isArray(X))return Ae(X,de);if((0,Q.HD)(X))return'"'+X+'"';if(typeof X=="function")return X.syntax?String(X.syntax):"function";if(X&&typeof X=="object"){if(typeof X.format=="function")return X.format(de);if(X&&X.toString(de)!=={}.toString())return X.toString(de);var Ie=Object.keys(X).map(Oe=>'"'+Oe+'": '+L(X[Oe],de));return"{"+Ie.join(", ")+"}"}return String(X)}function Se(X){for(var de=String(X),Ie="",Oe=0;Oe<de.length;){var ue=de.charAt(Oe);ue==="\\"?(Ie+=ue,Oe++,ue=de.charAt(Oe),(ue===""||'"\\/bfnrtu'.indexOf(ue)===-1)&&(Ie+="\\"),Ie+=ue):ue==='"'?Ie+='\\"':Ie+=ue,Oe++}return'"'+Ie+'"'}function Me(X){var de=String(X);return de=de.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),de}function Ae(X,de){if(Array.isArray(X)){for(var Ie="[",Oe=X.length,ue=0;ue<Oe;ue++)ue!==0&&(Ie+=", "),Ie+=Ae(X[ue],de);return Ie+="]",Ie}else return L(X,de)}function fe(X){return X&&typeof X=="object"&&typeof X.s=="number"&&typeof X.n=="number"&&typeof X.d=="number"||!1}function ne(X,de){if(!(0,Q.HD)(X))throw new TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: "+(0,Q.kM)(X)+", index: 0)");if(!(0,Q.HD)(de))throw new TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: "+(0,Q.kM)(de)+", index: 1)");return X===de?0:X>de?1:-1}},79887:function(ot,Ur,ie){ie.d(Ur,{c:function(){return Q}});function Q(cr){var A=cr.length,tr=cr[0].length,Pe,Te,ir=[];for(Te=0;Te<tr;Te++){var le=[];for(Pe=0;Pe<A;Pe++)le.push(cr[Pe][Te]);ir.push(le)}return ir}}}]);