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 h=new l(p+1);n=new Array(p);for(var d=0;d1)throw new Error("Probability must be between 0 and 1, inclusive")}else{if(!o(g))throw new TypeError("Unexpected type of argument in function quantileSeq");if(s=new g.constructor(1),g.isNegative()||g.gt(s))throw new Error("Probability must be between 0 and 1, inclusive")}n[y]=u(i,g,r)}return n}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")}})),Vu=Je("std",["typed","sqrt","variance"],(function(e){var t=e.typed,r=e.sqrt,n=e.variance;return t("std",{"Array | Matrix":i,"Array | Matrix, string":i,"Array | Matrix, number | BigNumber":i,"Array | Matrix, number | BigNumber, string":i,"...":function(e){return i(e)}});function i(e,t){if(0===e.length)throw new SyntaxError("Function std requires one or more parameters (0 provided)");try{return r(n.apply(null,arguments))}catch(e){throw e instanceof TypeError&&-1!==e.message.indexOf(" variance")?new TypeError(e.message.replace(" variance"," std")):e}}}));function Zu(e,t){if(t>1;return Zu(e,r)*Zu(r+1,t)}function Wu(e,t){if(!V(e)||e<0)throw new TypeError("Positive integer value expected in function combinations");if(!V(t)||t<0)throw new TypeError("Positive integer value expected in function combinations");if(t>e)throw new TypeError("k must be less than or equal to n");var r=e-t;return t171?1/0:Zu(1,e-1);if(e<.5)return Math.PI/(Math.sin(Math.PI*e)*Ku(1-e));if(e>=171.35)return 1/0;if(e>85){var r=e*e,n=r*e,i=n*e,a=i*e;return Math.sqrt(2*Math.PI/e)*Math.pow(e/Math.E,e)*(1+1/(12*e)+1/(288*r)-139/(51840*n)-571/(2488320*i)+163879/(209018880*a)+5246819/(75246796800*a*e))}--e,t=tc[0];for(var o=1;o2;)u+=o-=2,s=s.times(u);return new a(s.toPrecision(a.precision))}(e.minus(1));if(!e.isFinite())return new a(e.isNegative()?NaN:1/0);throw new Error("Integer BigNumber expected")},"Array | Matrix":function(e){return bt(e,this)}})})),nc=Je("factorial",["typed","gamma"],(function(e){var t=e.typed,r=e.gamma;return t("factorial",{number:function(e){if(e<0)throw new Error("Value must be non-negative");return r(e+1)},BigNumber:function(e){if(e.isNegative())throw new Error("Value must be non-negative");return r(e.plus(1))},"Array | Matrix":function(e){return bt(e,this)}})})),ic=Je("kldivergence",["typed","matrix","divide","sum","multiply","dotDivide","log","isNumeric"],(function(e){var t=e.typed,r=e.matrix,n=e.divide,i=e.sum,a=e.multiply,o=e.dotDivide,s=e.log,u=e.isNumeric;return t("kldivergence",{"Array, Array":function(e,t){return c(r(e),r(t))},"Matrix, Array":function(e,t){return c(e,r(t))},"Array, Matrix":function(e,t){return c(r(e),t)},"Matrix, Matrix":function(e,t){return c(e,t)}});function c(e,t){var r=t.size().length,c=e.size().length;if(r>1)throw new Error("first object must be one dimensional");if(c>1)throw new Error("second object must be one dimensional");if(r!==c)throw new Error("Length of two vectors must be equal");if(0===i(e))throw new Error("Sum of elements in first object must be non zero");if(0===i(t))throw new Error("Sum of elements in second object must be non zero");var f=n(e,i(e)),l=n(t,i(t)),p=i(a(f,s(o(f,l))));return u(p)?p:Number.NaN}})),ac=Je("multinomial",["typed","add","divide","multiply","factorial","isInteger","isPositive"],(function(e){var t=e.typed,r=e.add,n=e.divide,i=e.multiply,a=e.factorial,o=e.isInteger,s=e.isPositive;return t("multinomial",{"Array | Matrix":function(e){var t=0,u=1;return xt(e,(function(e){if(!o(e)||!s(e))throw new TypeError("Positive integer value expected in function multinomial");t=r(t,e),u=i(u,a(e))})),n(a(t),u)}})})),oc=Je("permutations",["typed","factorial"],(function(e){return(0,e.typed)("permutations",{"number | BigNumber":e.factorial,"number, number":function(e,t){if(!V(e)||e<0)throw new TypeError("Positive integer value expected in function permutations");if(!V(t)||t<0)throw new TypeError("Positive integer value expected in function permutations");if(t>e)throw new TypeError("second argument k must be less than or equal to first argument n");return Zu(e-t+1,e)},"BigNumber, BigNumber":function(e,t){var r,n;if(!sc(e)||!sc(t))throw new TypeError("Positive integer value expected in function permutations");if(t.gt(e))throw new TypeError("second argument k must be less than or equal to first argument n");for(r=e.mul(0).add(1),n=e.minus(t).plus(1);n.lte(e);n=n.plus(1))r=r.times(n);return r}})}));function sc(e){return e.isInteger()&&e.gte(0)}var uc=r(9),cc=r.n(uc),fc=cc()(Date.now());function lc(e){var t,r;return t=null===(r=e)?fc:cc()(String(r)),function(){return t()}}var pc=Je("pickRandom",["typed","config","?on"],(function(e){var t=e.typed,r=e.config,n=e.on,i=lc(r.randomSeed);return n&&n("config",(function(e,t){e.randomSeed!==t.randomSeed&&(i=lc(e.randomSeed))})),t({"Array | Matrix":function(e){return o(e,{})},"Array | Matrix, Object":function(e,t){return o(e,t)},"Array | Matrix, number":function(e,t){return o(e,{number:t})},"Array | Matrix, Array | Matrix":function(e,t){return o(e,{weights:t})},"Array | Matrix, Array | Matrix, number":function(e,t,r){return o(e,{number:r,weights:t})},"Array | Matrix, number, Array | Matrix":function(e,t,r){return o(e,{number:t,weights:r})}});function o(e,t){var r=t.number,n=t.weights,o=t.elementWise,s=void 0===o||o,u=void 0===r;u&&(r=1);var c=p(e)?e.create:p(n)?n.create:null;e=e.valueOf(),n&&(n=n.valueOf()),!0===s&&(e=Te(e),n=Te(n));var f=0;if(void 0!==n){if(n.length!==e.length)throw new Error("Weights must have the same length as possibles");for(var l=0,m=n.length;l1)for(var n=0,i=e.shift();n2&&o(t)){for(var a=t.args.pop();t.args.length>0;)a=r([t.args.pop(),a]);t.args=a.args}}},unflattenl:function e(t){if(t.args&&0!==t.args.length){for(var r=u(t),n=t.args.length,i=0;i2&&o(t)){for(var a=t.args.shift();t.args.length>0;)a=r([a,t.args.shift()]);t.args=a.args}}}}})),wc=Je("simplifyCore",["equal","isZero","add","subtract","multiply","divide","pow","ConstantNode","OperatorNode","FunctionNode","ParenthesisNode"],(function(e){var t=e.equal,r=e.isZero,n=e.add,i=e.subtract,a=e.multiply,o=e.divide,s=e.pow,u=e.ConstantNode,c=e.OperatorNode,f=e.FunctionNode,l=e.ParenthesisNode,p=new u(0),m=new u(1);return function e(h){if(j(h)&&h.isUnary()){var d=e(h.args[0]);if("+"===h.op)return d;if("-"===h.op){if(j(d)){if(d.isUnary()&&"-"===d.op)return d.args[0];if(d.isBinary()&&"subtract"===d.fn)return new c("-","subtract",[d.args[1],d.args[0]])}return new c(h.op,h.fn,[d])}}else if(j(h)&&h.isBinary()){var y=e(h.args[0]),g=e(h.args[1]);if("+"===h.op){if(z(y)){if(r(y.value))return g;if(z(g))return new u(n(y.value,g.value))}return z(g)&&r(g.value)?y:j(g)&&g.isUnary()&&"-"===g.op?new c("-","subtract",[y,g.args[0]]):new c(h.op,h.fn,g?[y,g]:[y])}if("-"===h.op){if(z(y)&&g){if(z(g))return new u(i(y.value,g.value));if(r(y.value))return new c("-","unaryMinus",[g])}if("subtract"===h.fn)return z(g)&&r(g.value)?y:j(g)&&g.isUnary()&&"-"===g.op?e(new c("+","add",[y,g.args[0]])):new c(h.op,h.fn,[y,g])}else{if("*"===h.op){if(z(y)){if(r(y.value))return p;if(t(y.value,1))return g;if(z(g))return new u(a(y.value,g.value))}if(z(g)){if(r(g.value))return p;if(t(g.value,1))return y;if(j(y)&&y.isBinary()&&y.op===h.op){var v=y.args[0];if(z(v)){var x=new u(a(v.value,g.value));return new c(h.op,h.fn,[x,y.args[1]],h.implicit)}}return new c(h.op,h.fn,[g,y],h.implicit)}return new c(h.op,h.fn,[y,g],h.implicit)}if("/"===h.op){if(z(y)){if(r(y.value))return p;if(z(g)&&(t(g.value,1)||t(g.value,2)||t(g.value,4)))return new u(o(y.value,g.value))}return new c(h.op,h.fn,[y,g])}if("^"===h.op){if(z(g)){if(r(g.value))return m;if(t(g.value,1))return y;if(z(y))return new u(s(y.value,g.value));if(j(y)&&y.isBinary()&&"^"===y.op){var b=y.args[1];if(z(b))return new c(h.op,h.fn,[y.args[0],new u(a(b.value,g.value))])}}return new c(h.op,h.fn,[y,g])}}}else{if(P(h)){var w=e(h.content);return P(w)||F(w)||z(w)?w:new l(w)}if(k(h)){var N=h.args.map(e).map((function(e){return P(e)?e.content:e}));return new f(e(h.fn),N)}}return h}})),Nc=Je("simplifyConstant",["typed","config","mathWithTransform","?fraction","?bignumber","ConstantNode","OperatorNode","FunctionNode","SymbolNode"],(function(e){var t=e.typed,r=e.config,n=e.mathWithTransform,i=e.fraction,a=e.bignumber,o=e.ConstantNode,s=e.OperatorNode,c=e.FunctionNode,f=e.SymbolNode,l=bc({FunctionNode:c,OperatorNode:s,SymbolNode:f}),p=l.isCommutative,m=l.isAssociative,h=l.allChildren,d=l.createMakeNodeFunction;function y(e,t,r){try{return x(n[e].apply(null,t),r)}catch(i){return t=t.map((function(e){return u(e)?e.valueOf():e})),x(n[e].apply(null,t),r)}}var g=t({Fraction:function(e){var t,r=e.s*e.n;t=r<0?new s("-","unaryMinus",[new o(-r)]):new o(r);if(1===e.d)return t;return new s("/","divide",[t,new o(e.d)])},number:function(e){return e<0?b(new o(-e)):new o(e)},BigNumber:function(e){return e<0?b(new o(-e)):new o(e)},Complex:function(e){throw new Error("Cannot convert Complex number to Node")}});function v(e,t){if(t&&!1!==t.exactFractions&&isFinite(e)&&i){var r=i(e),n=t&&"number"==typeof t.fractionsLimit?t.fractionsLimit:1/0;if(r.valueOf()===e&&r.n1?(o=w(s,f,u,r),l.unshift(o),o=w(s,l,u,r)):o=w(s,a,u,r)}else o=w(s,a,u,r);else a=t.args.map((function(t){return e(t,r)})),o=w(s,a,u,r);return o;case"ParenthesisNode":return e(t.content,r);case"AccessorNode":case"ArrayNode":case"AssignmentNode":case"BlockNode":case"FunctionAssignmentNode":case"IndexNode":case"ObjectNode":case"RangeNode":case"ConditionalNode":default:throw new Error("Unimplemented node type in simplifyConstant: ".concat(t.type))}}(e,t);return D(r)?r:g(r)}})),Mc=Je("resolve",["parse","FunctionNode","OperatorNode","ParenthesisNode"],(function(e){var t=e.parse,r=e.FunctionNode,n=e.OperatorNode,i=e.ParenthesisNode;return function e(a,o){if(!o)return a;if(F(a)){var s=o[a.name];if(D(s))return e(s,o);if("number"==typeof s)return t(String(s))}else{if(j(a)){var u=a.args.map((function(t){return e(t,o)}));return new n(a.op,a.fn,u,a.implicit)}if(P(a))return new i(e(a.content,o));if(k(a)){var c=a.args.map((function(t){return e(t,o)}));return new r(a.name,c)}}return a}}));function Sc(e){return(Sc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var Ec=Je("simplify",["config","typed","parse","add","subtract","multiply","divide","pow","isZero","equal","?fraction","?bignumber","mathWithTransform","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode","SymbolNode"],(function(e){var t=e.config,r=e.typed,n=e.parse,i=e.add,a=e.subtract,o=e.multiply,s=e.divide,u=e.pow,c=e.isZero,f=e.equal,l=e.fraction,p=e.bignumber,m=e.mathWithTransform,h=e.ConstantNode,d=e.FunctionNode,y=e.OperatorNode,g=e.ParenthesisNode,v=e.SymbolNode,x=Nc({typed:r,config:t,mathWithTransform:m,fraction:l,bignumber:p,ConstantNode:h,OperatorNode:y,FunctionNode:d,SymbolNode:v}),b=wc({equal:f,isZero:c,add:i,subtract:a,multiply:o,divide:s,pow:u,ConstantNode:h,OperatorNode:y,FunctionNode:d,ParenthesisNode:g}),w=Mc({parse:n,FunctionNode:d,OperatorNode:y,ParenthesisNode:g}),N=bc({FunctionNode:d,OperatorNode:y,SymbolNode:v}),M=N.isCommutative,S=N.isAssociative,E=N.flatten,A=N.unflattenr,O=N.unflattenl,C=N.createMakeNodeFunction,_=r("simplify",{string:function(e){return this(n(e),this.rules,{},{})},"string, Object":function(e,t){return this(n(e),this.rules,t,{})},"string, Object, Object":function(e,t,r){return this(n(e),this.rules,t,r)},"string, Array":function(e,t){return this(n(e),t,{},{})},"string, Array, Object":function(e,t,r){return this(n(e),t,r,{})},"string, Array, Object, Object":function(e,t,r,i){return this(n(e),t,r,i)},"Node, Object":function(e,t){return this(e,this.rules,t,{})},"Node, Object, Object":function(e,t,r){return this(e,this.rules,t,r)},Node:function(e){return this(e,this.rules,{},{})},"Node, Array":function(e,t){return this(e,t,{},{})},"Node, Array, Object":function(e,t,r){return this(e,t,r,{})},"Node, Array, Object, Object":function(e,t,r,i){t=function(e){for(var t=[],r=0;r");if(2!==s.length)throw SyntaxError("Could not parse rule: "+i);i={l:s[0],r:s[1]};case"object":if(a={l:T(n(i.l)),r:T(n(i.r))},i.context&&(a.evaluate=i.context),i.evaluate&&(a.evaluate=n(i.evaluate)),S(a.l)){var u=C(a.l),c=new v("_p"+I++);a.expanded={},a.expanded.l=u([a.l.clone(),c]),E(a.expanded.l),A(a.expanded.l),a.expanded.r=u([a.r,c])}break;case"function":a=i;break;default:throw TypeError("Unsupported type of rule: "+o)}t.push(a)}return t}(t);for(var a=w(e,r),o={},s=(a=T(a)).toString({parenthesis:"all"});!o[s];){o[s]=!0,I=0;for(var u=0;u=2&&2===e.args.length){for(var i=function(e,t){var r,n,i=[],a=C(e);if(M(e,t))for(var o=0;o2)throw Error("Unexpected non-binary associative function: "+e.toString());return[]}for(var u=[],c=0;c0){for(var n=d(e,t.args[0],r),i=1;i0){var n=e.args.filter((function(e){return void 0===t[e]})),i=1===n.length?n[0]:new f("*","multiply",n),s=r.concat(y(i,t));return new f("*","multiply",s)}return new f("+","add",e.args.map((function(r){return new f("*","multiply",e.args.map((function(e){return e===r?y(e,t):e.clone()})))})))}if("/"===e.op&&e.isBinary()){var u=e.args[0],l=e.args[1];return void 0!==t[l]?new f("/","divide",[y(u,t),l]):void 0!==t[u]?new f("*","multiply",[new f("-","unaryMinus",[u]),new f("/","divide",[y(l,t),new f("^","pow",[l.clone(),g(2)])])]):new f("/","divide",[new f("-","subtract",[new f("*","multiply",[y(u,t),l.clone()]),new f("*","multiply",[u.clone(),y(l,t)])]),new f("^","pow",[l.clone(),g(2)])])}if("^"===e.op&&e.isBinary()){var p=e.args[0],m=e.args[1];if(void 0!==t[p])return z(p)&&(o(p.value)||a(p.value,1))?g(0):new f("*","multiply",[e,new f("*","multiply",[new c("log",[p.clone()]),y(m.clone(),t)])]);if(void 0!==t[m]){if(z(m)){if(o(m.value))return g(0);if(a(m.value,1))return y(p,t)}var h=new f("^","pow",[p.clone(),new f("-","subtract",[m,g(1)])]);return new f("*","multiply",[m.clone(),new f("*","multiply",[y(p,t),h])])}return new f("*","multiply",[new f("^","pow",[p.clone(),m.clone()]),new f("+","add",[new f("*","multiply",[y(p,t),new f("/","divide",[m.clone(),p.clone()])]),new f("*","multiply",[y(m,t),new c("log",[p.clone()])])])])}throw new Error('Operator "'+e.op+'" is not supported by derivative, or a wrong number of arguments is passed')}});function g(e,t){return new u(s(e,t||r.number))}return m})),Oc=Je("rationalize",["config","typed","equal","isZero","add","subtract","multiply","divide","pow","parse","simplify","?bignumber","?fraction","mathWithTransform","ConstantNode","OperatorNode","FunctionNode","SymbolNode","ParenthesisNode"],(function(e){var t=e.config,r=e.typed,n=e.equal,i=e.isZero,a=e.add,o=e.subtract,s=e.multiply,u=e.divide,c=e.pow,f=e.parse,l=e.simplify,p=e.fraction,m=e.bignumber,h=e.mathWithTransform,d=e.ConstantNode,y=e.OperatorNode,g=e.FunctionNode,v=e.SymbolNode,x=e.ParenthesisNode,b=Nc({typed:r,config:t,mathWithTransform:h,fraction:p,bignumber:m,ConstantNode:d,OperatorNode:y,FunctionNode:g,SymbolNode:v}),w=wc({equal:n,isZero:i,add:a,subtract:o,multiply:s,divide:u,pow:c,ConstantNode:d,OperatorNode:y,FunctionNode:g,ParenthesisNode:x});return r("rationalize",{string:function(e){return this(f(e),{},!1)},"string, boolean":function(e,t){return this(f(e),{},t)},"string, Object":function(e,t){return this(f(e),t,!1)},"string, Object, boolean":function(e,t,r){return this(f(e),t,r)},Node:function(e){return this(e,{},!1)},"Node, boolean":function(e,t){return this(e,{},t)},"Node, Object":function(e,t){return this(e,t,!1)},"Node, Object, boolean":function(e,t,r){var n=function(){var e=[w,{l:"n+n",r:"2*n"},{l:"n+-n",r:"0"},b,{l:"n*(n1^-1)",r:"n/n1"},{l:"n*n1^-n2",r:"n/n1^n2"},{l:"n1^-1",r:"1/n1"},{l:"n*(n1/n2)",r:"(n*n1)/n2"},{l:"1*n",r:"n"}],t=[{l:"(-n1)/(-n2)",r:"n1/n2"},{l:"(-n1)*(-n2)",r:"n1*n2"},{l:"n1--n2",r:"n1+n2"},{l:"n1-n2",r:"n1+(-n2)"},{l:"(n1+n2)*n3",r:"(n1*n3 + n2*n3)"},{l:"n1*(n2+n3)",r:"(n1*n2+n1*n3)"},{l:"c1*n + c2*n",r:"(c1+c2)*n"},{l:"c1*n + n",r:"(c1+1)*n"},{l:"c1*n - c2*n",r:"(c1-c2)*n"},{l:"c1*n - n",r:"(c1-1)*n"},{l:"v/c",r:"(1/c)*v"},{l:"v/-c",r:"-(1/c)*v"},{l:"-v*-c",r:"c*v"},{l:"-v*c",r:"-c*v"},{l:"v*-c",r:"-c*v"},{l:"v*c",r:"c*v"},{l:"-(-n1*n2)",r:"(n1*n2)"},{l:"-(n1*n2)",r:"(-n1*n2)"},{l:"-(-n1+n2)",r:"(n1-n2)"},{l:"-(n1+n2)",r:"(-n1-n2)"},{l:"(n1^n2)^n3",r:"(n1^(n2*n3))"},{l:"-(-n1/n2)",r:"(n1/n2)"},{l:"-(n1/n2)",r:"(-n1/n2)"}],r=[{l:"(n1/(n2/n3))",r:"((n1*n3)/n2)"},{l:"(n1/n2/n3)",r:"(n1/(n2*n3))"}],n={};return n.firstRules=e.concat(t,r),n.distrDivRules=[{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)"}],n.sucDivRules=r,n.firstRulesAgain=e.concat(t),n.finalRules=[w,{l:"n*-n",r:"-n^2"},{l:"n*n",r:"n^2"},b,{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))"}],n}(),i=function(e,t,r,n){var i=[],a=l(e,n,t,{exactFractions:!1}),o="+-*"+((r=!!r)?"/":"");!function e(t){var r=t.type;if("FunctionNode"===r)throw new Error("There is an unsolved function call");if("OperatorNode"===r)if("^"===t.op){if("ConstantNode"!==t.args[1].type||!V(parseFloat(t.args[1].value)))throw new Error("There is a non-integer exponent");e(t.args[0])}else{if(-1===o.indexOf(t.op))throw new Error("Operator "+t.op+" invalid in polynomial expression");for(var n=0;n=1){var o,s;e=function e(t,r,n){var i=t.type,a=arguments.length>1;if("OperatorNode"===i&&t.isBinary()){var o,s=!1;if("^"===t.op&&("ParenthesisNode"!==t.args[0].type&&"OperatorNode"!==t.args[0].type||"ConstantNode"!==t.args[1].type||(o=parseFloat(t.args[1].value),s=o>=2&&V(o))),s){if(o>2){var u=t.args[0],c=new y("^","pow",[t.args[0].cloneDeep(),new d(o-1)]);t=new y("*","multiply",[u,c])}else t=new y("*","multiply",[t.args[0],t.args[0].cloneDeep()]);a&&("content"===n?r.content=t:r.args[n]=t)}}if("ParenthesisNode"===i)e(t.content,t,"content");else if("ConstantNode"!==i&&"SymbolNode"!==i)for(var f=0;fn&&(t[c]=0),t[c]+=o.cte*("+"===o.oper?1:-1),void(n=Math.max(c,n))}o.cte=c,""===o.fire&&(t[0]+=o.cte*("+"===o.oper?1:-1))}}(e,null,r);for(var a,o=!0,s=n=t.length-1;s>=0;s--)if(0!==t[s]){var u=new d(o?t[s]:Math.abs(t[s])),c=t[s]<0?"-":"+";if(s>0){var f=new v(i);if(s>1){var l=new d(s);f=new y("^","pow",[f,l])}u=-1===t[s]&&o?new y("-","unaryMinus",[f]):1===Math.abs(t[s])?f:new y("*","multiply",[u,f])}a=o?u:"+"===c?new y("+","add",[a,u]):new y("-","subtract",[a,u]),o=!1}return o?new d(0):a}})),Cc=Je("reviver",["classes"],(function(e){var t=e.classes;return function(e,r){var n=t[r&&r.mathjs];return n&&"function"==typeof n.fromJSON?n.fromJSON(r):r}})),_c=Je("replacer",[],(function(){return function(e,t){return"number"!=typeof t||isFinite(t)&&!isNaN(t)?t:{mathjs:"number",value:String(t)}}})),Tc=Math.PI,qc=2*Math.PI,zc=Math.E,Ic=Je("true",[],(function(){return!0})),kc=Je("false",[],(function(){return!1})),Bc=Je("null",[],(function(){return null})),Dc=Qc("Infinity",["config","?BigNumber"],(function(e){var t=e.config,r=e.BigNumber;return"BigNumber"===t.number?new r(1/0):1/0})),Rc=Qc("NaN",["config","?BigNumber"],(function(e){var t=e.config,r=e.BigNumber;return"BigNumber"===t.number?new r(NaN):NaN})),jc=Qc("pi",["config","?BigNumber"],(function(e){var t=e.config,r=e.BigNumber;return"BigNumber"===t.number?Xa(r):Tc})),Pc=Qc("tau",["config","?BigNumber"],(function(e){var t=e.config,r=e.BigNumber;return"BigNumber"===t.number?Qa(r):qc})),Uc=Qc("e",["config","?BigNumber"],(function(e){var t=e.config,r=e.BigNumber;return"BigNumber"===t.number?Ja(r):zc})),Fc=Qc("phi",["config","?BigNumber"],(function(e){var t=e.config,r=e.BigNumber;return"BigNumber"===t.number?Ya(r):1.618033988749895})),Lc=Qc("LN2",["config","?BigNumber"],(function(e){var t=e.config,r=e.BigNumber;return"BigNumber"===t.number?new r(2).ln():Math.LN2})),Hc=Qc("LN10",["config","?BigNumber"],(function(e){var t=e.config,r=e.BigNumber;return"BigNumber"===t.number?new r(10).ln():Math.LN10})),$c=Qc("LOG2E",["config","?BigNumber"],(function(e){var t=e.config,r=e.BigNumber;return"BigNumber"===t.number?new r(1).div(new r(2).ln()):Math.LOG2E})),Gc=Qc("LOG10E",["config","?BigNumber"],(function(e){var t=e.config,r=e.BigNumber;return"BigNumber"===t.number?new r(1).div(new r(10).ln()):Math.LOG10E})),Vc=Qc("SQRT1_2",["config","?BigNumber"],(function(e){var t=e.config,r=e.BigNumber;return"BigNumber"===t.number?new r("0.5").sqrt():Math.SQRT1_2})),Zc=Qc("SQRT2",["config","?BigNumber"],(function(e){var t=e.config,r=e.BigNumber;return"BigNumber"===t.number?new r(2).sqrt():Math.SQRT2})),Wc=Qc("i",["Complex"],(function(e){return e.Complex.I})),Jc=Je("PI",["pi"],(function(e){return e.pi})),Yc=Je("E",["e"],(function(e){return e.e})),Xc=Je("version",[],(function(){return"8.1.1"}));function Qc(e,t,r){return Je(e,t,r,{recreateOnConfigChange:!0})}var Kc=Yf("speedOfLight","299792458","m s^-1"),ef=Yf("gravitationConstant","6.67430e-11","m^3 kg^-1 s^-2"),tf=Yf("planckConstant","6.62607015e-34","J s"),rf=Yf("reducedPlanckConstant","1.0545718176461565e-34","J s"),nf=Yf("magneticConstant","1.25663706212e-6","N A^-2"),af=Yf("electricConstant","8.8541878128e-12","F m^-1"),of=Yf("vacuumImpedance","376.730313667","ohm"),sf=Yf("coulomb","8.987551792261171e9","N m^2 C^-2"),uf=Yf("elementaryCharge","1.602176634e-19","C"),cf=Yf("bohrMagneton","9.2740100783e-24","J T^-1"),ff=Yf("conductanceQuantum","7.748091729863649e-5","S"),lf=Yf("inverseConductanceQuantum","12906.403729652257","ohm"),pf=Yf("magneticFluxQuantum","2.0678338484619295e-15","Wb"),mf=Yf("nuclearMagneton","5.0507837461e-27","J T^-1"),hf=Yf("klitzing","25812.807459304513","ohm"),df=Yf("bohrRadius","5.29177210903e-11","m"),yf=Yf("classicalElectronRadius","2.8179403262e-15","m"),gf=Yf("electronMass","9.1093837015e-31","kg"),vf=Yf("fermiCoupling","1.1663787e-5","GeV^-2"),xf=Xf("fineStructure",.0072973525693),bf=Yf("hartreeEnergy","4.3597447222071e-18","J"),wf=Yf("protonMass","1.67262192369e-27","kg"),Nf=Yf("deuteronMass","3.3435830926e-27","kg"),Mf=Yf("neutronMass","1.6749271613e-27","kg"),Sf=Yf("quantumOfCirculation","3.6369475516e-4","m^2 s^-1"),Ef=Yf("rydberg","10973731.568160","m^-1"),Af=Yf("thomsonCrossSection","6.6524587321e-29","m^2"),Of=Xf("weakMixingAngle",.2229),Cf=Xf("efimovFactor",22.7),_f=Yf("atomicMass","1.66053906660e-27","kg"),Tf=Yf("avogadro","6.02214076e23","mol^-1"),qf=Yf("boltzmann","1.380649e-23","J K^-1"),zf=Yf("faraday","96485.33212331001","C mol^-1"),If=Yf("firstRadiation","3.7417718521927573e-16","W m^2"),kf=Yf("loschmidt","2.686780111798444e25","m^-3"),Bf=Yf("gasConstant","8.31446261815324","J K^-1 mol^-1"),Df=Yf("molarPlanckConstant","3.990312712893431e-10","J s mol^-1"),Rf=Yf("molarVolume","0.022413969545014137","m^3 mol^-1"),jf=Xf("sackurTetrode",-1.16487052358),Pf=Yf("secondRadiation","0.014387768775039337","m K"),Uf=Yf("stefanBoltzmann","5.67037441918443e-8","W m^-2 K^-4"),Ff=Yf("wienDisplacement","2.897771955e-3","m K"),Lf=Yf("molarMass","0.99999999965e-3","kg mol^-1"),Hf=Yf("molarMassC12","11.9999999958e-3","kg mol^-1"),$f=Yf("gravity","9.80665","m s^-2"),Gf=Yf("planckLength","1.616255e-35","m"),Vf=Yf("planckMass","2.176435e-8","kg"),Zf=Yf("planckTime","5.391245e-44","s"),Wf=Yf("planckCharge","1.87554603778e-18","C"),Jf=Yf("planckTemperature","1.416785e+32","K");function Yf(e,t,r){return Je(e,["config","Unit","BigNumber"],(function(e){var n=e.config,i=e.Unit,a=e.BigNumber,o=new i("BigNumber"===n.number?new a(t):parseFloat(t),r);return o.fixPrefix=!0,o}))}function Xf(e,t){return Je(e,["config","BigNumber"],(function(e){var r=e.config,n=e.BigNumber;return"BigNumber"===r.number?new n(t):t}))}var Qf=Je("apply",["typed","isInteger"],(function(e){var t=e.typed,r=e.isInteger,n=xr({typed:t,isInteger:r});return t("apply",{"...any":function(e){var t=e[1];a(t)?e[1]=t-1:o(t)&&(e[1]=t.minus(1));try{return n.apply(null,e)}catch(e){throw ys(e)}}})}),{isTransformFunction:!0}),Kf=Je("column",["typed","Index","matrix","range"],(function(e){var t=e.typed,r=e.Index,n=e.matrix,i=e.range,o=Fn({typed:t,Index:r,matrix:n,range:i});return t("column",{"...any":function(e){var t=e.length-1,r=e[t];a(r)&&(e[t]=r-1);try{return o.apply(null,e)}catch(e){throw ys(e)}}})}),{isTransformFunction:!0});function el(e,t,r){var n=e.filter((function(e){return F(e)&&!(e.name in t)&&!(e.name in r)}))[0];if(!n)throw new Error('No undefined variable found in inline expression "'+e+'"');var i=n.name,a=Object.create(r),o=e.compile();return function(e){return a[i]=e,o.evaluate(a)}}var tl=Je("filter",["typed"],(function(e){var t=e.typed;function r(e,t,r){var i,a;return e[0]&&(i=e[0].compile().evaluate(r)),e[1]&&(a=F(e[1])||I(e[1])?e[1].compile().evaluate(r):el(e[1],t,r)),n(i,a)}r.rawArgs=!0;var n=t("filter",{"Array, function":rl,"Matrix, function":function(e,t){return e.create(rl(e.toArray(),t))},"Array, RegExp":ke,"Matrix, RegExp":function(e,t){return e.create(ke(e.toArray(),t))}});return r}),{isTransformFunction:!0});function rl(e,t){var r=Zn(t);return Ie(e,(function(e,n,i){return 1===r?t(e):2===r?t(e,[n+1]):t(e,[n+1],i)}))}var nl=Je("forEach",["typed"],(function(e){var t=e.typed;function r(e,t,r){var i,a;return e[0]&&(i=e[0].compile().evaluate(r)),e[1]&&(a=F(e[1])||I(e[1])?e[1].compile().evaluate(r):el(e[1],t,r)),n(i,a)}r.rawArgs=!0;var n=t("forEach",{"Array | Matrix, function":function(e,t){var r=Zn(t);!function n(i,a){Array.isArray(i)?ze(i,(function(e,t){n(e,a.concat(t+1))})):1===r?t(i):2===r?t(i,a):t(i,a,e)}(e.valueOf(),[])}});return r}),{isTransformFunction:!0}),il=Je("index",["Index"],(function(e){var t=e.Index;return function(){for(var e=[],r=0,n=arguments.length;r0?0:2;else if(i&&!0===i.isSet)i=i.map((function(e){return e-1}));else if(l(i)||p(i))i=i.map((function(e){return e-1}));else if(a(i))i--;else if(o(i))i=i.toNumber()-1;else if("string"!=typeof i)throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range");e[r]=i}var s=new t;return t.apply(s,e),s}}),{isTransformFunction:!0}),al=Je("map",["typed"],(function(e){var t=e.typed;function r(e,t,r){var i,a;return e[0]&&(i=e[0].compile().evaluate(r)),e[1]&&(a=F(e[1])||I(e[1])?e[1].compile().evaluate(r):el(e[1],t,r)),n(i,a)}r.rawArgs=!0;var n=t("map",{"Array, function":function(e,t){return ol(e,t,e)},"Matrix, function":function(e,t){return e.create(ol(e.valueOf(),t,e))}});return r}),{isTransformFunction:!0});function ol(e,t,r){var n=Zn(t);return function e(i,a){return Array.isArray(i)?qe(i,(function(t,r){return e(t,a.concat(r+1))})):1===n?t(i):2===n?t(i,a):t(i,a,r)}(e,[])}var sl=Je("max",["typed","config","numeric","larger"],(function(e){var t=e.typed,r=e.config,n=e.numeric,i=e.larger,s=Ha({typed:t,config:r,numeric:n,larger:i});return t("max",{"...any":function(e){if(2===e.length&&m(e[0])){var t=e[1];a(t)?e[1]=t-1:o(t)&&(e[1]=t.minus(1))}try{return s.apply(null,e)}catch(e){throw ys(e)}}})}),{isTransformFunction:!0}),ul=Je("mean",["typed","add","divide"],(function(e){var t=e.typed,r=e.add,n=e.divide,i=Fu({typed:t,add:r,divide:n});return t("mean",{"...any":function(e){if(2===e.length&&m(e[0])){var t=e[1];a(t)?e[1]=t-1:o(t)&&(e[1]=t.minus(1))}try{return i.apply(null,e)}catch(e){throw ys(e)}}})}),{isTransformFunction:!0}),cl=Je("min",["typed","config","numeric","smaller"],(function(e){var t=e.typed,r=e.config,n=e.numeric,i=e.smaller,s=$a({typed:t,config:r,numeric:n,smaller:i});return t("min",{"...any":function(e){if(2===e.length&&m(e[0])){var t=e[1];a(t)?e[1]=t-1:o(t)&&(e[1]=t.minus(1))}try{return s.apply(null,e)}catch(e){throw ys(e)}}})}),{isTransformFunction:!0}),fl=Je("range",["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq"],(function(e){var t=e.typed,r=e.config,n=e.matrix,i=e.bignumber,a=e.smaller,o=e.smallerEq,s=e.larger,u=e.largerEq,c=ci({typed:t,config:r,matrix:n,bignumber:i,smaller:a,smallerEq:o,larger:s,largerEq:u});return t("range",{"...any":function(e){return"boolean"!=typeof e[e.length-1]&&e.push(!0),c.apply(null,e)}})}),{isTransformFunction:!0}),ll=Je("row",["typed","Index","matrix","range"],(function(e){var t=e.typed,r=e.Index,n=e.matrix,i=e.range,o=di({typed:t,Index:r,matrix:n,range:i});return t("row",{"...any":function(e){var t=e.length-1,r=e[t];a(r)&&(e[t]=r-1);try{return o.apply(null,e)}catch(e){throw ys(e)}}})}),{isTransformFunction:!0}),pl=Je("subset",["typed","matrix"],(function(e){var t=e.typed,r=e.matrix,n=Ai({typed:t,matrix:r});return t("subset",{"...any":function(e){try{return n.apply(null,e)}catch(e){throw ys(e)}}})}),{isTransformFunction:!0}),ml=Je("concat",["typed","matrix","isInteger"],(function(e){var t=e.typed,r=e.matrix,n=e.isInteger,i=Pn({typed:t,matrix:r,isInteger:n});return t("concat",{"...any":function(e){var t=e.length-1,r=e[t];a(r)?e[t]=r-1:o(r)&&(e[t]=r.minus(1));try{return i.apply(null,e)}catch(e){throw ys(e)}}})}),{isTransformFunction:!0}),hl=Je("diff",["typed","matrix","subtract","number","bignumber"],(function(e){var t=e.typed,r=e.matrix,n=e.subtract,i=e.number,s=e.bignumber,u=ii({typed:t,matrix:r,subtract:n,number:i,bignumber:s});return t("diff",{"...any":function(e){if(2===e.length&&m(e[0])){var t=e[1];a(t)?e[1]=t-1:o(t)&&(e[1]=t.minus(1))}try{return u.apply(null,e)}catch(e){throw ys(e)}}})}),{isTransformFunction:!0}),dl=Je("std",["typed","sqrt","variance"],(function(e){var t=e.typed,r=e.sqrt,n=e.variance,i=Vu({typed:t,sqrt:r,variance:n});return t("std",{"...any":function(e){if(e.length>=2&&m(e[0])){var t=e[1];a(t)?e[1]=t-1:o(t)&&(e[1]=t.minus(1))}try{return i.apply(null,e)}catch(e){throw ys(e)}}})}),{isTransformFunction:!0}),yl=Je("sum",["typed","config","add","numeric"],(function(e){var t=e.typed,r=e.config,n=e.add,i=e.numeric,s=Uu({typed:t,config:r,add:n,numeric:i});return t("sum",{"...any":function(e){if(2===e.length&&m(e[0])){var t=e[1];a(t)?e[1]=t-1:o(t)&&(e[1]=t.minus(1))}try{return s.apply(null,e)}catch(e){throw ys(e)}}})}),{isTransformFunction:!0}),gl=Je("variance",["typed","add","subtract","multiply","divide","apply","isNaN"],(function(e){var t=e.typed,r=e.add,n=e.subtract,i=e.multiply,s=e.divide,u=e.apply,c=e.isNaN,f=$u({typed:t,add:r,subtract:n,multiply:i,divide:s,apply:u,isNaN:c});return t("variance",{"...any":function(e){if(e.length>=2&&m(e[0])){var t=e[1];a(t)?e[1]=t-1:o(t)&&(e[1]=t.minus(1))}try{return f.apply(null,e)}catch(e){throw ys(e)}}})}),{isTransformFunction:!0}),vl=r(10),xl=r.n(vl);function bl(e){return(bl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function wl(e,t,r,n){function i(t,i,o){var s;if(o.wrap&&"function"==typeof i&&(i=function(e){var t=function(){for(var t=[],n=0,i=arguments.length;n2&&void 0!==arguments[2]?arguments[2]:t.fn;if(Pe(a,"."))throw new Error("Factory name should not contain a nested path. Name: "+JSON.stringify(a));var o=g(t)?r.expression.transform:r,s=a in r.expression.transform,u=Ze(o,a)?o[a]:void 0,c=function(){var n={};t.dependencies.map(Xe).forEach((function(e){if(Pe(e,"."))throw new Error("Factory dependency should not contain a nested path. Name: "+JSON.stringify(e));"math"===e?n.math=r:"mathWithTransform"===e?n.mathWithTransform=r.expression.mathWithTransform:"classes"===e?n.classes=r:n[e]=r[e]}));var o=t(n);if(o&&"function"==typeof o.transform)throw new Error('Transforms cannot be attached to factory functions. Please create a separate function for it with exports.path="expression.transform"');if(void 0===u||i.override)return o;if(h(u)&&h(o))return e(u,o);if(i.silent)return u;throw new Error('Cannot import "'+a+'": already exists')};t.meta&&!1===t.meta.lazy?(o[a]=c(),u&&s?f(a):(g(t)||y(t))&&Ve(r.expression.mathWithTransform,a,(function(){return o[a]}))):(Ve(o,a,c),u&&s?f(a):(g(t)||y(t))&&Ve(r.expression.mathWithTransform,a,(function(){return o[a]}))),n[a]=t,r.emit("import",a,c)}function m(e){return"function"==typeof e||"number"==typeof e||"string"==typeof e||"boolean"==typeof e||null===e||c(e)||s(e)||o(e)||u(e)||p(e)||Array.isArray(e)}function h(e){return"function"==typeof e&&"object"===bl(e.signatures)}function d(e){return!Ze(v,e)}function y(e){return!(-1!==e.fn.indexOf(".")||Ze(v,e.fn)||e.meta&&e.meta.isClass)}function g(e){return void 0!==e&&void 0!==e.meta&&!0===e.meta.isTransformFunction||!1}var v={expression:!0,type:!0,docs:!0,error:!0,json:!0,chain:!0};return function(e,t){var r=arguments.length;if(1!==r&&2!==r)throw new li("import",r,1,2);function n(e,r,i){if(Array.isArray(r))r.forEach((function(t){return n(e,t)}));else if("object"===bl(r))for(var a in r)Ze(r,a)&&n(e,r[a],a);else if(Ye(r)||void 0!==i){var o=Ye(r)?g(r)?r.fn+".transform":r.fn:i;if(Ze(e,o)&&e[o]!==r&&!t.silent)throw new Error('Cannot import "'+o+'" twice');e[o]=r}else if(!t.silent)throw new TypeError("Factory, Object, or Array expected")}t||(t={});var a={};for(var o in n(a,e),a)if(Ze(a,o)){var s=a[o];if(Ye(s))l(s,t);else if(m(s))i(o,s,t);else if(!t.silent)throw new TypeError("Factory, Object, or Array expected")}}}var Nl={epsilon:1e-12,matrix:"Matrix",number:"number",precision:64,predictable:!1,randomSeed:null},Ml=["Matrix","Array"],Sl=["number","BigNumber","Fraction"];function El(e,t){function r(r){if(r){var n=Le(e,Fe);Al(r,"matrix",Ml),Al(r,"number",Sl),function e(t,r){if(Array.isArray(r))throw new TypeError("Arrays are not supported by deepExtend");for(var n in r)if(Ze(r,n)&&!(n in Object.prototype)&&!(n in Function.prototype))if(r[n]&&r[n].constructor===Object)void 0===t[n]&&(t[n]={}),t[n]&&t[n].constructor===Object?e(t[n],r[n]):t[n]=r[n];else{if(Array.isArray(r[n]))throw new TypeError("Arrays are not supported by deepExtend");t[n]=r[n]}return t}(e,r);var i=Le(e,Fe),a=Le(r,Fe);return t("config",i,n,a),i}return Le(e,Fe)}return r.MATRIX_OPTIONS=Ml,r.NUMBER_OPTIONS=Sl,Object.keys(Nl).forEach((function(t){Object.defineProperty(r,t,{get:function(){return e[t]},enumerable:!0,configurable:!0})})),r}function Al(e,t,r){var n,i;void 0!==e[t]&&(n=r,i=e[t],-1===n.indexOf(i))&&console.warn('Warning: Unknown value "'+e[t]+'" for configuration option "'+t+'". Available options: '+r.map((function(e){return JSON.stringify(e)})).join(", ")+".")}function Ol(){return(Ol=Object.assign||function(e){for(var t=1;t0){for(e>=1&&(e/=h=Math.pow(10,Math.floor(1+Math.log(e)/Math.LN10)));y<=x&&v<=x;){if(e===(r=(d+g)/(y+v))){y+v<=x?(n=d+g,a=y+v):v>y?(n=g,a=v):(n=d,a=y);break}e>r?(d+=g,y+=v):(g+=d,v+=y),y>x?(n=g,a=v):(n=d,a=y)}n*=h}else(isNaN(e)||isNaN(t))&&(a=n=NaN);break;case"string":if(null===(y=e.match(/\d+|./g))&&c(),"-"===y[d]?(s=-1,d++):"+"===y[d]&&d++,y.length===d+1?l=u(y[d++],s):"."===y[d+1]||"."===y[d]?("."!==y[d]&&(f=u(y[d++],s)),(++d+1===y.length||"("===y[d+1]&&")"===y[d+3]||"'"===y[d+1]&&"'"===y[d+3])&&(l=u(y[d],s),m=Math.pow(10,y[d].length),d++),("("===y[d]&&")"===y[d+2]||"'"===y[d]&&"'"===y[d+2])&&(p=u(y[d+1],s),h=Math.pow(10,y[d+1].length)-1,d+=3)):"/"===y[d+1]||":"===y[d+1]?(l=u(y[d],s),m=u(y[d+2],1),d+=3):"/"===y[d+3]&&" "===y[d+1]&&(f=u(y[d],s),l=u(y[d+2],s),m=u(y[d+4],1),d+=5),y.length<=d){s=n=p+(a=m*h)*f+h*l;break}default:c()}if(0===a)throw new o;i.s=s<0?-1:1,i.n=Math.abs(n),i.d=Math.abs(a)};function l(e,t){if(!e)return t;if(!t)return e;for(;;){if(!(e%=t))return t;if(!(t%=e))return e}}function p(e,t){if(!(this instanceof p))return new p(e,t);f(e,t),e=p.REDUCE?l(i.d,i.n):1,this.s=i.s,this.n=i.n/e,this.d=i.d/e}p.REDUCE=1,p.prototype={s:1,n:0,d:1,abs:function(){return new p(this.n,this.d)},neg:function(){return new p(-this.s*this.n,this.d)},add:function(e,t){return f(e,t),new p(this.s*this.n*i.d+i.s*this.d*i.n,this.d*i.d)},sub:function(e,t){return f(e,t),new p(this.s*this.n*i.d-i.s*this.d*i.n,this.d*i.d)},mul:function(e,t){return f(e,t),new p(this.s*i.s*this.n*i.n,this.d*i.d)},div:function(e,t){return f(e,t),new p(this.s*i.s*this.n*i.d,this.d*i.n)},clone:function(){return new p(this)},mod:function(e,t){return isNaN(this.n)||isNaN(this.d)?new p(NaN):void 0===e?new p(this.s*this.n%this.d,1):(f(e,t),0===i.n&&0===this.d&&p(0,0),new p(this.s*(i.d*this.n)%(i.n*this.d),i.d*this.d))},gcd:function(e,t){return f(e,t),new p(l(i.n,this.n)*l(i.d,this.d),i.d*this.d)},lcm:function(e,t){return f(e,t),0===i.n&&0===this.n?new p:new p(i.n*this.n,l(i.n,this.n)*l(i.d,this.d))},ceil:function(e){return e=Math.pow(10,e||0),isNaN(this.n)||isNaN(this.d)?new p(NaN):new p(Math.ceil(e*this.s*this.n/this.d),e)},floor:function(e){return e=Math.pow(10,e||0),isNaN(this.n)||isNaN(this.d)?new p(NaN):new p(Math.floor(e*this.s*this.n/this.d),e)},round:function(e){return e=Math.pow(10,e||0),isNaN(this.n)||isNaN(this.d)?new p(NaN):new p(Math.round(e*this.s*this.n/this.d),e)},inverse:function(){return new p(this.s*this.d,this.n)},pow:function(e){return e<0?new p(Math.pow(this.s*this.d,-e),Math.pow(this.n,-e)):new p(Math.pow(this.s*this.n,e),Math.pow(this.d,e))},equals:function(e,t){return f(e,t),this.s*this.n*i.d==i.s*i.n*this.d},compare:function(e,t){f(e,t);var r=this.s*this.n*i.d-i.s*i.n*this.d;return(00&&(r+=t,r+=" ",n%=i),r+=n,r+="/",r+=i),r},toLatex:function(e){var t,r="",n=this.n,i=this.d;return this.s<0&&(r+="-"),1===i?r+=n:(e&&(t=Math.floor(n/i))>0&&(r+=t,n%=i),r+="\\frac{",r+=n,r+="}{",r+=i,r+="}"),r},toContinued:function(){var e,t=this.n,r=this.d,n=[];if(isNaN(t)||isNaN(r))return n;do{n.push(Math.floor(t/r)),e=t%r,t=r,r=e}while(1!==t);return n},toString:function(e){var t,r=this.n,n=this.d;if(isNaN(r)||isNaN(n))return"NaN";p.REDUCE||(r/=t=l(r,n),n/=t),e=e||15;var i=function(e,t){for(;t%2==0;t/=2);for(;t%5==0;t/=5);if(1===t)return 0;for(var r=10%t,n=1;1!==r;n++)if(r=10*r%t,n>2e3)return 0;return n}(0,n),a=function(e,t,r){for(var n=1,i=function(e,t,r){for(var n=1;t>0;e=e*e%r,t>>=1)1&t&&(n=n*e%r);return n}(10,r,t),a=0;a<300;a++){if(n===i)return a;n=10*n%t,i=10*i%t}return 0}(0,n,i),o=-1===this.s?"-":"";if(o+=r/n|0,r%=n,(r*=10)&&(o+="."),i){for(var s=a;s--;)o+=r/n|0,r%=n,r*=10;o+="(";for(s=i;s--;)o+=r/n|0,r%=n,r*=10;o+=")"}else for(s=e;r&&s--;)o+=r/n|0,r%=n,r*=10;return o}},void 0===(n=function(){return p}.apply(t,[]))||(e.exports=n)}()},function(e,t){e.exports=function e(t,r){"use strict";var n,i,a=/(^([+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/gi,o=/(^[ ]*|[ ]*$)/g,s=/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,u=/^0x[0-9a-f]+$/i,c=/^0/,f=function(t){return e.insensitive&&(""+t).toLowerCase()||""+t},l=f(t).replace(o,"")||"",p=f(r).replace(o,"")||"",m=l.replace(a,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),h=p.replace(a,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),d=parseInt(l.match(u),16)||1!==m.length&&l.match(s)&&Date.parse(l),y=parseInt(p.match(u),16)||d&&p.match(s)&&Date.parse(p)||null;if(y){if(dy)return 1}for(var g=0,v=Math.max(m.length,h.length);gi)return 1}return 0}},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t){(function(t){e.exports=t}).call(this,{})},function(e,t,r){var n;!function(i){"use strict";var a,o,s,u=9e15,c="0123456789abcdef",f="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",l="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",p={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-u,maxE:u,crypto:!1},m=!0,h="[DecimalError] Invalid argument: ",d=Math.floor,y=Math.pow,g=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,v=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,x=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,b=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,w=1e7,N=f.length-1,M=l.length-1,S={name:"[object Decimal]"};function E(e){var t,r,n,i=e.length-1,a="",o=e[0];if(i>0){for(a+=o,t=1;tr)throw Error(h+e)}function O(e,t,r,n){var i,a,o,s;for(a=e[0];a>=10;a/=10)--t;return--t<0?(t+=7,i=0):(i=Math.ceil((t+1)/7),t%=7),a=y(10,7-t),s=e[i]%a|0,null==n?t<3?(0==t?s=s/100|0:1==t&&(s=s/10|0),o=r<4&&99999==s||r>3&&49999==s||5e4==s||0==s):o=(r<4&&s+1==a||r>3&&s+1==a/2)&&(e[i+1]/a/100|0)==y(10,t-2)-1||(s==a/2||0==s)&&0==(e[i+1]/a/100|0):t<4?(0==t?s=s/1e3|0:1==t?s=s/100|0:2==t&&(s=s/10|0),o=(n||r<4)&&9999==s||!n&&r>3&&4999==s):o=((n||r<4)&&s+1==a||!n&&r>3&&s+1==a/2)&&(e[i+1]/a/1e3|0)==y(10,t-3)-1,o}function C(e,t,r){for(var n,i,a=[0],o=0,s=e.length;or-1&&(void 0===a[n+1]&&(a[n+1]=0),a[n+1]+=a[n]/r|0,a[n]%=r)}return a.reverse()}S.absoluteValue=S.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),T(e)},S.ceil=function(){return T(new this.constructor(this),this.e+1,2)},S.comparedTo=S.cmp=function(e){var t,r,n,i,a=this,o=a.d,s=(e=new a.constructor(e)).d,u=a.s,c=e.s;if(!o||!s)return u&&c?u!==c?u:o===s?0:!o^u<0?1:-1:NaN;if(!o[0]||!s[0])return o[0]?u:s[0]?-c:0;if(u!==c)return u;if(a.e!==e.e)return a.e>e.e^u<0?1:-1;for(t=0,r=(n=o.length)<(i=s.length)?n:i;ts[t]^u<0?1:-1;return n===i?0:n>i^u<0?1:-1},S.cosine=S.cos=function(){var e,t,r=this,n=r.constructor;return r.d?r.d[0]?(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+7,n.rounding=1,r=function(e,t){var r,n,i=t.d.length;i<32?(r=Math.ceil(i/3),n=(1/V(4,r)).toString()):(r=16,n="2.3283064365386962890625e-10");e.precision+=r,t=G(e,1,t.times(n),new e(1));for(var a=r;a--;){var o=t.times(t);t=o.times(o).minus(o).times(8).plus(1)}return e.precision-=r,t}(n,Z(n,r)),n.precision=e,n.rounding=t,T(2==s||3==s?r.neg():r,e,t,!0)):new n(1):new n(NaN)},S.cubeRoot=S.cbrt=function(){var e,t,r,n,i,a,o,s,u,c,f=this,l=f.constructor;if(!f.isFinite()||f.isZero())return new l(f);for(m=!1,(a=f.s*y(f.s*f,1/3))&&Math.abs(a)!=1/0?n=new l(a.toString()):(r=E(f.d),(a=((e=f.e)-r.length+1)%3)&&(r+=1==a||-2==a?"0":"00"),a=y(r,1/3),e=d((e+1)/3)-(e%3==(e<0?-1:2)),(n=new l(r=a==1/0?"5e"+e:(r=a.toExponential()).slice(0,r.indexOf("e")+1)+e)).s=f.s),o=(e=l.precision)+3;;)if(c=(u=(s=n).times(s).times(s)).plus(f),n=_(c.plus(f).times(s),c.plus(u),o+2,1),E(s.d).slice(0,o)===(r=E(n.d)).slice(0,o)){if("9999"!=(r=r.slice(o-3,o+1))&&(i||"4999"!=r)){+r&&(+r.slice(1)||"5"!=r.charAt(0))||(T(n,e+1,1),t=!n.times(n).times(n).eq(f));break}if(!i&&(T(s,e+1,0),s.times(s).times(s).eq(f))){n=s;break}o+=4,i=1}return m=!0,T(n,e,l.rounding,t)},S.decimalPlaces=S.dp=function(){var e,t=this.d,r=NaN;if(t){if(r=7*((e=t.length-1)-d(this.e/7)),e=t[e])for(;e%10==0;e/=10)r--;r<0&&(r=0)}return r},S.dividedBy=S.div=function(e){return _(this,new this.constructor(e))},S.dividedToIntegerBy=S.divToInt=function(e){var t=this.constructor;return T(_(this,new t(e),0,1,1),t.precision,t.rounding)},S.equals=S.eq=function(e){return 0===this.cmp(e)},S.floor=function(){return T(new this.constructor(this),this.e+1,3)},S.greaterThan=S.gt=function(e){return this.cmp(e)>0},S.greaterThanOrEqualTo=S.gte=function(e){var t=this.cmp(e);return 1==t||0===t},S.hyperbolicCosine=S.cosh=function(){var e,t,r,n,i,a=this,o=a.constructor,s=new o(1);if(!a.isFinite())return new o(a.s?1/0:NaN);if(a.isZero())return s;r=o.precision,n=o.rounding,o.precision=r+Math.max(a.e,a.sd())+4,o.rounding=1,(i=a.d.length)<32?t=(1/V(4,e=Math.ceil(i/3))).toString():(e=16,t="2.3283064365386962890625e-10"),a=G(o,1,a.times(t),new o(1),!0);for(var u,c=e,f=new o(8);c--;)u=a.times(a),a=s.minus(u.times(f.minus(u.times(f))));return T(a,o.precision=r,o.rounding=n,!0)},S.hyperbolicSine=S.sinh=function(){var e,t,r,n,i=this,a=i.constructor;if(!i.isFinite()||i.isZero())return new a(i);if(t=a.precision,r=a.rounding,a.precision=t+Math.max(i.e,i.sd())+4,a.rounding=1,(n=i.d.length)<3)i=G(a,2,i,i,!0);else{e=(e=1.4*Math.sqrt(n))>16?16:0|e,i=G(a,2,i=i.times(1/V(5,e)),i,!0);for(var o,s=new a(5),u=new a(16),c=new a(20);e--;)o=i.times(i),i=i.times(s.plus(o.times(u.times(o).plus(c))))}return a.precision=t,a.rounding=r,T(i,t,r,!0)},S.hyperbolicTangent=S.tanh=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+7,n.rounding=1,_(r.sinh(),r.cosh(),n.precision=e,n.rounding=t)):new n(r.s)},S.inverseCosine=S.acos=function(){var e,t=this,r=t.constructor,n=t.abs().cmp(1),i=r.precision,a=r.rounding;return-1!==n?0===n?t.isNeg()?B(r,i,a):new r(0):new r(NaN):t.isZero()?B(r,i+4,a).times(.5):(r.precision=i+6,r.rounding=1,t=t.asin(),e=B(r,i+4,a).times(.5),r.precision=i,r.rounding=a,e.minus(t))},S.inverseHyperbolicCosine=S.acosh=function(){var e,t,r=this,n=r.constructor;return r.lte(1)?new n(r.eq(1)?0:NaN):r.isFinite()?(e=n.precision,t=n.rounding,n.precision=e+Math.max(Math.abs(r.e),r.sd())+4,n.rounding=1,m=!1,r=r.times(r).minus(1).sqrt().plus(r),m=!0,n.precision=e,n.rounding=t,r.ln()):new n(r)},S.inverseHyperbolicSine=S.asinh=function(){var e,t,r=this,n=r.constructor;return!r.isFinite()||r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+2*Math.max(Math.abs(r.e),r.sd())+6,n.rounding=1,m=!1,r=r.times(r).plus(1).sqrt().plus(r),m=!0,n.precision=e,n.rounding=t,r.ln())},S.inverseHyperbolicTangent=S.atanh=function(){var e,t,r,n,i=this,a=i.constructor;return i.isFinite()?i.e>=0?new a(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=a.precision,t=a.rounding,n=i.sd(),Math.max(n,e)<2*-i.e-1?T(new a(i),e,t,!0):(a.precision=r=n-i.e,i=_(i.plus(1),new a(1).minus(i),r+e,1),a.precision=e+4,a.rounding=1,i=i.ln(),a.precision=e,a.rounding=t,i.times(.5))):new a(NaN)},S.inverseSine=S.asin=function(){var e,t,r,n,i=this,a=i.constructor;return i.isZero()?new a(i):(t=i.abs().cmp(1),r=a.precision,n=a.rounding,-1!==t?0===t?((e=B(a,r+4,n).times(.5)).s=i.s,e):new a(NaN):(a.precision=r+6,a.rounding=1,i=i.div(new a(1).minus(i.times(i)).sqrt().plus(1)).atan(),a.precision=r,a.rounding=n,i.times(2)))},S.inverseTangent=S.atan=function(){var e,t,r,n,i,a,o,s,u,c=this,f=c.constructor,l=f.precision,p=f.rounding;if(c.isFinite()){if(c.isZero())return new f(c);if(c.abs().eq(1)&&l+4<=M)return(o=B(f,l+4,p).times(.25)).s=c.s,o}else{if(!c.s)return new f(NaN);if(l+4<=M)return(o=B(f,l+4,p).times(.5)).s=c.s,o}for(f.precision=s=l+10,f.rounding=1,e=r=Math.min(28,s/7+2|0);e;--e)c=c.div(c.times(c).plus(1).sqrt().plus(1));for(m=!1,t=Math.ceil(s/7),n=1,u=c.times(c),o=new f(c),i=c;-1!==e;)if(i=i.times(u),a=o.minus(i.div(n+=2)),i=i.times(u),void 0!==(o=a.plus(i.div(n+=2))).d[t])for(e=t;o.d[e]===a.d[e]&&e--;);return r&&(o=o.times(2<this.d.length-2},S.isNaN=function(){return!this.s},S.isNegative=S.isNeg=function(){return this.s<0},S.isPositive=S.isPos=function(){return this.s>0},S.isZero=function(){return!!this.d&&0===this.d[0]},S.lessThan=S.lt=function(e){return this.cmp(e)<0},S.lessThanOrEqualTo=S.lte=function(e){return this.cmp(e)<1},S.logarithm=S.log=function(e){var t,r,n,i,a,o,s,u,c=this.constructor,f=c.precision,l=c.rounding;if(null==e)e=new c(10),t=!0;else{if(r=(e=new c(e)).d,e.s<0||!r||!r[0]||e.eq(1))return new c(NaN);t=e.eq(10)}if(r=this.d,this.s<0||!r||!r[0]||this.eq(1))return new c(r&&!r[0]?-1/0:1!=this.s?NaN:r?0:1/0);if(t)if(r.length>1)a=!0;else{for(i=r[0];i%10==0;)i/=10;a=1!==i}if(m=!1,o=F(this,s=f+5),n=t?I(c,s+10):F(e,s),O((u=_(o,n,s,1)).d,i=f,l))do{if(o=F(this,s+=10),n=t?I(c,s+10):F(e,s),u=_(o,n,s,1),!a){+E(u.d).slice(i+1,i+15)+1==1e14&&(u=T(u,f+1,0));break}}while(O(u.d,i+=10,l));return m=!0,T(u,f,l)},S.minus=S.sub=function(e){var t,r,n,i,a,o,s,u,c,f,l,p,h=this,y=h.constructor;if(e=new y(e),!h.d||!e.d)return h.s&&e.s?h.d?e.s=-e.s:e=new y(e.d||h.s!==e.s?h:NaN):e=new y(NaN),e;if(h.s!=e.s)return e.s=-e.s,h.plus(e);if(c=h.d,p=e.d,s=y.precision,u=y.rounding,!c[0]||!p[0]){if(p[0])e.s=-e.s;else{if(!c[0])return new y(3===u?-0:0);e=new y(h)}return m?T(e,s,u):e}if(r=d(e.e/7),f=d(h.e/7),c=c.slice(),a=f-r){for((l=a<0)?(t=c,a=-a,o=p.length):(t=p,r=f,o=c.length),a>(n=Math.max(Math.ceil(s/7),o)+2)&&(a=n,t.length=1),t.reverse(),n=a;n--;)t.push(0);t.reverse()}else{for((l=(n=c.length)<(o=p.length))&&(o=n),n=0;n0;--n)c[o++]=0;for(n=p.length;n>a;){if(c[--n](o=(a=Math.ceil(s/7))>o?a+1:o+1)&&(i=o,r.length=1),r.reverse();i--;)r.push(0);r.reverse()}for((o=c.length)-(i=f.length)<0&&(i=o,r=f,f=c,c=r),t=0;i;)t=(c[--i]=c[i]+f[i]+t)/w|0,c[i]%=w;for(t&&(c.unshift(t),++n),o=c.length;0==c[--o];)c.pop();return e.d=c,e.e=z(c,n),m?T(e,s,u):e},S.precision=S.sd=function(e){var t,r=this;if(void 0!==e&&e!==!!e&&1!==e&&0!==e)throw Error(h+e);return r.d?(t=k(r.d),e&&r.e+1>t&&(t=r.e+1)):t=NaN,t},S.round=function(){var e=this,t=e.constructor;return T(new t(e),e.e+1,t.rounding)},S.sine=S.sin=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+7,n.rounding=1,r=function(e,t){var r,n=t.d.length;if(n<3)return G(e,2,t,t);r=(r=1.4*Math.sqrt(n))>16?16:0|r,t=t.times(1/V(5,r)),t=G(e,2,t,t);for(var i,a=new e(5),o=new e(16),s=new e(20);r--;)i=t.times(t),t=t.times(a.plus(i.times(o.times(i).minus(s))));return t}(n,Z(n,r)),n.precision=e,n.rounding=t,T(s>2?r.neg():r,e,t,!0)):new n(NaN)},S.squareRoot=S.sqrt=function(){var e,t,r,n,i,a,o=this,s=o.d,u=o.e,c=o.s,f=o.constructor;if(1!==c||!s||!s[0])return new f(!c||c<0&&(!s||s[0])?NaN:s?o:1/0);for(m=!1,0==(c=Math.sqrt(+o))||c==1/0?(((t=E(s)).length+u)%2==0&&(t+="0"),c=Math.sqrt(t),u=d((u+1)/2)-(u<0||u%2),n=new f(t=c==1/0?"5e"+u:(t=c.toExponential()).slice(0,t.indexOf("e")+1)+u)):n=new f(c.toString()),r=(u=f.precision)+3;;)if(n=(a=n).plus(_(o,a,r+2,1)).times(.5),E(a.d).slice(0,r)===(t=E(n.d)).slice(0,r)){if("9999"!=(t=t.slice(r-3,r+1))&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(T(n,u+1,1),e=!n.times(n).eq(o));break}if(!i&&(T(a,u+1,0),a.times(a).eq(o))){n=a;break}r+=4,i=1}return m=!0,T(n,u,f.rounding,e)},S.tangent=S.tan=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+10,n.rounding=1,(r=r.sin()).s=1,r=_(r,new n(1).minus(r.times(r)).sqrt(),e+10,0),n.precision=e,n.rounding=t,T(2==s||4==s?r.neg():r,e,t,!0)):new n(NaN)},S.times=S.mul=function(e){var t,r,n,i,a,o,s,u,c,f=this,l=f.constructor,p=f.d,h=(e=new l(e)).d;if(e.s*=f.s,!(p&&p[0]&&h&&h[0]))return new l(!e.s||p&&!p[0]&&!h||h&&!h[0]&&!p?NaN:p&&h?0*e.s:e.s/0);for(r=d(f.e/7)+d(e.e/7),(u=p.length)<(c=h.length)&&(a=p,p=h,h=a,o=u,u=c,c=o),a=[],n=o=u+c;n--;)a.push(0);for(n=c;--n>=0;){for(t=0,i=u+n;i>n;)s=a[i]+h[n]*p[i-n-1]+t,a[i--]=s%w|0,t=s/w|0;a[i]=(a[i]+t)%w|0}for(;!a[--o];)a.pop();return t?++r:a.shift(),e.d=a,e.e=z(a,r),m?T(e,l.precision,l.rounding):e},S.toBinary=function(e,t){return W(this,2,e,t)},S.toDecimalPlaces=S.toDP=function(e,t){var r=this,n=r.constructor;return r=new n(r),void 0===e?r:(A(e,0,1e9),void 0===t?t=n.rounding:A(t,0,8),T(r,e+r.e+1,t))},S.toExponential=function(e,t){var r,n=this,i=n.constructor;return void 0===e?r=q(n,!0):(A(e,0,1e9),void 0===t?t=i.rounding:A(t,0,8),r=q(n=T(new i(n),e+1,t),!0,e+1)),n.isNeg()&&!n.isZero()?"-"+r:r},S.toFixed=function(e,t){var r,n,i=this,a=i.constructor;return void 0===e?r=q(i):(A(e,0,1e9),void 0===t?t=a.rounding:A(t,0,8),r=q(n=T(new a(i),e+i.e+1,t),!1,e+n.e+1)),i.isNeg()&&!i.isZero()?"-"+r:r},S.toFraction=function(e){var t,r,n,i,a,o,s,u,c,f,l,p,d=this,g=d.d,v=d.constructor;if(!g)return new v(d);if(c=r=new v(1),n=u=new v(0),o=(a=(t=new v(n)).e=k(g)-d.e-1)%7,t.d[0]=y(10,o<0?7+o:o),null==e)e=a>0?t:c;else{if(!(s=new v(e)).isInt()||s.lt(c))throw Error(h+s);e=s.gt(t)?a>0?t:c:s}for(m=!1,s=new v(E(g)),f=v.precision,v.precision=a=7*g.length*2;l=_(s,t,0,1,1),1!=(i=r.plus(l.times(n))).cmp(e);)r=n,n=i,i=c,c=u.plus(l.times(i)),u=i,i=t,t=s.minus(l.times(i)),s=i;return i=_(e.minus(r),n,0,1,1),u=u.plus(i.times(c)),r=r.plus(i.times(n)),u.s=c.s=d.s,p=_(c,n,a,1).minus(d).abs().cmp(_(u,r,a,1).minus(d).abs())<1?[c,n]:[u,r],v.precision=f,m=!0,p},S.toHexadecimal=S.toHex=function(e,t){return W(this,16,e,t)},S.toNearest=function(e,t){var r=this,n=r.constructor;if(r=new n(r),null==e){if(!r.d)return r;e=new n(1),t=n.rounding}else{if(e=new n(e),void 0===t?t=n.rounding:A(t,0,8),!r.d)return e.s?r:e;if(!e.d)return e.s&&(e.s=r.s),e}return e.d[0]?(m=!1,r=_(r,e,0,t,1).times(e),m=!0,T(r)):(e.s=r.s,r=e),r},S.toNumber=function(){return+this},S.toOctal=function(e,t){return W(this,8,e,t)},S.toPower=S.pow=function(e){var t,r,n,i,a,o,s=this,u=s.constructor,c=+(e=new u(e));if(!(s.d&&e.d&&s.d[0]&&e.d[0]))return new u(y(+s,c));if((s=new u(s)).eq(1))return s;if(n=u.precision,a=u.rounding,e.eq(1))return T(s,n,a);if((t=d(e.e/7))>=e.d.length-1&&(r=c<0?-c:c)<=9007199254740991)return i=R(u,s,r,n),e.s<0?new u(1).div(i):T(i,n,a);if((o=s.s)<0){if(tu.maxE+1||t0?o/0:0):(m=!1,u.rounding=s.s=1,r=Math.min(12,(t+"").length),(i=U(e.times(F(s,n+r)),n)).d&&O((i=T(i,n+5,1)).d,n,a)&&(t=n+10,+E((i=T(U(e.times(F(s,t+r)),t),t+5,1)).d).slice(n+1,n+15)+1==1e14&&(i=T(i,n+1,0))),i.s=o,m=!0,u.rounding=a,T(i,n,a))},S.toPrecision=function(e,t){var r,n=this,i=n.constructor;return void 0===e?r=q(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(A(e,1,1e9),void 0===t?t=i.rounding:A(t,0,8),r=q(n=T(new i(n),e,t),e<=n.e||n.e<=i.toExpNeg,e)),n.isNeg()&&!n.isZero()?"-"+r:r},S.toSignificantDigits=S.toSD=function(e,t){var r=this.constructor;return void 0===e?(e=r.precision,t=r.rounding):(A(e,1,1e9),void 0===t?t=r.rounding:A(t,0,8)),T(new r(this),e,t)},S.toString=function(){var e=this,t=e.constructor,r=q(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?"-"+r:r},S.truncated=S.trunc=function(){return T(new this.constructor(this),this.e+1,1)},S.valueOf=S.toJSON=function(){var e=this,t=e.constructor,r=q(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?"-"+r:r};var _=function(){function e(e,t,r){var n,i=0,a=e.length;for(e=e.slice();a--;)n=e[a]*t+i,e[a]=n%r|0,i=n/r|0;return i&&e.unshift(i),e}function t(e,t,r,n){var i,a;if(r!=n)a=r>n?1:-1;else for(i=a=0;it[i]?1:-1;break}return a}function r(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=e[r]1;)e.shift()}return function(n,i,a,s,u,c){var f,l,p,m,h,y,g,v,x,b,N,M,S,E,A,O,C,_,q,z,I=n.constructor,B=n.s==i.s?1:-1,k=n.d,D=i.d;if(!(k&&k[0]&&D&&D[0]))return new I(n.s&&i.s&&(k?!D||k[0]!=D[0]:D)?k&&0==k[0]||!D?0*B:B/0:NaN);for(c?(h=1,l=n.e-i.e):(c=w,h=7,l=d(n.e/h)-d(i.e/h)),q=D.length,C=k.length,b=(x=new I(B)).d=[],p=0;D[p]==(k[p]||0);p++);if(D[p]>(k[p]||0)&&l--,null==a?(E=a=I.precision,s=I.rounding):E=u?a+(n.e-i.e)+1:a,E<0)b.push(1),y=!0;else{if(E=E/h+2|0,p=0,1==q){for(m=0,D=D[0],E++;(p1&&(D=e(D,m,c),k=e(k,m,c),q=D.length,C=k.length),O=q,M=(N=k.slice(0,q)).length;M=c/2&&++_;do{m=0,(f=t(D,N,q,M))<0?(S=N[0],q!=M&&(S=S*c+(N[1]||0)),(m=S/_|0)>1?(m>=c&&(m=c-1),1==(f=t(g=e(D,m,c),N,v=g.length,M=N.length))&&(m--,r(g,q=10;m/=10)p++;x.e=p+l*h-1,T(x,u?a+x.e+1:a,s,y)}return x}}();function T(e,t,r,n){var i,a,o,s,u,c,f,l,p,h=e.constructor;e:if(null!=t){if(!(l=e.d))return e;for(i=1,s=l[0];s>=10;s/=10)i++;if((a=t-i)<0)a+=7,o=t,u=(f=l[p=0])/y(10,i-o-1)%10|0;else if((p=Math.ceil((a+1)/7))>=(s=l.length)){if(!n)break e;for(;s++<=p;)l.push(0);f=u=0,i=1,o=(a%=7)-7+1}else{for(f=s=l[p],i=1;s>=10;s/=10)i++;u=(o=(a%=7)-7+i)<0?0:f/y(10,i-o-1)%10|0}if(n=n||t<0||void 0!==l[p+1]||(o<0?f:f%y(10,i-o-1)),c=r<4?(u||n)&&(0==r||r==(e.s<0?3:2)):u>5||5==u&&(4==r||n||6==r&&(a>0?o>0?f/y(10,i-o):0:l[p-1])%10&1||r==(e.s<0?8:7)),t<1||!l[0])return l.length=0,c?(t-=e.e+1,l[0]=y(10,(7-t%7)%7),e.e=-t||0):l[0]=e.e=0,e;if(0==a?(l.length=p,s=1,p--):(l.length=p+1,s=y(10,7-a),l[p]=o>0?(f/y(10,i-o)%y(10,o)|0)*s:0),c)for(;;){if(0==p){for(a=1,o=l[0];o>=10;o/=10)a++;for(o=l[0]+=s,s=1;o>=10;o/=10)s++;a!=s&&(e.e++,l[0]==w&&(l[0]=1));break}if(l[p]+=s,l[p]!=w)break;l[p--]=0,s=1}for(a=l.length;0===l[--a];)l.pop()}return m&&(e.e>h.maxE?(e.d=null,e.e=NaN):e.e0?a=a.charAt(0)+"."+a.slice(1)+D(n):o>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(e.e<0?"e":"e+")+e.e):i<0?(a="0."+D(-i-1)+a,r&&(n=r-o)>0&&(a+=D(n))):i>=o?(a+=D(i+1-o),r&&(n=r-i-1)>0&&(a=a+"."+D(n))):((n=i+1)0&&(i+1===o&&(a+="."),a+=D(n))),a}function z(e,t){var r=e[0];for(t*=7;r>=10;r/=10)t++;return t}function I(e,t,r){if(t>N)throw m=!0,r&&(e.precision=r),Error("[DecimalError] Precision limit exceeded");return T(new e(f),t,1,!0)}function B(e,t,r){if(t>M)throw Error("[DecimalError] Precision limit exceeded");return T(new e(l),t,r,!0)}function k(e){var t=e.length-1,r=7*t+1;if(t=e[t]){for(;t%10==0;t/=10)r--;for(t=e[0];t>=10;t/=10)r++}return r}function D(e){for(var t="";e--;)t+="0";return t}function R(e,t,r,n){var i,a=new e(1),o=Math.ceil(n/7+4);for(m=!1;;){if(r%2&&J((a=a.times(t)).d,o)&&(i=!0),0===(r=d(r/2))){r=a.d.length-1,i&&0===a.d[r]&&++a.d[r];break}J((t=t.times(t)).d,o)}return m=!0,a}function j(e){return 1&e.d[e.d.length-1]}function P(e,t,r){for(var n,i=new e(t[0]),a=0;++a17)return new p(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:NaN);for(null==t?(m=!1,u=d):u=t,s=new p(.03125);e.e>-2;)e=e.times(s),l+=5;for(u+=n=Math.log(y(2,l))/Math.LN10*2+5|0,r=a=o=new p(1),p.precision=u;;){if(a=T(a.times(e),u,1),r=r.times(++f),E((s=o.plus(_(a,r,u,1))).d).slice(0,u)===E(o.d).slice(0,u)){for(i=l;i--;)o=T(o.times(o),u,1);if(null!=t)return p.precision=d,o;if(!(c<3&&O(o.d,u-n,h,c)))return T(o,p.precision=d,h,m=!0);p.precision=u+=10,r=a=s=new p(1),f=0,c++}o=s}}function F(e,t){var r,n,i,a,o,s,u,c,f,l,p,h=1,d=e,y=d.d,g=d.constructor,v=g.rounding,x=g.precision;if(d.s<0||!y||!y[0]||!d.e&&1==y[0]&&1==y.length)return new g(y&&!y[0]?-1/0:1!=d.s?NaN:y?0:d);if(null==t?(m=!1,f=x):f=t,g.precision=f+=10,n=(r=E(y)).charAt(0),!(Math.abs(a=d.e)<15e14))return c=I(g,f+2,x).times(a+""),d=F(new g(n+"."+r.slice(1)),f-10).plus(c),g.precision=x,null==t?T(d,x,v,m=!0):d;for(;n<7&&1!=n||1==n&&r.charAt(1)>3;)n=(r=E((d=d.times(e)).d)).charAt(0),h++;for(a=d.e,n>1?(d=new g("0."+r),a++):d=new g(n+"."+r.slice(1)),l=d,u=o=d=_(d.minus(1),d.plus(1),f,1),p=T(d.times(d),f,1),i=3;;){if(o=T(o.times(p),f,1),E((c=u.plus(_(o,new g(i),f,1))).d).slice(0,f)===E(u.d).slice(0,f)){if(u=u.times(2),0!==a&&(u=u.plus(I(g,f+2,x).times(a+""))),u=_(u,new g(h),f,1),null!=t)return g.precision=x,u;if(!O(u.d,f-10,v,s))return T(u,g.precision=x,v,m=!0);g.precision=f+=10,c=o=d=_(l.minus(1),l.plus(1),f,1),p=T(d.times(d),f,1),i=s=1}u=c,i+=2}}function L(e){return String(e.s*e.s/0)}function H(e,t){var r,n,i;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),n=0;48===t.charCodeAt(n);n++);for(i=t.length;48===t.charCodeAt(i-1);--i);if(t=t.slice(n,i)){if(i-=n,e.e=r=r-n-1,e.d=[],n=(r+1)%7,r<0&&(n+=7),ne.constructor.maxE?(e.d=null,e.e=NaN):e.e0?(c=+t.slice(o+1),t=t.substring(2,o)):t=t.slice(2),s=(o=t.indexOf("."))>=0,n=e.constructor,s&&(o=(u=(t=t.replace(".","")).length)-o,i=R(n,new n(r),o,2*o)),o=l=(f=C(t,r,w)).length-1;0===f[o];--o)f.pop();return o<0?new n(0*e.s):(e.e=z(f,l),e.d=f,m=!1,s&&(e=_(e,i,4*u)),c&&(e=e.times(Math.abs(c)<54?y(2,c):a.pow(2,c))),m=!0,e)}function G(e,t,r,n,i){var a,o,s,u,c=e.precision,f=Math.ceil(c/7);for(m=!1,u=r.times(r),s=new e(n);;){if(o=_(s.times(u),new e(t++*t++),c,1),s=i?n.plus(o):n.minus(o),n=_(o.times(u),new e(t++*t++),c,1),void 0!==(o=s.plus(n)).d[f]){for(a=f;o.d[a]===s.d[a]&&a--;);if(-1==a)break}a=s,s=n,n=o,o=a}return m=!0,o.d.length=f+1,o}function V(e,t){for(var r=e;--t;)r*=e;return r}function Z(e,t){var r,n=t.s<0,i=B(e,e.precision,1),a=i.times(.5);if((t=t.abs()).lte(a))return s=n?4:1,t;if((r=t.divToInt(i)).isZero())s=n?3:2;else{if((t=t.minus(r.times(i))).lte(a))return s=j(r)?n?2:3:n?4:1,t;s=j(r)?n?1:4:n?3:2}return t.minus(i).abs()}function W(e,t,r,n){var i,a,s,u,f,l,p,m,h,d=e.constructor,y=void 0!==r;if(y?(A(r,1,1e9),void 0===n?n=d.rounding:A(n,0,8)):(r=d.precision,n=d.rounding),e.isFinite()){for(y?(i=2,16==t?r=4*r-3:8==t&&(r=3*r-2)):i=t,(s=(p=q(e)).indexOf("."))>=0&&(p=p.replace(".",""),(h=new d(1)).e=p.length-s,h.d=C(q(h),10,i),h.e=h.d.length),a=f=(m=C(p,10,i)).length;0==m[--f];)m.pop();if(m[0]){if(s<0?a--:((e=new d(e)).d=m,e.e=a,m=(e=_(e,h,r,n,0,i)).d,a=e.e,l=o),s=m[r],u=i/2,l=l||void 0!==m[r+1],l=n<4?(void 0!==s||l)&&(0===n||n===(e.s<0?3:2)):s>u||s===u&&(4===n||l||6===n&&1&m[r-1]||n===(e.s<0?8:7)),m.length=r,l)for(;++m[--r]>i-1;)m[r]=0,r||(++a,m.unshift(1));for(f=m.length;!m[f-1];--f);for(s=0,p="";s1)if(16==t||8==t){for(s=16==t?4:3,--f;f%s;f++)p+="0";for(f=(m=C(p,i,t)).length;!m[f-1];--f);for(s=1,p="1.";sf)for(a-=f;a--;)p+="0";else at)return e.length=t,!0}function Y(e){return new this(e).abs()}function X(e){return new this(e).acos()}function Q(e){return new this(e).acosh()}function K(e,t){return new this(e).plus(t)}function ee(e){return new this(e).asin()}function te(e){return new this(e).asinh()}function re(e){return new this(e).atan()}function ne(e){return new this(e).atanh()}function ie(e,t){e=new this(e),t=new this(t);var r,n=this.precision,i=this.rounding,a=n+4;return e.s&&t.s?e.d||t.d?!t.d||e.isZero()?(r=t.s<0?B(this,n,i):new this(0)).s=e.s:!e.d||t.isZero()?(r=B(this,a,1).times(.5)).s=e.s:t.s<0?(this.precision=a,this.rounding=1,r=this.atan(_(e,t,a,1)),t=B(this,a,1),this.precision=n,this.rounding=i,r=e.s<0?r.minus(t):r.plus(t)):r=this.atan(_(e,t,a,1)):(r=B(this,a,1).times(t.s>0?.25:.75)).s=e.s:r=new this(NaN),r}function ae(e){return new this(e).cbrt()}function oe(e){return T(e=new this(e),e.e+1,2)}function se(e){if(!e||"object"!=typeof e)throw Error("[DecimalError] Object expected");var t,r,n,i=!0===e.defaults,a=["precision",1,1e9,"rounding",0,8,"toExpNeg",-u,0,"toExpPos",0,u,"maxE",0,u,"minE",-u,0,"modulo",0,9];for(t=0;t=a[t+1]&&n<=a[t+2]))throw Error(h+r+": "+n);this[r]=n}if(r="crypto",i&&(this[r]=p[r]),void 0!==(n=e[r])){if(!0!==n&&!1!==n&&0!==n&&1!==n)throw Error(h+r+": "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw Error("[DecimalError] crypto unavailable");this[r]=!0}else this[r]=!1}return this}function ue(e){return new this(e).cos()}function ce(e){return new this(e).cosh()}function fe(e,t){return new this(e).div(t)}function le(e){return new this(e).exp()}function pe(e){return T(e=new this(e),e.e+1,3)}function me(){var e,t,r=new this(0);for(m=!1,e=0;e=429e7?t[a]=crypto.getRandomValues(new Uint32Array(1))[0]:s[a++]=i%1e7;else{if(!crypto.randomBytes)throw Error("[DecimalError] crypto unavailable");for(t=crypto.randomBytes(n*=4);a=214e7?crypto.randomBytes(4).copy(t,a):(s.push(i%1e7),a+=4);a=n/4}else for(;a=10;i/=10)n++;n<7&&(r-=7-n)}return o.e=r,o.d=s,o}function Ee(e){return T(e=new this(e),e.e+1,this.rounding)}function Ae(e){return(e=new this(e)).d?e.d[0]?e.s:0*e.s:e.s||NaN}function Oe(e){return new this(e).sin()}function Ce(e){return new this(e).sinh()}function _e(e){return new this(e).sqrt()}function Te(e,t){return new this(e).sub(t)}function qe(e){return new this(e).tan()}function ze(e){return new this(e).tanh()}function Ie(e){return T(e=new this(e),e.e+1,1)}(a=function e(t){var r,n,i;function a(e){var t,r,n,i=this;if(!(i instanceof a))return new a(e);if(i.constructor=a,e instanceof a)return i.s=e.s,void(m?!e.d||e.e>a.maxE?(i.e=NaN,i.d=null):e.e=10;r/=10)t++;return void(m?t>a.maxE?(i.e=NaN,i.d=null):t3?e.slice(3):"any":e).split("|").map(z).filter(I).filter(q),i=function(e,t){var r={};return e.forEach((function(e){-1!==t.indexOf(e.from)||-1===t.indexOf(e.to)||r[e.from]||(r[e.from]=e)})),Object.keys(r).map((function(e){return r[e]}))}(t,n),a=n.map((function(e){var t=c(e);return{name:e,typeIndex:f(t),test:t.test,conversion:null,conversionIndex:-1}})),o=i.map((function(e){var r=c(e.from);return{name:e.from,typeIndex:f(r),test:r.test,conversion:e,conversionIndex:t.indexOf(e)}}));return{types:a.concat(o),restParam:r}}function h(e){var t=D(e);return!!t&&t.restParam}function d(e){return e.types.some((function(e){return null!=e.conversion}))}function y(t){if(t&&0!==t.types.length){if(1===t.types.length)return c(t.types[0].name).test;if(2===t.types.length){var r=c(t.types[0].name).test,n=c(t.types[1].name).test;return function(e){return r(e)||n(e)}}var i=t.types.map((function(e){return c(e.name).test}));return function(e){for(var t=0;t=a+1}}return 0===e.length?function(e){return 0===e.length}:1===e.length?(r=y(e[0]),function(e){return r(e[0])&&1===e.length}):2===e.length?(r=y(e[0]),n=y(e[1]),function(e){return r(e[0])&&n(e[1])&&2===e.length}):(t=e.map(y),function(e){for(var r=0;r0){var c=l(t[a]);return(n=new TypeError("Unexpected type of argument in function "+o+" (expected: "+i.join(" or ")+", actual: "+c+", index: "+a+")")).data={category:"wrongType",fn:o,index:a,actual:c,expected:i},n}}else s=u}var f=s.map((function(e){return h(e.params)?1/0:e.params.length}));if(t.lengthp?((n=new TypeError("Too many arguments in function "+o+" (expected: "+p+", actual: "+t.length+")")).data={category:"tooManyArgs",fn:o,index:t.length,expectedLength:p},n):((n=new TypeError('Arguments of type "'+t.join(", ")+'" do not match any of the defined signatures of function '+o+".")).data={category:"mismatch",actual:t.map(l)},n)}function S(e){for(var t=999,r=0;r=i:s?i>=a:i===a}(t,e)}));if(t)throw new TypeError('Conflicting signatures "'+p(t.params)+'" and "'+p(e.params)+'".');i.push(e)}));var a=U(i,(function(e){return(e?_(e.params,!1):[]).map((function(t){return{params:t,fn:e.fn}}))})).filter(B);a.sort(O);var o=a[0]&&a[0].params.length<=2&&!h(a[0].params),s=a[1]&&a[1].params.length<=2&&!h(a[1].params),c=a[2]&&a[2].params.length<=2&&!h(a[2].params),f=a[3]&&a[3].params.length<=2&&!h(a[3].params),l=a[4]&&a[4].params.length<=2&&!h(a[4].params),v=a[5]&&a[5].params.length<=2&&!h(a[5].params),b=o&&s&&c&&f&&l&&v,w=a.map((function(e){return g(e.params)})),N=o?y(a[0].params[0]):t,S=s?y(a[1].params[0]):t,E=c?y(a[2].params[0]):t,A=f?y(a[3].params[0]):t,T=l?y(a[4].params[0]):t,q=v?y(a[5].params[0]):t,I=o?y(a[0].params[1]):t,D=s?y(a[1].params[1]):t,F=c?y(a[2].params[1]):t,L=f?y(a[3].params[1]):t,H=l?y(a[4].params[1]):t,$=v?y(a[5].params[1]):t,G=a.map((function(e){return function(e,t){var r=t;if(e.some(d)){var n=h(e),i=e.map(C);r=function(){for(var e=[],r=n?arguments.length-1:arguments.length,a=0;a1&&void 0!==arguments[1]?arguments[1]:{},r=t.preserveFormatting,s=void 0!==r&&r,u=t.escapeMapFn,c=void 0===u?o:u,f=String(e),l="",p=c(n({},i),s?n({},a):{}),m=Object.keys(p),h=function(){var e=!1;m.forEach((function(t,r){e||f.length>=t.length&&f.slice(0,t.length)===t&&(l+=p[m[r]],f=f.slice(t.length,f.length),e=!0)})),e||(l+=f.slice(0,1),f=f.slice(1,f.length))};f;)h();return l}},function(e,t,r){(function(e){var n;!function(e,i,a){function o(e){var t,r=this,n=(t=4022871197,function(e){e=String(e);for(var r=0;r>>0,t=(n*=t)>>>0,t+=4294967296*(n-=t)}return 2.3283064365386963e-10*(t>>>0)});r.next=function(){var e=2091639*r.s0+2.3283064365386963e-10*r.c;return r.s0=r.s1,r.s1=r.s2,r.s2=e-(r.c=0|e)},r.c=1,r.s0=n(" "),r.s1=n(" "),r.s2=n(" "),r.s0-=n(e),r.s0<0&&(r.s0+=1),r.s1-=n(e),r.s1<0&&(r.s1+=1),r.s2-=n(e),r.s2<0&&(r.s2+=1),n=null}function s(e,t){return t.c=e.c,t.s0=e.s0,t.s1=e.s1,t.s2=e.s2,t}function u(e,t){var r=new o(e),n=t&&t.state,i=r.next;return i.int32=function(){return 4294967296*r.next()|0},i.double=function(){return i()+11102230246251565e-32*(2097152*i()|0)},i.quick=i,n&&("object"==typeof n&&s(n,r),i.state=function(){return s(r,{})}),i}i&&i.exports?i.exports=u:r(2)&&r(6)?void 0===(n=function(){return u}.call(t,r,t,i))||(i.exports=n):this.alea=u}(0,e,r(2))}).call(this,r(5)(e))},function(e,t,r){(function(e){var n;!function(e,i,a){function o(e){var t=this,r="";t.x=0,t.y=0,t.z=0,t.w=0,t.next=function(){var e=t.x^t.x<<11;return t.x=t.y,t.y=t.z,t.z=t.w,t.w^=t.w>>>19^e^e>>>8},e===(0|e)?t.x=e:r+=e;for(var n=0;n>>0)/4294967296};return i.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},i.int32=r.next,i.quick=i,n&&("object"==typeof n&&s(n,r),i.state=function(){return s(r,{})}),i}i&&i.exports?i.exports=u:r(2)&&r(6)?void 0===(n=function(){return u}.call(t,r,t,i))||(i.exports=n):this.xor128=u}(0,e,r(2))}).call(this,r(5)(e))},function(e,t,r){(function(e){var n;!function(e,i,a){function o(e){var t=this,r="";t.next=function(){var e=t.x^t.x>>>2;return t.x=t.y,t.y=t.z,t.z=t.w,t.w=t.v,(t.d=t.d+362437|0)+(t.v=t.v^t.v<<4^e^e<<1)|0},t.x=0,t.y=0,t.z=0,t.w=0,t.v=0,e===(0|e)?t.x=e:r+=e;for(var n=0;n>>4),t.next()}function s(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t.v=e.v,t.d=e.d,t}function u(e,t){var r=new o(e),n=t&&t.state,i=function(){return(r.next()>>>0)/4294967296};return i.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},i.int32=r.next,i.quick=i,n&&("object"==typeof n&&s(n,r),i.state=function(){return s(r,{})}),i}i&&i.exports?i.exports=u:r(2)&&r(6)?void 0===(n=function(){return u}.call(t,r,t,i))||(i.exports=n):this.xorwow=u}(0,e,r(2))}).call(this,r(5)(e))},function(e,t,r){(function(e){var n;!function(e,i,a){function o(e){var t=this;t.next=function(){var e,r,n=t.x,i=t.i;return e=n[i],r=(e^=e>>>7)^e<<24,r^=(e=n[i+1&7])^e>>>10,r^=(e=n[i+3&7])^e>>>3,r^=(e=n[i+4&7])^e<<7,e=n[i+7&7],r^=(e^=e<<13)^e<<9,n[i]=r,t.i=i+1&7,r},function(e,t){var r,n=[];if(t===(0|t))n[0]=t;else for(t=""+t,r=0;r0;--r)e.next()}(t,e)}function s(e,t){return t.x=e.x.slice(),t.i=e.i,t}function u(e,t){null==e&&(e=+new Date);var r=new o(e),n=t&&t.state,i=function(){return(r.next()>>>0)/4294967296};return i.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},i.int32=r.next,i.quick=i,n&&(n.x&&s(n,r),i.state=function(){return s(r,{})}),i}i&&i.exports?i.exports=u:r(2)&&r(6)?void 0===(n=function(){return u}.call(t,r,t,i))||(i.exports=n):this.xorshift7=u}(0,e,r(2))}).call(this,r(5)(e))},function(e,t,r){(function(e){var n;!function(e,i,a){function o(e){var t=this;t.next=function(){var e,r,n=t.w,i=t.X,a=t.i;return t.w=n=n+1640531527|0,r=i[a+34&127],e=i[a=a+1&127],r^=r<<13,e^=e<<17,r^=r>>>15,e^=e>>>12,r=i[a]=r^e,t.i=a,r+(n^n>>>16)|0},function(e,t){var r,n,i,a,o,s=[],u=128;for(t===(0|t)?(n=t,t=null):(t+="\0",n=0,u=Math.max(u,t.length)),i=0,a=-32;a>>15,n^=n<<4,n^=n>>>13,a>=0&&(o=o+1640531527|0,i=0==(r=s[127&a]^=n+o)?i+1:0);for(i>=128&&(s[127&(t&&t.length||0)]=-1),i=127,a=512;a>0;--a)n=s[i+34&127],r=s[i=i+1&127],n^=n<<13,r^=r<<17,n^=n>>>15,r^=r>>>12,s[i]=n^r;e.w=o,e.X=s,e.i=i}(t,e)}function s(e,t){return t.i=e.i,t.w=e.w,t.X=e.X.slice(),t}function u(e,t){null==e&&(e=+new Date);var r=new o(e),n=t&&t.state,i=function(){return(r.next()>>>0)/4294967296};return i.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},i.int32=r.next,i.quick=i,n&&(n.X&&s(n,r),i.state=function(){return s(r,{})}),i}i&&i.exports?i.exports=u:r(2)&&r(6)?void 0===(n=function(){return u}.call(t,r,t,i))||(i.exports=n):this.xor4096=u}(0,e,r(2))}).call(this,r(5)(e))},function(e,t,r){(function(e){var n;!function(e,i,a){function o(e){var t=this,r="";t.next=function(){var e=t.b,r=t.c,n=t.d,i=t.a;return e=e<<25^e>>>7^r,r=r-n|0,n=n<<24^n>>>8^i,i=i-e|0,t.b=e=e<<20^e>>>12^r,t.c=r=r-n|0,t.d=n<<16^r>>>16^i,t.a=i-e|0},t.a=0,t.b=0,t.c=-1640531527,t.d=1367130551,e===Math.floor(e)?(t.a=e/4294967296|0,t.b=0|e):r+=e;for(var n=0;n>>0)/4294967296};return i.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},i.int32=r.next,i.quick=i,n&&("object"==typeof n&&s(n,r),i.state=function(){return s(r,{})}),i}i&&i.exports?i.exports=u:r(2)&&r(6)?void 0===(n=function(){return u}.call(t,r,t,i))||(i.exports=n):this.tychei=u}(0,e,r(2))}).call(this,r(5)(e))},function(e,t,r){var n;!function(i,a,o){var s,u=o.pow(256,6),c=o.pow(2,52),f=2*c;function l(e,t,r){var n=[],l=h(function e(t,r){var n,i=[],a=typeof t;if(r&&"object"==a)for(n in t)try{i.push(e(t[n],r-1))}catch(e){}return i.length?i:"string"==a?t:t+"\0"}((t=1==t?{entropy:!0}:t||{}).entropy?[e,d(a)]:null==e?function(){try{var e;return s&&(e=s.randomBytes)?e=e(256):(e=new Uint8Array(256),(i.crypto||i.msCrypto).getRandomValues(e)),d(e)}catch(e){var t=i.navigator,r=t&&t.plugins;return[+new Date,i,r,i.screen,d(a)]}}():e,3),n),y=new p(n),g=function(){for(var e=y.g(6),t=u,r=0;e=f;)e/=2,t/=2,r>>>=1;return(e+r)/t};return g.int32=function(){return 0|y.g(4)},g.quick=function(){return y.g(4)/4294967296},g.double=g,h(d(y.S),a),(t.pass||r||function(e,t,r,n){return n&&(n.S&&m(n,y),e.state=function(){return m(y,{})}),r?(o.random=e,t):e})(g,l,"global"in t?t.global:this==o,t.state)}function p(e){var t,r=e.length,n=this,i=0,a=n.i=n.j=0,o=n.S=[];for(r||(e=[r++]);i<256;)o[i]=i++;for(i=0;i<256;i++)o[i]=o[a=255&a+e[i%r]+(t=o[i])],o[a]=t;(n.g=function(e){for(var t,r=0,i=n.i,a=n.j,o=n.S;e--;)t=o[i=255&i+1],r=256*r+o[255&(o[i]=o[a=255&a+t])+(o[a]=t)];return n.i=i,n.j=a,r})(256)}function m(e,t){return t.i=e.i,t.j=e.j,t.S=e.S.slice(),t}function h(e,t){for(var r,n=e+"",i=0;i0?1:e<0?-1:0},W=Math.log2||function(e){return Math.log(e)/Math.LN2},J=Math.log10||function(e){return Math.log(e)/Math.LN10},Y=Math.log1p||function(e){return Math.log(e+1)},X=Math.cbrt||function(e){if(0===e)return e;var t,r=e<0;return r&&(e=-e),t=isFinite(e)?(e/((t=Math.exp(Math.log(e)/3))*t)+2*t)/3:e,r?-t:t},Q=Math.expm1||function(e){return e>=2e-4||e<=-2e-4?Math.exp(e)-1:e+e*e/2+e*e*e/6};function K(e,t,r){var n={2:"0b",8:"0o",16:"0x"}[t],i="";if(r){if(r<1)throw new Error("size must be in greater than 0");if(!V(r))throw new Error("size must be an integer");if(e>Math.pow(2,r-1)-1||e<-Math.pow(2,r-1))throw new Error("Value must be in range [-2^".concat(r-1,", 2^").concat(r-1,"-1]"));if(!V(e))throw new Error("Value must be an integer");e<0&&(e+=Math.pow(2,r)),i="i".concat(r)}var a="";return e<0&&(e=-e,a="-"),"".concat(a).concat(n).concat(e.toString(t)).concat(i)}function ee(e,t){if("function"==typeof t)return t(e);if(e===1/0)return"Infinity";if(e===-1/0)return"-Infinity";if(isNaN(e))return"NaN";var r,n,i="auto";if(t&&(t.notation&&(i=t.notation),a(t)?r=t:a(t.precision)&&(r=t.precision),t.wordSize&&"number"!=typeof(n=t.wordSize)))throw new Error('Option "wordSize" must be a number');switch(i){case"fixed":return re(e,r);case"exponential":return ne(e,r);case"engineering":return function(e,t){if(isNaN(e)||!isFinite(e))return String(e);var r=ie(te(e),t),n=r.exponent,i=r.coefficients,o=n%3==0?n:n<0?n-3-n%3:n-n%3;if(a(t))for(;t>i.length||n-o+1>i.length;)i.push(0);else for(var s=Math.abs(n-o)-(i.length-1),u=0;u0;)f++,c--;var l=i.slice(f).join(""),p=a(t)&&l.length||l.match(/[1-9]/)?"."+l:"",m=i.slice(0,f).join("")+p+"e"+(n>=0?"+":"")+o.toString();return r.sign+m}(e,r);case"bin":return K(e,2,n);case"oct":return K(e,8,n);case"hex":return K(e,16,n);case"auto":return function(e,t,r){if(isNaN(e)||!isFinite(e))return String(e);var n=r&&void 0!==r.lowerExp?r.lowerExp:-3,i=r&&void 0!==r.upperExp?r.upperExp:5,a=te(e),o=t?ie(a,t):a;if(o.exponent=i)return ne(e,t);var s=o.coefficients,u=o.exponent;s.length0?u:0;return c0?"."+i.join(""):"")+"e"+(a>=0?"+":"")+a}function ie(e,t){for(var r={sign:e.sign,coefficients:e.coefficients,exponent:e.exponent},n=r.coefficients;t<=0;)n.unshift(0),r.exponent++,t++;if(n.length>t&&n.splice(t,n.length-t)[0]>=5){var i=t-1;for(n[i]++;10===n[i];)n.pop(),0===i&&(n.unshift(0),r.exponent++,i++),n[--i]++}return r}function ae(e){for(var t=[],r=0;r=0?"+":"")+n.toString()}(e,r);case"bin":return he(e,2,n);case"oct":return he(e,8,n);case"hex":return he(e,16,n);case"auto":var a=t&&void 0!==t.lowerExp?t.lowerExp:-3,o=t&&void 0!==t.upperExp?t.upperExp:5;if(e.isZero())return"0";var s=e.toSignificantDigits(r),u=s.e;return(u>=a&&u/g,">")}function Ne(e,t){if(!f(e))throw new TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: "+H(e)+", index: 0)");if(!f(t))throw new TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: "+H(t)+", index: 1)");return e===t?0:e>t?1:-1}function Me(e,t,r){if(!(this instanceof Me))throw new SyntaxError("Constructor must be called with the new operator");this.actual=e,this.expected=t,this.relation=r,this.message="Dimension mismatch ("+(Array.isArray(e)?"["+e.join(", ")+"]":e)+" "+(this.relation||"!=")+" "+(Array.isArray(t)?"["+t.join(", ")+"]":t)+")",this.stack=(new Error).stack}function Se(e,t,r){if(!(this instanceof Se))throw new SyntaxError("Constructor must be called with the new operator");this.index=e,arguments.length<3?(this.min=0,this.max=t):(this.min=t,this.max=r),void 0!==this.min&&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}function Ee(e){for(var t=[];Array.isArray(e);)t.push(e.length),e=e[0];return t}function Ae(e,t){if(0===t.length){if(Array.isArray(e))throw new Me(e.length,0)}else!function e(t,r,n){var i,a=t.length;if(a!==r[n])throw new Me(a,r[n]);if(n")}(e,t,0)}function Oe(e,t){if(!a(e)||!V(e))throw new TypeError("Index must be an integer (value: "+e+")");if(e<0||"number"==typeof t&&e>=t)throw new Se(e,t)}function Ce(e,t,r){if(!Array.isArray(e)||!Array.isArray(t))throw new TypeError("Array expected");if(0===t.length)throw new Error("Resizing to scalar is not supported");return t.forEach((function(e){if(!a(e)||!V(e)||e<0)throw new TypeError("Invalid size, must contain positive integers (size: "+xe(t)+")")})),function e(t,r,n,i){var a,o,s=t.length,u=r[n],c=Math.min(s,u);if(t.length=u,n0;i--){var a=t[i];r=[];for(var o=n.length/a,s=0;s15)throw new TypeError("Cannot implicitly convert a number with >15 significant digits to BigNumber (value: "+e+"). Use function bignumber(x) to convert to BigNumber.");return new t(e)}},{from:"number",to:"Complex",convert:function(e){return r||nt(e),new r(e,0)}},{from:"number",to:"string",convert:function(e){return e+""}},{from:"BigNumber",to:"Complex",convert:function(e){return r||nt(e),new r(e.toNumber(),0)}},{from:"Fraction",to:"BigNumber",convert:function(e){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(e){return r||nt(e),new r(e.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(e){i||it(e);var t=new i(e);if(t.valueOf()!==e)throw new TypeError("Cannot implicitly convert a number to a Fraction when there will be a loss of precision (value: "+e+"). Use function fraction(x) to convert to Fraction.");return t}},{from:"string",to:"number",convert:function(e){var t=Number(e);if(isNaN(t))throw new Error('Cannot convert "'+e+'" to a number');return t}},{from:"string",to:"BigNumber",convert:function(e){t||rt(e);try{return new t(e)}catch(t){throw new Error('Cannot convert "'+e+'" to BigNumber')}}},{from:"string",to:"Fraction",convert:function(e){i||it(e);try{return new i(e)}catch(t){throw new Error('Cannot convert "'+e+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(e){r||nt(e);try{return new r(e)}catch(t){throw new Error('Cannot convert "'+e+'" to Complex')}}},{from:"boolean",to:"number",convert:function(e){return+e}},{from:"boolean",to:"BigNumber",convert:function(e){return t||rt(e),new t(+e)}},{from:"boolean",to:"Fraction",convert:function(e){return i||it(e),new i(+e)}},{from:"boolean",to:"string",convert:function(e){return String(e)}},{from:"Array",to:"Matrix",convert:function(e){return n||function(){throw new Error("Cannot convert array into a Matrix: no class 'DenseMatrix' provided")}(),new n(e)}},{from:"Matrix",to:"Array",convert:function(e){return e.valueOf()}}],m}));function rt(e){throw new Error("Cannot convert value ".concat(e," into a BigNumber: no class 'BigNumber' provided"))}function nt(e){throw new Error("Cannot convert value ".concat(e," into a Complex number: no class 'Complex' provided"))}function it(e){throw new Error("Cannot convert value ".concat(e," into a Fraction, no class 'Fraction' provided."))}var at=Xe("ResultSet",[],(function(){function e(t){if(!(this instanceof e))throw new SyntaxError("Constructor must be called with the new operator");this.entries=t||[]}return e.prototype.type="ResultSet",e.prototype.isResultSet=!0,e.prototype.valueOf=function(){return this.entries},e.prototype.toString=function(){return"["+this.entries.join(", ")+"]"},e.prototype.toJSON=function(){return{mathjs:"ResultSet",entries:this.entries}},e.fromJSON=function(t){return new e(t.entries)},e}),{isClass:!0}),ot=r(7),st=r.n(ot),ut=Xe("BigNumber",["?on","config"],(function(e){var t=e.on,r=e.config,n=st.a.clone({precision:r.precision,modulo:9});return n.prototype.type="BigNumber",n.prototype.isBigNumber=!0,n.prototype.toJSON=function(){return{mathjs:"BigNumber",value:this.toString()}},n.fromJSON=function(e){return new n(e.value)},t&&t("config",(function(e,t){e.precision!==t.precision&&n.config({precision:e.precision})})),n}),{isClass:!0}),ct=r(1),ft=r.n(ct);function lt(e){return(lt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var pt=Xe("Complex",[],(function(){return ft.a.prototype.type="Complex",ft.a.prototype.isComplex=!0,ft.a.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},ft.a.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},ft.a.prototype.format=function(e){var t=this.im,r=this.re,n=ee(this.re,e),i=ee(this.im,e),o=a(e)?e:e?e.precision:null;if(null!==o){var s=Math.pow(10,-o);Math.abs(r/t)t.re?1:e.ret.im?1:e.im0?this.step>0?this.start:this.start+(e-1)*this.step:void 0},e.prototype.max=function(){var e=this.size()[0];return e>0?this.step>0?this.start+(e-1)*this.step:this.start:void 0},e.prototype.forEach=function(e){var t=this.start,r=this.step,n=this.end,i=0;if(r>0)for(;tn;)e(t,[i],this),t+=r,i++},e.prototype.map=function(e){var t=[];return this.forEach((function(r,n,i){t[n[0]]=e(r,n,i)})),t},e.prototype.toArray=function(){var e=[];return this.forEach((function(t,r){e[r[0]]=t})),e},e.prototype.valueOf=function(){return this.toArray()},e.prototype.format=function(e){var t=ee(this.start,e);return 1!==this.step&&(t+=":"+ee(this.step,e)),t+=":"+ee(this.end,e)},e.prototype.toString=function(){return this.format()},e.prototype.toJSON=function(){return{mathjs:"Range",start:this.start,end:this.end,step:this.step}},e.fromJSON=function(t){return new e(t.start,t.end,t.step)},e}),{isClass:!0}),gt=Xe("Matrix",[],(function(){function e(){if(!(this instanceof e))throw new SyntaxError("Constructor must be called with the new operator")}return e.prototype.type="Matrix",e.prototype.isMatrix=!0,e.prototype.storage=function(){throw new Error("Cannot invoke storage on a Matrix interface")},e.prototype.datatype=function(){throw new Error("Cannot invoke datatype on a Matrix interface")},e.prototype.create=function(e,t){throw new Error("Cannot invoke create on a Matrix interface")},e.prototype.subset=function(e,t,r){throw new Error("Cannot invoke subset on a Matrix interface")},e.prototype.get=function(e){throw new Error("Cannot invoke get on a Matrix interface")},e.prototype.set=function(e,t,r){throw new Error("Cannot invoke set on a Matrix interface")},e.prototype.resize=function(e,t){throw new Error("Cannot invoke resize on a Matrix interface")},e.prototype.reshape=function(e,t){throw new Error("Cannot invoke reshape on a Matrix interface")},e.prototype.clone=function(){throw new Error("Cannot invoke clone on a Matrix interface")},e.prototype.size=function(){throw new Error("Cannot invoke size on a Matrix interface")},e.prototype.map=function(e,t){throw new Error("Cannot invoke map on a Matrix interface")},e.prototype.forEach=function(e){throw new Error("Cannot invoke forEach on a Matrix interface")},e.prototype.toArray=function(){throw new Error("Cannot invoke toArray on a Matrix interface")},e.prototype.valueOf=function(){throw new Error("Cannot invoke valueOf on a Matrix interface")},e.prototype.format=function(e){throw new Error("Cannot invoke format on a Matrix interface")},e.prototype.toString=function(){throw new Error("Cannot invoke toString on a Matrix interface")},e}),{isClass:!0}),vt=Xe("DenseMatrix",["Matrix"],(function(e){var t=e.Matrix;function r(e,t){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");if(t&&!f(t))throw new Error("Invalid datatype: "+t);if(p(e))"DenseMatrix"===e.type?(this._data=He(e._data),this._size=He(e._size),this._datatype=t||e._datatype):(this._data=e.toArray(),this._size=e.size(),this._datatype=t||e._datatype);else if(e&&l(e.data)&&l(e.size))this._data=e.data,this._size=e.size,Ae(this._data,this._size),this._datatype=t||e.datatype;else if(l(e))this._data=function e(t){for(var r=0,n=t.length;r");u(e,t.max().map((function(e){return e+1})),n);var f=a.length;!function e(t,r,n,i,a){var o=a===i-1,s=r.dimension(a);o?s.forEach((function(e,r){Oe(e),t[e]=n[r[0]]})):s.forEach((function(o,s){Oe(o),e(t[o],r,n[s[0]],i,a+1)}))}(e._data,t,r,f,0)}return e}function s(e,t,r){if(0===t.length){for(var n=e._data;l(n);)n=n[0];return n}return e._size=t.slice(0),e._data=Ce(e._data,e._size,r),e}function u(e,t,r){for(var n=e._size.slice(0),i=!1;n.lengthn[a]&&(n[a]=t[a],i=!0);i&&s(e,n,r)}return r.prototype=new t,r.prototype.createDenseMatrix=function(e,t){return new r(e,t)},r.prototype.type="DenseMatrix",r.prototype.isDenseMatrix=!0,r.prototype.getDataType=function(){return Ue(this._data,H)},r.prototype.storage=function(){return"dense"},r.prototype.datatype=function(){return this._datatype},r.prototype.create=function(e,t){return new r(e,t)},r.prototype.subset=function(e,t,r){switch(arguments.length){case 1:return n(this,e);case 2:case 3:return i(this,e,t,r);default:throw new SyntaxError("Wrong number of arguments")}},r.prototype.get=function(e){if(!l(e))throw new TypeError("Array expected");if(e.length!==this._size.length)throw new Me(e.length,this._size.length);for(var t=0;t0?e:0,n=e<0?-e:0,i=this._size[0],s=this._size[1],u=Math.min(i-n,s-t),c=[],f=0;f0?n:0,c=n<0?-n:0,f=e[0],m=e[1],h=Math.min(f-c,m-u);if(l(t)){if(t.length!==h)throw new Error("Invalid value array length");s=function(e){return t[e]}}else if(p(t)){var d=t.size();if(1!==d.length||d[0]!==h)throw new Error("Invalid matrix length");s=function(e){return t.get([e])}}else s=function(){return t};i||(i=o(s(0))?s(0).mul(0):0);var y=[];if(e.length>0){y=Ce(y,e,i);for(var g=0;g=n.length)throw new Se(t,n.length);return p(e)?e.create(St(e.valueOf(),t,r)):St(e,t,r)}function St(e,t,r){var n,i,a,o;if(t<=0){if(Array.isArray(e[0])){for(o=function(e){var t,r,n=e.length,i=e[0].length,a=[];for(r=0;r0}function _t(e){return 0===e}function Tt(e){return Number.isNaN(e)}Ot.signature="number",Ct.signature="number",_t.signature="number",Tt.signature="number";var qt=Xe("isNegative",["typed"],(function(e){return(0,e.typed)("isNegative",{number:Ot,BigNumber:function(e){return e.isNeg()&&!e.isZero()&&!e.isNaN()},Fraction:function(e){return e.s<0},Unit:function(e){return this(e.value)},"Array | Matrix":function(e){return Nt(e,this)}})})),zt=Xe("isNumeric",["typed"],(function(e){return(0,e.typed)("isNumeric",{"number | BigNumber | Fraction | boolean":function(){return!0},"Complex | Unit | string | null | undefined | Node":function(){return!1},"Array | Matrix":function(e){return Nt(e,this)}})})),It=Xe("hasNumericValue",["typed","isNumeric"],(function(e){var t=e.typed,r=e.isNumeric;return t("hasNumericValue",{string:function(e){return e.trim().length>0&&!isNaN(Number(e))},any:function(e){return r(e)}})})),Bt=Xe("isPositive",["typed"],(function(e){return(0,e.typed)("isPositive",{number:Ct,BigNumber:function(e){return!e.isNeg()&&!e.isZero()&&!e.isNaN()},Fraction:function(e){return e.s>0&&e.n>0},Unit:function(e){return this(e.value)},"Array | Matrix":function(e){return Nt(e,this)}})})),kt=Xe("isZero",["typed"],(function(e){return(0,e.typed)("isZero",{number:_t,BigNumber:function(e){return e.isZero()},Complex:function(e){return 0===e.re&&0===e.im},Fraction:function(e){return 1===e.d&&0===e.n},Unit:function(e){return this(e.value)},"Array | Matrix":function(e){return Nt(e,this)}})})),Dt=Xe("isNaN",["typed"],(function(e){return(0,e.typed)("isNaN",{number:Tt,BigNumber:function(e){return e.isNaN()},Fraction:function(e){return!1},Complex:function(e){return e.isNaN()},Unit:function(e){return Number.isNaN(e.value)},"Array | Matrix":function(e){return Nt(e,Number.isNaN)}})})),Rt=Xe("typeOf",["typed"],(function(e){return(0,e.typed)("typeOf",{any:H})}));function jt(e,t,r){if(null==r)return e.eq(t);if(e.eq(t))return!0;if(e.isNaN()||t.isNaN())return!1;if(e.isFinite()&&t.isFinite()){var n=e.minus(t).abs();if(n.isZero())return!0;var i=e.constructor.max(e.abs(),t.abs());return n.lte(i.times(r))}return!1}var Pt=Xe("equalScalar",["typed","config"],(function(e){var t=e.typed,r=e.config;return t("equalScalar",{"boolean, boolean":function(e,t){return e===t},"number, number":function(e,t){return se(e,t,r.epsilon)},"BigNumber, BigNumber":function(e,t){return e.eq(t)||jt(e,t,r.epsilon)},"Fraction, Fraction":function(e,t){return e.equals(t)},"Complex, Complex":function(e,t){return function(e,t,r){return se(e.re,t.re,r)&&se(e.im,t.im,r)}(e,t,r.epsilon)},"Unit, Unit":function(e,t){if(!e.equalBase(t))throw new Error("Cannot compare units with different base");return this(e.value,t.value)}})})),Ut=(Xe("equalScalar",["typed","config"],(function(e){var t=e.typed,r=e.config;return t("equalScalar",{"number, number":function(e,t){return se(e,t,r.epsilon)}})})),Xe("SparseMatrix",["typed","equalScalar","Matrix"],(function(e){var t=e.typed,r=e.equalScalar,n=e.Matrix;function i(e,t){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if(t&&!f(t))throw new Error("Invalid datatype: "+t);if(p(e))!function(e,t,r){"SparseMatrix"===t.type?(e._values=t._values?He(t._values):void 0,e._index=He(t._index),e._ptr=He(t._ptr),e._size=He(t._size),e._datatype=r||t._datatype):s(e,t.valueOf(),r||t._datatype)}(this,e,t);else if(e&&l(e.index)&&l(e.ptr)&&l(e.size))this._values=e.values,this._index=e.index,this._ptr=e.ptr,this._size=e.size,this._datatype=t||e.datatype;else if(l(e))s(this,e,t);else{if(e)throw new TypeError("Unsupported type of data ("+H(e)+")");this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=t}}function s(e,n,i){e._values=[],e._index=[],e._ptr=[],e._datatype=i;var a=n.length,o=0,s=r,u=0;if(f(i)&&(s=t.find(r,[i,i])||r,u=t.convert(0,i)),a>0){var c=0;do{e._ptr.push(e._index.length);for(var p=0;p