()
| 83 | `)}toJSON(){return{mathjs:B9,blocks:this.blocks}}static fromJSON(a){return new n(a.blocks)}_toHTML(a){return this.blocks.map(function(o){return o.node.toHTML(a)+(o.visible?"":'<span class="math-separator">;</span>')}).join('<span class="math-separator"><br /></span>')}_toTex(a){return this.blocks.map(function(o){return o.node.toTex(a)+(o.visible?"":";")}).join(`\\;\\; |
| 84 | `)}}return ai(n,"name",B9),n},{isClass:!0,isNode:!0});var R9="ConditionalNode",aut=["Node"],q9=X(R9,aut,e=>{var{Node:t}=e;function r(i){if(typeof i=="number"||typeof i=="boolean"||typeof i=="string")return!!i;if(i){if(er(i))return!i.isZero();if(ol(i))return!!(i.re||i.im);if(hs(i))return!!i.value}if(i==null)return!1;throw new TypeError('Unsupported type of condition "'+yn(i)+'"')}class n extends t{constructor(a,o,s){if(super(),!an(a))throw new TypeError("Parameter condition must be a Node");if(!an(o))throw new TypeError("Parameter trueExpr must be a Node");if(!an(s))throw new TypeError("Parameter falseExpr must be a Node");this.condition=a,this.trueExpr=o,this.falseExpr=s}get type(){return R9}get isConditionalNode(){return!0}_compile(a,o){var s=this.condition._compile(a,o),l=this.trueExpr._compile(a,o),u=this.falseExpr._compile(a,o);return function(f,d,p){return r(s(f,d,p))?l(f,d,p):u(f,d,p)}}forEach(a){a(this.condition,"condition",this),a(this.trueExpr,"trueExpr",this),a(this.falseExpr,"falseExpr",this)}map(a){return new n(this._ifNode(a(this.condition,"condition",this)),this._ifNode(a(this.trueExpr,"trueExpr",this)),this._ifNode(a(this.falseExpr,"falseExpr",this)))}clone(){return new n(this.condition,this.trueExpr,this.falseExpr)}_toString(a){var o=a&&a.parenthesis?a.parenthesis:"keep",s=hi(this,o,a&&a.implicit),l=this.condition.toString(a),u=hi(this.condition,o,a&&a.implicit);(o==="all"||this.condition.type==="OperatorNode"||u!==null&&u<=s)&&(l="("+l+")");var c=this.trueExpr.toString(a),f=hi(this.trueExpr,o,a&&a.implicit);(o==="all"||this.trueExpr.type==="OperatorNode"||f!==null&&f<=s)&&(c="("+c+")");var d=this.falseExpr.toString(a),p=hi(this.falseExpr,o,a&&a.implicit);return(o==="all"||this.falseExpr.type==="OperatorNode"||p!==null&&p<=s)&&(d="("+d+")"),l+" ? "+c+" : "+d}toJSON(){return{mathjs:R9,condition:this.condition,trueExpr:this.trueExpr,falseExpr:this.falseExpr}}static fromJSON(a){return new n(a.condition,a.trueExpr,a.falseExpr)}_toHTML(a){var o=a&&a.parenthesis?a.parenthesis:"keep",s=hi(this,o,a&&a.implicit),l=this.condition.toHTML(a),u=hi(this.condition,o,a&&a.implicit);(o==="all"||this.condition.type==="OperatorNode"||u!==null&&u<=s)&&(l='<span class="math-parenthesis math-round-parenthesis">(</span>'+l+'<span class="math-parenthesis math-round-parenthesis">)</span>');var c=this.trueExpr.toHTML(a),f=hi(this.trueExpr,o,a&&a.implicit);(o==="all"||this.trueExpr.type==="OperatorNode"||f!==null&&f<=s)&&(c='<span class="math-parenthesis math-round-parenthesis">(</span>'+c+'<span class="math-parenthesis math-round-parenthesis">)</span>');var d=this.falseExpr.toHTML(a),p=hi(this.falseExpr,o,a&&a.implicit);return(o==="all"||this.falseExpr.type==="OperatorNode"||p!==null&&p<=s)&&(d='<span class="math-parenthesis math-round-parenthesis">(</span>'+d+'<span class="math-parenthesis math-round-parenthesis">)</span>'),l+'<span class="math-operator math-conditional-operator">?</span>'+c+'<span class="math-operator math-conditional-operator">:</span>'+d}_toTex(a){return"\\begin{cases} {"+this.trueExpr.toTex(a)+"}, &\\quad{\\text{if }\\;"+this.condition.toTex(a)+"}\\\\{"+this.falseExpr.toTex(a)+"}, &\\quad{\\text{otherwise}}\\end{cases}"}}return ai(n,"name",R9),n},{isClass:!0,isNode:!0});var Ibe=ge(Pbe(),1);var jZ={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{?}"},Kn={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"},PZ={abs:{1:"\\left|${args[0]}\\right|"},add:{2:"\\left(${args[0]}".concat(Kn.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(Kn.dotDivide,"${args[1]}\\right)")},dotMultiply:{2:"\\left(${args[0]}".concat(Kn.dotMultiply,"${args[1]}\\right)")},dotPow:{2:"\\left(${args[0]}".concat(Kn.dotPow,"${args[1]}\\right)")},exp:{1:"\\exp\\left(${args[0]}\\right)"},expm1:"\\left(e".concat(Kn.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(Kn.mod,"${args[1]}\\right)")},multiply:{2:"\\left(${args[0]}".concat(Kn.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(Kn.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(Kn.subtract,"${args[1]}\\right)")},unaryMinus:{1:"".concat(Kn.unaryMinus,"\\left(${args[0]}\\right)")},unaryPlus:{1:"".concat(Kn.unaryPlus,"\\left(${args[0]}\\right)")},bitAnd:{2:"\\left(${args[0]}".concat(Kn.bitAnd,"${args[1]}\\right)")},bitNot:{1:Kn.bitNot+"\\left(${args[0]}\\right)"},bitOr:{2:"\\left(${args[0]}".concat(Kn.bitOr,"${args[1]}\\right)")},bitXor:{2:"\\left(${args[0]}".concat(Kn.bitXor,"${args[1]}\\right)")},leftShift:{2:"\\left(${args[0]}".concat(Kn.leftShift,"${args[1]}\\right)")},rightArithShift:{2:"\\left(${args[0]}".concat(Kn.rightArithShift,"${args[1]}\\right)")},rightLogShift:{2:"\\left(${args[0]}".concat(Kn.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(Kn.and,"${args[1]}\\right)")},not:{1:Kn.not+"\\left(${args[0]}\\right)"},or:{2:"\\left(${args[0]}".concat(Kn.or,"${args[1]}\\right)")},xor:{2:"\\left(${args[0]}".concat(Kn.xor,"${args[1]}\\right)")},cross:{2:"\\left(${args[0]}\\right)\\times\\left(${args[1]}\\right)"},ctranspose:{1:"\\left(${args[0]}\\right)".concat(Kn.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(Kn.pow,"{\\frac{1}{2}}")},trace:{1:"\\mathrm{tr}\\left(${args[0]}\\right)"},transpose:{1:"\\left(${args[0]}\\right)".concat(Kn.transpose)},combinations:{2:"\\binom{${args[0]}}{${args[1]}}"},combinationsWithRep:{2:"\\left(\\!\\!{\\binom{${args[0]}}{${args[1]}}}\\!\\!\\right)"},factorial:{1:"\\left(${args[0]}\\right)".concat(Kn.factorial)},gamma:{1:"\\Gamma\\left(${args[0]}\\right)"},lgamma:{1:"\\ln\\Gamma\\left(${args[0]}\\right)"},equal:{2:"\\left(${args[0]}".concat(Kn.equal,"${args[1]}\\right)")},larger:{2:"\\left(${args[0]}".concat(Kn.larger,"${args[1]}\\right)")},largerEq:{2:"\\left(${args[0]}".concat(Kn.largerEq,"${args[1]}\\right)")},smaller:{2:"\\left(${args[0]}".concat(Kn.smaller,"${args[1]}\\right)")},smallerEq:{2:"\\left(${args[0]}".concat(Kn.smallerEq,"${args[1]}\\right)")},unequal:{2:"\\left(${args[0]}".concat(Kn.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(Kn.to,"${args[1]}\\right)")},numeric:function(t,r){return t.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(jZ.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)"}},Bbe="\\mathrm{${name}}\\left(${args}\\right)",_be={deg:"^\\circ"};function $9(e){return(0,Ibe.default)(e,{preserveFormatting:!0})}function z9(e,t){return t=typeof t>"u"?!1:t,t?Pt(_be,e)?_be[e]:"\\mathrm{"+$9(e)+"}":Pt(jZ,e)?jZ[e]:$9(e)}var U9="ConstantNode",uut=["Node"],H9=X(U9,uut,e=>{var{Node:t}=e;class r extends t{constructor(i){super(),this.value=i}get type(){return U9}get isConstantNode(){return!0}_compile(i,a){var o=this.value;return function(){return o}}forEach(i){}map(i){return this.clone()}clone(){return new r(this.value)}_toString(i){return Er(this.value,i)}_toHTML(i){var a=this._toString(i);switch(yn(this.value)){case"number":case"BigNumber":case"Fraction":return'<span class="math-number">'+a+"</span>";case"string":return'<span class="math-string">'+a+"</span>";case"boolean":return'<span class="math-boolean">'+a+"</span>";case"null":return'<span class="math-null-symbol">'+a+"</span>";case"undefined":return'<span class="math-undefined">'+a+"</span>";default:return'<span class="math-symbol">'+a+"</span>"}}toJSON(){return{mathjs:U9,value:this.value}}static fromJSON(i){return new r(i.value)}_toTex(i){var a=this._toString(i),o=yn(this.value);switch(o){case"string":return"\\mathtt{"+$9(a)+"}";case"number":case"BigNumber":{var s=o==="BigNumber"?this.value.isFinite():isFinite(this.value);if(!s)return this.value.valueOf()<0?"-\\infty":"\\infty";var l=a.toLowerCase().indexOf("e");return l!==-1?a.substring(0,l)+"\\cdot10^{"+a.substring(l+1)+"}":a}case"Fraction":return this.value.toLatex();default:return a}}}return ai(r,"name",U9),r},{isClass:!0,isNode:!0});var V9="FunctionAssignmentNode",cut=["typed","Node"],G9=X(V9,cut,e=>{var{typed:t,Node:r}=e;function n(a,o,s){var l=hi(a,o,s),u=hi(a.expr,o,s);return o==="all"||u!==null&&u<=l}class i extends r{constructor(o,s,l){if(super(),typeof o!="string")throw new TypeError('String expected for parameter "name"');if(!Array.isArray(s))throw new TypeError('Array containing strings or objects expected for parameter "params"');if(!an(l))throw new TypeError('Node expected for parameter "expr"');if(C9.has(o))throw new Error('Illegal function name, "'+o+'" is a reserved keyword');var u=new Set;for(var c of s){var f=typeof c=="string"?c:c.name;if(u.has(f))throw new Error('Duplicate parameter name "'.concat(f,'"'));u.add(f)}this.name=o,this.params=s.map(function(d){return d&&d.name||d}),this.types=s.map(function(d){return d&&d.type||"any"}),this.expr=l}get type(){return V9}get isFunctionAssignmentNode(){return!0}_compile(o,s){var l=Object.create(s);F1(this.params,function(h){l[h]=!0});var u=this.expr._compile(o,l),c=this.name,f=this.params,d=kJ(this.types,","),p=c+"("+kJ(this.params,", ")+")";return function(m,v,A){var x={};x[d]=function(){for(var w=Object.create(v),b=0;b<f.length;b++)w[f[b]]=arguments[b];return u(m,w,A)};var g=t(c,x);return g.syntax=p,m.set(c,g),g}}forEach(o){o(this.expr,"expr",this)}map(o){var s=this._ifNode(o(this.expr,"expr",this));return new i(this.name,this.params.slice(0),s)}clone(){return new i(this.name,this.params.slice(0),this.expr)}_toString(o){var s=o&&o.parenthesis?o.parenthesis:"keep",l=this.expr.toString(o);return n(this,s,o&&o.implicit)&&(l="("+l+")"),this.name+"("+this.params.join(", ")+") = "+l}toJSON(){var o=this.types;return{mathjs:V9,name:this.name,params:this.params.map(function(s,l){return{name:s,type:o[l]}}),expr:this.expr}}static fromJSON(o){return new i(o.name,o.params,o.expr)}_toHTML(o){for(var s=o&&o.parenthesis?o.parenthesis:"keep",l=[],u=0;u<this.params.length;u++)l.push('<span class="math-symbol math-parameter">'+cl(this.params[u])+"</span>");var c=this.expr.toHTML(o);return n(this,s,o&&o.implicit)&&(c='<span class="math-parenthesis math-round-parenthesis">(</span>'+c+'<span class="math-parenthesis math-round-parenthesis">)</span>'),'<span class="math-function">'+cl(this.name)+'</span><span class="math-parenthesis math-round-parenthesis">(</span>'+l.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>'+c}_toTex(o){var s=o&&o.parenthesis?o.parenthesis:"keep",l=this.expr.toTex(o);return n(this,s,o&&o.implicit)&&(l="\\left(".concat(l,"\\right)")),"\\mathrm{"+this.name+"}\\left("+this.params.map(z9).join(",")+"\\right)="+l}}return ai(i,"name",V9),i},{isClass:!0,isNode:!0});var W9="IndexNode",fut=["Node","size"],Q9=X(W9,fut,e=>{var{Node:t,size:r}=e;class n extends t{constructor(a,o){if(super(),this.dimensions=a,this.dotNotation=o||!1,!Array.isArray(a)||!a.every(an))throw new TypeError('Array containing Nodes expected for parameter "dimensions"');if(this.dotNotation&&!this.isObjectProperty())throw new Error("dotNotation only applicable for object properties")}get type(){return W9}get isIndexNode(){return!0}_compile(a,o){var s=Lf(this.dimensions,function(u,c){var f=u.filter(h=>h.isSymbolNode&&h.name==="end").length>0;if(f){var d=Object.create(o);d.end=!0;var p=u._compile(a,d);return function(m,v,A){if(!jt(A)&&!mn(A)&&!Ya(A))throw new TypeError('Cannot resolve "end": context must be a Matrix, Array, or string but is '+yn(A));var x=r(A).valueOf(),g=Object.create(v);return g.end=x[c],p(m,g,A)}}else return u._compile(a,o)}),l=Oa(a,"index");return function(c,f,d){var p=Lf(s,function(h){return h(c,f,d)});return l(...p)}}forEach(a){for(var o=0;o<this.dimensions.length;o++)a(this.dimensions[o],"dimensions["+o+"]",this)}map(a){for(var o=[],s=0;s<this.dimensions.length;s++)o[s]=this._ifNode(a(this.dimensions[s],"dimensions["+s+"]",this));return new n(o,this.dotNotation)}clone(){return new n(this.dimensions.slice(0),this.dotNotation)}isObjectProperty(){return this.dimensions.length===1&&Hr(this.dimensions[0])&&typeof this.dimensions[0].value=="string"}getObjectProperty(){return this.isObjectProperty()?this.dimensions[0].value:null}_toString(a){return this.dotNotation?"."+this.getObjectProperty():"["+this.dimensions.join(", ")+"]"}toJSON(){return{mathjs:W9,dimensions:this.dimensions,dotNotation:this.dotNotation}}static fromJSON(a){return new n(a.dimensions,a.dotNotation)}_toHTML(a){for(var o=[],s=0;s<this.dimensions.length;s++)o[s]=this.dimensions[s].toHTML();return this.dotNotation?'<span class="math-operator math-accessor-operator">.</span><span class="math-symbol math-property">'+cl(this.getObjectProperty())+"</span>":'<span class="math-parenthesis math-square-parenthesis">[</span>'+o.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-square-parenthesis">]</span>'}_toTex(a){var o=this.dimensions.map(function(s){return s.toTex(a)});return this.dotNotation?"."+this.getObjectProperty():"_{"+o.join(",")+"}"}}return ai(n,"name",W9),n},{isClass:!0,isNode:!0});var Y9="ObjectNode",dut=["Node"],X9=X(Y9,dut,e=>{var{Node:t}=e;class r extends t{constructor(i){if(super(),this.properties=i||{},i&&(typeof i!="object"||!Object.keys(i).every(function(a){return an(i[a])})))throw new TypeError("Object containing Nodes expected")}get type(){return Y9}get isObjectNode(){return!0}_compile(i,a){var o={};for(var s in this.properties)if(Pt(this.properties,s)){var l=Rx(s),u=JSON.parse(l),c=Oa(this.properties,s);o[u]=c._compile(i,a)}return function(d,p,h){var m={};for(var v in o)Pt(o,v)&&(m[v]=o[v](d,p,h));return m}}forEach(i){for(var a in this.properties)Pt(this.properties,a)&&i(this.properties[a],"properties["+Rx(a)+"]",this)}map(i){var a={};for(var o in this.properties)Pt(this.properties,o)&&(a[o]=this._ifNode(i(this.properties[o],"properties["+Rx(o)+"]",this)));return new r(a)}clone(){var i={};for(var a in this.properties)Pt(this.properties,a)&&(i[a]=this.properties[a]);return new r(i)}_toString(i){var a=[];for(var o in this.properties)Pt(this.properties,o)&&a.push(Rx(o)+": "+this.properties[o].toString(i));return"{"+a.join(", ")+"}"}toJSON(){return{mathjs:Y9,properties:this.properties}}static fromJSON(i){return new r(i.properties)}_toHTML(i){var a=[];for(var o in this.properties)Pt(this.properties,o)&&a.push('<span class="math-symbol math-property">'+cl(o)+'</span><span class="math-operator math-assignment-operator math-property-assignment-operator math-binary-operator">:</span>'+this.properties[o].toHTML(i));return'<span class="math-parenthesis math-curly-parenthesis">{</span>'+a.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-curly-parenthesis">}</span>'}_toTex(i){var a=[];for(var o in this.properties)Pt(this.properties,o)&&a.push("\\mathbf{"+o+":} & "+this.properties[o].toTex(i)+"\\\\");var s="\\left\\{\\begin{array}{ll}"+a.join(` |
| 85 | `)+"\\end{array}\\right\\}";return s}}return ai(r,"name",Y9),r},{isClass:!0,isNode:!0});function Hx(e,t){return new JE(e,new Ix(t),new Set(Object.keys(t)))}var K9="OperatorNode",put=["Node"],J9=X(K9,put,e=>{var{Node:t}=e;function r(a,o){var s=a;if(o==="auto")for(;ll(s);)s=s.content;return Hr(s)?!0:ta(s)?r(s.args[0],o):!1}function n(a,o,s,l,u){var c=hi(a,o,s),f=Mk(a,o);if(o==="all"||l.length>2&&a.getIdentifier()!=="OperatorNode:add"&&a.getIdentifier()!=="OperatorNode:multiply")return l.map(function(k){switch(k.getContent().type){case"ArrayNode":case"ConstantNode":case"SymbolNode":case"ParenthesisNode":return!1;default:return!0}});var d;switch(l.length){case 0:d=[];break;case 1:{var p=hi(l[0],o,s,a);if(u&&p!==null){var h,m;if(o==="keep"?(h=l[0].getIdentifier(),m=a.getIdentifier()):(h=l[0].getContent().getIdentifier(),m=a.getContent().getIdentifier()),Jp[c][m].latexLeftParens===!1){d=[!1];break}if(Jp[p][h].latexParens===!1){d=[!1];break}}if(p===null){d=[!1];break}if(p<=c){d=[!0];break}d=[!1]}break;case 2:{var v,A=hi(l[0],o,s,a),x=P9(a,l[0],o);A===null?v=!1:A===c&&f==="right"&&!x||A<c?v=!0:v=!1;var g,w=hi(l[1],o,s,a),b=P9(a,l[1],o);if(w===null?g=!1:w===c&&f==="left"&&!b||w<c?g=!0:g=!1,u){var y,S,T;o==="keep"?(y=a.getIdentifier(),S=a.args[0].getIdentifier(),T=a.args[1].getIdentifier()):(y=a.getContent().getIdentifier(),S=a.args[0].getContent().getIdentifier(),T=a.args[1].getContent().getIdentifier()),A!==null&&(Jp[c][y].latexLeftParens===!1&&(v=!1),Jp[A][S].latexParens===!1&&(v=!1)),w!==null&&(Jp[c][y].latexRightParens===!1&&(g=!1),Jp[w][T].latexParens===!1&&(g=!1))}d=[v,g]}break;default:(a.getIdentifier()==="OperatorNode:add"||a.getIdentifier()==="OperatorNode:multiply")&&(d=l.map(function(k){var M=hi(k,o,s,a),E=P9(a,k,o),O=Mk(k,o);return M===null?!1:c===M&&f===O&&!E?!0:M<c}));break}if(l.length>=2&&a.getIdentifier()==="OperatorNode:multiply"&&a.implicit&&o!=="all"&&s==="hide")for(var D=1;D<d.length;++D)r(l[D],o)&&!d[D-1]&&(o!=="keep"||!ll(l[D-1]))&&(d[D]=!0);return d}class i extends t{constructor(o,s,l,u,c){if(super(),typeof o!="string")throw new TypeError('string expected for parameter "op"');if(typeof s!="string")throw new TypeError('string expected for parameter "fn"');if(!Array.isArray(l)||!l.every(an))throw new TypeError('Array containing Nodes expected for parameter "args"');this.implicit=u===!0,this.isPercentage=c===!0,this.op=o,this.fn=s,this.args=l||[]}get type(){return K9}get isOperatorNode(){return!0}_compile(o,s){if(typeof this.fn!="string"||!II(o,this.fn))throw o[this.fn]?new Error('No access to function "'+this.fn+'"'):new Error("Function "+this.fn+' missing in provided namespace "math"');var l=Oa(o,this.fn),u=Lf(this.args,function(h){return h._compile(o,s)});if(typeof l=="function"&&l.rawArgs===!0){var c=this.args;return function(m,v,A){return l(c,o,Hx(m,v))}}else if(u.length===1){var f=u[0];return function(m,v,A){return l(f(m,v,A))}}else if(u.length===2){var d=u[0],p=u[1];return function(m,v,A){return l(d(m,v,A),p(m,v,A))}}else return function(m,v,A){return l.apply(null,Lf(u,function(x){return x(m,v,A)}))}}forEach(o){for(var s=0;s<this.args.length;s++)o(this.args[s],"args["+s+"]",this)}map(o){for(var s=[],l=0;l<this.args.length;l++)s[l]=this._ifNode(o(this.args[l],"args["+l+"]",this));return new i(this.op,this.fn,s,this.implicit,this.isPercentage)}clone(){return new i(this.op,this.fn,this.args.slice(0),this.implicit,this.isPercentage)}isUnary(){return this.args.length===1}isBinary(){return this.args.length===2}_toString(o){var s=o&&o.parenthesis?o.parenthesis:"keep",l=o&&o.implicit?o.implicit:"hide",u=this.args,c=n(this,s,l,u,!1);if(u.length===1){var f=Mk(this,s),d=u[0].toString(o);c[0]&&(d="("+d+")");var p=/[a-zA-Z]+/.test(this.op);return f==="right"?this.op+(p?" ":"")+d:f==="left"?d+(p?" ":"")+this.op:d+this.op}else if(u.length===2){var h=u[0].toString(o),m=u[1].toString(o);return c[0]&&(h="("+h+")"),c[1]&&(m="("+m+")"),this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&l==="hide"?h+" "+m:h+" "+this.op+" "+m}else if(u.length>2&&(this.getIdentifier()==="OperatorNode:add"||this.getIdentifier()==="OperatorNode:multiply")){var v=u.map(function(A,x){return A=A.toString(o),c[x]&&(A="("+A+")"),A});return this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&l==="hide"?v.join(" "):v.join(" "+this.op+" ")}else return this.fn+"("+this.args.join(", ")+")"}toJSON(){return{mathjs:K9,op:this.op,fn:this.fn,args:this.args,implicit:this.implicit,isPercentage:this.isPercentage}}static fromJSON(o){return new i(o.op,o.fn,o.args,o.implicit,o.isPercentage)}_toHTML(o){var s=o&&o.parenthesis?o.parenthesis:"keep",l=o&&o.implicit?o.implicit:"hide",u=this.args,c=n(this,s,l,u,!1);if(u.length===1){var f=Mk(this,s),d=u[0].toHTML(o);return c[0]&&(d='<span class="math-parenthesis math-round-parenthesis">(</span>'+d+'<span class="math-parenthesis math-round-parenthesis">)</span>'),f==="right"?'<span class="math-operator math-unary-operator math-lefthand-unary-operator">'+cl(this.op)+"</span>"+d:d+'<span class="math-operator math-unary-operator math-righthand-unary-operator">'+cl(this.op)+"</span>"}else if(u.length===2){var p=u[0].toHTML(o),h=u[1].toHTML(o);return c[0]&&(p='<span class="math-parenthesis math-round-parenthesis">(</span>'+p+'<span class="math-parenthesis math-round-parenthesis">)</span>'),c[1]&&(h='<span class="math-parenthesis math-round-parenthesis">(</span>'+h+'<span class="math-parenthesis math-round-parenthesis">)</span>'),this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&l==="hide"?p+'<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>'+h:p+'<span class="math-operator math-binary-operator math-explicit-binary-operator">'+cl(this.op)+"</span>"+h}else{var m=u.map(function(v,A){return v=v.toHTML(o),c[A]&&(v='<span class="math-parenthesis math-round-parenthesis">(</span>'+v+'<span class="math-parenthesis math-round-parenthesis">)</span>'),v});return u.length>2&&(this.getIdentifier()==="OperatorNode:add"||this.getIdentifier()==="OperatorNode:multiply")?this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&l==="hide"?m.join('<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>'):m.join('<span class="math-operator math-binary-operator math-explicit-binary-operator">'+cl(this.op)+"</span>"):'<span class="math-function">'+cl(this.fn)+'</span><span class="math-paranthesis math-round-parenthesis">(</span>'+m.join('<span class="math-separator">,</span>')+'<span class="math-paranthesis math-round-parenthesis">)</span>'}}_toTex(o){var s=o&&o.parenthesis?o.parenthesis:"keep",l=o&&o.implicit?o.implicit:"hide",u=this.args,c=n(this,s,l,u,!0),f=Kn[this.fn];if(f=typeof f>"u"?this.op:f,u.length===1){var d=Mk(this,s),p=u[0].toTex(o);return c[0]&&(p="\\left(".concat(p,"\\right)")),d==="right"?f+p:p+f}else if(u.length===2){var h=u[0],m=h.toTex(o);c[0]&&(m="\\left(".concat(m,"\\right)"));var v=u[1],A=v.toTex(o);c[1]&&(A="\\left(".concat(A,"\\right)"));var x;switch(s==="keep"?x=h.getIdentifier():x=h.getContent().getIdentifier(),this.getIdentifier()){case"OperatorNode:divide":return f+"{"+m+"}{"+A+"}";case"OperatorNode:pow":switch(m="{"+m+"}",A="{"+A+"}",x){case"ConditionalNode":case"OperatorNode:divide":m="\\left(".concat(m,"\\right)")}break;case"OperatorNode:multiply":if(this.implicit&&l==="hide")return m+"~"+A}return m+f+A}else if(u.length>2&&(this.getIdentifier()==="OperatorNode:add"||this.getIdentifier()==="OperatorNode:multiply")){var g=u.map(function(w,b){return w=w.toTex(o),c[b]&&(w="\\left(".concat(w,"\\right)")),w});return this.getIdentifier()==="OperatorNode:multiply"&&this.implicit&&l==="hide"?g.join("~"):g.join(f)}else return"\\mathrm{"+this.fn+"}\\left("+u.map(function(w){return w.toTex(o)}).join(",")+"\\right)"}getIdentifier(){return this.type+":"+this.fn}}return ai(i,"name",K9),i},{isClass:!0,isNode:!0});var Z9="ParenthesisNode",mut=["Node"],e7=X(Z9,mut,e=>{var{Node:t}=e;class r extends t{constructor(i){if(super(),!an(i))throw new TypeError('Node expected for parameter "content"');this.content=i}get type(){return Z9}get isParenthesisNode(){return!0}_compile(i,a){return this.content._compile(i,a)}getContent(){return this.content.getContent()}forEach(i){i(this.content,"content",this)}map(i){var a=i(this.content,"content",this);return new r(a)}clone(){return new r(this.content)}_toString(i){return!i||i&&!i.parenthesis||i&&i.parenthesis==="keep"?"("+this.content.toString(i)+")":this.content.toString(i)}toJSON(){return{mathjs:Z9,content:this.content}}static fromJSON(i){return new r(i.content)}_toHTML(i){return!i||i&&!i.parenthesis||i&&i.parenthesis==="keep"?'<span class="math-parenthesis math-round-parenthesis">(</span>'+this.content.toHTML(i)+'<span class="math-parenthesis math-round-parenthesis">)</span>':this.content.toHTML(i)}_toTex(i){return!i||i&&!i.parenthesis||i&&i.parenthesis==="keep"?"\\left(".concat(this.content.toTex(i),"\\right)"):this.content.toTex(i)}}return ai(r,"name",Z9),r},{isClass:!0,isNode:!0});var t7="RangeNode",hut=["Node"],r7=X(t7,hut,e=>{var{Node:t}=e;function r(i,a,o){var s=hi(i,a,o),l={},u=hi(i.start,a,o);if(l.start=u!==null&&u<=s||a==="all",i.step){var c=hi(i.step,a,o);l.step=c!==null&&c<=s||a==="all"}var f=hi(i.end,a,o);return l.end=f!==null&&f<=s||a==="all",l}class n extends t{constructor(a,o,s){if(super(),!an(a))throw new TypeError("Node expected");if(!an(o))throw new TypeError("Node expected");if(s&&!an(s))throw new TypeError("Node expected");if(arguments.length>3)throw new Error("Too many arguments");this.start=a,this.end=o,this.step=s||null}get type(){return t7}get isRangeNode(){return!0}needsEnd(){var a=this.filter(function(o){return Oi(o)&&o.name==="end"});return a.length>0}_compile(a,o){var s=a.range,l=this.start._compile(a,o),u=this.end._compile(a,o);if(this.step){var c=this.step._compile(a,o);return function(d,p,h){return s(l(d,p,h),u(d,p,h),c(d,p,h))}}else return function(d,p,h){return s(l(d,p,h),u(d,p,h))}}forEach(a){a(this.start,"start",this),a(this.end,"end",this),this.step&&a(this.step,"step",this)}map(a){return new n(this._ifNode(a(this.start,"start",this)),this._ifNode(a(this.end,"end",this)),this.step&&this._ifNode(a(this.step,"step",this)))}clone(){return new n(this.start,this.end,this.step&&this.step)}_toString(a){var o=a&&a.parenthesis?a.parenthesis:"keep",s=r(this,o,a&&a.implicit),l,u=this.start.toString(a);if(s.start&&(u="("+u+")"),l=u,this.step){var c=this.step.toString(a);s.step&&(c="("+c+")"),l+=":"+c}var f=this.end.toString(a);return s.end&&(f="("+f+")"),l+=":"+f,l}toJSON(){return{mathjs:t7,start:this.start,end:this.end,step:this.step}}static fromJSON(a){return new n(a.start,a.end,a.step)}_toHTML(a){var o=a&&a.parenthesis?a.parenthesis:"keep",s=r(this,o,a&&a.implicit),l,u=this.start.toHTML(a);if(s.start&&(u='<span class="math-parenthesis math-round-parenthesis">(</span>'+u+'<span class="math-parenthesis math-round-parenthesis">)</span>'),l=u,this.step){var c=this.step.toHTML(a);s.step&&(c='<span class="math-parenthesis math-round-parenthesis">(</span>'+c+'<span class="math-parenthesis math-round-parenthesis">)</span>'),l+='<span class="math-operator math-range-operator">:</span>'+c}var f=this.end.toHTML(a);return s.end&&(f='<span class="math-parenthesis math-round-parenthesis">(</span>'+f+'<span class="math-parenthesis math-round-parenthesis">)</span>'),l+='<span class="math-operator math-range-operator">:</span>'+f,l}_toTex(a){var o=a&&a.parenthesis?a.parenthesis:"keep",s=r(this,o,a&&a.implicit),l=this.start.toTex(a);if(s.start&&(l="\\left(".concat(l,"\\right)")),this.step){var u=this.step.toTex(a);s.step&&(u="\\left(".concat(u,"\\right)")),l+=":"+u}var c=this.end.toTex(a);return s.end&&(c="\\left(".concat(c,"\\right)")),l+=":"+c,l}}return ai(n,"name",t7),n},{isClass:!0,isNode:!0});var n7="RelationalNode",gut=["Node"],i7=X(n7,gut,e=>{var{Node:t}=e,r={equal:"==",unequal:"!=",smaller:"<",larger:">",smallerEq:"<=",largerEq:">="};class n extends t{constructor(a,o){if(super(),!Array.isArray(a))throw new TypeError("Parameter conditionals must be an array");if(!Array.isArray(o))throw new TypeError("Parameter params must be an array");if(a.length!==o.length-1)throw new TypeError("Parameter params must contain exactly one more element than parameter conditionals");this.conditionals=a,this.params=o}get type(){return n7}get isRelationalNode(){return!0}_compile(a,o){var s=this,l=this.params.map(u=>u._compile(a,o));return function(c,f,d){for(var p,h=l[0](c,f,d),m=0;m<s.conditionals.length;m++){p=h,h=l[m+1](c,f,d);var v=Oa(a,s.conditionals[m]);if(!v(p,h))return!1}return!0}}forEach(a){this.params.forEach((o,s)=>a(o,"params["+s+"]",this),this)}map(a){return new n(this.conditionals.slice(),this.params.map((o,s)=>this._ifNode(a(o,"params["+s+"]",this)),this))}clone(){return new n(this.conditionals,this.params)}_toString(a){for(var o=a&&a.parenthesis?a.parenthesis:"keep",s=hi(this,o,a&&a.implicit),l=this.params.map(function(f,d){var p=hi(f,o,a&&a.implicit);return o==="all"||p!==null&&p<=s?"("+f.toString(a)+")":f.toString(a)}),u=l[0],c=0;c<this.conditionals.length;c++)u+=" "+r[this.conditionals[c]],u+=" "+l[c+1];return u}toJSON(){return{mathjs:n7,conditionals:this.conditionals,params:this.params}}static fromJSON(a){return new n(a.conditionals,a.params)}_toHTML(a){for(var o=a&&a.parenthesis?a.parenthesis:"keep",s=hi(this,o,a&&a.implicit),l=this.params.map(function(f,d){var p=hi(f,o,a&&a.implicit);return o==="all"||p!==null&&p<=s?'<span class="math-parenthesis math-round-parenthesis">(</span>'+f.toHTML(a)+'<span class="math-parenthesis math-round-parenthesis">)</span>':f.toHTML(a)}),u=l[0],c=0;c<this.conditionals.length;c++)u+='<span class="math-operator math-binary-operator math-explicit-binary-operator">'+cl(r[this.conditionals[c]])+"</span>"+l[c+1];return u}_toTex(a){for(var o=a&&a.parenthesis?a.parenthesis:"keep",s=hi(this,o,a&&a.implicit),l=this.params.map(function(f,d){var p=hi(f,o,a&&a.implicit);return o==="all"||p!==null&&p<=s?"\\left("+f.toTex(a)+"\right)":f.toTex(a)}),u=l[0],c=0;c<this.conditionals.length;c++)u+=Kn[this.conditionals[c]]+l[c+1];return u}}return ai(n,"name",n7),n},{isClass:!0,isNode:!0});var Aut="SymbolNode",vut=["math","?Unit","Node"],a7=X(Aut,vut,e=>{var{math:t,Unit:r,Node:n}=e;function i(o){return r?r.isValuelessUnit(o):!1}class a extends n{constructor(s){if(super(),typeof s!="string")throw new TypeError('String expected for parameter "name"');this.name=s}get type(){return"SymbolNode"}get isSymbolNode(){return!0}_compile(s,l){var u=this.name;if(l[u]===!0)return function(f,d,p){return Oa(d,u)};if(u in s)return function(f,d,p){return f.has(u)?f.get(u):Oa(s,u)};var c=i(u);return function(f,d,p){return f.has(u)?f.get(u):c?new r(null,u):a.onUndefinedSymbol(u)}}forEach(s){}map(s){return this.clone()}static onUndefinedSymbol(s){throw new Error("Undefined symbol "+s)}clone(){return new a(this.name)}_toString(s){return this.name}_toHTML(s){var l=cl(this.name);return l==="true"||l==="false"?'<span class="math-symbol math-boolean">'+l+"</span>":l==="i"?'<span class="math-symbol math-imaginary-symbol">'+l+"</span>":l==="Infinity"?'<span class="math-symbol math-infinity-symbol">'+l+"</span>":l==="NaN"?'<span class="math-symbol math-nan-symbol">'+l+"</span>":l==="null"?'<span class="math-symbol math-null-symbol">'+l+"</span>":l==="undefined"?'<span class="math-symbol math-undefined-symbol">'+l+"</span>":'<span class="math-symbol">'+l+"</span>"}toJSON(){return{mathjs:"SymbolNode",name:this.name}}static fromJSON(s){return new a(s.name)}_toTex(s){var l=!1;typeof t[this.name]>"u"&&i(this.name)&&(l=!0);var u=z9(this.name,l);return u[0]==="\\"?u:" "+u}}return a},{isClass:!0,isNode:!0});var o7="FunctionNode",yut=["math","Node","SymbolNode"],s7=X(o7,yut,e=>{var t,{math:r,Node:n,SymbolNode:i}=e,a=l=>Er(l,{truncate:78});function o(l,u,c){for(var f="",d=/\$(?:\{([a-z_][a-z_0-9]*)(?:\[([0-9]+)\])?\}|\$)/gi,p=0,h;(h=d.exec(l))!==null;)if(f+=l.substring(p,h.index),p=h.index,h[0]==="$$")f+="$",p++;else{p+=h[0].length;var m=u[h[1]];if(!m)throw new ReferenceError("Template: Property "+h[1]+" does not exist.");if(h[2]===void 0)switch(typeof m){case"string":f+=m;break;case"object":if(an(m))f+=m.toTex(c);else if(Array.isArray(m))f+=m.map(function(v,A){if(an(v))return v.toTex(c);throw new TypeError("Template: "+h[1]+"["+A+"] is not a Node.")}).join(",");else throw new TypeError("Template: "+h[1]+" has to be a Node, String or array of Nodes");break;default:throw new TypeError("Template: "+h[1]+" has to be a Node, String or array of Nodes")}else if(an(m[h[2]]&&m[h[2]]))f+=m[h[2]].toTex(c);else throw new TypeError("Template: "+h[1]+"["+h[2]+"] is not a Node.")}return f+=l.slice(p),f}class s extends n{constructor(u,c){if(super(),typeof u=="string"&&(u=new i(u)),!an(u))throw new TypeError('Node expected as parameter "fn"');if(!Array.isArray(c)||!c.every(an))throw new TypeError('Array containing Nodes expected for parameter "args"');this.fn=u,this.args=c||[]}get name(){return this.fn.name||""}get type(){return o7}get isFunctionNode(){return!0}_compile(u,c){var f=this.args.map(T=>T._compile(u,c));if(Oi(this.fn)){var d=this.fn.name;if(c[d]){var A=this.args;return function(D,k,M){var E=Oa(k,d);if(typeof E!="function")throw new TypeError("Argument '".concat(d,"' was not a function; received: ").concat(a(E)));if(E.rawArgs)return E(A,u,Hx(D,k));var O=f.map(P=>P(D,k,M));return E.apply(E,O)}}else{var p=d in u?Oa(u,d):void 0,h=typeof p=="function"&&p.rawArgs===!0,m=T=>{var D;if(T.has(d))D=T.get(d);else if(d in u)D=Oa(u,d);else return s.onUndefinedFunction(d);if(typeof D=="function")return D;throw new TypeError("'".concat(d,`' is not a function; its value is: |
| 86 | `).concat(a(D)))};if(h){var v=this.args;return function(D,k,M){var E=m(D);return E(v,u,Hx(D,k))}}else switch(f.length){case 0:return function(D,k,M){var E=m(D);return E()};case 1:return function(D,k,M){var E=m(D),O=f[0];return E(O(D,k,M))};case 2:return function(D,k,M){var E=m(D),O=f[0],P=f[1];return E(O(D,k,M),P(D,k,M))};default:return function(D,k,M){var E=m(D),O=f.map(P=>P(D,k,M));return E(...O)}}}}else if(Yc(this.fn)&&If(this.fn.index)&&this.fn.index.isObjectProperty()){var x=this.fn.object._compile(u,c),g=this.fn.index.getObjectProperty(),w=this.args;return function(D,k,M){var E=x(D,k,M),O=R0e(E,g);if(O!=null&&O.rawArgs)return O(w,u,Hx(D,k));var P=f.map(_=>_(D,k,M));return O.apply(E,P)}}else{var b=this.fn.toString(),y=this.fn._compile(u,c),S=this.args;return function(D,k,M){var E=y(D,k,M);if(typeof E!="function")throw new TypeError("Expression '".concat(b,"' did not evaluate to a function; value is:")+` |
| 87 | `.concat(a(E)));if(E.rawArgs)return E(S,u,Hx(D,k));var O=f.map(P=>P(D,k,M));return E.apply(E,O)}}}forEach(u){u(this.fn,"fn",this);for(var c=0;c<this.args.length;c++)u(this.args[c],"args["+c+"]",this)}map(u){for(var c=this._ifNode(u(this.fn,"fn",this)),f=[],d=0;d<this.args.length;d++)f[d]=this._ifNode(u(this.args[d],"args["+d+"]",this));return new s(c,f)}clone(){return new s(this.fn,this.args.slice(0))}toString(u){var c,f=this.fn.toString(u);return u&&typeof u.handler=="object"&&Pt(u.handler,f)&&(c=u.handler[f](this,u)),typeof c<"u"?c:super.toString(u)}_toString(u){var c=this.args.map(function(d){return d.toString(u)}),f=Vp(this.fn)?"("+this.fn.toString(u)+")":this.fn.toString(u);return f+"("+c.join(", ")+")"}toJSON(){return{mathjs:o7,fn:this.fn,args:this.args}}_toHTML(u){var c=this.args.map(function(f){return f.toHTML(u)});return'<span class="math-function">'+cl(this.fn)+'</span><span class="math-paranthesis math-round-parenthesis">(</span>'+c.join('<span class="math-separator">,</span>')+'<span class="math-paranthesis math-round-parenthesis">)</span>'}toTex(u){var c;return u&&typeof u.handler=="object"&&Pt(u.handler,this.name)&&(c=u.handler[this.name](this,u)),typeof c<"u"?c:super.toTex(u)}_toTex(u){var c=this.args.map(function(p){return p.toTex(u)}),f;PZ[this.name]&&(f=PZ[this.name]),r[this.name]&&(typeof r[this.name].toTex=="function"||typeof r[this.name].toTex=="object"||typeof r[this.name].toTex=="string")&&(f=r[this.name].toTex);var d;switch(typeof f){case"function":d=f(this,u);break;case"string":d=o(f,this,u);break;case"object":switch(typeof f[c.length]){case"function":d=f[c.length](this,u);break;case"string":d=o(f[c.length],this,u);break}}return typeof d<"u"?d:o(Bbe,this,u)}getIdentifier(){return this.type+":"+this.name}}return t=s,ai(s,"name",o7),ai(s,"onUndefinedFunction",function(l){throw new Error("Undefined function "+l)}),ai(s,"fromJSON",function(l){return new t(l.fn,l.args)}),s},{isClass:!0,isNode:!0});var Lbe="parse",but=["typed","numeric","config","AccessorNode","ArrayNode","AssignmentNode","BlockNode","ConditionalNode","ConstantNode","FunctionAssignmentNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","RangeNode","RelationalNode","SymbolNode"],l7=X(Lbe,but,e=>{var{typed:t,numeric:r,config:n,AccessorNode:i,ArrayNode:a,AssignmentNode:o,BlockNode:s,ConditionalNode:l,ConstantNode:u,FunctionAssignmentNode:c,FunctionNode:f,IndexNode:d,ObjectNode:p,OperatorNode:h,ParenthesisNode:m,RangeNode:v,RelationalNode:A,SymbolNode:x}=e,g=t(Lbe,{string:function(me){return J(me,{})},"Array | Matrix":function(me){return w(me,{})},"string, Object":function(me,Fe){var Ce=Fe.nodes!==void 0?Fe.nodes:{};return J(me,Ce)},"Array | Matrix, Object":w});function w(K){var me=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Fe=me.nodes!==void 0?me.nodes:{};return Ut(K,function(Ce){if(typeof Ce!="string")throw new TypeError("String expected");return J(Ce,Fe)})}var b={NULL:0,DELIMITER:1,NUMBER:2,SYMBOL:3,UNKNOWN:4},y={",":!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},S={mod:!0,to:!0,in:!0,and:!0,xor:!0,or:!0,not:!0},T={true:!0,false:!1,null:null,undefined:void 0},D=["NaN","Infinity"],k={'"':'"',"'":"'","\\":"\\","/":"/",b:"\b",f:"\f",n:` |
| 88 | `,r:"\r",t:" "};function M(){return{extraNodes:{},expression:"",comment:"",index:0,token:"",tokenType:b.NULL,nestingLevel:0,conditionalLevel:null}}function E(K,me){return K.expression.substr(K.index,me)}function O(K){return E(K,1)}function P(K){K.index++}function _(K){return K.expression.charAt(K.index-1)}function B(K){return K.expression.charAt(K.index+1)}function F(K){for(K.tokenType=b.NULL,K.token="",K.comment="";;){if(O(K)==="#")for(;O(K)!==` |
nothing calls this directly
no outgoing calls
no test coverage detected