math.js 710 KB

1
  1. !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.math=t():e.math=t()}(this,()=>{var r={5716:function(e,t){var r;!function(){"use strict";function s(){throw SyntaxError("Invalid Param")}var n=Math.cosh||function(e){return Math.abs(e)<1e-9?1-e:.5*(Math.exp(e)+Math.exp(-e))},i=Math.sinh||function(e){return Math.abs(e)<1e-9?e:.5*(Math.exp(e)-Math.exp(-e))};function o(e,t){var r=Math.abs(e),n=Math.abs(t);return 0===e?Math.log(n):0===t?Math.log(r):r<3e3&&n<3e3?.5*Math.log(e*e+t*t):(e/=2,t/=2,.5*Math.log(e*e+t*t)+Math.LN2)}function c(e,t){if(!(this instanceof c))return new c(e,t);e=function(e,t){var r={re:0,im:0};if(null==e)r.re=r.im=0;else if(void 0!==t)r.re=e,r.im=t;else switch(typeof e){case"object":if("im"in e&&"re"in e)r.re=e.re,r.im=e.im;else if("abs"in e&&"arg"in e){if(!Number.isFinite(e.abs)&&Number.isFinite(e.arg))return c.INFINITY;r.re=e.abs*Math.cos(e.arg),r.im=e.abs*Math.sin(e.arg)}else if("r"in e&&"phi"in e){if(!Number.isFinite(e.r)&&Number.isFinite(e.phi))return c.INFINITY;r.re=e.r*Math.cos(e.phi),r.im=e.r*Math.sin(e.phi)}else 2===e.length?(r.re=e[0],r.im=e[1]):s();break;case"string":r.im=r.re=0;var n=e.match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g),i=1,a=0;null===n&&s();for(var o=0;o<n.length;o++){var u=n[o];" "!==u&&"\t"!==u&&"\n"!==u&&("+"===u?i++:"-"===u?a++:i=a=("i"===u||"I"===u?(i+a===0&&s()," "===n[o+1]||isNaN(n[o+1])?r.im+=parseFloat((a%2?"-":"")+"1"):(r.im+=parseFloat((a%2?"-":"")+n[o+1]),o++)):(i+a!==0&&!isNaN(u)||s(),"i"===n[o+1]||"I"===n[o+1]?(r.im+=parseFloat((a%2?"-":"")+u),o++):r.re+=parseFloat((a%2?"-":"")+u)),0))}0<i+a&&s();break;case"number":r.im=0,r.re=e;break;default:s()}return isNaN(r.re)||isNaN(r.im),r}(e,t);this.re=e.re,this.im=e.im}c.prototype={re:0,im:0,sign:function(){var e=this.abs();return new c(this.re/e,this.im/e)},add:function(e,t){e=new c(e,t);return this.isInfinite()&&e.isInfinite()?c.NAN:this.isInfinite()||e.isInfinite()?c.INFINITY:new c(this.re+e.re,this.im+e.im)},sub:function(e,t){e=new c(e,t);return this.isInfinite()&&e.isInfinite()?c.NAN:this.isInfinite()||e.isInfinite()?c.INFINITY:new c(this.re-e.re,this.im-e.im)},mul:function(e,t){e=new c(e,t);return this.isInfinite()&&e.isZero()||this.isZero()&&e.isInfinite()?c.NAN:this.isInfinite()||e.isInfinite()?c.INFINITY:0===e.im&&0===this.im?new c(this.re*e.re,0):new c(this.re*e.re-this.im*e.im,this.re*e.im+this.im*e.re)},div:function(e,t){var r=new c(e,t);if(this.isZero()&&r.isZero()||this.isInfinite()&&r.isInfinite())return c.NAN;if(this.isInfinite()||r.isZero())return c.INFINITY;if(this.isZero()||r.isInfinite())return c.ZERO;e=this.re,t=this.im;var n,i,a=r.re,r=r.im;return 0===r?new c(e/a,t/a):Math.abs(a)<Math.abs(r)?new c((e*(i=a/r)+t)/(n=a*i+r),(t*i-e)/n):new c((e+t*(i=r/a))/(n=r*i+a),(t-e*i)/n)},pow:function(e,t){var r=new c(e,t);if(e=this.re,t=this.im,r.isZero())return c.ONE;if(0===r.im){if(0===t&&0<e)return new c(Math.pow(e,r.re),0);if(0===e)switch((r.re%4+4)%4){case 0:return new c(Math.pow(t,r.re),0);case 1:return new c(0,Math.pow(t,r.re));case 2:return new c(-Math.pow(t,r.re),0);case 3:return new c(0,-Math.pow(t,r.re))}}if(0===e&&0===t&&0<r.re&&0<=r.im)return c.ZERO;var n=Math.atan2(t,e),i=o(e,t);return e=Math.exp(r.re*i-r.im*n),t=r.im*i+r.re*n,new c(e*Math.cos(t),e*Math.sin(t))},sqrt:function(){var e,t=this.re,r=this.im,n=this.abs();if(0<=t){if(0===r)return new c(Math.sqrt(t),0);e=.5*Math.sqrt(2*(n+t))}else e=Math.abs(r)/Math.sqrt(2*(n-t));return n=t<=0?.5*Math.sqrt(2*(n-t)):Math.abs(r)/Math.sqrt(2*(n+t)),new c(e,r<0?-n:n)},exp:function(){var e=Math.exp(this.re);return this.im,new c(e*Math.cos(this.im),e*Math.sin(this.im))},expm1:function(){var e=this.re,t=this.im;return new c(Math.expm1(e)*Math.cos(t)+function(e){var t=Math.PI/4;if(e<-t||t<e)return Math.cos(e)-1;t=e*e;return t*(t*(t*(t*(t*(t*(t*(t/20922789888e3-1/87178291200)+1/479001600)-1/3628800)+1/40320)-1/720)+1/24)-.5)}(t),Math.exp(e)*Math.sin(t))},log:function(){var e=this.re,t=this.im;return new c(o(e,t),Math.atan2(t,e))},abs:function(){return e=this.re,t=this.im,r=Math.abs(e),n=Math.abs(t),r<3e3&&n<3e3?Math.sqrt(r*r+n*n):(n=r<n?(r=n,e/t):t/e,r*Math.sqrt(1+n*n));var e,t,r,n},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){var e=this.re,t=this.im;return new c(Math.sin(e)*n(t),Math.cos(e)*i(t))},cos:function(){var e=this.re,t=this.im;return new c(Math.cos(e)*n(t),-Math.sin(e)*i(t))},tan:function(){var e=2*this.re,t=2*this.im,r=Math.cos(e)+n(t);return new c(Math.sin(e)/r,i(t)/r)},cot:function(){var e=2*this.re,t=2*this.im,r=Math.cos(e)-n(t);return new c(-Math.sin(e)/r,i(t)/r)},sec:function(){var e=this.re,t=this.im,r=.5*n(2*t)+.5*Math.cos(2*e);return new c(Math.cos(e)*n(t)/r,Math.sin(e)*i(t)/r)},csc:function(){var e=this.re,t=this.im,r=.5*n(2*t)-.5*Math.cos(2*e);return new c(Math.sin(e)*n(t)/r,-Math.cos(e)*i(t)/r)},asin:function(){var e=this.re,t=this.im,r=new c(t*t-e*e+1,-2*e*t).sqrt(),t=new c(r.re-t,r.im+e).log();return new c(t.im,-t.re)},acos:function(){var e=this.re,t=this.im,r=new c(t*t-e*e+1,-2*e*t).sqrt(),t=new c(r.re-t,r.im+e).log();return new c(Math.PI/2-t.im,t.re)},atan:function(){var e=this.re,t=this.im;if(0===e){if(1===t)return new c(0,1/0);if(-1===t)return new c(0,-1/0)}var r=e*e+(1-t)*(1-t),t=new c((1-t*t-e*e)/r,-2*e/r).log();return new c(-.5*t.im,.5*t.re)},acot:function(){var e=this.re,t=this.im;if(0===t)return new c(Math.atan2(1,e),0);var r=e*e+t*t;return(0!=r?new c(e/r,-t/r):new c(0!==e?e/0:0,0!==t?-t/0:0)).atan()},asec:function(){var e=this.re,t=this.im;if(0===e&&0===t)return new c(0,1/0);var r=e*e+t*t;return(0!=r?new c(e/r,-t/r):new c(0!==e?e/0:0,0!==t?-t/0:0)).acos()},acsc:function(){var e=this.re,t=this.im;if(0===e&&0===t)return new c(Math.PI/2,1/0);var r=e*e+t*t;return(0!=r?new c(e/r,-t/r):new c(0!==e?e/0:0,0!==t?-t/0:0)).asin()},sinh:function(){var e=this.re,t=this.im;return new c(i(e)*Math.cos(t),n(e)*Math.sin(t))},cosh:function(){var e=this.re,t=this.im;return new c(n(e)*Math.cos(t),i(e)*Math.sin(t))},tanh:function(){var e=2*this.re,t=2*this.im,r=n(e)+Math.cos(t);return new c(i(e)/r,Math.sin(t)/r)},coth:function(){var e=2*this.re,t=2*this.im,r=n(e)-Math.cos(t);return new c(i(e)/r,-Math.sin(t)/r)},csch:function(){var e=this.re,t=this.im,r=Math.cos(2*t)-n(2*e);return new c(-2*i(e)*Math.cos(t)/r,2*n(e)*Math.sin(t)/r)},sech:function(){var e=this.re,t=this.im,r=Math.cos(2*t)+n(2*e);return new c(2*n(e)*Math.cos(t)/r,-2*i(e)*Math.sin(t)/r)},asinh:function(){var e=this.im,t=(this.im=-this.re,this.re=e,this.asin());return this.re=-this.im,this.im=e,e=t.re,t.re=-t.im,t.im=e,t},acosh:function(){var e,t=this.acos();return t.im<=0?(e=t.re,t.re=-t.im,t.im=e):(e=t.im,t.im=-t.re,t.re=e),t},atanh:function(){var e=this.re,t=this.im,r=1<e&&0===t,n=1-e,i=1+e,a=n*n+t*t,n=0!=a?new c((i*n-t*t)/a,(t*n+i*t)/a):new c(-1!==e?e/0:0,0!==t?t/0:0),i=n.re;return n.re=o(n.re,n.im)/2,n.im=Math.atan2(n.im,i)/2,r&&(n.im=-n.im),n},acoth:function(){var e=this.re,t=this.im;if(0===e&&0===t)return new c(0,Math.PI/2);var r=e*e+t*t;return(0!=r?new c(e/r,-t/r):new c(0!==e?e/0:0,0!==t?-t/0:0)).atanh()},acsch:function(){var e=this.re,t=this.im;if(0===t)return new c(0!==e?Math.log(e+Math.sqrt(e*e+1)):1/0,0);var r=e*e+t*t;return(0!=r?new c(e/r,-t/r):new c(0!==e?e/0:0,0!==t?-t/0:0)).asinh()},asech:function(){var e=this.re,t=this.im;if(this.isZero())return c.INFINITY;var r=e*e+t*t;return(0!=r?new c(e/r,-t/r):new c(0!==e?e/0:0,0!==t?-t/0:0)).acosh()},inverse:function(){if(this.isZero())return c.INFINITY;if(this.isInfinite())return c.ZERO;var e=this.re,t=this.im,r=e*e+t*t;return new c(e/r,-t/r)},conjugate:function(){return new c(this.re,-this.im)},neg:function(){return new c(-this.re,-this.im)},ceil:function(e){return e=Math.pow(10,e||0),new c(Math.ceil(this.re*e)/e,Math.ceil(this.im*e)/e)},floor:function(e){return e=Math.pow(10,e||0),new c(Math.floor(this.re*e)/e,Math.floor(this.im*e)/e)},round:function(e){return e=Math.pow(10,e||0),new c(Math.round(this.re*e)/e,Math.round(this.im*e)/e)},equals:function(e,t){e=new c(e,t);return Math.abs(e.re-this.re)<=c.EPSILON&&Math.abs(e.im-this.im)<=c.EPSILON},clone:function(){return new c(this.re,this.im)},toString:function(){var e=this.re,t=this.im,r="";return this.isNaN()?"NaN":this.isInfinite()?"Infinity":(Math.abs(e)<c.EPSILON&&(e=0),0===(t=Math.abs(t)<c.EPSILON?0:t)?r+e:(0!==e?(r=r+e+" ",t<0?(t=-t,r+="-"):r+="+",r+=" "):t<0&&(t=-t,r+="-"),1!==t&&(r+=t),r+"i"))},toVector:function(){return[this.re,this.im]},valueOf:function(){return 0===this.im?this.re:null},isNaN:function(){return isNaN(this.re)||isNaN(this.im)},isZero:function(){return 0===this.im&&0===this.re},isFinite:function(){return isFinite(this.re)&&isFinite(this.im)},isInfinite:function(){return!(this.isNaN()||this.isFinite())}},c.ZERO=new c(0,0),c.ONE=new c(1,0),c.I=new c(0,1),c.PI=new c(Math.PI,0),c.E=new c(Math.E,0),c.INFINITY=new c(1/0,1/0),c.NAN=new c(NaN,NaN),c.EPSILON=1e-15,void 0!==(r=function(){return c}.apply(t,[]))&&(e.exports=r)}()},3144:e=>{"use strict";function u(e,t){return s({},e,t)}var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},c={"{":"\\{","}":"\\}","\\":"\\textbackslash{}","#":"\\#",$:"\\$","%":"\\%","&":"\\&","^":"\\textasciicircum{}",_:"\\_","~":"\\textasciitilde{}"},l={"–":"\\--","—":"\\---"," ":"~","\t":"\\qquad{}","\r\n":"\\newline{}","\n":"\\newline{}"};e.exports=function(e){for(var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r=t.preserveFormatting,r=void 0!==r&&r,t=t.escapeMapFn,t=void 0===t?u:t,n=String(e),i="",a=t(s({},c),r?s({},l):{}),o=Object.keys(a);n;)!function(){var r=!1;o.forEach(function(e,t){r||n.length>=e.length&&n.slice(0,e.length)===e&&(i+=a[o[t]],n=n.slice(e.length,n.length),r=!0)}),r||(i+=n.slice(0,1),n=n.slice(1,n.length))}();return i}},3996:function(e){!function(){"use strict";var d={s:1,n:0,d:1};function y(e,t){if(isNaN(e=parseInt(e,10)))throw g();return e*t}function u(e,t){if(0===t)throw v();var r=Object.create(a.prototype),n=(r.s=e<0?-1:1,i(e=e<0?-e:e,t));return r.n=e/n,r.d=t/n,r}function s(e){for(var t={},r=e,n=2,i=4;i<=r;){for(;r%n==0;)r/=n,t[n]=(t[n]||0)+1;i+=1+2*n++}return r!==e?1<r&&(t[r]=(t[r]||0)+1):t[e]=(t[e]||0)+1,t}function c(e,t){var r,n=0,i=1,a=1,o=0,u=0,s=0,c=1,l=1,f=0,p=1,m=1,h=1;if(null!=e)if(void 0!==t){if(a=(n=e)*(i=t),n%1!=0||i%1!=0)throw x()}else switch(typeof e){case"object":if("d"in e&&"n"in e)n=e.n,i=e.d,"s"in e&&(n*=e.s);else{if(!(0 in e))throw g();n=e[0],1 in e&&(i=e[1])}a=n*i;break;case"number":if((e=e<0?-(a=e):e)%1==0)n=e;else if(0<e){for(1<=e&&(e/=l=Math.pow(10,Math.floor(1+Math.log(e)/Math.LN10)));p<=1e7&&h<=1e7;){if(e===(r=(f+m)/(p+h))){i=p+h<=1e7?(n=f+m,p+h):p<h?(n=m,h):(n=f,p);break}r<e?(f+=m,p+=h):(m+=f,h+=p),i=1e7<p?(n=m,h):(n=f,p)}n*=l}else(isNaN(e)||isNaN(t))&&(i=n=NaN);break;case"string":if(null===(p=e.match(/\d+|./g)))throw g();if("-"===p[f]?(a=-1,f++):"+"===p[f]&&f++,p.length===f+1?u=y(p[f++],a):"."===p[f+1]||"."===p[f]?("."!==p[f]&&(o=y(p[f++],a)),(++f+1===p.length||"("===p[f+1]&&")"===p[f+3]||"'"===p[f+1]&&"'"===p[f+3])&&(u=y(p[f],a),c=Math.pow(10,p[f].length),f++),("("===p[f]&&")"===p[f+2]||"'"===p[f]&&"'"===p[f+2])&&(s=y(p[f+1],a),l=Math.pow(10,p[f+1].length)-1,f+=3)):"/"===p[f+1]||":"===p[f+1]?(u=y(p[f],a),c=y(p[f+2],1),f+=3):"/"===p[f+3]&&" "===p[f+1]&&(o=y(p[f],a),u=y(p[f+2],a),c=y(p[f+4],1),f+=5),p.length<=f){a=n=s+(i=c*l)*o+l*u;break}default:throw g()}if(0===i)throw v();d.s=a<0?-1:1,d.n=Math.abs(n),d.d=Math.abs(i)}function i(e,t){if(!e)return t;if(!t)return e;for(;;){if(!(e%=t))return t;if(!(t%=e))return e}}function a(e,t){if(c(e,t),!(this instanceof a))return u(d.s*d.n,d.d);e=i(d.d,d.n),this.s=d.s,this.n=d.n/e,this.d=d.d/e}var v=function(){return new Error("Division by Zero")},g=function(){return new Error("Invalid argument")},x=function(){return new Error("Parameters must be integer")};a.prototype={s:1,n:0,d:1,abs:function(){return u(this.n,this.d)},neg:function(){return u(-this.s*this.n,this.d)},add:function(e,t){return c(e,t),u(this.s*this.n*d.d+d.s*this.d*d.n,this.d*d.d)},sub:function(e,t){return c(e,t),u(this.s*this.n*d.d-d.s*this.d*d.n,this.d*d.d)},mul:function(e,t){return c(e,t),u(this.s*d.s*this.n*d.n,this.d*d.d)},div:function(e,t){return c(e,t),u(this.s*d.s*this.n*d.d,this.d*d.n)},clone:function(){return u(this.s*this.n,this.d)},mod:function(e,t){if(isNaN(this.n)||isNaN(this.d))return new a(NaN);if(void 0===e)return u(this.s*this.n%this.d,1);if(c(e,t),0===d.n&&0===this.d)throw v();return u(this.s*(d.d*this.n)%(d.n*this.d),d.d*this.d)},gcd:function(e,t){return c(e,t),u(i(d.n,this.n)*i(d.d,this.d),d.d*this.d)},lcm:function(e,t){return c(e,t),0===d.n&&0===this.n?u(0,1):u(d.n*this.n,i(d.n,this.n)*i(d.d,this.d))},ceil:function(e){return e=Math.pow(10,e||0),isNaN(this.n)||isNaN(this.d)?new a(NaN):u(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 a(NaN):u(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 a(NaN):u(Math.round(e*this.s*this.n/this.d),e)},inverse:function(){return u(this.s*this.d,this.n)},pow:function(e,t){if(c(e,t),1===d.d)return d.s<0?u(Math.pow(this.s*this.d,d.n),Math.pow(this.n,d.n)):u(Math.pow(this.s*this.n,d.n),Math.pow(this.d,d.n));if(this.s<0)return null;var r,n=s(this.n),i=s(this.d),a=1,o=1;for(r in n)if("1"!==r){if("0"===r){a=0;break}if(n[r]*=d.n,n[r]%d.d!=0)return null;n[r]/=d.d,a*=Math.pow(r,n[r])}for(r in i)if("1"!==r){if(i[r]*=d.n,i[r]%d.d!=0)return null;i[r]/=d.d,o*=Math.pow(r,i[r])}return d.s<0?u(o,a):u(a,o)},equals:function(e,t){return c(e,t),this.s*this.n*d.d==d.s*d.n*this.d},compare:function(e,t){c(e,t);e=this.s*this.n*d.d-d.s*d.n*this.d;return(0<e)-(e<0)},simplify:function(e){if(isNaN(this.n)||isNaN(this.d))return this;e=e||.001;for(var t=this.abs(),r=t.toContinued(),n=1;n<r.length;n++){for(var i=u(r[n-1],1),a=n-2;0<=a;a--)i=i.inverse().add(r[a]);if(Math.abs(i.sub(t).valueOf())<e)return i.mul(this.s)}return this},divisible:function(e,t){return c(e,t),!(!(d.n*this.d)||this.n*d.d%(d.n*this.d))},valueOf:function(){return this.s*this.n/this.d},toFraction:function(e){var t="",r=this.n,n=this.d;return this.s<0&&(t+="-"),1===n?t+=r:(e&&0<(e=Math.floor(r/n))&&(t=t+e+" ",r%=n),t=(t+=r)+"/"+n),t},toLatex:function(e){var t="",r=this.n,n=this.d;return this.s<0&&(t+="-"),1===n?t+=r:(e&&0<(e=Math.floor(r/n))&&(t+=e,r%=n),t=(t=(t+="\\frac{")+r+"}{")+n+"}"),t},toContinued:function(){var e,t=this.n,r=this.d,n=[];if(isNaN(t)||isNaN(r))return n;for(;n.push(Math.floor(t/r)),e=t%r,t=r,r=e,1!==t;);return n},toString:function(e){var t=this.n,r=this.d;if(isNaN(t)||isNaN(r))return"NaN";e=e||15;var i=function(e){for(;e%2==0;e/=2);for(;e%5==0;e/=5);if(1===e)return 0;for(var t=10%e,r=1;1!==t;r++)if(t=10*t%e,2e3<r)return 0;return r}(r),n=function(e){for(var t=1,r=function(e,t,r){for(var n=1;0<t;e=e*e%r,t>>=1)1&t&&(n=n*e%r);return n}(10,i,e),n=0;n<300;n++){if(t===r)return n;t=10*t%e,r=10*r%e}return 0}(r),a=this.s<0?"-":"";if(a+=t/r|0,(t=t%r*10)&&(a+="."),i){for(var o=n;o--;)a+=t/r|0,t=t%r*10;for(a+="(",o=i;o--;)a+=t/r|0,t=t%r*10;a+=")"}else for(o=e;t&&o--;)a+=t/r|0,t=t%r*10;return a}},Object.defineProperty(a,"__esModule",{value:!0}),e.exports=(a.default=a).Fraction=a}()},1880:e=>{e.exports=function t(e,r){"use strict";function n(e){return t.insensitive&&(""+e).toLowerCase()||""+e}var i,a,o=/(^([+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/gi,u=/(^[ ]*|[ ]*$)/g,s=/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,c=/^0x[0-9a-f]+$/i,l=/^0/,e=n(e).replace(u,"")||"",r=n(r).replace(u,"")||"",f=e.replace(o,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),p=r.replace(o,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),u=parseInt(e.match(c),16)||1!==f.length&&e.match(s)&&Date.parse(e),o=parseInt(r.match(c),16)||u&&r.match(s)&&Date.parse(r)||null;if(o){if(u<o)return-1;if(o<u)return 1}for(var m=0,h=Math.max(f.length,p.length);m<h;m++){if(i=!(f[m]||"").match(l)&&parseFloat(f[m])||f[m]||0,a=!(p[m]||"").match(l)&&parseFloat(p[m])||p[m]||0,isNaN(i)!==isNaN(a))return isNaN(i)?1:-1;if(typeof i!=typeof a&&(i+="",a+=""),i<a)return-1;if(a<i)return 1}return 0}},7391:(e,t,r)=>{var n=r(7180),i=r(3181),a=r(3031),o=r(9067),u=r(6833),s=r(6098),r=r(4801);r.alea=n,r.xor128=i,r.xorwow=a,r.xorshift7=o,r.xor4096=u,r.tychei=s,e.exports=r},7180:function(e,r,n){var o;!function(e){function i(e){var n,t=this,r=(n=4022871197,function(e){e=String(e);for(var t=0;t<e.length;t++){var r=.02519603282416938*(n+=e.charCodeAt(t));n=(r=(r-=n=r>>>0)*n)>>>0,n+=4294967296*(r-=n)}return 2.3283064365386963e-10*(n>>>0)});t.next=function(){var e=2091639*t.s0+2.3283064365386963e-10*t.c;return t.s0=t.s1,t.s1=t.s2,t.s2=e-(t.c=0|e)},t.c=1,t.s0=r(" "),t.s1=r(" "),t.s2=r(" "),t.s0-=r(e),t.s0<0&&(t.s0+=1),t.s1-=r(e),t.s1<0&&(t.s1+=1),t.s2-=r(e),t.s2<0&&(t.s2+=1)}function a(e,t){return t.c=e.c,t.s0=e.s0,t.s1=e.s1,t.s2=e.s2,t}function t(e,t){var r=new i(e),e=t&&t.state,n=r.next;return n.int32=function(){return 4294967296*r.next()|0},n.double=function(){return n()+11102230246251565e-32*(2097152*n()|0)},n.quick=n,e&&("object"==typeof e&&a(e,r),n.state=function(){return a(r,{})}),n}e&&e.exports?e.exports=t:n.amdD&&n.amdO?void 0!==(o=function(){return t}.call(r,n,r,e))&&(e.exports=o):this.alea=t}(e=n.nmd(e),n.amdD)},6098:function(e,r,n){var o;!function(e){function i(e){var i=this,t="";i.next=function(){var e=(e=i.b)<<25^e>>>7^(t=i.c),t=t-(r=i.d)|0,r=r<<24^r>>>8^(n=i.a),n=n-e|0;return i.b=e=e<<20^e>>>12^t,i.c=t=t-r|0,i.d=r<<16^t>>>16^n,i.a=n-e|0},i.a=0,i.b=0,i.c=-1640531527,i.d=1367130551,e===Math.floor(e)?(i.a=e/4294967296|0,i.b=0|e):t+=e;for(var r=0;r<t.length+20;r++)i.b^=0|t.charCodeAt(r),i.next()}function a(e,t){return t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t}function t(e,t){function r(){return(n.next()>>>0)/4294967296}var n=new i(e),e=t&&t.state;return r.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},r.int32=n.next,r.quick=r,e&&("object"==typeof e&&a(e,n),r.state=function(){return a(n,{})}),r}e&&e.exports?e.exports=t:n.amdD&&n.amdO?void 0!==(o=function(){return t}.call(r,n,r,e))&&(e.exports=o):this.tychei=t}(e=n.nmd(e),n.amdD)},3181:function(e,r,n){var o;!function(e){function i(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<r.length+64;n++)t.x^=0|r.charCodeAt(n),t.next()}function a(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t}function t(e,t){function r(){return(n.next()>>>0)/4294967296}var n=new i(e),e=t&&t.state;return r.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},r.int32=n.next,r.quick=r,e&&("object"==typeof e&&a(e,n),r.state=function(){return a(n,{})}),r}e&&e.exports?e.exports=t:n.amdD&&n.amdO?void 0!==(o=function(){return t}.call(r,n,r,e))&&(e.exports=o):this.xor128=t}(e=n.nmd(e),n.amdD)},6833:function(e,r,n){var o;!function(e){function i(e){var t,r,n,i,a,o=this,u=(o.next=function(){var e,t,r=o.w,n=o.X,i=o.i;return o.w=r=r+1640531527|0,t=n[i+34&127],e=n[i=i+1&127],t=n[i]=(t^=t<<13)^t>>>15^((e^=e<<17)^e>>>12),o.i=i,t+(r^r>>>16)|0},o),s=e,c=[],l=128;for(s===(0|s)?(r=s,s=null):(s+="\0",r=0,l=Math.max(l,s.length)),n=0,i=-32;i<l;++i)s&&(r^=s.charCodeAt((i+32)%s.length)),0===i&&(a=r),r=(r=(r=(r^=r<<10)^r>>>15)^r<<4)^r>>>13,0<=i&&(n=0==(t=c[127&i]^=r+(a=a+1640531527|0))?n+1:0);for(128<=n&&(c[127&(s&&s.length||0)]=-1),n=127,i=512;0<i;--i)r=c[n+34&127],t=c[n=n+1&127],c[n]=(r=(r^=r<<13)^r>>>15)^(t=(t^=t<<17)^t>>>12);u.w=a,u.X=c,u.i=n}function a(e,t){return t.i=e.i,t.w=e.w,t.X=e.X.slice(),t}function t(e,t){function r(){return(n.next()>>>0)/4294967296}var n=new i(e=null==e?+new Date:e),e=t&&t.state;return r.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},r.int32=n.next,r.quick=r,e&&(e.X&&a(e,n),r.state=function(){return a(n,{})}),r}e&&e.exports?e.exports=t:n.amdD&&n.amdO?void 0!==(o=function(){return t}.call(r,n,r,e))&&(e.exports=o):this.xor4096=t}(e=n.nmd(e),n.amdD)},9067:function(e,r,n){var o;!function(e){function i(e){var t,i=this,r=(i.next=function(){var e=i.x,t=i.i,r=e[t],n=(r^=r>>>7)^r<<24;return n=(n=(n^=(r=e[t+1&7])^r>>>10)^((r=e[t+3&7])^r>>>3))^((r=e[t+4&7])^r<<7),r=e[t+7&7],n^=(r^=r<<13)^r<<9,e[t]=n,i.i=t+1&7,n},i),n=e,a=[];if(n===(0|n))a[0]=n;else for(n=""+n,t=0;t<n.length;++t)a[7&t]=a[7&t]<<15^n.charCodeAt(t)+a[t+1&7]<<13;for(;a.length<8;)a.push(0);for(t=0;t<8&&0===a[t];++t);for(8==t?a[7]=-1:a[t],r.x=a,r.i=0,t=256;0<t;--t)r.next()}function a(e,t){return t.x=e.x.slice(),t.i=e.i,t}function t(e,t){function r(){return(n.next()>>>0)/4294967296}var n=new i(e=null==e?+new Date:e),e=t&&t.state;return r.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},r.int32=n.next,r.quick=r,e&&(e.x&&a(e,n),r.state=function(){return a(n,{})}),r}e&&e.exports?e.exports=t:n.amdD&&n.amdO?void 0!==(o=function(){return t}.call(r,n,r,e))&&(e.exports=o):this.xorshift7=t}(e=n.nmd(e),n.amdD)},3031:function(e,r,n){var o;!function(e){function i(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,e===((t.v=0)|e)?t.x=e:r+=e;for(var n=0;n<r.length+64;n++)t.x^=0|r.charCodeAt(n),n==r.length&&(t.d=t.x<<10^t.x>>>4),t.next()}function a(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 t(e,t){function r(){return(n.next()>>>0)/4294967296}var n=new i(e),e=t&&t.state;return r.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},r.int32=n.next,r.quick=r,e&&("object"==typeof e&&a(e,n),r.state=function(){return a(n,{})}),r}e&&e.exports?e.exports=t:n.amdD&&n.amdO?void 0!==(o=function(){return t}.call(r,n,r,e))&&(e.exports=o):this.xorwow=t}(e=n.nmd(e),n.amdD)},4801:function(e,t,r){var o,u="undefined"!=typeof self?self:this,s=[],c=Math,l=256,f=c.pow(l,6),p=c.pow(2,52),m=2*p,h=l-1;function n(e,t,r){function n(){for(var e=a.g(6),t=f,r=0;e<p;)e=(e+r)*l,t*=l,r=a.g(1);for(;m<=e;)e/=2,t/=2,r>>>=1;return(e+r)/t}var i=[],e=v(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(t){}return i.length?i:"string"==a?t:t+"\0"}((t=1==t?{entropy:!0}:t||{}).entropy?[e,g(s)]:null==e?function(){try{var e;return o&&(e=o.randomBytes)?e=e(l):(e=new Uint8Array(l),(u.crypto||u.msCrypto).getRandomValues(e)),g(e)}catch(e){var t=u.navigator,t=t&&t.plugins;return[+new Date,u,t,u.screen,g(s)]}}():e,3),i),a=new d(i);return n.int32=function(){return 0|a.g(4)},n.quick=function(){return a.g(4)/4294967296},n.double=n,v(g(a.S),s),(t.pass||r||function(e,t,r,n){return n&&(n.S&&y(n,a),e.state=function(){return y(a,{})}),r?(c.random=e,t):e})(n,e,"global"in t?t.global:this==c,t.state)}function d(e){var t,r=e.length,o=this,n=0,i=o.i=o.j=0,a=o.S=[];for(r||(e=[r++]);n<l;)a[n]=n++;for(n=0;n<l;n++)a[n]=a[i=h&i+e[n%r]+(t=a[n])],a[i]=t;(o.g=function(e){for(var t,r=0,n=o.i,i=o.j,a=o.S;e--;)t=a[n=h&n+1],r=r*l+a[h&(a[n]=a[i=h&i+t])+(a[i]=t)];return o.i=n,o.j=i,r})(l)}function y(e,t){return t.i=e.i,t.j=e.j,t.S=e.S.slice(),t}function v(e,t){for(var r,n=e+"",i=0;i<n.length;)t[h&i]=h&(r^=19*t[h&i])+n.charCodeAt(i++);return g(t)}function g(e){return String.fromCharCode.apply(0,e)}if(v(c.random(),s),e.exports){e.exports=n;try{o=r(1234)}catch(e){}}else void 0!==(r=function(){return n}.call(t,r,t,e))&&(e.exports=r)},1504:e=>{function t(){}t.prototype={on:function(e,t,r){var n=this.e||(this.e={});return(n[e]||(n[e]=[])).push({fn:t,ctx:r}),this},once:function(e,t,r){var n=this;function i(){n.off(e,i),t.apply(r,arguments)}return i._=t,this.on(e,i,r)},emit:function(e){for(var t=[].slice.call(arguments,1),r=((this.e||(this.e={}))[e]||[]).slice(),n=0,i=r.length;n<i;n++)r[n].fn.apply(r[n].ctx,t);return this},off:function(e,t){var r=this.e||(this.e={}),n=r[e],i=[];if(n&&t)for(var a=0,o=n.length;a<o;a++)n[a].fn!==t&&n[a].fn._!==t&&i.push(n[a]);return i.length?r[e]=i:delete r[e],this}},e.exports=t,e.exports.TinyEmitter=t},1234:()=>{},4633:(M,e,t)=>{var F=t(3738).default;function r(){"use strict";M.exports=function(){return o},M.exports.__esModule=!0,M.exports.default=M.exports;var s,o={},e=Object.prototype,c=e.hasOwnProperty,l=Object.defineProperty||function(e,t,r){e[t]=r.value},t="function"==typeof Symbol?Symbol:{},n=t.iterator||"@@iterator",r=t.asyncIterator||"@@asyncIterator",i=t.toStringTag||"@@toStringTag";function a(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{a({},"")}catch(s){a=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var i,a,o,u,t=t&&t.prototype instanceof v?t:v,t=Object.create(t.prototype),n=new S(n||[]);return l(t,"_invoke",{value:(i=e,a=r,o=n,u=p,function(e,t){if(u===h)throw Error("Generator is already running");if(u===d){if("throw"===e)throw t;return{value:s,done:!0}}for(o.method=e,o.arg=t;;){var r=o.delegate;if(r){r=function e(t,r){var n=r.method,i=t.iterator[n];if(i===s)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=s,e(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;n=f(i,t.iterator,r.arg);if("throw"===n.type)return r.method="throw",r.arg=n.arg,r.delegate=null,y;i=n.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=s),r.delegate=null,y):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}(r,o);if(r){if(r===y)continue;return r}}if("next"===o.method)o.sent=o._sent=o.arg;else if("throw"===o.method){if(u===p)throw u=d,o.arg;o.dispatchException(o.arg)}else"return"===o.method&&o.abrupt("return",o.arg);u=h;r=f(i,a,o);if("normal"===r.type){if(u=o.done?d:m,r.arg===y)continue;return{value:r.arg,done:o.done}}"throw"===r.type&&(u=d,o.method="throw",o.arg=r.arg)}})}),t}function f(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}o.wrap=u;var p="suspendedStart",m="suspendedYield",h="executing",d="completed",y={};function v(){}function g(){}function x(){}var t={},b=(a(t,n,function(){return this}),Object.getPrototypeOf),b=b&&b(b(C([]))),w=(b&&b!==e&&c.call(b,n)&&(t=b),x.prototype=v.prototype=Object.create(t));function N(e){["next","throw","return"].forEach(function(t){a(e,t,function(e){return this._invoke(t,e)})})}function D(o,u){var t;l(this,"_invoke",{value:function(r,n){function e(){return new u(function(e,t){!function t(e,r,n,i){var a,e=f(o[e],o,r);if("throw"!==e.type)return(r=(a=e.arg).value)&&"object"==F(r)&&c.call(r,"__await")?u.resolve(r.__await).then(function(e){t("next",e,n,i)},function(e){t("throw",e,n,i)}):u.resolve(r).then(function(e){a.value=e,n(a)},function(e){return t("throw",e,n,i)});i(e.arg)}(r,n,e,t)})}return t=t?t.then(e,e):e()}})}function E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function A(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function S(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function C(t){if(t||""===t){var r,e=t[n];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length))return r=-1,(e=function e(){for(;++r<t.length;)if(c.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=s,e.done=!0,e}).next=e}throw new TypeError(F(t)+" is not iterable")}return l(w,"constructor",{value:g.prototype=x,configurable:!0}),l(x,"constructor",{value:g,configurable:!0}),g.displayName=a(x,i,"GeneratorFunction"),o.isGeneratorFunction=function(e){e="function"==typeof e&&e.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},o.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,x):(e.__proto__=x,a(e,i,"GeneratorFunction")),e.prototype=Object.create(w),e},o.awrap=function(e){return{__await:e}},N(D.prototype),a(D.prototype,r,function(){return this}),o.AsyncIterator=D,o.async=function(e,t,r,n,i){void 0===i&&(i=Promise);var a=new D(u(e,t,r,n),i);return o.isGeneratorFunction(t)?a:a.next().then(function(e){return e.done?e.value:a.next()})},N(w),a(w,i,"Generator"),a(w,n,function(){return this}),a(w,"toString",function(){return"[object Generator]"}),o.keys=function(e){var t,r=Object(e),n=[];for(t in r)n.push(t);return n.reverse(),function e(){for(;n.length;){var t=n.pop();if(t in r)return e.value=t,e.done=!1,e}return e.done=!0,e}},o.values=C,S.prototype={constructor:S,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=s,this.done=!1,this.delegate=null,this.method="next",this.arg=s,this.tryEntries.forEach(A),!e)for(var t in this)"t"===t.charAt(0)&&c.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=s)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var n=this;function e(e,t){return a.type="throw",a.arg=r,n.next=e,t&&(n.method="next",n.arg=s),!!t}for(var t=this.tryEntries.length-1;0<=t;--t){var i=this.tryEntries[t],a=i.completion;if("root"===i.tryLoc)return e("end");if(i.tryLoc<=this.prev){var o=c.call(i,"catchLoc"),u=c.call(i,"finallyLoc");if(o&&u){if(this.prev<i.catchLoc)return e(i.catchLoc,!0);if(this.prev<i.finallyLoc)return e(i.finallyLoc)}else if(o){if(this.prev<i.catchLoc)return e(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return e(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;0<=r;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&c.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}var a=(i=i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc?null:i)?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),A(r),y}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r,n,i=this.tryEntries[t];if(i.tryLoc===e)return"throw"===(r=i.completion).type&&(n=r.arg,A(i)),n}throw Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:C(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=s),y}},o}M.exports=r,M.exports.__esModule=!0,M.exports.default=M.exports},3738:t=>{function r(e){return t.exports=r="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},t.exports.__esModule=!0,t.exports.default=t.exports,r(e)}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports},4756:(e,t,r)=>{r=r(4633)();e.exports=r;try{regeneratorRuntime=r}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}},9306:(e,t,r)=>{"use strict";var n=r(4901),i=r(6823),a=TypeError;e.exports=function(e){if(n(e))return e;throw new a(i(e)+" is not a function")}},5548:(e,t,r)=>{"use strict";var n=r(3517),i=r(6823),a=TypeError;e.exports=function(e){if(n(e))return e;throw new a(i(e)+" is not a constructor")}},3506:(e,t,r)=>{"use strict";var n=r(3925),i=String,a=TypeError;e.exports=function(e){if(n(e))return e;throw new a("Can't set "+i(e)+" as a prototype")}},6469:(e,t,r)=>{"use strict";var n=r(8227),i=r(2360),r=r(4913).f,a=n("unscopables"),o=Array.prototype;void 0===o[a]&&r(o,a,{configurable:!0,value:i(null)}),e.exports=function(e){o[a][e]=!0}},7829:(e,t,r)=>{"use strict";var n=r(8183).charAt;e.exports=function(e,t,r){return t+(r?n(e,t).length:1)}},679:(e,t,r)=>{"use strict";var n=r(1625),i=TypeError;e.exports=function(e,t){if(n(t,e))return e;throw new i("Incorrect invocation")}},8551:(e,t,r)=>{"use strict";var n=r(34),i=String,a=TypeError;e.exports=function(e){if(n(e))return e;throw new a(i(e)+" is not an object")}},5652:(e,t,r)=>{"use strict";r=r(9039);e.exports=r(function(){var e;"function"==typeof ArrayBuffer&&(e=new ArrayBuffer(8),Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8}))})},4373:(e,t,r)=>{"use strict";var o=r(8981),u=r(5610),s=r(6198);e.exports=function(e){for(var t=o(this),r=s(t),n=arguments.length,i=u(1<n?arguments[1]:void 0,r),n=2<n?arguments[2]:void 0,a=void 0===n?r:u(n,r);i<a;)t[i++]=e;return t}},235:(e,t,r)=>{"use strict";var n=r(9213).forEach,r=r(4598)("forEach");e.exports=r?[].forEach:function(e){return n(this,e,1<arguments.length?arguments[1]:void 0)}},7916:(e,t,r)=>{"use strict";var p=r(6080),m=r(9565),h=r(8981),d=r(6319),y=r(4209),v=r(3517),g=r(6198),x=r(4659),b=r(81),w=r(851),N=Array;e.exports=function(e){var t=h(e),e=v(this),r=arguments.length,n=1<r?arguments[1]:void 0,i=void 0!==n;i&&(n=p(n,2<r?arguments[2]:void 0));var a,o,u,s,c,l,r=w(t),f=0;if(!r||this===N&&y(r))for(a=g(t),o=e?new this(a):N(a);f<a;f++)l=i?n(t[f],f):t[f],x(o,f,l);else for(o=e?new this:[],c=(s=b(t,r)).next;!(u=m(c,s)).done;f++)l=i?d(s,n,[u.value,f],!0):u.value,x(o,f,l);return o.length=f,o}},9617:(e,t,r)=>{"use strict";function n(u){return function(e,t,r){var n=s(e),i=l(n);if(0===i)return!u&&-1;var a,o=c(r,i);if(u&&t!=t){for(;o<i;)if((a=n[o++])!=a)return!0}else for(;o<i;o++)if((u||o in n)&&n[o]===t)return u||o||0;return!u&&-1}}var s=r(5397),c=r(5610),l=r(6198);e.exports={includes:n(!0),indexOf:n(!1)}},9213:(e,t,r)=>{"use strict";function n(p){var m=1===p,h=2===p,d=3===p,y=4===p,v=6===p,g=7===p,x=5===p||v;return function(e,t,r,n){for(var i,a,o=N(e),u=w(o),s=D(u),c=b(t,r),l=0,t=n||E,f=m?t(e,s):h||g?t(e,0):void 0;l<s;l++)if((x||l in u)&&(a=c(i=u[l],l,o),p))if(m)f[l]=a;else if(a)switch(p){case 3:return!0;case 5:return i;case 6:return l;case 2:A(f,i)}else switch(p){case 4:return!1;case 7:A(f,i)}return v?-1:d||y?y:f}}var b=r(6080),i=r(9504),w=r(7055),N=r(8981),D=r(6198),E=r(1469),A=i([].push);e.exports={forEach:n(0),map:n(1),filter:n(2),some:n(3),every:n(4),find:n(5),findIndex:n(6),filterReject:n(7)}},597:(e,t,r)=>{"use strict";var n=r(9039),i=r(8227),a=r(7388),o=i("species");e.exports=function(t){return 51<=a||!n(function(){var e=[];return(e.constructor={})[o]=function(){return{foo:1}},1!==e[t](Boolean).foo})}},4598:(e,t,r)=>{"use strict";var n=r(9039);e.exports=function(e,t){var r=[][e];return!!r&&n(function(){r.call(null,t||function(){return 1},1)})}},926:(e,t,r)=>{"use strict";function n(c){return function(e,t,r,n){var i=f(e),a=p(i),o=m(i);if(l(t),0===o&&r<2)throw new h(d);var u=c?o-1:0,s=c?-1:1;if(r<2)for(;;){if(u in a){n=a[u],u+=s;break}if(u+=s,c?u<0:o<=u)throw new h(d)}for(;c?0<=u:u<o;u+=s)u in a&&(n=t(n,a[u],u,i));return n}}var l=r(9306),f=r(8981),p=r(7055),m=r(6198),h=TypeError,d="Reduce of empty array with no initial value";e.exports={left:n(!1),right:n(!0)}},4527:(e,t,r)=>{"use strict";var n=r(3724),i=r(4376),a=TypeError,o=Object.getOwnPropertyDescriptor,r=n&&!function(){if(void 0!==this)return 1;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(e){return e instanceof TypeError}}();e.exports=r?function(e,t){if(i(e)&&!o(e,"length").writable)throw new a("Cannot set read only .length");return e.length=t}:function(e,t){return e.length=t}},7680:(e,t,r)=>{"use strict";r=r(9504);e.exports=r([].slice)},4488:(e,t,r)=>{"use strict";function m(e,t){var r=e.length;if(r<8)for(var n,i,a=1;a<r;){for(n=e[i=a];i&&0<t(e[i-1],n);)e[i]=e[--i];i!==a++&&(e[i]=n)}else for(var o=d(r/2),u=m(h(e,0,o),t),s=m(h(e,o),t),c=u.length,l=s.length,f=0,p=0;f<c||p<l;)e[f+p]=f<c&&p<l?t(u[f],s[p])<=0?u[f++]:s[p++]:f<c?u[f++]:s[p++];return e}var h=r(7680),d=Math.floor;e.exports=m},7433:(e,t,r)=>{"use strict";var n=r(4376),i=r(3517),a=r(34),o=r(8227)("species"),u=Array;e.exports=function(e){var t;return n(e)&&(t=e.constructor,(i(t)&&(t===u||n(t.prototype))||a(t)&&null===(t=t[o]))&&(t=void 0)),void 0===t?u:t}},1469:(e,t,r)=>{"use strict";var n=r(7433);e.exports=function(e,t){return new(n(e))(0===t?0:t)}},6319:(e,t,r)=>{"use strict";var i=r(8551),a=r(9539);e.exports=function(e,t,r,n){try{return n?t(i(r)[0],r[1]):t(r)}catch(t){a(e,"throw",t)}}},4428:(e,t,r)=>{"use strict";var i=r(8227)("iterator"),a=!1;try{var n=0,o={next:function(){return{done:!!n++}},return:function(){a=!0}};o[i]=function(){return this},Array.from(o,function(){throw 2})}catch(e){}e.exports=function(e,t){try{if(!t&&!a)return!1}catch(e){return!1}var r=!1;try{var n={};n[i]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(e){}return r}},4576:(e,t,r)=>{"use strict";var r=r(9504),n=r({}.toString),i=r("".slice);e.exports=function(e){return i(n(e),8,-1)}},6955:(e,t,r)=>{"use strict";var n=r(2140),i=r(4901),a=r(4576),o=r(8227)("toStringTag"),u=Object,s="Arguments"===a(function(){return arguments}());e.exports=n?a:function(e){var t;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(t=function(e,t){try{return e[t]}catch(e){}}(e=u(e),o))?t:s?a(e):"Object"===(t=a(e))&&i(e.callee)?"Arguments":t}},6938:(e,t,r)=>{"use strict";var c=r(2360),l=r(2106),f=r(6279),p=r(6080),m=r(679),h=r(4117),d=r(2652),o=r(1088),u=r(2529),s=r(7633),y=r(3724),v=r(3451).fastKey,r=r(1181),g=r.set,x=r.getterFor;e.exports={getConstructor:function(e,r,n,i){function a(e,t,r){var n,i=s(e),a=o(e,t);return a?a.value=r:(i.last=a={index:n=v(t,!0),key:t,value:r,previous:t=i.last,next:void 0,removed:!1},i.first||(i.first=a),t&&(t.next=a),y?i.size++:e.size++,"F"!==n&&(i.index[n]=a)),e}function o(e,t){var r,e=s(e),n=v(t);if("F"!==n)return e.index[n];for(r=e.first;r;r=r.next)if(r.key===t)return r}var e=e(function(e,t){m(e,u),g(e,{type:r,index:c(null),first:void 0,last:void 0,size:0}),y||(e.size=0),h(t)||d(t,e[i],{that:e,AS_ENTRIES:n})}),u=e.prototype,s=x(r);return f(u,{clear:function(){for(var e=s(this),t=e.first;t;)t.removed=!0,t.previous&&(t.previous=t.previous.next=void 0),t=t.next;e.first=e.last=void 0,e.index=c(null),y?e.size=0:this.size=0},delete:function(e){var t,r,n=s(this),e=o(this,e);return e&&(t=e.next,r=e.previous,delete n.index[e.index],e.removed=!0,r&&(r.next=t),t&&(t.previous=r),n.first===e&&(n.first=t),n.last===e&&(n.last=r),y?n.size--:this.size--),!!e},forEach:function(e){for(var t,r=s(this),n=p(e,1<arguments.length?arguments[1]:void 0);t=t?t.next:r.first;)for(n(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!o(this,e)}}),f(u,n?{get:function(e){e=o(this,e);return e&&e.value},set:function(e,t){return a(this,0===e?0:e,t)}}:{add:function(e){return a(this,e=0===e?0:e,e)}}),y&&l(u,"size",{configurable:!0,get:function(){return s(this).size}}),e},setStrong:function(e,t,r){var n=t+" Iterator",i=x(t),a=x(n);o(e,t,function(e,t){g(this,{type:n,target:e,state:i(e),kind:t,last:void 0})},function(){for(var e=a(this),t=e.kind,r=e.last;r&&r.removed;)r=r.previous;return e.target&&(e.last=r=r?r.next:e.state.first)?u("keys"===t?r.key:"values"===t?r.value:[r.key,r.value],!1):(e.target=void 0,u(void 0,!0))},r?"entries":"values",!r,!0),s(t)}}},6468:(e,t,r)=>{"use strict";var y=r(6518),v=r(4475),g=r(9504),x=r(2796),b=r(6840),w=r(3451),N=r(2652),D=r(679),E=r(4901),A=r(4117),S=r(34),C=r(9039),M=r(4428),F=r(687),O=r(3167);e.exports=function(e,t,r){function n(e){var r=g(m[e]);b(m,e,"add"===e?function(e){return r(this,0===e?0:e),this}:"delete"===e?function(e){return!(l&&!S(e))&&r(this,0===e?0:e)}:"get"===e?function(e){return l&&!S(e)?void 0:r(this,0===e?0:e)}:"has"===e?function(e){return!(l&&!S(e))&&r(this,0===e?0:e)}:function(e,t){return r(this,0===e?0:e,t),this})}var i,a,o,u,s,c=-1!==e.indexOf("Map"),l=-1!==e.indexOf("Weak"),f=c?"set":"add",p=v[e],m=p&&p.prototype,h=p,d={};return x(e,!E(p)||!(l||m.forEach&&!C(function(){(new p).entries().next()})))?(h=r.getConstructor(t,e,c,f),w.enable()):x(e,!0)&&(a=(i=new h)[f](l?{}:-0,1)!==i,o=C(function(){i.has(1)}),u=M(function(e){new p(e)}),s=!l&&C(function(){for(var e=new p,t=5;t--;)e[f](t,t);return!e.has(-0)}),u||(((h=t(function(e,t){D(e,m);e=O(new p,e,h);return A(t)||N(t,e[f],{that:e,AS_ENTRIES:c}),e})).prototype=m).constructor=h),(o||s)&&(n("delete"),n("has"),c&&n("get")),(s||a)&&n(f),l&&m.clear&&delete m.clear),d[e]=h,y({global:!0,constructor:!0,forced:h!==p},d),F(h,e),l||r.setStrong(h,e,c),h}},7740:(e,t,r)=>{"use strict";var s=r(9297),c=r(5031),l=r(7347),f=r(4913);e.exports=function(e,t,r){for(var n=c(t),i=f.f,a=l.f,o=0;o<n.length;o++){var u=n[o];s(e,u)||r&&s(r,u)||i(e,u,a(t,u))}}},1436:(e,t,r)=>{"use strict";var n=r(8227)("match");e.exports=function(t){var r=/./;try{"/./"[t](r)}catch(e){try{return r[n]=!1,"/./"[t](r)}catch(t){}}return!1}},2211:(e,t,r)=>{"use strict";r=r(9039);e.exports=!r(function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})},7240:(e,t,r)=>{"use strict";var n=r(9504),a=r(7750),o=r(655),u=/"/g,s=n("".replace);e.exports=function(e,t,r,n){var e=o(a(e)),i="<"+t;return""!==r&&(i+=" "+r+'="'+s(o(n),u,"&quot;")+'"'),i+">"+e+"</"+t+">"}},2529:e=>{"use strict";e.exports=function(e,t){return{value:e,done:t}}},6699:(e,t,r)=>{"use strict";var n=r(3724),i=r(4913),a=r(6980);e.exports=n?function(e,t,r){return i.f(e,t,a(1,r))}:function(e,t,r){return e[t]=r,e}},6980:e=>{"use strict";e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},4659:(e,t,r)=>{"use strict";var n=r(3724),i=r(4913),a=r(6980);e.exports=function(e,t,r){n?i.f(e,t,a(0,r)):e[t]=r}},2106:(e,t,r)=>{"use strict";var n=r(283),i=r(4913);e.exports=function(e,t,r){return r.get&&n(r.get,t,{getter:!0}),r.set&&n(r.set,t,{setter:!0}),i.f(e,t,r)}},6840:(e,t,r)=>{"use strict";var o=r(4901),u=r(4913),s=r(283),c=r(9433);e.exports=function(e,t,r,n){var i=(n=n||{}).enumerable,a=void 0!==n.name?n.name:t;if(o(r)&&s(r,a,n),n.global)i?e[t]=r:c(t,r);else{try{n.unsafe?e[t]&&(i=!0):delete e[t]}catch(e){}i?e[t]=r:u.f(e,t,{value:r,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return e}},6279:(e,t,r)=>{"use strict";var i=r(6840);e.exports=function(e,t,r){for(var n in t)i(e,n,t[n],r);return e}},9433:(e,t,r)=>{"use strict";var n=r(4475),i=Object.defineProperty;e.exports=function(t,r){try{i(n,t,{value:r,configurable:!0,writable:!0})}catch(e){n[t]=r}return r}},4606:(e,t,r)=>{"use strict";var n=r(6823),i=TypeError;e.exports=function(e,t){if(!delete e[t])throw new i("Cannot delete property "+n(t)+" of "+n(e))}},3724:(e,t,r)=>{"use strict";r=r(9039);e.exports=!r(function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})},4055:(e,t,r)=>{"use strict";var n=r(4475),r=r(34),i=n.document,a=r(i)&&r(i.createElement);e.exports=function(e){return a?i.createElement(e):{}}},6837:e=>{"use strict";var t=TypeError;e.exports=function(e){if(9007199254740991<e)throw t("Maximum allowed index exceeded");return e}},7400:e=>{"use strict";e.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},9296:(e,t,r)=>{"use strict";r=r(4055)("span").classList,r=r&&r.constructor&&r.constructor.prototype;e.exports=r===Object.prototype?void 0:r},8834:(e,t,r)=>{"use strict";r=r(9392).match(/firefox\/(\d+)/i);e.exports=!!r&&+r[1]},7290:(e,t,r)=>{"use strict";var n=r(516),r=r(9088);e.exports=!n&&!r&&"object"==typeof window&&"object"==typeof document},516:e=>{"use strict";e.exports="object"==typeof Deno&&Deno&&"object"==typeof Deno.version},3202:(e,t,r)=>{"use strict";r=r(9392);e.exports=/MSIE|Trident/.test(r)},28:(e,t,r)=>{"use strict";r=r(9392);e.exports=/ipad|iphone|ipod/i.test(r)&&"undefined"!=typeof Pebble},8119:(e,t,r)=>{"use strict";r=r(9392);e.exports=/(?:ipad|iphone|ipod).*applewebkit/i.test(r)},9088:(e,t,r)=>{"use strict";var n=r(4475),r=r(4576);e.exports="process"===r(n.process)},6765:(e,t,r)=>{"use strict";r=r(9392);e.exports=/web0s(?!.*chrome)/i.test(r)},9392:e=>{"use strict";e.exports="undefined"!=typeof navigator&&String(navigator.userAgent)||""},7388:(e,t,r)=>{"use strict";var n,i,a=r(4475),r=r(9392),o=a.process,a=a.Deno,o=o&&o.versions||a&&a.version,a=o&&o.v8;!(i=a?0<(n=a.split("."))[0]&&n[0]<4?1:+(n[0]+n[1]):i)&&r&&(!(n=r.match(/Edge\/(\d+)/))||74<=n[1])&&(n=r.match(/Chrome\/(\d+)/))&&(i=+n[1]),e.exports=i},9160:(e,t,r)=>{"use strict";r=r(9392).match(/AppleWebKit\/(\d+)\./);e.exports=!!r&&+r[1]},8727:e=>{"use strict";e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},6518:(e,t,r)=>{"use strict";var c=r(4475),l=r(7347).f,f=r(6699),p=r(6840),m=r(9433),h=r(7740),d=r(2796);e.exports=function(e,t){var r,n,i,a,o=e.target,u=e.global,s=e.stat;if(r=u?c:s?c[o]||m(o,{}):c[o]&&c[o].prototype)for(n in t){if(i=t[n],a=e.dontCallGetSet?(a=l(r,n))&&a.value:r[n],!d(u?n:o+(s?".":"#")+n,e.forced)&&void 0!==a){if(typeof i==typeof a)continue;h(i,a)}(e.sham||a&&a.sham)&&f(i,"sham",!0),p(r,n,i,e)}}},9039:e=>{"use strict";e.exports=function(e){try{return!!e()}catch(e){return!0}}},9228:(e,t,r)=>{"use strict";r(7495);var s=r(9565),c=r(6840),l=r(7323),f=r(9039),p=r(8227),m=r(6699),h=p("species"),d=RegExp.prototype;e.exports=function(r,e,t,n){var o,i=p(r),u=!f(function(){var e={};return e[i]=function(){return 7},7!==""[r](e)}),a=u&&!f(function(){var e=!1,t=/a/;return"split"===r&&((t={}).constructor={},t.constructor[h]=function(){return t},t.flags="",t[i]=/./[i]),t.exec=function(){return e=!0,null},t[i](""),!e});u&&a&&!t||(o=/./[i],a=e(i,""[r],function(e,t,r,n,i){var a=t.exec;return a===l||a===d.exec?u&&!i?{done:!0,value:s(o,t,r,n)}:{done:!0,value:s(e,r,t,n)}:{done:!1}}),c(String.prototype,r,a[0]),c(d,i,a[1])),n&&m(d[i],"sham",!0)}},2744:(e,t,r)=>{"use strict";r=r(9039);e.exports=!r(function(){return Object.isExtensible(Object.preventExtensions({}))})},8745:(e,t,r)=>{"use strict";var r=r(616),n=Function.prototype,i=n.apply,a=n.call;e.exports="object"==typeof Reflect&&Reflect.apply||(r?a.bind(i):function(){return a.apply(i,arguments)})},6080:(e,t,r)=>{"use strict";var n=r(7476),i=r(9306),a=r(616),o=n(n.bind);e.exports=function(e,t){return i(e),void 0===t?e:a?o(e,t):function(){return e.apply(t,arguments)}}},616:(e,t,r)=>{"use strict";r=r(9039);e.exports=!r(function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})},566:(e,t,r)=>{"use strict";var n=r(9504),i=r(9306),a=r(34),l=r(9297),f=r(7680),r=r(616),p=Function,m=n([].concat),h=n([].join),d={};e.exports=r?p.bind:function(o){var u=i(this),e=u.prototype,s=f(arguments,1),c=function(){var e=m(s,f(arguments));if(this instanceof c){var t=u,r=e.length,n=e;if(!l(d,r)){for(var i=[],a=0;a<r;a++)i[a]="a["+a+"]";d[r]=p("C,a","return new C("+h(i,",")+")")}return d[r](t,n)}return u.apply(o,e)};return a(e)&&(c.prototype=e),c}},9565:(e,t,r)=>{"use strict";var r=r(616),n=Function.prototype.call;e.exports=r?n.bind(n):function(){return n.apply(n,arguments)}},350:(e,t,r)=>{"use strict";var n=r(3724),r=r(9297),i=Function.prototype,a=n&&Object.getOwnPropertyDescriptor,r=r(i,"name"),o=r&&"something"===function(){}.name,n=r&&(!n||a(i,"name").configurable);e.exports={EXISTS:r,PROPER:o,CONFIGURABLE:n}},6706:(e,t,r)=>{"use strict";var n=r(9504),i=r(9306);e.exports=function(e,t,r){try{return n(i(Object.getOwnPropertyDescriptor(e,t)[r]))}catch(e){}}},7476:(e,t,r)=>{"use strict";var n=r(4576),i=r(9504);e.exports=function(e){if("Function"===n(e))return i(e)}},9504:(e,t,r)=>{"use strict";var r=r(616),n=Function.prototype,i=n.call,n=r&&n.bind.bind(i,i);e.exports=r?n:function(e){return function(){return i.apply(e,arguments)}}},7751:(e,t,r)=>{"use strict";var n=r(4475),i=r(4901);e.exports=function(e,t){return arguments.length<2?(r=n[e],i(r)?r:void 0):n[e]&&n[e][t];var r}},851:(e,t,r)=>{"use strict";var n=r(6955),i=r(5966),a=r(4117),o=r(6269),u=r(8227)("iterator");e.exports=function(e){if(!a(e))return i(e,u)||i(e,"@@iterator")||o[n(e)]}},81:(e,t,r)=>{"use strict";var n=r(9565),i=r(9306),a=r(8551),o=r(6823),u=r(851),s=TypeError;e.exports=function(e,t){t=arguments.length<2?u(e):t;if(i(t))return a(n(t,e));throw new s(o(e)+" is not iterable")}},6933:(e,t,r)=>{"use strict";var n=r(9504),u=r(4376),s=r(4901),c=r(4576),l=r(655),f=n([].push);e.exports=function(e){if(s(e))return e;if(u(e)){for(var t=e.length,n=[],r=0;r<t;r++){var i=e[r];"string"==typeof i?f(n,i):"number"!=typeof i&&"Number"!==c(i)&&"String"!==c(i)||f(n,l(i))}var a=n.length,o=!0;return function(e,t){if(o)return o=!1,t;if(u(this))return t;for(var r=0;r<a;r++)if(n[r]===e)return t}}}},5966:(e,t,r)=>{"use strict";var n=r(9306),i=r(4117);e.exports=function(e,t){e=e[t];return i(e)?void 0:n(e)}},2478:(e,t,r)=>{"use strict";var n=r(9504),i=r(8981),p=Math.floor,m=n("".charAt),h=n("".replace),d=n("".slice),y=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,v=/\$([$&'`]|\d{1,2})/g;e.exports=function(a,o,u,s,c,e){var l=u+a.length,f=s.length,t=v;return void 0!==c&&(c=i(c),t=y),h(e,t,function(e,t){var r;switch(m(t,0)){case"$":return"$";case"&":return a;case"`":return d(o,0,u);case"'":return d(o,l);case"<":r=c[d(t,1,-1)];break;default:var n,i=+t;if(0==i)return e;if(f<i)return 0!==(n=p(i/10))&&n<=f?void 0===s[n-1]?m(t,1):s[n-1]+m(t,1):e;r=s[i-1]}return void 0===r?"":r})}},4475:function(e){"use strict";function t(e){return e&&e.Math===Math&&e}e.exports=t("object"==typeof globalThis&&globalThis)||t("object"==typeof window&&window)||t("object"==typeof self&&self)||t("object"==typeof global&&global)||t("object"==typeof this&&this)||function(){return this}()||Function("return this")()},9297:(e,t,r)=>{"use strict";var n=r(9504),i=r(8981),a=n({}.hasOwnProperty);e.exports=Object.hasOwn||function(e,t){return a(i(e),t)}},421:e=>{"use strict";e.exports={}},3138:e=>{"use strict";e.exports=function(e,t){try{1===arguments.length?console.error(e):console.error(e,t)}catch(e){}}},397:(e,t,r)=>{"use strict";r=r(7751);e.exports=r("document","documentElement")},5917:(e,t,r)=>{"use strict";var n=r(3724),i=r(9039),a=r(4055);e.exports=!n&&!i(function(){return 7!==Object.defineProperty(a("div"),"a",{get:function(){return 7}}).a})},7055:(e,t,r)=>{"use strict";var n=r(9504),i=r(9039),a=r(4576),o=Object,u=n("".split);e.exports=i(function(){return!o("z").propertyIsEnumerable(0)})?function(e){return"String"===a(e)?u(e,""):o(e)}:o},3167:(e,t,r)=>{"use strict";var n=r(4901),i=r(34),a=r(2967);e.exports=function(e,t,r){return a&&n(t=t.constructor)&&t!==r&&i(t=t.prototype)&&t!==r.prototype&&a(e,t),e}},3706:(e,t,r)=>{"use strict";var n=r(9504),i=r(4901),r=r(7629),a=n(Function.toString);i(r.inspectSource)||(r.inspectSource=function(e){return a(e)}),e.exports=r.inspectSource},3451:(e,t,r)=>{"use strict";function n(e){c(e,y,{value:{objectID:"O"+v++,weakData:{}}})}var o=r(6518),u=r(9504),i=r(421),a=r(34),s=r(9297),c=r(4913).f,l=r(8480),f=r(298),p=r(4124),m=r(3392),h=r(2744),d=!1,y=m("meta"),v=0,g=e.exports={enable:function(){g.enable=function(){},d=!0;var i=l.f,a=u([].splice),e={};e[y]=1,i(e).length&&(l.f=function(e){for(var t=i(e),r=0,n=t.length;r<n;r++)if(t[r]===y){a(t,r,1);break}return t},o({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:f.f}))},fastKey:function(e,t){if(!a(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!s(e,y)){if(!p(e))return"F";if(!t)return"E";n(e)}return e[y].objectID},getWeakData:function(e,t){if(!s(e,y)){if(!p(e))return!0;if(!t)return!1;n(e)}return e[y].weakData},onFreeze:function(e){return h&&d&&p(e)&&!s(e,y)&&n(e),e}};i[y]=!0},1181:(e,t,r)=>{"use strict";var n,i,a,o,u=r(8622),s=r(4475),c=r(34),l=r(6699),f=r(9297),p=r(7629),m=r(6119),r=r(421),h="Object already initialized",d=s.TypeError,s=s.WeakMap,y=u||p.state?((a=p.state||(p.state=new s)).get=a.get,a.has=a.has,a.set=a.set,n=function(e,t){if(a.has(e))throw new d(h);return t.facade=e,a.set(e,t),t},i=function(e){return a.get(e)||{}},function(e){return a.has(e)}):(r[o=m("state")]=!0,n=function(e,t){if(f(e,o))throw new d(h);return t.facade=e,l(e,o,t),t},i=function(e){return f(e,o)?e[o]:{}},function(e){return f(e,o)});e.exports={set:n,get:i,has:y,enforce:function(e){return y(e)?i(e):n(e,{})},getterFor:function(t){return function(e){if(c(e)&&(e=i(e)).type===t)return e;throw new d("Incompatible receiver, "+t+" required")}}}},4209:(e,t,r)=>{"use strict";var n=r(8227),i=r(6269),a=n("iterator"),o=Array.prototype;e.exports=function(e){return void 0!==e&&(i.Array===e||o[a]===e)}},4376:(e,t,r)=>{"use strict";var n=r(4576);e.exports=Array.isArray||function(e){return"Array"===n(e)}},4901:e=>{"use strict";var t="object"==typeof document&&document.all;e.exports=void 0===t&&void 0!==t?function(e){return"function"==typeof e||e===t}:function(e){return"function"==typeof e}},3517:(e,t,r)=>{"use strict";function n(){}function i(e){if(!s(e))return!1;try{return p(n,[],e),!0}catch(e){return!1}}function a(e){if(!s(e))return!1;switch(c(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return d||!!h(m,f(e))}catch(e){return!0}}var o=r(9504),u=r(9039),s=r(4901),c=r(6955),l=r(7751),f=r(3706),p=l("Reflect","construct"),m=/^\s*(?:class|function)\b/,h=o(m.exec),d=!m.test(n);a.sham=!0,e.exports=!p||u(function(){var e;return i(i.call)||!i(Object)||!i(function(){e=!0})||e})?a:i},2796:(e,t,r)=>{"use strict";function n(e,t){return(e=s[u(e)])===l||e!==c&&(a(t)?i(t):!!t)}var i=r(9039),a=r(4901),o=/#|\.prototype\./,u=n.normalize=function(e){return String(e).replace(o,".").toLowerCase()},s=n.data={},c=n.NATIVE="N",l=n.POLYFILL="P";e.exports=n},4117:e=>{"use strict";e.exports=function(e){return null==e}},34:(e,t,r)=>{"use strict";var n=r(4901);e.exports=function(e){return"object"==typeof e?null!==e:n(e)}},3925:(e,t,r)=>{"use strict";var n=r(34);e.exports=function(e){return n(e)||null===e}},6395:e=>{"use strict";e.exports=!1},788:(e,t,r)=>{"use strict";var n=r(34),i=r(4576),a=r(8227)("match");e.exports=function(e){var t;return n(e)&&(void 0!==(t=e[a])?!!t:"RegExp"===i(e))}},757:(e,t,r)=>{"use strict";var n=r(7751),i=r(4901),a=r(1625),r=r(7040),o=Object;e.exports=r?function(e){return"symbol"==typeof e}:function(e){var t=n("Symbol");return i(t)&&a(t.prototype,o(e))}},2652:(e,t,r)=>{"use strict";function v(e,t){this.stopped=e,this.result=t}var g=r(6080),x=r(9565),b=r(8551),w=r(6823),N=r(4209),D=r(6198),E=r(1625),A=r(81),S=r(851),C=r(9539),M=TypeError,F=v.prototype;e.exports=function(e,t,r){function n(e){return a&&C(a,"normal",e),new v(!0,e)}function i(e){return p?(b(e),d?y(e[0],e[1],n):y(e[0],e[1])):d?y(e,n):y(e)}var a,o,u,s,c,l,f=r&&r.that,p=!(!r||!r.AS_ENTRIES),m=!(!r||!r.IS_RECORD),h=!(!r||!r.IS_ITERATOR),d=!(!r||!r.INTERRUPTED),y=g(t,f);if(m)a=e.iterator;else if(h)a=e;else{if(!(r=S(e)))throw new M(w(e)+" is not iterable");if(N(r)){for(o=0,u=D(e);o<u;o++)if((s=i(e[o]))&&E(F,s))return s;return new v(!1)}a=A(e,r)}for(c=(m?e:a).next;!(l=x(c,a)).done;){try{s=i(l.value)}catch(e){C(a,"throw",e)}if("object"==typeof s&&s&&E(F,s))return s}return new v(!1)}},9539:(e,t,r)=>{"use strict";var a=r(9565),o=r(8551),u=r(5966);e.exports=function(e,t,r){var n,i;o(e);try{if(!(n=u(e,"return"))){if("throw"===t)throw r;return r}n=a(n,e)}catch(e){i=!0,n=e}if("throw"===t)throw r;if(i)throw n;return o(n),r}},3994:(e,t,r)=>{"use strict";function i(){return this}var a=r(7657).IteratorPrototype,o=r(2360),u=r(6980),s=r(687),c=r(6269);e.exports=function(e,t,r,n){t+=" Iterator";return e.prototype=o(a,{next:u(+!n,r)}),s(e,t,!1,!0),c[t]=i,e}},1088:(e,t,r)=>{"use strict";function d(){return this}var y=r(6518),v=r(9565),g=r(6395),n=r(350),x=r(4901),b=r(3994),w=r(2787),N=r(2967),D=r(687),E=r(6699),A=r(6840),i=r(8227),S=r(6269),r=r(7657),C=n.PROPER,M=n.CONFIGURABLE,F=r.IteratorPrototype,O=r.BUGGY_SAFARI_ITERATORS,T=i("iterator"),_="values",B="entries";e.exports=function(e,t,r,n,i,a,o){b(r,t,n);function u(e){if(e===i&&m)return m;if(!O&&e&&e in f)return f[e];switch(e){case"keys":case _:case B:return function(){return new r(this,e)}}return function(){return new r(this)}}var s,c,n=t+" Iterator",l=!1,f=e.prototype,p=f[T]||f["@@iterator"]||i&&f[i],m=!O&&p||u(i),h="Array"===t&&f.entries||p;if(h&&(h=w(h.call(new e)))!==Object.prototype&&h.next&&(g||w(h)===F||(N?N(h,F):x(h[T])||A(h,T,d)),D(h,n,!0,!0),g&&(S[n]=d)),C&&i===_&&p&&p.name!==_&&(!g&&M?E(f,"name",_):(l=!0,m=function(){return v(p,this)})),i)if(s={values:u(_),keys:a?m:u("keys"),entries:u(B)},o)for(c in s)!O&&!l&&c in f||A(f,c,s[c]);else y({target:t,proto:!0,forced:O||l},s);return g&&!o||f[T]===m||A(f,T,m,{name:i}),S[t]=m,s}},7657:(e,t,r)=>{"use strict";var n,i,a=r(9039),o=r(4901),u=r(34),s=r(2360),c=r(2787),l=r(6840),f=r(8227),r=r(6395),p=f("iterator"),f=!1;[].keys&&("next"in(i=[].keys())?(c=c(c(i)))!==Object.prototype&&(n=c):f=!0),!u(n)||a(function(){var e={};return n[p].call(e)!==e})?n={}:r&&(n=s(n)),o(n[p])||l(n,p,function(){return this}),e.exports={IteratorPrototype:n,BUGGY_SAFARI_ITERATORS:f}},6269:e=>{"use strict";e.exports={}},6198:(e,t,r)=>{"use strict";var n=r(8014);e.exports=function(e){return n(e.length)}},283:(e,t,r)=>{"use strict";var n=r(9504),i=r(9039),a=r(4901),o=r(9297),u=r(3724),s=r(350).CONFIGURABLE,c=r(3706),r=r(1181),l=r.enforce,f=r.get,p=String,m=Object.defineProperty,h=n("".slice),d=n("".replace),y=n([].join),v=u&&!i(function(){return 8!==m(function(){},"length",{value:8}).length}),g=String(String).split("String"),r=e.exports=function(e,t,r){"Symbol("===h(p(t),0,7)&&(t="["+d(p(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),r&&r.getter&&(t="get "+t),r&&r.setter&&(t="set "+t),(!o(e,"name")||s&&e.name!==t)&&(u?m(e,"name",{value:t,configurable:!0}):e.name=t),v&&r&&o(r,"arity")&&e.length!==r.arity&&m(e,"length",{value:r.arity});try{r&&o(r,"constructor")&&r.constructor?u&&m(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}r=l(e);return o(r,"source")||(r.source=y(g,"string"==typeof t?t:"")),e};Function.prototype.toString=r(function(){return a(this)&&f(this).source||c(this)},"toString")},3250:e=>{"use strict";var t=Math.expm1,r=Math.exp;e.exports=!t||22025.465794806718<t(10)||t(10)<22025.465794806718||-2e-17!==t(-2e-17)?function(e){e=+e;return 0==e?e:-1e-6<e&&e<1e-6?e+e*e/2:r(e)-1}:t},9340:e=>{"use strict";var t=Math.log,r=Math.LOG10E;e.exports=Math.log10||function(e){return t(e)*r}},5359:e=>{"use strict";var t=Math.log;e.exports=Math.log1p||function(e){e=+e;return-1e-8<e&&e<1e-8?e-e*e/2:t(1+e)}},7782:e=>{"use strict";e.exports=Math.sign||function(e){e=+e;return 0==e||e!=e?e:e<0?-1:1}},741:e=>{"use strict";var t=Math.ceil,r=Math.floor;e.exports=Math.trunc||function(e){e=+e;return(0<e?r:t)(e)}},1955:(e,t,r)=>{"use strict";var n,i,a,o,u,s,c=r(4475),l=r(3389),f=r(6080),p=r(9225).set,m=r(8265),h=r(8119),d=r(28),y=r(6765),v=r(9088),r=c.MutationObserver||c.WebKitMutationObserver,g=c.document,x=c.process,b=c.Promise,l=l("queueMicrotask");l||(o=new m,u=function(){var e,t;for(v&&(e=x.domain)&&e.exit();t=o.get();)try{t()}catch(e){throw o.head&&s(),e}e&&e.enter()},s=h||v||y||!r||!g?!d&&b&&b.resolve?((m=b.resolve(void 0)).constructor=b,a=f(m.then,m),function(){a(u)}):v?function(){x.nextTick(u)}:(p=f(p,c),function(){p(u)}):(n=!0,i=g.createTextNode(""),new r(u).observe(i,{characterData:!0}),function(){i.data=n=!n}),l=function(e){o.head||s(),o.add(e)}),e.exports=l},6043:(e,t,r)=>{"use strict";function n(e){var r,n;this.promise=new e(function(e,t){if(void 0!==r||void 0!==n)throw new a("Bad Promise constructor");r=e,n=t}),this.resolve=i(r),this.reject=i(n)}var i=r(9306),a=TypeError;e.exports.f=function(e){return new n(e)}},511:(e,t,r)=>{"use strict";var n=r(788),i=TypeError;e.exports=function(e){if(n(e))throw new i("The method doesn't accept regular expressions");return e}},3904:(e,t,r)=>{"use strict";var n=r(4475),i=r(9039),a=r(9504),o=r(655),u=r(3802).trim,r=r(7452),s=a("".charAt),c=n.parseFloat,a=n.Symbol,l=a&&a.iterator,n=1/c(r+"-0")!=-1/0||l&&!i(function(){c(Object(l))});e.exports=n?function(e){var e=u(o(e)),t=c(e);return 0===t&&"-"===s(e,0)?-0:t}:c},2703:(e,t,r)=>{"use strict";var n=r(4475),i=r(9039),a=r(9504),o=r(655),u=r(3802).trim,r=r(7452),s=n.parseInt,n=n.Symbol,c=n&&n.iterator,l=/^[+-]?0x/i,f=a(l.exec),n=8!==s(r+"08")||22!==s(r+"0x16")||c&&!i(function(){s(Object(c))});e.exports=n?function(e,t){e=u(o(e));return s(e,t>>>0||(f(l,e)?16:10))}:s},2360:(e,t,r)=>{"use strict";function n(){}function i(e){e.write(d("")),e.close();var t=e.parentWindow.Object;return e=null,t}var a,o=r(8551),u=r(6801),s=r(8727),c=r(421),l=r(397),f=r(4055),r=r(6119),p="prototype",m="script",h=r("IE_PROTO"),d=function(e){return"<"+m+">"+e+"</"+m+">"},y=function(){try{a=new ActiveXObject("htmlfile")}catch(e){}var e,t,r;y="undefined"==typeof document||document.domain&&a?i(a):(t=f("iframe"),r="java"+m+":",t.style.display="none",l.appendChild(t),t.src=String(r),(e=t.contentWindow.document).open(),e.write(d("document.F=Object")),e.close(),e.F);for(var n=s.length;n--;)delete y[p][s[n]];return y()};c[h]=!0,e.exports=Object.create||function(e,t){var r;return null!==e?(n[p]=o(e),r=new n,n[p]=null,r[h]=e):r=y(),void 0===t?r:u.f(r,t)}},6801:(e,t,r)=>{"use strict";var n=r(3724),i=r(8686),u=r(4913),s=r(8551),c=r(5397),l=r(1072);t.f=n&&!i?Object.defineProperties:function(e,t){s(e);for(var r,n=c(t),i=l(t),a=i.length,o=0;o<a;)u.f(e,r=i[o++],n[r]);return e}},4913:(e,t,r)=>{"use strict";var n=r(3724),i=r(5917),a=r(8686),o=r(8551),u=r(6969),s=TypeError,c=Object.defineProperty,l=Object.getOwnPropertyDescriptor,f="enumerable",p="configurable",m="writable";t.f=n?a?function(e,t,r){var n;return o(e),t=u(t),o(r),"function"==typeof e&&"prototype"===t&&"value"in r&&m in r&&!r[m]&&(n=l(e,t))&&n[m]&&(e[t]=r.value,r={configurable:(p in r?r:n)[p],enumerable:(f in r?r:n)[f],writable:!1}),c(e,t,r)}:c:function(e,t,r){if(o(e),t=u(t),o(r),i)try{return c(e,t,r)}catch(e){}if("get"in r||"set"in r)throw new s("Accessors not supported");return"value"in r&&(e[t]=r.value),e}},7347:(e,t,r)=>{"use strict";var n=r(3724),i=r(9565),a=r(8773),o=r(6980),u=r(5397),s=r(6969),c=r(9297),l=r(5917),f=Object.getOwnPropertyDescriptor;t.f=n?f:function(e,t){if(e=u(e),t=s(t),l)try{return f(e,t)}catch(e){}if(c(e,t))return o(!i(a.f,e,t),e[t])}},298:(e,t,r)=>{"use strict";var n=r(4576),i=r(5397),a=r(8480).f,o=r(7680),u="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];e.exports.f=function(e){if(!u||"Window"!==n(e))return a(i(e));var t=e;try{return a(t)}catch(t){return o(u)}}},8480:(e,t,r)=>{"use strict";var n=r(1828),i=r(8727).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return n(e,i)}},3717:(e,t)=>{"use strict";t.f=Object.getOwnPropertySymbols},2787:(e,t,r)=>{"use strict";var n=r(9297),i=r(4901),a=r(8981),o=r(6119),r=r(2211),u=o("IE_PROTO"),s=Object,c=s.prototype;e.exports=r?s.getPrototypeOf:function(e){e=a(e);if(n(e,u))return e[u];var t=e.constructor;return i(t)&&e instanceof t?t.prototype:e instanceof s?c:null}},4124:(e,t,r)=>{"use strict";var n=r(9039),i=r(34),a=r(4576),o=r(5652),u=Object.isExtensible,r=n(function(){u(1)});e.exports=r||o?function(e){return!!i(e)&&(!o||"ArrayBuffer"!==a(e))&&(!u||u(e))}:u},1625:(e,t,r)=>{"use strict";r=r(9504);e.exports=r({}.isPrototypeOf)},1828:(e,t,r)=>{"use strict";var n=r(9504),o=r(9297),u=r(5397),s=r(9617).indexOf,c=r(421),l=n([].push);e.exports=function(e,t){var r,n=u(e),i=0,a=[];for(r in n)!o(c,r)&&o(n,r)&&l(a,r);for(;t.length>i;)!o(n,r=t[i++])||~s(a,r)||l(a,r);return a}},1072:(e,t,r)=>{"use strict";var n=r(1828),i=r(8727);e.exports=Object.keys||function(e){return n(e,i)}},8773:(e,t)=>{"use strict";var r={}.propertyIsEnumerable,n=Object.getOwnPropertyDescriptor,i=n&&!r.call({1:2},1);t.f=i?function(e){e=n(this,e);return!!e&&e.enumerable}:r},2967:(e,t,r)=>{"use strict";var i=r(6706),a=r(34),o=r(7750),u=r(3506);e.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var r,n=!1,e={};try{(r=i(Object.prototype,"__proto__","set"))(e,[]),n=e instanceof Array}catch(r){}return function(e,t){return o(e),u(t),a(e)&&(n?r(e,t):e.__proto__=t),e}}():void 0)},2357:(e,t,r)=>{"use strict";function n(s){return function(e){for(var t,r=p(e),n=f(r),i=d&&null===l(r),a=n.length,o=0,u=[];o<a;)t=n[o++],c&&!(i?t in r:m(r,t))||h(u,s?[t,r[t]]:r[t]);return u}}var c=r(3724),i=r(9039),a=r(9504),l=r(2787),f=r(1072),p=r(5397),m=a(r(8773).f),h=a([].push),d=c&&i(function(){var e=Object.create(null);return e[2]=2,!m(e,2)});e.exports={entries:n(!0),values:n(!1)}},3179:(e,t,r)=>{"use strict";var n=r(2140),i=r(6955);e.exports=n?{}.toString:function(){return"[object "+i(this)+"]"}},4270:(e,t,r)=>{"use strict";var i=r(9565),a=r(4901),o=r(34),u=TypeError;e.exports=function(e,t){var r,n;if("string"===t&&a(r=e.toString)&&!o(n=i(r,e)))return n;if(a(r=e.valueOf)&&!o(n=i(r,e)))return n;if("string"!==t&&a(r=e.toString)&&!o(n=i(r,e)))return n;throw new u("Can't convert object to primitive value")}},5031:(e,t,r)=>{"use strict";var n=r(7751),i=r(9504),a=r(8480),o=r(3717),u=r(8551),s=i([].concat);e.exports=n("Reflect","ownKeys")||function(e){var t=a.f(u(e)),r=o.f;return r?s(t,r(e)):t}},9167:(e,t,r)=>{"use strict";r=r(4475);e.exports=r},1103:e=>{"use strict";e.exports=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}}},916:(e,t,r)=>{"use strict";var n=r(4475),i=r(550),a=r(4901),o=r(2796),u=r(3706),s=r(8227),c=r(7290),l=r(516),f=r(6395),p=r(7388),m=i&&i.prototype,h=s("species"),d=!1,y=a(n.PromiseRejectionEvent),r=o("Promise",function(){var e=u(i),t=e!==String(i);if(!t&&66===p)return!0;if(f&&(!m.catch||!m.finally))return!0;if(!p||p<51||!/native code/.test(e)){var e=new i(function(e){e(1)}),r=function(e){e(function(){},function(){})};if((e.constructor={})[h]=r,!(d=e.then(function(){})instanceof r))return!0}return!t&&(c||l)&&!y});e.exports={CONSTRUCTOR:r,REJECTION_EVENT:y,SUBCLASSING:d}},550:(e,t,r)=>{"use strict";r=r(4475);e.exports=r.Promise},3438:(e,t,r)=>{"use strict";var n=r(8551),i=r(34),a=r(6043);e.exports=function(e,t){if(n(e),i(t)&&t.constructor===e)return t;e=a.f(e);return(0,e.resolve)(t),e.promise}},537:(e,t,r)=>{"use strict";var n=r(550),i=r(4428),r=r(916).CONSTRUCTOR;e.exports=r||!i(function(e){n.all(e).then(void 0,function(){})})},1056:(e,t,r)=>{"use strict";var n=r(4913).f;e.exports=function(e,t,r){r in e||n(e,r,{configurable:!0,get:function(){return t[r]},set:function(e){t[r]=e}})}},8265:e=>{"use strict";function t(){this.head=null,this.tail=null}t.prototype={add:function(e){var e={item:e,next:null},t=this.tail;t?t.next=e:this.head=e,this.tail=e},get:function(){var e=this.head;if(e)return null===(this.head=e.next)&&(this.tail=null),e.item}},e.exports=t},6682:(e,t,r)=>{"use strict";var n=r(9565),i=r(8551),a=r(4901),o=r(4576),u=r(7323),s=TypeError;e.exports=function(e,t){var r=e.exec;if(a(r))return null!==(r=n(r,e,t))&&i(r),r;if("RegExp"===o(e))return n(u,e,t);throw new s("RegExp#exec called on incompatible receiver")}},7323:(e,t,r)=>{"use strict";var h=r(9565),n=r(9504),d=r(655),y=r(7979),i=r(8429),a=r(5745),v=r(2360),g=r(1181).get,o=r(3635),r=r(8814),x=a("native-string-replace",String.prototype.replace),b=RegExp.prototype.exec,w=b,N=n("".charAt),D=n("".indexOf),E=n("".replace),A=n("".slice),S=(a=/b*/g,h(b,n=/a/,"a"),h(b,a,"a"),0!==n.lastIndex||0!==a.lastIndex),C=i.BROKEN_CARET,M=void 0!==/()??/.exec("")[1];(S||M||C||o||r)&&(w=function(e){var t,r,n,i,a,o,u=this,s=g(u),e=d(e),c=s.raw;if(c)return c.lastIndex=u.lastIndex,f=h(w,c,e),u.lastIndex=c.lastIndex,f;var l=s.groups,c=C&&u.sticky,f=h(y,u),s=u.source,p=0,m=e;if(c&&(f=E(f,"y",""),-1===D(f,"g")&&(f+="g"),m=A(e,u.lastIndex),0<u.lastIndex&&(!u.multiline||u.multiline&&"\n"!==N(e,u.lastIndex-1))&&(s="(?: "+s+")",m=" "+m,p++),t=new RegExp("^(?:"+s+")",f)),M&&(t=new RegExp("^"+s+"$(?!\\s)",f)),S&&(r=u.lastIndex),n=h(b,c?t:u,m),c?n?(n.input=A(n.input,p),n[0]=A(n[0],p),n.index=u.lastIndex,u.lastIndex+=n[0].length):u.lastIndex=0:S&&n&&(u.lastIndex=u.global?n.index+n[0].length:r),M&&n&&1<n.length&&h(x,n[0],t,function(){for(i=1;i<arguments.length-2;i++)void 0===arguments[i]&&(n[i]=void 0)}),n&&l)for(n.groups=a=v(null),i=0;i<l.length;i++)a[(o=l[i])[0]]=n[o[1]];return n}),e.exports=w},7979:(e,t,r)=>{"use strict";var n=r(8551);e.exports=function(){var e=n(this),t="";return e.hasIndices&&(t+="d"),e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.unicodeSets&&(t+="v"),e.sticky&&(t+="y"),t}},1034:(e,t,r)=>{"use strict";var n=r(9565),i=r(9297),a=r(1625),o=r(7979),u=RegExp.prototype;e.exports=function(e){var t=e.flags;return void 0!==t||"flags"in u||i(e,"flags")||!a(u,e)?t:n(o,e)}},8429:(e,t,r)=>{"use strict";var n=r(9039),i=r(4475).RegExp,r=n(function(){var e=i("a","y");return e.lastIndex=2,null!==e.exec("abcd")}),a=r||n(function(){return!i("a","y").sticky}),n=r||n(function(){var e=i("^r","gy");return e.lastIndex=2,null!==e.exec("str")});e.exports={BROKEN_CARET:n,MISSED_STICKY:a,UNSUPPORTED_Y:r}},3635:(e,t,r)=>{"use strict";var n=r(9039),i=r(4475).RegExp;e.exports=n(function(){var e=i(".","s");return!(e.dotAll&&e.test("\n")&&"s"===e.flags)})},8814:(e,t,r)=>{"use strict";var n=r(9039),i=r(4475).RegExp;e.exports=n(function(){var e=i("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})},7750:(e,t,r)=>{"use strict";var n=r(4117),i=TypeError;e.exports=function(e){if(n(e))throw new i("Can't call method on "+e);return e}},3389:(e,t,r)=>{"use strict";var n=r(4475),i=r(3724),a=Object.getOwnPropertyDescriptor;e.exports=function(e){if(!i)return n[e];e=a(n,e);return e&&e.value}},7633:(e,t,r)=>{"use strict";var n=r(7751),i=r(2106),a=r(8227),o=r(3724),u=a("species");e.exports=function(e){e=n(e);o&&e&&!e[u]&&i(e,u,{configurable:!0,get:function(){return this}})}},687:(e,t,r)=>{"use strict";var n=r(4913).f,i=r(9297),a=r(8227)("toStringTag");e.exports=function(e,t,r){(e=e&&!r?e.prototype:e)&&!i(e,a)&&n(e,a,{configurable:!0,value:t})}},6119:(e,t,r)=>{"use strict";var n=r(5745),i=r(3392),a=n("keys");e.exports=function(e){return a[e]||(a[e]=i(e))}},7629:(e,t,r)=>{"use strict";var n=r(6395),i=r(4475),r=r(9433),a="__core-js_shared__",e=e.exports=i[a]||r(a,{});(e.versions||(e.versions=[])).push({version:"3.37.0",mode:n?"pure":"global",copyright:"© 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.37.0/LICENSE",source:"https://github.com/zloirock/core-js"})},5745:(e,t,r)=>{"use strict";var n=r(7629);e.exports=function(e,t){return n[e]||(n[e]=t||{})}},2293:(e,t,r)=>{"use strict";var n=r(8551),i=r(5548),a=r(4117),o=r(8227)("species");e.exports=function(e,t){var e=n(e).constructor;return void 0===e||a(e=n(e)[o])?t:i(e)}},3061:(e,t,r)=>{"use strict";var n=r(9039);e.exports=function(t){return n(function(){var e=""[t]('"');return e!==e.toLowerCase()||3<e.split('"').length})}},8183:(e,t,r)=>{"use strict";function n(i){return function(e,t){var r,e=o(u(e)),t=a(t),n=e.length;return t<0||n<=t?i?"":void 0:(r=c(e,t))<55296||56319<r||t+1===n||(n=c(e,t+1))<56320||57343<n?i?s(e,t):r:i?l(e,t,t+2):n-56320+(r-55296<<10)+65536}}var i=r(9504),a=r(1291),o=r(655),u=r(7750),s=i("".charAt),c=i("".charCodeAt),l=i("".slice);e.exports={codeAt:n(!1),charAt:n(!0)}},2333:(e,t,r)=>{"use strict";var i=r(1291),a=r(655),o=r(7750),u=RangeError;e.exports=function(e){var t=a(o(this)),r="",n=i(e);if(n<0||n===1/0)throw new u("Wrong number of repetitions");for(;0<n;(n>>>=1)&&(t+=t))1&n&&(r+=t);return r}},706:(e,t,r)=>{"use strict";var n=r(350).PROPER,i=r(9039),a=r(7452);e.exports=function(e){return i(function(){return!!a[e]()||"​…᠎"!=="​…᠎"[e]()||n&&a[e].name!==e})}},3802:(e,t,r)=>{"use strict";function n(t){return function(e){e=o(a(e));return 1&t&&(e=u(e,s,"")),e=2&t?u(e,c,"$1"):e}}var i=r(9504),a=r(7750),o=r(655),r=r(7452),u=i("".replace),s=RegExp("^["+r+"]+"),c=RegExp("(^|[^"+r+"])["+r+"]+$");e.exports={start:n(1),end:n(2),trim:n(3)}},4495:(e,t,r)=>{"use strict";var n=r(7388),i=r(9039),a=r(4475).String;e.exports=!!Object.getOwnPropertySymbols&&!i(function(){var e=Symbol("symbol detection");return!a(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&n&&n<41})},8242:(e,t,r)=>{"use strict";var n=r(9565),i=r(7751),a=r(8227),o=r(6840);e.exports=function(){var e=i("Symbol"),e=e&&e.prototype,t=e&&e.valueOf,r=a("toPrimitive");e&&!e[r]&&o(e,r,function(e){return n(t,this)},{arity:1})}},1296:(e,t,r)=>{"use strict";r=r(4495);e.exports=r&&!!Symbol.for&&!!Symbol.keyFor},9225:(e,t,r)=>{"use strict";function n(e){return function(){F(e)}}function i(e){F(e.data)}function a(e){s.postMessage(A(e),o.protocol+"//"+o.host)}var o,u,s=r(4475),c=r(8745),l=r(6080),f=r(4901),p=r(9297),m=r(9039),h=r(397),d=r(7680),y=r(4055),v=r(2812),g=r(8119),r=r(9088),x=s.setImmediate,b=s.clearImmediate,w=s.process,N=s.Dispatch,D=s.Function,E=s.MessageChannel,A=s.String,S=0,C={},M="onreadystatechange",F=(m(function(){o=s.location}),function(e){var t;p(C,e)&&(t=C[e],delete C[e],t())});x&&b||(x=function(e){v(arguments.length,1);var t=f(e)?e:D(e),r=d(arguments,1);return C[++S]=function(){c(t,void 0,r)},u(S),S},b=function(e){delete C[e]},r?u=function(e){w.nextTick(n(e))}:N&&N.now?u=function(e){N.now(n(e))}:E&&!g?(g=(r=new E).port2,r.port1.onmessage=i,u=l(g.postMessage,g)):s.addEventListener&&f(s.postMessage)&&!s.importScripts&&o&&"file:"!==o.protocol&&!m(a)?(u=a,s.addEventListener("message",i,!1)):u=M in y("script")?function(e){h.appendChild(y("script"))[M]=function(){h.removeChild(this),F(e)}}:function(e){setTimeout(n(e),0)}),e.exports={set:x,clear:b}},1240:(e,t,r)=>{"use strict";r=r(9504);e.exports=r(1..valueOf)},5610:(e,t,r)=>{"use strict";var n=r(1291),i=Math.max,a=Math.min;e.exports=function(e,t){e=n(e);return e<0?i(e+t,0):a(e,t)}},5397:(e,t,r)=>{"use strict";var n=r(7055),i=r(7750);e.exports=function(e){return n(i(e))}},1291:(e,t,r)=>{"use strict";var n=r(741);e.exports=function(e){e=+e;return e!=e||0==e?0:n(e)}},8014:(e,t,r)=>{"use strict";var n=r(1291),i=Math.min;e.exports=function(e){e=n(e);return 0<e?i(e,9007199254740991):0}},8981:(e,t,r)=>{"use strict";var n=r(7750),i=Object;e.exports=function(e){return i(n(e))}},2777:(e,t,r)=>{"use strict";var n=r(9565),i=r(34),a=r(757),o=r(5966),u=r(4270),r=r(8227),s=TypeError,c=r("toPrimitive");e.exports=function(e,t){if(!i(e)||a(e))return e;var r=o(e,c);if(r){if(r=n(r,e,t=void 0===t?"default":t),!i(r)||a(r))return r;throw new s("Can't convert object to primitive value")}return u(e,t=void 0===t?"number":t)}},6969:(e,t,r)=>{"use strict";var n=r(2777),i=r(757);e.exports=function(e){e=n(e,"string");return i(e)?e:e+""}},2140:(e,t,r)=>{"use strict";var n={};n[r(8227)("toStringTag")]="z",e.exports="[object z]"===String(n)},655:(e,t,r)=>{"use strict";var n=r(6955),i=String;e.exports=function(e){if("Symbol"===n(e))throw new TypeError("Cannot convert a Symbol value to a string");return i(e)}},6823:e=>{"use strict";var t=String;e.exports=function(e){try{return t(e)}catch(e){return"Object"}}},3392:(e,t,r)=>{"use strict";var r=r(9504),n=0,i=Math.random(),a=r(1..toString);e.exports=function(e){return"Symbol("+(void 0===e?"":e)+")_"+a(++n+i,36)}},7040:(e,t,r)=>{"use strict";r=r(4495);e.exports=r&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},8686:(e,t,r)=>{"use strict";var n=r(3724),r=r(9039);e.exports=n&&r(function(){return 42!==Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype})},2812:e=>{"use strict";var r=TypeError;e.exports=function(e,t){if(e<t)throw new r("Not enough arguments");return e}},8622:(e,t,r)=>{"use strict";var n=r(4475),r=r(4901),n=n.WeakMap;e.exports=r(n)&&/native code/.test(String(n))},5749:(e,t,r)=>{"use strict";var n=r(9167),i=r(9297),a=r(1951),o=r(4913).f;e.exports=function(e){var t=n.Symbol||(n.Symbol={});i(t,e)||o(t,e,{value:a.f(e)})}},1951:(e,t,r)=>{"use strict";r=r(8227);t.f=r},8227:(e,t,r)=>{"use strict";var n=r(4475),i=r(5745),a=r(9297),o=r(3392),u=r(4495),r=r(7040),s=n.Symbol,c=i("wks"),l=r?s.for||s:s&&s.withoutSetter||o;e.exports=function(e){return a(c,e)||(c[e]=u&&a(s,e)?s[e]:l("Symbol."+e)),c[e]}},7452:e=>{"use strict";e.exports="\t\n\v\f\r                 \u2028\u2029\ufeff"},8706:(e,t,r)=>{"use strict";var n=r(6518),i=r(9039),c=r(4376),l=r(34),f=r(8981),p=r(6198),m=r(6837),h=r(4659),d=r(1469),a=r(597),o=r(8227),r=r(7388),y=o("isConcatSpreadable"),o=51<=r||!i(function(){var e=[];return e[y]=!1,e.concat()[0]!==e});n({target:"Array",proto:!0,arity:1,forced:!o||!a("concat")},{concat:function(e){for(var t,r,n,i=f(this),a=d(i,0),o=0,u=-1,s=arguments.length;u<s;u++)if(function(e){if(!l(e))return!1;var t=e[y];return void 0!==t?!!t:c(e)}(n=-1===u?i:arguments[u]))for(r=p(n),m(o+r),t=0;t<r;t++,o++)t in n&&h(a,o,n[t]);else m(o+1),h(a,o++,n);return a.length=o,a}})},8431:(e,t,r)=>{"use strict";var n=r(6518),i=r(9213).every;n({target:"Array",proto:!0,forced:!r(4598)("every")},{every:function(e){return i(this,e,1<arguments.length?arguments[1]:void 0)}})},3771:(e,t,r)=>{"use strict";var n=r(6518),i=r(4373),r=r(6469);n({target:"Array",proto:!0},{fill:i}),r("fill")},2008:(e,t,r)=>{"use strict";var n=r(6518),i=r(9213).filter;n({target:"Array",proto:!0,forced:!r(597)("filter")},{filter:function(e){return i(this,e,1<arguments.length?arguments[1]:void 0)}})},113:(e,t,r)=>{"use strict";var n=r(6518),i=r(9213).find,r=r(6469),a="find",o=!0;a in[]&&Array(1)[a](function(){o=!1}),n({target:"Array",proto:!0,forced:o},{find:function(e){return i(this,e,1<arguments.length?arguments[1]:void 0)}}),r(a)},1629:(e,t,r)=>{"use strict";var n=r(6518),r=r(235);n({target:"Array",proto:!0,forced:[].forEach!==r},{forEach:r})},3418:(e,t,r)=>{"use strict";var n=r(6518),i=r(7916);n({target:"Array",stat:!0,forced:!r(4428)(function(e){Array.from(e)})},{from:i})},4423:(e,t,r)=>{"use strict";var n=r(6518),i=r(9617).includes,a=r(9039),r=r(6469);n({target:"Array",proto:!0,forced:a(function(){return!Array(1).includes()})},{includes:function(e){return i(this,e,1<arguments.length?arguments[1]:void 0)}}),r("includes")},5276:(e,t,r)=>{"use strict";var n=r(6518),i=r(7476),a=r(9617).indexOf,r=r(4598),o=i([].indexOf),u=!!o&&1/o([1],1,-0)<0;n({target:"Array",proto:!0,forced:u||!r("indexOf")},{indexOf:function(e){var t=1<arguments.length?arguments[1]:void 0;return u?o(this,e,t)||0:a(this,e,t)}})},4346:(e,t,r)=>{"use strict";r(6518)({target:"Array",stat:!0},{isArray:r(4376)})},3792:(e,t,r)=>{"use strict";var n=r(5397),i=r(6469),a=r(6269),o=r(1181),u=r(4913).f,s=r(1088),c=r(2529),l=r(6395),r=r(3724),f="Array Iterator",p=o.set,m=o.getterFor(f),o=(e.exports=s(Array,"Array",function(e,t){p(this,{type:f,target:n(e),index:0,kind:t})},function(){var e=m(this),t=e.target,r=e.index++;if(!t||r>=t.length)return e.target=void 0,c(void 0,!0);switch(e.kind){case"keys":return c(r,!1);case"values":return c(t[r],!1)}return c([r,t[r]],!1)},"values"),a.Arguments=a.Array);if(i("keys"),i("values"),i("entries"),!l&&r&&"values"!==o.name)try{u(o,"name",{value:"values"})}catch(e){}},8598:(e,t,r)=>{"use strict";var n=r(6518),i=r(9504),a=r(7055),o=r(5397),r=r(4598),u=i([].join);n({target:"Array",proto:!0,forced:a!==Object||!r("join",",")},{join:function(e){return u(o(this),void 0===e?",":e)}})},2062:(e,t,r)=>{"use strict";var n=r(6518),i=r(9213).map;n({target:"Array",proto:!0,forced:!r(597)("map")},{map:function(e){return i(this,e,1<arguments.length?arguments[1]:void 0)}})},2712:(e,t,r)=>{"use strict";var n=r(6518),i=r(926).left,a=r(4598),o=r(7388);n({target:"Array",proto:!0,forced:!r(9088)&&79<o&&o<83||!a("reduce")},{reduce:function(e){var t=arguments.length;return i(this,e,t,1<t?arguments[1]:void 0)}})},4490:(e,t,r)=>{"use strict";var n=r(6518),i=r(9504),a=r(4376),o=i([].reverse),r=[1,2];n({target:"Array",proto:!0,forced:String(r)===String(r.reverse())},{reverse:function(){return a(this)&&(this.length=this.length),o(this)}})},4782:(e,t,r)=>{"use strict";var n=r(6518),c=r(4376),l=r(3517),f=r(34),p=r(5610),m=r(6198),h=r(5397),d=r(4659),i=r(8227),a=r(597),y=r(7680),r=a("slice"),v=i("species"),g=Array,x=Math.max;n({target:"Array",proto:!0,forced:!r},{slice:function(e,t){var r,n,i,a=h(this),o=m(a),u=p(e,o),s=p(void 0===t?o:t,o);if(c(a)&&(r=a.constructor,(r=l(r)&&(r===g||c(r.prototype))||f(r)&&null===(r=r[v])?void 0:r)===g||void 0===r))return y(a,u,s);for(n=new(void 0===r?g:r)(x(s-u,0)),i=0;u<s;u++,i++)u in a&&d(n,i,a[u]);return n.length=i,n}})},5086:(e,t,r)=>{"use strict";var n=r(6518),i=r(9213).some;n({target:"Array",proto:!0,forced:!r(4598)("some")},{some:function(e){return i(this,e,1<arguments.length?arguments[1]:void 0)}})},6910:(e,t,r)=>{"use strict";var n=r(6518),i=r(9504),u=r(9306),s=r(8981),c=r(6198),l=r(4606),f=r(655),a=r(9039),p=r(4488),o=r(4598),m=r(8834),h=r(3202),d=r(7388),y=r(9160),v=[],g=i(v.sort),x=i(v.push),r=a(function(){v.sort(void 0)}),i=a(function(){v.sort(null)}),o=o("sort"),b=!a(function(){if(d)return d<70;if(!(m&&3<m)){if(h)return!0;if(y)return y<603;for(var e,t,r,n="",i=65;i<76;i++){switch(e=String.fromCharCode(i),i){case 66:case 69:case 70:case 72:t=3;break;case 68:case 71:t=4;break;default:t=2}for(r=0;r<47;r++)v.push({k:e+r,v:t})}for(v.sort(function(e,t){return t.v-e.v}),r=0;r<v.length;r++)e=v[r].k.charAt(0),n.charAt(n.length-1)!==e&&(n+=e);return"DGBEFHACIJK"!==n}});n({target:"Array",proto:!0,forced:r||!i||!o||!b},{sort:function(e){void 0!==e&&u(e);var t=s(this);if(b)return void 0===e?g(t):g(t,e);for(var r,n,i=[],a=c(t),o=0;o<a;o++)o in t&&x(i,t[o]);for(p(i,(n=e,function(e,t){return void 0===t?-1:void 0===e?1:void 0!==n?+n(e,t)||0:f(e)>f(t)?1:-1})),r=c(i),o=0;o<r;)t[o]=i[o++];for(;o<a;)l(t,o++);return t}})},4554:(e,t,r)=>{"use strict";var n=r(6518),f=r(8981),p=r(5610),m=r(1291),h=r(6198),d=r(4527),y=r(6837),v=r(1469),g=r(4659),x=r(4606),r=r(597)("splice"),b=Math.max,w=Math.min;n({target:"Array",proto:!0,forced:!r},{splice:function(e,t){var r,n,i,a,o,u,s=f(this),c=h(s),l=p(e,c),e=arguments.length;for(0===e?r=n=0:n=1===e?(r=0,c-l):(r=e-2,w(b(m(t),0),c-l)),y(c+r-n),i=v(s,n),a=0;a<n;a++)(o=l+a)in s&&g(i,a,s[o]);if(r<(i.length=n)){for(a=l;a<c-n;a++)u=a+r,(o=a+n)in s?s[u]=s[o]:x(s,u);for(a=c;c-n+r<a;a--)x(s,a-1)}else if(n<r)for(a=c-n;l<a;a--)u=a+r-1,(o=a+n-1)in s?s[u]=s[o]:x(s,u);for(a=0;a<r;a++)s[a+l]=arguments[a+2];return d(s,c-n+r),i}})},9089:(e,t,r)=>{"use strict";var n=r(6518),r=r(9504),i=Date,a=r(i.prototype.getTime);n({target:"Date",stat:!0},{now:function(){return a(new i)}})},739:(e,t,r)=>{"use strict";var n=r(6518),i=r(9039),a=r(8981),o=r(2777);n({target:"Date",proto:!0,arity:1,forced:i(function(){return null!==new Date(NaN).toJSON()||1!==Date.prototype.toJSON.call({toISOString:function(){return 1}})})},{toJSON:function(e){var t=a(this),r=o(t,"number");return"number"!=typeof r||isFinite(r)?t.toISOString():null}})},3288:(e,t,r)=>{"use strict";var n=r(9504),r=r(6840),i=Date.prototype,a="Invalid Date",o="toString",u=n(i[o]),s=n(i.getTime);String(new Date(NaN))!==a&&r(i,o,function(){var e=s(this);return e==e?u(this):a})},4170:(e,t,r)=>{"use strict";var n=r(6518),r=r(566);n({target:"Function",proto:!0,forced:Function.bind!==r},{bind:r})},2010:(e,t,r)=>{"use strict";var n=r(3724),i=r(350).EXISTS,a=r(9504),r=r(2106),o=Function.prototype,u=a(o.toString),s=/function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,c=a(s.exec);n&&!i&&r(o,"name",{configurable:!0,get:function(){try{return c(s,u(this))[1]}catch(e){return""}}})},3110:(e,t,r)=>{"use strict";function i(e,t){var r=m(arguments),n=h(t);if(f(n)||void 0!==e&&!p(e))return r[1]=function(e,t){if(f(n)&&(t=s(n,this,d(e),t)),!p(t))return t},u(y,null,r)}function a(e,t,r){var n=g(r,t-1),r=g(r,t+1);return v(D,e)&&!v(E,r)||v(E,e)&&!v(D,n)?"\\u"+w(x(e,0),16):e}var n=r(6518),o=r(7751),u=r(8745),s=r(9565),c=r(9504),l=r(9039),f=r(4901),p=r(757),m=r(7680),h=r(6933),r=r(4495),d=String,y=o("JSON","stringify"),v=c(/./.exec),g=c("".charAt),x=c("".charCodeAt),b=c("".replace),w=c(1..toString),N=/[\uD800-\uDFFF]/g,D=/^[\uD800-\uDBFF]$/,E=/^[\uDC00-\uDFFF]$/,A=!r||l(function(){var e=o("Symbol")("stringify detection");return"[null]"!==y([e])||"{}"!==y({a:e})||"{}"!==y(Object(e))}),S=l(function(){return'"\\udf06\\ud834"'!==y("\udf06\ud834")||'"\\udead"'!==y("\udead")});y&&n({target:"JSON",stat:!0,arity:3,forced:A||S},{stringify:function(e,t,r){var n=m(arguments),n=u(A?i:y,null,n);return S&&"string"==typeof n?b(n,N,a):n}})},8523:(e,t,r)=>{"use strict";r(6468)("Map",function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},r(6938))},6033:(e,t,r)=>{"use strict";r(8523)},3153:(e,t,r)=>{"use strict";var n=r(6518),i=r(5359),r=Math.acosh,a=Math.log,o=Math.sqrt,u=Math.LN2;n({target:"Math",stat:!0,forced:!r||710!==Math.floor(r(Number.MAX_VALUE))||r(1/0)!==1/0},{acosh:function(e){e=+e;return e<1?NaN:94906265.62425156<e?a(e)+u:i(e-1+o(e-1)*o(1+e))}})},2326:(e,t,r)=>{"use strict";var r=r(6518),n=Math.asinh,i=Math.log,a=Math.sqrt;r({target:"Math",stat:!0,forced:!(n&&0<1/n(0))},{asinh:function e(t){t=+t;return isFinite(t)&&0!=t?t<0?-e(-t):i(t+a(t*t+1)):t}})},6389:(e,t,r)=>{"use strict";var r=r(6518),n=Math.atanh,i=Math.log;r({target:"Math",stat:!0,forced:!(n&&1/n(-0)<0)},{atanh:function(e){e=+e;return 0==e?e:i((1+e)/(1-e))/2}})},4444:(e,t,r)=>{"use strict";var n=r(6518),i=r(7782),a=Math.abs,o=Math.pow;n({target:"Math",stat:!0},{cbrt:function(e){e=+e;return i(e)*o(a(e),1/3)}})},7762:(e,t,r)=>{"use strict";var n=r(6518),i=r(3250),r=Math.cosh,a=Math.abs,o=Math.E;n({target:"Math",stat:!0,forced:!r||r(710)===1/0},{cosh:function(e){e=i(a(e)-1)+1;return(e+1/(e*o*o))*(o/2)}})},5070:(e,t,r)=>{"use strict";var n=r(6518),r=r(3250);n({target:"Math",stat:!0,forced:r!==Math.expm1},{expm1:r})},5376:(e,t,r)=>{"use strict";r(6518)({target:"Math",stat:!0},{log10:r(9340)})},6624:(e,t,r)=>{"use strict";r(6518)({target:"Math",stat:!0},{log1p:r(5359)})},1367:(e,t,r)=>{"use strict";var r=r(6518),n=Math.log,i=Math.LN2;r({target:"Math",stat:!0},{log2:function(e){return n(e)/i}})},5914:(e,t,r)=>{"use strict";r(6518)({target:"Math",stat:!0},{sign:r(7782)})},8553:(e,t,r)=>{"use strict";var n=r(6518),i=r(9039),a=r(3250),o=Math.abs,u=Math.exp,s=Math.E;n({target:"Math",stat:!0,forced:i(function(){return-2e-17!==Math.sinh(-2e-17)})},{sinh:function(e){e=+e;return o(e)<1?(a(e)-a(-e))/2:(u(e-1)-u(-e-1))*(s/2)}})},8690:(e,t,r)=>{"use strict";var n=r(6518),i=r(3250),a=Math.exp;n({target:"Math",stat:!0},{tanh:function(e){var e=+e,t=i(e),r=i(-e);return t===1/0?1:r===1/0?-1:(t-r)/(a(e)+a(-e))}})},2892:(e,t,r)=>{"use strict";function n(c){var e,t=arguments.length<1?0:D(function(){var e=y(c,"number");if("bigint"==typeof e)return e;var t,r,n,i,a,o,u,s=y(e,"number");if(d(s))throw new S("Cannot convert a Symbol value to a number");if("string"==typeof s&&2<s.length)if(s=N(s),43===(e=M(s,0))||45===e){if(88===(t=M(s,2))||120===t)return NaN}else if(48===e){switch(M(s,1)){case 66:case 98:r=2,n=49;break;case 79:case 111:r=8,n=55;break;default:return+s}for(a=(i=C(s,2)).length,o=0;o<a;o++)if((u=M(i,o))<48||n<u)return NaN;return parseInt(i,r)}return+s}());return h(A,e=this)&&v(function(){w(e)})?m(Object(t),this,n):t}function i(e,t){for(var r,n=u?g(t):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,fromString,range".split(","),i=0;n.length>i;i++)p(t,r=n[i])&&!p(e,r)&&b(e,r,x(t,r))}var a=r(6518),o=r(6395),u=r(3724),s=r(4475),c=r(9167),l=r(9504),f=r(2796),p=r(9297),m=r(3167),h=r(1625),d=r(757),y=r(2777),v=r(9039),g=r(8480).f,x=r(7347).f,b=r(4913).f,w=r(1240),N=r(3802).trim,r="Number",D=s[r],E=c[r],A=D.prototype,S=s.TypeError,C=l("".slice),M=l("".charCodeAt),s=f(r,!D(" 0o1")||!D("0b1")||D("+0x1"));n.prototype=A,s&&!o&&(A.constructor=n),a({global:!0,constructor:!0,wrap:!0,forced:s},{Number:n});o&&E&&i(c[r],E),(s||o)&&i(c[r],D)},5374:(e,t,r)=>{"use strict";r(6518)({target:"Number",stat:!0,nonConfigurable:!0,nonWritable:!0},{EPSILON:Math.pow(2,-52)})},150:(e,t,r)=>{"use strict";r(6518)({target:"Number",stat:!0},{isNaN:function(e){return e!=e}})},9868:(e,t,r)=>{"use strict";function s(e,t,r){return 0===t?r:t%2==1?s(e,t-1,r*e):s(e*e,t/2,r)}function c(e,t,r){for(var n=-1,i=r;++n<6;)i+=t*e[n],e[n]=i%1e7,i=o(i/1e7)}function l(e,t){for(var r=6,n=0;0<=--r;)n+=e[r],e[r]=o(n/t),n=n%t*1e7}function f(e){for(var t,r=6,n="";0<=--r;)""===n&&0!==r&&0===e[r]||(t=d(e[r]),n=""===n?t:n+y("0",7-t.length)+t);return n}var n=r(6518),i=r(9504),p=r(1291),m=r(1240),a=r(2333),r=r(9039),h=RangeError,d=String,o=Math.floor,y=i(a),v=i("".slice),u=i(1..toFixed);n({target:"Number",proto:!0,forced:r(function(){return"0.000"!==u(8e-5,3)||"1"!==u(.9,0)||"1.25"!==u(1.255,2)||"1000000000000000128"!==u(0xde0b6b3a7640080,0)})||!r(function(){u({})})},{toFixed:function(e){var t,r,n,i=m(this),e=p(e),a=[0,0,0,0,0,0],o="",u="0";if(e<0||20<e)throw new h("Incorrect fraction digits");if(i!=i)return"NaN";if(i<=-1e21||1e21<=i)return d(i);if(i<0&&(o="-",i=-i),1e-21<i)if(n=(t=function(){for(var e=0,t=i*s(2,69,1);4096<=t;)e+=12,t/=4096;for(;2<=t;)e+=1,t/=2;return e}()-69)<0?i*s(2,-t,1):i/s(2,t,1),n*=4503599627370496,0<(t=52-t)){for(c(a,0,n),r=e;7<=r;)c(a,1e7,0),r-=7;for(c(a,s(10,r,1),0),r=t-1;23<=r;)l(a,1<<23),r-=23;l(a,1<<r),c(a,1,1),l(a,2),u=f(a)}else c(a,0,n),c(a,1<<-t,0),u=f(a)+y("0",e);return 0<e?o+((n=u.length)<=e?"0."+y("0",e-n)+u:v(u,0,n-e)+"."+v(u,n-e)):o+u}})},630:(e,t,r)=>{"use strict";var n=r(6518),i=r(9504),a=r(9039),o=r(1240),u=i(1..toPrecision);n({target:"Number",proto:!0,forced:a(function(){return"1"!==u(1,void 0)})||!a(function(){u({})})},{toPrecision:function(e){return void 0===e?u(o(this)):u(o(this),e)}})},9904:(e,t,r)=>{"use strict";r(6518)({target:"Object",stat:!0,sham:!r(3724)},{create:r(2360)})},7945:(e,t,r)=>{"use strict";var n=r(6518),i=r(3724),r=r(6801).f;n({target:"Object",stat:!0,forced:Object.defineProperties!==r,sham:!i},{defineProperties:r})},4185:(e,t,r)=>{"use strict";var n=r(6518),i=r(3724),r=r(4913).f;n({target:"Object",stat:!0,forced:Object.defineProperty!==r,sham:!i},{defineProperty:r})},3851:(e,t,r)=>{"use strict";var n=r(6518),i=r(9039),a=r(5397),o=r(7347).f,r=r(3724);n({target:"Object",stat:!0,forced:!r||i(function(){o(1)}),sham:!r},{getOwnPropertyDescriptor:function(e,t){return o(a(e),t)}})},1278:(e,t,r)=>{"use strict";var n=r(6518),i=r(3724),s=r(5031),c=r(5397),l=r(7347),f=r(4659);n({target:"Object",stat:!0,sham:!i},{getOwnPropertyDescriptors:function(e){for(var t,r,n=c(e),i=l.f,a=s(n),o={},u=0;a.length>u;)void 0!==(r=i(n,t=a[u++]))&&f(o,t,r);return o}})},9773:(e,t,r)=>{"use strict";var n=r(6518),i=r(4495),a=r(9039),o=r(3717),u=r(8981);n({target:"Object",stat:!0,forced:!i||a(function(){o.f(1)})},{getOwnPropertySymbols:function(e){var t=o.f;return t?t(u(e)):[]}})},875:(e,t,r)=>{"use strict";var n=r(6518),i=r(9039),a=r(8981),o=r(2787),r=r(2211);n({target:"Object",stat:!0,forced:i(function(){o(1)}),sham:!r},{getPrototypeOf:function(e){return o(a(e))}})},9432:(e,t,r)=>{"use strict";var n=r(6518),i=r(8981),a=r(1072);n({target:"Object",stat:!0,forced:r(9039)(function(){a(1)})},{keys:function(e){return a(i(e))}})},6099:(e,t,r)=>{"use strict";var n=r(2140),i=r(6840),r=r(3179);n||i(Object.prototype,"toString",r,{unsafe:!0})},6034:(e,t,r)=>{"use strict";var n=r(6518),i=r(2357).values;n({target:"Object",stat:!0},{values:function(e){return i(e)}})},8459:(e,t,r)=>{"use strict";var n=r(6518),r=r(3904);n({global:!0,forced:parseFloat!==r},{parseFloat:r})},8940:(e,t,r)=>{"use strict";var n=r(6518),r=r(2703);n({global:!0,forced:parseInt!==r},{parseInt:r})},6499:(e,t,r)=>{"use strict";var n=r(6518),l=r(9565),f=r(9306),i=r(6043),a=r(1103),p=r(2652);n({target:"Promise",stat:!0,forced:r(537)},{all:function(e){var u=this,t=i.f(u),s=t.resolve,c=t.reject,r=a(function(){var n=f(u.resolve),i=[],a=0,o=1;p(e,function(e){var t=a++,r=!1;o++,l(n,u,e).then(function(e){r||(r=!0,i[t]=e,--o||s(i))},c)}),--o||s(i)});return r.error&&c(r.value),t.promise}})},2003:(e,t,r)=>{"use strict";var n=r(6518),i=r(6395),a=r(916).CONSTRUCTOR,o=r(550),u=r(7751),s=r(4901),r=r(6840),c=o&&o.prototype;n({target:"Promise",proto:!0,forced:a,real:!0},{catch:function(e){return this.then(void 0,e)}}),!i&&s(o)&&(n=u("Promise").prototype.catch,c.catch!==n&&r(c,"catch",n,{unsafe:!0}))},436:(e,z,t)=>{"use strict";function a(e,t){var r,n,i,a,o=t.value,u=1===t.state,s=u?e.ok:e.fail,c=e.resolve,l=e.reject,f=e.domain;try{s?(u||(2===t.rejection&&(a=t,h(d,m,function(){var e=a.facade;p?S.emit("rejectionHandled",e):T("rejectionhandled",e,a.value)})),t.rejection=1),!0===s?r=o:(f&&f.enter(),r=s(o),f&&(f.exit(),i=!0)),r===e.promise?l(new E("Promise-chain cycle")):(n=F(r))?h(n,r,c,l):c(r)):l(o)}catch(e){f&&!i&&f.exit(),l(e)}}var r,n,i,o=t(6518),u=t(6395),p=t(9088),m=t(4475),h=t(9565),s=t(6840),c=t(2967),R=t(687),q=t(7633),j=t(9306),l=t(4901),P=t(34),L=t(679),U=t(2293),d=t(9225).set,f=t(1955),$=t(3138),H=t(1103),G=t(8265),y=t(1181),v=t(550),g=t(916),t=t(6043),x="Promise",b=g.CONSTRUCTOR,V=g.REJECTION_EVENT,g=g.SUBCLASSING,w=y.getterFor(x),Z=y.set,y=v&&v.prototype,N=v,D=y,E=m.TypeError,A=m.document,S=m.process,C=t.f,W=C,Y=!!(A&&A.createEvent&&m.dispatchEvent),M="unhandledrejection",F=function(e){var t;return!(!P(e)||!l(t=e.then))&&t},O=function(r,i){r.notified||(r.notified=!0,f(function(){for(var e,n,t=r.reactions;e=t.get();)a(e,r);r.notified=!1,i&&!r.rejection&&(n=r,h(d,m,function(){var e,t=n.facade,r=n.value;if(_(n)&&(e=H(function(){p?S.emit("unhandledRejection",r,t):T(M,t,r)}),n.rejection=p||_(n)?2:1,e.error))throw e.value}))}))},T=function(e,t,r){var n;Y?((n=A.createEvent("Event")).promise=t,n.reason=r,n.initEvent(e,!1,!0),m.dispatchEvent(n)):n={promise:t,reason:r},!V&&(t=m["on"+e])?t(n):e===M&&$("Unhandled promise rejection",r)},_=function(e){return 1!==e.rejection&&!e.parent},B=function(t,r,n){return function(e){t(r,e,n)}},k=function(e,t,r){e.done||(e.done=!0,(e=r?r:e).value=t,e.state=2,O(e,!0))},I=function(r,e,t){if(!r.done){r.done=!0,t&&(r=t);try{if(r.facade===e)throw new E("Promise can't be resolved itself");var n=F(e);n?f(function(){var t={done:!1};try{h(n,e,B(I,t,r),B(k,t,r))}catch(e){k(t,e,r)}}):(r.value=e,r.state=1,O(r,!1))}catch(e){k({done:!1},e,r)}}};if(b&&(D=(N=function(e){L(this,D),j(e),h(r,this);var t=w(this);try{e(B(I,t),B(k,t))}catch(e){k(t,e)}}).prototype,(r=function(e){Z(this,{type:x,done:!1,notified:!1,parent:!1,reactions:new G,rejection:!1,state:0,value:void 0})}).prototype=s(D,"then",function(e,t){var r=w(this),n=C(U(this,N));return r.parent=!0,n.ok=!l(e)||e,n.fail=l(t)&&t,n.domain=p?S.domain:void 0,0===r.state?r.reactions.add(n):f(function(){a(n,r)}),n.promise}),n=function(){var e=new r,t=w(e);this.promise=e,this.resolve=B(I,t),this.reject=B(k,t)},t.f=C=function(e){return e===N||void 0===e?new n:W(e)},!u&&l(v)&&y!==Object.prototype)){i=y.then,g||s(y,"then",function(e,t){var r=this;return new N(function(e,t){h(i,r,e,t)}).then(e,t)},{unsafe:!0});try{delete y.constructor}catch(e){}c&&c(y,D)}o({global:!0,constructor:!0,wrap:!0,forced:b},{Promise:N}),R(N,x,!1,!0),q(x)},3362:(e,t,r)=>{"use strict";r(436),r(6499),r(2003),r(7743),r(1481),r(280)},7743:(e,t,r)=>{"use strict";var n=r(6518),a=r(9565),o=r(9306),u=r(6043),s=r(1103),c=r(2652);n({target:"Promise",stat:!0,forced:r(537)},{race:function(e){var r=this,n=u.f(r),i=n.reject,t=s(function(){var t=o(r.resolve);c(e,function(e){a(t,r,e).then(n.resolve,i)})});return t.error&&i(t.value),n.promise}})},1481:(e,t,r)=>{"use strict";var n=r(6518),i=r(6043);n({target:"Promise",stat:!0,forced:r(916).CONSTRUCTOR},{reject:function(e){var t=i.f(this);return(0,t.reject)(e),t.promise}})},280:(e,t,r)=>{"use strict";var n=r(6518),i=r(7751),a=r(6395),o=r(550),u=r(916).CONSTRUCTOR,s=r(3438),c=i("Promise"),l=a&&!u;n({target:"Promise",stat:!0,forced:a||u},{resolve:function(e){return s(l&&this===c?o:this,e)}})},825:(e,t,r)=>{"use strict";var n=r(6518),i=r(7751),a=r(8745),o=r(566),u=r(5548),s=r(8551),c=r(34),l=r(2360),r=r(9039),f=i("Reflect","construct"),p=Object.prototype,m=[].push,h=r(function(){function e(){}return!(f(function(){},[],e)instanceof e)}),d=!r(function(){f(function(){})}),i=h||d;n({target:"Reflect",stat:!0,forced:i,sham:i},{construct:function(e,t){u(e),s(t);var r=arguments.length<3?e:u(arguments[2]);if(d&&!h)return f(e,t,r);if(e===r){switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3])}var n=[null];return a(m,n,t),new(a(o,e,n))}n=r.prototype,r=l(c(n)?n:p),n=a(e,r,t);return c(n)?n:r}})},4864:(z,R,e)=>{"use strict";var t=e(3724),r=e(4475),n=e(9504),i=e(2796),c=e(3167),l=e(6699),f=e(2360),a=e(8480).f,p=e(1625),m=e(788),h=e(655),d=e(1034),o=e(8429),u=e(1056),s=e(6840),y=e(9039),v=e(9297),g=e(1181).enforce,x=e(7633),b=e(8227),w=e(3635),N=e(8814),D=b("match"),E=r.RegExp,A=E.prototype,S=r.SyntaxError,q=n(A.exec),C=n("".charAt),M=n("".replace),F=n("".indexOf),j=n("".slice),P=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,O=/a/g,T=/a/g,e=new E(O)!==O,_=o.MISSED_STICKY,L=o.UNSUPPORTED_Y;if(i("RegExp",t&&(!e||_||w||N||y(function(){return T[D]=!1,E(O)!==O||E(T)===T||"/a/i"!==String(E(O,"i"))})))){for(var B=function(e,t){var r,n,i=p(A,this),a=m(e),o=void 0===t,u=[],s=e;if(!i&&a&&o&&e.constructor===B)return e;if((a||p(A,e))&&(e=e.source,o&&(t=d(s))),e=void 0===e?"":h(e),t=void 0===t?"":h(t),s=e,a=t=w&&"dotAll"in O&&(r=!!t&&-1<F(t,"s"))?M(t,/s/g,""):t,_&&"sticky"in O&&(n=!!t&&-1<F(t,"y"))&&L&&(t=M(t,/y/g,"")),N&&(e=(o=function(e){for(var t,r=e.length,n=0,i="",a=[],o=f(null),u=!1,s=!1,c=0,l="";n<=r;n++){if("\\"===(t=C(e,n)))t+=C(e,++n);else if("]"===t)u=!1;else if(!u)switch(!0){case"["===t:u=!0;break;case"("===t:q(P,j(e,n+1))&&(n+=2,s=!0),i+=t,c++;continue;case">"===t&&s:if(""===l||v(o,l))throw new S("Invalid capture group name");o[l]=!0,s=!(a[a.length]=[l,c]),l="";continue}s?l+=t:i+=t}return[i,a]}(e))[0],u=o[1]),o=c(E(e,t),i?this:A,B),(r||n||u.length)&&(t=g(o),r&&(t.dotAll=!0,t.raw=B(function(e){for(var t,r=e.length,n=0,i="",a=!1;n<=r;n++)"\\"!==(t=C(e,n))?a||"."!==t?("["===t?a=!0:"]"===t&&(a=!1),i+=t):i+="[\\s\\S]":i+=t+C(e,++n);return i}(e),a)),n&&(t.sticky=!0),u.length&&(t.groups=u)),e!==s)try{l(o,"source",""===s?"(?:)":s)}catch(e){}return o},k=a(E),I=0;k.length>I;)u(B,E,k[I++]);(A.constructor=B).prototype=A,s(r,"RegExp",B,{constructor:!0})}x("RegExp")},7465:(e,t,r)=>{"use strict";var n=r(3724),i=r(3635),a=r(4576),o=r(2106),u=r(1181).get,s=RegExp.prototype,c=TypeError;n&&i&&o(s,"dotAll",{configurable:!0,get:function(){if(this!==s){if("RegExp"===a(this))return!!u(this).dotAll;throw new c("Incompatible receiver, RegExp required")}}})},7495:(e,t,r)=>{"use strict";var n=r(6518),r=r(7323);n({target:"RegExp",proto:!0,forced:/./.exec!==r},{exec:r})},7745:(e,t,r)=>{"use strict";var n=r(3724),i=r(8429).MISSED_STICKY,a=r(4576),o=r(2106),u=r(1181).get,s=RegExp.prototype,c=TypeError;n&&i&&o(s,"sticky",{configurable:!0,get:function(){if(this!==s){if("RegExp"===a(this))return!!u(this).sticky;throw new c("Incompatible receiver, RegExp required")}}})},906:(e,t,r)=>{"use strict";r(7495);var n,i=r(6518),a=r(9565),o=r(4901),u=r(8551),s=r(655),r=(n=!1,(r=/[ac]/).exec=function(){return n=!0,/./.exec.apply(this,arguments)},!0===r.test("abc")&&n),c=/./.test;i({target:"RegExp",proto:!0,forced:!r},{test:function(e){var t=u(this),e=s(e),r=t.exec;if(!o(r))return a(c,t,e);r=a(r,t,e);return null!==r&&(u(r),!0)}})},8781:(e,t,r)=>{"use strict";var n=r(350).PROPER,i=r(6840),a=r(8551),o=r(655),u=r(9039),s=r(1034),r="toString",c=RegExp.prototype,l=c[r],u=u(function(){return"/a/b"!==l.call({source:"a",flags:"b"})}),n=n&&l.name!==r;(u||n)&&i(c,r,function(){var e=a(this);return"/"+o(e.source)+"/"+o(s(e))},{unsafe:!0})},2405:(e,t,r)=>{"use strict";r(6468)("Set",function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},r(6938))},1415:(e,t,r)=>{"use strict";r(2405)},1699:(e,t,r)=>{"use strict";var n=r(6518),i=r(9504),a=r(511),o=r(7750),u=r(655),r=r(1436),s=i("".indexOf);n({target:"String",proto:!0,forced:!r("includes")},{includes:function(e){return!!~s(u(o(this)),u(a(e)),1<arguments.length?arguments[1]:void 0)}})},7764:(e,t,r)=>{"use strict";var n=r(8183).charAt,i=r(655),a=r(1181),o=r(1088),u=r(2529),s="String Iterator",c=a.set,l=a.getterFor(s);o(String,"String",function(e){c(this,{type:s,string:i(e),index:0})},function(){var e=l(this),t=e.string,r=e.index;return r>=t.length?u(void 0,!0):(t=n(t,r),e.index+=t.length,u(t,!1))})},1761:(e,t,r)=>{"use strict";var i=r(9565),n=r(9228),c=r(8551),a=r(4117),l=r(8014),f=r(655),o=r(7750),p=r(5966),m=r(7829),h=r(6682);n("match",function(n,u,s){return[function(e){var t=o(this),r=a(e)?void 0:p(e,n);return r?i(r,e,t):new RegExp(e)[n](f(t))},function(e){var t=c(this),r=f(e),e=s(u,t,r);if(e.done)return e.value;if(!t.global)return h(t,r);for(var n=t.unicode,i=[],a=t.lastIndex=0;null!==(o=h(t,r));){var o=f(o[0]);""===(i[a]=o)&&(t.lastIndex=m(r,l(t.lastIndex),n)),a++}return 0===a?null:i}]})},2781:(e,t,r)=>{"use strict";r(6518)({target:"String",proto:!0},{repeat:r(2333)})},5440:(e,t,r)=>{"use strict";var N=r(8745),i=r(9565),n=r(9504),a=r(9228),o=r(9039),D=r(8551),E=r(4901),u=r(4117),A=r(1291),S=r(8014),C=r(655),s=r(7750),M=r(7829),c=r(5966),F=r(2478),O=r(6682),l=r(8227)("replace"),T=Math.max,_=Math.min,B=n([].concat),k=n([].push),I=n("".indexOf),z=n("".slice),r="$0"==="a".replace(/./,"$0"),f=!!/./[l]&&""===/./[l]("a","$0");a("replace",function(e,x,b){var w=f?"$":"$0";return[function(e,t){var r=s(this),n=u(e)?void 0:c(e,l);return n?i(n,e,r,t):i(x,C(r),e,t)},function(e,t){var r=D(this),n=C(e);if("string"==typeof t&&-1===I(t,w)&&-1===I(t,"$<")){e=b(x,r,n,t);if(e.done)return e.value}var i=E(t);i||(t=C(t));var a,o=r.global;o&&(a=r.unicode,r.lastIndex=0);for(var u,s=[];null!==(u=O(r,n))&&(k(s,u),o);)""===C(u[0])&&(r.lastIndex=M(n,S(r.lastIndex),a));for(var c,l="",f=0,p=0;p<s.length;p++){for(var m=C((u=s[p])[0]),h=T(_(A(u.index),n.length),0),d=[],y=1;y<u.length;y++)k(d,void 0===(c=u[y])?c:String(c));var v=u.groups,g=i?(g=B([m],d,h,n),void 0!==v&&k(g,v),C(N(t,void 0,g))):F(m,n,h,d,v,t);f<=h&&(l+=z(n,f,h)+g,f=h+m.length)}return l+z(n,f)}]},!!o(function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")})||!r||f)},8718:(e,t,r)=>{"use strict";var n=r(6518),i=r(7240);n({target:"String",proto:!0,forced:r(3061)("sub")},{sub:function(){return i(this,"sub","","")}})},375:(e,t,r)=>{"use strict";var n=r(6518),i=r(9504),a=r(7750),o=r(1291),u=r(655),s=i("".slice),c=Math.max,l=Math.min;n({target:"String",proto:!0,forced:!"".substr||"b"!=="ab".substr(-1)},{substr:function(e,t){var r=u(a(this)),n=r.length,e=o(e);return(e=e===1/0?0:e)<0&&(e=c(n+e,0)),(t=void 0===t?n:o(t))<=0||t===1/0||e>=(t=l(e+t,n))?"":s(r,e,t)}})},2762:(e,t,r)=>{"use strict";var n=r(6518),i=r(3802).trim;n({target:"String",proto:!0,forced:r(706)("trim")},{trim:function(){return i(this)}})},6761:(z,R,e)=>{"use strict";function a(e,t,r){var n=ue(F,t);n&&delete F[t],T(e,t,r),n&&e!==F&&T(F,t,n)}function t(e,t){var r=_[e]=b(O);return ne(r,{type:M,tag:e,description:t}),m||(r.description=t),r}function n(e,t,r){return e===F&&n(B,t,r),y(e),t=g(t),y(r),d(_,t)?(r.enumerable?(d(e,C)&&e[C][t]&&(e[C][t]=!1),r=b(r,{enumerable:x(0,!1)})):(d(e,C)||T(e,C,x(1,b(null))),e[C][t]=!0),I(e,t,r)):T(e,t,r)}function r(t,e){y(t);var r=v(e),e=w(r).concat(s(r));return S(e,function(e){m&&!f(i,r,e)||n(t,e,r[e])}),t}function i(e){var e=g(e),t=f(ce,this,e);return!(this===F&&d(_,e)&&!d(B,e))&&(!(t||!d(this,e)||!d(_,e)||d(this,C)&&this[C][e])||t)}function o(e,t){var r,e=v(e),t=g(t);if(e!==F||!d(_,t)||d(B,t))return!(r=ue(e,t))||!d(_,t)||d(e,C)&&e[C][t]||(r.enumerable=!0),r}function u(e){var e=se(v(e)),t=[];return S(e,function(e){d(_,e)||d(J,e)||le(t,e)}),t}function s(e){var t=e===F,e=se(t?B:v(e)),r=[];return S(e,function(e){!d(_,e)||t&&!d(F,e)||le(r,_[e])}),r}var c=e(6518),l=e(4475),f=e(9565),p=e(9504),q=e(6395),m=e(3724),h=e(4495),j=e(9039),d=e(9297),P=e(1625),y=e(8551),v=e(5397),g=e(6969),L=e(655),x=e(6980),b=e(2360),w=e(1072),U=e(8480),$=e(298),H=e(3717),G=e(7347),V=e(4913),Z=e(6801),W=e(8773),N=e(6840),Y=e(2106),D=e(5745),E=e(6119),J=e(421),X=e(3392),Q=e(8227),K=e(1951),ee=e(5749),te=e(8242),re=e(687),A=e(1181),S=e(9213).forEach,C=E("hidden"),M="Symbol",e="prototype",ne=A.set,ie=A.getterFor(M),F=Object[e],E=l.Symbol,O=E&&E[e],ae=l.RangeError,oe=l.TypeError,A=l.QObject,ue=G.f,T=V.f,se=$.f,ce=W.f,le=p([].push),_=D("symbols"),B=D("op-symbols"),p=D("wks"),k=!A||!A[e]||!A[e].findChild,I=m&&j(function(){return 7!==b(T({},"a",{get:function(){return T(this,"a",{value:7}).a}})).a})?a:T;h||(N(O=(E=function(){if(P(O,this))throw new oe("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?L(arguments[0]):void 0,n=X(e),i=function(e){var t=void 0===this?l:this,r=(t===F&&f(i,B,e),d(t,C)&&d(t[C],n)&&(t[C][n]=!1),x(1,e));try{I(t,n,r)}catch(e){if(!(e instanceof ae))throw e;a(t,n,r)}};return m&&k&&I(F,n,{configurable:!0,set:i}),t(n,e)})[e],"toString",function(){return ie(this).tag}),N(E,"withoutSetter",function(e){return t(X(e),e)}),W.f=i,V.f=n,Z.f=r,G.f=o,U.f=$.f=u,H.f=s,K.f=function(e){return t(Q(e),e)},m&&(Y(O,"description",{configurable:!0,get:function(){return ie(this).description}}),q||N(F,"propertyIsEnumerable",i,{unsafe:!0}))),c({global:!0,constructor:!0,wrap:!0,forced:!h,sham:!h},{Symbol:E}),S(w(p),function(e){ee(e)}),c({target:M,stat:!0,forced:!h},{useSetter:function(){k=!0},useSimple:function(){k=!1}}),c({target:"Object",stat:!0,forced:!h,sham:!m},{create:function(e,t){return void 0===t?b(e):r(b(e),t)},defineProperty:n,defineProperties:r,getOwnPropertyDescriptor:o}),c({target:"Object",stat:!0,forced:!h},{getOwnPropertyNames:u}),te(),re(E,M),J[C]=!0},9463:(e,t,r)=>{"use strict";var n,i,a,o,u,s,c,l=r(6518),f=r(3724),p=r(4475),m=r(9504),h=r(9297),d=r(4901),y=r(1625),v=r(655),g=r(2106),r=r(7740),x=p.Symbol,b=x&&x.prototype;!f||!d(x)||"description"in b&&void 0===x().description||(n={},r(p=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:v(arguments[0]),t=y(b,this)?new x(e):void 0===e?x():x(e);return""===e&&(n[t]=!0),t},x),(p.prototype=b).constructor=p,i="Symbol(description detection)"===String(x("description detection")),a=m(b.valueOf),o=m(b.toString),u=/^Symbol\((.*)\)[^)]+$/,s=m("".replace),c=m("".slice),g(b,"description",{configurable:!0,get:function(){var e=a(this);if(h(n,e))return"";e=o(e),e=i?c(e,7,-1):s(e,u,"$1");return""===e?void 0:e}}),l({global:!0,constructor:!0,forced:!0},{Symbol:p}))},1510:(e,t,r)=>{"use strict";var n=r(6518),i=r(7751),a=r(9297),o=r(655),u=r(5745),r=r(1296),s=u("string-to-symbol-registry"),c=u("symbol-to-string-registry");n({target:"Symbol",stat:!0,forced:!r},{for:function(e){e=o(e);if(a(s,e))return s[e];var t=i("Symbol")(e);return s[e]=t,c[t]=e,t}})},2259:(e,t,r)=>{"use strict";r(5749)("iterator")},2675:(e,t,r)=>{"use strict";r(6761),r(1510),r(7812),r(3110),r(9773)},7812:(e,t,r)=>{"use strict";var n=r(6518),i=r(9297),a=r(757),o=r(6823),u=r(5745),r=r(1296),s=u("symbol-to-string-registry");n({target:"Symbol",stat:!0,forced:!r},{keyFor:function(e){if(!a(e))throw new TypeError(o(e)+" is not a symbol");if(i(s,e))return s[e]}})},3500:(e,t,r)=>{"use strict";function n(t){if(t&&t.forEach!==s)try{c(t,"forEach",s)}catch(e){t.forEach=s}}var i,a=r(4475),o=r(7400),u=r(9296),s=r(235),c=r(6699);for(i in o)o[i]&&n(a[i]&&a[i].prototype);n(u)},2953:(e,t,r)=>{"use strict";function n(e,t){if(e){if(e[f]!==p)try{c(e,f,p)}catch(t){e[f]=p}if(l(e,t,!0),o[t])for(var r in s)if(e[r]!==s[r])try{c(e,r,s[r])}catch(t){e[r]=s[r]}}}var i,a=r(4475),o=r(7400),u=r(9296),s=r(3792),c=r(6699),l=r(687),f=r(8227)("iterator"),p=s.values;for(i in o)n(a[i]&&a[i].prototype,i);n(u,"DOMTokenList")},2369:function(e){e.exports=function(){"use strict";function M(){return!0}function le(){return!1}function fe(){}const F="Argument is not a typed-function.";return function e(){function l(e){return"object"==typeof e&&null!==e&&e.constructor===Object}const t=[{name:"number",test:function(e){return"number"==typeof e}},{name:"string",test:function(e){return"string"==typeof e}},{name:"boolean",test:function(e){return"boolean"==typeof e}},{name:"Function",test:function(e){return"function"==typeof e}},{name:"Array",test:Array.isArray},{name:"Date",test:function(e){return e instanceof Date}},{name:"RegExp",test:function(e){return e instanceof RegExp}},{name:"Object",test:l},{name:"null",test:function(e){return null===e}},{name:"undefined",test:function(e){return void 0===e}}],r={name:"any",test:M,isAny:!0};let a,o,n=0,J={createCount:0};function u(e){var t=a.get(e);if(t)return t;let r='Unknown type "'+e+'"';var n=e.toLowerCase();let i;for(i of o)if(i.toLowerCase()===n){r+='. Did you mean "'+i+'" ?';break}throw new TypeError(r)}function i(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"any";const r=e?u(e).index:o.length,n=[];for(let e=0;e<t.length;++e){if(!t[e]||"string"!=typeof t[e].name||"function"!=typeof t[e].test)throw new TypeError("Object with properties {name: string, test: function} expected");const i=t[e].name;if(a.has(i))throw new TypeError('Duplicate type name "'+i+'"');n.push(i),a.set(i,{name:i,test:t[e].test,isAny:t[e].isAny,index:r+e,conversionsTo:[]})}const i=o.slice(r);o=o.slice(0,r).concat(n).concat(i);for(let e=r+n.length;e<o.length;++e)a.get(o[e]).index=e}function s(){a=new Map,o=[],n=0,i([r],!1)}function c(r){var e=o.filter(e=>{const t=a.get(e);return!t.isAny&&t.test(r)});return e.length?e:["any"]}function f(e){return e&&"function"==typeof e&&"_typedFunctionData"in e}function p(r,n,i){if(!f(r))throw new TypeError(F);const a=i&&i.exact,o=Q(Array.isArray(n)?n.join(","):n),e=X(o);if(!a||e in r.signatures){const n=r._typedFunctionData.signatureMap.get(e);if(n)return n}var u=o.length;let s,t;if(a){let e;for(e in s=[],r.signatures)s.push(r._typedFunctionData.signatureMap.get(e))}else s=r._typedFunctionData.signatures;for(let t=0;t<u;++t){const n=o[t],i=[];let e;for(e of s){const a=h(e.params,t);if(a&&(!n.restParam||a.restParam)){if(!a.hasAny){const r=m(a);if(n.types.some(e=>!r.has(e.name)))continue}i.push(e)}}if(0===(s=i).length)break}for(t of s)if(t.params.length<=u)return t;throw new TypeError("Signature not found (signature: "+(r.name||"unnamed")+"("+X(o,", ")+"))")}function X(e,t){t=1<arguments.length&&void 0!==t?t:",";return e.map(e=>e.name).join(t)}function oe(e){const t=function(e){if(0===e.length)return[];const r=e.map(u);1<e.length&&r.sort((e,t)=>e.index-t.index);let n=r[0].conversionsTo;if(1===e.length)return n;n=n.concat([]);const i=new Set(e);for(let t=1;t<r.length;++t){let e;for(e of r[t].conversionsTo)i.has(e.from)||(n.push(e),i.add(e.from))}return n}(e.types.map(e=>e.name));let r=e.hasAny,n=e.name;var i=t.map(function(e){var t=u(e.from);return r=t.isAny||r,n+="|"+e.from,{name:e.from,typeIndex:t.index,test:t.test,isAny:t.isAny,conversion:e,conversionIndex:e.index}});return{types:e.types.concat(i),name:n,hasAny:r,hasConversion:0<i.length,restParam:e.restParam}}function m(t){return t.typeSet||(t.typeSet=new Set,t.types.forEach(e=>t.typeSet.add(e.name))),t.typeSet}function Q(e){const t=[];if("string"!=typeof e)throw new TypeError("Signatures must be strings");const r=e.trim();if(""===r)return t;const n=r.split(",");for(let e=0;e<n.length;++e){const r=function(e){const t=0===e.indexOf("..."),r=(t?3<e.length?e.slice(3):"any":e).split("|").map(e=>u(e.trim()));let n=!1,i=t?"...":"";return{types:r.map(function(e){return n=e.isAny||n,i+=e.name+"|",{name:e.name,typeIndex:e.index,test:e.test,isAny:e.isAny,conversion:null,conversionIndex:-1}}),name:i.slice(0,-1),hasAny:n,hasConversion:!1,restParam:t}}(n[e].trim());if(r.restParam&&e!==n.length-1)throw new SyntaxError('Unexpected rest parameter "'+n[e]+'": only allowed for the last parameter');if(0===r.types.length)return null;t.push(r)}return t}function K(e){e=ie(e);return!!e&&e.restParam}function ee(e){if(e&&0!==e.types.length){if(1===e.types.length)return u(e.types[0].name).test;if(2===e.types.length){const M=u(e.types[0].name).test,t=u(e.types[1].name).test;return function(e){return M(e)||t(e)}}{const M=e.types.map(function(e){return u(e.name).test});return function(t){for(let e=0;e<M.length;e++)if(M[e](t))return!0;return!1}}}return M}function h(e,t){return t<e.length?e[t]:K(e)?ie(e):null}function te(e,t){e=h(e,t);return e?m(e):new Set}function re(e){return null===e.conversion||void 0===e.conversion}function d(e,r){const n=new Set;return e.forEach(e=>{let t;for(t of te(e.params,r))n.add(t)}),n.has("any")?["any"]:Array.from(n)}function y(r,n,e){let t,i;var a=r||"unnamed";let o,u=e;for(o=0;o<n.length;o++){const r=[];if(u.forEach(e=>{const t=ee(h(e.params,o));(o<e.params.length||K(e.params))&&t(n[o])&&r.push(e)}),0===r.length){if(0<(i=d(u,o)).length){const r=c(n[o]);return(t=new TypeError("Unexpected type of argument in function "+a+" (expected: "+i.join(" or ")+", actual: "+r.join(" | ")+", index: "+o+")")).data={category:"wrongType",fn:a,index:o,actual:r,expected:i},t}}else u=r}r=u.map(function(e){return K(e.params)?1/0:e.params.length});if(n.length<Math.min.apply(null,r))return i=d(u,o),(t=new TypeError("Too few arguments in function "+a+" (expected: "+i.join(" or ")+", index: "+n.length+")")).data={category:"tooFewArgs",fn:a,index:n.length,expected:i},t;e=Math.max.apply(null,r);if(n.length>e)return(t=new TypeError("Too many arguments in function "+a+" (expected: "+e+", actual: "+n.length+")")).data={category:"tooManyArgs",fn:a,index:n.length,expectedLength:e},t;const s=[];for(let e=0;e<n.length;++e)s.push(c(n[e]).join("|"));return(t=new TypeError('Arguments of type "'+s.join(", ")+'" do not match any of the defined signatures of function '+a+".")).data={category:"mismatch",actual:s},t}function v(t){let r=o.length+1;for(let e=0;e<t.types.length;e++)re(t.types[e])&&(r=Math.min(r,t.types[e].typeIndex));return r}function g(t){let r=n+1;for(let e=0;e<t.types.length;e++)re(t.types[e])||(r=Math.min(r,t.types[e].conversionIndex));return r}function ue(e,t){var r=e.params,n=t.params,e=ie(r),t=ie(n),i=K(r),a=K(n);if(i&&e.hasAny){if(!a||!t.hasAny)return 1}else if(a&&t.hasAny)return-1;let o,u=0,s=0;for(o of r)o.hasAny&&++u,o.hasConversion&&++s;let c=0,l=0;for(o of n)o.hasAny&&++c,o.hasConversion&&++l;if(u!==c)return u-c;if(i&&e.hasConversion){if(!a||!t.hasConversion)return 1}else if(a&&t.hasConversion)return-1;if(s!==l)return s-l;if(i){if(!a)return 1}else if(a)return-1;e=(r.length-n.length)*(i?-1:1);if(0!=e)return e;const f=[];let p,m=0;for(let e=0;e<r.length;++e){const t=function(e,t){if(e.hasAny){if(!t.hasAny)return 1}else if(t.hasAny)return-1;if(e.restParam){if(!t.restParam)return 1}else if(t.restParam)return-1;if(e.hasConversion){if(!t.hasConversion)return 1}else if(t.hasConversion)return-1;var r=v(e)-v(t);return r<0?-1:0<r?1:(r=g(e)-g(t))<0?-1:0<r?1:0}(r[e],n[e]);f.push(t),m+=t}if(0!==m)return m;for(p of f)if(0!==p)return p;return 0}function se(e){let t,r,n,i;const a=[],o=[];switch(e.types.forEach(function(e){e.conversion&&(a.push(u(e.conversion.from).test),o.push(e.conversion.convert))}),o.length){case 0:return function(e){return e};case 1:return t=a[0],n=o[0],function(e){return t(e)?n(e):e};case 2:return t=a[0],r=a[1],n=o[0],i=o[1],function(e){return t(e)?n(e):r(e)?i(e):e};default:return function(t){for(let e=0;e<o.length;e++)if(a[e](t))return o[e](t);return t}}}function ce(e,r,n){const i=e.map(e=>D(e)?w(e.referToSelf.callback):N(e)?b(e.referTo.references,e.referTo.callback):e),a=new Array(i.length).fill(!1);let o=!0;for(;o;){let t=!(o=!1);for(let e=0;e<i.length;++e)if(!a[e]){const u=i[e];if(D(u))i[e]=u.referToSelf.callback(n),i[e].referToSelf=u.referToSelf,a[e]=!0,t=!1;else if(N(u)){const n=function(e,t,r){const n=[];let i;for(i of e){var a=r[i];if("number"!=typeof a)throw new TypeError('No definition for referenced signature "'+i+'"');if("function"!=typeof(a=t[a]))return!1;n.push(a)}return n}(u.referTo.references,i,r);n?(i[e]=u.referTo.callback.apply(this,n),i[e].referTo=u.referTo,a[e]=!0,t=!1):o=!0}}if(t&&o)throw new SyntaxError("Circular reference detected in resolving typed.referTo")}return i}function S(t,r){if(J.createCount++,0===Object.keys(r).length)throw new SyntaxError("No signatures provided");if(J.warnAgainstDeprecatedThis){var n=r;const I=/\bthis(\(|\.signatures\b)/;Object.keys(n).forEach(e=>{const t=n[e];if(I.test(t.toString()))throw new SyntaxError("Using `this` to self-reference a function is deprecated since typed-function@3. Use typed.referTo and typed.referToSelf instead.")})}const i=[],a=[],o={},u=[];let s;for(s in r)if(Object.prototype.hasOwnProperty.call(r,s)){const t=Q(s);if(t){i.forEach(function(e){if(function(n,i){const a=Math.max(n.length,i.length);for(let r=0;r<a;r++){const a=te(n,r),o=te(i,r);let e,t=!1;for(e of o)if(a.has(e)){t=!0;break}if(!t)return}const e=n.length,o=i.length,t=K(n),r=K(i);return t?r?e===o:o>=e:r?e>=o:e===o}(e,t))throw new TypeError('Conflicting signatures "'+X(e)+'" and "'+X(t)+'".')}),i.push(t);const le=a.length,fe=(a.push(r[s]),t.map(oe));let e;for(e of function t(r,n,i){if(n<r.length){const o=r[n];let e=[];if(o.restParam){const t=o.types.filter(re);t.length<o.types.length&&e.push({types:t,name:"..."+t.map(e=>e.name).join("|"),hasAny:t.some(e=>e.isAny),hasConversion:!1,restParam:!0}),e.push(o)}else e=o.types.map(function(e){return{types:[e],name:e.name,hasAny:e.isAny,hasConversion:e.conversion,restParam:!1}});return a=e,Array.prototype.concat.apply([],a.map(function(e){return t(r,n+1,i.concat([e]))}))}var a;return[i]}(fe,0,[])){const t=X(e);u.push({params:e,name:t,fn:le}),e.every(e=>!e.hasConversion)&&(o[t]=le)}}}u.sort(ue);var e=ce(a,o,k);let c;for(c in o)Object.prototype.hasOwnProperty.call(o,c)&&(o[c]=e[o[c]]);const l=[],f=new Map;for(c of u)f.has(c.name)||(c.fn=e[c.fn],l.push(c),f.set(c.name,c));var p=l[0]&&l[0].params.length<=2&&!K(l[0].params),m=l[1]&&l[1].params.length<=2&&!K(l[1].params),h=l[2]&&l[2].params.length<=2&&!K(l[2].params),d=l[3]&&l[3].params.length<=2&&!K(l[3].params),y=l[4]&&l[4].params.length<=2&&!K(l[4].params),v=l[5]&&l[5].params.length<=2&&!K(l[5].params),g=p&&m&&h&&d&&y&&v;for(let e=0;e<l.length;++e)l[e].test=function(e){let r,n,i;if(K(e)){const n=(r=ne(e).map(ee)).length,i=ee(ie(e)),a=function(t){for(let e=n;e<t.length;e++)if(!i(t[e]))return!1;return!0};return function(t){for(let e=0;e<r.length;e++)if(!r[e](t[e]))return!1;return a(t)&&t.length>=n+1}}return 0===e.length?function(e){return 0===e.length}:1===e.length?(n=ee(e[0]),function(e){return n(e[0])&&1===e.length}):2===e.length?(n=ee(e[0]),i=ee(e[1]),function(e){return n(e[0])&&i(e[1])&&2===e.length}):(r=e.map(ee),function(t){for(let e=0;e<r.length;e++)if(!r[e](t[e]))return!1;return t.length===r.length})}(l[e].params);const x=p?ee(l[0].params[0]):le,b=m?ee(l[1].params[0]):le,w=h?ee(l[2].params[0]):le,N=d?ee(l[3].params[0]):le,D=y?ee(l[4].params[0]):le,E=v?ee(l[5].params[0]):le,A=p?ee(l[0].params[1]):le,S=m?ee(l[1].params[1]):le,C=h?ee(l[2].params[1]):le,M=d?ee(l[3].params[1]):le,F=y?ee(l[4].params[1]):le,O=v?ee(l[5].params[1]):le;for(let e=0;e<l.length;++e)l[e].implementation=function(e,n){let t=n;if(e.some(e=>e.hasConversion)){const i=K(e),a=e.map(se);t=function(){const t=[],r=i?arguments.length-1:arguments.length;for(let e=0;e<r;e++)t[e]=a[e](arguments[e]);return i&&(t[r]=arguments[r].map(a[r])),n.apply(this,t)}}let i=t;if(K(e)){const n=e.length-1;i=function(){return t.apply(this,ae(arguments,0,n).concat([ae(arguments,n)]))}}return i}(l[e].params,l[e].fn);const T=p?l[0].implementation:fe,_=m?l[1].implementation:fe,B=h?l[2].implementation:fe,z=d?l[3].implementation:fe,R=y?l[4].implementation:fe,q=v?l[5].implementation:fe,j=p?l[0].params.length:-1,P=m?l[1].params.length:-1,L=h?l[2].params.length:-1,U=d?l[3].params.length:-1,$=y?l[4].params.length:-1,H=v?l[5].params.length:-1,G=g?6:0,V=l.length,Z=l.map(e=>e.test),W=l.map(e=>e.implementation),Y=function(){for(let e=G;e<V;e++)if(Z[e](arguments))return W[e].apply(this,arguments);return J.onMismatch(t,arguments,l)};function k(e,t){return(arguments.length===j&&x(e)&&A(t)?T:arguments.length===P&&b(e)&&S(t)?_:arguments.length===L&&w(e)&&C(t)?B:arguments.length===U&&N(e)&&M(t)?z:arguments.length===$&&D(e)&&F(t)?R:arguments.length===H&&E(e)&&O(t)?q:Y).apply(this,arguments)}try{Object.defineProperty(k,"name",{value:t})}catch(t){}return k.signatures=o,k._typedFunctionData={signatures:l,signatureMap:f},k}function x(e,t,r){throw y(e,t,r)}function ne(e){return ae(e,0,e.length-1)}function ie(e){return e[e.length-1]}function ae(e,t,r){return Array.prototype.slice.call(e,t,r)}function b(e,t){return{referTo:{references:e,callback:t}}}function w(e){if("function"!=typeof e)throw new TypeError("Callback function expected as first argument");return{referToSelf:{callback:e}}}function N(e){return e&&"object"==typeof e.referTo&&Array.isArray(e.referTo.references)&&"function"==typeof e.referTo.callback}function D(e){return e&&"object"==typeof e.referToSelf&&"function"==typeof e.referToSelf.callback}function E(e,t){if(!e)return t;if(t&&t!==e){const r=new Error("Function names do not match (expected: "+e+", actual: "+t+")");throw r.data={actual:t,expected:e},r}return e}s(),i(t);var C=J;function A(e){if(!e||"string"!=typeof e.from||"string"!=typeof e.to||"function"!=typeof e.convert)throw new TypeError("Object with properties {from: string, to: string, convert: function} expected");if(e.to===e.from)throw new SyntaxError('Illegal to define conversion from "'+e.from+'" to itself.')}return(J=function(e){const n="string"==typeof e;let i=n?e:"";var a={};for(let r=n?1:0;r<arguments.length;++r){var o=arguments[r];let e,t={};if("function"==typeof o?(e=o.name,"string"==typeof o.signature?t[o.signature]=o:f(o)&&(t=o.signatures)):l(o)&&(t=o,n||(e=function(e){let t;for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(f(e[r])||"string"==typeof e[r].signature)&&(t=E(t,e[r].name));return t}(o))),0===Object.keys(t).length){const n=new TypeError("Argument to 'typed' at index "+r+" is not a (typed) function, nor an object with signatures as keys and functions as values.");throw n.data={index:r,argument:o},n}n||(i=E(i,e));{u=void 0;s=void 0;var u=a;var s=t;let e;for(e in s)if(Object.prototype.hasOwnProperty.call(s,e)){if(e in u&&s[e]!==u[e]){const c=new Error('Signature "'+e+'" is defined twice');throw c.data={signature:e,sourceFunction:s[e],destFunction:u[e]},c}u[e]=s[e]}}}return S(i||"",a)}).create=e,J.createCount=C.createCount,J.onMismatch=x,J.throwMismatchError=x,J.createError=y,J.clear=s,J.clearConversions=function(){let e;for(e of o)a.get(e).conversionsTo=[];n=0},J.addTypes=i,J._findType=u,J.referTo=function(){var e=ne(arguments).map(e=>X(Q(e))),t=ie(arguments);if("function"!=typeof t)throw new TypeError("Callback function expected as last argument");return b(e,t)},J.referToSelf=w,J.convert=function(t,e){const r=u(e);if(r.test(t))return t;const n=r.conversionsTo;if(0===n.length)throw new Error("There are no conversions to "+e+" defined.");for(let e=0;e<n.length;e++)if(u(n[e].from).test(t))return n[e].convert(t);throw new Error("Cannot convert "+t+" to "+e)},J.findSignature=p,J.find=function(e,t,r){return p(e,t,r).implementation},J.isTypedFunction=f,J.warnAgainstDeprecatedThis=!0,J.addType=function(e,t){let r="any";!1!==t&&a.has("Object")&&(r="Object"),J.addTypes([e],r)},J.addConversion=function(t){A(t);const e=u(t.to);if(!e.conversionsTo.every(function(e){return e.from!==t.from}))throw new Error('There is already a conversion from "'+t.from+'" to "'+e.name+'"');e.conversionsTo.push({from:t.from,convert:t.convert,index:n++})},J.addConversions=function(e){e.forEach(J.addConversion)},J.removeConversion=function(r){A(r);const e=u(r.to),t=function(t){for(let e=0;e<t.length;e++)if(t[e].from===r.from)return t[e]}(e.conversionsTo);if(!t)throw new Error("Attempt to remove nonexistent conversion from "+r.from+" to "+r.to);if(t.convert!==r.convert)throw new Error("Conversion to remove does not match existing conversion");var n=e.conversionsTo.indexOf(t);e.conversionsTo.splice(n,1)},J.resolve=function(e,t){if(!f(e))throw new TypeError(F);const r=e._typedFunctionData.signatures;for(let e=0;e<r.length;++e)if(r[e].test(t))return r[e];return null},J}()}()}},n={};function Mh(e){var t=n[e];if(void 0!==t)return t.exports;t=n[e]={id:e,loaded:!1,exports:{}};return r[e].call(t.exports,t,t.exports,Mh),t.loaded=!0,t.exports}Mh.amdD=function(){throw new Error("define cannot be used indirect")},Mh.amdO={},Mh.d=(e,t)=>{for(var r in t)Mh.o(t,r)&&!Mh.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},Mh.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),Mh.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},Mh.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var Fh={};return(()=>{"use strict";Mh.d(Fh,{default:()=>Ch});var t={};function V(e){return(V="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 Ee(e){return"number"==typeof e}function Ae(e){return!(!e||"object"!==V(e)||"function"!=typeof e.constructor)&&(!0===e.isBigNumber&&"object"===V(e.constructor.prototype)&&!0===e.constructor.prototype.isBigNumber||"function"==typeof e.constructor.isDecimal&&!0===e.constructor.isDecimal(e))}function Oe(e){return e&&"object"===V(e)&&!0===Object.getPrototypeOf(e).isComplex||!1}function Te(e){return e&&"object"===V(e)&&!0===Object.getPrototypeOf(e).isFraction||!1}function Z(e){return e&&!0===e.constructor.prototype.isUnit||!1}function S(e){return"string"==typeof e}Mh.r(t),Mh.d(t,{createAbs:()=>Qi,createAccessorNode:()=>bl,createAcos:()=>Ks,createAcosh:()=>yc,createAcot:()=>vc,createAcoth:()=>gc,createAcsc:()=>xc,createAcsch:()=>bc,createAdd:()=>al,createAddScalar:()=>ta,createAnd:()=>rs,createAndTransform:()=>vh,createApply:()=>Ki,createApplyTransform:()=>Z0,createArg:()=>po,createArrayNode:()=>Dl,createAsec:()=>wc,createAsech:()=>Nc,createAsin:()=>Dc,createAsinh:()=>Ec,createAssignmentNode:()=>Tl,createAtan:()=>Ac,createAtan2:()=>Sc,createAtanh:()=>Cc,createAtomicMass:()=>A0,createAvogadro:()=>S0,createBellNumbers:()=>tm,createBigNumberClass:()=>Jr,createBignumber:()=>yi,createBin:()=>Au,createBitAnd:()=>uo,createBitAndTransform:()=>xh,createBitNot:()=>so,createBitOr:()=>co,createBitOrTransform:()=>bh,createBitXor:()=>fo,createBlockNode:()=>kl,createBohrMagneton:()=>a0,createBohrRadius:()=>f0,createBoltzmann:()=>C0,createBoolean:()=>di,createCatalan:()=>rm,createCbrt:()=>ia,createCeil:()=>ca,createChain:()=>Zf,createChainClass:()=>Hf,createClassicalElectronRadius:()=>p0,createClone:()=>jn,createColumn:()=>Ao,createColumnTransform:()=>W0,createCombinations:()=>Dp,createCombinationsWithRep:()=>Sp,createCompare:()=>is,createCompareNatural:()=>ss,createCompareText:()=>ls,createCompile:()=>Ef,createComplex:()=>vi,createComplexClass:()=>Qr,createComposition:()=>im,createConcat:()=>Eo,createConcatTransform:()=>ch,createConditionalNode:()=>Rl,createConductanceQuantum:()=>o0,createConj:()=>mo,createConstantNode:()=>Vl,createCorr:()=>xp,createCos:()=>Fc,createCosh:()=>Oc,createCot:()=>Tc,createCoth:()=>_c,createCoulomb:()=>n0,createCount:()=>So,createCreateUnit:()=>Qs,createCross:()=>Co,createCsc:()=>Bc,createCsch:()=>kc,createCtranspose:()=>su,createCube:()=>la,createCumSum:()=>lp,createCumSumTransform:()=>hh,createDeepEqual:()=>Cs,createDenseMatrixClass:()=>qn,createDerivative:()=>bm,createDet:()=>Wf,createDeuteronMass:()=>g0,createDiag:()=>Mo,createDiff:()=>Lo,createDiffTransform:()=>lh,createDistance:()=>op,createDivide:()=>ap,createDivideScalar:()=>Iu,createDot:()=>sl,createDotDivide:()=>$u,createDotMultiply:()=>Ga,createDotPow:()=>Uu,createE:()=>Rm,createEfimovFactor:()=>E0,createEigs:()=>Kf,createElectricConstant:()=>t0,createElectronMass:()=>m0,createElementaryCharge:()=>i0,createEqual:()=>ps,createEqualScalar:()=>fi,createEqualText:()=>hs,createErf:()=>hu,createEvaluate:()=>Af,createExp:()=>fa,createExpm:()=>ep,createExpm1:()=>pa,createFactorial:()=>zp,createFalse:()=>Tm,createFaraday:()=>M0,createFermiCoupling:()=>h0,createFft:()=>lu,createFibonacciHeapClass:()=>js,createFilter:()=>Oo,createFilterTransform:()=>J0,createFineStructure:()=>d0,createFirstRadiation:()=>F0,createFix:()=>ha,createFlatten:()=>_o,createFloor:()=>ya,createForEach:()=>Bo,createForEachTransform:()=>Q0,createFormat:()=>Eu,createFraction:()=>gi,createFractionClass:()=>en,createFreqz:()=>Em,createFunctionAssignmentNode:()=>Jl,createFunctionNode:()=>Nf,createGamma:()=>kp,createGasConstant:()=>T0,createGcd:()=>Fa,createGetMatrixDataType:()=>zo,createGravitationConstant:()=>Xm,createGravity:()=>P0,createHartreeEnergy:()=>y0,createHasNumericValue:()=>ri,createHelp:()=>Vf,createHelpClass:()=>$f,createHex:()=>Cu,createHypot:()=>ol,createI:()=>Gm,createIdentity:()=>Ro,createIfft:()=>fu,createIm:()=>ho,createImmutableDenseMatrixClass:()=>zs,createIndex:()=>ll,createIndexClass:()=>Rs,createIndexNode:()=>Kl,createIndexTransform:()=>K0,createInfinity:()=>Bm,createIntersect:()=>up,createInv:()=>Yf,createInverseConductanceQuantum:()=>u0,createInvmod:()=>Ua,createIsInteger:()=>Vn,createIsNaN:()=>oi,createIsNegative:()=>Kn,createIsNumeric:()=>ei,createIsPositive:()=>ii,createIsPrime:()=>_u,createIsZero:()=>ai,createKldivergence:()=>qp,createKlitzing:()=>l0,createKron:()=>qo,createLN10:()=>Pm,createLN2:()=>jm,createLOG10E:()=>Um,createLOG2E:()=>Lm,createLarger:()=>Ns,createLargerEq:()=>As,createLcm:()=>Ta,createLeafCount:()=>am,createLeftShift:()=>Xu,createLgamma:()=>Ip,createLog:()=>ju,createLog10:()=>_a,createLog1p:()=>Pu,createLog2:()=>Ba,createLoschmidt:()=>O0,createLsolve:()=>Gu,createLsolveAll:()=>Zu,createLup:()=>Mf,createLusolve:()=>Pf,createLyap:()=>ip,createMad:()=>mp,createMagneticConstant:()=>e0,createMagneticFluxQuantum:()=>s0,createMap:()=>jo,createMapTransform:()=>eh,createMatrix:()=>xi,createMatrixClass:()=>rn,createMatrixFromColumns:()=>Ci,createMatrixFromFunction:()=>wi,createMatrixFromRows:()=>Ei,createMax:()=>ks,createMaxTransform:()=>nh,createMean:()=>fp,createMeanTransform:()=>ih,createMedian:()=>pp,createMin:()=>Is,createMinTransform:()=>ah,createMod:()=>Na,createMode:()=>wu,createMolarMass:()=>q0,createMolarMassC12:()=>j0,createMolarPlanckConstant:()=>_0,createMolarVolume:()=>B0,createMultinomial:()=>Pp,createMultiply:()=>Ia,createMultiplyScalar:()=>ka,createNaN:()=>km,createNeutronMass:()=>x0,createNode:()=>pl,createNorm:()=>ul,createNot:()=>wo,createNthRoot:()=>za,createNthRoots:()=>Lu,createNuclearMagneton:()=>c0,createNull:()=>_m,createNumber:()=>mi,createNumeric:()=>Bu,createObjectNode:()=>rf,createOct:()=>Su,createOnes:()=>Uo,createOperatorNode:()=>uf,createOr:()=>No,createOrTransform:()=>gh,createParenthesisNode:()=>lf,createParse:()=>Df,createParser:()=>Cf,createParserClass:()=>Sf,createPartitionSelect:()=>_s,createPermutations:()=>Up,createPhi:()=>qm,createPi:()=>Im,createPickRandom:()=>Wp,createPinv:()=>Jf,createPlanckCharge:()=>H0,createPlanckConstant:()=>Qm,createPlanckLength:()=>L0,createPlanckMass:()=>U0,createPlanckTemperature:()=>G0,createPlanckTime:()=>$0,createPolynomialRoot:()=>Uf,createPow:()=>zu,createPrint:()=>Fu,createPrintTransform:()=>yh,createProd:()=>Du,createProtonMass:()=>v0,createQr:()=>Ff,createQuantileSeq:()=>vp,createQuantileSeqTransform:()=>mh,createQuantumOfCirculation:()=>b0,createRandom:()=>Jp,createRandomInt:()=>Xp,createRange:()=>Vo,createRangeClass:()=>tn,createRangeNode:()=>mf,createRangeTransform:()=>oh,createRationalize:()=>Nm,createRe:()=>yo,createReducedPlanckConstant:()=>Km,createRelationalNode:()=>yf,createReplacer:()=>Sm,createReshape:()=>Zo,createResize:()=>Wo,createResolve:()=>ym,createResultSet:()=>xt,createReviver:()=>Am,createRightArithShift:()=>Ku,createRightLogShift:()=>ts,createRotate:()=>Yo,createRotationMatrix:()=>Xo,createRound:()=>qu,createRow:()=>Qo,createRowTransform:()=>uh,createRydberg:()=>w0,createSQRT1_2:()=>$m,createSQRT2:()=>Hm,createSackurTetrode:()=>k0,createSchur:()=>np,createSec:()=>Ic,createSech:()=>zc,createSecondRadiation:()=>I0,createSetCartesian:()=>Uc,createSetDifference:()=>Hc,createSetDistinct:()=>Vc,createSetIntersect:()=>Wc,createSetIsSubset:()=>Jc,createSetMultiplicity:()=>Qc,createSetPowerset:()=>el,createSetSize:()=>tl,createSetSymDifference:()=>nl,createSetUnion:()=>il,createSign:()=>Ra,createSimplify:()=>fm,createSimplifyConstant:()=>mm,createSimplifyCore:()=>dm,createSin:()=>Rc,createSinh:()=>qc,createSize:()=>Ko,createSlu:()=>qf,createSmaller:()=>ys,createSmallerEq:()=>xs,createSolveODE:()=>mu,createSort:()=>Bs,createSpaClass:()=>Ps,createSparse:()=>Js,createSparseMatrixClass:()=>pi,createSpeedOfLight:()=>Jm,createSplitUnit:()=>Mi,createSqrt:()=>qa,createSqrtm:()=>tp,createSquare:()=>ja,createSqueeze:()=>eu,createStd:()=>gp,createStdTransform:()=>fh,createStefanBoltzmann:()=>z0,createStirlingS2:()=>Kp,createString:()=>hi,createSubset:()=>tu,createSubsetTransform:()=>sh,createSubtract:()=>Pa,createSubtractScalar:()=>na,createSum:()=>sp,createSumTransform:()=>ph,createSylvester:()=>rp,createSymbolNode:()=>gf,createSymbolicEqual:()=>gm,createTan:()=>jc,createTanh:()=>Pc,createTau:()=>zm,createThomsonCrossSection:()=>N0,createTo:()=>Tu,createTrace:()=>cl,createTranspose:()=>ou,createTrue:()=>Om,createTypeOf:()=>ui,createTyped:()=>mt,createUnaryMinus:()=>Ji,createUnaryPlus:()=>Xi,createUnequal:()=>Fs,createUnitClass:()=>Ws,createUnitFunction:()=>Ys,createUppercaseE:()=>Zm,createUppercasePi:()=>Vm,createUsolve:()=>Vu,createUsolveAll:()=>Wu,createVacuumImpedance:()=>r0,createVariance:()=>dp,createVarianceTransform:()=>dh,createVersion:()=>Wm,createWeakMixingAngle:()=>D0,createWienDisplacement:()=>R0,createXgcd:()=>La,createXor:()=>Do,createZeros:()=>cu,createZeta:()=>bu,createZpk2tf:()=>Dm}),Mh(4423),Mh(5086),Mh(2892),Mh(6099),Mh(7495),Mh(906),Mh(1699),Mh(4346),Mh(3288),Mh(2010),Mh(875),Mh(4864),Mh(7465),Mh(7745),Mh(8781);var b=Array.isArray;function P(e){return e&&!0===e.constructor.prototype.isMatrix||!1}function C(e){return Array.isArray(e)||P(e)}function M(e){return e&&e.isDenseMatrix&&!0===e.constructor.prototype.isMatrix||!1}function B(e){return e&&e.isSparseMatrix&&!0===e.constructor.prototype.isMatrix||!1}function I(e){return e&&!0===e.constructor.prototype.isRange||!1}function z(e){return e&&!0===e.constructor.prototype.isIndex||!1}function R(e){return"boolean"==typeof e}function q(e){return e&&!0===e.constructor.prototype.isResultSet||!1}function j(e){return e&&!0===e.constructor.prototype.isHelp||!1}function U(e){return"function"==typeof e}function $(e){return e instanceof Date}function H(e){return e instanceof RegExp}function G(e){return!(!e||"object"!==V(e)||e.constructor!==Object||Oe(e)||Te(e))}function W(e){return null===e}function Y(e){return void 0===e}function le(e){return e&&!0===e.isAccessorNode&&!0===e.constructor.prototype.isNode||!1}function J(e){return e&&!0===e.isArrayNode&&!0===e.constructor.prototype.isNode||!1}function X(e){return e&&!0===e.isAssignmentNode&&!0===e.constructor.prototype.isNode||!1}function Q(e){return e&&!0===e.isBlockNode&&!0===e.constructor.prototype.isNode||!1}function K(e){return e&&!0===e.isConditionalNode&&!0===e.constructor.prototype.isNode||!1}function ae(e){return e&&!0===e.isConstantNode&&!0===e.constructor.prototype.isNode||!1}function fe(e){return ae(e)||oe(e)&&1===e.args.length&&ae(e.args[0])&&"-+~".includes(e.op)}function ee(e){return e&&!0===e.isFunctionAssignmentNode&&!0===e.constructor.prototype.isNode||!1}function pe(e){return e&&!0===e.isFunctionNode&&!0===e.constructor.prototype.isNode||!1}function te(e){return e&&!0===e.isIndexNode&&!0===e.constructor.prototype.isNode||!1}function L(e){return e&&!0===e.isNode&&!0===e.constructor.prototype.isNode||!1}function re(e){return e&&!0===e.isObjectNode&&!0===e.constructor.prototype.isNode||!1}function oe(e){return e&&!0===e.isOperatorNode&&!0===e.constructor.prototype.isNode||!1}function ne(e){return e&&!0===e.isParenthesisNode&&!0===e.constructor.prototype.isNode||!1}function ie(e){return e&&!0===e.isRangeNode&&!0===e.constructor.prototype.isNode||!1}function me(e){return e&&!0===e.isRelationalNode&&!0===e.constructor.prototype.isNode||!1}function ue(e){return e&&!0===e.isSymbolNode&&!0===e.constructor.prototype.isNode||!1}function he(e){return e&&!0===e.constructor.prototype.isChain||!1}function Se(e){var t=V(e);return"object"===t?null===e?"null":Ae(e)?"BigNumber":e.constructor&&e.constructor.name?e.constructor.name:"Object":t}var de=Mh(2369);function w(e){return"boolean"==typeof e||!!isFinite(e)&&e===Math.round(e)}Mh(8706),Mh(5276),Mh(8598),Mh(2062),Mh(4782),Mh(4554),Mh(3153),Mh(2326),Mh(6389),Mh(4444),Mh(7762),Mh(5070),Mh(5376),Mh(6624),Mh(1367),Mh(5914),Mh(8553),Mh(8690),Mh(5374),Mh(8459),Mh(8940),Mh(1761),Mh(5440);var n=Math.sign||function(e){return 0<e?1:e<0?-1:0},r=Math.log2||function(e){return Math.log(e)/Math.LN2},i=Math.log10||function(e){return Math.log(e)/Math.LN10},u=Math.log1p||function(e){return Math.log(e+1)},a=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},s=Math.expm1||function(e){return 2e-4<=e||e<=-2e-4?Math.exp(e)-1:e+e*e/2+e*e*e/6};function v(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(!w(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(!w(e))throw new Error("Value must be an integer");e<0&&(e+=Math.pow(2,r)),i="i".concat(r)}r="";return e<0&&(e=-e,r="-"),"".concat(r).concat(n).concat(e.toString(t)).concat(i)}function ye(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=ve(t),n=r.notation,i=r.precision,a=r.wordSize;switch(n){case"fixed":return xe(e,i);case"exponential":return be(e,i);case"engineering":var o=e,u=i;if(isNaN(o)||!isFinite(o))return String(o);var s=(o=we(ge(o),u)).exponent,c=o.coefficients,l=s%3==0?s:s<0?s-3-s%3:s-s%3;if(Ee(u))for(;u>c.length||s-l+1>c.length;)c.push(0);else for(var f=Math.abs(s-l)-(c.length-1),p=0;p<f;p++)c.push(0);for(var m=Math.abs(s-l),h=1;0<m;)h++,m--;var d=c.slice(h).join(""),d=Ee(u)&&d.length||d.match(/[1-9]/)?"."+d:"",d=c.slice(0,h).join("")+d+"e"+(0<=s?"+":"")+l.toString();return o.sign+d;case"bin":return v(e,2,a);case"oct":return v(e,8,a);case"hex":return v(e,16,a);case"auto":return function(e,t,r){if(isNaN(e)||!isFinite(e))return String(e);var n=je(null==r?void 0:r.lowerExp,-3),r=je(null==r?void 0:r.upperExp,5),i=ge(e),i=t?we(i,t):i;if(i.exponent<n||i.exponent>=r)return be(e,t);n=i.coefficients,r=i.exponent,n=(n=n.length<t?n.concat(Ne(t-n.length)):n).concat(Ne(r-n.length+1+(n.length<t?t-n.length:0))),e=0<r?r:0;return e<(n=Ne(-r).concat(n)).length-1&&n.splice(e+1,0,"."),i.sign+n.join("")}(e,i,t).replace(/((\.\d*?)(0+))($|e)/,function(){var e=arguments[2],t=arguments[4];return"."!==e?e+t:t});default:throw new Error('Unknown notation "'+n+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function ve(e){var t,r,n="auto";if(void 0!==e)if(Ee(e))t=e;else if(Ae(e))t=e.toNumber();else{if(!G(e))throw new Error("Unsupported type of options, number, BigNumber, or object expected");void 0!==e.precision&&(t=qe(e.precision,function(){throw new Error('Option "precision" must be a number or BigNumber')})),void 0!==e.wordSize&&(r=qe(e.wordSize,function(){throw new Error('Option "wordSize" must be a number or BigNumber')})),e.notation&&(n=e.notation)}return{notation:n,precision:t,wordSize:r}}function ge(e){var t=String(e).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!t)throw new SyntaxError("Invalid number "+e);var e=t[1],r=t[2],n=parseFloat(t[4]||"0"),t=r.indexOf("."),t=(n+=-1!==t?t-1:r.length-1,r.replace(".","").replace(/^0*/,function(e){return n-=e.length,""}).replace(/0*$/,"").split("").map(function(e){return parseInt(e)}));return 0===t.length&&(t.push(0),n++),{sign:e,coefficients:t,exponent:n}}function xe(e,t){if(isNaN(e)||!isFinite(e))return String(e);var e=ge(e),e="number"==typeof t?we(e,e.exponent+1+t):e,r=e.coefficients,n=e.exponent+1,t=n+(t||0);return r.length<t&&(r=r.concat(Ne(t-r.length))),n<0&&(r=Ne(1-n).concat(r),n=1),n<r.length&&r.splice(n,0,0===n?"0.":"."),e.sign+r.join("")}function be(e,t){if(isNaN(e)||!isFinite(e))return String(e);var e=ge(e),e=t?we(e,t):e,r=e.coefficients,n=e.exponent,t=(r=r.length<t?r.concat(Ne(t-r.length)):r).shift();return e.sign+t+(0<r.length?"."+r.join(""):"")+"e"+(0<=n?"+":"")+n}function we(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&&5<=n.splice(t,n.length-t)[0]){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 Ne(e){for(var t=[],r=0;r<e;r++)t.push(0);return t}var l=Number.EPSILON||2220446049250313e-31;function De(e,t,r){return null==r?e===t:e===t||!isNaN(e)&&!isNaN(t)&&(!(!isFinite(e)||!isFinite(t))&&((n=Math.abs(e-t))<=l||n<=Math.max(Math.abs(e),Math.abs(t))*r));var n}var _e=Math.acosh||function(e){return Math.log(Math.sqrt(e*e-1)+e)},Be=Math.asinh||function(e){return Math.log(Math.sqrt(e*e+1)+e)},ke=Math.atanh||function(e){return Math.log((1+e)/(1-e))/2},Ie=Math.cosh||function(e){return(Math.exp(e)+Math.exp(-e))/2},ze=Math.sinh||function(e){return(Math.exp(e)-Math.exp(-e))/2},Re=Math.tanh||function(e){e=Math.exp(2*e);return(e-1)/(e+1)};function qe(e,t){return Ee(e)?e:Ae(e)?e.toNumber():void t()}function je(e,t){return Ee(e)?e:Ae(e)?e.toNumber():t}function Ce(e){var t=V(e);if("number"===t||"string"===t||"boolean"===t||null==e)return e;if("function"==typeof e.clone)return e.clone();if(Array.isArray(e))return e.map(Ce);if(e instanceof Date)return new Date(e.valueOf());if(Ae(e))return e;if(G(e))return Pe(e,Ce);throw new TypeError("Cannot clone: unknown type of value (value: ".concat(e,")"))}function Pe(e,t){var r,n={};for(r in e)se(e,r)&&(n[r]=t(e[r]));return n}function Le(e,t){for(var r in t)se(t,r)&&(e[r]=t[r]);return e}function Ue(e,t){var r,n,i;if(Array.isArray(e)){if(!Array.isArray(t))return!1;if(e.length!==t.length)return!1;for(n=0,i=e.length;n<i;n++)if(!Ue(e[n],t[n]))return!1;return!0}if("function"==typeof e)return e===t;if(e instanceof Object){if(Array.isArray(t)||!(t instanceof Object))return!1;for(r in e)if(!(r in t&&Ue(e[r],t[r])))return!1;for(r in t)if(!(r in e))return!1;return!0}return e===t}function $e(e){var t={};return function e(t,r){for(var n in t){var i;se(t,n)&&("object"===V(i=t[n])&&null!==i?e(i,r):r[n]=i)}}(e,t),t}function He(e,t,r){var n,i=!0;Object.defineProperty(e,t,{get:function(){return i&&(n=r(),i=!1),n},set:function(e){n=e,i=!1},configurable:!0,enumerable:!0})}function se(e,t){return e&&Object.hasOwnProperty.call(e,t)}function N(a,o,u,e){function t(e){var t=function(e,t){for(var r={},n=0;n<t.length;n++){var i=t[n],a=e[i];void 0!==a&&(r[i]=a)}return r}(e,o.map(Ve)),r=a,n=o,i=e;if(n.filter(function(e){return!(e&&"?"===e[0])}).every(function(e){return void 0!==i[e]}))return u(t);throw n=n.filter(function(e){return void 0===i[e]}),new Error('Cannot create function "'.concat(r,'", ')+"some dependencies are missing: ".concat(n.map(function(e){return'"'.concat(e,'"')}).join(", "),"."))}return t.isFactory=!0,t.fn=a,t.dependencies=o.slice().sort(),e&&(t.meta=e),t}function Ge(e){return"function"==typeof e&&"string"==typeof e.fn&&Array.isArray(e.dependencies)}function Ve(e){return e&&"?"===e[0]?e.slice(1):e}function Ze(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function We(e,t){if(e){if("string"==typeof e)return Ze(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(r="Object"===r&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ze(e,t):void 0}}function Me(e){return function(e){if(Array.isArray(e))return Ze(e)}(e)||function(){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}()||We(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ye(e){e=function(e){if("object"!=V(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0===t)return String(e);t=t.call(e,"string");if("object"!=V(t))return t;throw new TypeError("@@toPrimitive must return a primitive value.")}(e);return"symbol"==V(e)?e:e+""}function Je(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Ye(n.key),n)}}function c(e,t,r){return t&&Je(e.prototype,t),r&&Je(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Xe(e,t){if(tt(e)&&Ke(e,t))return e[t];if("function"==typeof e[t]&&et(e,t))throw new Error('Cannot access method "'+t+'" as a property');throw new Error('No access to property "'+t+'"')}function Qe(e,t,r){if(tt(e)&&Ke(e,t))return e[t]=r;throw new Error('No access to property "'+t+'"')}function Ke(e,t){return e&&"object"===V(e)&&(se(rt,t)||!(t in Object.prototype||t in Function.prototype))}function et(e,t){return!(null==e||"function"!=typeof e[t]||se(e,t)&&Object.getPrototypeOf&&t in Object.getPrototypeOf(e)||!se(nt,t)&&(t in Object.prototype||t in Function.prototype))}function tt(e){return"object"===V(e)&&e&&e.constructor===Object}Mh(8431),Mh(2008),Mh(1629),Mh(6910),Mh(3500),Mh(4185),Mh(2675),Mh(9463),Mh(2259),Mh(3418),Mh(3792),Mh(6033),Mh(9432),Mh(1415),Mh(7764),Mh(2953);var rt={length:!0,name:!0},nt={toString:!0,valueOf:!0,toLocaleString:!0};function it(e,t){var r,n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e){if(e){if("string"==typeof e)return at(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(t="Object"===t&&e.constructor?e.constructor.name:t)||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?at(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length)return n&&(e=n),r=0,{s:t=function(){},n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,o=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){o=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(o)throw i}}}}function at(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var ot=c(function e(t){h(this,e),this.wrappedObject=t,this[Symbol.iterator]=this.entries},[{key:"keys",value:function(){return Object.keys(this.wrappedObject).values()}},{key:"get",value:function(e){return Xe(this.wrappedObject,e)}},{key:"set",value:function(e,t){return Qe(this.wrappedObject,e,t),this}},{key:"has",value:function(e){return e in this.wrappedObject}},{key:"entries",value:function(){var t=this;return st(this.keys(),function(e){return[e,t.get(e)]})}},{key:"forEach",value:function(e){var t,r=it(this.keys());try{for(r.s();!(t=r.n()).done;){var n=t.value;e(this.get(n),n,this)}}catch(e){r.e(e)}finally{r.f()}}},{key:"delete",value:function(e){delete this.wrappedObject[e]}},{key:"clear",value:function(){var e,t=it(this.keys());try{for(t.s();!(e=t.n()).done;){var r=e.value;this.delete(r)}}catch(e){t.e(e)}finally{t.f()}}},{key:"size",get:function(){return Object.keys(this.wrappedObject).length}}]),ut=c(function e(t,r,n){h(this,e),this.a=t,this.b=r,this.bKeys=n,this[Symbol.iterator]=this.entries},[{key:"get",value:function(e){return(this.bKeys.has(e)?this.b:this.a).get(e)}},{key:"set",value:function(e,t){return(this.bKeys.has(e)?this.b:this.a).set(e,t),this}},{key:"has",value:function(e){return this.b.has(e)||this.a.has(e)}},{key:"keys",value:function(){return new Set([].concat(Me(this.a.keys()),Me(this.b.keys())))[Symbol.iterator]()}},{key:"entries",value:function(){var t=this;return st(this.keys(),function(e){return[e,t.get(e)]})}},{key:"forEach",value:function(e){var t,r=it(this.keys());try{for(r.s();!(t=r.n()).done;){var n=t.value;e(this.get(n),n,this)}}catch(e){r.e(e)}finally{r.f()}}},{key:"delete",value:function(e){return(this.bKeys.has(e)?this.b:this.a).delete(e)}},{key:"clear",value:function(){this.a.clear(),this.b.clear()}},{key:"size",get:function(){return Me(this.keys()).length}}]);function st(t,r){return{next:function(){var e=t.next();return e.done?e:{value:r(e.value),done:!1}}}}function ct(){return new Map}function lt(e){if(!e)return ct();if(ft(e))return e;if(G(e))return new ot(e);throw new Error("createMap can create maps from objects or Maps")}function ft(e){return!!e&&(e instanceof Map||e instanceof ot||"function"==typeof e.set&&"function"==typeof e.get&&"function"==typeof e.keys&&"function"==typeof e.has)}var pt=function(){return pt=de.create,de},mt=N("typed",["?BigNumber","?Complex","?DenseMatrix","?Fraction"],function(e){var r=e.BigNumber,n=e.Complex,t=e.DenseMatrix,i=e.Fraction,a=pt();return a.clear(),a.addTypes([{name:"number",test:Ee},{name:"Complex",test:Oe},{name:"BigNumber",test:Ae},{name:"Fraction",test:Te},{name:"Unit",test:Z},{name:"identifier",test:function(e){return/^(?:[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])(?:[0-9A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])*$/.test(e)}},{name:"string",test:S},{name:"Chain",test:he},{name:"Array",test:b},{name:"Matrix",test:P},{name:"DenseMatrix",test:M},{name:"SparseMatrix",test:B},{name:"Range",test:I},{name:"Index",test:z},{name:"boolean",test:R},{name:"ResultSet",test:q},{name:"Help",test:j},{name:"function",test:U},{name:"Date",test:$},{name:"RegExp",test:H},{name:"null",test:W},{name:"undefined",test:Y},{name:"AccessorNode",test:le},{name:"ArrayNode",test:J},{name:"AssignmentNode",test:X},{name:"BlockNode",test:Q},{name:"ConditionalNode",test:K},{name:"ConstantNode",test:ae},{name:"FunctionNode",test:pe},{name:"FunctionAssignmentNode",test:ee},{name:"IndexNode",test:te},{name:"Node",test:L},{name:"ObjectNode",test:re},{name:"OperatorNode",test:oe},{name:"ParenthesisNode",test:ne},{name:"RangeNode",test:ie},{name:"RelationalNode",test:me},{name:"SymbolNode",test:ue},{name:"Map",test:ft},{name:"Object",test:G}]),a.addConversions([{from:"number",to:"BigNumber",convert:function(e){if(r||ht(e),15<e.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length)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 r(e)}},{from:"number",to:"Complex",convert:function(e){return n||dt(e),new n(e,0)}},{from:"BigNumber",to:"Complex",convert:function(e){return n||dt(e),new n(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 n||dt(e),new n(e.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(e){i||yt(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(t){r||ht(t);try{return new r(t)}catch(e){throw new Error('Cannot convert "'+t+'" to BigNumber')}}},{from:"string",to:"Fraction",convert:function(t){i||yt(t);try{return new i(t)}catch(e){throw new Error('Cannot convert "'+t+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(t){n||dt(t);try{return new n(t)}catch(e){throw new Error('Cannot convert "'+t+'" to Complex')}}},{from:"boolean",to:"number",convert:function(e){return+e}},{from:"boolean",to:"BigNumber",convert:function(e){return r||ht(e),new r(+e)}},{from:"boolean",to:"Fraction",convert:function(e){return i||yt(e),new i(+e)}},{from:"boolean",to:"string",convert:function(e){return String(e)}},{from:"Array",to:"Matrix",convert:function(e){if(t)return new t(e);throw new Error("Cannot convert array into a Matrix: no class 'DenseMatrix' provided")}},{from:"Matrix",to:"Array",convert:function(e){return e.valueOf()}}]),a.onMismatch=function(e,t,r){var n=a.createError(e,t,r);if(["wrongType","mismatch"].includes(n.data.category)&&1===t.length&&C(t[0])&&r.some(function(e){return!e.params.includes(",")}))throw(t=new TypeError("Function '".concat(e,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(e,")'."))).data=n.data,t;throw n},a.onMismatch=function(e,t,r){var n=a.createError(e,t,r);if(["wrongType","mismatch"].includes(n.data.category)&&1===t.length&&C(t[0])&&r.some(function(e){return!e.params.includes(",")}))throw(t=new TypeError("Function '".concat(e,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(e,")'."))).data=n.data,t;throw n},a});function ht(e){throw new Error("Cannot convert value ".concat(e," into a BigNumber: no class 'BigNumber' provided"))}function dt(e){throw new Error("Cannot convert value ".concat(e," into a Complex number: no class 'Complex' provided"))}function yt(e){throw new Error("Cannot convert value ".concat(e," into a Fraction, no class 'Fraction' provided."))}Mh(739);var vt,gt,xt=N("ResultSet",[],function(){function t(e){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");this.entries=e||[]}return t.prototype.type="ResultSet",t.prototype.isResultSet=!0,t.prototype.valueOf=function(){return this.entries},t.prototype.toString=function(){return"["+this.entries.join(", ")+"]"},t.prototype.toJSON=function(){return{mathjs:"ResultSet",entries:this.entries}},t.fromJSON=function(e){return new t(e.entries)},t},{isClass:!0}),bt=(Mh(9904),"0123456789abcdef"),wt="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Nt="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",Dt={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-9e15,maxE:9e15,crypto:!1},x=!0,Et="[DecimalError] ",At=Et+"Invalid argument: ",St=Et+"Precision limit exceeded",Ct=Et+"crypto unavailable",Mt="[object Decimal]",Ft=Math.floor,d=Math.pow,Ot=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,Tt=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,_t=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,Bt=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,kt=1e7,F=7,It=wt.length-1,zt=Nt.length-1,o={toStringTag:Mt};function Rt(e){var t,r,n,i=e.length-1,a="",o=e[0];if(0<i){for(a+=o,t=1;t<i;t++)n=e[t]+"",(r=F-n.length)&&(a+=Yt(r)),a+=n;o=e[t],(r=F-(n=o+"").length)&&(a+=Yt(r))}else if(0===o)return"0";for(;o%10==0;)o/=10;return a+o}function qt(e,t,r){if(e!==~~e||e<t||r<e)throw Error(At+e)}function jt(e,t,r,n){for(var i,a,o=e[0];10<=o;o/=10)--t;return--t<0?(t+=F,i=0):(i=Math.ceil((t+1)/F),t%=F),o=d(10,F-t),a=e[i]%o|0,null==n?t<3?(0==t?a=a/100|0:1==t&&(a=a/10|0),r<4&&99999==a||3<r&&49999==a||5e4==a||0==a):(r<4&&a+1==o||3<r&&a+1==o/2)&&(e[i+1]/o/100|0)==d(10,t-2)-1||(a==o/2||0==a)&&0==(e[i+1]/o/100|0):t<4?(0==t?a=a/1e3|0:1==t?a=a/100|0:2==t&&(a=a/10|0),(n||r<4)&&9999==a||!n&&3<r&&4999==a):((n||r<4)&&a+1==o||!n&&3<r&&a+1==o/2)&&(e[i+1]/o/1e3|0)==d(10,t-3)-1}function Pt(e,t,r){for(var n,i,a=[0],o=0,u=e.length;o<u;){for(i=a.length;i--;)a[i]*=t;for(a[0]+=bt.indexOf(e.charAt(o++)),n=0;n<a.length;n++)a[n]>r-1&&(void 0===a[n+1]&&(a[n+1]=0),a[n+1]+=a[n]/r|0,a[n]%=r)}return a.reverse()}o.absoluteValue=o.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),O(e)},o.ceil=function(){return O(new this.constructor(this),this.e+1,2)},o.clampedTo=o.clamp=function(e,t){var r=this.constructor;if(e=new r(e),t=new r(t),!e.s||!t.s)return new r(NaN);if(e.gt(t))throw Error(At+t);return this.cmp(e)<0?e:0<this.cmp(t)?t:new r(this)},o.comparedTo=o.cmp=function(e){var t,r,n=this.d,i=(e=new this.constructor(e)).d,a=this.s,o=e.s;if(!n||!i)return a&&o?a!==o?a:n===i?0:!n^a<0?1:-1:NaN;if(!n[0]||!i[0])return n[0]?a:i[0]?-o:0;if(a!==o)return a;if(this.e!==e.e)return this.e>e.e^a<0?1:-1;for(t=0,r=(o=n.length)<(e=i.length)?o:e;t<r;++t)if(n[t]!==i[t])return n[t]>i[t]^a<0?1:-1;return o===e?0:e<o^a<0?1:-1},o.cosine=o.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())+F,n.rounding=1,r=function(e,t){var r,n;if(t.isZero())return t;n=(n=t.d.length)<32?(1/ir(4,r=Math.ceil(n/3))).toString():(r=16,"2.3283064365386962890625e-10"),e.precision+=r,t=nr(e,1,t.times(n),new e(1));for(var i=r;i--;){var a=t.times(t);t=a.times(a).minus(a).times(8).plus(1)}return e.precision-=r,t}(n,ar(n,r)),n.precision=e,n.rounding=t,O(2==gt||3==gt?r.neg():r,e,t,!0)):new n(1):new n(NaN)},o.cubeRoot=o.cbrt=function(){var e,t,r,n,i,a,o,u,s,c,l=this,f=l.constructor;if(!l.isFinite()||l.isZero())return new f(l);for(x=!1,(a=l.s*d(l.s*l,1/3))&&Math.abs(a)!=1/0?n=new f(a.toString()):(r=Rt(l.d),(a=((e=l.e)-r.length+1)%3)&&(r+=1==a||-2==a?"0":"00"),a=d(r,1/3),e=Ft((e+1)/3)-(e%3==(e<0?-1:2)),(n=new f(r=a==1/0?"5e"+e:(r=a.toExponential()).slice(0,r.indexOf("e")+1)+e)).s=l.s),o=(e=f.precision)+3;;)if(c=(s=(u=n).times(u).times(u)).plus(l),n=D(c.plus(l).times(u),c.plus(s),o+2,1),Rt(u.d).slice(0,o)===(r=Rt(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))||(O(n,e+1,1),t=!n.times(n).times(n).eq(l));break}if(!i&&(O(u,e+1,0),u.times(u).times(u).eq(l))){n=u;break}o+=4,i=1}return x=!0,O(n,e,f.rounding,t)},o.decimalPlaces=o.dp=function(){var e,t=this.d,r=NaN;if(t){if(r=((e=t.length-1)-Ft(this.e/F))*F,e=t[e])for(;e%10==0;e/=10)r--;r<0&&(r=0)}return r},o.dividedBy=o.div=function(e){return D(this,new this.constructor(e))},o.dividedToIntegerBy=o.divToInt=function(e){var t=this.constructor;return O(D(this,new t(e),0,1,1),t.precision,t.rounding)},o.equals=o.eq=function(e){return 0===this.cmp(e)},o.floor=function(){return O(new this.constructor(this),this.e+1,3)},o.greaterThan=o.gt=function(e){return 0<this.cmp(e)},o.greaterThanOrEqualTo=o.gte=function(e){e=this.cmp(e);return 1==e||0===e},o.hyperbolicCosine=o.cosh=function(){var e,t,r,n=(u=this).constructor,i=new n(1);if(!u.isFinite())return new n(u.s?1/0:NaN);if(u.isZero())return i;t=n.precision,r=n.rounding,n.precision=t+Math.max(u.e,u.sd())+4,n.rounding=1;for(var a,o=(o=u.d.length)<32?(1/ir(4,e=Math.ceil(o/3))).toString():(e=16,"2.3283064365386962890625e-10"),u=nr(n,1,u.times(o),new n(1),!0),s=e,c=new n(8);s--;)a=u.times(u),u=i.minus(a.times(c.minus(a.times(c))));return O(u,n.precision=t,n.rounding=r,!0)},o.hyperbolicSine=o.sinh=function(){var e,t,r,n=(o=this).constructor;if(!o.isFinite()||o.isZero())return new n(o);if(e=n.precision,t=n.rounding,n.precision=e+Math.max(o.e,o.sd())+4,n.rounding=1,(r=o.d.length)<3)o=nr(n,2,o,o,!0);else for(var i,a=16<(a=1.4*Math.sqrt(r))?16:0|a,o=nr(n,2,o=o.times(1/ir(5,a)),o,!0),u=new n(5),s=new n(16),c=new n(20);a--;)i=o.times(o),o=o.times(u.plus(i.times(s.times(i).plus(c))));return O(o,n.precision=e,n.rounding=t,!0)},o.hyperbolicTangent=o.tanh=function(){var e,t,r=this.constructor;return this.isFinite()?this.isZero()?new r(this):(e=r.precision,t=r.rounding,r.precision=e+7,r.rounding=1,D(this.sinh(),this.cosh(),r.precision=e,r.rounding=t)):new r(this.s)},o.inverseCosine=o.acos=function(){var e=this,t=e.constructor,r=e.abs().cmp(1),n=t.precision,i=t.rounding;return-1!==r?0===r?e.isNeg()?Zt(t,n,i):new t(0):new t(NaN):e.isZero()?Zt(t,n+4,i).times(.5):(t.precision=n+6,t.rounding=1,e=e.asin(),r=Zt(t,n+4,i).times(.5),t.precision=n,t.rounding=i,r.minus(e))},o.inverseHyperbolicCosine=o.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,x=!1,r=r.times(r).minus(1).sqrt().plus(r),x=!0,n.precision=e,n.rounding=t,r.ln()):new n(r)},o.inverseHyperbolicSine=o.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,x=!1,r=r.times(r).plus(1).sqrt().plus(r),x=!0,n.precision=e,n.rounding=t,r.ln())},o.inverseHyperbolicTangent=o.atanh=function(){var e,t,r,n=this,i=n.constructor;return n.isFinite()?0<=n.e?new i(n.abs().eq(1)?n.s/0:n.isZero()?n:NaN):(e=i.precision,t=i.rounding,r=n.sd(),Math.max(r,e)<2*-n.e-1?O(new i(n),e,t,!0):(i.precision=r=r-n.e,n=D(n.plus(1),new i(1).minus(n),r+e,1),i.precision=e+4,i.rounding=1,n=n.ln(),i.precision=e,i.rounding=t,n.times(.5))):new i(NaN)},o.inverseSine=o.asin=function(){var e,t,r,n=this,i=n.constructor;return n.isZero()?new i(n):(e=n.abs().cmp(1),t=i.precision,r=i.rounding,-1!==e?0===e?((e=Zt(i,t+4,r).times(.5)).s=n.s,e):new i(NaN):(i.precision=t+6,i.rounding=1,n=n.div(new i(1).minus(n.times(n)).sqrt().plus(1)).atan(),i.precision=t,i.rounding=r,n.times(2)))},o.inverseTangent=o.atan=function(){var e,t,r,n,i,a,o,u,s,c=this,l=c.constructor,f=l.precision,p=l.rounding;if(c.isFinite()){if(c.isZero())return new l(c);if(c.abs().eq(1)&&f+4<=zt)return(o=Zt(l,f+4,p).times(.25)).s=c.s,o}else{if(!c.s)return new l(NaN);if(f+4<=zt)return(o=Zt(l,f+4,p).times(.5)).s=c.s,o}for(l.precision=u=f+10,l.rounding=1,e=r=Math.min(28,u/F+2|0);e;--e)c=c.div(c.times(c).plus(1).sqrt().plus(1));for(x=!1,t=Math.ceil(u/F),n=1,s=c.times(c),o=new l(c),i=c;-1!==e;)if(i=i.times(s),a=o.minus(i.div(n+=2)),i=i.times(s),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<<r-1)),x=!0,O(o,l.precision=f,l.rounding=p,!0)},o.isFinite=function(){return!!this.d},o.isInteger=o.isInt=function(){return!!this.d&&Ft(this.e/F)>this.d.length-2},o.isNaN=function(){return!this.s},o.isNegative=o.isNeg=function(){return this.s<0},o.isPositive=o.isPos=function(){return 0<this.s},o.isZero=function(){return!!this.d&&0===this.d[0]},o.lessThan=o.lt=function(e){return this.cmp(e)<0},o.lessThanOrEqualTo=o.lte=function(e){return this.cmp(e)<1},o.logarithm=o.log=function(e){var t,r,n,i,a,o,u,s,c=this.constructor,l=c.precision,f=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(1<r.length)a=!0;else{for(i=r[0];i%10==0;)i/=10;a=1!==i}if(x=!1,o=er(this,u=l+5),n=t?Vt(c,u+10):er(e,u),jt((s=D(o,n,u,1)).d,i=l,f))do{if(o=er(this,u+=10),n=t?Vt(c,u+10):er(e,u),s=D(o,n,u,1),!a){+Rt(s.d).slice(i+1,i+15)+1==1e14&&(s=O(s,l+1,0));break}}while(jt(s.d,i+=10,f));return x=!0,O(s,l,f)},o.minus=o.sub=function(e){var t,r,n,i,a,o,u,s,c,l,f,p=this,m=p.constructor;if(e=new m(e),!p.d||!e.d)return p.s&&e.s?p.d?e.s=-e.s:e=new m(e.d||p.s!==e.s?p:NaN):e=new m(NaN),e;if(p.s!=e.s)return e.s=-e.s,p.plus(e);if(c=p.d,f=e.d,u=m.precision,s=m.rounding,!c[0]||!f[0]){if(f[0])e.s=-e.s;else{if(!c[0])return new m(3===s?-0:0);e=new m(p)}return x?O(e,u,s):e}if(r=Ft(e.e/F),p=Ft(p.e/F),c=c.slice(),a=p-r){for(o=(l=a<0)?(t=c,a=-a,f.length):(t=f,r=p,c.length),a>(n=Math.max(Math.ceil(u/F),o)+2)&&(a=n,t.length=1),t.reverse(),n=a;n--;)t.push(0);t.reverse()}else{for((l=(n=c.length)<(o=f.length))&&(o=n),n=0;n<o;n++)if(c[n]!=f[n]){l=c[n]<f[n];break}a=0}for(l&&(t=c,c=f,f=t,e.s=-e.s),o=c.length,n=f.length-o;0<n;--n)c[o++]=0;for(n=f.length;a<n;){if(c[--n]<f[n]){for(i=n;i&&0===c[--i];)c[i]=kt-1;--c[i],c[n]+=kt}c[n]-=f[n]}for(;0===c[--o];)c.pop();for(;0===c[0];c.shift())--r;return c[0]?(e.d=c,e.e=Gt(c,r),x?O(e,u,s):e):new m(3===s?-0:0)},o.modulo=o.mod=function(e){var t,r=this.constructor;return e=new r(e),!this.d||!e.s||e.d&&!e.d[0]?new r(NaN):!e.d||this.d&&!this.d[0]?O(new r(this),r.precision,r.rounding):(x=!1,9==r.modulo?(t=D(this,e.abs(),0,3,1)).s*=e.s:t=D(this,e,0,r.modulo,1),t=t.times(e),x=!0,this.minus(t))},o.naturalExponential=o.exp=function(){return Kt(this)},o.naturalLogarithm=o.ln=function(){return er(this)},o.negated=o.neg=function(){var e=new this.constructor(this);return e.s=-e.s,O(e)},o.plus=o.add=function(e){var t,r,n,i,a,o,u,s,c=this,l=c.constructor;if(e=new l(e),!c.d||!e.d)return c.s&&e.s?c.d||(e=new l(e.d||c.s===e.s?c:NaN)):e=new l(NaN),e;if(c.s!=e.s)return e.s=-e.s,c.minus(e);if(u=c.d,s=e.d,a=l.precision,o=l.rounding,!u[0]||!s[0])return s[0]||(e=new l(c)),x?O(e,a,o):e;if(l=Ft(c.e/F),c=Ft(e.e/F),u=u.slice(),n=l-c){for(i=n<0?(r=u,n=-n,s.length):(r=s,c=l,u.length),n>(i=(l=Math.ceil(a/F))>i?l+1:i+1)&&(n=i,r.length=1),r.reverse();n--;)r.push(0);r.reverse()}for((i=u.length)-(n=s.length)<0&&(n=i,r=s,s=u,u=r),t=0;n;)t=(u[--n]=u[n]+s[n]+t)/kt|0,u[n]%=kt;for(t&&(u.unshift(t),++c),i=u.length;0==u[--i];)u.pop();return e.d=u,e.e=Gt(u,c),x?O(e,a,o):e},o.precision=o.sd=function(e){var t;if(void 0!==e&&e!==!!e&&1!==e&&0!==e)throw Error(At+e);return this.d?(t=Wt(this.d),e&&this.e+1>t&&(t=this.e+1)):t=NaN,t},o.round=function(){var e=this.constructor;return O(new e(this),this.e+1,e.rounding)},o.sine=o.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())+F,n.rounding=1,r=function(e,t){var r,n=t.d.length;if(n<3)return t.isZero()?t:nr(e,2,t,t);r=16<(r=1.4*Math.sqrt(n))?16:0|r,t=nr(e,2,t=t.times(1/ir(5,r)),t);for(var i,a=new e(5),o=new e(16),u=new e(20);r--;)i=t.times(t),t=t.times(a.plus(i.times(o.times(i).minus(u))));return t}(n,ar(n,r)),n.precision=e,n.rounding=t,O(2<gt?r.neg():r,e,t,!0)):new n(NaN)},o.squareRoot=o.sqrt=function(){var e,t,r,n,i,a,o=this.d,u=this.e,s=this.s,c=this.constructor;if(1!==s||!o||!o[0])return new c(!s||s<0&&(!o||o[0])?NaN:o?this:1/0);for(x=!1,n=0==(s=Math.sqrt(+this))||s==1/0?(((t=Rt(o)).length+u)%2==0&&(t+="0"),s=Math.sqrt(t),u=Ft((u+1)/2)-(u<0||u%2),new c(t=s==1/0?"5e"+u:(t=s.toExponential()).slice(0,t.indexOf("e")+1)+u)):new c(s.toString()),r=(u=c.precision)+3;;)if(n=(a=n).plus(D(this,a,r+2,1)).times(.5),Rt(a.d).slice(0,r)===(t=Rt(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))||(O(n,u+1,1),e=!n.times(n).eq(this));break}if(!i&&(O(a,u+1,0),a.times(a).eq(this))){n=a;break}r+=4,i=1}return x=!0,O(n,u,c.rounding,e)},o.tangent=o.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=D(r,new n(1).minus(r.times(r)).sqrt(),e+10,0),n.precision=e,n.rounding=t,O(2==gt||4==gt?r.neg():r,e,t,!0)):new n(NaN)},o.times=o.mul=function(e){var t,r,n,i,a,o,u,s,c,l=this.constructor,f=this.d,p=(e=new l(e)).d;if(e.s*=this.s,!(f&&f[0]&&p&&p[0]))return new l(!e.s||f&&!f[0]&&!p||p&&!p[0]&&!f?NaN:f&&p?0*e.s:e.s/0);for(r=Ft(this.e/F)+Ft(e.e/F),(s=f.length)<(c=p.length)&&(a=f,f=p,p=a,o=s,s=c,c=o),a=[],n=o=s+c;n--;)a.push(0);for(n=c;0<=--n;){for(t=0,i=s+n;n<i;)u=a[i]+p[n]*f[i-n-1]+t,a[i--]=u%kt|0,t=u/kt|0;a[i]=(a[i]+t)%kt|0}for(;!a[--o];)a.pop();return t?++r:a.shift(),e.d=a,e.e=Gt(a,r),x?O(e,l.precision,l.rounding):e},o.toBinary=function(e,t){return or(this,2,e,t)},o.toDecimalPlaces=o.toDP=function(e,t){var r=this.constructor,n=new r(this);return void 0===e?n:(qt(e,0,1e9),void 0===t?t=r.rounding:qt(t,0,8),O(n,e+n.e+1,t))},o.toExponential=function(e,t){var r=this,n=r.constructor,n=void 0===e?Ht(r,!0):(qt(e,0,1e9),void 0===t?t=n.rounding:qt(t,0,8),Ht(r=O(new n(r),e+1,t),!0,e+1));return r.isNeg()&&!r.isZero()?"-"+n:n},o.toFixed=function(e,t){var r=this.constructor,t=void 0===e?Ht(this):(qt(e,0,1e9),void 0===t?t=r.rounding:qt(t,0,8),Ht(r=O(new r(this),e+this.e+1,t),!1,e+r.e+1));return this.isNeg()&&!this.isZero()?"-"+t:t},o.toFraction=function(e){var t,r,n,i,a,o,u,s,c,l,f=this.d,p=this.constructor;if(!f)return new p(this);if(s=r=new p(1),n=u=new p(0),c=(a=(t=new p(n)).e=Wt(f)-this.e-1)%F,t.d[0]=d(10,c<0?F+c:c),null==e)e=0<a?t:s;else{if(!(o=new p(e)).isInt()||o.lt(s))throw Error(At+o);e=o.gt(t)?0<a?t:s:o}for(x=!1,o=new p(Rt(f)),c=p.precision,p.precision=a=f.length*F*2;l=D(o,t,0,1,1),1!=(i=r.plus(l.times(n))).cmp(e);)r=n,n=i,i=s,s=u.plus(l.times(i)),u=i,i=t,t=o.minus(l.times(i)),o=i;return i=D(e.minus(r),n,0,1,1),u=u.plus(i.times(s)),r=r.plus(i.times(n)),u.s=s.s=this.s,f=D(s,n,a,1).minus(this).abs().cmp(D(u,r,a,1).minus(this).abs())<1?[s,n]:[u,r],p.precision=c,x=!0,f},o.toHexadecimal=o.toHex=function(e,t){return or(this,16,e,t)},o.toNearest=function(e,t){var r=(n=this).constructor,n=new r(n);if(null==e){if(!n.d)return n;e=new r(1),t=r.rounding}else{if(e=new r(e),void 0===t?t=r.rounding:qt(t,0,8),!n.d)return e.s?n:e;if(!e.d)return e.s&&(e.s=n.s),e}return e.d[0]?(x=!1,n=D(n,e,0,t,1).times(e),x=!0,O(n)):(e.s=n.s,n=e),n},o.toNumber=function(){return+this},o.toOctal=function(e,t){return or(this,8,e,t)},o.toPower=o.pow=function(e){var t,r,n,i,a,o,u=this,s=u.constructor,c=+(e=new s(e));if(!(u.d&&e.d&&u.d[0]&&e.d[0]))return new s(d(+u,c));if((u=new s(u)).eq(1))return u;if(n=s.precision,a=s.rounding,e.eq(1))return O(u,n,a);if((t=Ft(e.e/F))>=e.d.length-1&&(r=c<0?-c:c)<=9007199254740991)return i=Jt(s,u,r,n),e.s<0?new s(1).div(i):O(i,n,a);if((o=u.s)<0){if(t<e.d.length-1)return new s(NaN);if(0==(1&e.d[t])&&(o=1),0==u.e&&1==u.d[0]&&1==u.d.length)return u.s=o,u}return(t=0!=(r=d(+u,c))&&isFinite(r)?new s(r+"").e:Ft(c*(Math.log("0."+Rt(u.d))/Math.LN10+u.e+1)))>s.maxE+1||t<s.minE-1?new s(0<t?o/0:0):(x=!1,s.rounding=u.s=1,r=Math.min(12,(t+"").length),(i=Kt(e.times(er(u,n+r)),n)).d&&jt((i=O(i,n+5,1)).d,n,a)&&(+Rt((i=O(Kt(e.times(er(u,(t=n+10)+r)),t),t+5,1)).d).slice(n+1,n+15)+1==1e14&&(i=O(i,n+1,0))),i.s=o,x=!0,O(i,n,s.rounding=a))},o.toPrecision=function(e,t){var r=this,n=r.constructor,t=void 0===e?Ht(r,r.e<=n.toExpNeg||r.e>=n.toExpPos):(qt(e,1,1e9),void 0===t?t=n.rounding:qt(t,0,8),Ht(r=O(new n(r),e,t),e<=r.e||r.e<=n.toExpNeg,e));return r.isNeg()&&!r.isZero()?"-"+t:t},o.toSignificantDigits=o.toSD=function(e,t){var r=this.constructor;return void 0===e?(e=r.precision,t=r.rounding):(qt(e,1,1e9),void 0===t?t=r.rounding:qt(t,0,8)),O(new r(this),e,t)},o.toString=function(){var e=this.constructor,e=Ht(this,this.e<=e.toExpNeg||this.e>=e.toExpPos);return this.isNeg()&&!this.isZero()?"-"+e:e},o.truncated=o.trunc=function(){return O(new this.constructor(this),this.e+1,1)},o.valueOf=o.toJSON=function(){var e=this.constructor,e=Ht(this,this.e<=e.toExpNeg||this.e>=e.toExpPos);return this.isNeg()?"-"+e:e};var D=function(e,t,r,n,i,a){var o,u,s,c,l,f,p,m,h,d,y,v,g,x,b,w,N,D,E,A=e.constructor,S=e.s==t.s?1:-1,C=e.d,M=t.d;if(!(C&&C[0]&&M&&M[0]))return new A(e.s&&t.s&&(C?!M||C[0]!=M[0]:M)?C&&0==C[0]||!M?0*S:S/0:NaN);for(u=a?(l=1,e.e-t.e):(a=kt,Ft(e.e/(l=F))-Ft(t.e/l)),D=M.length,w=C.length,h=(S=new A(S)).d=[],s=0;M[s]==(C[s]||0);s++);if(M[s]>(C[s]||0)&&u--,null==r?(g=r=A.precision,n=A.rounding):g=i?r+(e.e-t.e)+1:r,g<0)h.push(1),f=!0;else{if(g=g/l+2|0,s=0,1==D){for(M=M[c=0],g++;(s<w||c)&&g--;s++)x=c*a+(C[s]||0),h[s]=x/M|0,c=x%M|0;f=c||s<w}else{for(1<(c=a/(M[0]+1)|0)&&(M=Lt(M,c,a),C=Lt(C,c,a),D=M.length,w=C.length),b=D,y=(d=C.slice(0,D)).length;y<D;)d[y++]=0;for((E=M.slice()).unshift(0),N=M[0],M[1]>=a/2&&++N;c=0,(o=Ut(M,d,D,y))<0?(v=d[0],1<(c=(v=D!=y?v*a+(d[1]||0):v)/N|0)?1==(o=Ut(p=Lt(M,c=a<=c?a-1:c,a),d,m=p.length,y=d.length))&&(c--,$t(p,D<m?E:M,m,a)):(0==c&&(o=c=1),p=M.slice()),(m=p.length)<y&&p.unshift(0),$t(d,p,y,a),-1==o&&(o=Ut(M,d,D,y=d.length))<1&&(c++,$t(d,D<y?E:M,y,a)),y=d.length):0===o&&(c++,d=[0]),h[s++]=c,o&&d[0]?d[y++]=C[b]||0:(d=[C[b]],y=1),(b++<w||void 0!==d[0])&&g--;);f=void 0!==d[0]}h[0]||h.shift()}if(1==l)S.e=u,vt=f;else{for(s=1,c=h[0];10<=c;c/=10)s++;S.e=s+u*l-1,O(S,i?r+S.e+1:r,n,f)}return S};function Lt(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 Ut(e,t,r,n){var i,a;if(r!=n)a=n<r?1:-1;else for(i=a=0;i<r;i++)if(e[i]!=t[i]){a=e[i]>t[i]?1:-1;break}return a}function $t(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=e[r]<t[r]?1:0,e[r]=i*n+e[r]-t[r];for(;!e[0]&&1<e.length;)e.shift()}function O(e,t,r,n){var i,a,o,u,s,c,l,f,p=e.constructor;e:if(null!=t){if(!(l=e.d))return e;for(i=1,u=l[0];10<=u;u/=10)i++;if((a=t-i)<0)a+=F,o=t,s=(c=l[f=0])/d(10,i-o-1)%10|0;else if((f=Math.ceil((a+1)/F))>=(u=l.length)){if(!n)break e;for(;u++<=f;)l.push(0);c=s=0,o=(a%=F)-F+(i=1)}else{for(c=u=l[f],i=1;10<=u;u/=10)i++;s=(o=(a%=F)-F+i)<0?0:c/d(10,i-o-1)%10|0}if(n=n||t<0||void 0!==l[f+1]||(o<0?c:c%d(10,i-o-1)),s=r<4?(s||n)&&(0==r||r==(e.s<0?3:2)):5<s||5==s&&(4==r||n||6==r&&(0<a?0<o?c/d(10,i-o):0:l[f-1])%10&1||r==(e.s<0?8:7)),t<1||!l[0])return l.length=0,s?(t-=e.e+1,l[0]=d(10,(F-t%F)%F),e.e=-t||0):l[0]=e.e=0,e;if(0==a?(l.length=f,u=1,f--):(l.length=f+1,u=d(10,F-a),l[f]=0<o?(c/d(10,i-o)%d(10,o)|0)*u:0),s)for(;;){if(0==f){for(a=1,o=l[0];10<=o;o/=10)a++;for(o=l[0]+=u,u=1;10<=o;o/=10)u++;a!=u&&(e.e++,l[0]==kt&&(l[0]=1));break}if(l[f]+=u,l[f]!=kt)break;l[f--]=0,u=1}for(a=l.length;0===l[--a];)l.pop()}return x&&(e.e>p.maxE?(e.d=null,e.e=NaN):e.e<p.minE&&(e.e=0,e.d=[0])),e}function Ht(e,t,r){if(!e.isFinite())return tr(e);var n,i=e.e,a=Rt(e.d),o=a.length;return t?(r&&0<(n=r-o)?a=a.charAt(0)+"."+a.slice(1)+Yt(n):1<o&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(e.e<0?"e":"e+")+e.e):i<0?(a="0."+Yt(-i-1)+a,r&&0<(n=r-o)&&(a+=Yt(n))):o<=i?(a+=Yt(i+1-o),r&&0<(n=r-i-1)&&(a=a+"."+Yt(n))):((n=i+1)<o&&(a=a.slice(0,n)+"."+a.slice(n)),r&&0<(n=r-o)&&(i+1===o&&(a+="."),a+=Yt(n))),a}function Gt(e,t){var r=e[0];for(t*=F;10<=r;r/=10)t++;return t}function Vt(e,t,r){if(It<t)throw x=!0,r&&(e.precision=r),Error(St);return O(new e(wt),t,1,!0)}function Zt(e,t,r){if(zt<t)throw Error(St);return O(new e(Nt),t,r,!0)}function Wt(e){var t=e.length-1,r=t*F+1;if(t=e[t]){for(;t%10==0;t/=10)r--;for(t=e[0];10<=t;t/=10)r++}return r}function Yt(e){for(var t="";e--;)t+="0";return t}function Jt(e,t,r,n){var i,a=new e(1),o=Math.ceil(n/F+4);for(x=!1;;){if(r%2&&ur((a=a.times(t)).d,o)&&(i=!0),0===(r=Ft(r/2))){r=a.d.length-1,i&&0===a.d[r]&&++a.d[r];break}ur((t=t.times(t)).d,o)}return x=!0,a}function Xt(e){return 1&e.d[e.d.length-1]}function Qt(e,t,r){for(var n,i=new e(t[0]),a=0;++a<t.length;){if(!(n=new e(t[a])).s){i=n;break}i[r](n)&&(i=n)}return i}function Kt(e,t){var r,n,i,a,o,u,s,c=0,l=0,f=0,p=e.constructor,m=p.rounding,h=p.precision;if(!e.d||!e.d[0]||17<e.e)return new p(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:NaN);for(s=null==t?(x=!1,h):t,u=new p(.03125);-2<e.e;)e=e.times(u),f+=5;for(s+=n=Math.log(d(2,f))/Math.LN10*2+5|0,r=a=o=new p(1),p.precision=s;;){if(a=O(a.times(e),s,1),r=r.times(++l),Rt((u=o.plus(D(a,r,s,1))).d).slice(0,s)===Rt(o.d).slice(0,s)){for(i=f;i--;)o=O(o.times(o),s,1);if(null!=t)return p.precision=h,o;if(!(c<3&&jt(o.d,s-n,m,c)))return O(o,p.precision=h,m,x=!0);p.precision=s+=10,r=a=u=new p(1),l=0,c++}o=u}}function er(e,t){var r,n,i,a,o,u,s,c,l,f,p,m=1,h=e,d=h.d,y=h.constructor,v=y.rounding,g=y.precision;if(h.s<0||!d||!d[0]||!h.e&&1==d[0]&&1==d.length)return new y(d&&!d[0]?-1/0:1!=h.s?NaN:d?0:h);if(l=null==t?(x=!1,g):t,y.precision=l+=10,n=(r=Rt(d)).charAt(0),!(Math.abs(a=h.e)<15e14))return c=Vt(y,l+2,g).times(a+""),h=er(new y(n+"."+r.slice(1)),l-10).plus(c),y.precision=g,null==t?O(h,g,v,x=!0):h;for(;n<7&&1!=n||1==n&&3<r.charAt(1);)n=(r=Rt((h=h.times(e)).d)).charAt(0),m++;for(a=h.e,1<n?(h=new y("0."+r),a++):h=new y(n+"."+r.slice(1)),s=o=h=D((f=h).minus(1),h.plus(1),l,1),p=O(h.times(h),l,1),i=3;;){if(o=O(o.times(p),l,1),Rt((c=s.plus(D(o,new y(i),l,1))).d).slice(0,l)===Rt(s.d).slice(0,l)){if(s=s.times(2),0!==a&&(s=s.plus(Vt(y,l+2,g).times(a+""))),s=D(s,new y(m),l,1),null!=t)return y.precision=g,s;if(!jt(s.d,l-10,v,u))return O(s,y.precision=g,v,x=!0);y.precision=l+=10,c=o=h=D(f.minus(1),f.plus(1),l,1),p=O(h.times(h),l,1),i=u=1}s=c,i+=2}}function tr(e){return String(e.s*e.s/0)}function rr(e,t){var r,n,i;for(0<(n=(t=-1<(r=t.indexOf("."))?t.replace(".",""):t).search(/e/i))?(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)%F,r<0&&(n+=F),n<i){for(n&&e.d.push(+t.slice(0,n)),i-=F;n<i;)e.d.push(+t.slice(n,n+=F));t=t.slice(n),n=F-t.length}else n-=i;for(;n--;)t+="0";e.d.push(+t),x&&(e.e>e.constructor.maxE?(e.d=null,e.e=NaN):e.e<e.constructor.minE&&(e.e=0,e.d=[0]))}else e.e=0,e.d=[0];return e}function nr(e,t,r,n,i){var a,o,u,s,c=e.precision,l=Math.ceil(c/F);for(x=!1,s=r.times(r),u=new e(n);;){if(o=D(u.times(s),new e(t++*t++),c,1),u=i?n.plus(o):n.minus(o),n=D(o.times(s),new e(t++*t++),c,1),void 0!==(o=u.plus(n)).d[l]){for(a=l;o.d[a]===u.d[a]&&a--;);if(-1==a)break}a=u,u=n,n=o,o=a}return x=!0,o.d.length=l+1,o}function ir(e,t){for(var r=e;--t;)r*=e;return r}function ar(e,t){var r,n=t.s<0,e=Zt(e,e.precision,1),i=e.times(.5);if((t=t.abs()).lte(i))return gt=n?4:1,t;if((r=t.divToInt(e)).isZero())gt=n?3:2;else{if((t=t.minus(r.times(e))).lte(i))return gt=Xt(r)?n?2:3:n?4:1,t;gt=Xt(r)?n?1:4:n?3:2}return t.minus(e).abs()}function or(e,t,r,n){var i,a,o,u,s,c,l,f,p=e.constructor,m=void 0!==r;if(m?(qt(r,1,1e9),void 0===n?n=p.rounding:qt(n,0,8)):(r=p.precision,n=p.rounding),e.isFinite()){for(m?(i=2,16==t?r=4*r-3:8==t&&(r=3*r-2)):i=t,0<=(o=(c=Ht(e)).indexOf("."))&&(c=c.replace(".",""),(f=new p(1)).e=c.length-o,f.d=Pt(Ht(f),10,i),f.e=f.d.length),a=u=(l=Pt(c,10,i)).length;0==l[--u];)l.pop();if(l[0]){if(o<0?a--:((e=new p(e)).d=l,e.e=a,l=(e=D(e,f,r,n,0,i)).d,a=e.e,s=vt),o=l[r],p=i/2,s=s||void 0!==l[r+1],s=n<4?(void 0!==o||s)&&(0===n||n===(e.s<0?3:2)):p<o||o===p&&(4===n||s||6===n&&1&l[r-1]||n===(e.s<0?8:7)),l.length=r,s)for(;++l[--r]>i-1;)l[r]=0,r||(++a,l.unshift(1));for(u=l.length;!l[u-1];--u);for(o=0,c="";o<u;o++)c+=bt.charAt(l[o]);if(m){if(1<u)if(16==t||8==t){for(o=16==t?4:3,--u;u%o;u++)c+="0";for(u=(l=Pt(c,i,t)).length;!l[u-1];--u);for(o=1,c="1.";o<u;o++)c+=bt.charAt(l[o])}else c=c.charAt(0)+"."+c.slice(1);c=c+(a<0?"p":"p+")+a}else if(a<0){for(;++a;)c="0"+c;c="0."+c}else if(++a>u)for(a-=u;a--;)c+="0";else a<u&&(c=c.slice(0,a)+"."+c.slice(a))}else c=m?"0p+0":"0";c=(16==t?"0x":2==t?"0b":8==t?"0o":"")+c}else c=tr(e);return e.s<0?"-"+c:c}function ur(e,t){return e.length>t&&(e.length=t,1)}function sr(e){return new this(e).abs()}function cr(e){return new this(e).acos()}function lr(e){return new this(e).acosh()}function fr(e,t){return new this(e).plus(t)}function pr(e){return new this(e).asin()}function mr(e){return new this(e).asinh()}function hr(e){return new this(e).atan()}function dr(e){return new this(e).atanh()}function yr(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?Zt(this,n,i):new this(0)).s=e.s:!e.d||t.isZero()?(r=Zt(this,a,1).times(.5)).s=e.s:r=t.s<0?(this.precision=a,this.rounding=1,r=this.atan(D(e,t,a,1)),t=Zt(this,a,1),this.precision=n,this.rounding=i,e.s<0?r.minus(t):r.plus(t)):this.atan(D(e,t,a,1)):(r=Zt(this,a,1).times(0<t.s?.25:.75)).s=e.s:r=new this(NaN),r}function vr(e){return new this(e).cbrt()}function gr(e){return O(e=new this(e),e.e+1,2)}function xr(e,t,r){return new this(e).clamp(t,r)}function br(e){if(!e||"object"!=typeof e)throw Error(Et+"Object expected");for(var t,r,n=!0===e.defaults,i=["precision",1,1e9,"rounding",0,8,"toExpNeg",-9e15,0,"toExpPos",0,9e15,"maxE",0,9e15,"minE",-9e15,0,"modulo",0,9],a=0;a<i.length;a+=3)if(t=i[a],n&&(this[t]=Dt[t]),void 0!==(r=e[t])){if(!(Ft(r)===r&&i[a+1]<=r&&r<=i[a+2]))throw Error(At+t+": "+r);this[t]=r}if(t="crypto",n&&(this[t]=Dt[t]),void 0!==(r=e[t])){if(!0!==r&&!1!==r&&0!==r&&1!==r)throw Error(At+t+": "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw Error(Ct);this[t]=!0}else this[t]=!1}return this}function wr(e){return new this(e).cos()}function Nr(e){return new this(e).cosh()}function Dr(e,t){return new this(e).div(t)}function Er(e){return new this(e).exp()}function Ar(e){return O(e=new this(e),e.e+1,3)}function Sr(){var e,t,r=new this(0);for(x=!1,e=0;e<arguments.length;)if((t=new this(arguments[e++])).d)r.d&&(r=r.plus(t.times(t)));else{if(t.s)return x=!0,new this(1/0);r=t}return x=!0,r.sqrt()}function Cr(e){return e instanceof Wr||e&&e.toStringTag===Mt||!1}function Mr(e){return new this(e).ln()}function Fr(e,t){return new this(e).log(t)}function Or(e){return new this(e).log(2)}function Tr(e){return new this(e).log(10)}function _r(){return Qt(this,arguments,"lt")}function Br(){return Qt(this,arguments,"gt")}function kr(e,t){return new this(e).mod(t)}function Ir(e,t){return new this(e).mul(t)}function zr(e,t){return new this(e).pow(t)}function Rr(e){var t,r,n,i,a=0,o=new this(1),u=[];if(void 0===e?e=this.precision:qt(e,1,1e9),n=Math.ceil(e/F),this.crypto)if(crypto.getRandomValues)for(t=crypto.getRandomValues(new Uint32Array(n));a<n;)429e7<=(i=t[a])?t[a]=crypto.getRandomValues(new Uint32Array(1))[0]:u[a++]=i%1e7;else{if(!crypto.randomBytes)throw Error(Ct);for(t=crypto.randomBytes(n*=4);a<n;)214e7<=(i=t[a]+(t[a+1]<<8)+(t[a+2]<<16)+((127&t[a+3])<<24))?crypto.randomBytes(4).copy(t,a):(u.push(i%1e7),a+=4);a=n/4}else for(;a<n;)u[a++]=1e7*Math.random()|0;for(n=u[--a],e%=F,n&&e&&(i=d(10,F-e),u[a]=(n/i|0)*i);0===u[a];a--)u.pop();if(a<0)u=[r=0];else{for(r=-1;0===u[0];r-=F)u.shift();for(n=1,i=u[0];10<=i;i/=10)n++;n<F&&(r-=F-n)}return o.e=r,o.d=u,o}function qr(e){return O(e=new this(e),e.e+1,this.rounding)}function jr(e){return(e=new this(e)).d?e.d[0]?e.s:0*e.s:e.s||NaN}function Pr(e){return new this(e).sin()}function Lr(e){return new this(e).sinh()}function Ur(e){return new this(e).sqrt()}function $r(e,t){return new this(e).sub(t)}function Hr(){var e=0,t=arguments,r=new this(t[e]);for(x=!1;r.s&&++e<t.length;)r=r.plus(t[e]);return x=!0,O(r,this.precision,this.rounding)}function Gr(e){return new this(e).tan()}function Vr(e){return new this(e).tanh()}function Zr(e){return O(e=new this(e),e.e+1,1)}o[Symbol.for("nodejs.util.inspect.custom")]=o.toString,o[Symbol.toStringTag]="Decimal";var Wr=o.constructor=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,Cr(e))return i.s=e.s,void(x?!e.d||e.e>a.maxE?(i.e=NaN,i.d=null):e.e<a.minE?(i.e=0,i.d=[0]):(i.e=e.e,i.d=e.d.slice()):(i.e=e.e,i.d=e.d&&e.d.slice()));if("number"==(n=typeof e)){if(0===e)return i.s=1/e<0?-1:1,i.e=0,void(i.d=[0]);if(e<0?(e=-e,i.s=-1):i.s=1,e===~~e&&e<1e7){for(t=0,r=e;10<=r;r/=10)t++;return void(x?a.maxE<t?(i.e=NaN,i.d=null):t<a.minE?(i.e=0,i.d=[0]):(i.e=t,i.d=[e]):(i.e=t,i.d=[e]))}return 0*e!=0?(e||(i.s=NaN),i.e=NaN,void(i.d=null)):rr(i,e.toString())}if("string"!=n)throw Error(At+e);return 45===(r=e.charCodeAt(0))?(e=e.slice(1),i.s=-1):(43===r&&(e=e.slice(1)),i.s=1),(Bt.test(e)?rr:function(e,t){var r,n,i,a,o,u,s,c;if(-1<t.indexOf("_")){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),Bt.test(t))return rr(e,t)}else if("Infinity"===t||"NaN"===t)return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(Tt.test(t))r=16,t=t.toLowerCase();else if(Ot.test(t))r=2;else{if(!_t.test(t))throw Error(At+t);r=8}for(o=0<=(a=(t=0<(a=t.search(/p/i))?(s=+t.slice(a+1),t.substring(2,a)):t.slice(2)).indexOf(".")),n=e.constructor,o&&(a=(u=(t=t.replace(".","")).length)-a,i=Jt(n,new n(r),a,2*a)),a=t=(c=Pt(t,r,kt)).length-1;0===c[a];--a)c.pop();return a<0?new n(0*e.s):(e.e=Gt(c,t),e.d=c,x=!1,o&&(e=D(e,i,4*u)),s&&(e=e.times(Math.abs(s)<54?d(2,s):Wr.pow(2,s))),x=!0,e)})(i,e)}if(a.prototype=o,a.ROUND_UP=0,a.ROUND_DOWN=1,a.ROUND_CEIL=2,a.ROUND_FLOOR=3,a.ROUND_HALF_UP=4,a.ROUND_HALF_DOWN=5,a.ROUND_HALF_EVEN=6,a.ROUND_HALF_CEIL=7,a.ROUND_HALF_FLOOR=8,a.EUCLID=9,a.config=a.set=br,a.clone=e,a.isDecimal=Cr,a.abs=sr,a.acos=cr,a.acosh=lr,a.add=fr,a.asin=pr,a.asinh=mr,a.atan=hr,a.atanh=dr,a.atan2=yr,a.cbrt=vr,a.ceil=gr,a.clamp=xr,a.cos=wr,a.cosh=Nr,a.div=Dr,a.exp=Er,a.floor=Ar,a.hypot=Sr,a.ln=Mr,a.log=Fr,a.log10=Tr,a.log2=Or,a.max=_r,a.min=Br,a.mod=kr,a.mul=Ir,a.pow=zr,a.random=Rr,a.round=qr,a.sign=jr,a.sin=Pr,a.sinh=Lr,a.sqrt=Ur,a.sub=$r,a.sum=Hr,a.tan=Gr,a.tanh=Vr,a.trunc=Zr,(t=void 0===t?{}:t)&&!0!==t.defaults)for(i=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],r=0;r<i.length;)t.hasOwnProperty(n=i[r++])||(t[n]=this[n]);return a.config(t),a}(Dt),wt=new Wr(wt),Nt=new Wr(Nt);const Yr=Wr;var Jr=N("BigNumber",["?on","config"],function(e){var t=e.on,e=e.config,r=Yr.clone({precision:e.precision,modulo:Yr.EUCLID});return r.prototype=Object.create(r.prototype),r.prototype.type="BigNumber",r.prototype.isBigNumber=!0,r.prototype.toJSON=function(){return{mathjs:"BigNumber",value:this.toString()}},r.fromJSON=function(e){return new r(e.value)},t&&t("config",function(e,t){e.precision!==t.precision&&r.config({precision:e.precision})}),r},{isClass:!0}),Xr=Mh(5716),Qr=N("Complex",[],function(){return Object.defineProperty(Xr,"name",{value:"Complex"}),(Xr.prototype.constructor=Xr).prototype.type="Complex",Xr.prototype.isComplex=!0,Xr.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},Xr.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},Xr.prototype.format=function(e){var t=this.im,r=this.re,n=ye(this.re,e),i=ye(this.im,e),e=Ee(e)?e:e?e.precision:null;return null!==e&&(e=Math.pow(10,-e),Math.abs(r/t)<e&&(r=0),Math.abs(t/r)<e&&(t=0)),0===t?n:0===r?1===t?"i":-1===t?"-i":i+"i":t<0?-1===t?n+" - i":n+" - "+i.substring(1)+"i":1===t?n+" + i":n+" + "+i+"i"},Xr.fromPolar=function(e){switch(arguments.length){case 1:var t=e;if("object"===V(t))return Xr(t);throw new TypeError("Input has to be an object with r and phi keys.");case 2:var t=e,r=arguments[1];if(Ee(t)){if(Ee(r=Z(r)&&r.hasBase("ANGLE")?r.toNumber("rad"):r))return new Xr({r:t,phi:r});throw new TypeError("Phi is not a number nor an angle unit.")}throw new TypeError("Radius r is not a number.");default:throw new SyntaxError("Wrong number of arguments in function fromPolar")}},Xr.prototype.valueOf=Xr.prototype.toString,Xr.fromJSON=function(e){return new Xr(e)},Xr.compare=function(e,t){return e.re>t.re?1:e.re<t.re?-1:e.im>t.im?1:e.im<t.im?-1:0},Xr},{isClass:!0}),Kr=Mh(3996),en=N("Fraction",[],function(){return Object.defineProperty(Kr,"name",{value:"Fraction"}),(Kr.prototype.constructor=Kr).prototype.type="Fraction",Kr.prototype.isFraction=!0,Kr.prototype.toJSON=function(){return{mathjs:"Fraction",n:this.s*this.n,d:this.d}},Kr.fromJSON=function(e){return new Kr(e)},Kr},{isClass:!0}),tn=(Mh(3362),N("Range",[],function(){function o(e,t,r){if(!(this instanceof o))throw new SyntaxError("Constructor must be called with the new operator");var n=null!=e,i=null!=t,a=null!=r;if(n)if(Ae(e))e=e.toNumber();else if("number"!=typeof e)throw new TypeError("Parameter start must be a number");if(i)if(Ae(t))t=t.toNumber();else if("number"!=typeof t)throw new TypeError("Parameter end must be a number");if(a)if(Ae(r))r=r.toNumber();else if("number"!=typeof r)throw new TypeError("Parameter step must be a number");this.start=n?parseFloat(e):0,this.end=i?parseFloat(t):0,this.step=a?parseFloat(r):1}return o.prototype.type="Range",o.prototype.isRange=!0,o.parse=function(e){if("string"!=typeof e)return null;var t=e.split(":").map(function(e){return parseFloat(e)});if(t.some(function(e){return isNaN(e)}))return null;switch(t.length){case 2:return new o(t[0],t[1]);case 3:return new o(t[0],t[2],t[1]);default:return null}},o.prototype.clone=function(){return new o(this.start,this.end,this.step)},o.prototype.size=function(){var e=0,t=this.start,r=this.step,t=this.end-t;return n(r)===n(t)?e=Math.ceil(t/r):0==t&&(e=0),[e=isNaN(e)?0:e]},o.prototype.min=function(){var e=this.size()[0];return 0<e?0<this.step?this.start:this.start+(e-1)*this.step:void 0},o.prototype.max=function(){var e=this.size()[0];return 0<e?0<this.step?this.start+(e-1)*this.step:this.start:void 0},o.prototype.forEach=function(e){var t=this.start,r=this.step,n=this.end,i=0;if(0<r)for(;t<n;)e(t,[i],this),t+=r,i++;else if(r<0)for(;n<t;)e(t,[i],this),t+=r,i++},o.prototype.map=function(n){var i=[];return this.forEach(function(e,t,r){i[t[0]]=n(e,t,r)}),i},o.prototype.toArray=function(){var r=[];return this.forEach(function(e,t){r[t[0]]=e}),r},o.prototype.valueOf=function(){return this.toArray()},o.prototype.format=function(e){var t=ye(this.start,e);return 1!==this.step&&(t+=":"+ye(this.step,e)),t+":"+ye(this.end,e)},o.prototype.toString=function(){return this.format()},o.prototype.toJSON=function(){return{mathjs:"Range",start:this.start,end:this.end,step:this.step}},o.fromJSON=function(e){return new o(e.start,e.end,e.step)},o},{isClass:!0})),rn=N("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[Symbol.iterator]=function(){throw new Error("Cannot iterate a Matrix interface")},e.prototype.toArray=function(){throw new Error("Cannot invoke toArray on a Matrix interface")},e.prototype.valueOf=function(){throw new Error("Cannot invoke valueOf on a Matrix interface")},e.prototype.format=function(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}),nn=Mh(4756);function an(){return(an=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function on(e,t,r){var n=new e.constructor(2),i="";if(r){if(r<1)throw new Error("size must be in greater than 0");if(!w(r))throw new Error("size must be an integer");if(e.greaterThan(n.pow(r-1).sub(1))||e.lessThan(n.pow(r-1).mul(-1)))throw new Error("Value must be in range [-2^".concat(r-1,", 2^").concat(r-1,"-1]"));if(!e.isInteger())throw new Error("Value must be an integer");e.lessThan(0)&&(e=e.add(n.pow(r))),i="i".concat(r)}switch(t){case 2:return"".concat(e.toBinary()).concat(i);case 8:return"".concat(e.toOctal()).concat(i);case 16:return"".concat(e.toHexadecimal()).concat(i);default:throw new Error("Base ".concat(t," not supported "))}}function un(e,t){return void 0!==t?e.toExponential(t-1):e.toExponential()}function sn(e,t){return Ee(e)?e:Ae(e)?e.toNumber():t}function Fe(e,t){e=function(t,r){{if("number"==typeof t)return ye(t,r);if(!Ae(t))return(i=t)&&"object"===V(i)&&"number"==typeof i.s&&"number"==typeof i.n&&"number"==typeof i.d?r&&"decimal"===r.fraction?t.toString():t.s*t.n+"/"+t.d:Array.isArray(t)?function e(t,r){if(Array.isArray(t)){for(var n="[",i=t.length,a=0;a<i;a++)0!==a&&(n+=", "),n+=e(t[a],r);return n+"]"}return Fe(t,r)}(t,r):S(t)?cn(t):"function"==typeof t?t.syntax?String(t.syntax):"function":t&&"object"===V(t)?"function"==typeof t.format?t.format(r):t&&t.toString(r)!=={}.toString()?t.toString(r):"{"+Object.keys(t).map(function(e){return cn(e)+": "+Fe(t[e],r)}).join(", ")+"}":String(t);var e=t,n=r;if("function"==typeof n)return n(e);if(!e.isFinite())return e.isNaN()?"NaN":e.gt(0)?"Infinity":"-Infinity";var i=ve(n),a=i.notation,o=i.precision,u=i.wordSize;switch(a){case"fixed":return e.toFixed(o);case"exponential":return un(e,o);case"engineering":return c=o,l=(s=e).e,f=l%3==0?l:l<0?l-3-l%3:l-l%3,(c=(c=s.mul(Math.pow(10,-f)).toPrecision(c)).includes("e")?new s.constructor(c).toFixed():c)+"e"+(0<=l?"+":"")+f.toString();case"bin":return on(e,2,u);case"oct":return on(e,8,u);case"hex":return on(e,16,u);case"auto":var s=sn(null==n?void 0:n.lowerExp,-3),c=sn(null==n?void 0:n.upperExp,5);if(e.isZero())return"0";var l=e.toSignificantDigits(o),f=l.e;return(s<=f&&f<c?l.toFixed():un(e,o)).replace(/((\.\d*?)(0+))($|e)/,function(){var e=arguments[2],t=arguments[4];return"."!==e?e+t:t});default:throw new Error('Unknown notation "'+a+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}}(e,t);return t&&"object"===V(t)&&"truncate"in t&&e.length>t.truncate?e.substring(0,t.truncate-3)+"...":e}function cn(e){for(var t=String(e),r="",n=0;n<t.length;){var i=t.charAt(n);r+=i in ln?ln[i]:i,n++}return'"'+r+'"'}Mh(2712),Mh(3771),Mh(9868),Mh(630),Mh(8718);var ln={'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t"};function fn(e){return String(e).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function pn(e,t){if(!S(e))throw new TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: "+Se(e)+", index: 0)");if(S(t))return e===t?0:t<e?1:-1;throw new TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: "+Se(t)+", index: 1)")}function k(e,t,r){if(!(this instanceof k))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 mn(e,t,r){if(!(this instanceof mn))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.min?this.message="Index out of range ("+this.index+" < "+this.min+")":void 0!==this.max&&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 _(e){for(var t=[];Array.isArray(e);)t.push(e.length),e=e[0];return t}function hn(e,t){if(0===t.length){if(Array.isArray(e))throw new k(e.length,0)}else!function e(t,r,n){var i=t.length;if(i!==r[n])throw new k(i,r[n]);if(n<r.length-1)for(var a=n+1,o=0;o<i;o++){var u=t[o];if(!Array.isArray(u))throw new k(r.length-1,r.length,"<");e(t[o],r,a)}else for(o=0;o<i;o++)if(Array.isArray(t[o]))throw new k(r.length+1,r.length,">")}(e,t,0)}function dn(e,t){var r=e.isMatrix?e._size:_(e);t._sourceSize.forEach(function(e,t){if(null!==e&&e!==r[t])throw new k(e,r[t])})}function T(e,t){if(void 0!==e){if(!Ee(e)||!w(e))throw new TypeError("Index must be an integer (value: "+e+")");if(e<0||"number"==typeof t&&t<=e)throw new mn(e,t)}}function yn(e){for(var t=0;t<e._dimensions.length;++t){var r=e._dimensions[t];if(r._data&&b(r._data)){if(0===r._size[0])return 1}else if(r.isRange){if(r.start===r.end)return 1}else if(S(r)&&0===r.length)return 1}}function vn(e,t,r){if(!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(!Ee(e)||!w(e)||e<0)throw new TypeError("Invalid size, must contain positive integers (size: "+Fe(t)+")")}),function e(t,r,n,i){var a,o,u=t.length,s=r[n],c=Math.min(u,s);if(t.length=s,n<r.length-1){var l=n+1;for(a=0;a<c;a++)o=t[a],Array.isArray(o)||(o=[o],t[a]=o),e(o,r,l,i);for(a=c;a<s;a++)o=[],t[a]=o,e(o,r,l,i)}else{for(a=0;a<c;a++)for(;Array.isArray(t[a]);)t[a]=t[a][0];for(a=c;a<s;a++)t[a]=i}}(e=Ee(e)||Ae(e)?[e]:e,t,0,void 0!==r?r:0),e}function gn(e,t){var r=E(e),n=r.length;if(!Array.isArray(e)||!Array.isArray(t))throw new TypeError("Array expected");if(0===t.length)throw new k(0,n,"!=");var i=bn(t=xn(t,n));if(n!==i)throw new k(i,n,"!=");try{for(var a=t,o=r,u=a.length-1;0<u;u--){for(var s=a[u],c=[],l=o.length/s,f=0;f<l;f++)c.push(o.slice(f*s,(f+1)*s));o=c}return o}catch(e){if(e instanceof k)throw new k(i,n,"!=");throw e}}function xn(e,t){var r=bn(e),n=e.slice(),i=e.indexOf(-1);if(0<=e.indexOf(-1,i+1))throw new Error("More than one wildcard in sizes");if(0<=i){if(t%r!=0)throw new Error("Could not replace wildcard, since "+t+" is no multiple of "+-r);n[i]=-t/r}return n}function bn(e){return e.reduce(function(e,t){return e*t},1)}function wn(e,t){for(var r=t||_(e);Array.isArray(e)&&1===e.length;)e=e[0],r.shift();for(var n=r.length;1===r[n-1];)n--;return n<r.length&&(e=function e(t,r,n){var i,a;if(n<r){var o=n+1;for(i=0,a=t.length;i<a;i++)t[i]=e(t[i],r,o)}else for(;Array.isArray(t);)t=t[0];return t}(e,n,0),r.length=n),e}function Nn(e,t,r,n){var i=n||_(e);if(r)for(var a=0;a<r;a++)e=[e],i.unshift(1);for(e=function e(t,r,n){var i,a;if(Array.isArray(t)){var o=n+1;for(i=0,a=t.length;i<a;i++)t[i]=e(t[i],r,o)}else for(var u=n;u<r;u++)t=[t];return t}(e,t,0);i.length<t;)i.push(1);return e}function E(e){if(!Array.isArray(e))return e;var r=[];return e.forEach(function e(t){Array.isArray(t)?t.forEach(e):r.push(t)}),r}function Dn(e,t){return Array.prototype.map.call(e,t)}function En(e,t){Array.prototype.forEach.call(e,t)}function An(e,t){if(1!==_(e).length)throw new Error("Only one dimensional matrices supported");return Array.prototype.filter.call(e,t)}function Sn(e,t){if(1!==_(e).length)throw new Error("Only one dimensional matrices supported");return Array.prototype.filter.call(e,function(e){return t.test(e)})}function Cn(e,t){return Array.prototype.join.call(e,t)}function Mn(e){if(!Array.isArray(e))throw new TypeError("Array input expected");if(0===e.length)return e;var t=[],r=0;t[0]={value:e[0],identifier:0};for(var n=1;n<e.length;n++)e[n]===e[n-1]?r++:r=0,t.push({value:e[n],identifier:r});return t}function Fn(e){if(!Array.isArray(e))throw new TypeError("Array input expected");if(0===e.length)return e;for(var t=[],r=0;r<e.length;r++)t.push(e[r].value);return t}function On(e,t){for(var r,n=0,i=0;i<e.length;i++){var a=e[i],o=Array.isArray(a);if(0===i&&o&&(n=a.length),o&&a.length!==n)return;o=o?On(a,t):t(a);if(void 0===r)r=o;else if(r!==o)return"mixed"}return r}function Tn(){var e=Array.prototype.slice.call(arguments,0,-1),r=Array.prototype.slice.call(arguments,-1);if(1===e.length)return e[0];if(1<e.length)return e.slice(1).reduce(function(e,t){return function e(t,r,n,i){if(i<n){if(t.length!==r.length)throw new k(t.length,r.length);for(var a=[],o=0;o<t.length;o++)a[o]=e(t[o],r[o],n,i+1);return a}return t.concat(r)}(e,t,r,0)},e[0]);throw new Error("Wrong number of arguments in function concat")}function _n(e,t){for(var r=t.length,n=e.length,i=0;i<n;i++){var a=r-n+i;if(e[i]<t[a]&&1<e[i]||e[i]>t[a])throw new Error("shape missmatch: missmatch is found in arg with shape (".concat(e,") not possible to broadcast dimension ").concat(n," with size ").concat(e[i]," to size ").concat(t[a]))}}function Bn(e,t){var r=_(e);if(Ue(r,t))return e;_n(r,t);var n,i,a,o=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];for(var n=t.map(function(e){return e.length}),i=Math.max.apply(Math,Me(n)),a=new Array(i).fill(null),o=0;o<t.length;o++)for(var u=t[o],s=n[o],c=0;c<s;c++){var l=i-s+c;u[c]>a[l]&&(a[l]=u[c])}for(var f=0;f<t.length;f++)_n(t[f],a);return a}(r,t),u=o.length,t=[].concat(Me(Array(u-r.length).fill(1)),Me(r)),s=an([],e);r.length<u&&(r=_(s=gn(s,t)));for(var c=0;c<u;c++)r[c]<o[c]&&(n=s,i=o[c],a=c,r=_(s=Tn.apply(void 0,Me(Array(i).fill(n)).concat([a]))));return s}function kn(n){function i(e){var t=s[e];if(t&&(delete u[t],delete s[e],--a,o===t)){if(!a)return c=0,void(o=1);for(;!Object.prototype.hasOwnProperty.call(u,++o););}}var a=0,o=1,u=Object.create(null),s=Object.create(null),c=0;return n=Math.abs(n),{hit:function(e){var t=s[e],r=++c;if(u[r]=e,s[e]=r,!t)return++a<=n?void 0:(e=u[o],i(e),e);if(delete u[t],o===t)for(;!Object.prototype.hasOwnProperty.call(u,++o););},delete:i,clear:function(){a=c=0,o=1,u=Object.create(null),s=Object.create(null)}}}function In(a,e){var e=1<arguments.length&&void 0!==e?e:{},o=e.hasher,u=null==(u=e.limit)?Number.POSITIVE_INFINITY:u,o=null==o?JSON.stringify:o;return function e(){"object"!==V(e.cache)&&(e.cache={values:new Map,lru:kn(u||Number.POSITIVE_INFINITY)});for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=o(t);if(e.cache.values.has(n))return e.cache.lru.hit(n),e.cache.values.get(n);var i=a.apply(a,t);return e.cache.values.set(n,i),e.cache.values.delete(e.cache.lru.hit(n)),i}}function zn(e){return Object.keys(e.signatures||{}).reduce(function(e,t){t=(t.match(/,/g)||[]).length+1;return Math.max(e,t)},-1)}function Rn(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}(k.prototype=new RangeError).constructor=RangeError,k.prototype.name="DimensionError",k.prototype.isDimensionError=!0,(mn.prototype=new RangeError).constructor=RangeError,mn.prototype.name="IndexError",mn.prototype.isIndexError=!0,Mh(3110);var qn=N("DenseMatrix",["Matrix"],function(e){e=e.Matrix;function v(e,t){if(!(this instanceof v))throw new SyntaxError("Constructor must be called with the new operator");if(t&&!S(t))throw new Error("Invalid datatype: "+t);if(P(e))"DenseMatrix"===e.type?(this._data=Ce(e._data),this._size=Ce(e._size)):(this._data=e.toArray(),this._size=e.size()),this._datatype=t||e._datatype;else if(e&&b(e.data)&&b(e.size))this._data=e.data,this._size=e.size,hn(this._data,this._size),this._datatype=t||e.datatype;else if(b(e))this._data=r(e),this._size=_(this._data),hn(this._data,this._size),this._datatype=t;else{if(e)throw new TypeError("Unsupported type of data ("+Se(e)+")");this._data=[],this._size=[0],this._datatype=t}}function u(e,t,r){if(0!==t.length)return e._size=t.slice(0),e._data=vn(e._data,e._size,r),e;for(var n=e._data;b(n);)n=n[0];return n}function g(e,t,r){for(var n=e._size.slice(0),i=!1;n.length<t.length;)n.push(0),i=!0;for(var a=0,o=t.length;a<o;a++)t[a]>n[a]&&(n[a]=t[a],i=!0);i&&u(e,n,r)}function r(e){return P(e)?r(e.valueOf()):b(e)?e.map(r):e}return(v.prototype=new e).createDenseMatrix=function(e,t){return new v(e,t)},Object.defineProperty(v,"name",{value:"DenseMatrix"}),(v.prototype.constructor=v).prototype.type="DenseMatrix",v.prototype.isDenseMatrix=!0,v.prototype.getDataType=function(){return On(this._data,Se)},v.prototype.storage=function(){return"dense"},v.prototype.datatype=function(){return this._datatype},v.prototype.create=function(e,t){return new v(e,t)},v.prototype.subset=function(e,t,r){switch(arguments.length){case 1:var n=this,i=e;if(!z(i))throw new TypeError("Invalid index");if(i.isScalar())return n.get(i.min());var a=i.size();if(a.length!==n._size.length)throw new k(a.length,n._size.length);for(var o=i.min(),u=i.max(),s=0,c=n._size.length;s<c;s++)T(o[s],n._size[s]),T(u[s],n._size[s]);return new v(function t(r,n,i,a){var e=a===i-1,o=n.dimension(a);return(e?o.map(function(e){return T(e,r.length),r[e]}):o.map(function(e){return T(e,r.length),t(r[e],n,i,a+1)})).valueOf()}(n._data,i,a.length,0),n._datatype);case 2:case 3:var l=this,i=e,a=t,f=r;if(!i||!0!==i.isIndex)throw new TypeError("Invalid index");var p,m=i.size(),h=i.isScalar();if(P(a)?(p=a.size(),a=a.valueOf()):p=_(a),h){if(0!==p.length)throw new TypeError("Scalar expected");l.set(i.min(),a,f)}else{if(!Ue(p,m))try{p=_(a=0===p.length?Bn([a],m):Bn(a,m))}catch(l){}if(m.length<l._size.length)throw new k(m.length,l._size.length,"<");if(p.length<m.length){for(var d=0,y=0;1===m[d]&&1===p[d];)d++;for(;1===m[d];)y++,d++;a=Nn(a,m.length,y,p)}if(!Ue(m,p))throw new k(m,p,">");g(l,i.max().map(function(e){return e+1}),f);h=m.length;!function r(n,i,a,o,u){var e=u===o-1,t=i.dimension(u);e?t.forEach(function(e,t){T(e),n[e]=a[t[0]]}):t.forEach(function(e,t){T(e),r(n[e],i,a[t[0]],o,u+1)})}(l._data,i,a,h,0)}return l;default:throw new SyntaxError("Wrong number of arguments")}},v.prototype.get=function(e){if(!b(e))throw new TypeError("Array expected");if(e.length!==this._size.length)throw new k(e.length,this._size.length);for(var t=0;t<e.length;t++)T(e[t],this._size[t]);for(var r=this._data,n=0,i=e.length;n<i;n++){var a=e[n];T(a,r.length),r=r[a]}return r},v.prototype.set=function(e,t,r){if(!b(e))throw new TypeError("Array expected");if(e.length<this._size.length)throw new k(e.length,this._size.length,"<");g(this,e.map(function(e){return e+1}),r);for(var n,i=this._data,a=0,o=e.length-1;a<o;a++)T(n=e[a],i.length),i=i[n];return T(n=e[e.length-1],i.length),i[n]=t,this},v.prototype.resize=function(e,t,r){if(!C(e))throw new TypeError("Array or Matrix expected");e=e.valueOf().map(function(e){return Array.isArray(e)&&1===e.length?e[0]:e});return u(r?this.clone():this,e,t)},v.prototype.reshape=function(e,t){var t=t?this.clone():this,r=(t._data=gn(t._data,e),t._size.reduce(function(e,t){return e*t}));return t._size=xn(e,r),t},v.prototype.clone=function(){return new v({data:Ce(this._data),size:Ce(this._size),datatype:this._datatype})},v.prototype.size=function(){return this._size.slice(0)},v.prototype.map=function(t){var i=this,a=zn(t),e=function r(e,n){return b(e)?e.map(function(e,t){return r(e,n.concat(t))}):1===a?t(e):2===a?t(e,n):t(e,n,i)}(this._data,[]);return new v(e,void 0!==this._datatype?On(e,Se):void 0)},v.prototype.forEach=function(t){var i=this;!function r(e,n){b(e)?e.forEach(function(e,t){r(e,n.concat(t))}):t(e,n,i)}(this._data,[])},v.prototype[Symbol.iterator]=nn.mark(function e(){var t;return nn.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=nn.mark(function t(r,n){var i;return nn.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!b(r)){e.next=9;break}i=0;case 2:if(i<r.length)return e.delegateYield(t(r[i],n.concat(i)),"t0",4);e.next=7;break;case 4:i++,e.next=2;break;case 7:e.next=11;break;case 9:return e.next=11,{value:r,index:n};case 11:case"end":return e.stop()}},t)}),e.delegateYield(t(this._data,[]),"t0",2);case 2:case"end":return e.stop()}},e,this)}),v.prototype.rows=function(){var e=[];if(2!==this.size().length)throw new TypeError("Rows can only be returned for a 2D matrix.");var t,r=function(e){var t,r,n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e){if(e){if("string"==typeof e)return Rn(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(t="Object"===t&&e.constructor?e.constructor.name:t)||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Rn(e,void 0):void 0}}(e)))return n&&(e=n),t=0,{s:r=function(){},n:function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}},e:function(e){throw e},f:r};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,o=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){o=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(o)throw i}}}}(this._data);try{for(r.s();!(t=r.n()).done;){var n=t.value;e.push(new v([n],this._datatype))}}catch(e){r.e(e)}finally{r.f()}return e},v.prototype.columns=function(){var r=this,n=[],e=this.size();if(2!==e.length)throw new TypeError("Rows can only be returned for a 2D matrix.");for(var i=this._data,t=0;t<e[1];t++)!function(t){var e=i.map(function(e){return[e[t]]});n.push(new v(e,r._datatype))}(t);return n},v.prototype.toArray=function(){return Ce(this._data)},v.prototype.valueOf=function(){return this._data},v.prototype.format=function(e){return Fe(this._data,e)},v.prototype.toString=function(){return Fe(this._data)},v.prototype.toJSON=function(){return{mathjs:"DenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},v.prototype.diagonal=function(e){if(e){if(!Ee(e=Ae(e)?e.toNumber():e)||!w(e))throw new TypeError("The parameter k must be an integer number")}else e=0;for(var t=0<e?e:0,r=e<0?-e:0,e=this._size[0],n=this._size[1],i=Math.min(e-r,n-t),a=[],o=0;o<i;o++)a[o]=this._data[o+r][o+t];return new v({data:a,size:[i],datatype:this._datatype})},v.diagonal=function(e,t,r,n){if(!b(e))throw new TypeError("Array expected, size parameter");if(2!==e.length)throw new Error("Only two dimensions matrix are supported");if(e=e.map(function(e){if(!Ee(e=Ae(e)?e.toNumber():e)||!w(e)||e<1)throw new Error("Size values must be positive integers");return e}),r){if(!Ee(r=Ae(r)?r.toNumber():r)||!w(r))throw new TypeError("The parameter k must be an integer number")}else r=0;var i,a=0<r?r:0,o=r<0?-r:0,r=e[0],u=e[1],s=Math.min(r-o,u-a);if(b(t)){if(t.length!==s)throw new Error("Invalid value array length");i=function(e){return t[e]}}else if(P(t)){var c=t.size();if(1!==c.length||c[0]!==s)throw new Error("Invalid matrix length");i=function(e){return t.get([e])}}else i=function(){return t};n=n||(Ae(i(0))?i(0).mul(0):0);var l=[];if(0<e.length)for(var l=vn(l,e,n),f=0;f<s;f++)l[f+o][f+a]=i(f);return new v({data:l,size:[r,u]})},v.fromJSON=function(e){return new v(e)},v.prototype.swapRows=function(e,t){if(!(Ee(e)&&w(e)&&Ee(t)&&w(t)))throw new Error("Row index must be positive integers");if(2!==this._size.length)throw new Error("Only two dimensional matrix is supported");return T(e,this._size[0]),T(t,this._size[0]),v._swapRows(e,t,this._data),this},v._swapRows=function(e,t,r){var n=r[e];r[e]=r[t],r[t]=n},v},{isClass:!0}),jn=N("clone",["typed"],function(e){return(0,e.typed)("clone",{any:Ce})});function Pn(e){for(var t=e.length,r=e[0].length,n=[],i=0;i<r;i++){for(var a=[],o=0;o<t;o++)a.push(e[o][i]);n.push(a)}return n}function Ln(e){for(var t=0;t<e.length;t++)if(C(e[t]))return 1}function Un(e,t){for(var r=0,n=(e=P(e)?e.valueOf():e).length;r<n;r++){var i=e[r];Array.isArray(i)?Un(i,t):t(i)}}function ce(e,t,r){return e&&"function"==typeof e.map?e.map(function(e){return ce(e,t,r)}):t(e)}function $n(e,t,r){var n=Array.isArray(e)?_(e):e.size();if(t<0||t>=n.length)throw new mn(t,n.length);return P(e)?e.create(Hn(e.valueOf(),t,r)):Hn(e,t,r)}function Hn(e,t,r){var n,i,a,o;if(t<=0){if(Array.isArray(e[0])){for(o=Pn(e),i=[],n=0;n<o.length;n++)i[n]=Hn(o[n],t-1,r);return i}for(a=e[0],n=1;n<e.length;n++)a=r(a,e[n]);return a}for(i=[],n=0;n<e.length;n++)i[n]=Hn(e[n],t-1,r);return i}function Gn(e,t,r,n,i,a,o,u,s,c,l){var f,p,m,h,d=e._values,y=e._index,e=e._ptr;if(n)for(p=e[t],m=e[t+1],f=p;f<m;f++)r[h=y[f]]!==a?(r[h]=a,o.push(h),c?(n[h]=s?u(d[f],l):u(l,d[f]),i[h]=a):n[h]=d[f]):(n[h]=s?u(d[f],n[h]):u(n[h],d[f]),i[h]=a);else for(p=e[t],m=e[t+1],f=p;f<m;f++)r[h=y[f]]!==a?(r[h]=a,o.push(h)):i[h]=a}var Vn=N("isInteger",["typed"],function(e){e=e.typed;return e("isInteger",{number:w,BigNumber:function(e){return e.isInt()},Fraction:function(e){return 1===e.d&&isFinite(e.n)},"Array | Matrix":e.referToSelf(function(t){return function(e){return ce(e,t)}})})}),Zn=(Mh(113),Mh(150),"number");function Wn(e){return e<0}function Yn(e){return 0<e}function Jn(e){return 0===e}function Xn(e){return Number.isNaN(e)}Xn.signature=Jn.signature=Yn.signature=Wn.signature=Zn;var Qn="isNegative",Kn=N(Qn,["typed"],function(e){var r=e.typed;return r(Qn,{number:Wn,BigNumber:function(e){return e.isNeg()&&!e.isZero()&&!e.isNaN()},Fraction:function(e){return e.s<0},Unit:r.referToSelf(function(t){return function(e){return r.find(t,e.valueType())(e.value)}}),"Array | Matrix":r.referToSelf(function(t){return function(e){return ce(e,t)}})})}),ei=N("isNumeric",["typed"],function(e){e=e.typed;return e("isNumeric",{"number | BigNumber | Fraction | boolean":function(){return!0},"Complex | Unit | string | null | undefined | Node":function(){return!1},"Array | Matrix":e.referToSelf(function(t){return function(e){return ce(e,t)}})})}),ti=(Mh(2762),"hasNumericValue"),ri=N(ti,["typed","isNumeric"],function(e){var t=e.typed,r=e.isNumeric;return t(ti,{boolean:function(){return!0},string:function(e){return 0<e.trim().length&&!isNaN(Number(e))},any:function(e){return r(e)}})}),ni="isPositive",ii=N(ni,["typed"],function(e){var r=e.typed;return r(ni,{number:Yn,BigNumber:function(e){return!e.isNeg()&&!e.isZero()&&!e.isNaN()},Fraction:function(e){return 0<e.s&&0<e.n},Unit:r.referToSelf(function(t){return function(e){return r.find(t,e.valueType())(e.value)}}),"Array | Matrix":r.referToSelf(function(t){return function(e){return ce(e,t)}})})}),ai=N("isZero",["typed"],function(e){var r=e.typed;return r("isZero",{number:Jn,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:r.referToSelf(function(t){return function(e){return r.find(t,e.valueType())(e.value)}}),"Array | Matrix":r.referToSelf(function(t){return function(e){return ce(e,t)}})})}),oi=N("isNaN",["typed"],function(e){e=e.typed;return e("isNaN",{number:Xn,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":e.referToSelf(function(t){return function(e){return ce(e,t)}})})}),ui=N("typeOf",["typed"],function(e){return(0,e.typed)("typeOf",{any:Se})});function si(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;e=e.constructor.max(e.abs(),t.abs());return n.lte(e.times(r))}return!1}var ci=N("compareUnits",["typed"],function(e){var n=e.typed;return{"Unit, Unit":n.referToSelf(function(r){return function(e,t){if(e.equalBase(t))return n.find(r,[e.valueType(),t.valueType()])(e.value,t.value);throw new Error("Cannot compare units with different base")}})}}),li="equalScalar",fi=N(li,["typed","config"],function(e){var t=e.typed,n=e.config,e=ci({typed:t});return t(li,{"boolean, boolean":function(e,t){return e===t},"number, number":function(e,t){return De(e,t,n.epsilon)},"BigNumber, BigNumber":function(e,t){return e.eq(t)||si(e,t,n.epsilon)},"Fraction, Fraction":function(e,t){return e.equals(t)},"Complex, Complex":function(e,t){return e=e,t=t,r=n.epsilon,De(e.re,t.re,r)&&De(e.im,t.im,r);var r}},e)}),pi=(N(li,["typed","config"],function(e){var t=e.typed,r=e.config;return t(li,{"number, number":function(e,t){return De(e,t,r.epsilon)}})}),N("SparseMatrix",["typed","equalScalar","Matrix"],function(e){var E=e.typed,A=e.equalScalar,e=e.Matrix;function F(e,t){if(!(this instanceof F))throw new SyntaxError("Constructor must be called with the new operator");if(t&&!S(t))throw new Error("Invalid datatype: "+t);if(P(e))r=this,i=t,"SparseMatrix"===(n=e).type?(r._values=n._values?Ce(n._values):void 0,r._index=Ce(n._index),r._ptr=Ce(n._ptr),r._size=Ce(n._size),r._datatype=i||n._datatype):a(r,n.valueOf(),i||n._datatype);else if(e&&b(e.index)&&b(e.ptr)&&b(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(b(e))a(this,e,t);else{if(e)throw new TypeError("Unsupported type of data ("+Se(e)+")");this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=t}var r,n,i}function a(e,t,r){e._values=[],e._index=[],e._ptr=[],e._datatype=r;var n=t.length,i=0,a=A,o=0;if(S(r)&&(a=E.find(A,[r,r])||A,o=E.convert(0,r)),0<n){var u=0;do{e._ptr.push(e._index.length);for(var s=0;s<n;s++){var c,l=t[s];b(l)?(0===u&&i<l.length&&(i=l.length),u<l.length&&(a(c=l[u],o)||(e._values.push(c),e._index.push(s)))):(0===u&&i<1&&(i=1),a(l,o)||(e._values.push(l),e._index.push(s)))}}while(++u<i)}e._ptr.push(e._index.length),e._size=[n,i]}function v(e,t,r,n){if(r-t==0)return r;for(var i=t;i<r;i++)if(n[i]===e)return i;return t}function g(e,t,r,n,i,a,o){i.splice(e,0,n),a.splice(e,0,t);for(var u=r+1;u<o.length;u++)o[u]++}function p(e,t,r,n){var i=n||0,n=A,a=0;S(e._datatype)&&(n=E.find(A,[e._datatype,e._datatype])||A,a=E.convert(0,e._datatype),i=E.convert(i,e._datatype));var o=!n(i,a),u=e._size[0],s=e._size[1];if(s<r){for(l=s;l<r;l++)if(e._ptr[l]=e._values.length,o)for(m=0;m<u;m++)e._values.push(i),e._index.push(m);e._ptr[r]=e._values.length}else r<s&&(e._ptr.splice(r+1,s-r),e._values.splice(e._ptr[r],e._values.length),e._index.splice(e._ptr[r],e._index.length));if(s=r,u<t){if(o){for(var c=0,l=0;l<s;l++){e._ptr[l]=e._ptr[l]+c;for(var f=e._ptr[l+1]+c,p=0,m=u;m<t;m++,p++)e._values.splice(f+p,0,i),e._index.splice(f+p,0,m),c++}e._ptr[s]=e._values.length}}else if(t<u){var h=0;for(l=0;l<s;l++){e._ptr[l]=e._ptr[l]-h;var d=e._ptr[l],y=e._ptr[l+1]-h;for(f=d;f<y;f++)(m=e._index[f])>t-1&&(e._values.splice(f,1),e._index.splice(f,1),h++)}e._ptr[l]=e._values.length}return e._size[0]=t,e._size[1]=r,e}function t(e,t,r,n,i){for(var a,o=n[0],u=n[1],s=[],c=0;c<o;c++)for(s[c]=[],a=0;a<u;a++)s[c][a]=0;for(a=0;a<u;a++)for(var l=r[a],f=r[a+1],p=l;p<f;p++)s[c=t[p]][a]=e?i?Ce(e[p]):e[p]:1;return s}return(F.prototype=new e).createSparseMatrix=function(e,t){return new F(e,t)},Object.defineProperty(F,"name",{value:"SparseMatrix"}),(F.prototype.constructor=F).prototype.type="SparseMatrix",F.prototype.isSparseMatrix=!0,F.prototype.getDataType=function(){return On(this._values,Se)},F.prototype.storage=function(){return"sparse"},F.prototype.datatype=function(){return this._datatype},F.prototype.create=function(e,t){return new F(e,t)},F.prototype.density=function(){var e=this._size[0],t=this._size[1];return 0!==e&&0!==t?this._index.length/(e*t):0},F.prototype.subset=function(e,t,r){if(!this._values)throw new Error("Cannot invoke subset on a Pattern only matrix");switch(arguments.length){case 1:var n=this,i=e;if(!z(i))throw new TypeError("Invalid index");if(i.isScalar())return n.get(i.min());var a,o,u=i.size();if(u.length!==n._size.length)throw new k(u.length,n._size.length);for(var s=i.min(),c=i.max(),l=0,f=n._size.length;l<f;l++)T(s[l],n._size[l]),T(c[l],n._size[l]);var p=n._values,m=n._index,h=n._ptr,d=i.dimension(0),i=i.dimension(1),y=[],v=[],g=(d.forEach(function(e,t){v[e]=t[0],y[e]=!0}),p?[]:void 0),x=[],b=[];return i.forEach(function(e){for(b.push(x.length),a=h[e],o=h[e+1];a<o;a++)l=m[a],!0===y[l]&&(x.push(v[l]),g&&g.push(p[a]))}),b.push(x.length),new F({values:g,index:x,ptr:b,size:u,datatype:n._datatype});case 2:case 3:var w=this,d=e,N=t,D=r;if(!d||!0!==d.isIndex)throw new TypeError("Invalid index");var E,A,S=d.size(),i=d.isScalar();if(P(N)?(E=N.size(),N=N.toArray()):E=_(N),i){if(0!==E.length)throw new TypeError("Scalar expected");w.set(d.min(),N,D)}else{if(1!==S.length&&2!==S.length)throw new k(S.length,w._size.length,"<");if(E.length<S.length){for(var C=0,M=0;1===S[C]&&1===E[C];)C++;for(;1===S[C];)M++,C++;N=Nn(N,S.length,M,E)}if(!Ue(S,E))throw new k(S,E,">");1===S.length?d.dimension(0).forEach(function(e,t){T(e),w.set([e,0],N[t[0]],D)}):(i=d.dimension(0),A=d.dimension(1),i.forEach(function(r,n){T(r),A.forEach(function(e,t){T(e),w.set([r,e],N[n[0]][t[0]],D)})}))}return w;default:throw new SyntaxError("Wrong number of arguments")}},F.prototype.get=function(e){if(!b(e))throw new TypeError("Array expected");if(e.length!==this._size.length)throw new k(e.length,this._size.length);if(!this._values)throw new Error("Cannot invoke get on a Pattern only matrix");var t=e[0],e=e[1],r=(T(t,this._size[0]),T(e,this._size[1]),v(t,this._ptr[e],this._ptr[e+1],this._index));return r<this._ptr[e+1]&&this._index[r]===t?this._values[r]:0},F.prototype.set=function(e,t,r){if(!b(e))throw new TypeError("Array expected");if(e.length!==this._size.length)throw new k(e.length,this._size.length);if(!this._values)throw new Error("Cannot invoke set on a Pattern only matrix");var n=e[0],e=e[1],i=this._size[0],a=this._size[1],o=A,u=0,r=(S(this._datatype)&&(o=E.find(A,[this._datatype,this._datatype])||A,u=E.convert(0,this._datatype)),(i-1<n||a-1<e)&&(p(this,Math.max(n+1,i),Math.max(e+1,a),r),i=this._size[0],a=this._size[1]),T(n,i),T(e,a),v(n,this._ptr[e],this._ptr[e+1],this._index));if(r<this._ptr[e+1]&&this._index[r]===n)if(o(t,u)){i=r,a=e;var s=this._values,c=this._index,l=this._ptr;s.splice(i,1),c.splice(i,1);for(var f=a+1;f<l.length;f++)l[f]--}else this._values[r]=t;else o(t,u)||g(r,n,e,t,this._values,this._index,this._ptr);return this},F.prototype.resize=function(e,t,r){if(!C(e))throw new TypeError("Array or Matrix expected");var n=e.valueOf().map(function(e){return Array.isArray(e)&&1===e.length?e[0]:e});if(2!==n.length)throw new Error("Only two dimensions matrix are supported");return n.forEach(function(e){if(!Ee(e)||!w(e)||e<0)throw new TypeError("Invalid size, must contain positive integers (size: "+Fe(n)+")")}),p(r?this.clone():this,n[0],n[1],t)},F.prototype.reshape=function(t,e){if(!b(t))throw new TypeError("Array expected");if(2!==t.length)throw new Error("Sparse matrices can only be reshaped in two dimensions");t.forEach(function(e){if(!Ee(e)||!w(e)||e<=-2||0===e)throw new TypeError("Invalid size, must contain positive integers or -1 (size: "+Fe(t)+")")});var r=this._size[0]*this._size[1];if(r!=(t=xn(t,r))[0]*t[1])throw new Error("Reshaping sparse matrix will result in the wrong number of elements");var n=e?this.clone():this;if(this._size[0]===t[0]&&this._size[1]===t[1])return n;for(var i=[],a=0;a<n._ptr.length;a++)for(var o=0;o<n._ptr[a+1]-n._ptr[a];o++)i.push(a);for(var u=n._values.slice(),s=n._index.slice(),c=0;c<n._index.length;c++){var l=s[c],f=i[c],l=l*n._size[1]+f;i[c]=l%t[1],s[c]=Math.floor(l/t[1])}n._values.length=0,n._index.length=0,n._ptr.length=t[1]+1,n._size=t.slice();for(var p=0;p<n._ptr.length;p++)n._ptr[p]=0;for(var m=0;m<u.length;m++){var h=s[m],d=i[m],y=u[m];g(v(h,n._ptr[d],n._ptr[d+1],n._index),h,d,y,n._values,n._index,n._ptr)}return n},F.prototype.clone=function(){return new F({values:this._values?Ce(this._values):void 0,index:Ce(this._index),ptr:Ce(this._ptr),size:Ce(this._size),datatype:this._datatype})},F.prototype.size=function(){return this._size.slice(0)},F.prototype.map=function(a,e){if(!this._values)throw new Error("Cannot invoke map on a Pattern only matrix");var o=this,t=this._size[0],r=this._size[1],u=zn(a),n=this,i=t-1,s=r-1,c=e,l=[],f=[],p=[],m=A,h=0;S(n._datatype)&&(m=E.find(A,[n._datatype,n._datatype])||A,h=E.convert(0,n._datatype));for(var d=function(e,t,r){var n,i;n=e,i=t,r=r,e=1===u?a(n):2===u?a(n,[i,r]):a(n,[i,r],o),m(e,h)||(l.push(e),f.push(t))},y=0;y<=s;y++){p.push(l.length);var v=n._ptr[y],g=n._ptr[y+1];if(c)for(var x=v;x<g;x++){var b=n._index[x];0<=b&&b<=i&&d(n._values[x],+b,+y)}else{for(var w={},N=v;N<g;N++)w[n._index[N]]=n._values[N];for(var D=0;D<=i;D++)d(D in w?w[D]:0,+D,+y)}}return p.push(l.length),new F({values:l,index:f,ptr:p,size:[1+i,1+s]})},F.prototype.forEach=function(e,t){if(!this._values)throw new Error("Cannot invoke forEach on a Pattern only matrix");for(var r=this._size[0],n=this._size[1],i=0;i<n;i++){var a=this._ptr[i],o=this._ptr[i+1];if(t)for(var u=a;u<o;u++){var s=this._index[u];e(this._values[u],[s,i],this)}else{for(var c={},l=a;l<o;l++)c[this._index[l]]=this._values[l];for(var f=0;f<r;f++)e(f in c?c[f]:0,[f,i],this)}}},F.prototype[Symbol.iterator]=nn.mark(function e(){var t,r,n,i,a;return nn.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this._values){e.next=2;break}throw new Error("Cannot iterate a Pattern only matrix");case 2:t=this._size[1],r=0;case 4:if(!(r<t)){e.next=18;break}i=this._ptr[r],n=this._ptr[r+1],i=i;case 8:if(i<n)return a=this._index[i],e.next=12,{value:this._values[i],index:[a,r]};e.next=15;break;case 12:i++,e.next=8;break;case 15:r++,e.next=4;break;case 18:case"end":return e.stop()}},e,this)}),F.prototype.toArray=function(){return t(this._values,this._index,this._ptr,this._size,!0)},F.prototype.valueOf=function(){return t(this._values,this._index,this._ptr,this._size,!1)},F.prototype.format=function(e){for(var t=this._size[0],r=this._size[1],n=this.density(),i="Sparse Matrix ["+Fe(t,e)+" x "+Fe(r,e)+"] density: "+Fe(n,e)+"\n",a=0;a<r;a++)for(var o=this._ptr[a],u=this._ptr[a+1],s=o;s<u;s++)i+="\n ("+Fe(this._index[s],e)+", "+Fe(a,e)+") ==> "+(this._values?Fe(this._values[s],e):"X");return i},F.prototype.toString=function(){return Fe(this.toArray())},F.prototype.toJSON=function(){return{mathjs:"SparseMatrix",values:this._values,index:this._index,ptr:this._ptr,size:this._size,datatype:this._datatype}},F.prototype.diagonal=function(e){if(e){if(!Ee(e=Ae(e)?e.toNumber():e)||!w(e))throw new TypeError("The parameter k must be an integer number")}else e=0;var t=0<e?e:0,r=e<0?-e:0,e=this._size[0],n=this._size[1],i=Math.min(e-r,n-t),a=[],o=[],e=[];e[0]=0;for(var u=t;u<n&&a.length<i;u++)for(var s=this._ptr[u],c=this._ptr[u+1],l=s;l<c;l++){var f=this._index[l];if(f===u-t+r){a.push(this._values[l]),o[a.length-1]=f-r;break}}return e.push(a.length),new F({values:a,index:o,ptr:e,size:[i,1]})},F.fromJSON=function(e){return new F(e)},F.diagonal=function(e,t,r,n,i){if(!b(e))throw new TypeError("Array expected, size parameter");if(2!==e.length)throw new Error("Only two dimensions matrix are supported");if(e=e.map(function(e){if(!Ee(e=Ae(e)?e.toNumber():e)||!w(e)||e<1)throw new Error("Size values must be positive integers");return e}),r){if(!Ee(r=Ae(r)?r.toNumber():r)||!w(r))throw new TypeError("The parameter k must be an integer number")}else r=0;var a=A,o=0;S(i)&&(a=E.find(A,[i,i])||A,o=E.convert(0,i));var u,s=0<r?r:0,c=r<0?-r:0,i=e[0],l=e[1],f=Math.min(i-c,l-s);if(b(t)){if(t.length!==f)throw new Error("Invalid value array length");u=function(e){return t[e]}}else if(P(t)){r=t.size();if(1!==r.length||r[0]!==f)throw new Error("Invalid matrix length");u=function(e){return t.get([e])}}else u=function(){return t};for(var p=[],m=[],h=[],d=0;d<l;d++){h.push(p.length);var y,v=d-s;0<=v&&v<f&&(a(y=u(v),o)||(m.push(v+c),p.push(y)))}return h.push(p.length),new F({values:p,index:m,ptr:h,size:[i,l]})},F.prototype.swapRows=function(e,t){if(!(Ee(e)&&w(e)&&Ee(t)&&w(t)))throw new Error("Row index must be positive integers");if(2!==this._size.length)throw new Error("Only two dimensional matrix is supported");return T(e,this._size[0]),T(t,this._size[0]),F._swapRows(e,t,this._size[1],this._values,this._index,this._ptr),this},F._forEachRow=function(e,t,r,n,i){for(var a=n[e],o=n[e+1],u=a;u<o;u++)i(r[u],t[u])},F._swapRows=function(e,t,r,n,i,a){for(var o=0;o<r;o++){var u,s=a[o],c=a[o+1],l=v(e,s,c,i),s=v(t,s,c,i);l<c&&s<c&&i[l]===e&&i[s]===t?n&&(u=n[l],n[l]=n[s],n[s]=u):l<c&&i[l]===e&&(c<=s||i[s]!==t)?(u=n?n[l]:void 0,i.splice(s,0,t),n&&n.splice(s,0,u),i.splice(s<=l?l+1:l,1),n&&n.splice(s<=l?l+1:l,1)):s<c&&i[s]===t&&(c<=l||i[l]!==e)&&(c=n?n[s]:void 0,i.splice(l,0,e),n&&n.splice(l,0,c),i.splice(l<=s?s+1:s,1),n&&n.splice(l<=s?s+1:s,1))}},F},{isClass:!0})),mi=N("number",["typed"],function(e){e=e.typed,e=e("number",{"":function(){return 0},number:function(e){return e},string:function(e){if("NaN"===e)return NaN;var t=(n=(t=e).match(/(0[box])([0-9a-fA-F]*)\.([0-9a-fA-F]*)/))?{input:t,radix:{"0b":2,"0o":8,"0x":16}[n[1]],integerPart:n[2],fractionalPart:n[3]}:null;if(t){for(var r=t,n=parseInt(r.integerPart,r.radix),i=0,a=0;a<r.fractionalPart.length;a++)i+=parseInt(r.fractionalPart[a],r.radix)/Math.pow(r.radix,a+1);if(n+=i,isNaN(n))throw new SyntaxError('String "'+r.input+'" is not a valid number');return n}var t=0,n=e.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/),o=(n&&(t=Number(n[2]),e=n[1]),Number(e));if(isNaN(o))throw new SyntaxError('String "'+e+'" is not a valid number');if(n){if(o>Math.pow(2,t)-1)throw new SyntaxError('String "'.concat(e,'" is out of range'));o>=Math.pow(2,t-1)&&(o-=Math.pow(2,t))}return o},BigNumber:function(e){return e.toNumber()},Fraction:function(e){return e.valueOf()},Unit:e.referToSelf(function(r){return function(e){var t=e.clone();return t.value=r(e.value),t}}),null:function(e){return 0},"Unit, string | Unit":function(e,t){return e.toNumber(t)},"Array | Matrix":e.referToSelf(function(t){return function(e){return ce(e,t)}})});return e.fromJSON=function(e){return parseFloat(e.value)},e}),hi=N("string",["typed"],function(e){e=e.typed;return e("string",{"":function(){return""},number:ye,null:function(e){return"null"},boolean:function(e){return e+""},string:function(e){return e},"Array | Matrix":e.referToSelf(function(t){return function(e){return ce(e,t)}}),any:function(e){return String(e)}})}),di=N("boolean",["typed"],function(e){e=e.typed;return e("boolean",{"":function(){return!1},boolean:function(e){return e},number:function(e){return!!e},null:function(e){return!1},BigNumber:function(e){return!e.isZero()},string:function(e){var t=e.toLowerCase();if("true"===t)return!0;if("false"===t)return!1;t=Number(e);if(""===e||isNaN(t))throw new Error('Cannot convert "'+e+'" to a boolean');return!!t},"Array | Matrix":e.referToSelf(function(t){return function(e){return ce(e,t)}})})}),yi=N("bignumber",["typed","BigNumber"],function(e){var t=e.typed,i=e.BigNumber;return t("bignumber",{"":function(){return new i(0)},number:function(e){return new i(e+"")},string:function(e){var t=e.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);if(t){var r=t[2],t=i(t[1]),n=new i(2).pow(Number(r));if(t.gt(n.sub(1)))throw new SyntaxError('String "'.concat(e,'" is out of range'));r=new i(2).pow(Number(r)-1);return t.gte(r)?t.sub(n):t}return new i(e)},BigNumber:function(e){return e},Unit:t.referToSelf(function(r){return function(e){var t=e.clone();return t.value=r(e.value),t}}),Fraction:function(e){return new i(e.n).div(e.d).times(e.s)},null:function(e){return new i(0)},"Array | Matrix":t.referToSelf(function(t){return function(e){return ce(e,t)}})})}),vi=N("complex",["typed","Complex"],function(e){var t=e.typed,r=e.Complex;return t("complex",{"":function(){return r.ZERO},number:function(e){return new r(e,0)},"number, number":function(e,t){return new r(e,t)},"BigNumber, BigNumber":function(e,t){return new r(e.toNumber(),t.toNumber())},Fraction:function(e){return new r(e.valueOf(),0)},Complex:function(e){return e.clone()},string:function(e){return r(e)},null:function(e){return r(0)},Object:function(e){if("re"in e&&"im"in e)return new r(e.re,e.im);if("r"in e&&"phi"in e||"abs"in e&&"arg"in e)return new r(e);throw new Error("Expected object with properties (re and im) or (r and phi) or (abs and arg)")},"Array | Matrix":t.referToSelf(function(t){return function(e){return ce(e,t)}})})}),gi=N("fraction",["typed","Fraction"],function(e){var t=e.typed,r=e.Fraction;return t("fraction",{number:function(e){if(!isFinite(e)||isNaN(e))throw new Error(e+" cannot be represented as a fraction");return new r(e)},string:function(e){return new r(e)},"number, number":function(e,t){return new r(e,t)},null:function(e){return new r(0)},BigNumber:function(e){return new r(e.toString())},Fraction:function(e){return e},Unit:t.referToSelf(function(r){return function(e){var t=e.clone();return t.value=r(e.value),t}}),Object:function(e){return new r(e)},"Array | Matrix":t.referToSelf(function(t){return function(e){return ce(e,t)}})})}),xi=N("matrix",["typed","Matrix","DenseMatrix","SparseMatrix"],function(e){var t=e.typed,n=(e.Matrix,e.DenseMatrix),i=e.SparseMatrix;return t("matrix",{"":function(){return r([])},string:function(e){return r([],e)},"string, string":function(e,t){return r([],e,t)},Array:function(e){return r(e)},Matrix:function(e){return r(e,e.storage())},"Array | Matrix, string":r,"Array | Matrix, string, string":r});function r(e,t,r){if("dense"===t||"default"===t||void 0===t)return new n(e,r);if("sparse"===t)return new i(e,r);throw new TypeError("Unknown matrix type "+JSON.stringify(t)+".")}}),bi="matrixFromFunction",wi=N(bi,["typed","matrix","isZero"],function(e){var t=e.typed,a=e.matrix,o=e.isZero;return t(bi,{"Array | Matrix, function, string, string":i,"Array | Matrix, function, string":function(e,t,r){return i(e,t,r)},"Matrix, function":function(e,t){return i(e,t,"dense")},"Array, function":function(e,t){return i(e,t,"dense").toArray()},"Array | Matrix, string, function":function(e,t,r){return i(e,r,t)},"Array | Matrix, string, string, function":function(e,t,r,n){return i(e,n,t,r)}});function i(e,n,t,r){var i;return(i=void 0!==r?a(t,r):a(t)).resize(e),i.forEach(function(e,t){var r=n(t);o(r)||i.set(t,r)}),i}});function Ni(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var Di="matrixFromRows",Ei=N(Di,["typed","matrix","flatten","size"],function(e){var t=e.typed,r=e.matrix,u=e.flatten,n=e.size;return t(Di,{"...Array":i,"...Matrix":function(e){return r(i(e.map(function(e){return e.toArray()})))}});function i(e){if(0===e.length)throw new TypeError("At least one row is needed to construct a matrix.");var t,r=s(e[0]),n=[],i=function(e){var t,r,n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e){if(e){if("string"==typeof e)return Ni(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(t="Object"===t&&e.constructor?e.constructor.name:t)||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Ni(e,void 0):void 0}}(e)))return n&&(e=n),t=0,{s:r=function(){},n:function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}},e:function(e){throw e},f:r};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,o=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){o=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(o)throw i}}}}(e);try{for(i.s();!(t=i.n()).done;){var a=t.value,o=s(a);if(o!==r)throw new TypeError("The vectors had different length: "+(0|r)+" ≠ "+(0|o));n.push(u(a))}}catch(e){i.e(e)}finally{i.f()}return n}function s(e){e=n(e);if(1===e.length)return e[0];if(2!==e.length)throw new TypeError("Only one- or two-dimensional vectors are supported.");if(1===e[0])return e[1];if(1===e[1])return e[0];throw new TypeError("At least one of the arguments is not a vector.")}});function Ai(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var Si="matrixFromColumns",Ci=N(Si,["typed","matrix","flatten","size"],function(e){var t=e.typed,r=e.matrix,l=e.flatten,n=e.size;return t(Si,{"...Array":i,"...Matrix":function(e){return r(i(e.map(function(e){return e.toArray()})))}});function i(e){if(0===e.length)throw new TypeError("At least one column is needed to construct a matrix.");for(var t=f(e[0]),r=[],n=0;n<t;n++)r[n]=[];var i,a=function(e){var t,r,n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e){if(e){if("string"==typeof e)return Ai(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(t="Object"===t&&e.constructor?e.constructor.name:t)||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Ai(e,void 0):void 0}}(e)))return n&&(e=n),t=0,{s:r=function(){},n:function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}},e:function(e){throw e},f:r};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,o=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){o=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(o)throw i}}}}(e);try{for(a.s();!(i=a.n()).done;){var o=i.value,u=f(o);if(u!==t)throw new TypeError("The vectors had different length: "+(0|t)+" ≠ "+(0|u));for(var s=l(o),c=0;c<t;c++)r[c].push(s[c])}}catch(e){a.e(e)}finally{a.f()}return r}function f(e){e=n(e);if(1===e.length)return e[0];if(2!==e.length)throw new TypeError("Only one- or two-dimensional vectors are supported.");if(1===e[0])return e[1];if(1===e[1])return e[0];throw new TypeError("At least one of the arguments is not a vector.")}}),Mi=N("splitUnit",["typed"],function(e){return(0,e.typed)("splitUnit",{"Unit, Array":function(e,t){return e.splitUnit(t)}})}),Zn="number",Fi="number, number";function Oi(e){return Math.abs(e)}function Ti(e,t){return e+t}function _i(e,t){return e-t}function Bi(e,t){return e*t}function ki(e){return-e}function Ii(e){return e}function zi(e){return a(e)}function Ri(e){return e*e*e}function qi(e){return Math.exp(e)}function ji(e){return s(e)}function Pi(e,t){if(!w(e)||!w(t))throw new Error("Parameters in function lcm must be integer numbers");if(0===e||0===t)return 0;for(var r,n=e*t;0!==t;)t=e%(r=t),e=r;return Math.abs(n/e)}function Li(e){return i(e)}function Ui(e){return r(e)}function $i(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:2,r=t<0;if(0===(t=r?-t:t))throw new Error("Root must be non-zero");if(e<0&&Math.abs(t)%2!=1)throw new Error("Root must be odd when a is negative.");if(0===e)return r?1/0:0;if(!isFinite(e))return r?0:e;t=Math.pow(Math.abs(e),1/t),t=e<0?-t:t;return r?1/t:t}function Hi(e){return n(e)}function Gi(e){return e*e}function Vi(e,t){var r,n,i,a=0,o=1,u=1,s=0;if(!w(e)||!w(t))throw new Error("Parameters in function xgcd must be integer numbers");for(;t;)i=e-(n=Math.floor(e/t))*t,a=o-n*(r=a),o=r,u=s-n*(r=u),s=r,e=t,t=i;return e<0?[-e,-o,-s]:[e,e?o:0,s]}function Zi(e,t){return e*e<1&&t===1/0||1<e*e&&t===-1/0?0:Math.pow(e,t)}function Wi(e,t){t=1<arguments.length&&void 0!==t?t:0;if(!w(t)||t<0||15<t)throw new Error("Number of decimals in function round must be an integer from 0 to 15 inclusive");return parseFloat(xe(e,t))}Oi.signature=Zn,Bi.signature=_i.signature=Ti.signature=Fi,ji.signature=qi.signature=Ri.signature=zi.signature=Ii.signature=ki.signature=Zn,Pi.signature=Fi,Gi.signature=Hi.signature=Ui.signature=Li.signature=Zn,Zi.signature=Vi.signature=Fi;var Yi="unaryMinus",Ji=N(Yi,["typed"],function(e){var n=e.typed;return n(Yi,{number:ki,"Complex | BigNumber | Fraction":function(e){return e.neg()},Unit:n.referToSelf(function(r){return function(e){var t=e.clone();return t.value=n.find(r,t.valueType())(e.value),t}}),"Array | Matrix":n.referToSelf(function(t){return function(e){return ce(e,t,!0)}})})}),Xi=N("unaryPlus",["typed","config","BigNumber"],function(e){var t=e.typed,r=e.config,n=e.BigNumber;return t("unaryPlus",{number:Ii,Complex:function(e){return e},BigNumber:function(e){return e},Fraction:function(e){return e},Unit:function(e){return e.clone()},"Array | Matrix":t.referToSelf(function(t){return function(e){return ce(e,t,!0)}}),"boolean | string":function(e){return"BigNumber"===r.number?new n(+e):+e}})}),Qi=N("abs",["typed"],function(e){e=e.typed;return e("abs",{number:Oi,"Complex | BigNumber | Fraction | Unit":function(e){return e.abs()},"Array | Matrix":e.referToSelf(function(t){return function(e){return ce(e,t,!0)}})})}),Ki=N("apply",["typed","isInteger"],function(e){var t=e.typed,i=e.isInteger;return t("apply",{"Array | Matrix, number | BigNumber, function":function(e,t,r){if(!i(t))throw new TypeError("Integer number expected for dimension");var n=Array.isArray(e)?_(e):e.size();if(t<0||t>=n.length)throw new mn(t,n.length);return P(e)?e.create(ea(e.valueOf(),t,r)):ea(e,t,r)}})});function ea(e,t,r){var n,i,a;if(t<=0){if(Array.isArray(e[0])){for(a=function(e){for(var t=e.length,r=e[0].length,n=[],i=0;i<r;i++){for(var a=[],o=0;o<t;o++)a.push(e[o][i]);n.push(a)}return n}(e),i=[],n=0;n<a.length;n++)i[n]=ea(a[n],t-1,r);return i}return r(e)}for(i=[],n=0;n<e.length;n++)i[n]=ea(e[n],t-1,r);return i}var ta=N("addScalar",["typed"],function(e){var n=e.typed;return n("addScalar",{"number, number":Ti,"Complex, Complex":function(e,t){return e.add(t)},"BigNumber, BigNumber":function(e,t){return e.plus(t)},"Fraction, Fraction":function(e,t){return e.add(t)},"Unit, Unit":n.referToSelf(function(r){return function(e,t){if(null===e.value||void 0===e.value)throw new Error("Parameter x contains a unit with undefined value");if(null===t.value||void 0===t.value)throw new Error("Parameter y contains a unit with undefined value");if(!e.equalBase(t))throw new Error("Units do not match");e=e.clone();return e.value=n.find(r,[e.valueType(),t.valueType()])(e.value,t.value),e.fixPrefix=!1,e}})})}),ra="subtractScalar",na=N(ra,["typed"],function(e){var n=e.typed;return n(ra,{"number, number":_i,"Complex, Complex":function(e,t){return e.sub(t)},"BigNumber, BigNumber":function(e,t){return e.minus(t)},"Fraction, Fraction":function(e,t){return e.sub(t)},"Unit, Unit":n.referToSelf(function(r){return function(e,t){if(null===e.value||void 0===e.value)throw new Error("Parameter x contains a unit with undefined value");if(null===t.value||void 0===t.value)throw new Error("Parameter y contains a unit with undefined value");if(!e.equalBase(t))throw new Error("Units do not match");e=e.clone();return e.value=n.find(r,[e.valueType(),t.valueType()])(e.value,t.value),e.fixPrefix=!1,e}})})}),ia=N("cbrt",["config","typed","isNegative","unaryMinus","matrix","Complex","BigNumber","Fraction"],function(e){var i=e.config,t=e.typed,n=e.isNegative,a=e.unaryMinus,o=e.matrix,u=e.Complex,s=e.BigNumber,c=e.Fraction;return t("cbrt",{number:zi,Complex:l,"Complex, boolean":l,BigNumber:function(e){return e.cbrt()},Unit:function(e){if(e.value&&Oe(e.value))return(r=e.clone()).value=1,(r=r.pow(1/3)).value=l(e.value),r;var t,r=n(e.value),e=(r&&(e.value=a(e.value)),t=Ae(e.value)?new s(1).div(3):Te(e.value)?new c(1,3):1/3,e.pow(t));return r&&(e.value=a(e.value)),e}});function l(e,t){var r=e.arg()/3,e=e.abs(),n=new u(zi(e),0).mul(new u(0,r).exp());return t?(t=[n,new u(zi(e),0).mul(new u(0,r+2*Math.PI/3).exp()),new u(zi(e),0).mul(new u(0,r-2*Math.PI/3).exp())],"Array"===i.matrix?t:o(t)):n}});function aa(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,a,o,u=[],s=!0,c=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=a.call(r)).done)&&(u.push(n.value),u.length!==t);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(c)throw i}}return u}}(e,t)||We(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var oa=N("matAlgo11xS0s",["typed","equalScalar"],function(e){var E=e.typed,A=e.equalScalar;return function(e,t,r,n){var i=e._values,a=e._index,o=e._ptr,u=e._size,s=e._datatype;if(!i)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var c,l=u[0],f=u[1],p=A,m=0,h=r;"string"==typeof s&&(p=E.find(A,[c=s,c]),m=E.convert(0,c),t=E.convert(t,c),h=E.find(r,[c,c]));for(var d=[],y=[],v=[],g=0;g<f;g++){v[g]=y.length;for(var x=o[g],b=o[g+1],w=x;w<b;w++){var N=a[w],D=n?h(t,i[w]):h(i[w],t);p(D,m)||(y.push(N),d.push(D))}}return v[f]=y.length,e.createSparseMatrix({values:d,index:y,ptr:v,size:[l,f],datatype:c})}}),f=N("matAlgo12xSfs",["typed","DenseMatrix"],function(e){var N=e.typed,D=e.DenseMatrix;return function(e,t,r,n){var i=e._values,a=e._index,o=e._ptr,u=e._size,e=e._datatype;if(!i)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var s,c=u[0],l=u[1],f=r;"string"==typeof e&&(t=N.convert(t,s=e),f=N.find(r,[s,s]));for(var p=[],m=[],h=[],d=0;d<l;d++){for(var y=d+1,v=o[d],g=o[d+1],x=v;x<g;x++){var b=a[x];m[b]=i[x],h[b]=y}for(var w=0;w<c;w++)0===d&&(p[w]=[]),h[w]===y?p[w][d]=n?f(t,m[w]):f(m[w],t):p[w][d]=n?f(t,0):f(0,t)}return new D({data:p,size:[c,l],datatype:s})}}),ua=N("matAlgo14xDs",["typed"],function(e){var c=e.typed;return function(e,t,r,n){var i,a=e._data,o=e._size,u=e._datatype,s=r,u=("string"==typeof u&&(t=c.convert(t,i=u),s=c.find(r,[i,i])),0<o.length?function e(t,r,n,i,a,o,u){var s=[];if(r===n.length-1)for(var c=0;c<i;c++)s[c]=u?t(o,a[c]):t(a[c],o);else for(var l=0;l<i;l++)s[l]=e(t,r+1,n,n[r+1],a[l],o,u);return s}(s,0,o,o[0],a,t,n):[]);return e.createDenseMatrix({data:u,size:Ce(o),datatype:i})}}),sa=N("ceil",["typed","config","round"],function(e){var t=e.typed,i=e.config,a=e.round;return t("ceil",{number:function(e){return De(e,a(e),i.epsilon)?a(e):Math.ceil(e)},"number, number":function(e,t){if(De(e,a(e,t),i.epsilon))return a(e,t);var e=aa("".concat(e,"e").split("e"),2),r=e[0],e=e[1],n=Math.ceil(Number("".concat(r,"e").concat(Number(e)+t))),n=aa("".concat(n,"e").split("e"),2),r=n[0],e=n[1];return Number("".concat(r,"e").concat(Number(e)-t))}})}),ca=N("ceil",["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],function(e){var t=e.typed,r=e.config,n=e.round,i=e.matrix,a=e.equalScalar,o=e.zeros,e=e.DenseMatrix,u=oa({typed:t,equalScalar:a}),s=f({typed:t,DenseMatrix:e}),c=ua({typed:t}),e=sa({typed:t,config:r,round:n});return t("ceil",{number:e.signatures.number,"number,number":e.signatures["number,number"],Complex:function(e){return e.ceil()},"Complex, number":function(e,t){return e.ceil(t)},"Complex, BigNumber":function(e,t){return e.ceil(t.toNumber())},BigNumber:function(e){return si(e,n(e),r.epsilon)?n(e):e.ceil()},"BigNumber, BigNumber":function(e,t){return si(e,n(e,t),r.epsilon)?n(e,t):e.toDecimalPlaces(t.toNumber(),Yr.ROUND_CEIL)},Fraction:function(e){return e.ceil()},"Fraction, number":function(e,t){return e.ceil(t)},"Fraction, BigNumber":function(e,t){return e.ceil(t.toNumber())},"Array | Matrix":t.referToSelf(function(t){return function(e){return ce(e,t,!0)}}),"Array, number | BigNumber":t.referToSelf(function(r){return function(e,t){return ce(e,function(e){return r(e,t)},!0)}}),"SparseMatrix, number | BigNumber":t.referToSelf(function(r){return function(e,t){return u(e,t,r,!1)}}),"DenseMatrix, number | BigNumber":t.referToSelf(function(r){return function(e,t){return c(e,t,r,!1)}}),"number | Complex | Fraction | BigNumber, Array":t.referToSelf(function(r){return function(e,t){return c(i(t),e,r,!0).valueOf()}}),"number | Complex | Fraction | BigNumber, Matrix":t.referToSelf(function(r){return function(e,t){return a(e,0)?o(t.size(),t.storage()):("dense"===t.storage()?c:s)(t,e,r,!0)}})})}),la=N("cube",["typed"],function(e){return(0,e.typed)("cube",{number:Ri,Complex:function(e){return e.mul(e).mul(e)},BigNumber:function(e){return e.times(e).times(e)},Fraction:function(e){return e.pow(3)},Unit:function(e){return e.pow(3)}})}),fa=N("exp",["typed"],function(e){return(0,e.typed)("exp",{number:qi,Complex:function(e){return e.exp()},BigNumber:function(e){return e.exp()}})}),pa=N("expm1",["typed","Complex"],function(e){var t=e.typed,r=e.Complex;return t("expm1",{number:ji,Complex:function(e){var t=Math.exp(e.re);return new r(t*Math.cos(e.im)-1,t*Math.sin(e.im))},BigNumber:function(e){return e.exp().minus(1)}})}),ma=N("fix",["typed","ceil","floor"],function(e){var t=e.typed,r=e.ceil,n=e.floor;return t("fix",{number:function(e){return(0<e?n:r)(e)},"number, number":function(e,t){return(0<e?n:r)(e,t)}})}),ha=N("fix",["typed","Complex","matrix","ceil","floor","equalScalar","zeros","DenseMatrix"],function(e){var t=e.typed,r=e.Complex,n=e.matrix,i=e.ceil,a=e.floor,o=e.equalScalar,u=e.zeros,e=e.DenseMatrix,s=f({typed:t,DenseMatrix:e}),c=ua({typed:t}),e=ma({typed:t,ceil:i,floor:a});return t("fix",{number:e.signatures.number,"number, number | BigNumber":e.signatures["number,number"],Complex:function(e){return new r(0<e.re?Math.floor(e.re):Math.ceil(e.re),0<e.im?Math.floor(e.im):Math.ceil(e.im))},"Complex, number":function(e,t){return new r((0<e.re?a:i)(e.re,t),(0<e.im?a:i)(e.im,t))},"Complex, BigNumber":function(e,t){t=t.toNumber();return new r((0<e.re?a:i)(e.re,t),(0<e.im?a:i)(e.im,t))},BigNumber:function(e){return(e.isNegative()?i:a)(e)},"BigNumber, number | BigNumber":function(e,t){return(e.isNegative()?i:a)(e,t)},Fraction:function(e){return e.s<0?e.ceil():e.floor()},"Fraction, number | BigNumber":function(e,t){return(e.s<0?i:a)(e,t)},"Array | Matrix":t.referToSelf(function(t){return function(e){return ce(e,t,!0)}}),"Array | Matrix, number | BigNumber":t.referToSelf(function(r){return function(e,t){return ce(e,function(e){return r(e,t)},!0)}}),"number | Complex | Fraction | BigNumber, Array":t.referToSelf(function(r){return function(e,t){return c(n(t),e,r,!0).valueOf()}}),"number | Complex | Fraction | BigNumber, Matrix":t.referToSelf(function(r){return function(e,t){return o(e,0)?u(t.size(),t.storage()):("dense"===t.storage()?c:s)(t,e,r,!0)}})})}),da=N("floor",["typed","config","round"],function(e){var t=e.typed,i=e.config,a=e.round;return t("floor",{number:function(e){return De(e,a(e),i.epsilon)?a(e):Math.floor(e)},"number, number":function(e,t){if(De(e,a(e,t),i.epsilon))return a(e,t);var e=aa("".concat(e,"e").split("e"),2),r=e[0],e=e[1],n=Math.floor(Number("".concat(r,"e").concat(Number(e)+t))),n=aa("".concat(n,"e").split("e"),2),r=n[0],e=n[1];return Number("".concat(r,"e").concat(Number(e)-t))}})}),ya=N("floor",["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],function(e){var t=e.typed,r=e.config,n=e.round,i=e.matrix,a=e.equalScalar,o=e.zeros,e=e.DenseMatrix,u=oa({typed:t,equalScalar:a}),s=f({typed:t,DenseMatrix:e}),c=ua({typed:t}),e=da({typed:t,config:r,round:n});return t("floor",{number:e.signatures.number,"number,number":e.signatures["number,number"],Complex:function(e){return e.floor()},"Complex, number":function(e,t){return e.floor(t)},"Complex, BigNumber":function(e,t){return e.floor(t.toNumber())},BigNumber:function(e){return si(e,n(e),r.epsilon)?n(e):e.floor()},"BigNumber, BigNumber":function(e,t){return si(e,n(e,t),r.epsilon)?n(e,t):e.toDecimalPlaces(t.toNumber(),Yr.ROUND_FLOOR)},Fraction:function(e){return e.floor()},"Fraction, number":function(e,t){return e.floor(t)},"Fraction, BigNumber":function(e,t){return e.floor(t.toNumber())},"Array | Matrix":t.referToSelf(function(t){return function(e){return ce(e,t,!0)}}),"Array, number | BigNumber":t.referToSelf(function(r){return function(e,t){return ce(e,function(e){return r(e,t)},!0)}}),"SparseMatrix, number | BigNumber":t.referToSelf(function(r){return function(e,t){return u(e,t,r,!1)}}),"DenseMatrix, number | BigNumber":t.referToSelf(function(r){return function(e,t){return c(e,t,r,!1)}}),"number | Complex | Fraction | BigNumber, Array":t.referToSelf(function(r){return function(e,t){return c(i(t),e,r,!0).valueOf()}}),"number | Complex | Fraction | BigNumber, Matrix":t.referToSelf(function(r){return function(e,t){return a(e,0)?o(t.size(),t.storage()):("dense"===t.storage()?c:s)(t,e,r,!0)}})})});function A(e,t,r){return(t=Ye(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var va=N("matAlgo02xDS0",["typed","equalScalar"],function(e){var S=e.typed,C=e.equalScalar;return function(e,t,r,n){var i=e._data,a=e._size,o=e._datatype||e.getDataType(),u=t._values,s=t._index,c=t._ptr,l=t._size,f=t._datatype||void 0===t._data?t._datatype:t.getDataType();if(a.length!==l.length)throw new k(a.length,l.length);if(a[0]!==l[0]||a[1]!==l[1])throw new RangeError("Dimension mismatch. Matrix A ("+a+") must match Matrix B ("+l+")");if(!u)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var p,l=a[0],m=a[1],h=C,d=0,y=r;"string"==typeof o&&o===f&&"mixed"!==o&&(h=S.find(C,[p=o,p]),d=S.convert(0,p),y=S.find(r,[p,p]));for(var v=[],g=[],x=[],b=0;b<m;b++){x[b]=g.length;for(var w=c[b],N=c[b+1],D=w;D<N;D++){var E=s[D],A=n?y(u[D],i[E][b]):y(i[E][b],u[D]);h(A,d)||(g.push(E),v.push(A))}}return x[m]=g.length,t.createSparseMatrix({values:v,index:g,ptr:x,size:[l,m],datatype:o===e._datatype&&f===t._datatype?p:void 0})}}),ga=N("matAlgo03xDSf",["typed"],function(e){var M=e.typed;return function(e,t,r,n){var i=e._data,a=e._size,o=e._datatype||e.getDataType(),u=t._values,s=t._index,c=t._ptr,l=t._size,f=t._datatype||void 0===t._data?t._datatype:t.getDataType();if(a.length!==l.length)throw new k(a.length,l.length);if(a[0]!==l[0]||a[1]!==l[1])throw new RangeError("Dimension mismatch. Matrix A ("+a+") must match Matrix B ("+l+")");if(!u)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var p,m=a[0],h=a[1],d=0,y=r;"string"==typeof o&&o===f&&"mixed"!==o&&(d=M.convert(0,p=o),y=M.find(r,[p,p]));for(var v=[],g=0;g<m;g++)v[g]=[];for(var x=[],b=[],w=0;w<h;w++){for(var N=w+1,D=c[w],E=c[w+1],A=D;A<E;A++){var S=s[A];x[S]=n?y(u[A],i[S][w]):y(i[S][w],u[A]),b[S]=N}for(var C=0;C<m;C++)b[C]===N?v[C][w]=x[C]:v[C][w]=n?y(d,i[C][w]):y(i[C][w],d)}return e.createDenseMatrix({data:v,size:[m,h],datatype:o===e._datatype&&f===t._datatype?p:void 0})}}),xa=N("matAlgo05xSfSf",["typed","equalScalar"],function(e){var _=e.typed,B=e.equalScalar;return function(e,t,r){var n=e._values,i=e._index,a=e._ptr,o=e._size,u=e._datatype||void 0===e._data?e._datatype:e.getDataType(),s=t._values,c=t._index,l=t._ptr,f=t._size,p=t._datatype||void 0===t._data?t._datatype:t.getDataType();if(o.length!==f.length)throw new k(o.length,f.length);if(o[0]!==f[0]||o[1]!==f[1])throw new RangeError("Dimension mismatch. Matrix A ("+o+") must match Matrix B ("+f+")");var m,f=o[0],h=o[1],d=B,y=0,v=r;"string"==typeof u&&u===p&&"mixed"!==u&&(d=_.find(B,[m=u,m]),y=_.convert(0,m),v=_.find(r,[m,m]));for(var g,x=n&&s?[]:void 0,b=[],w=[],N=x?[]:void 0,D=x?[]:void 0,E=[],A=[],S=0;S<h;S++){w[S]=b.length;for(var C=S+1,M=a[S],F=a[S+1];M<F;M++)g=i[M],b.push(g),E[g]=C,N&&(N[g]=n[M]);for(M=l[S],F=l[S+1];M<F;M++)E[g=c[M]]!==C&&b.push(g),A[g]=C,D&&(D[g]=s[M]);if(x)for(M=w[S];M<b.length;){var O=E[g=b[M]],T=A[g];O!==C&&T!==C||(d(O=v(O===C?N[g]:y,T===C?D[g]:y),y)?b.splice(M,1):(x.push(O),M++))}}return w[h]=b.length,e.createSparseMatrix({values:x,index:b,ptr:w,size:[f,h],datatype:u===e._datatype&&p===t._datatype?m:void 0})}}),ba=N("matAlgo13xDD",["typed"],function(e){var p=e.typed;return function(e,t,r){var n,i=e._data,a=e._size,o=e._datatype,u=t._data,s=t._size,t=t._datatype,c=[];if(a.length!==s.length)throw new k(a.length,s.length);for(var l=0;l<a.length;l++){if(a[l]!==s[l])throw new RangeError("Dimension mismatch. Matrix A ("+a+") must match Matrix B ("+s+")");c[l]=a[l]}var f=r,t=("string"==typeof o&&o===t&&(f=p.find(r,[n=o,n])),0<c.length?function e(t,r,n,i,a,o){var u=[];if(r===n.length-1)for(var s=0;s<i;s++)u[s]=t(a[s],o[s]);else for(var c=0;c<i;c++)u[c]=e(t,r+1,n,n[r+1],a[c],o[c]);return u}(f,0,c,c[0],i,u):[]);return e.createDenseMatrix({data:t,size:c,datatype:n})}}),wa=N("broadcast",["concat"],function(e){var n=e.concat;return function(e,r){var t=Math.max(e._size.length,r._size.length);if(e._size.length===r._size.length&&e._size.every(function(e,t){return e===r._size[t]}))return[e,r];for(var n=l(e._size,t,0),i=l(r._size,t,0),a=[],o=0;o<t;o++)a[o]=Math.max(n[o],i[o]);_n(n,a),_n(i,a);var u=e.clone(),s=r.clone();u._size.length<t?u.reshape(l(u._size,t,1)):s._size.length<t&&s.reshape(l(s._size,t,1));for(var c=0;c<t;c++)u._size[c]<a[c]&&(u=f(u,a[c],c)),s._size[c]<a[c]&&(s=f(s,a[c],c));return[u,s]};function l(e,t,r){return[].concat(Me(Array(t-e.length).fill(r)),Me(e))}function f(e,t,r){return n.apply(void 0,Me(Array(t).fill(e)).concat([r]))}}),p=N("matrixAlgorithmSuite",["typed","matrix","concat"],function(e){var o=e.typed,u=e.matrix,e=e.concat,s=ba({typed:o}),c=ua({typed:o}),l=wa({concat:e});return function(n){var e,r=n.elop,i=n.SD||n.DS,t=(r?(e={"DenseMatrix, DenseMatrix":function(e,t){return s.apply(void 0,Me(l(e,t)).concat([r]))},"Array, Array":function(e,t){return s.apply(void 0,Me(l(u(e),u(t))).concat([r])).valueOf()},"Array, DenseMatrix":function(e,t){return s.apply(void 0,Me(l(u(e),t)).concat([r]))},"DenseMatrix, Array":function(e,t){return s.apply(void 0,Me(l(e,u(t))).concat([r]))}},n.SS&&(e["SparseMatrix, SparseMatrix"]=function(e,t){return n.SS.apply(n,Me(l(e,t)).concat([r,!1]))}),n.DS&&(e["DenseMatrix, SparseMatrix"]=function(e,t){return n.DS.apply(n,Me(l(e,t)).concat([r,!1]))},e["Array, SparseMatrix"]=function(e,t){return n.DS.apply(n,Me(l(u(e),t)).concat([r,!1]))}),i&&(e["SparseMatrix, DenseMatrix"]=function(e,t){return i.apply(void 0,Me(l(t,e)).concat([r,!0]))},e["SparseMatrix, Array"]=function(e,t){return i.apply(void 0,Me(l(u(t),e)).concat([r,!0]))})):(e={"DenseMatrix, DenseMatrix":o.referToSelf(function(r){return function(e,t){return s.apply(void 0,Me(l(e,t)).concat([r]))}}),"Array, Array":o.referToSelf(function(r){return function(e,t){return s.apply(void 0,Me(l(u(e),u(t))).concat([r])).valueOf()}}),"Array, DenseMatrix":o.referToSelf(function(r){return function(e,t){return s.apply(void 0,Me(l(u(e),t)).concat([r]))}}),"DenseMatrix, Array":o.referToSelf(function(r){return function(e,t){return s.apply(void 0,Me(l(e,u(t))).concat([r]))}})},n.SS&&(e["SparseMatrix, SparseMatrix"]=o.referToSelf(function(r){return function(e,t){return n.SS.apply(n,Me(l(e,t)).concat([r,!1]))}})),n.DS&&(e["DenseMatrix, SparseMatrix"]=o.referToSelf(function(r){return function(e,t){return n.DS.apply(n,Me(l(e,t)).concat([r,!1]))}}),e["Array, SparseMatrix"]=o.referToSelf(function(r){return function(e,t){return n.DS.apply(n,Me(l(u(e),t)).concat([r,!1]))}})),i&&(e["SparseMatrix, DenseMatrix"]=o.referToSelf(function(r){return function(e,t){return i.apply(void 0,Me(l(t,e)).concat([r,!0]))}}),e["SparseMatrix, Array"]=o.referToSelf(function(r){return function(e,t){return i.apply(void 0,Me(l(u(t),e)).concat([r,!0]))}}))),n.scalar||"any"),a=((n.Ds||n.Ss)&&(r?(e["DenseMatrix,"+t]=function(e,t){return c(e,t,r,!1)},e[t+", DenseMatrix"]=function(e,t){return c(t,e,r,!0)},e["Array,"+t]=function(e,t){return c(u(e),t,r,!1).valueOf()},e[t+", Array"]=function(e,t){return c(u(t),e,r,!0).valueOf()}):(e["DenseMatrix,"+t]=o.referToSelf(function(r){return function(e,t){return c(e,t,r,!1)}}),e[t+", DenseMatrix"]=o.referToSelf(function(r){return function(e,t){return c(t,e,r,!0)}}),e["Array,"+t]=o.referToSelf(function(r){return function(e,t){return c(u(e),t,r,!1).valueOf()}}),e[t+", Array"]=o.referToSelf(function(r){return function(e,t){return c(u(t),e,r,!0).valueOf()}}))),void 0!==n.sS?n.sS:n.Ss);return r?(n.Ss&&(e["SparseMatrix,"+t]=function(e,t){return n.Ss(e,t,r,!1)}),a&&(e[t+", SparseMatrix"]=function(e,t){return a(t,e,r,!0)})):(n.Ss&&(e["SparseMatrix,"+t]=o.referToSelf(function(r){return function(e,t){return n.Ss(e,t,r,!1)}})),a&&(e[t+", SparseMatrix"]=o.referToSelf(function(r){return function(e,t){return a(t,e,r,!0)}}))),r&&r.signatures&&Le(e,r.signatures),e}}),Na=N("mod",["typed","config","round","matrix","equalScalar","zeros","DenseMatrix","concat"],function(e){var t=e.typed,r=e.config,n=e.round,i=e.matrix,a=e.equalScalar,o=e.zeros,u=e.DenseMatrix,e=e.concat,s=ya({typed:t,config:r,round:n,matrix:i,equalScalar:a,zeros:o,DenseMatrix:u}),r=va({typed:t,equalScalar:a}),n=ga({typed:t}),o=xa({typed:t,equalScalar:a}),a=oa({typed:t,equalScalar:a}),u=f({typed:t,DenseMatrix:u});return t("mod",{"number, number":function(e,t){return 0===t?e:e-t*s(e/t)},"BigNumber, BigNumber":function(e,t){return t.isZero()?e:e.sub(t.mul(s(e.div(t))))},"Fraction, Fraction":function(e,t){return t.equals(0)?e:e.sub(t.mul(s(e.div(t))))}},p({typed:t,matrix:i,concat:e})({SS:o,DS:n,SD:r,Ss:a,sS:u}))}),Da=N("matAlgo01xDSid",["typed"],function(e){var E=e.typed;return function(e,t,r,n){var i=e._data,a=e._size,o=e._datatype||e.getDataType(),u=t._values,s=t._index,c=t._ptr,l=t._size,f=t._datatype||void 0===t._data?t._datatype:t.getDataType();if(a.length!==l.length)throw new k(a.length,l.length);if(a[0]!==l[0]||a[1]!==l[1])throw new RangeError("Dimension mismatch. Matrix A ("+a+") must match Matrix B ("+l+")");if(!u)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");for(var p=a[0],m=a[1],l="string"==typeof o&&"mixed"!==o&&o===f?o:void 0,h=l?E.find(r,[l,l]):r,d=[],y=0;y<p;y++)d[y]=[];for(var v=[],g=[],x=0;x<m;x++){for(var b=x+1,w=c[x],N=c[x+1],D=w;D<N;D++)v[y=s[D]]=n?h(u[D],i[y][x]):h(i[y][x],u[D]),g[y]=b;for(y=0;y<p;y++)g[y]===b?d[y][x]=v[y]:d[y][x]=i[y][x]}return e.createDenseMatrix({data:d,size:[p,m],datatype:o===e._datatype&&f===t._datatype?l:void 0})}}),Ea=N("matAlgo04xSidSid",["typed","equalScalar"],function(e){var _=e.typed,B=e.equalScalar;return function(e,t,r){var n=e._values,i=e._index,a=e._ptr,o=e._size,u=e._datatype||void 0===e._data?e._datatype:e.getDataType(),s=t._values,c=t._index,l=t._ptr,f=t._size,p=t._datatype||void 0===t._data?t._datatype:t.getDataType();if(o.length!==f.length)throw new k(o.length,f.length);if(o[0]!==f[0]||o[1]!==f[1])throw new RangeError("Dimension mismatch. Matrix A ("+o+") must match Matrix B ("+f+")");var m,f=o[0],h=o[1],d=B,y=0,v=r;"string"==typeof u&&u===p&&"mixed"!==u&&(d=_.find(B,[m=u,m]),y=_.convert(0,m),v=_.find(r,[m,m]));for(var g,x=n&&s?[]:void 0,b=[],w=[],N=n&&s?[]:void 0,D=n&&s?[]:void 0,E=[],A=[],S=0;S<h;S++){w[S]=b.length;for(var C,M=S+1,F=a[S],O=a[S+1],T=F;T<O;T++)g=i[T],b.push(g),E[g]=M,N&&(N[g]=n[T]);for(F=l[S],O=l[S+1],T=F;T<O;T++)E[g=c[T]]===M?N&&(d(C=v(N[g],s[T]),y)?E[g]=null:N[g]=C):(b.push(g),A[g]=M,D&&(D[g]=s[T]));if(N&&D)for(T=w[S];T<b.length;)E[g=b[T]]===M?(x[T]=N[g],T++):A[g]===M?(x[T]=D[g],T++):b.splice(T,1)}return w[h]=b.length,e.createSparseMatrix({values:x,index:b,ptr:w,size:[f,h],datatype:u===e._datatype&&p===t._datatype?m:void 0})}}),Aa=N("matAlgo10xSids",["typed","DenseMatrix"],function(e){var N=e.typed,D=e.DenseMatrix;return function(e,t,r,n){var i=e._values,a=e._index,o=e._ptr,u=e._size,e=e._datatype;if(!i)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var s,c=u[0],l=u[1],f=r;"string"==typeof e&&(t=N.convert(t,s=e),f=N.find(r,[s,s]));for(var p=[],m=[],h=[],d=0;d<l;d++){for(var y=d+1,v=o[d],g=o[d+1],x=v;x<g;x++){var b=a[x];m[b]=i[x],h[b]=y}for(var w=0;w<c;w++)0===d&&(p[w]=[]),h[w]===y?p[w][d]=n?f(t,m[w]):f(m[w],t):p[w][d]=t}return new D({data:p,size:[c,l],datatype:s})}});function Sa(e,t,r,n){if(!(this instanceof Sa))throw new SyntaxError("Constructor must be called with the new operator");this.fn=e,this.count=t,this.min=r,this.max=n,this.message="Wrong number of arguments in function "+e+" ("+t+" provided, "+r+(null!=n?"-"+n:"")+" expected)",this.stack=(new Error).stack}(Sa.prototype=new Error).constructor=Error,Sa.prototype.name="ArgumentsError",Sa.prototype.isArgumentsError=!0;var Zn="number | BigNumber | Fraction | Matrix | Array",Ca="".concat(Zn,", ").concat(Zn,", ...").concat(Zn);function Ma(e){return!e.some(function(e){return Array.isArray(e)})}var Fa=N("gcd",["typed","config","round","matrix","equalScalar","zeros","BigNumber","DenseMatrix","concat"],function(e){var t=e.typed,r=e.matrix,n=e.config,i=e.round,a=e.equalScalar,o=e.zeros,u=e.BigNumber,s=e.DenseMatrix,e=e.concat,c=Na({typed:t,config:n,round:i,matrix:r,equalScalar:a,zeros:o,DenseMatrix:s,concat:e}),n=Da({typed:t}),i=Ea({typed:t,equalScalar:a}),o=Aa({typed:t,DenseMatrix:s});return t("gcd",{"number, number":function(e,t){if(!w(e)||!w(t))throw new Error("Parameters in function gcd must be integer numbers");for(var r;0!==t;)r=c(e,t),e=t,t=r;return e<0?-e:e},"BigNumber, BigNumber":function(e,t){if(!e.isInt()||!t.isInt())throw new Error("Parameters in function gcd must be integer numbers");for(var r=new u(0);!t.isZero();){var n=c(e,t);e=t,t=n}return e.lt(r)?e.neg():e},"Fraction, Fraction":function(e,t){return e.gcd(t)}},p({typed:t,matrix:r,concat:e})({SS:i,DS:n,Ss:o}),A(A(A({},Ca,t.referToSelf(function(a){return function(e,t,r){for(var n=a(e,t),i=0;i<r.length;i++)n=a(n,r[i]);return n}})),"Array",t.referToSelf(function(t){return function(e){if(1===e.length&&Array.isArray(e[0])&&Ma(e[0]))return t.apply(void 0,Me(e[0]));if(Ma(e))return t.apply(void 0,Me(e));throw new Sa("gcd() supports only 1d matrices!")}})),"Matrix",t.referToSelf(function(t){return function(e){return t(e.toArray())}})))}),Oa=N("matAlgo06xS0S0",["typed","equalScalar"],function(e){var A=e.typed,S=e.equalScalar;return function(e,t,r){var n=e._values,i=e._size,a=e._datatype||void 0===e._data?e._datatype:e.getDataType(),o=t._values,u=t._size,s=t._datatype||void 0===t._data?t._datatype:t.getDataType();if(i.length!==u.length)throw new k(i.length,u.length);if(i[0]!==u[0]||i[1]!==u[1])throw new RangeError("Dimension mismatch. Matrix A ("+i+") must match Matrix B ("+u+")");var c,u=i[0],l=i[1],f=S,p=0,m=r;"string"==typeof a&&a===s&&"mixed"!==a&&(f=A.find(S,[c=a,c]),p=A.convert(0,c),m=A.find(r,[c,c]));for(var h=n&&o?[]:void 0,d=[],y=[],v=h?[]:void 0,g=[],x=[],b=0;b<l;b++){y[b]=d.length;var w=b+1;if(Gn(e,b,g,v,x,w,d,m),Gn(t,b,g,v,x,w,d,m),v)for(var N=y[b];N<d.length;){var D=d[N];x[D]!==w||f(D=v[D],p)?d.splice(N,1):(h.push(D),N++)}else for(var E=y[b];E<d.length;)x[d[E]]!==w?d.splice(E,1):E++}return y[l]=d.length,e.createSparseMatrix({values:h,index:d,ptr:y,size:[u,l],datatype:a===e._datatype&&s===t._datatype?c:void 0})}}),Ta=N("lcm",["typed","matrix","equalScalar","concat"],function(e){var t=e.typed,r=e.matrix,n=e.equalScalar,e=e.concat,i=va({typed:t,equalScalar:n}),a=Oa({typed:t,equalScalar:n}),n=oa({typed:t,equalScalar:n}),r=p({typed:t,matrix:r,concat:e}),e="number | BigNumber | Fraction | Matrix | Array",o={};return o["".concat(e,", ").concat(e,", ...").concat(e)]=t.referToSelf(function(a){return function(e,t,r){for(var n=a(e,t),i=0;i<r.length;i++)n=a(n,r[i]);return n}}),t("lcm",{"number, number":Pi,"BigNumber, BigNumber":function(e,t){if(!e.isInt()||!t.isInt())throw new Error("Parameters in function lcm must be integer numbers");if(e.isZero())return e;if(t.isZero())return t;for(var r=e.times(t);!t.isZero();){var n=t;t=e.mod(n),e=n}return r.div(e).abs()},"Fraction, Fraction":function(e,t){return e.lcm(t)}},r({SS:a,DS:i,Ss:n}),o)}),_a=N("log10",["typed","config","Complex"],function(e){var t=e.typed,r=e.config,n=e.Complex;return t("log10",{number:function(e){return 0<=e||r.predictable?Li(e):new n(e,0).log().div(Math.LN10)},Complex:function(e){return new n(e).log().div(Math.LN10)},BigNumber:function(e){return!e.isNegative()||r.predictable?e.log():new n(e.toNumber(),0).log().div(Math.LN10)},"Array | Matrix":t.referToSelf(function(t){return function(e){return ce(e,t)}})})}),Ba=N("log2",["typed","config","Complex"],function(e){var t=e.typed,r=e.config,n=e.Complex;return t("log2",{number:function(e){return 0<=e||r.predictable?Ui(e):i(new n(e,0))},Complex:i,BigNumber:function(e){return!e.isNegative()||r.predictable?e.log(2):i(new n(e.toNumber(),0))},"Array | Matrix":t.referToSelf(function(t){return function(e){return ce(e,t)}})});function i(e){var t=Math.sqrt(e.re*e.re+e.im*e.im);return new n(Math.log2?Math.log2(t):Math.log(t)/Math.LN2,Math.atan2(e.im,e.re)/Math.LN2)}}),ka=N("multiplyScalar",["typed"],function(e){return(0,e.typed)("multiplyScalar",{"number, number":Bi,"Complex, Complex":function(e,t){return e.mul(t)},"BigNumber, BigNumber":function(e,t){return e.times(t)},"Fraction, Fraction":function(e,t){return e.mul(t)},"number | Fraction | BigNumber | Complex, Unit":function(e,t){return t.multiply(e)},"Unit, number | Fraction | BigNumber | Complex | Unit":function(e,t){return e.multiply(t)}})}),Ia=N("multiply",["typed","matrix","addScalar","multiplyScalar","equalScalar","dot"],function(e){var k=e.typed,n=e.matrix,I=e.addScalar,z=e.multiplyScalar,B=e.equalScalar,i=e.dot,r=oa({typed:k,equalScalar:B}),a=ua({typed:k});function o(e,t){switch(e.length){case 1:switch(t.length){case 1:if(e[0]!==t[0])throw new RangeError("Dimension mismatch in multiplication. Vectors must have the same length");break;case 2:if(e[0]!==t[0])throw new RangeError("Dimension mismatch in multiplication. Vector length ("+e[0]+") must match Matrix rows ("+t[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+t.length+" dimensions)")}break;case 2:switch(t.length){case 1:if(e[1]!==t[0])throw new RangeError("Dimension mismatch in multiplication. Matrix columns ("+e[1]+") must match Vector length ("+t[0]+")");break;case 2:if(e[1]!==t[0])throw new RangeError("Dimension mismatch in multiplication. Matrix A columns ("+e[1]+") must match Matrix B rows ("+t[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+t.length+" dimensions)")}break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix A has "+e.length+" dimensions)")}}var u=k("_multiplyMatrixVector",{"DenseMatrix, any":function(e,t){var r,n=e._data,i=e._size,a=e._datatype||e.getDataType(),o=t._data,u=t._datatype||t.getDataType(),s=i[0],c=i[1],l=I,f=z;a&&u&&a===u&&"string"==typeof a&&"mixed"!==a&&(l=k.find(I,[r=a,r]),f=k.find(z,[r,r]));for(var p=[],m=0;m<s;m++){for(var h=n[m],d=f(h[0],o[0]),y=1;y<c;y++)d=l(d,f(h[y],o[y]));p[m]=d}return e.createDenseMatrix({data:p,size:[s],datatype:a===e._datatype&&u===t._datatype?r:void 0})},"SparseMatrix, any":function(e,t){var r=e._values,n=e._index,i=e._ptr,a=e._datatype||void 0===e._data?e._datatype:e.getDataType();if(!r)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");for(var o,u=t._data,s=t._datatype||t.getDataType(),c=e._size[0],l=t._size[0],f=[],p=[],m=[],h=I,d=z,y=B,v=0,g=(a&&s&&a===s&&"string"==typeof a&&"mixed"!==a&&(h=k.find(I,[o=a,o]),d=k.find(z,[o,o]),y=k.find(B,[o,o]),v=k.convert(0,o)),[]),x=[],b=m[0]=0;b<l;b++){var w=u[b];if(!y(w,v))for(var N=i[b],D=i[b+1],E=N;E<D;E++){var A=n[E];x[A]?g[A]=h(g[A],d(w,r[E])):(x[A]=!0,p.push(A),g[A]=d(w,r[E]))}}for(var S=p.length,C=0;C<S;C++){var M=p[C];f[C]=g[M]}return m[1]=p.length,e.createSparseMatrix({values:f,index:p,ptr:m,size:[c,1],datatype:a===e._datatype&&s===t._datatype?o:void 0})}}),s=k("_multiplyMatrixMatrix",{"DenseMatrix, DenseMatrix":function(e,t){var r,n=e._data,i=e._size,a=e._datatype||e.getDataType(),o=t._data,u=t._size,s=t._datatype||t.getDataType(),c=i[0],l=i[1],f=u[1],p=I,m=z;a&&s&&a===s&&"string"==typeof a&&"mixed"!==a&&"mixed"!==a&&(p=k.find(I,[r=a,r]),m=k.find(z,[r,r]));for(var h=[],d=0;d<c;d++){var y=n[d];h[d]=[];for(var v=0;v<f;v++){for(var g=m(y[0],o[0][v]),x=1;x<l;x++)g=p(g,m(y[x],o[x][v]));h[d][v]=g}}return e.createDenseMatrix({data:h,size:[c,f],datatype:a===e._datatype&&s===t._datatype?r:void 0})},"DenseMatrix, SparseMatrix":function(e,t){var r=e._data,n=e._size,i=e._datatype||e.getDataType(),a=t._values,o=t._index,u=t._ptr,s=t._size,c=t._datatype||void 0===t._data?t._datatype:t.getDataType();if(!a)throw new Error("Cannot multiply Dense Matrix times Pattern only Matrix");var l,f=n[0],p=s[1],m=I,h=z,d=B,y=0;i&&c&&i===c&&"string"==typeof i&&"mixed"!==i&&(m=k.find(I,[l=i,l]),h=k.find(z,[l,l]),d=k.find(B,[l,l]),y=k.convert(0,l));for(var v=[],g=[],x=[],n=t.createSparseMatrix({values:v,index:g,ptr:x,size:[f,p],datatype:i===e._datatype&&c===t._datatype?l:void 0}),b=0;b<p;b++){x[b]=g.length;var w=u[b],N=u[b+1];if(w<N)for(var D=0,E=0;E<f;E++){for(var A=E+1,S=void 0,C=w;C<N;C++){var M=o[C];D!==A?(S=h(r[E][M],a[C]),D=A):S=m(S,h(r[E][M],a[C]))}D!==A||d(S,y)||(g.push(E),v.push(S))}}return x[p]=g.length,n},"SparseMatrix, DenseMatrix":function(e,t){var r=e._values,n=e._index,i=e._ptr,a=e._datatype||void 0===e._data?e._datatype:e.getDataType();if(!r)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var o,u=t._data,s=t._datatype||t.getDataType(),c=e._size[0],l=t._size[0],f=t._size[1],p=I,m=z,h=B,d=0;a&&s&&a===s&&"string"==typeof a&&"mixed"!==a&&(p=k.find(I,[o=a,o]),m=k.find(z,[o,o]),h=k.find(B,[o,o]),d=k.convert(0,o));for(var y=[],v=[],g=[],c=e.createSparseMatrix({values:y,index:v,ptr:g,size:[c,f],datatype:a===e._datatype&&s===t._datatype?o:void 0}),x=[],b=[],w=0;w<f;w++){g[w]=v.length;for(var N=w+1,D=0;D<l;D++){var E=u[D][w];if(!h(E,d))for(var A=i[D],S=i[D+1],C=A;C<S;C++){var M=n[C];b[M]!==N?(b[M]=N,v.push(M),x[M]=m(E,r[C])):x[M]=p(x[M],m(E,r[C]))}}for(var F=g[w],O=v.length,T=F;T<O;T++){var _=v[T];y[T]=x[_]}}return g[f]=v.length,c},"SparseMatrix, SparseMatrix":function(e,t){var r,n=e._values,i=e._index,a=e._ptr,o=e._datatype||void 0===e._data?e._datatype:e.getDataType(),u=t._values,s=t._index,c=t._ptr,l=t._datatype||void 0===t._data?t._datatype:t.getDataType(),f=e._size[0],p=t._size[1],m=n&&u,h=I,d=z;o&&l&&o===l&&"string"==typeof o&&"mixed"!==o&&(h=k.find(I,[r=o,r]),d=k.find(z,[r,r]));for(var y,v,g,x,b,w=m?[]:void 0,N=[],D=[],f=e.createSparseMatrix({values:w,index:N,ptr:D,size:[f,p],datatype:o===e._datatype&&l===t._datatype?r:void 0}),E=m?[]:void 0,A=[],S=0;S<p;S++){D[S]=N.length;for(var C=S+1,M=c[S],F=c[S+1],O=M;O<F;O++)if(b=s[O],m)for(v=a[b],g=a[b+1],y=v;y<g;y++)A[x=i[y]]!==C?(A[x]=C,N.push(x),E[x]=d(u[O],n[y])):E[x]=h(E[x],d(u[O],n[y]));else for(v=a[b],g=a[b+1],y=v;y<g;y++)A[x=i[y]]!==C&&(A[x]=C,N.push(x));if(m)for(var M=D[S],T=N.length,_=M;_<T;_++){var B=N[_];w[_]=E[B]}}return D[p]=N.length,f}});return k("multiply",z,{"Array, Array":k.referTo("Matrix, Matrix",function(r){return function(e,t){o(_(e),_(t));e=r(n(e),n(t));return P(e)?e.valueOf():e}}),"Matrix, Matrix":function(e,t){var r=e.size(),n=t.size();return o(r,n),(1===r.length?1===n.length?function(e,t){if(0===r[0])throw new Error("Cannot multiply two empty vectors");return i(e,t)}:function(e,t){if("dense"!==t.storage())throw new Error("Support for SparseMatrix not implemented");var r,n=e._data,i=e._size,a=e._datatype||e.getDataType(),o=t._data,u=t._size,s=t._datatype||t.getDataType(),c=i[0],l=u[1],f=I,p=z;a&&s&&a===s&&"string"==typeof a&&"mixed"!==a&&(f=k.find(I,[r=a,r]),p=k.find(z,[r,r]));for(var m=[],h=0;h<l;h++){for(var d=p(n[0],o[0][h]),y=1;y<c;y++)d=f(d,p(n[y],o[y][h]));m[h]=d}return e.createDenseMatrix({data:m,size:[l],datatype:a===e._datatype&&s===t._datatype?r:void 0})}:1===n.length?u:s)(e,t)},"Matrix, Array":k.referTo("Matrix,Matrix",function(r){return function(e,t){return r(e,n(t))}}),"Array, Matrix":k.referToSelf(function(r){return function(e,t){return r(n(e,t.storage()),t)}}),"SparseMatrix, any":function(e,t){return r(e,t,z,!1)},"DenseMatrix, any":function(e,t){return a(e,t,z,!1)},"any, SparseMatrix":function(e,t){return r(t,e,z,!0)},"any, DenseMatrix":function(e,t){return a(t,e,z,!0)},"Array, any":function(e,t){return a(n(e),t,z,!1).valueOf()},"any, Array":function(e,t){return a(n(t),e,z,!0).valueOf()},"any, any":z,"any, any, ...any":k.referToSelf(function(a){return function(e,t,r){for(var n=a(e,t),i=0;i<r.length;i++)n=a(n,r[i]);return n}})})}),za=N("nthRoot",["typed","matrix","equalScalar","BigNumber","concat"],function(e){var t=e.typed,n=e.matrix,r=e.equalScalar,u=e.BigNumber,e=e.concat,i=Da({typed:t}),a=va({typed:t,equalScalar:r}),o=Oa({typed:t,equalScalar:r}),s=oa({typed:t,equalScalar:r}),r=p({typed:t,matrix:n,concat:e});function c(){throw new Error("Complex number not supported in function nthRoot. Use nthRoots instead.")}return t("nthRoot",{number:$i,"number, number":$i,BigNumber:function(e){return l(e,new u(2))},"BigNumber, BigNumber":l,Complex:c,"Complex, number":c,Array:t.referTo("DenseMatrix,number",function(t){return function(e){return t(n(e),2).valueOf()}}),DenseMatrix:t.referTo("DenseMatrix,number",function(t){return function(e){return t(e,2)}}),SparseMatrix:t.referTo("SparseMatrix,number",function(t){return function(e){return t(e,2)}}),"SparseMatrix, SparseMatrix":t.referToSelf(function(r){return function(e,t){if(1===t.density())return o(e,t,r);throw new Error("Root must be non-zero")}}),"DenseMatrix, SparseMatrix":t.referToSelf(function(r){return function(e,t){if(1===t.density())return i(e,t,r,!1);throw new Error("Root must be non-zero")}}),"Array, SparseMatrix":t.referTo("DenseMatrix,SparseMatrix",function(r){return function(e,t){return r(n(e),t)}}),"number | BigNumber, SparseMatrix":t.referToSelf(function(r){return function(e,t){if(1===t.density())return s(t,e,r,!0);throw new Error("Root must be non-zero")}})},r({scalar:"number | BigNumber",SD:a,Ss:s,sS:!1}));function l(e,t){var r=u.precision,n=u.clone({precision:r+2}),i=new u(0),a=new n(1),o=t.isNegative();if((t=o?t.neg():t).isZero())throw new Error("Root must be non-zero");if(e.isNegative()&&!t.abs().mod(2).equals(1))throw new Error("Root must be odd when a is negative.");if(e.isZero())return o?new n(1/0):0;if(!e.isFinite())return o?i:e;n=e.abs().pow(a.div(t)),n=e.isNeg()?n.neg():n;return new u((o?a.div(n):n).toPrecision(r))}}),Ra=N("sign",["typed","BigNumber","Fraction","complex"],function(e){var r=e.typed,t=e.BigNumber,n=e.complex,i=e.Fraction;return r("sign",{number:Hi,Complex:function(e){return 0===e.im?n(Hi(e.re)):e.sign()},BigNumber:function(e){return new t(e.cmp(0))},Fraction:function(e){return new i(e.s,1)},"Array | Matrix":r.referToSelf(function(t){return function(e){return ce(e,t,!0)}}),Unit:r.referToSelf(function(t){return function(e){if(e._isDerived()||0===e.units[0].unit.offset)return r.find(t,e.valueType())(e.value);throw new TypeError("sign is ambiguous for units with offset")}})})}),qa=N("sqrt",["config","typed","Complex"],function(e){var t=e.config,r=e.typed,n=e.Complex;return r("sqrt",{number:i,Complex:function(e){return e.sqrt()},BigNumber:function(e){return!e.isNegative()||t.predictable?e.sqrt():i(e.toNumber())},Unit:function(e){return e.pow(.5)}});function i(e){return isNaN(e)?NaN:0<=e||t.predictable?Math.sqrt(e):new n(e,0).sqrt()}}),ja=N("square",["typed"],function(e){return(0,e.typed)("square",{number:Gi,Complex:function(e){return e.mul(e)},BigNumber:function(e){return e.times(e)},Fraction:function(e){return e.mul(e)},Unit:function(e){return e.pow(2)}})}),Pa=N("subtract",["typed","matrix","equalScalar","subtractScalar","unaryMinus","DenseMatrix","concat"],function(e){var t=e.typed,r=e.matrix,n=e.equalScalar,i=e.subtractScalar,a=(e.unaryMinus,e.DenseMatrix),e=e.concat,o=Da({typed:t}),u=ga({typed:t}),n=xa({typed:t,equalScalar:n}),s=Aa({typed:t,DenseMatrix:a}),a=f({typed:t,DenseMatrix:a});return t("subtract",{"any, any":i},p({typed:t,matrix:r,concat:e})({elop:i,SS:n,DS:o,SD:u,Ss:a,sS:s}))}),La=N("xgcd",["typed","config","matrix","BigNumber"],function(e){var t=e.typed,f=e.config,p=e.matrix,m=e.BigNumber;return t("xgcd",{"number, number":function(e,t){e=Vi(e,t);return"Array"===f.matrix?e:p(e)},"BigNumber, BigNumber":function(e,t){var r,n,i,a=new m(0),o=new m(1),u=a,s=o,c=o,l=a;if(!e.isInt()||!t.isInt())throw new Error("Parameters in function xgcd must be integer numbers");for(;!t.isZero();)n=e.div(t).floor(),i=e.mod(t),r=u,u=s.minus(n.times(u)),s=r,r=c,c=l.minus(n.times(c)),l=r,e=t,t=i;return o=e.lt(a)?[e.neg(),s.neg(),l.neg()]:[e,e.isZero()?0:s,l],"Array"===f.matrix?o:p(o)}})}),Ua=N("invmod",["typed","config","BigNumber","xgcd","equal","smaller","mod","add","isInteger"],function(e){var t=e.typed,n=(e.config,e.BigNumber),i=e.xgcd,a=e.equal,o=e.smaller,u=e.mod,s=e.add,c=e.isInteger;return t("invmod",{"number, number":r,"BigNumber, BigNumber":r});function r(e,t){if(!c(e)||!c(t))throw new Error("Parameters in function invmod must be integer numbers");if(e=u(e,t),a(t,0))throw new Error("Divisor must be non zero");var e=aa(i(e,t).valueOf(),2),r=e[0],e=e[1];return a(r,n(1))?(e=u(e,t),e=o(e,n(0))?s(e,t):e):NaN}}),$a=N("matAlgo09xS0Sf",["typed","equalScalar"],function(e){var O=e.typed,T=e.equalScalar;return function(e,t,r){var n=e._values,i=e._index,a=e._ptr,o=e._size,u=e._datatype||void 0===e._data?e._datatype:e.getDataType(),s=t._values,c=t._index,l=t._ptr,f=t._size,p=t._datatype||void 0===t._data?t._datatype:t.getDataType();if(o.length!==f.length)throw new k(o.length,f.length);if(o[0]!==f[0]||o[1]!==f[1])throw new RangeError("Dimension mismatch. Matrix A ("+o+") must match Matrix B ("+f+")");var m,f=o[0],h=o[1],d=T,y=0,v=r;"string"==typeof u&&u===p&&"mixed"!==u&&(d=O.find(T,[m=u,m]),y=O.convert(0,m),v=O.find(r,[m,m]));for(var g,x,b,w,N=n&&s?[]:void 0,D=[],E=[],A=N?[]:void 0,S=[],C=0;C<h;C++){E[C]=D.length;var M,F=C+1;if(A)for(b=l[C],w=l[C+1],x=b;x<w;x++)S[g=c[x]]=F,A[g]=s[x];for(b=a[C],w=a[C+1],x=b;x<w;x++)g=i[x],A?(M=S[g]===F?A[g]:y,d(M=v(n[x],M),y)||(D.push(g),N.push(M))):D.push(g)}return E[h]=D.length,e.createSparseMatrix({values:N,index:D,ptr:E,size:[f,h],datatype:u===e._datatype&&p===t._datatype?m:void 0})}}),Ha="dotMultiply",Ga=N(Ha,["typed","matrix","equalScalar","multiplyScalar","concat"],function(e){var t=e.typed,r=e.matrix,n=e.equalScalar,i=e.multiplyScalar,e=e.concat,a=va({typed:t,equalScalar:n}),o=$a({typed:t,equalScalar:n}),n=oa({typed:t,equalScalar:n}),r=p({typed:t,matrix:r,concat:e});return t(Ha,r({elop:i,SS:o,DS:a,Ss:n}))});function Va(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function bitAnd");var r=e.constructor;if(e.isNaN()||t.isNaN())return new r(NaN);if(e.isZero()||t.eq(-1)||e.eq(t))return e;if(t.isZero()||e.eq(-1))return t;if(!e.isFinite()||!t.isFinite()){if(!e.isFinite()&&!t.isFinite())return e.isNegative()===t.isNegative()?e:new r(0);if(!e.isFinite())return t.isNegative()?e:e.isNegative()?new r(0):t;if(!t.isFinite())return e.isNegative()?t:t.isNegative()?new r(0):e}return Ya(e,t,function(e,t){return e&t})}function Za(e){if(e.isFinite()&&!e.isInteger())throw new Error("Integer expected in function bitNot");var t=e.constructor,r=t.precision,e=(t.config({precision:1e9}),e.plus(new t(1)));return e.s=-e.s||null,t.config({precision:r}),e}function Wa(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function bitOr");var r=e.constructor;if(e.isNaN()||t.isNaN())return new r(NaN);r=new r(-1);return e.isZero()||t.eq(r)||e.eq(t)?t:t.isZero()||e.eq(r)?e:e.isFinite()&&t.isFinite()?Ya(e,t,function(e,t){return e|t}):!e.isFinite()&&!e.isNegative()&&t.isNegative()||e.isNegative()&&!t.isNegative()&&!t.isFinite()?r:e.isNegative()&&t.isNegative()?e.isFinite()?e:t:e.isFinite()?t:e}function Ya(e,t,r){var n,i,a=e.constructor,o=+(e.s<0),u=+(t.s<0);if(o)for(var s=Ja(Za(e)),c=0;c<s.length;++c)s[c]^=1;else s=Ja(e);if(u)for(var l=Ja(Za(t)),f=0;f<l.length;++f)l[f]^=1;else l=Ja(t);var p=s.length<=l.length?(n=s,i=l,o):(n=l,i=s,u),m=n.length,h=i.length,d=1^r(o,u),y=new a(1^d),v=new a(1),g=new a(2),e=a.precision;for(a.config({precision:1e9});0<m;)r(n[--m],i[--h])===d&&(y=y.plus(v)),v=v.times(g);for(;0<h;)r(p,i[--h])===d&&(y=y.plus(v)),v=v.times(g);return a.config({precision:e}),0==d&&(y.s=-y.s),y}function Ja(e){for(var t=e.d,r=t[0]+"",n=1;n<t.length;++n){for(var i=t[n]+"",a=7-i.length;a--;)i="0"+i;r+=i}for(var o=r.length;"0"===r.charAt(o);)o--;var u=e.e,s=r.slice(0,o+1||1),e=s.length;if(0<u)if(++u>e)for(u-=e;u--;)s+="0";else u<e&&(s=s.slice(0,u)+"."+s.slice(u));for(var c=[0],l=0;l<s.length;){for(var f=c.length;f--;)c[f]*=10;c[0]+=parseInt(s.charAt(l++));for(var p=0;p<c.length;++p)1<c[p]&&(null!==c[p+1]&&void 0!==c[p+1]||(c[p+1]=0),c[p+1]+=c[p]>>1,c[p]&=1)}return c.reverse()}function Xa(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function bitXor");var r=e.constructor;if(e.isNaN()||t.isNaN())return new r(NaN);if(e.isZero())return t;if(t.isZero())return e;if(e.eq(t))return new r(0);var n=new r(-1);return e.eq(n)?Za(t):t.eq(n)?Za(e):e.isFinite()&&t.isFinite()?Ya(e,t,function(e,t){return e^t}):e.isFinite()||t.isFinite()?new r(e.isNegative()===t.isNegative()?1/0:-1/0):n}function Qa(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function leftShift");var r=e.constructor;return e.isNaN()||t.isNaN()||t.isNegative()&&!t.isZero()?new r(NaN):e.isZero()||t.isZero()?e:e.isFinite()||t.isFinite()?t.lt(55)?e.times(Math.pow(2,t.toNumber())+""):e.times(new r(2).pow(t)):new r(NaN)}function Ka(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function rightArithShift");var r=e.constructor;return e.isNaN()||t.isNaN()||t.isNegative()&&!t.isZero()?new r(NaN):e.isZero()||t.isZero()?e:t.isFinite()?(t.lt(55)?e.div(Math.pow(2,t.toNumber())+""):e.div(new r(2).pow(t))).floor():e.isNegative()?new r(-1):e.isFinite()?new r(0):new r(NaN)}Mh(4490);Fi="number, number";function eo(e,t){if(w(e)&&w(t))return e&t;throw new Error("Integers expected in function bitAnd")}function to(e){if(w(e))return~e;throw new Error("Integer expected in function bitNot")}function ro(e,t){if(w(e)&&w(t))return e|t;throw new Error("Integers expected in function bitOr")}function no(e,t){if(w(e)&&w(t))return e^t;throw new Error("Integers expected in function bitXor")}function io(e,t){if(w(e)&&w(t))return e<<t;throw new Error("Integers expected in function leftShift")}function ao(e,t){if(w(e)&&w(t))return e>>t;throw new Error("Integers expected in function rightArithShift")}function oo(e,t){if(w(e)&&w(t))return e>>>t;throw new Error("Integers expected in function rightLogShift")}eo.signature=Fi,to.signature="number",oo.signature=ao.signature=io.signature=no.signature=ro.signature=Fi;var uo=N("bitAnd",["typed","matrix","equalScalar","concat"],function(e){var t=e.typed,r=e.matrix,n=e.equalScalar,e=e.concat,i=va({typed:t,equalScalar:n}),a=Oa({typed:t,equalScalar:n}),n=oa({typed:t,equalScalar:n});return t("bitAnd",{"number, number":eo,"BigNumber, BigNumber":Va},p({typed:t,matrix:r,concat:e})({SS:a,DS:i,Ss:n}))}),so=N("bitNot",["typed"],function(e){e=e.typed;return e("bitNot",{number:to,BigNumber:Za,"Array | Matrix":e.referToSelf(function(t){return function(e){return ce(e,t)}})})}),co=N("bitOr",["typed","matrix","equalScalar","DenseMatrix","concat"],function(e){var t=e.typed,r=e.matrix,n=e.equalScalar,i=e.DenseMatrix,e=e.concat,a=Da({typed:t}),n=Ea({typed:t,equalScalar:n}),i=Aa({typed:t,DenseMatrix:i});return t("bitOr",{"number, number":ro,"BigNumber, BigNumber":Wa},p({typed:t,matrix:r,concat:e})({SS:n,DS:a,Ss:i}))}),lo=N("matAlgo07xSSf",["typed","DenseMatrix"],function(e){var b=e.typed,w=e.DenseMatrix;return function(e,t,r){var n=e._size,i=e._datatype||void 0===e._data?e._datatype:e.getDataType(),a=t._size,o=t._datatype||void 0===t._data?t._datatype:t.getDataType();if(n.length!==a.length)throw new k(n.length,a.length);if(n[0]!==a[0]||n[1]!==a[1])throw new RangeError("Dimension mismatch. Matrix A ("+n+") must match Matrix B ("+a+")");for(var u,s=n[0],c=n[1],l=0,f=r,p=("string"==typeof i&&i===o&&"mixed"!==i&&(l=b.convert(0,u=i),f=b.find(r,[u,u])),[]),m=0;m<s;m++)p[m]=[];for(var h=[],d=[],y=[],v=[],g=0;g<c;g++){var x=g+1;for(N(e,g,y,h,x),N(t,g,v,d,x),m=0;m<s;m++)p[m][g]=f(y[m]===x?h[m]:l,v[m]===x?d[m]:l)}return new w({data:p,size:[s,c],datatype:i===e._datatype&&o===t._datatype?u:void 0})};function N(e,t,r,n,i){for(var a=e._values,o=e._index,e=e._ptr,u=e[t],s=e[t+1];u<s;u++){var c=o[u];r[c]=i,n[c]=a[u]}}}),fo=N("bitXor",["typed","matrix","DenseMatrix","concat"],function(e){var t=e.typed,r=e.matrix,n=e.DenseMatrix,e=e.concat,i=ga({typed:t}),a=lo({typed:t,DenseMatrix:n}),n=f({typed:t,DenseMatrix:n});return t("bitXor",{"number, number":no,"BigNumber, BigNumber":Xa},p({typed:t,matrix:r,concat:e})({SS:a,DS:i,Ss:n}))}),po=N("arg",["typed"],function(e){e=e.typed;return e("arg",{number:function(e){return Math.atan2(0,e)},BigNumber:function(e){return e.constructor.atan2(0,e)},Complex:function(e){return e.arg()},"Array | Matrix":e.referToSelf(function(t){return function(e){return ce(e,t)}})})}),mo=N("conj",["typed"],function(e){e=e.typed;return e("conj",{"number | BigNumber | Fraction":function(e){return e},Complex:function(e){return e.conjugate()},"Array | Matrix":e.referToSelf(function(t){return function(e){return ce(e,t)}})})}),ho=N("im",["typed"],function(e){e=e.typed;return e("im",{number:function(){return 0},"BigNumber | Fraction":function(e){return e.mul(0)},Complex:function(e){return e.im},"Array | Matrix":e.referToSelf(function(t){return function(e){return ce(e,t)}})})}),yo=N("re",["typed"],function(e){e=e.typed;return e("re",{"number | BigNumber | Fraction":function(e){return e},Complex:function(e){return e.re},"Array | Matrix":e.referToSelf(function(t){return function(e){return ce(e,t)}})})}),Zn="number, number";function vo(e){return!e}function go(e,t){return!(!e&&!t)}function xo(e,t){return!!e!=!!t}function bo(e,t){return!(!e||!t)}vo.signature="number",bo.signature=xo.signature=go.signature=Zn;var wo=N("not",["typed"],function(e){var r=e.typed;return r("not",{"null | undefined":function(){return!0},number:vo,Complex:function(e){return 0===e.re&&0===e.im},BigNumber:function(e){return e.isZero()||e.isNaN()},Unit:r.referToSelf(function(t){return function(e){return r.find(t,e.valueType())(e.value)}}),"Array | Matrix":r.referToSelf(function(t){return function(e){return ce(e,t)}})})}),No=N("or",["typed","matrix","equalScalar","DenseMatrix","concat"],function(e){var t=e.typed,r=e.matrix,n=e.equalScalar,i=e.DenseMatrix,e=e.concat,a=ga({typed:t}),n=xa({typed:t,equalScalar:n}),i=f({typed:t,DenseMatrix:i}),r=p({typed:t,matrix:r,concat:e});return t("or",{"number, number":go,"Complex, Complex":function(e,t){return 0!==e.re||0!==e.im||0!==t.re||0!==t.im},"BigNumber, BigNumber":function(e,t){return!e.isZero()&&!e.isNaN()||!t.isZero()&&!t.isNaN()},"Unit, Unit":t.referToSelf(function(r){return function(e,t){return r(e.value||0,t.value||0)}})},r({SS:n,DS:a,Ss:i}))}),Do=N("xor",["typed","matrix","DenseMatrix","concat"],function(e){var t=e.typed,r=e.matrix,n=e.DenseMatrix,e=e.concat,i=ga({typed:t}),a=lo({typed:t,DenseMatrix:n}),n=f({typed:t,DenseMatrix:n}),r=p({typed:t,matrix:r,concat:e});return t("xor",{"number, number":xo,"Complex, Complex":function(e,t){return(0!==e.re||0!==e.im)!=(0!==t.re||0!==t.im)},"BigNumber, BigNumber":function(e,t){return(!e.isZero()&&!e.isNaN())!=(!t.isZero()&&!t.isNaN())},"Unit, Unit":t.referToSelf(function(r){return function(e,t){return r(e.value||0,t.value||0)}})},r({SS:a,DS:i,Ss:n}))}),Eo=N("concat",["typed","matrix","isInteger"],function(e){var t=e.typed,l=e.matrix,f=e.isInteger;return t("concat",{"...Array | Matrix | number | BigNumber":function(e){for(var t,r=e.length,n=-1,i=!1,a=[],o=0;o<r;o++){var u=e[o];if(P(u)&&(i=!0),Ee(u)||Ae(u)){if(o!==r-1)throw new Error("Dimension must be specified as last argument");if(t=n,n=u.valueOf(),!f(n))throw new TypeError("Integer number expected for dimension");if(n<0||0<o&&t<n)throw new mn(n,t+1)}else{var u=Ce(u).valueOf(),s=_(u);if(a[o]=u,t=n,n=s.length-1,0<o&&n!==t)throw new k(t+1,n+1)}}if(0===a.length)throw new SyntaxError("At least one matrix expected");for(var c=a.shift();a.length;)c=Tn(c,a.shift(),n);return i?l(c):c},"...string":function(e){return e.join("")}})}),Ao=N("column",["typed","Index","matrix","range"],function(e){var t=e.typed,n=e.Index,i=e.matrix,a=e.range;return t("column",{"Matrix, number":r,"Array, number":function(e,t){return r(i(Ce(e)),t).valueOf()}});function r(e,t){if(2!==e.size().length)throw new Error("Only two dimensional matrix is supported");T(t,e.size()[1]);var r=a(0,e.size()[0]),r=new n(r,t),t=e.subset(r);return P(t)?t:i([[t]])}}),So=N("count",["typed","size","prod"],function(e){var t=e.typed,r=e.size,n=e.prod;return t("count",{string:function(e){return e.length},"Matrix | Array":function(e){return n(r(e))}})}),Co=N("cross",["typed","matrix","subtract","multiply"],function(e){var t=e.typed,r=e.matrix,a=e.subtract,o=e.multiply;return t("cross",{"Matrix, Matrix":function(e,t){return r(n(e.toArray(),t.toArray()))},"Matrix, Array":function(e,t){return r(n(e.toArray(),t))},"Array, Matrix":function(e,t){return r(n(e,t.toArray()))},"Array, Array":n});function n(e,t){var r=Math.max(_(e).length,_(t).length),n=(e=wn(e),t=wn(t),_(e)),i=_(t);if(1!==n.length||1!==i.length||3!==n[0]||3!==i[0])throw new RangeError("Vectors with length 3 expected (Size A = ["+n.join(", ")+"], B = ["+i.join(", ")+"])");n=[a(o(e[1],t[2]),o(e[2],t[1])),a(o(e[2],t[0]),o(e[0],t[2])),a(o(e[0],t[1]),o(e[1],t[0]))];return 1<r?[n]:n}}),Mo=N("diag",["typed","matrix","DenseMatrix","SparseMatrix"],function(e){var t=e.typed,y=e.matrix,v=e.DenseMatrix,g=e.SparseMatrix;return t("diag",{Array:function(e){return n(e,0,_(e),null)},"Array, number":function(e,t){return n(e,t,_(e),null)},"Array, BigNumber":function(e,t){return n(e,t.toNumber(),_(e),null)},"Array, string":function(e,t){return n(e,0,_(e),t)},"Array, number, string":function(e,t,r){return n(e,t,_(e),r)},"Array, BigNumber, string":function(e,t,r){return n(e,t.toNumber(),_(e),r)},Matrix:function(e){return n(e,0,e.size(),e.storage())},"Matrix, number":function(e,t){return n(e,t,e.size(),e.storage())},"Matrix, BigNumber":function(e,t){return n(e,t.toNumber(),e.size(),e.storage())},"Matrix, string":function(e,t){return n(e,0,e.size(),t)},"Matrix, number, string":function(e,t,r){return n(e,t,e.size(),r)},"Matrix, BigNumber, string":function(e,t,r){return n(e,t.toNumber(),e.size(),r)}});function n(e,t,r,n){if(!w(t))throw new TypeError("Second parameter in function diag must be an integer");var i=0<t?t:0,a=t<0?-t:0;switch(r.length){case 1:var o=e,u=t,s=n,c=r[0];if(c=[c+a,c+i],s&&"sparse"!==s&&"dense"!==s)throw new TypeError("Unknown matrix type ".concat(s,'"'));return c=("sparse"===s?g:v).diagonal(c,o,u),null!==s?c:c.valueOf();case 2:var l=e,o=n,u=r,f=a,p=i;if(P(l))return s=l.diagonal(t),null!==o?o!==s.storage()?y(s,o):s:s.valueOf();for(var m=Math.min(u[0]-f,u[1]-p),h=[],d=0;d<m;d++)h[d]=l[d+f][d+p];return null!==o?y(h):h}throw new RangeError("Matrix for function diag must be 2 dimensional")}});function Fo(n,i,a,o,u){if(de.isTypedFunction(n)){var e=[i,a,o],t=de.resolve(n,e);if(t)return s(t.implementation,e);var t=[i,a],r=de.resolve(n,t);if(r)return s(r.implementation,t);r=[i],t=de.resolve(n,r);return t?s(t.implementation,r):s(n,e)}return n(i,a,o);function s(e,t){try{return e.apply(e,t)}catch(e){var r;if(e instanceof TypeError&&"wrongType"===(null==(r=e.data)?void 0:r.category))throw(r=[]).push("value: ".concat(Se(i))),2<=t.length&&r.push("index: ".concat(Se(a))),3<=t.length&&r.push("array: ".concat(Se(o))),new TypeError("Function ".concat(u," cannot apply callback arguments ")+"".concat(n.name,"(").concat(r.join(", "),") at index ").concat(JSON.stringify(a)));throw new TypeError("Function ".concat(u," cannot apply callback arguments ")+"to function ".concat(n.name,": ").concat(e.message))}}}var Oo=N("filter",["typed"],function(e){return(0,e.typed)("filter",{"Array, function":To,"Matrix, function":function(e,t){return e.create(To(e.toArray(),t))},"Array, RegExp":Sn,"Matrix, RegExp":function(e,t){return e.create(Sn(e.toArray(),t))}})});function To(e,n){return An(e,function(e,t,r){return Fo(n,e,[t],r,"filter")})}var _o=N("flatten",["typed","matrix"],function(e){var t=e.typed,r=e.matrix;return t("flatten",{Array:E,Matrix:function(e){e=E(e.toArray());return r(e)}})}),Bo=N("forEach",["typed"],function(e){return(0,e.typed)("forEach",{"Array, function":ko,"Matrix, function":function(e,t){e.forEach(t)}})});function ko(t,i){!function r(e,n){return Array.isArray(e)?void En(e,function(e,t){r(e,n.concat(t))}):Fo(i,e,n,t,"forEach")}(t,[])}var Io="getMatrixDataType",zo=N(Io,["typed"],function(e){return(0,e.typed)(Io,{Array:function(e){return On(e,Se)},Matrix:function(e){return e.getDataType()}})}),Ro=N("identity",["typed","config","matrix","BigNumber","DenseMatrix","SparseMatrix"],function(e){var t=e.typed,r=e.config,n=e.matrix,c=e.BigNumber,l=e.DenseMatrix,f=e.SparseMatrix;return t("identity",{"":function(){return"Matrix"===r.matrix?n([]):[]},string:function(e){return n(e)},"number | BigNumber":function(e){return a(e,e,"Matrix"===r.matrix?"dense":void 0)},"number | BigNumber, string":function(e,t){return a(e,e,t)},"number | BigNumber, number | BigNumber":function(e,t){return a(e,t,"Matrix"===r.matrix?"dense":void 0)},"number | BigNumber, number | BigNumber, string":a,Array:function(e){return i(e)},"Array, string":i,Matrix:function(e){return i(e.valueOf(),e.storage())},"Matrix, string":function(e,t){return i(e.valueOf(),t)}});function i(e,t){switch(e.length){case 0:return t?n(t):[];case 1:return a(e[0],e[0],t);case 2:return a(e[0],e[1],t);default:throw new Error("Vector containing two values expected")}}function a(e,t,r){var n=Ae(e)||Ae(t)?c:null;if(Ae(e)&&(e=e.toNumber()),Ae(t)&&(t=t.toNumber()),!w(e)||e<1)throw new Error("Parameters in function identity must be positive integers");if(!w(t)||t<1)throw new Error("Parameters in function identity must be positive integers");var i=n?new c(1):1,n=n?new n(0):0,a=[e,t];if(r){if("sparse"===r)return f.diagonal(a,i,0,n);if("dense"===r)return l.diagonal(a,i,0,n);throw new TypeError('Unknown matrix type "'.concat(r,'"'))}for(var o=vn([],a,n),u=e<t?e:t,s=0;s<u;s++)o[s][s]=i;return o}}),qo=N("kron",["typed","matrix","multiplyScalar"],function(e){var t=e.typed,r=e.matrix,a=e.multiplyScalar;return t("kron",{"Matrix, Matrix":function(e,t){return r(n(e.toArray(),t.toArray()))},"Matrix, Array":function(e,t){return r(n(e.toArray(),t))},"Array, Matrix":function(e,t){return r(n(e,t.toArray()))},"Array, Array":n});function n(e,r){if(1===_(e).length&&(e=[e]),1===_(r).length&&(r=[r]),2<_(e).length||2<_(r).length)throw new RangeError("Vectors with dimensions greater then 2 are not supported expected (Size x = "+JSON.stringify(e.length)+", y = "+JSON.stringify(r.length)+")");var n=[],i=[];return e.map(function(t){return r.map(function(e){return i=[],n.push(i),t.map(function(t){return e.map(function(e){return i.push(a(t,e))})})})})&&n}}),jo=N("map",["typed"],function(e){return(0,e.typed)("map",{"Array, function":Po,"Matrix, function":function(e,t){return e.map(t)}})});function Po(t,i){return function r(e,n){return Array.isArray(e)?e.map(function(e,t){return r(e,n.concat(t))}):Fo(i,e,n,t,"map")}(t,[])}var Lo=N("diff",["typed","matrix","subtract","number"],function(e){var t=e.typed,r=e.matrix,i=e.subtract,n=e.number;return t("diff",{"Array | Matrix":function(e){return P(e)?r(o(e.toArray())):o(e)},"Array | Matrix, number":function(e,t){if(w(t))return P(e)?r(a(e.toArray(),t)):a(e,t);throw new RangeError("Dimension must be a whole number")},"Array, BigNumber":t.referTo("Array,number",function(r){return function(e,t){return r(e,n(t))}}),"Matrix, BigNumber":t.referTo("Matrix,number",function(r){return function(e,t){return r(e,n(t))}})});function a(e,t){if(P(e)&&(e=e.toArray()),!Array.isArray(e))throw RangeError("Array/Matrix does not have that many dimensions");var r;if(0<t)return r=[],e.forEach(function(e){r.push(a(e,t-1))}),r;if(0===t)return o(e);throw RangeError("Cannot have negative dimension")}function o(e){for(var t=[],r=e.length,n=1;n<r;n++)t.push(function a(e,t){P(e)&&(e=e.toArray()),P(t)&&(t=t.toArray());var r=Array.isArray(e),n=Array.isArray(t);if(r&&n)return function(e,t){if(e.length!==t.length)throw RangeError("Not all sub-arrays have the same length");for(var r=[],n=e.length,i=0;i<n;i++)r.push(a(e[i],t[i]));return r}(e,t);if(!r&&!n)return i(t,e);throw TypeError("Cannot calculate difference between 1 array and 1 non-array")}(e[n-1],e[n]));return t}}),Uo=N("ones",["typed","config","matrix","BigNumber"],function(e){var t=e.typed,r=e.config,i=e.matrix,a=e.BigNumber;return t("ones",{"":function(){return"Array"===r.matrix?n([]):n([],"default")},"...number | BigNumber | string":function(e){var t;return"string"==typeof e[e.length-1]?(t=e.pop(),n(e,t)):"Array"===r.matrix?n(e):n(e,"default")},Array:n,Matrix:function(e){var t=e.storage();return n(e.valueOf(),t)},"Array | Matrix, string":function(e,t){return n(e.valueOf(),t)}});function n(e,t){n=!1,e.forEach(function(e,t,r){Ae(e)&&(n=!0,r[t]=e.toNumber())});var n,r=n?new a(1):1;if(e.forEach(function(e){if("number"!=typeof e||!w(e)||e<0)throw new Error("Parameters in function ones must be positive integers")}),t)return t=i(t),0<e.length?t.resize(e,r):t;t=[];return 0<e.length?vn(t,e,r):t}});function $o(){throw new Error('No "bignumber" implementation available')}function Ho(){throw new Error('No "fraction" implementation available')}function Go(){throw new Error('No "matrix" implementation available')}var Vo=N("range",["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],function(e){var t=e.typed,n=e.config,r=e.matrix,i=e.bignumber,u=e.smaller,s=e.smallerEq,c=e.larger,l=e.largerEq,f=e.add,p=e.isPositive;return t("range",{string:o,"string, boolean":o,"number, number":function(e,t){return a(m(e,t,1,!1))},"number, number, number":function(e,t,r){return a(m(e,t,r,!1))},"number, number, boolean":function(e,t,r){return a(m(e,t,1,r))},"number, number, number, boolean":function(e,t,r,n){return a(m(e,t,r,n))},"BigNumber, BigNumber":function(e,t){return a(m(e,t,new e.constructor(1),!1))},"BigNumber, BigNumber, BigNumber":function(e,t,r){return a(m(e,t,r,!1))},"BigNumber, BigNumber, boolean":function(e,t,r){return a(m(e,t,new e.constructor(1),r))},"BigNumber, BigNumber, BigNumber, boolean":function(e,t,r,n){return a(m(e,t,r,n))},"Unit, Unit, Unit":function(e,t,r){return a(m(e,t,r,!1))},"Unit, Unit, Unit, boolean":function(e,t,r,n){return a(m(e,t,r,n))}});function a(e){return"Matrix"===n.matrix?r?r(e):Go():e}function o(t,e){var r=function(){var e=t.split(":").map(function(e){return Number(e)});if(e.some(function(e){return isNaN(e)}))return null;switch(e.length){case 2:return{start:e[0],end:e[1],step:1};case 3:return{start:e[0],end:e[2],step:e[1]};default:return null}}();if(r)return"BigNumber"===n.number?(void 0===i&&$o(),a(m(i(r.start),i(r.end),i(r.step)))):a(m(r.start,r.end,r.step,e));throw new SyntaxError('String "'+t+'" is no valid range')}function m(e,t,r,n){for(var i=[],a=p(r)?n?s:u:n?l:c,o=e;a(o,t);)i.push(o),o=f(o,r);return i}}),Zo=N("reshape",["typed","isInteger","matrix"],function(e){var t=e.typed,r=e.isInteger;return t("reshape",{"Matrix, Array":function(e,t){return e.reshape(t,!0)},"Array, Array":function(e,t){return t.forEach(function(e){if(!r(e))throw new TypeError("Invalid size for dimension: "+e)}),gn(e,t)}})}),Wo=N("resize",["config","matrix"],function(e){var l=e.config,f=e.matrix;return function(e,t,r){if(2!==arguments.length&&3!==arguments.length)throw new Sa("resize",arguments.length,2,3);if(Ae((t=P(t)?t.valueOf():t)[0])&&(t=t.map(function(e){return Ae(e)?e.toNumber():e})),P(e))return e.resize(t,r,!0);if("string"==typeof e){var n=e,i=t,a=r;if(void 0!==a){if("string"!=typeof a||1!==a.length)throw new TypeError("Single character expected as defaultValue")}else a=" ";if(1!==i.length)throw new k(i.length,1);var o=i[0];if("number"!=typeof o||!w(o))throw new TypeError("Invalid size, must contain positive integers (size: "+Fe(i)+")");if(n.length>o)return n.substring(0,o);if(n.length<o){for(var u=n,s=0,c=o-n.length;s<c;s++)u+=a;return u}return n}i=!Array.isArray(e)&&"Array"!==l.matrix;if(0===t.length){for(;Array.isArray(e);)e=e[0];return Ce(e)}o=vn(e=Ce(e=Array.isArray(e)?e:[e]),t,r);return i?f(o):o}}),Yo=N("rotate",["typed","multiply","rotationMatrix"],function(e){var t=e.typed,n=e.multiply,i=e.rotationMatrix;return t("rotate",{"Array , number | BigNumber | Complex | Unit":function(e,t){return a(e,2),n(i(t),e).toArray()},"Matrix , number | BigNumber | Complex | Unit":function(e,t){return a(e,2),n(i(t),e)},"Array, number | BigNumber | Complex | Unit, Array | Matrix":function(e,t,r){return a(e,3),n(i(t,r),e)},"Matrix, number | BigNumber | Complex | Unit, Array | Matrix":function(e,t,r){return a(e,3),n(i(t,r),e)}});function a(e,t){e=Array.isArray(e)?_(e):e.size();if(2<e.length)throw new RangeError("Vector must be of dimensions 1x".concat(t));if(2===e.length&&1!==e[1])throw new RangeError("Vector must be of dimensions 1x".concat(t));if(e[0]!==t)throw new RangeError("Vector must be of dimensions 1x".concat(t))}}),Jo="rotationMatrix",Xo=N(Jo,["typed","config","multiplyScalar","addScalar","unaryMinus","norm","matrix","BigNumber","DenseMatrix","SparseMatrix","cos","sin"],function(e){var t=e.typed,n=e.config,i=e.multiplyScalar,c=e.addScalar,l=e.unaryMinus,f=e.norm,p=e.BigNumber,a=e.matrix,r=e.DenseMatrix,o=e.SparseMatrix,m=e.cos,h=e.sin;return t(Jo,{"":function(){return"Matrix"===n.matrix?a([]):[]},string:function(e){return a(e)},"number | BigNumber | Complex | Unit":function(e){return u(e,"Matrix"===n.matrix?"dense":void 0)},"number | BigNumber | Complex | Unit, string":u,"number | BigNumber | Complex | Unit, Array":function(e,t){t=a(t);return s(t),v(e,t,void 0)},"number | BigNumber | Complex | Unit, Matrix":function(e,t){s(t);var r=t.storage()||("Matrix"===n.matrix?"dense":void 0);return v(e,t,r)},"number | BigNumber | Complex | Unit, Array, string":function(e,t,r){t=a(t);return s(t),v(e,t,r)},"number | BigNumber | Complex | Unit, Matrix, string":function(e,t,r){return s(t),v(e,t,r)}});function u(e,t){var r=Ae(e)?new p(-1):-1,n=m(e),e=h(e);return y([[n,i(r,e)],[e,n]],t)}function s(e){e=e.size();if(e.length<1||3!==e[0])throw new RangeError("Vector must be of dimensions 1x3")}function d(e){return e.reduce(function(e,t){return i(e,t)})}function y(e,t){if(t){if("sparse"===t)return new o(e);if("dense"===t)return new r(e);throw new TypeError('Unknown matrix type "'.concat(t,'"'))}return e}function v(e,t,r){var n=f(t);if(0===n)throw new RangeError("Rotation around zero vector");var i=Ae(e)?p:null,a=i?new i(1):1,o=i?new i(-1):-1,u=i?new i(t.get([0])/n):t.get([0])/n,s=i?new i(t.get([1])/n):t.get([1])/n,i=i?new i(t.get([2])/n):t.get([2])/n,t=m(e),n=c(a,l(t)),a=h(e);return y([[c(t,d([u,u,n])),c(d([u,s,n]),d([o,i,a])),c(d([u,i,n]),d([s,a]))],[c(d([u,s,n]),d([i,a])),c(t,d([s,s,n])),c(d([s,i,n]),d([o,u,a]))],[c(d([u,i,n]),d([o,s,a])),c(d([s,i,n]),d([u,a])),c(t,d([i,i,n]))]],r)}}),Qo=N("row",["typed","Index","matrix","range"],function(e){var t=e.typed,n=e.Index,i=e.matrix,a=e.range;return t("row",{"Matrix, number":r,"Array, number":function(e,t){return r(i(Ce(e)),t).valueOf()}});function r(e,t){if(2!==e.size().length)throw new Error("Only two dimensional matrix is supported");T(t,e.size()[0]);var r=a(0,e.size()[1]),t=new n(t,r),r=e.subset(t);return P(r)?r:i([[r]])}}),Ko=N("size",["typed","config","?matrix"],function(e){var t=e.typed,r=e.config,n=e.matrix;return t("size",{Matrix:function(e){return e.create(e.size())},Array:_,string:function(e){return"Array"===r.matrix?[e.length]:n([e.length])},"number | Complex | BigNumber | Unit | boolean | null":function(e){return"Array"===r.matrix?[]:n?n([]):Go()}})}),eu=N("squeeze",["typed","matrix"],function(e){var t=e.typed,r=e.matrix;return t("squeeze",{Array:function(e){return wn(Ce(e))},Matrix:function(e){e=wn(e.toArray());return Array.isArray(e)?r(e):e},any:Ce})}),tu=N("subset",["typed","matrix","zeros","add"],function(e){var t=e.typed,a=e.matrix,i=e.zeros,o=e.add;return t("subset",{"Matrix, Index":function(e,t){return yn(t)?a():(dn(e,t),e.subset(t))},"Array, Index":t.referTo("Matrix, Index",function(r){return function(e,t){e=r(a(e),t);return t.isScalar()?e:e.valueOf()}}),"Object, Index":iu,"string, Index":ru,"Matrix, Index, any, any":function(e,t,r,n){return yn(t)?e:(dn(e,t),e.clone().subset(t,function(e,t){if("string"==typeof e)throw new Error("can't boradcast a string");if(t._isScalar)return e;var r=t.size();if(!r.every(function(e){return 0<e}))return e;try{return o(e,i(r))}catch(t){return e}}(r,t),n))},"Array, Index, any, any":t.referTo("Matrix, Index, any, any",function(i){return function(e,t,r,n){e=i(a(e),t,r,n);return e.isMatrix?e.valueOf():e}}),"Array, Index, any":t.referTo("Matrix, Index, any, any",function(n){return function(e,t,r){return n(a(e),t,r,void 0).valueOf()}}),"Matrix, Index, any":t.referTo("Matrix, Index, any, any",function(n){return function(e,t,r){return n(e,t,r,void 0)}}),"string, Index, string":nu,"string, Index, string, string":nu,"Object, Index, any":au})});function ru(t,e){if(!z(e))throw new TypeError("Index expected");if(yn(e))return"";if(dn(Array.from(t),e),1!==e.size().length)throw new k(e.size().length,1);var r=t.length,r=(T(e.min()[0],r),T(e.max()[0],r),e.dimension(0)),n="";return r.forEach(function(e){n+=t.charAt(e)}),n}function nu(e,t,r,n){if(!t||!0!==t.isIndex)throw new TypeError("Index expected");if(yn(t))return e;if(dn(Array.from(e),t),1!==t.size().length)throw new k(t.size().length,1);if(void 0!==n){if("string"!=typeof n||1!==n.length)throw new TypeError("Single character expected as defaultValue")}else n=" ";var i=t.dimension(0);if(i.size()[0]!==r.length)throw new k(i.size()[0],r.length);var a=e.length;T(t.min()[0]),T(t.max()[0]);for(var o=[],u=0;u<a;u++)o[u]=e.charAt(u);if(i.forEach(function(e,t){o[e]=r.charAt(t[0])}),o.length>a)for(var s=a-1,c=o.length;s<c;s++)o[s]||(o[s]=n);return o.join("")}function iu(e,t){if(!yn(t)){if(1!==t.size().length)throw new k(t.size(),1);t=t.dimension(0);if("string"!=typeof t)throw new TypeError("String expected as index to retrieve an object property");return Xe(e,t)}}function au(e,t,r){if(yn(t))return e;if(1!==t.size().length)throw new k(t.size(),1);t=t.dimension(0);if("string"!=typeof t)throw new TypeError("String expected as index to retrieve an object property");e=Ce(e);return Qe(e,t,r),e}var ou=N("transpose",["typed","matrix"],function(e){var t=e.typed,r=e.matrix;return t("transpose",{Array:function(e){return n(r(e)).valueOf()},Matrix:n,any:Ce});function n(e){var t,r=e.size();switch(r.length){case 1:t=e.clone();break;case 2:var n=r[0],i=r[1];if(0===i)throw new RangeError("Cannot transpose a 2D matrix with no columns (size: "+Fe(r)+")");switch(e.storage()){case"dense":t=function(e,t,r){for(var n=e._data,i=[],a=0;a<r;a++)for(var o=i[a]=[],u=0;u<t;u++)o[u]=Ce(n[u][a]);return e.createDenseMatrix({data:i,size:[r,t],datatype:e._datatype})}(e,n,i);break;case"sparse":t=function(e,t,r){for(var n,i,a,o=e._values,u=e._index,s=e._ptr,c=o?[]:void 0,l=[],f=[],p=[],m=0;m<t;m++)p[m]=0;for(n=0,i=u.length;n<i;n++)p[u[n]]++;for(var h=0,d=0;d<t;d++)f.push(h),h+=p[d],p[d]=f[d];for(f.push(h),a=0;a<r;a++)for(var y=s[a],v=s[a+1],g=y;g<v;g++){var x=p[u[g]]++;l[x]=a,o&&(c[x]=Ce(o[g]))}return e.createSparseMatrix({values:c,index:l,ptr:f,size:[r,t],datatype:e._datatype})}(e,n,i)}break;default:throw new RangeError("Matrix must be a vector or two dimensional (size: "+Fe(r)+")")}return t}}),uu="ctranspose",su=N(uu,["typed","transpose","conj"],function(e){var t=e.typed,r=e.transpose,n=e.conj;return t(uu,{any:function(e){return n(r(e))}})}),cu=N("zeros",["typed","config","matrix","BigNumber"],function(e){var t=e.typed,r=e.config,i=e.matrix,a=e.BigNumber;return t("zeros",{"":function(){return"Array"===r.matrix?n([]):n([],"default")},"...number | BigNumber | string":function(e){var t;return"string"==typeof e[e.length-1]?(t=e.pop(),n(e,t)):"Array"===r.matrix?n(e):n(e,"default")},Array:n,Matrix:function(e){var t=e.storage();return n(e.valueOf(),t)},"Array | Matrix, string":function(e,t){return n(e.valueOf(),t)}});function n(e,t){n=!1,e.forEach(function(e,t,r){Ae(e)&&(n=!0,r[t]=e.toNumber())});var n,r=n?new a(0):0;if(e.forEach(function(e){if("number"!=typeof e||!w(e)||e<0)throw new Error("Parameters in function zeros must be positive integers")}),t)return t=i(t),0<e.length?t.resize(e,r):t;t=[];return 0<e.length?vn(t,e,r):t}}),lu=N("fft",["typed","matrix","addScalar","multiplyScalar","divideScalar","exp","tau","i","dotDivide","conj","pow","ceil","log2"],function(e){var t=e.typed,x=(e.matrix,e.addScalar),b=e.multiplyScalar,w=e.divideScalar,N=e.exp,D=e.tau,E=e.i,A=e.dotDivide,S=e.conj,C=e.pow,M=e.ceil,F=e.log2;return t("fft",{Array:O,Matrix:function(e){return e.create(O(e.toArray()))}});function O(e){var t=_(e);return 1===t.length?T(e,t[0]):function r(n,i){var e=_(n);if(0!==i)return new Array(e[0]).fill(0).map(function(e,t){return r(n[t],i-1)});if(1===e.length)return T(n);function t(n){var t=_(n);return new Array(t[1]).fill(0).map(function(e,r){return new Array(t[0]).fill(0).map(function(e,t){return n[t][r]})})}return t(r(t(n),1))}(e.map(function(e){return O(e,t.slice(1))}),0)}function T(e){var t=e.length;if(1===t)return[e[0]];if(t%2!=0){for(var r=e,n=r.length,i=N(w(b(-1,b(E,D)),n)),a=[],o=1-n;o<n;o++)a.push(C(i,w(C(o,2),2)));for(var u=C(2,M(F(n+n-1))),s=[].concat(Me(new Array(n).fill(0).map(function(e,t){return b(r[t],a[n-1+t])})),Me(new Array(u-n).fill(0))),c=[].concat(Me(new Array(n+n-1).fill(0).map(function(e,t){return w(1,a[t])})),Me(new Array(u-(n+n-1)).fill(0))),l=T(s),f=T(c),s=new Array(u).fill(0).map(function(e,t){return b(l[t],f[t])}),p=A(S(O(S(s))),u),m=[],h=n-1;h<n+n-1;h++)m.push(b(p[h],a[h]));return m}for(var d=[].concat(Me(T(e.filter(function(e,t){return t%2==0}))),Me(T(e.filter(function(e,t){return t%2==1})))),y=0;y<t/2;y++){var v=d[y],g=b(d[y+t/2],N(b(b(D,E),w(-y,t))));d[y]=x(v,g),d[y+t/2]=x(v,b(-1,g))}return d}}),fu=N("ifft",["typed","fft","dotDivide","conj"],function(e){var t=e.typed,r=e.fft,n=e.dotDivide,i=e.conj;return t("ifft",{"Array | Matrix":function(e){var t=P(e)?e.size():_(e);return n(i(r(i(e))),t.reduce(function(e,t){return e*t},1))}})});function pu(t,e){var r,n=Object.keys(t);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)),n}Mh(7945),Mh(3851),Mh(1278);var mu=N("solveODE",["typed","add","subtract","multiply","divide","max","map","abs","isPositive","isNegative","larger","smaller","matrix","bignumber","unaryMinus"],function(e){var t=e.typed,T=e.add,_=e.subtract,B=e.multiply,k=e.divide,I=e.max,z=e.map,R=e.abs,q=e.isPositive,j=e.isNegative,P=e.larger,L=e.smaller,i=e.matrix,U=e.bignumber,$=e.unaryMinus;function a(O){return function(e,t,r,n){if(2!==t.length||!t.every(H)&&!t.every(Z))throw new Error('"tspan" must be an Array of two numeric values or two units [tStart, tEnd]');var i=t[0],a=t[1],o=P(a,i),t=n.firstStep;if(void 0!==t&&!q(t))throw new Error('"firstStep" must be positive');var u=n.maxStep;if(void 0!==u&&!q(u))throw new Error('"maxStep" must be positive');var s=n.minStep;if(s&&j(s))throw new Error('"minStep" must be positive or zero');var c=[i,a,t,s,u].filter(function(e){return void 0!==e});if(!c.every(H)&&!c.every(Z))throw new Error('Inconsistent type of "t" dependant variables');for(var l,f=n.tol||1e-4,p=n.minDelta||.2,m=n.maxDelta||5,h=n.maxIter||1e4,d=[i,a].concat(Me(r),[u,s]).some(Ae),c=aa(d?[U(O.a),U(O.c),U(O.b),U(O.bp)]:[O.a,O.c,O.b,O.bp],4),y=c[0],v=c[1],g=c[2],n=c[3],x=t?o?t:$(t):k(_(a,i),1),b=[i],w=[r],N=_(g,n),D=0,E=0,A=o?L:P,S=(l=o?P:L,function(e,t,r){var n=T(e,r);return l(n,t)?_(t,e):r});A(b[D],a);){var C=[],x=S(b[D],a,x);C.push(e(b[D],w[D]));for(var M=1;M<v.length;++M)C.push(e(T(b[D],B(v[M],x)),T(w[D],B(x,y[M],C))));var F=I(R(z(B(N,C),function(e){return Z(e)?e.value:e}))),F=(F<f&&.25<f/F&&(b.push(T(b[D],x)),w.push(T(w[D],B(x,g,C))),D++),.84*Math.pow(f/F,.2));if(L(F,p)?F=p:P(F,m)&&(F=m),F=d?U(F):F,x=B(x,F),u&&P(R(x),u)?x=o?u:$(u):s&&L(R(x),s)&&(x=o?s:$(s)),++E>h)throw new Error("Maximum number of iterations reached, try changing options")}return{t:b,y:w}}}function o(e,t,r,n){return a({a:[[],[.5],[0,.75],[2/9,1/3,4/9]],c:[null,.5,.75,1],b:[2/9,1/3,4/9,0],bp:[7/24,.25,1/3,1/8]})(e,t,r,n)}function u(e,t,r,n){return a({a:[[],[.2],[.075,.225],[44/45,-56/15,32/9],[19372/6561,-25360/2187,64448/6561,-212/729],[9017/3168,-355/33,46732/5247,49/176,-5103/18656],[35/384,0,500/1113,125/192,-2187/6784,11/84]],c:[null,.2,.3,.8,8/9,1,1],b:[35/384,0,500/1113,125/192,-2187/6784,11/84,0],bp:[5179/57600,0,7571/16695,393/640,-92097/339200,187/2100,.025]})(e,t,r,n)}function s(e,t,r,n){var i=n.method||"RK45",a={RK23:o,RK45:u};if(i.toUpperCase()in a)return delete(n=function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?pu(Object(r),!0).forEach(function(e){A(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):pu(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}({},n)).method,a[i.toUpperCase()](e,t,r,n);e=Object.keys(a).map(function(e){return'"'.concat(e,'"')}),t="".concat(e.slice(0,-1).join(", ")," and ").concat(e.slice(-1));throw new Error('Unavailable method "'.concat(i,'". Available methods are ').concat(t))}function H(e){return Ae(e)||Ee(e)}function n(e,t,r,n){e=s(e,t.toArray(),r.toArray(),n);return{t:i(e.t),y:i(e.y)}}return t("solveODE",{"function, Array, Array, Object":s,"function, Matrix, Matrix, Object":n,"function, Array, Array":function(e,t,r){return s(e,t,r,{})},"function, Matrix, Matrix":function(e,t,r){return n(e,t,r,{})},"function, Array, number | BigNumber | Unit":function(e,t,r){e=s(e,t,[r],{});return{t:e.t,y:e.y.map(function(e){return e[0]})}},"function, Matrix, number | BigNumber | Unit":function(e,t,r){e=s(e,t.toArray(),[r],{});return{t:i(e.t),y:i(e.y.map(function(e){return e[0]}))}},"function, Array, number | BigNumber | Unit, Object":function(e,t,r,n){e=s(e,t,[r],n);return{t:e.t,y:e.y.map(function(e){return e[0]})}},"function, Matrix, number | BigNumber | Unit, Object":function(e,t,r,n){e=s(e,t.toArray(),[r],n);return{t:i(e.t),y:i(e.y.map(function(e){return e[0]}))}}})}),hu=N("erf",["typed"],function(e){e=e.typed;return e("name",{number:function(e){var t=Math.abs(e);return xu<=t?n(e):t<=du?n(e)*function(e){for(var t=e*e,r=vu[0][4]*t,n=t,i=0;i<3;i+=1)r=(r+vu[0][i])*t,n=(n+gu[0][i])*t;return e*(r+vu[0][3])/(n+gu[0][3])}(t):t<=4?n(e)*(1-function(e){for(var t=vu[1][8]*e,r=e,n=0;n<7;n+=1)t=(t+vu[1][n])*e,r=(r+gu[1][n])*e;var i=(t+vu[1][7])/(r+gu[1][7]),a=parseInt(16*e)/16,o=(e-a)*(e+a);return Math.exp(-a*a)*Math.exp(-o)*i}(t)):n(e)*(1-function(e){for(var t=1/(e*e),r=vu[2][5]*t,n=t,i=0;i<4;i+=1)r=(r+vu[2][i])*t,n=(n+gu[2][i])*t;var a=t*(r+vu[2][4])/(n+gu[2][4]),a=(yu-a)/e,e=(e-(t=parseInt(16*e)/16))*(e+t);return Math.exp(-t*t)*Math.exp(-e)*a}(t))},"Array | Matrix":e.referToSelf(function(t){return function(e){return ce(e,t)}})})}),du=.46875,yu=.5641895835477563,vu=[[3.1611237438705655,113.86415415105016,377.485237685302,3209.3775891384694,.18577770618460315],[.5641884969886701,8.883149794388377,66.11919063714163,298.6351381974001,881.952221241769,1712.0476126340707,2051.0783778260716,1230.3393547979972,2.1531153547440383e-8],[.30532663496123236,.36034489994980445,.12578172611122926,.016083785148742275,.0006587491615298378,.016315387137302097]],gu=[[23.601290952344122,244.02463793444417,1282.6165260773723,2844.236833439171],[15.744926110709835,117.6939508913125,537.1811018620099,1621.3895745666903,3290.7992357334597,4362.619090143247,3439.3676741437216,1230.3393548037495],[2.568520192289822,1.8729528499234604,.5279051029514285,.06051834131244132,.0023352049762686918]],xu=Math.pow(2,53),bu=N("zeta",["typed","config","multiply","pow","divide","factorial","equal","smallerEq","isNegative","gamma","sin","subtract","add","?Complex","?BigNumber","pi"],function(e){var t=e.typed,r=e.config,l=e.multiply,f=e.pow,p=e.divide,a=e.factorial,n=e.equal,m=e.smallerEq,i=e.isNegative,h=e.gamma,d=e.sin,y=e.subtract,v=e.add,o=e.Complex,u=e.BigNumber,g=e.pi;return t("zeta",{number:function(e){return s(e,function(e){return e},function(){return 20})},BigNumber:function(e){return s(e,function(e){return new u(e)},function(){return Math.abs(Math.log10(r.epsilon))})},Complex:function(e){return 0===e.re&&0===e.im?new o(-.5):1===e.re?new o(NaN,NaN):e.re===1/0&&0===e.im?new o(1):e.im===1/0||e.re===-1/0?new o(NaN,NaN):x(e,function(e){return e},function(e){return Math.round(19.5+.9*Math.abs(e.im))},function(e){return e.re})}});function s(e,t,r){return n(e,0)?t(-.5):n(e,1)?t(NaN):isFinite(e)?x(e,t,r,function(e){return e}):i(e)?t(NaN):t(1)}function x(e,t,r,n){var i=r(e);{if(n(e)>-(i-1)/2){for(var a=e,o=t(i),i=t,u=p(1,l(b(i(0),o),y(1,f(2,y(1,a))))),s=i(0),c=i(1);m(c,o);c=v(c,1))s=v(s,p(l(Math.pow(-1,c-1),b(c,o)),f(c,a)));return l(u,s)}return i=l(f(2,e),f(t(g),y(e,1))),i=l(i,d(l(p(t(g),2),e))),i=l(i,h(y(1,e))),l(i,x(y(1,e),t,r,n))}}function b(e,t){for(var r=e,n=e;m(n,t);n=v(n,1))var i=p(l(a(v(t,y(n,1))),f(4,n)),l(a(y(t,n)),a(l(2,n)))),r=v(r,i);return l(t,r)}}),wu=N("mode",["typed","isNaN","isNumeric"],function(e){var t=e.typed,o=e.isNaN,u=e.isNumeric;return t("mode",{"Array | Matrix":r,"...":r});function r(e){if(0===(e=E(e.valueOf())).length)throw new Error("Cannot calculate mode of an empty array");for(var t={},r=[],n=0,i=0;i<e.length;i++){var a=e[i];if(u(a)&&o(a))throw new Error("Cannot calculate mode of an array containing NaN values");a in t||(t[a]=0),t[a]++,t[a]===n?r.push(a):t[a]>n&&(n=t[a],r=[a])}return r}});function Nu(e,t,r){var n;return String(e).includes("Unexpected type")?(n=2<arguments.length?" (type: "+Se(r)+", value: "+JSON.stringify(r)+")":" (type: "+e.data.actual+")",new TypeError("Cannot calculate "+t+", unexpected type of argument"+n)):String(e).includes("complex numbers")?(n=2<arguments.length?" (type: "+Se(r)+", value: "+JSON.stringify(r)+")":"",new TypeError("Cannot calculate "+t+", no ordering relation is defined for complex numbers"+n)):e}var Du=N("prod",["typed","config","multiplyScalar","numeric"],function(e){var t=e.typed,n=e.config,i=e.multiplyScalar,a=e.numeric;return t("prod",{"Array | Matrix":r,"Array | Matrix, number | BigNumber":function(e,t){throw new Error("prod(A, dim) is not yet supported")},"...":r});function r(e){var r;if(Un(e,function(t){try{r=void 0===r?t:i(r,t)}catch(e){throw Nu(e,"prod",t)}}),void 0===(r="string"==typeof r?a(r,n.number):r))throw new Error("Cannot calculate prod of an empty array");return r}}),Eu=N("format",["typed"],function(e){return(0,e.typed)("format",{any:Fe,"any, Object | function | number | BigNumber":Fe})}),Au=N("bin",["typed","format"],function(e){var t=e.typed,r=e.format;return t("bin",{"number | BigNumber":function(e){return r(e,{notation:"bin"})},"number | BigNumber, number | BigNumber":function(e,t){return r(e,{notation:"bin",wordSize:t})}})}),Su=N("oct",["typed","format"],function(e){var t=e.typed,r=e.format;return t("oct",{"number | BigNumber":function(e){return r(e,{notation:"oct"})},"number | BigNumber, number | BigNumber":function(e,t){return r(e,{notation:"oct",wordSize:t})}})}),Cu=N("hex",["typed","format"],function(e){var t=e.typed,r=e.format;return t("hex",{"number | BigNumber":function(e){return r(e,{notation:"hex"})},"number | BigNumber, number | BigNumber":function(e,t){return r(e,{notation:"hex",wordSize:t})}})}),Mu=/\$([\w.]+)/g,Fu=N("print",["typed"],function(e){return(0,e.typed)("print",{"string, Object | Array":Ou,"string, Object | Array, number | Object":Ou})});function Ou(e,a,o){return e.replace(Mu,function(e,t){var r=t.split(".");for(void 0!==(i=a[r.shift()])&&i.isMatrix&&(i=i.toArray());r.length&&void 0!==i;)var n=r.shift(),i=n?i[n]:i+".";return void 0!==i?S(i)?i:Fe(i,o):e})}var Tu=N("to",["typed","matrix","concat"],function(e){var t=e.typed,r=e.matrix,e=e.concat;return t("to",{"Unit, Unit | string":function(e,t){return e.to(t)}},p({typed:t,matrix:r,concat:e})({Ds:!0}))}),_u=N("isPrime",["typed"],function(e){e=e.typed;return e("isPrime",{number:function(e){if(0*e!=0)return!1;if(e<=3)return 1<e;if(e%2==0||e%3==0)return!1;for(var t=5;t*t<=e;t+=6)if(e%t==0||e%(t+2)==0)return!1;return!0},BigNumber:function(t){if(0*t.toNumber()!=0)return!1;if(t.lte(3))return t.gt(1);if(t.mod(2).eq(0)||t.mod(3).eq(0))return!1;if(t.lt(Math.pow(2,32))){for(var e=t.toNumber(),r=5;r*r<=e;r+=6)if(e%r==0||e%(r+2)==0)return!1;return!0}for(var n=0,i=(t=new(t.constructor.clone({precision:2*t.toFixed(0).length}))(t)).sub(1);i.mod(2).eq(0);)i=i.div(2),n+=1;var a=null;if(t.lt("3317044064679887385961981"))a=[2,3,5,7,11,13,17,19,23,29,31,37,41].filter(function(e){return e<t});else for(var o=Math.min(t.toNumber()-2,Math.floor(2*Math.pow(t.toFixed(0).length*Math.log(10),2))),a=[],u=2;u<=o;u+=1)a.push(o);for(var s=0;s<a.length;s+=1){var c=a[s],c=function(e,t,r){for(var n=1;!t.eq(0);)t.mod(2).eq(0)?(t=t.div(2),e=e.mul(e).mod(r)):(t=t.sub(1),n=e.mul(n).mod(r));return n}(t.sub(t).add(c),i,t);if(!c.eq(1))for(var l=0,f=c;!f.eq(t.sub(1));l+=1,f=f.mul(f).mod(t))if(l===n-1)return!1}return!0},"Array | Matrix":e.referToSelf(function(t){return function(e){return ce(e,t)}})})}),Bu=N("numeric",["number","?bignumber","?fraction"],function(e){var t=e.number,r=e.bignumber,n=e.fraction,i={string:!0,number:!0,BigNumber:!0,Fraction:!0},a={number:function(e){return t(e)},BigNumber:r?function(e){return r(e)}:$o,Fraction:n?function(e){return n(e)}:Ho};return function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"number";if(void 0!==(2<arguments.length?arguments[2]:void 0))throw new SyntaxError("numeric() takes one or two arguments");var r=Se(e);if(!(r in i))throw new TypeError("Cannot convert "+e+' of type "'+r+'"; valid input types are '+Object.keys(i).join(", "));if(t in a)return t===r?e:a[t](e);throw new TypeError("Cannot convert "+e+' to type "'+t+'"; valid output types are '+Object.keys(a).join(", "))}}),ku="divideScalar",Iu=N(ku,["typed","numeric"],function(e){var t=e.typed;return e.numeric,t(ku,{"number, number":function(e,t){return e/t},"Complex, Complex":function(e,t){return e.div(t)},"BigNumber, BigNumber":function(e,t){return e.div(t)},"Fraction, Fraction":function(e,t){return e.div(t)},"Unit, number | Complex | Fraction | BigNumber | Unit":function(e,t){return e.divide(t)},"number | Fraction | Complex | BigNumber, Unit":function(e,t){return t.divideInto(e)}})}),zu=N("pow",["typed","config","identity","multiply","matrix","inv","fraction","number","Complex"],function(e){var t=e.typed,i=e.config,a=e.identity,o=e.multiply,r=e.matrix,u=e.inv,s=e.number,c=e.fraction,l=e.Complex;return t("pow",{"number, number":n,"Complex, Complex":function(e,t){return e.pow(t)},"BigNumber, BigNumber":function(e,t){return t.isInteger()||0<=e||i.predictable?e.pow(t):new l(e.toNumber(),0).pow(t.toNumber(),0)},"Fraction, Fraction":function(e,t){var r=e.pow(t);if(null!=r)return r;if(i.predictable)throw new Error("Result of pow is non-rational and cannot be expressed as a fraction");return n(e.valueOf(),t.valueOf())},"Array, number":f,"Array, BigNumber":function(e,t){return f(e,t.toNumber())},"Matrix, number":p,"Matrix, BigNumber":function(e,t){return p(e,t.toNumber())},"Unit, number | BigNumber":function(e,t){return e.pow(t)}});function n(e,t){if(i.predictable&&!w(t)&&e<0)try{var r=c(t),n=s(r);if((t===n||Math.abs((t-n)/t)<1e-14)&&r.d%2==1)return(r.n%2==0?1:-1)*Math.pow(-e,t)}catch(e){}return i.predictable&&(e<-1&&t===1/0||-1<e&&e<0&&t===-1/0)?NaN:w(t)||0<=e||i.predictable?Zi(e,t):e*e<1&&t===1/0||1<e*e&&t===-1/0?0:new l(e,0).pow(t,0)}function f(e,t){if(!w(t))throw new TypeError("For A^b, b must be an integer (value is "+t+")");var r=_(e);if(2!==r.length)throw new Error("For A^b, A must be 2 dimensional (A has "+r.length+" dimensions)");if(r[0]!==r[1])throw new Error("For A^b, A must be square (size is "+r[0]+"x"+r[1]+")");if(t<0)try{return f(u(e),-t)}catch(e){if("Cannot calculate inverse, determinant is zero"===e.message)throw new TypeError("For A^b, when A is not invertible, b must be a positive integer (value is "+t+")");throw e}for(var n=a(r[0]).valueOf(),i=e;1<=t;)1==(1&t)&&(n=o(i,n)),t>>=1,i=o(i,i);return n}function p(e,t){return r(f(e.valueOf(),t))}}),Ru="Number of decimals in function round must be an integer",qu=N("round",["typed","config","matrix","equalScalar","zeros","BigNumber","DenseMatrix"],function(e){var t=e.typed,n=e.config,i=e.matrix,a=e.equalScalar,o=e.zeros,r=e.BigNumber,e=e.DenseMatrix,u=oa({typed:t,equalScalar:a}),s=f({typed:t,DenseMatrix:e}),c=ua({typed:t});function l(e){return Math.abs(ge(e).exponent)}return t("round",{number:function(e){var t=Wi(e,l(n.epsilon));return Wi(De(e,t,n.epsilon)?t:e)},"number, number":function(e,t){var r=l(n.epsilon);if(r<=t)return Wi(e,t);r=Wi(e,r);return Wi(De(e,r,n.epsilon)?r:e,t)},"number, BigNumber":function(e,t){if(t.isInteger())return new r(e).toDecimalPlaces(t.toNumber());throw new TypeError(Ru)},Complex:function(e){return e.round()},"Complex, number":function(e,t){if(t%1)throw new TypeError(Ru);return e.round(t)},"Complex, BigNumber":function(e,t){if(!t.isInteger())throw new TypeError(Ru);t=t.toNumber();return e.round(t)},BigNumber:function(e){var t=new r(e).toDecimalPlaces(l(n.epsilon));return(si(e,t,n.epsilon)?t:e).toDecimalPlaces(0)},"BigNumber, BigNumber":function(e,t){if(!t.isInteger())throw new TypeError(Ru);var r=l(n.epsilon);if(r<=t)return e.toDecimalPlaces(t.toNumber());r=e.toDecimalPlaces(r);return(si(e,r,n.epsilon)?r:e).toDecimalPlaces(t.toNumber())},Fraction:function(e){return e.round()},"Fraction, number":function(e,t){if(t%1)throw new TypeError(Ru);return e.round(t)},"Fraction, BigNumber":function(e,t){if(t.isInteger())return e.round(t.toNumber());throw new TypeError(Ru)},"Unit, number, Unit":t.referToSelf(function(n){return function(e,t,r){e=e.toNumeric(r);return r.multiply(n(e,t))}}),"Unit, BigNumber, Unit":t.referToSelf(function(n){return function(e,t,r){return n(e,t.toNumber(),r)}}),"Unit, Unit":t.referToSelf(function(r){return function(e,t){return r(e,0,t)}}),"Array | Matrix, number, Unit":t.referToSelf(function(n){return function(e,t,r){return ce(e,function(e){return n(e,t,r)},!0)}}),"Array | Matrix, BigNumber, Unit":t.referToSelf(function(n){return function(e,t,r){return n(e,t.toNumber(),r)}}),"Array | Matrix, Unit":t.referToSelf(function(r){return function(e,t){return r(e,0,t)}}),"Array | Matrix":t.referToSelf(function(t){return function(e){return ce(e,t,!0)}}),"SparseMatrix, number | BigNumber":t.referToSelf(function(r){return function(e,t){return u(e,t,r,!1)}}),"DenseMatrix, number | BigNumber":t.referToSelf(function(r){return function(e,t){return c(e,t,r,!1)}}),"Array, number | BigNumber":t.referToSelf(function(r){return function(e,t){return c(i(e),t,r,!1).valueOf()}}),"number | Complex | BigNumber | Fraction, SparseMatrix":t.referToSelf(function(r){return function(e,t){return a(e,0)?o(t.size(),t.storage()):s(t,e,r,!0)}}),"number | Complex | BigNumber | Fraction, DenseMatrix":t.referToSelf(function(r){return function(e,t){return a(e,0)?o(t.size(),t.storage()):c(t,e,r,!0)}}),"number | Complex | BigNumber | Fraction, Array":t.referToSelf(function(r){return function(e,t){return c(i(t),e,r,!0).valueOf()}})})}),ju=N("log",["config","typed","divideScalar","Complex"],function(e){var t=e.typed,r=e.config,n=e.divideScalar,i=e.Complex;return t("log",{number:function(e){return 0<=e||r.predictable?Math.log(e):new i(e,0).log()},Complex:function(e){return e.log()},BigNumber:function(e){return!e.isNegative()||r.predictable?e.ln():new i(e.toNumber(),0).log()},"any, any":t.referToSelf(function(r){return function(e,t){return n(r(e),r(t))}})})}),Pu=N("log1p",["typed","config","divideScalar","log","Complex"],function(e){var t=e.typed,r=e.config,n=e.divideScalar,i=e.log,a=e.Complex;return t("log1p",{number:function(e){return-1<=e||r.predictable?u(e):o(new a(e,0))},Complex:o,BigNumber:function(e){var t=e.plus(1);return!t.isNegative()||r.predictable?t.ln():o(new a(e.toNumber(),0))},"Array | Matrix":t.referToSelf(function(t){return function(e){return ce(e,t)}}),"any, any":t.referToSelf(function(r){return function(e,t){return n(r(e),i(t))}})});function o(e){var t=e.re+1;return new a(Math.log(Math.sqrt(t*t+e.im*e.im)),Math.atan2(e.im,t))}}),Lu=N("nthRoots",["config","typed","divideScalar","Complex"],function(e){var t=e.typed,c=(e.config,e.divideScalar,e.Complex),l=[function(e){return new c(e,0)},function(e){return new c(0,e)},function(e){return new c(-e,0)},function(e){return new c(0,-e)}];function r(e,t){if(t<0)throw new Error("Root must be greater than zero");if(0===t)throw new Error("Root must be non-zero");if(t%1!=0)throw new Error("Root must be an integer");if(0===e||0===e.abs())return[new c(0,0)];var r,n="number"==typeof e;!n&&0!==e.re&&0!==e.im||(r=n?2*(e<0):0===e.im?2*(e.re<0):2*(e.im<0)+1);for(var i=e.arg(),n=e.abs(),a=[],o=Math.pow(n,1/t),u=0;u<t;u++){var s=(r+4*u)/t;s!==Math.round(s)?a.push(new c({r:o,phi:(i+2*Math.PI*u)/t})):a.push(l[s%4](o))}return a}return t("nthRoots",{Complex:function(e){return r(e,2)},"Complex, number":r})}),Uu=N("dotPow",["typed","equalScalar","matrix","pow","DenseMatrix","concat"],function(e){var t,r=e.typed,n=e.equalScalar,i=e.matrix,a=e.pow,o=e.DenseMatrix,e=e.concat,u=ga({typed:r}),s=lo({typed:r,DenseMatrix:o}),n=oa({typed:r,equalScalar:n}),o=f({typed:r,DenseMatrix:o}),i=p({typed:r,matrix:i,concat:e}),c={};for(t in a.signatures)!Object.prototype.hasOwnProperty.call(a.signatures,t)||t.includes("Matrix")||t.includes("Array")||(c[t]=a.signatures[t]);e=r(c);return r("dotPow",i({elop:e,SS:s,DS:u,Ss:n,sS:o}))}),$u=N("dotDivide",["typed","matrix","equalScalar","divideScalar","DenseMatrix","concat"],function(e){var t=e.typed,r=e.matrix,n=e.equalScalar,i=e.divideScalar,a=e.DenseMatrix,e=e.concat,o=va({typed:t,equalScalar:n}),u=ga({typed:t}),s=lo({typed:t,DenseMatrix:a}),n=oa({typed:t,equalScalar:n}),a=f({typed:t,DenseMatrix:a});return t("dotDivide",p({typed:t,matrix:r,concat:e})({elop:i,SS:s,DS:u,SD:o,Ss:n,sS:a}))});function Hu(e){var d=e.DenseMatrix;return function(e,t,r){e=e.size();if(2!==e.length)throw new RangeError("Matrix must be two dimensional (size: "+Fe(e)+")");var n=e[0];if(n!==e[1])throw new RangeError("Matrix must be square (size: "+Fe(e)+")");var i=[];if(P(t)){var e=t.size(),a=t._data;if(1===e.length){if(e[0]!==n)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var o=0;o<n;o++)i[o]=[a[o]];return new d({data:i,size:[n,1],datatype:t._datatype})}if(2===e.length){if(e[0]!==n||1!==e[1])throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");if(M(t)){if(r){for(var i=[],u=0;u<n;u++)i[u]=[a[u][0]];return new d({data:i,size:[n,1],datatype:t._datatype})}return t}if(B(t)){for(var s=0;s<n;s++)i[s]=[0];for(var c=t._values,l=t._index,e=t._ptr,f=e[1],p=e[0];p<f;p++)i[l[p]][0]=c[p];return new d({data:i,size:[n,1],datatype:t._datatype})}}throw new RangeError("Dimension mismatch. The right side has to be either 1- or 2-dimensional vector.")}if(b(t)){r=_(t);if(1===r.length){if(r[0]!==n)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var m=0;m<n;m++)i[m]=[t[m]];return new d({data:i,size:[n,1]})}if(2!==r.length)throw new RangeError("Dimension mismatch. The right side has to be either 1- or 2-dimensional vector.");if(r[0]!==n||1!==r[1])throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var h=0;h<n;h++)i[h]=[t[h][0]];return new d({data:i,size:[n,1]})}}}var Gu=N("lsolve",["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],function(e){var t=e.typed,r=e.matrix,w=e.divideScalar,N=e.multiplyScalar,D=e.subtractScalar,E=e.equalScalar,A=e.DenseMatrix,S=Hu({DenseMatrix:A});return t("lsolve",{"SparseMatrix, Array | Matrix":function(e,t){for(var r=S(e,t,!0)._data,t=e._size[0],n=e._size[1],i=e._values,a=e._index,o=e._ptr,u=[],s=0;s<n;s++){var c=r[s][0]||0;if(E(c,0))u[s]=[0];else{for(var l=0,f=[],p=[],m=o[s],h=o[s+1],d=m;d<h;d++){var y=a[d];y===s?l=i[d]:s<y&&(f.push(i[d]),p.push(y))}if(E(l,0))throw new Error("Linear system cannot be solved since matrix is singular");for(var v=w(c,l),g=0,x=p.length;g<x;g++){var b=p[g];r[b]=[D(r[b][0]||0,N(v,f[g]))]}u[s]=[v]}}return new A({data:u,size:[t,1]})},"DenseMatrix, Array | Matrix":n,"Array, Array | Matrix":function(e,t){return n(r(e),t).valueOf()}});function n(e,t){for(var r=(t=S(e,t,!0))._data,n=e._size[0],i=e._size[1],a=[],o=e._data,u=0;u<i;u++){var s=r[u][0]||0,c=void 0;if(E(s,0))c=0;else{var l=o[u][u];if(E(l,0))throw new Error("Linear system cannot be solved since matrix is singular");for(var c=w(s,l),f=u+1;f<n;f++)r[f]=[D(r[f][0]||0,N(c,o[f][u]))]}a[u]=[c]}return new A({data:a,size:[n,1]})}}),Vu=N("usolve",["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],function(e){var t=e.typed,r=e.matrix,b=e.divideScalar,w=e.multiplyScalar,N=e.subtractScalar,D=e.equalScalar,E=e.DenseMatrix,A=Hu({DenseMatrix:E});return t("usolve",{"SparseMatrix, Array | Matrix":function(e,t){for(var r=A(e,t,!0)._data,t=e._size[0],n=e._size[1],i=e._values,a=e._index,o=e._ptr,u=[],s=n-1;0<=s;s--){var c=r[s][0]||0;if(D(c,0))u[s]=[0];else{for(var l=0,f=[],p=[],m=o[s],h=o[s+1]-1;m<=h;h--){var d=a[h];d===s?l=i[h]:d<s&&(f.push(i[h]),p.push(d))}if(D(l,0))throw new Error("Linear system cannot be solved since matrix is singular");for(var y=b(c,l),v=0,g=p.length;v<g;v++){var x=p[v];r[x]=[N(r[x][0],w(y,f[v]))]}u[s]=[y]}}return new E({data:u,size:[t,1]})},"DenseMatrix, Array | Matrix":n,"Array, Array | Matrix":function(e,t){return n(r(e),t).valueOf()}});function n(e,t){for(var r=(t=A(e,t,!0))._data,t=e._size[0],n=e._size[1],i=[],a=e._data,o=n-1;0<=o;o--){var u=r[o][0]||0,s=void 0;if(D(u,0))s=0;else{var c=a[o][o];if(D(c,0))throw new Error("Linear system cannot be solved since matrix is singular");for(var s=b(u,c),l=o-1;0<=l;l--)r[l]=[N(r[l][0]||0,w(s,a[l][o]))]}i[o]=[s]}return new E({data:i,size:[t,1]})}}),Zu=N("lsolveAll",["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],function(e){var t=e.typed,r=e.matrix,S=e.divideScalar,C=e.multiplyScalar,M=e.subtractScalar,F=e.equalScalar,O=e.DenseMatrix,T=Hu({DenseMatrix:O});return t("lsolveAll",{"SparseMatrix, Array | Matrix":function(e,t){for(var r=[T(e,t,!0)._data.map(function(e){return e[0]})],n=e._size[0],i=e._size[1],a=e._values,o=e._index,u=e._ptr,s=0;s<i;s++)for(var c=r.length,l=0;l<c;l++){for(var f=r[l],p=[],m=[],h=u[s],d=u[s+1],y=0,v=h;v<d;v++){var g=o[v];g===s?y=a[v]:s<g&&(p.push(a[v]),m.push(g))}if(F(y,0))if(F(f[s],0)){if(0===l){var x=Me(f);x[s]=1;for(var b=0,w=m.length;b<w;b++){var N=m[b];x[N]=M(x[N],p[b])}r.push(x)}}else{if(0===l)return[];r.splice(l,1),--l,--c}else{f[s]=S(f[s],y);for(var D=0,E=m.length;D<E;D++){var A=m[D];f[A]=M(f[A],C(f[s],p[D]))}}}return r.map(function(e){return new O({data:e.map(function(e){return[e]}),size:[n,1]})})},"DenseMatrix, Array | Matrix":n,"Array, Array | Matrix":function(e,t){return n(r(e),t).map(function(e){return e.valueOf()})}});function n(e,t){for(var r=[T(e,t,!0)._data.map(function(e){return e[0]})],n=e._data,i=e._size[0],a=e._size[1],o=0;o<a;o++)for(var u=r.length,s=0;s<u;s++){var c=r[s];if(F(n[o][o],0))if(F(c[o],0)){if(0===s){for(var l=Me(c),f=o+(l[o]=1);f<a;f++)l[f]=M(l[f],n[f][o]);r.push(l)}}else{if(0===s)return[];r.splice(s,1),--s,--u}else{c[o]=S(c[o],n[o][o]);for(var p=o+1;p<a;p++)c[p]=M(c[p],C(c[o],n[p][o]))}}return r.map(function(e){return new O({data:e.map(function(e){return[e]}),size:[i,1]})})}}),Wu=N("usolveAll",["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],function(e){var t=e.typed,r=e.matrix,E=e.divideScalar,A=e.multiplyScalar,S=e.subtractScalar,C=e.equalScalar,M=e.DenseMatrix,F=Hu({DenseMatrix:M});return t("usolveAll",{"SparseMatrix, Array | Matrix":function(e,t){for(var r=[F(e,t,!0)._data.map(function(e){return e[0]})],n=e._size[0],t=e._size[1],i=e._values,a=e._index,o=e._ptr,u=t-1;0<=u;u--)for(var s=r.length,c=0;c<s;c++){for(var l=r[c],f=[],p=[],m=o[u],h=0,d=o[u+1]-1;m<=d;d--){var y=a[d];y===u?h=i[d]:y<u&&(f.push(i[d]),p.push(y))}if(C(h,0))if(C(l[u],0)){if(0===c){var v=Me(l);v[u]=1;for(var g=0,x=p.length;g<x;g++){var b=p[g];v[b]=S(v[b],f[g])}r.push(v)}}else{if(0===c)return[];r.splice(c,1),--c,--s}else{l[u]=E(l[u],h);for(var w=0,N=p.length;w<N;w++){var D=p[w];l[D]=S(l[D],A(l[u],f[w]))}}}return r.map(function(e){return new M({data:e.map(function(e){return[e]}),size:[n,1]})})},"DenseMatrix, Array | Matrix":n,"Array, Array | Matrix":function(e,t){return n(r(e),t).map(function(e){return e.valueOf()})}});function n(e,t){for(var r=[F(e,t,!0)._data.map(function(e){return e[0]})],n=e._data,i=e._size[0],a=e._size[1]-1;0<=a;a--)for(var o=r.length,u=0;u<o;u++){var s=r[u];if(C(n[a][a],0))if(C(s[a],0)){if(0===u){for(var c=Me(s),l=a-(c[a]=1);0<=l;l--)c[l]=S(c[l],n[l][a]);r.push(c)}}else{if(0===u)return[];r.splice(u,1),--u,--o}else{s[a]=E(s[a],n[a][a]);for(var f=a-1;0<=f;f--)s[f]=S(s[f],A(s[a],n[f][a]))}}return r.map(function(e){return new M({data:e.map(function(e){return[e]}),size:[i,1]})})}}),Yu=N("matAlgo08xS0Sid",["typed","equalScalar"],function(e){var O=e.typed,T=e.equalScalar;return function(e,t,r){var n=e._values,i=e._index,a=e._ptr,o=e._size,u=e._datatype||void 0===e._data?e._datatype:e.getDataType(),s=t._values,c=t._index,l=t._ptr,f=t._size,p=t._datatype||void 0===t._data?t._datatype:t.getDataType();if(o.length!==f.length)throw new k(o.length,f.length);if(o[0]!==f[0]||o[1]!==f[1])throw new RangeError("Dimension mismatch. Matrix A ("+o+") must match Matrix B ("+f+")");if(!n||!s)throw new Error("Cannot perform operation on Pattern Sparse Matrices");var m,f=o[0],h=o[1],d=T,y=0,v=r;"string"==typeof u&&u===p&&"mixed"!==u&&(d=O.find(T,[m=u,m]),y=O.convert(0,m),v=O.find(r,[m,m]));for(var g,x=[],b=[],w=[],N=[],D=[],E=0;E<h;E++){w[E]=b.length;for(var A=E+1,S=a[E],C=a[E+1],M=S;M<C;M++)D[g=i[M]]=A,N[g]=n[M],b.push(g);for(S=l[E],C=l[E+1],M=S;M<C;M++)D[g=c[M]]===A&&(N[g]=v(N[g],s[M]));for(M=w[E];M<b.length;){var F=N[g=b[M]];d(F,y)?b.splice(M,1):(x.push(F),M++)}}return w[h]=b.length,e.createSparseMatrix({values:x,index:b,ptr:w,size:[f,h],datatype:u===e._datatype&&p===t._datatype?m:void 0})}}),Ju=N("useMatrixForArrayScalar",["typed","matrix"],function(e){var t=e.typed,n=e.matrix;return{"Array, number":t.referTo("DenseMatrix, number",function(r){return function(e,t){return r(n(e),t).valueOf()}}),"Array, BigNumber":t.referTo("DenseMatrix, BigNumber",function(r){return function(e,t){return r(n(e),t).valueOf()}}),"number, Array":t.referTo("number, DenseMatrix",function(r){return function(e,t){return r(e,n(t)).valueOf()}}),"BigNumber, Array":t.referTo("BigNumber, DenseMatrix",function(r){return function(e,t){return r(e,n(t)).valueOf()}})}}),Xu=N("leftShift",["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],function(e){var t=e.typed,r=e.matrix,n=e.equalScalar,i=e.zeros,a=e.DenseMatrix,e=e.concat,o=Da({typed:t}),u=va({typed:t,equalScalar:n}),s=Yu({typed:t,equalScalar:n}),c=Aa({typed:t,DenseMatrix:a}),l=oa({typed:t,equalScalar:n}),f=ua({typed:t}),a=p({typed:t,matrix:r,concat:e}),e=Ju({typed:t,matrix:r});return t("leftShift",{"number, number":io,"BigNumber, BigNumber":Qa,"SparseMatrix, number | BigNumber":t.referToSelf(function(r){return function(e,t){return n(t,0)?e.clone():l(e,t,r,!1)}}),"DenseMatrix, number | BigNumber":t.referToSelf(function(r){return function(e,t){return n(t,0)?e.clone():f(e,t,r,!1)}}),"number | BigNumber, SparseMatrix":t.referToSelf(function(r){return function(e,t){return n(e,0)?i(t.size(),t.storage()):c(t,e,r,!0)}}),"number | BigNumber, DenseMatrix":t.referToSelf(function(r){return function(e,t){return n(e,0)?i(t.size(),t.storage()):f(t,e,r,!0)}})},e,a({SS:s,DS:o,SD:u}))}),Qu="rightArithShift",Ku=N(Qu,["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],function(e){var t=e.typed,r=e.matrix,n=e.equalScalar,i=e.zeros,a=e.DenseMatrix,e=e.concat,o=Da({typed:t}),u=va({typed:t,equalScalar:n}),s=Yu({typed:t,equalScalar:n}),c=Aa({typed:t,DenseMatrix:a}),l=oa({typed:t,equalScalar:n}),f=ua({typed:t}),a=p({typed:t,matrix:r,concat:e}),e=Ju({typed:t,matrix:r});return t(Qu,{"number, number":ao,"BigNumber, BigNumber":Ka,"SparseMatrix, number | BigNumber":t.referToSelf(function(r){return function(e,t){return n(t,0)?e.clone():l(e,t,r,!1)}}),"DenseMatrix, number | BigNumber":t.referToSelf(function(r){return function(e,t){return n(t,0)?e.clone():f(e,t,r,!1)}}),"number | BigNumber, SparseMatrix":t.referToSelf(function(r){return function(e,t){return n(e,0)?i(t.size(),t.storage()):c(t,e,r,!0)}}),"number | BigNumber, DenseMatrix":t.referToSelf(function(r){return function(e,t){return n(e,0)?i(t.size(),t.storage()):f(t,e,r,!0)}})},e,a({SS:s,DS:o,SD:u}))}),es="rightLogShift",ts=N(es,["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],function(e){var t=e.typed,r=e.matrix,n=e.equalScalar,i=e.zeros,a=e.DenseMatrix,e=e.concat,o=Da({typed:t}),u=va({typed:t,equalScalar:n}),s=Yu({typed:t,equalScalar:n}),c=Aa({typed:t,DenseMatrix:a}),l=oa({typed:t,equalScalar:n}),f=ua({typed:t}),a=p({typed:t,matrix:r,concat:e}),e=Ju({typed:t,matrix:r});return t(es,{"number, number":oo,"SparseMatrix, number | BigNumber":t.referToSelf(function(r){return function(e,t){return n(t,0)?e.clone():l(e,t,r,!1)}}),"DenseMatrix, number | BigNumber":t.referToSelf(function(r){return function(e,t){return n(t,0)?e.clone():f(e,t,r,!1)}}),"number | BigNumber, SparseMatrix":t.referToSelf(function(r){return function(e,t){return n(e,0)?i(t.size(),t.storage()):c(t,e,r,!0)}}),"number | BigNumber, DenseMatrix":t.referToSelf(function(r){return function(e,t){return n(e,0)?i(t.size(),t.storage()):f(t,e,r,!0)}})},e,a({SS:s,DS:o,SD:u}))}),rs=N("and",["typed","matrix","equalScalar","zeros","not","concat"],function(e){var t=e.typed,n=e.matrix,r=e.equalScalar,i=e.zeros,a=e.not,e=e.concat,o=va({typed:t,equalScalar:r}),u=Oa({typed:t,equalScalar:r}),s=oa({typed:t,equalScalar:r}),c=ua({typed:t}),r=p({typed:t,matrix:n,concat:e});return t("and",{"number, number":bo,"Complex, Complex":function(e,t){return!(0===e.re&&0===e.im||0===t.re&&0===t.im)},"BigNumber, BigNumber":function(e,t){return!(e.isZero()||t.isZero()||e.isNaN()||t.isNaN())},"Unit, Unit":t.referToSelf(function(r){return function(e,t){return r(e.value||0,t.value||0)}}),"SparseMatrix, any":t.referToSelf(function(r){return function(e,t){return a(t)?i(e.size(),e.storage()):s(e,t,r,!1)}}),"DenseMatrix, any":t.referToSelf(function(r){return function(e,t){return a(t)?i(e.size(),e.storage()):c(e,t,r,!1)}}),"any, SparseMatrix":t.referToSelf(function(r){return function(e,t){return a(e)?i(e.size(),e.storage()):s(t,e,r,!0)}}),"any, DenseMatrix":t.referToSelf(function(r){return function(e,t){return a(e)?i(e.size(),e.storage()):c(t,e,r,!0)}}),"Array, any":t.referToSelf(function(r){return function(e,t){return r(n(e),t).valueOf()}}),"any, Array":t.referToSelf(function(r){return function(e,t){return r(e,n(t)).valueOf()}})},r({SS:u,DS:o}))}),ns="compare",is=N(ns,["typed","config","matrix","equalScalar","BigNumber","Fraction","DenseMatrix","concat"],function(e){var t=e.typed,r=e.config,n=e.equalScalar,i=e.matrix,a=e.BigNumber,o=e.Fraction,u=e.DenseMatrix,e=e.concat,s=ga({typed:t}),n=xa({typed:t,equalScalar:n}),u=f({typed:t,DenseMatrix:u}),i=p({typed:t,matrix:i,concat:e}),e=ci({typed:t});return t(ns,as({typed:t,config:r}),{"boolean, boolean":function(e,t){return e===t?0:t<e?1:-1},"BigNumber, BigNumber":function(e,t){return si(e,t,r.epsilon)?new a(0):new a(e.cmp(t))},"Fraction, Fraction":function(e,t){return new o(e.compare(t))},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},e,i({SS:n,DS:s,Ss:u}))}),as=N(ns,["typed","config"],function(e){var t=e.typed,r=e.config;return t(ns,{"number, number":function(e,t){return De(e,t,r.epsilon)?0:t<e?1:-1}})}),os=Mh(1880),us="compareNatural",ss=N(us,["typed","compare"],function(e){var t=e.typed,h=e.compare,d=h.signatures["boolean,boolean"];return t(us,{"any, any":function e(t,r){var n,i=Se(t),a=Se(r);if(!("number"!==i&&"BigNumber"!==i&&"Fraction"!==i||"number"!==a&&"BigNumber"!==a&&"Fraction"!==a))return"0"!==(n=h(t,r)).toString()?0<n?1:-1:os(i,a);var o=["Array","DenseMatrix","SparseMatrix"];if(o.includes(i)||o.includes(a))return 0!==(n=function e(t,r,n){return B(r)&&B(n)?y(t,r.toJSON().values,n.toJSON().values):B(r)?e(t,r.toArray(),n):B(n)?e(t,r,n.toArray()):M(r)?e(t,r.toJSON().data,n):M(n)?e(t,r,n.toJSON().data):Array.isArray(r)?Array.isArray(n)?y(t,r,n):e(t,r,[n]):e(t,[r],n)}(e,t,r))?n:os(i,a);if(i!==a)return os(i,a);if("Complex"===i)return t.re>r.re?1:t.re<r.re?-1:t.im>r.im?1:t.im<r.im?-1:0;if("Unit"===i)return t.equalBase(r)?e(t.value,r.value):y(e,t.formatUnits(),r.formatUnits());if("boolean"===i)return d(t,r);if("string"===i)return os(t,r);if("Object"===i){var u=e,s=t,c=r,l=Object.keys(s),f=Object.keys(c),o=(l.sort(os),f.sort(os),y(u,l,f));if(0!==o)return o;for(var p=0;p<l.length;p++){var m=u(s[l[p]],c[f[p]]);if(0!==m)return m}return 0}if("null"===i)return 0;if("undefined"===i)return 0;throw new TypeError('Unsupported type of value "'+i+'"')}});function y(e,t,r){for(var n=0,i=Math.min(t.length,r.length);n<i;n++){var a=e(t[n],r[n]);if(0!==a)return a}return t.length>r.length?1:t.length<r.length?-1:0}}),cs="compareText",ls=(pn.signature="any, any",N(cs,["typed","matrix","concat"],function(e){var t=e.typed,r=e.matrix,e=e.concat,r=p({typed:t,matrix:r,concat:e});return t(cs,pn,r({elop:pn,Ds:!0}))})),fs="equal",ps=N(fs,["typed","matrix","equalScalar","DenseMatrix","concat"],function(e){var t=e.typed,r=e.matrix,n=e.equalScalar,i=e.DenseMatrix,e=e.concat,a=ga({typed:t}),o=lo({typed:t,DenseMatrix:i}),i=f({typed:t,DenseMatrix:i}),r=p({typed:t,matrix:r,concat:e});return t(fs,ms({typed:t,equalScalar:n}),r({elop:n,SS:o,DS:a,Ss:i}))}),ms=N(fs,["typed","equalScalar"],function(e){var t=e.typed,r=e.equalScalar;return t(fs,{"any, any":function(e,t){return null===e?null===t:null===t?null===e:void 0===e?void 0===t:void 0===t?void 0===e:r(e,t)}})}),hs=N("equalText",["typed","compareText","isZero"],function(e){var t=e.typed,r=e.compareText,n=e.isZero;return t("equalText",{"any, any":function(e,t){return n(r(e,t))}})}),ds="smaller",ys=N(ds,["typed","config","matrix","DenseMatrix","concat"],function(e){var t=e.typed,r=e.config,n=e.matrix,i=e.DenseMatrix,e=e.concat,a=ga({typed:t}),o=lo({typed:t,DenseMatrix:i}),i=f({typed:t,DenseMatrix:i}),n=p({typed:t,matrix:n,concat:e}),e=ci({typed:t});return t(ds,vs({typed:t,config:r}),{"boolean, boolean":function(e,t){return e<t},"BigNumber, BigNumber":function(e,t){return e.lt(t)&&!si(e,t,r.epsilon)},"Fraction, Fraction":function(e,t){return-1===e.compare(t)},"Complex, Complex":function(e,t){throw new TypeError("No ordering relation is defined for complex numbers")}},e,n({SS:o,DS:a,Ss:i}))}),vs=N(ds,["typed","config"],function(e){var t=e.typed,r=e.config;return t(ds,{"number, number":function(e,t){return e<t&&!De(e,t,r.epsilon)}})}),gs="smallerEq",xs=N(gs,["typed","config","matrix","DenseMatrix","concat"],function(e){var t=e.typed,r=e.config,n=e.matrix,i=e.DenseMatrix,e=e.concat,a=ga({typed:t}),o=lo({typed:t,DenseMatrix:i}),i=f({typed:t,DenseMatrix:i}),n=p({typed:t,matrix:n,concat:e}),e=ci({typed:t});return t(gs,bs({typed:t,config:r}),{"boolean, boolean":function(e,t){return e<=t},"BigNumber, BigNumber":function(e,t){return e.lte(t)||si(e,t,r.epsilon)},"Fraction, Fraction":function(e,t){return 1!==e.compare(t)},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},e,n({SS:o,DS:a,Ss:i}))}),bs=N(gs,["typed","config"],function(e){var t=e.typed,r=e.config;return t(gs,{"number, number":function(e,t){return e<=t||De(e,t,r.epsilon)}})}),ws="larger",Ns=N(ws,["typed","config","matrix","DenseMatrix","concat"],function(e){var t=e.typed,r=e.config,n=e.matrix,i=e.DenseMatrix,e=e.concat,a=ga({typed:t}),o=lo({typed:t,DenseMatrix:i}),i=f({typed:t,DenseMatrix:i}),n=p({typed:t,matrix:n,concat:e}),e=ci({typed:t});return t(ws,Ds({typed:t,config:r}),{"boolean, boolean":function(e,t){return t<e},"BigNumber, BigNumber":function(e,t){return e.gt(t)&&!si(e,t,r.epsilon)},"Fraction, Fraction":function(e,t){return 1===e.compare(t)},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},e,n({SS:o,DS:a,Ss:i}))}),Ds=N(ws,["typed","config"],function(e){var t=e.typed,r=e.config;return t(ws,{"number, number":function(e,t){return t<e&&!De(e,t,r.epsilon)}})}),Es="largerEq",As=N(Es,["typed","config","matrix","DenseMatrix","concat"],function(e){var t=e.typed,r=e.config,n=e.matrix,i=e.DenseMatrix,e=e.concat,a=ga({typed:t}),o=lo({typed:t,DenseMatrix:i}),i=f({typed:t,DenseMatrix:i}),n=p({typed:t,matrix:n,concat:e}),e=ci({typed:t});return t(Es,Ss({typed:t,config:r}),{"boolean, boolean":function(e,t){return t<=e},"BigNumber, BigNumber":function(e,t){return e.gte(t)||si(e,t,r.epsilon)},"Fraction, Fraction":function(e,t){return-1!==e.compare(t)},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},e,n({SS:o,DS:a,Ss:i}))}),Ss=N(Es,["typed","config"],function(e){var t=e.typed,r=e.config;return t(Es,{"number, number":function(e,t){return t<=e||De(e,t,r.epsilon)}})}),Cs=N("deepEqual",["typed","equal"],function(e){var t=e.typed,a=e.equal;return t("deepEqual",{"any, any":function(e,t){return function e(t,r){if(Array.isArray(t)){if(Array.isArray(r)){var n=t.length;if(n!==r.length)return!1;for(var i=0;i<n;i++)if(!e(t[i],r[i]))return!1;return!0}return!1}return!Array.isArray(r)&&a(t,r)}(e.valueOf(),t.valueOf())}})}),Ms="unequal",Fs=N(Ms,["typed","config","equalScalar","matrix","DenseMatrix","concat"],function(e){var t=e.typed,r=(e.config,e.equalScalar),n=e.matrix,i=e.DenseMatrix,e=e.concat,a=ga({typed:t}),o=lo({typed:t,DenseMatrix:i}),i=f({typed:t,DenseMatrix:i}),n=p({typed:t,matrix:n,concat:e});return t(Ms,Os({typed:t,equalScalar:r}),n({elop:function(e,t){return!r(e,t)},SS:o,DS:a,Ss:i}))}),Os=N(Ms,["typed","equalScalar"],function(e){var t=e.typed,r=e.equalScalar;return t(Ms,{"any, any":function(e,t){return null===e?null!==t:null===t?null!==e:void 0===e?void 0!==t:void 0===t?void 0!==e:!r(e,t)}})}),Ts="partitionSelect",_s=N(Ts,["typed","isNumeric","isNaN","compare"],function(e){function n(e,t){return-r(e,t)}var t=e.typed,l=e.isNumeric,f=e.isNaN,r=e.compare,i=r;return t(Ts,{"Array | Matrix, number":function(e,t){return a(e,t,i)},"Array | Matrix, number, string":function(e,t,r){if("asc"===r)return a(e,t,i);if("desc"===r)return a(e,t,n);throw new Error('Compare string must be "asc" or "desc"')},"Array | Matrix, number, function":a});function a(e,t,r){if(!w(t)||t<0)throw new Error("k must be a non-negative integer");if(P(e)){if(1<e.size().length)throw new Error("Only one dimensional matrices supported");return o(e.valueOf(),t,r)}if(Array.isArray(e))return o(e,t,r)}function o(e,t,r){if(t>=e.length)throw new Error("k out of bounds");for(var n=0;n<e.length;n++)if(l(e[n])&&f(e[n]))return e[n];for(var i=0,a=e.length-1;i<a;){for(var o,u=i,s=a,c=e[Math.floor(Math.random()*(a-i+1))+i];u<s;)0<=r(e[u],c)?(o=e[s],e[s]=e[u],e[u]=o,--s):++u;0<r(e[u],c)&&--u,t<=u?a=u:i=u+1}return e[t]}}),Bs=N("sort",["typed","matrix","compare","compareNatural"],function(e){function t(e,t){return-i(e,t)}var r=e.typed,n=e.matrix,i=e.compare,a=e.compareNatural,o=i;return r("sort",{Array:function(e){return s(e),e.sort(o)},Matrix:function(e){return c(e),n(e.toArray().sort(o),e.storage())},"Array, function":function(e,t){return s(e),e.sort(t)},"Matrix, function":function(e,t){return c(e),n(e.toArray().sort(t),e.storage())},"Array, string":function(e,t){return s(e),e.sort(u(t))},"Matrix, string":function(e,t){return c(e),n(e.toArray().sort(u(t)),e.storage())}});function u(e){if("asc"===e)return o;if("desc"===e)return t;if("natural"===e)return a;throw new Error('String "asc", "desc", or "natural" expected')}function s(e){if(1!==_(e).length)throw new Error("One dimensional array expected")}function c(e){if(1!==e.size().length)throw new Error("One dimensional matrix expected")}}),ks=N("max",["typed","config","numeric","larger"],function(e){var t=e.typed,n=e.config,i=e.numeric,a=e.larger;return t("max",{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(e,t){return $n(e,t.valueOf(),r)},"...":function(e){if(Ln(e))throw new TypeError("Scalar values expected in function max");return o(e)}});function r(e,t){try{return a(e,t)?e:t}catch(e){throw Nu(e,"max",t)}}function o(e){var r;if(Un(e,function(t){try{isNaN(t)&&"number"==typeof t?r=NaN:void 0!==r&&!a(t,r)||(r=t)}catch(e){throw Nu(e,"max",t)}}),void 0===r)throw new Error("Cannot calculate max of an empty array");return r="string"==typeof r?i(r,n.number):r}}),Is=N("min",["typed","config","numeric","smaller"],function(e){var t=e.typed,n=e.config,i=e.numeric,a=e.smaller;return t("min",{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(e,t){return $n(e,t.valueOf(),r)},"...":function(e){if(Ln(e))throw new TypeError("Scalar values expected in function min");return o(e)}});function r(e,t){try{return a(e,t)?e:t}catch(e){throw Nu(e,"min",t)}}function o(e){var r;if(Un(e,function(t){try{isNaN(t)&&"number"==typeof t?r=NaN:void 0!==r&&!a(t,r)||(r=t)}catch(e){throw Nu(e,"min",t)}}),void 0===r)throw new Error("Cannot calculate min of an empty array");return r="string"==typeof r?i(r,n.number):r}}),zs=N("ImmutableDenseMatrix",["smaller","DenseMatrix"],function(e){var r=e.smaller,n=e.DenseMatrix;function i(e,t){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if(t&&!S(t))throw new Error("Invalid datatype: "+t);if(P(e)||b(e)){var r=new n(e,t);this._data=r._data,this._size=r._size,this._datatype=r._datatype,this._min=null,this._max=null}else if(e&&b(e.data)&&b(e.size))this._data=e.data,this._size=e.size,this._datatype=e.datatype,this._min=void 0!==e.min?e.min:null,this._max=void 0!==e.max?e.max:null;else{if(e)throw new TypeError("Unsupported type of data ("+Se(e)+")");this._data=[],this._size=[0],this._datatype=t,this._min=null,this._max=null}}return(i.prototype=new n).type="ImmutableDenseMatrix",i.prototype.isImmutableDenseMatrix=!0,i.prototype.subset=function(e){switch(arguments.length){case 1:var t=n.prototype.subset.call(this,e);return P(t)?new i({data:t._data,size:t._size,datatype:t._datatype}):t;case 2:case 3:throw new Error("Cannot invoke set subset on an Immutable Matrix instance");default:throw new SyntaxError("Wrong number of arguments")}},i.prototype.set=function(){throw new Error("Cannot invoke set on an Immutable Matrix instance")},i.prototype.resize=function(){throw new Error("Cannot invoke resize on an Immutable Matrix instance")},i.prototype.reshape=function(){throw new Error("Cannot invoke reshape on an Immutable Matrix instance")},i.prototype.clone=function(){return new i({data:Ce(this._data),size:Ce(this._size),datatype:this._datatype})},i.prototype.toJSON=function(){return{mathjs:"ImmutableDenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},i.fromJSON=function(e){return new i(e)},i.prototype.swapRows=function(){throw new Error("Cannot invoke swapRows on an Immutable Matrix instance")},i.prototype.min=function(){var t;return null===this._min&&(t=null,this.forEach(function(e){null!==t&&!r(e,t)||(t=e)}),this._min=null!==t?t:void 0),this._min},i.prototype.max=function(){var t;return null===this._max&&(t=null,this.forEach(function(e){null!==t&&!r(t,e)||(t=e)}),this._max=null!==t?t:void 0),this._max},i},{isClass:!0}),Rs=N("Index",["ImmutableDenseMatrix","getMatrixDataType"],function(e){var n=e.ImmutableDenseMatrix,s=e.getMatrixDataType;function c(e){if(!(this instanceof c))throw new SyntaxError("Constructor must be called with the new operator");this._dimensions=[],this._sourceSize=[],this._isScalar=!0;for(var t=0,r=arguments.length;t<r;t++){var n=arguments[t],i=b(n),a=P(n),o=null;if(I(n))this._dimensions.push(n),this._isScalar=!1;else if(i||a){var u=void 0,i=("boolean"===s(n)?(i&&(u=l(qs(n).valueOf())),a&&(u=l(qs(n._data).valueOf())),o=n.valueOf().length):u=l(n.valueOf()),this._dimensions.push(u),u.size());1===i.length&&1===i[0]&&null===o||(this._isScalar=!1)}else if("number"==typeof n)this._dimensions.push(l([n]));else{if("string"!=typeof n)throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range");this._dimensions.push(n)}this._sourceSize.push(o)}}function l(e){for(var t=0,r=e.length;t<r;t++)if("number"!=typeof e[t]||!w(e[t]))throw new TypeError("Index parameters must be positive integer numbers");return new n(e)}return c.prototype.type="Index",c.prototype.isIndex=!0,c.prototype.clone=function(){var e=new c;return e._dimensions=Ce(this._dimensions),e._isScalar=this._isScalar,e._sourceSize=this._sourceSize,e},c.create=function(e){var t=new c;return c.apply(t,e),t},c.prototype.size=function(){for(var e=[],t=0,r=this._dimensions.length;t<r;t++){var n=this._dimensions[t];e[t]="string"==typeof n?1:n.size()[0]}return e},c.prototype.max=function(){for(var e=[],t=0,r=this._dimensions.length;t<r;t++){var n=this._dimensions[t];e[t]="string"==typeof n?n:n.max()}return e},c.prototype.min=function(){for(var e=[],t=0,r=this._dimensions.length;t<r;t++){var n=this._dimensions[t];e[t]="string"==typeof n?n:n.min()}return e},c.prototype.forEach=function(e){for(var t=0,r=this._dimensions.length;t<r;t++)e(this._dimensions[t],t,this)},c.prototype.dimension=function(e){return this._dimensions[e]||null},c.prototype.isObjectProperty=function(){return 1===this._dimensions.length&&"string"==typeof this._dimensions[0]},c.prototype.getObjectProperty=function(){return this.isObjectProperty()?this._dimensions[0]:null},c.prototype.isScalar=function(){return this._isScalar},c.prototype.valueOf=c.prototype.toArray=function(){for(var e=[],t=0,r=this._dimensions.length;t<r;t++){var n=this._dimensions[t];e.push("string"==typeof n?n:n.toArray())}return e},c.prototype.toString=function(){for(var e=[],t=0,r=this._dimensions.length;t<r;t++){var n=this._dimensions[t];"string"==typeof n?e.push(JSON.stringify(n)):e.push(n.toString())}return"["+e.join(", ")+"]"},c.prototype.toJSON=function(){return{mathjs:"Index",dimensions:this._dimensions}},c.fromJSON=function(e){return c.create(e.dimensions)},c},{isClass:!0});function qs(e){var r=[];return e.forEach(function(e,t){e&&r.push(t)}),r}var js=N("FibonacciHeap",["smaller","larger"],function(e){var f=e.smaller,p=e.larger,m=1/Math.log((1+Math.sqrt(5))/2);function t(){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");this._minimum=null,this._size=0}function i(e,t,r){t.left.right=t.right,t.right.left=t.left,r.degree--,r.child===t&&(r.child=t.right),0===r.degree&&(r.child=null),t.left=e,t.right=e.right,((e.right=t).right.left=t).parent=null,t.mark=!1}t.prototype.type="FibonacciHeap",t.prototype.isFibonacciHeap=!0,t.prototype.insert=function(e,t){var r,t={key:e,value:t,degree:0};return this._minimum?(r=this._minimum,t.left=r,t.right=r.right,(r.right=t).right.left=t,f(e,r.key)&&(this._minimum=t)):((t.left=t).right=t,this._minimum=t),this._size++,t},t.prototype.size=function(){return this._size},t.prototype.clear=function(){this._minimum=null,this._size=0},t.prototype.isEmpty=function(){return 0===this._size},t.prototype.extractMinimum=function(){var e=this._minimum;if(null===e)return e;for(var t=this._minimum,r=e.degree,n=e.child;0<r;){var i=n.right;n.left.right=n.right,n.right.left=n.left,n.left=t,n.right=t.right,((t.right=n).right.left=n).parent=null,n=i,r--}return e.left.right=e.right,e.right.left=e.left,t=e===e.right?null:function(e,t){var r=Math.floor(Math.log(t)*m)+1,n=new Array(r),i=0;if(u=e)for(i++,u=u.right;u!==e;)i++,u=u.right;for(;0<i;){for(var a,o,u,s=u.degree,c=u.right;o=n[s];)p(u.key,o.key)&&(a=o,o=u,u=a),h(o,u),n[s]=null,s++;n[s]=u,u=c,i--}e=null;for(var l=0;l<r;l++)(o=n[l])&&(e?(o.left.right=o.right,o.right.left=o.left,o.left=e,o.right=e.right,(e.right=o).right.left=o,f(o.key,e.key)&&(e=o)):e=o);return e}(t=e.right,this._size),this._size--,this._minimum=t,e},t.prototype.remove=function(e){var t,r;this._minimum=(t=this._minimum,(e=e).key=-1,(r=e.parent)&&f(e.key,r.key)&&(i(t,e,r),function e(t,r){var n=r.parent;n&&(r.mark?(i(t,r,n),e(n)):r.mark=!0)}(t,r)),t=f(e.key,t.key)?e:t),this.extractMinimum()};var h=function(e,t){e.left.right=e.right,e.right.left=e.left,(e.parent=t).child?(e.left=t.child,e.right=t.child.right,(t.child.right=e).right.left=e):((t.child=e).right=e).left=e,t.degree++,e.mark=!1};return t},{isClass:!0}),Ps=N("Spa",["addScalar","equalScalar","FibonacciHeap"],function(e){var n=e.addScalar,c=e.equalScalar,t=e.FibonacciHeap;function r(){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");this._values=[],this._heap=new t}return r.prototype.type="Spa",r.prototype.isSpa=!0,r.prototype.set=function(e,t){this._values[e]?this._values[e].value=t:(t=this._heap.insert(e,t),this._values[e]=t)},r.prototype.get=function(e){e=this._values[e];return e?e.value:0},r.prototype.accumulate=function(e,t){var r=this._values[e];r?r.value=n(r.value,t):(r=this._heap.insert(e,t),this._values[e]=r)},r.prototype.forEach=function(e,t,r){var n=this._heap,i=this._values,a=[],o=n.extractMinimum();for(o&&a.push(o);o&&o.key<=t;)o.key>=e&&(c(o.value,0)||r(o.key,o.value,this)),(o=n.extractMinimum())&&a.push(o);for(var u=0;u<a.length;u++){var s=a[u];i[(o=n.insert(s.key,s.value)).key]=o}},r.prototype.swap=function(e,t){var r=this._values[e],n=this._values[t];!r&&n?(r=this._heap.insert(e,n.value),this._heap.remove(n),this._values[e]=r,this._values[t]=void 0):r&&!n?(n=this._heap.insert(t,r.value),this._heap.remove(r),this._values[t]=n,this._values[e]=void 0):r&&n&&(t=r.value,r.value=n.value,n.value=t)},r},{isClass:!0}),Ls=(Mh(375),In(function(e){return new e(1).exp()},{hasher:Gs})),Us=In(function(e){return new e(1).plus(new e(5).sqrt()).div(2)},{hasher:Gs}),$s=In(function(e){return e.acos(-1)},{hasher:Gs}),Hs=In(function(e){return $s(e).times(2)},{hasher:Gs});function Gs(e){return e[0].precision}function Vs(t,e){var r,n=Object.keys(t);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)),n}function Zs(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Vs(Object(r),!0).forEach(function(e){A(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Vs(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}var Ws=N("Unit",["?on","config","addScalar","subtractScalar","multiplyScalar","divideScalar","pow","abs","fix","round","equal","isNumeric","format","number","Complex","BigNumber","Fraction"],function(e){var h,d,D,t=e.on,y=e.config,s=e.addScalar,c=e.subtractScalar,l=e.multiplyScalar,f=e.divideScalar,p=e.pow,m=e.abs,z=e.fix,R=e.round,v=e.equal,q=e.isNumeric,j=e.format,P=e.number,L=e.Complex,g=e.BigNumber,x=e.Fraction,U=P;function E(e,t){if(!(this instanceof E))throw new Error("Constructor must be called with the new operator");if(null!=e&&!q(e)&&!Oe(e))throw new TypeError("First parameter in Unit constructor must be number, BigNumber, Fraction, Complex, or undefined");if(this.fixPrefix=!1,this.skipAutomaticSimplification=!0,void 0===t)this.units=[],this.dimensions=F.map(function(e){return 0});else if("string"==typeof t){var r=E.parse(t);this.units=r.units,this.dimensions=r.dimensions}else{if(!Z(t)||null!==t.value)throw new TypeError("Second parameter in Unit constructor must be a string or valueless Unit");this.fixPrefix=t.fixPrefix,this.skipAutomaticSimplification=t.skipAutomaticSimplification,this.dimensions=t.dimensions.slice(0),this.units=t.units.map(function(e){return an({},e)})}this.value=this._normalize(e)}function b(){for(;" "===D||"\t"===D;)w()}function A(e){return"0"<=e&&e<="9"}function w(){d++,D=h.charAt(d)}function n(e){d=e,D=h.charAt(d)}function $(){var e="",t=d;if("+"===D?w():"-"===D&&(e+=D,w()),!("0"<=D&&D<="9"||"."===D))return n(t),null;if("."===D){if(e+=D,w(),!A(D))return n(t),null}else{for(;A(D);)e+=D,w();"."===D&&(e+=D,w())}for(;A(D);)e+=D,w();if("E"===D||"e"===D){var t="",r=d;if(t+=D,w(),"+"!==D&&"-"!==D||(t+=D,w()),!A(D))return n(r),e;for(e+=t;A(D);)e+=D,w()}return e}function N(e){return D===e&&(w(),e)}Object.defineProperty(E,"name",{value:"Unit"}),(E.prototype.constructor=E).prototype.type="Unit",E.prototype.isUnit=!0,E.parse=function(e,t){if(t=t||{},d=-1,D="","string"!=typeof(h=e))throw new TypeError("Invalid argument in Unit.parse, string expected");var r=new E,n=1,i=!(r.units=[]),a=(w(),b(),$()),o=null;if(a){if("BigNumber"===y.number)o=new g(a);else if("Fraction"===y.number)try{o=new x(a)}catch(e){o=parseFloat(a)}else o=parseFloat(a);b(),N("*")?(n=1,i=!0):N("/")&&(n=-1,i=!0)}for(var u=[],s=1;;){for(b();"("===D;)u.push(n),s*=n,n=1,w(),b();if(!D)break;var c=D;if(null===(m=function(){for(var e="";A(D)||E.isValidAlpha(D);)e+=D,w();var t=e.charAt(0);return E.isValidAlpha(t)?e:null}()))throw new SyntaxError('Unexpected "'+c+'" in "'+h+'" at index '+d.toString());var l=S(m);if(null===l)throw new SyntaxError('Unit "'+m+'" not found.');var f=n*s;if(b(),N("^")){b();c=$();if(null===c)throw new SyntaxError('In "'+e+'", "^" must be followed by a floating-point number');f*=c}r.units.push({unit:l.unit,prefix:l.prefix,power:f});for(var p=0;p<F.length;p++)r.dimensions[p]+=(l.unit.dimensions[p]||0)*f;for(b();")"===D;){if(0===u.length)throw new SyntaxError('Unmatched ")" in "'+h+'" at index '+d.toString());s/=u.pop(),w(),b()}var m,i=!1;N("*")?(n=1,i=!0):N("/")?(n=-1,i=!0):n=1,l.unit.base&&(m=l.unit.base.key,_.auto[m]={unit:l.unit,prefix:l.prefix})}if(b(),D)throw new SyntaxError('Could not parse: "'+e+'"');if(i)throw new SyntaxError('Trailing characters: "'+e+'"');if(0!==u.length)throw new SyntaxError('Unmatched "(" in "'+h+'"');if(0!==r.units.length||t.allowNoUnits)return r.value=void 0!==o?r._normalize(o):null,r;throw new SyntaxError('"'+e+'" contains no units')},E.prototype.clone=function(){var e=new E;e.fixPrefix=this.fixPrefix,e.skipAutomaticSimplification=this.skipAutomaticSimplification,e.value=Ce(this.value),e.dimensions=this.dimensions.slice(0),e.units=[];for(var t=0;t<this.units.length;t++)for(var r in e.units[t]={},this.units[t])se(this.units[t],r)&&(e.units[t][r]=this.units[t][r]);return e},E.prototype.valueType=function(){return Se(this.value)},E.prototype._isDerived=function(){return 0!==this.units.length&&(1<this.units.length||1e-15<Math.abs(this.units[0].power-1))},E.prototype._normalize=function(e){if(null==e||0===this.units.length)return e;for(var t=e,r=E._getNumberConverter(Se(e)),n=0;n<this.units.length;n++)var i=r(this.units[n].unit.value),a=r(this.units[n].prefix.value),o=r(this.units[n].power),t=l(t,p(l(i,a),o));return t},E.prototype._denormalize=function(e,t){if(null==e||0===this.units.length)return e;for(var r=e,n=E._getNumberConverter(Se(e)),i=0;i<this.units.length;i++)var a=n(this.units[i].unit.value),o=n(this.units[i].prefix.value),u=n(this.units[i].power),r=f(r,p(l(a,o),u));return r};var S=In(function(e){var t,r;if(se(T,e))return{unit:t=T[e],prefix:t.prefixes[""]};for(r in T)if(se(T,r)&&(n=e,o=r,i=void 0,a=void 0,i=n.length-o.length,a=n.length,n.substring(i,a)===o)){var n=T[r],i=e.length-r.length,a=e.substring(0,i),o=se(n.prefixes,a)?n.prefixes[a]:void 0;if(void 0!==o)return{unit:n,prefix:o}}return null},{hasher:function(e){return e[0]},limit:100});function C(e){return e.equalBase(O.NONE)&&null!==e.value&&!y.predictable?e.value:e}E.isValuelessUnit=function(e){return null!==S(e)},E.prototype.hasBase=function(e){if(!(e="string"==typeof e?O[e]:e))return!1;for(var t=0;t<F.length;t++)if(1e-12<Math.abs((this.dimensions[t]||0)-(e.dimensions[t]||0)))return!1;return!0},E.prototype.equalBase=function(e){for(var t=0;t<F.length;t++)if(1e-12<Math.abs((this.dimensions[t]||0)-(e.dimensions[t]||0)))return!1;return!0},E.prototype.equals=function(e){return this.equalBase(e)&&v(this.value,e.value)},E.prototype.multiply=function(e){for(var t=this.clone(),r=Z(e)?e:new E(e),n=0;n<F.length;n++)t.dimensions[n]=(this.dimensions[n]||0)+(r.dimensions[n]||0);for(var i,a,o=0;o<r.units.length;o++){var u=Zs({},r.units[o]);t.units.push(u)}return null!==this.value||null!==r.value?(i=null===this.value?this._normalize(1):this.value,a=null===r.value?r._normalize(1):r.value,t.value=l(i,a)):t.value=null,Z(e)&&(t.skipAutomaticSimplification=!1),C(t)},E.prototype.divideInto=function(e){return new E(e).divide(this)},E.prototype.divide=function(e){for(var t=this.clone(),r=Z(e)?e:new E(e),n=0;n<F.length;n++)t.dimensions[n]=(this.dimensions[n]||0)-(r.dimensions[n]||0);for(var i,a,o=0;o<r.units.length;o++){var u=Zs(Zs({},r.units[o]),{},{power:-r.units[o].power});t.units.push(u)}return null!==this.value||null!==r.value?(i=null===this.value?this._normalize(1):this.value,a=null===r.value?r._normalize(1):r.value,t.value=f(i,a)):t.value=null,Z(e)&&(t.skipAutomaticSimplification=!1),C(t)},E.prototype.pow=function(e){for(var t=this.clone(),r=0;r<F.length;r++)t.dimensions[r]=(this.dimensions[r]||0)*e;for(var n=0;n<t.units.length;n++)t.units[n].power*=e;return null!==t.value?t.value=p(t.value,e):t.value=null,t.skipAutomaticSimplification=!1,C(t)},E.prototype.abs=function(){var e,t,r,n=this.clone();for(r in null!==n.value&&(n._isDerived()||0===n.units.length||0===n.units[0].unit.offset?n.value=m(n.value):(t=(e=n._numberConverter())(n.units[0].unit.value),e=e(n.units[0].unit.offset),t=l(t,e),n.value=c(m(s(n.value,t)),t))),n.units)"VA"!==n.units[r].unit.name&&"VAR"!==n.units[r].unit.name||(n.units[r].unit=T.W);return n},E.prototype.to=function(e){var t,r,n,i,a=null===this.value?this._normalize(1):this.value;if("string"==typeof e)t=E.parse(e);else{if(!Z(e))throw new Error("String or Unit expected as parameter");t=e.clone()}if(!this.equalBase(t))throw new Error("Units do not match ('".concat(t.toString(),"' != '").concat(this.toString(),"')"));if(null!==t.value)throw new Error("Cannot convert to a unit with a value");return null===this.value||this._isDerived()||0===this.units.length||0===t.units.length||this.units[0].unit.offset===t.units[0].unit.offset?t.value=Ce(a):(e=E._getNumberConverter(Se(a)),r=this.units[0].unit.value,i=this.units[0].unit.offset,r=l(r,i),i=t.units[0].unit.value,n=t.units[0].unit.offset,i=l(i,n),t.value=s(a,e(c(r,i)))),t.fixPrefix=!0,t.skipAutomaticSimplification=!0,t},E.prototype.toNumber=function(e){return U(this.toNumeric(e))},E.prototype.toNumeric=function(e){return(e=e?this.to(e):this.clone())._isDerived()||0===e.units.length?e._denormalize(e.value):e._denormalize(e.value,e.units[0].prefix.value)},E.prototype.toString=function(){return this.format()},E.prototype.toJSON=function(){return{mathjs:"Unit",value:this._denormalize(this.value),unit:0<this.units.length?this.formatUnits():null,fixPrefix:this.fixPrefix}},E.fromJSON=function(e){var t=new E(e.value,null!=(t=e.unit)?t:void 0);return t.fixPrefix=e.fixPrefix||!1,t},E.prototype.valueOf=E.prototype.toString,E.prototype.simplify=function(){var e,t,r,n=this.clone(),i=[];for(r in B)if(se(B,r)&&n.hasBase(O[r])){e=r;break}if("NONE"===e)n.units=[];else if(t=e&&se(B,e)?B[e]:t)n.units=[{unit:t.unit,prefix:t.prefix,power:1}];else{for(var a=!1,o=0;o<F.length;o++){var u=F[o];1e-12<Math.abs(n.dimensions[o]||0)&&(se(B,u)?i.push({unit:B[u].unit,prefix:B[u].prefix,power:n.dimensions[o]||0}):a=!0)}i.length<n.units.length&&!a&&(n.units=i)}return n},E.prototype.toSI=function(){for(var e=this.clone(),t=[],r=0;r<F.length;r++){var n=F[r];if(1e-12<Math.abs(e.dimensions[r]||0)){if(!se(_.si,n))throw new Error("Cannot express custom unit "+n+" in SI units");t.push({unit:_.si[n].unit,prefix:_.si[n].prefix,power:e.dimensions[r]||0})}}return e.units=t,e.fixPrefix=!0,e.skipAutomaticSimplification=!0,null!==this.value?(e.value=null,this.to(e)):e},E.prototype.formatUnits=function(){for(var e="",t="",r=0,n=0,i=0;i<this.units.length;i++)0<this.units[i].power?(r++,e+=" "+this.units[i].prefix.name+this.units[i].unit.name,1e-15<Math.abs(this.units[i].power-1)&&(e+="^"+this.units[i].power)):this.units[i].power<0&&n++;if(0<n)for(var a=0;a<this.units.length;a++)this.units[a].power<0&&(0<r?(t+=" "+this.units[a].prefix.name+this.units[a].unit.name,1e-15<Math.abs(this.units[a].power+1)&&(t+="^"+-this.units[a].power)):t=(t+=" "+this.units[a].prefix.name+this.units[a].unit.name)+("^"+this.units[a].power));var e=e.substr(1),t=t.substr(1),o=e=1<r&&0<n?"("+e+")":e;return 0<r&&0<n&&(o+=" / "),o+(t=1<n&&0<r?"("+t+")":t)},E.prototype.format=function(e){var t,r=this.skipAutomaticSimplification||null===this.value?this.clone():this.simplify(),n=!1;for(t in void 0!==r.value&&null!==r.value&&Oe(r.value)&&(n=Math.abs(r.value.re)<1e-14),r.units)se(r.units,t)&&r.units[t].unit&&("VA"===r.units[t].unit.name&&n?r.units[t].unit=T.VAR:"VAR"!==r.units[t].unit.name||n||(r.units[t].unit=T.VA));1!==r.units.length||r.fixPrefix||Math.abs(r.units[0].power-Math.round(r.units[0].power))<1e-14&&(r.units[0].prefix=r._bestPrefix());var i=r._denormalize(r.value),i=null!==r.value?j(i,e||{}):"",e=r.formatUnits();return r.value&&Oe(r.value)&&(i="("+i+")"),0<e.length&&0<i.length&&(i+=" "),i+e},E.prototype._bestPrefix=function(){if(1!==this.units.length)throw new Error("Can only compute the best prefix for single units with integer powers, like kg, s^2, N^-1, and so forth!");if(1e-14<=Math.abs(this.units[0].power-Math.round(this.units[0].power)))throw new Error("Can only compute the best prefix for single units with integer powers, like kg, s^2, N^-1, and so forth!");var e=null!==this.value?m(this.value):0,t=m(this.units[0].unit.value),r=this.units[0].prefix;if(0===e)return r;var n=this.units[0].power;if(-2.200001<(u=Math.log(e/Math.pow(r.value*t,n))/Math.LN10-1.2)&&u<1.800001)return r;var i,a,o,u=Math.abs(u),s=this.units[0].unit.prefixes;for(i in s)se(s,i)&&(a=s[i]).scientific&&((o=Math.abs(Math.log(e/Math.pow(a.value*t,n))/Math.LN10-1.2))<u||o===u&&a.name.length<r.name.length)&&(r=a,u=o);return r};var r,M={NONE:{"":{name:"",value:1,scientific:!0}},SHORT:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:10,scientific:!(E.prototype.splitUnit=function(e){for(var t=this.clone(),r=[],n=0;n<e.length&&(t=t.to(e[n]),n!==e.length-1);n++){var i=t.toNumeric(),a=R(i),i=new E(v(a,i)?a:z(t.toNumeric()),e[n].toString());r.push(i),t=c(t,i)}for(var o=0,u=0;u<r.length;u++)o=s(o,r[u].value);return v(o,this.value)&&(t.value=0),r.push(t),r})},h:{name:"h",value:100,scientific:!1},k:{name:"k",value:1e3,scientific:!0},M:{name:"M",value:1e6,scientific:!0},G:{name:"G",value:1e9,scientific:!0},T:{name:"T",value:1e12,scientific:!0},P:{name:"P",value:1e15,scientific:!0},E:{name:"E",value:1e18,scientific:!0},Z:{name:"Z",value:1e21,scientific:!0},Y:{name:"Y",value:1e24,scientific:!0},R:{name:"R",value:1e27,scientific:!0},Q:{name:"Q",value:1e30,scientific:!0},d:{name:"d",value:.1,scientific:!1},c:{name:"c",value:.01,scientific:!1},m:{name:"m",value:.001,scientific:!0},u:{name:"u",value:1e-6,scientific:!0},n:{name:"n",value:1e-9,scientific:!0},p:{name:"p",value:1e-12,scientific:!0},f:{name:"f",value:1e-15,scientific:!0},a:{name:"a",value:1e-18,scientific:!0},z:{name:"z",value:1e-21,scientific:!0},y:{name:"y",value:1e-24,scientific:!0},r:{name:"r",value:1e-27,scientific:!0},q:{name:"q",value:1e-30,scientific:!0}},LONG:{"":{name:"",value:1,scientific:!0},deca:{name:"deca",value:10,scientific:!1},hecto:{name:"hecto",value:100,scientific:!1},kilo:{name:"kilo",value:1e3,scientific:!0},mega:{name:"mega",value:1e6,scientific:!0},giga:{name:"giga",value:1e9,scientific:!0},tera:{name:"tera",value:1e12,scientific:!0},peta:{name:"peta",value:1e15,scientific:!0},exa:{name:"exa",value:1e18,scientific:!0},zetta:{name:"zetta",value:1e21,scientific:!0},yotta:{name:"yotta",value:1e24,scientific:!0},ronna:{name:"ronna",value:1e27,scientific:!0},quetta:{name:"quetta",value:1e30,scientific:!0},deci:{name:"deci",value:.1,scientific:!1},centi:{name:"centi",value:.01,scientific:!1},milli:{name:"milli",value:.001,scientific:!0},micro:{name:"micro",value:1e-6,scientific:!0},nano:{name:"nano",value:1e-9,scientific:!0},pico:{name:"pico",value:1e-12,scientific:!0},femto:{name:"femto",value:1e-15,scientific:!0},atto:{name:"atto",value:1e-18,scientific:!0},zepto:{name:"zepto",value:1e-21,scientific:!0},yocto:{name:"yocto",value:1e-24,scientific:!0},ronto:{name:"ronto",value:1e-27,scientific:!0},quecto:{name:"quecto",value:1e-30,scientific:!0}},SQUARED:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:100,scientific:!1},h:{name:"h",value:1e4,scientific:!1},k:{name:"k",value:1e6,scientific:!0},M:{name:"M",value:1e12,scientific:!0},G:{name:"G",value:1e18,scientific:!0},T:{name:"T",value:1e24,scientific:!0},P:{name:"P",value:1e30,scientific:!0},E:{name:"E",value:1e36,scientific:!0},Z:{name:"Z",value:1e42,scientific:!0},Y:{name:"Y",value:1e48,scientific:!0},R:{name:"R",value:1e54,scientific:!0},Q:{name:"Q",value:1e60,scientific:!0},d:{name:"d",value:.01,scientific:!1},c:{name:"c",value:1e-4,scientific:!1},m:{name:"m",value:1e-6,scientific:!0},u:{name:"u",value:1e-12,scientific:!0},n:{name:"n",value:1e-18,scientific:!0},p:{name:"p",value:1e-24,scientific:!0},f:{name:"f",value:1e-30,scientific:!0},a:{name:"a",value:1e-36,scientific:!0},z:{name:"z",value:1e-42,scientific:!0},y:{name:"y",value:1e-48,scientific:!0},r:{name:"r",value:1e-54,scientific:!0},q:{name:"q",value:1e-60,scientific:!0}},CUBIC:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:1e3,scientific:!1},h:{name:"h",value:1e6,scientific:!1},k:{name:"k",value:1e9,scientific:!0},M:{name:"M",value:1e18,scientific:!0},G:{name:"G",value:1e27,scientific:!0},T:{name:"T",value:1e36,scientific:!0},P:{name:"P",value:1e45,scientific:!0},E:{name:"E",value:1e54,scientific:!0},Z:{name:"Z",value:1e63,scientific:!0},Y:{name:"Y",value:1e72,scientific:!0},R:{name:"R",value:1e81,scientific:!0},Q:{name:"Q",value:1e90,scientific:!0},d:{name:"d",value:.001,scientific:!1},c:{name:"c",value:1e-6,scientific:!1},m:{name:"m",value:1e-9,scientific:!0},u:{name:"u",value:1e-18,scientific:!0},n:{name:"n",value:1e-27,scientific:!0},p:{name:"p",value:1e-36,scientific:!0},f:{name:"f",value:1e-45,scientific:!0},a:{name:"a",value:1e-54,scientific:!0},z:{name:"z",value:1e-63,scientific:!0},y:{name:"y",value:1e-72,scientific:!0},r:{name:"r",value:1e-81,scientific:!0},q:{name:"q",value:1e-90,scientific:!0}},BINARY_SHORT_SI:{"":{name:"",value:1,scientific:!0},k:{name:"k",value:1e3,scientific:!0},M:{name:"M",value:1e6,scientific:!0},G:{name:"G",value:1e9,scientific:!0},T:{name:"T",value:1e12,scientific:!0},P:{name:"P",value:1e15,scientific:!0},E:{name:"E",value:1e18,scientific:!0},Z:{name:"Z",value:1e21,scientific:!0},Y:{name:"Y",value:1e24,scientific:!0}},BINARY_SHORT_IEC:{"":{name:"",value:1,scientific:!0},Ki:{name:"Ki",value:1024,scientific:!0},Mi:{name:"Mi",value:Math.pow(1024,2),scientific:!0},Gi:{name:"Gi",value:Math.pow(1024,3),scientific:!0},Ti:{name:"Ti",value:Math.pow(1024,4),scientific:!0},Pi:{name:"Pi",value:Math.pow(1024,5),scientific:!0},Ei:{name:"Ei",value:Math.pow(1024,6),scientific:!0},Zi:{name:"Zi",value:Math.pow(1024,7),scientific:!0},Yi:{name:"Yi",value:Math.pow(1024,8),scientific:!0}},BINARY_LONG_SI:{"":{name:"",value:1,scientific:!0},kilo:{name:"kilo",value:1e3,scientific:!0},mega:{name:"mega",value:1e6,scientific:!0},giga:{name:"giga",value:1e9,scientific:!0},tera:{name:"tera",value:1e12,scientific:!0},peta:{name:"peta",value:1e15,scientific:!0},exa:{name:"exa",value:1e18,scientific:!0},zetta:{name:"zetta",value:1e21,scientific:!0},yotta:{name:"yotta",value:1e24,scientific:!0}},BINARY_LONG_IEC:{"":{name:"",value:1,scientific:!0},kibi:{name:"kibi",value:1024,scientific:!0},mebi:{name:"mebi",value:Math.pow(1024,2),scientific:!0},gibi:{name:"gibi",value:Math.pow(1024,3),scientific:!0},tebi:{name:"tebi",value:Math.pow(1024,4),scientific:!0},pebi:{name:"pebi",value:Math.pow(1024,5),scientific:!0},exi:{name:"exi",value:Math.pow(1024,6),scientific:!0},zebi:{name:"zebi",value:Math.pow(1024,7),scientific:!0},yobi:{name:"yobi",value:Math.pow(1024,8),scientific:!0}},BTU:{"":{name:"",value:1,scientific:!0},MM:{name:"MM",value:1e6,scientific:!0}}},F=(M.SHORTLONG=an({},M.SHORT,M.LONG),M.BINARY_SHORT=an({},M.BINARY_SHORT_SI,M.BINARY_SHORT_IEC),M.BINARY_LONG=an({},M.BINARY_LONG_SI,M.BINARY_LONG_IEC),["MASS","LENGTH","TIME","CURRENT","TEMPERATURE","LUMINOUS_INTENSITY","AMOUNT_OF_SUBSTANCE","ANGLE","BIT"]),O={NONE:{dimensions:[0,0,0,0,0,0,0,0,0]},MASS:{dimensions:[1,0,0,0,0,0,0,0,0]},LENGTH:{dimensions:[0,1,0,0,0,0,0,0,0]},TIME:{dimensions:[0,0,1,0,0,0,0,0,0]},CURRENT:{dimensions:[0,0,0,1,0,0,0,0,0]},TEMPERATURE:{dimensions:[0,0,0,0,1,0,0,0,0]},LUMINOUS_INTENSITY:{dimensions:[0,0,0,0,0,1,0,0,0]},AMOUNT_OF_SUBSTANCE:{dimensions:[0,0,0,0,0,0,1,0,0]},FORCE:{dimensions:[1,1,-2,0,0,0,0,0,0]},SURFACE:{dimensions:[0,2,0,0,0,0,0,0,0]},VOLUME:{dimensions:[0,3,0,0,0,0,0,0,0]},ENERGY:{dimensions:[1,2,-2,0,0,0,0,0,0]},POWER:{dimensions:[1,2,-3,0,0,0,0,0,0]},PRESSURE:{dimensions:[1,-1,-2,0,0,0,0,0,0]},ELECTRIC_CHARGE:{dimensions:[0,0,1,1,0,0,0,0,0]},ELECTRIC_CAPACITANCE:{dimensions:[-1,-2,4,2,0,0,0,0,0]},ELECTRIC_POTENTIAL:{dimensions:[1,2,-3,-1,0,0,0,0,0]},ELECTRIC_RESISTANCE:{dimensions:[1,2,-3,-2,0,0,0,0,0]},ELECTRIC_INDUCTANCE:{dimensions:[1,2,-2,-2,0,0,0,0,0]},ELECTRIC_CONDUCTANCE:{dimensions:[-1,-2,3,2,0,0,0,0,0]},MAGNETIC_FLUX:{dimensions:[1,2,-2,-1,0,0,0,0,0]},MAGNETIC_FLUX_DENSITY:{dimensions:[1,0,-2,-1,0,0,0,0,0]},FREQUENCY:{dimensions:[0,0,-1,0,0,0,0,0,0]},ANGLE:{dimensions:[0,0,0,0,0,0,0,1,0]},BIT:{dimensions:[0,0,0,0,0,0,0,0,1]}};for(r in O)se(O,r)&&(O[r].key=r);var e={name:"",base:{},value:1,offset:0,dimensions:F.map(function(e){return 0})},T={meter:{name:"meter",base:O.LENGTH,prefixes:M.LONG,value:1,offset:0},inch:{name:"inch",base:O.LENGTH,prefixes:M.NONE,value:.0254,offset:0},foot:{name:"foot",base:O.LENGTH,prefixes:M.NONE,value:.3048,offset:0},yard:{name:"yard",base:O.LENGTH,prefixes:M.NONE,value:.9144,offset:0},mile:{name:"mile",base:O.LENGTH,prefixes:M.NONE,value:1609.344,offset:0},link:{name:"link",base:O.LENGTH,prefixes:M.NONE,value:.201168,offset:0},rod:{name:"rod",base:O.LENGTH,prefixes:M.NONE,value:5.0292,offset:0},chain:{name:"chain",base:O.LENGTH,prefixes:M.NONE,value:20.1168,offset:0},angstrom:{name:"angstrom",base:O.LENGTH,prefixes:M.NONE,value:1e-10,offset:0},m:{name:"m",base:O.LENGTH,prefixes:M.SHORT,value:1,offset:0},in:{name:"in",base:O.LENGTH,prefixes:M.NONE,value:.0254,offset:0},ft:{name:"ft",base:O.LENGTH,prefixes:M.NONE,value:.3048,offset:0},yd:{name:"yd",base:O.LENGTH,prefixes:M.NONE,value:.9144,offset:0},mi:{name:"mi",base:O.LENGTH,prefixes:M.NONE,value:1609.344,offset:0},li:{name:"li",base:O.LENGTH,prefixes:M.NONE,value:.201168,offset:0},rd:{name:"rd",base:O.LENGTH,prefixes:M.NONE,value:5.02921,offset:0},ch:{name:"ch",base:O.LENGTH,prefixes:M.NONE,value:20.1168,offset:0},mil:{name:"mil",base:O.LENGTH,prefixes:M.NONE,value:254e-7,offset:0},m2:{name:"m2",base:O.SURFACE,prefixes:M.SQUARED,value:1,offset:0},sqin:{name:"sqin",base:O.SURFACE,prefixes:M.NONE,value:64516e-8,offset:0},sqft:{name:"sqft",base:O.SURFACE,prefixes:M.NONE,value:.09290304,offset:0},sqyd:{name:"sqyd",base:O.SURFACE,prefixes:M.NONE,value:.83612736,offset:0},sqmi:{name:"sqmi",base:O.SURFACE,prefixes:M.NONE,value:2589988.110336,offset:0},sqrd:{name:"sqrd",base:O.SURFACE,prefixes:M.NONE,value:25.29295,offset:0},sqch:{name:"sqch",base:O.SURFACE,prefixes:M.NONE,value:404.6873,offset:0},sqmil:{name:"sqmil",base:O.SURFACE,prefixes:M.NONE,value:6.4516e-10,offset:0},acre:{name:"acre",base:O.SURFACE,prefixes:M.NONE,value:4046.86,offset:0},hectare:{name:"hectare",base:O.SURFACE,prefixes:M.NONE,value:1e4,offset:0},m3:{name:"m3",base:O.VOLUME,prefixes:M.CUBIC,value:1,offset:0},L:{name:"L",base:O.VOLUME,prefixes:M.SHORT,value:.001,offset:0},l:{name:"l",base:O.VOLUME,prefixes:M.SHORT,value:.001,offset:0},litre:{name:"litre",base:O.VOLUME,prefixes:M.LONG,value:.001,offset:0},cuin:{name:"cuin",base:O.VOLUME,prefixes:M.NONE,value:16387064e-12,offset:0},cuft:{name:"cuft",base:O.VOLUME,prefixes:M.NONE,value:.028316846592,offset:0},cuyd:{name:"cuyd",base:O.VOLUME,prefixes:M.NONE,value:.764554857984,offset:0},teaspoon:{name:"teaspoon",base:O.VOLUME,prefixes:M.NONE,value:5e-6,offset:0},tablespoon:{name:"tablespoon",base:O.VOLUME,prefixes:M.NONE,value:15e-6,offset:0},drop:{name:"drop",base:O.VOLUME,prefixes:M.NONE,value:5e-8,offset:0},gtt:{name:"gtt",base:O.VOLUME,prefixes:M.NONE,value:5e-8,offset:0},minim:{name:"minim",base:O.VOLUME,prefixes:M.NONE,value:6.161152e-8,offset:0},fluiddram:{name:"fluiddram",base:O.VOLUME,prefixes:M.NONE,value:36966911e-13,offset:0},fluidounce:{name:"fluidounce",base:O.VOLUME,prefixes:M.NONE,value:2957353e-11,offset:0},gill:{name:"gill",base:O.VOLUME,prefixes:M.NONE,value:.0001182941,offset:0},cc:{name:"cc",base:O.VOLUME,prefixes:M.NONE,value:1e-6,offset:0},cup:{name:"cup",base:O.VOLUME,prefixes:M.NONE,value:.0002365882,offset:0},pint:{name:"pint",base:O.VOLUME,prefixes:M.NONE,value:.0004731765,offset:0},quart:{name:"quart",base:O.VOLUME,prefixes:M.NONE,value:.0009463529,offset:0},gallon:{name:"gallon",base:O.VOLUME,prefixes:M.NONE,value:.003785412,offset:0},beerbarrel:{name:"beerbarrel",base:O.VOLUME,prefixes:M.NONE,value:.1173478,offset:0},oilbarrel:{name:"oilbarrel",base:O.VOLUME,prefixes:M.NONE,value:.1589873,offset:0},hogshead:{name:"hogshead",base:O.VOLUME,prefixes:M.NONE,value:.238481,offset:0},fldr:{name:"fldr",base:O.VOLUME,prefixes:M.NONE,value:36966911e-13,offset:0},floz:{name:"floz",base:O.VOLUME,prefixes:M.NONE,value:2957353e-11,offset:0},gi:{name:"gi",base:O.VOLUME,prefixes:M.NONE,value:.0001182941,offset:0},cp:{name:"cp",base:O.VOLUME,prefixes:M.NONE,value:.0002365882,offset:0},pt:{name:"pt",base:O.VOLUME,prefixes:M.NONE,value:.0004731765,offset:0},qt:{name:"qt",base:O.VOLUME,prefixes:M.NONE,value:.0009463529,offset:0},gal:{name:"gal",base:O.VOLUME,prefixes:M.NONE,value:.003785412,offset:0},bbl:{name:"bbl",base:O.VOLUME,prefixes:M.NONE,value:.1173478,offset:0},obl:{name:"obl",base:O.VOLUME,prefixes:M.NONE,value:.1589873,offset:0},g:{name:"g",base:O.MASS,prefixes:M.SHORT,value:.001,offset:0},gram:{name:"gram",base:O.MASS,prefixes:M.LONG,value:.001,offset:0},ton:{name:"ton",base:O.MASS,prefixes:M.SHORT,value:907.18474,offset:0},t:{name:"t",base:O.MASS,prefixes:M.SHORT,value:1e3,offset:0},tonne:{name:"tonne",base:O.MASS,prefixes:M.LONG,value:1e3,offset:0},grain:{name:"grain",base:O.MASS,prefixes:M.NONE,value:6479891e-11,offset:0},dram:{name:"dram",base:O.MASS,prefixes:M.NONE,value:.0017718451953125,offset:0},ounce:{name:"ounce",base:O.MASS,prefixes:M.NONE,value:.028349523125,offset:0},poundmass:{name:"poundmass",base:O.MASS,prefixes:M.NONE,value:.45359237,offset:0},hundredweight:{name:"hundredweight",base:O.MASS,prefixes:M.NONE,value:45.359237,offset:0},stick:{name:"stick",base:O.MASS,prefixes:M.NONE,value:.115,offset:0},stone:{name:"stone",base:O.MASS,prefixes:M.NONE,value:6.35029318,offset:0},gr:{name:"gr",base:O.MASS,prefixes:M.NONE,value:6479891e-11,offset:0},dr:{name:"dr",base:O.MASS,prefixes:M.NONE,value:.0017718451953125,offset:0},oz:{name:"oz",base:O.MASS,prefixes:M.NONE,value:.028349523125,offset:0},lbm:{name:"lbm",base:O.MASS,prefixes:M.NONE,value:.45359237,offset:0},cwt:{name:"cwt",base:O.MASS,prefixes:M.NONE,value:45.359237,offset:0},s:{name:"s",base:O.TIME,prefixes:M.SHORT,value:1,offset:0},min:{name:"min",base:O.TIME,prefixes:M.NONE,value:60,offset:0},h:{name:"h",base:O.TIME,prefixes:M.NONE,value:3600,offset:0},second:{name:"second",base:O.TIME,prefixes:M.LONG,value:1,offset:0},sec:{name:"sec",base:O.TIME,prefixes:M.LONG,value:1,offset:0},minute:{name:"minute",base:O.TIME,prefixes:M.NONE,value:60,offset:0},hour:{name:"hour",base:O.TIME,prefixes:M.NONE,value:3600,offset:0},day:{name:"day",base:O.TIME,prefixes:M.NONE,value:86400,offset:0},week:{name:"week",base:O.TIME,prefixes:M.NONE,value:604800,offset:0},month:{name:"month",base:O.TIME,prefixes:M.NONE,value:2629800,offset:0},year:{name:"year",base:O.TIME,prefixes:M.NONE,value:31557600,offset:0},decade:{name:"decade",base:O.TIME,prefixes:M.NONE,value:315576e3,offset:0},century:{name:"century",base:O.TIME,prefixes:M.NONE,value:315576e4,offset:0},millennium:{name:"millennium",base:O.TIME,prefixes:M.NONE,value:315576e5,offset:0},hertz:{name:"Hertz",base:O.FREQUENCY,prefixes:M.LONG,value:1,offset:0,reciprocal:!0},Hz:{name:"Hz",base:O.FREQUENCY,prefixes:M.SHORT,value:1,offset:0,reciprocal:!0},rad:{name:"rad",base:O.ANGLE,prefixes:M.SHORT,value:1,offset:0},radian:{name:"radian",base:O.ANGLE,prefixes:M.LONG,value:1,offset:0},deg:{name:"deg",base:O.ANGLE,prefixes:M.SHORT,value:null,offset:0},degree:{name:"degree",base:O.ANGLE,prefixes:M.LONG,value:null,offset:0},grad:{name:"grad",base:O.ANGLE,prefixes:M.SHORT,value:null,offset:0},gradian:{name:"gradian",base:O.ANGLE,prefixes:M.LONG,value:null,offset:0},cycle:{name:"cycle",base:O.ANGLE,prefixes:M.NONE,value:null,offset:0},arcsec:{name:"arcsec",base:O.ANGLE,prefixes:M.NONE,value:null,offset:0},arcmin:{name:"arcmin",base:O.ANGLE,prefixes:M.NONE,value:null,offset:0},A:{name:"A",base:O.CURRENT,prefixes:M.SHORT,value:1,offset:0},ampere:{name:"ampere",base:O.CURRENT,prefixes:M.LONG,value:1,offset:0},K:{name:"K",base:O.TEMPERATURE,prefixes:M.SHORT,value:1,offset:0},degC:{name:"degC",base:O.TEMPERATURE,prefixes:M.SHORT,value:1,offset:273.15},degF:{name:"degF",base:O.TEMPERATURE,prefixes:M.SHORT,value:new x(5,9),offset:459.67},degR:{name:"degR",base:O.TEMPERATURE,prefixes:M.SHORT,value:new x(5,9),offset:0},kelvin:{name:"kelvin",base:O.TEMPERATURE,prefixes:M.LONG,value:1,offset:0},celsius:{name:"celsius",base:O.TEMPERATURE,prefixes:M.LONG,value:1,offset:273.15},fahrenheit:{name:"fahrenheit",base:O.TEMPERATURE,prefixes:M.LONG,value:new x(5,9),offset:459.67},rankine:{name:"rankine",base:O.TEMPERATURE,prefixes:M.LONG,value:new x(5,9),offset:0},mol:{name:"mol",base:O.AMOUNT_OF_SUBSTANCE,prefixes:M.SHORT,value:1,offset:0},mole:{name:"mole",base:O.AMOUNT_OF_SUBSTANCE,prefixes:M.LONG,value:1,offset:0},cd:{name:"cd",base:O.LUMINOUS_INTENSITY,prefixes:M.SHORT,value:1,offset:0},candela:{name:"candela",base:O.LUMINOUS_INTENSITY,prefixes:M.LONG,value:1,offset:0},N:{name:"N",base:O.FORCE,prefixes:M.SHORT,value:1,offset:0},newton:{name:"newton",base:O.FORCE,prefixes:M.LONG,value:1,offset:0},dyn:{name:"dyn",base:O.FORCE,prefixes:M.SHORT,value:1e-5,offset:0},dyne:{name:"dyne",base:O.FORCE,prefixes:M.LONG,value:1e-5,offset:0},lbf:{name:"lbf",base:O.FORCE,prefixes:M.NONE,value:4.4482216152605,offset:0},poundforce:{name:"poundforce",base:O.FORCE,prefixes:M.NONE,value:4.4482216152605,offset:0},kip:{name:"kip",base:O.FORCE,prefixes:M.LONG,value:4448.2216,offset:0},kilogramforce:{name:"kilogramforce",base:O.FORCE,prefixes:M.NONE,value:9.80665,offset:0},J:{name:"J",base:O.ENERGY,prefixes:M.SHORT,value:1,offset:0},joule:{name:"joule",base:O.ENERGY,prefixes:M.LONG,value:1,offset:0},erg:{name:"erg",base:O.ENERGY,prefixes:M.SHORTLONG,value:1e-7,offset:0},Wh:{name:"Wh",base:O.ENERGY,prefixes:M.SHORT,value:3600,offset:0},BTU:{name:"BTU",base:O.ENERGY,prefixes:M.BTU,value:1055.05585262,offset:0},eV:{name:"eV",base:O.ENERGY,prefixes:M.SHORT,value:1602176565e-28,offset:0},electronvolt:{name:"electronvolt",base:O.ENERGY,prefixes:M.LONG,value:1602176565e-28,offset:0},W:{name:"W",base:O.POWER,prefixes:M.SHORT,value:1,offset:0},watt:{name:"watt",base:O.POWER,prefixes:M.LONG,value:1,offset:0},hp:{name:"hp",base:O.POWER,prefixes:M.NONE,value:745.6998715386,offset:0},VAR:{name:"VAR",base:O.POWER,prefixes:M.SHORT,value:L.I,offset:0},VA:{name:"VA",base:O.POWER,prefixes:M.SHORT,value:1,offset:0},Pa:{name:"Pa",base:O.PRESSURE,prefixes:M.SHORT,value:1,offset:0},psi:{name:"psi",base:O.PRESSURE,prefixes:M.NONE,value:6894.75729276459,offset:0},atm:{name:"atm",base:O.PRESSURE,prefixes:M.NONE,value:101325,offset:0},bar:{name:"bar",base:O.PRESSURE,prefixes:M.SHORTLONG,value:1e5,offset:0},torr:{name:"torr",base:O.PRESSURE,prefixes:M.NONE,value:133.322,offset:0},mmHg:{name:"mmHg",base:O.PRESSURE,prefixes:M.NONE,value:133.322,offset:0},mmH2O:{name:"mmH2O",base:O.PRESSURE,prefixes:M.NONE,value:9.80665,offset:0},cmH2O:{name:"cmH2O",base:O.PRESSURE,prefixes:M.NONE,value:98.0665,offset:0},coulomb:{name:"coulomb",base:O.ELECTRIC_CHARGE,prefixes:M.LONG,value:1,offset:0},C:{name:"C",base:O.ELECTRIC_CHARGE,prefixes:M.SHORT,value:1,offset:0},farad:{name:"farad",base:O.ELECTRIC_CAPACITANCE,prefixes:M.LONG,value:1,offset:0},F:{name:"F",base:O.ELECTRIC_CAPACITANCE,prefixes:M.SHORT,value:1,offset:0},volt:{name:"volt",base:O.ELECTRIC_POTENTIAL,prefixes:M.LONG,value:1,offset:0},V:{name:"V",base:O.ELECTRIC_POTENTIAL,prefixes:M.SHORT,value:1,offset:0},ohm:{name:"ohm",base:O.ELECTRIC_RESISTANCE,prefixes:M.SHORTLONG,value:1,offset:0},henry:{name:"henry",base:O.ELECTRIC_INDUCTANCE,prefixes:M.LONG,value:1,offset:0},H:{name:"H",base:O.ELECTRIC_INDUCTANCE,prefixes:M.SHORT,value:1,offset:0},siemens:{name:"siemens",base:O.ELECTRIC_CONDUCTANCE,prefixes:M.LONG,value:1,offset:0},S:{name:"S",base:O.ELECTRIC_CONDUCTANCE,prefixes:M.SHORT,value:1,offset:0},weber:{name:"weber",base:O.MAGNETIC_FLUX,prefixes:M.LONG,value:1,offset:0},Wb:{name:"Wb",base:O.MAGNETIC_FLUX,prefixes:M.SHORT,value:1,offset:0},tesla:{name:"tesla",base:O.MAGNETIC_FLUX_DENSITY,prefixes:M.LONG,value:1,offset:0},T:{name:"T",base:O.MAGNETIC_FLUX_DENSITY,prefixes:M.SHORT,value:1,offset:0},b:{name:"b",base:O.BIT,prefixes:M.BINARY_SHORT,value:1,offset:0},bits:{name:"bits",base:O.BIT,prefixes:M.BINARY_LONG,value:1,offset:0},B:{name:"B",base:O.BIT,prefixes:M.BINARY_SHORT,value:8,offset:0},bytes:{name:"bytes",base:O.BIT,prefixes:M.BINARY_LONG,value:8,offset:0}},i={meters:"meter",inches:"inch",feet:"foot",yards:"yard",miles:"mile",links:"link",rods:"rod",chains:"chain",angstroms:"angstrom",lt:"l",litres:"litre",liter:"litre",liters:"litre",teaspoons:"teaspoon",tablespoons:"tablespoon",minims:"minim",fluiddrams:"fluiddram",fluidounces:"fluidounce",gills:"gill",cups:"cup",pints:"pint",quarts:"quart",gallons:"gallon",beerbarrels:"beerbarrel",oilbarrels:"oilbarrel",hogsheads:"hogshead",gtts:"gtt",grams:"gram",tons:"ton",tonnes:"tonne",grains:"grain",drams:"dram",ounces:"ounce",poundmasses:"poundmass",hundredweights:"hundredweight",sticks:"stick",lb:"lbm",lbs:"lbm",kips:"kip",kgf:"kilogramforce",acres:"acre",hectares:"hectare",sqfeet:"sqft",sqyard:"sqyd",sqmile:"sqmi",sqmiles:"sqmi",mmhg:"mmHg",mmh2o:"mmH2O",cmh2o:"cmH2O",seconds:"second",secs:"second",minutes:"minute",mins:"minute",hours:"hour",hr:"hour",hrs:"hour",days:"day",weeks:"week",months:"month",years:"year",decades:"decade",centuries:"century",millennia:"millennium",hertz:"hertz",radians:"radian",degrees:"degree",gradians:"gradian",cycles:"cycle",arcsecond:"arcsec",arcseconds:"arcsec",arcminute:"arcmin",arcminutes:"arcmin",BTUs:"BTU",watts:"watt",joules:"joule",amperes:"ampere",amps:"ampere",amp:"ampere",coulombs:"coulomb",volts:"volt",ohms:"ohm",farads:"farad",webers:"weber",teslas:"tesla",electronvolts:"electronvolt",moles:"mole",bit:"bits",byte:"bytes"};function H(e){"BigNumber"===e.number?(e=$s(g),T.rad.value=new g(1),T.deg.value=e.div(180),T.grad.value=e.div(200),T.cycle.value=e.times(2),T.arcsec.value=e.div(648e3),T.arcmin.value=e.div(10800)):(T.rad.value=1,T.deg.value=Math.PI/180,T.grad.value=Math.PI/200,T.cycle.value=2*Math.PI,T.arcsec.value=Math.PI/648e3,T.arcmin.value=Math.PI/10800),T.radian.value=T.rad.value,T.degree.value=T.deg.value,T.gradian.value=T.grad.value}H(y),t&&t("config",function(e,t){e.number!==t.number&&H(e)});var a,G,o,_={si:{NONE:{unit:e,prefix:M.NONE[""]},LENGTH:{unit:T.m,prefix:M.SHORT[""]},MASS:{unit:T.g,prefix:M.SHORT.k},TIME:{unit:T.s,prefix:M.SHORT[""]},CURRENT:{unit:T.A,prefix:M.SHORT[""]},TEMPERATURE:{unit:T.K,prefix:M.SHORT[""]},LUMINOUS_INTENSITY:{unit:T.cd,prefix:M.SHORT[""]},AMOUNT_OF_SUBSTANCE:{unit:T.mol,prefix:M.SHORT[""]},ANGLE:{unit:T.rad,prefix:M.SHORT[""]},BIT:{unit:T.bits,prefix:M.SHORT[""]},FORCE:{unit:T.N,prefix:M.SHORT[""]},ENERGY:{unit:T.J,prefix:M.SHORT[""]},POWER:{unit:T.W,prefix:M.SHORT[""]},PRESSURE:{unit:T.Pa,prefix:M.SHORT[""]},ELECTRIC_CHARGE:{unit:T.C,prefix:M.SHORT[""]},ELECTRIC_CAPACITANCE:{unit:T.F,prefix:M.SHORT[""]},ELECTRIC_POTENTIAL:{unit:T.V,prefix:M.SHORT[""]},ELECTRIC_RESISTANCE:{unit:T.ohm,prefix:M.SHORT[""]},ELECTRIC_INDUCTANCE:{unit:T.H,prefix:M.SHORT[""]},ELECTRIC_CONDUCTANCE:{unit:T.S,prefix:M.SHORT[""]},MAGNETIC_FLUX:{unit:T.Wb,prefix:M.SHORT[""]},MAGNETIC_FLUX_DENSITY:{unit:T.T,prefix:M.SHORT[""]},FREQUENCY:{unit:T.Hz,prefix:M.SHORT[""]}}},B=(_.cgs=JSON.parse(JSON.stringify(_.si)),_.cgs.LENGTH={unit:T.m,prefix:M.SHORT.c},_.cgs.MASS={unit:T.g,prefix:M.SHORT[""]},_.cgs.FORCE={unit:T.dyn,prefix:M.SHORT[""]},_.cgs.ENERGY={unit:T.erg,prefix:M.NONE[""]},_.us=JSON.parse(JSON.stringify(_.si)),_.us.LENGTH={unit:T.ft,prefix:M.NONE[""]},_.us.MASS={unit:T.lbm,prefix:M.NONE[""]},_.us.TEMPERATURE={unit:T.degF,prefix:M.NONE[""]},_.us.FORCE={unit:T.lbf,prefix:M.NONE[""]},_.us.ENERGY={unit:T.BTU,prefix:M.BTU[""]},_.us.POWER={unit:T.hp,prefix:M.NONE[""]},_.us.PRESSURE={unit:T.psi,prefix:M.NONE[""]},_.auto=JSON.parse(JSON.stringify(_.si)),_.auto);for(a in E.setUnitSystem=function(e){if(!se(_,e))throw new Error("Unit system "+e+" does not exist. Choices are: "+Object.keys(_).join(", "));B=_[e]},E.getUnitSystem=function(){for(var e in _)if(se(_,e)&&_[e]===B)return e},E.typeConverters={BigNumber:function(e){return null!=e&&e.isFraction?new g(e.n).div(e.d).times(e.s):new g(e+"")},Fraction:function(e){return new x(e)},Complex:function(e){return e},number:function(e){return null!=e&&e.isFraction?P(e):e}},E.prototype._numberConverter=function(){var e=E.typeConverters[this.valueType()];if(e)return e;throw new TypeError('Unsupported Unit value type "'+this.valueType()+'"')},E._getNumberConverter=function(e){if(E.typeConverters[e])return E.typeConverters[e];throw new TypeError('Unsupported type "'+e+'"')},T)se(T,a)&&((G=T[a]).dimensions=G.base.dimensions);for(o in i)if(se(i,o)){var u,k=T[i[o]],I={};for(u in k)se(k,u)&&(I[u]=k[u]);I.name=o,T[o]=I}return E.isValidAlpha=function(e){return/^[a-zA-Z]$/.test(e)},E.createUnit=function(e,t){if("object"!==V(e))throw new TypeError("createUnit expects first parameter to be of type 'Object'");if(t&&t.override)for(var r in e)if(se(e,r)&&E.deleteUnit(r),e[r].aliases)for(var n=0;n<e[r].aliases.length;n++)E.deleteUnit(e[r].aliases[n]);var i,a;for(a in e)se(e,a)&&(i=E.createUnitSingle(a,e[a]));return i},E.createUnitSingle=function(t,e){if(null==e&&(e={}),"string"!=typeof t)throw new TypeError("createUnitSingle expects first parameter to be of type 'string'");if(se(T,t))throw new Error('Cannot create unit "'+t+'": a unit with that name already exists');for(var r=t,n=0;n<r.length;n++){if(D=r.charAt(n),0===n&&!E.isValidAlpha(D))throw new Error('Invalid unit name (must begin with alpha character): "'+r+'"');if(0<n&&!E.isValidAlpha(D)&&!A(D))throw new Error('Invalid unit name (only alphanumeric characters are allowed): "'+r+'"')}var i,a=null,o=[],u=0;if(e&&"Unit"===e.type)a=e.clone();else if("string"==typeof e)""!==e&&(i=e);else{if("object"!==V(e))throw new TypeError('Cannot create unit "'+t+'" from "'+e.toString()+'": expecting "string" or "Unit" or "Object"');i=e.definition,c=e.prefixes,u=e.offset,p=e.baseName,e.aliases&&(o=e.aliases.valueOf())}if(o)for(var s=0;s<o.length;s++)if(se(T,o[s]))throw new Error('Cannot create alias "'+o[s]+'": a unit with that name already exists');if(i&&"string"==typeof i&&!a)try{a=E.parse(i,{allowNoUnits:!0})}catch(e){throw e.message='Could not create unit "'+t+'" from "'+i+'": '+e.message,e}else i&&"Unit"===i.type&&(a=i.clone());var o=o||[],u=u||0,c=c&&c.toUpperCase&&M[c.toUpperCase()]||M.NONE,l={};if(a){var f,p,l={name:t,value:a.value,dimensions:a.dimensions.slice(0),prefixes:c,offset:u},m=!1;for(f in O)if(se(O,f)){for(var h=!0,d=0;d<F.length;d++)if(1e-12<Math.abs((l.dimensions[d]||0)-(O[f].dimensions[d]||0))){h=!1;break}if(h){m=!0,l.base=O[f];break}}m||(p=p||t+"_STUFF",(e={dimensions:a.dimensions.slice(0)}).key=p,O[p]=e,B[p]={unit:l,prefix:M.NONE[""]},l.base=O[p])}else{if(0<=F.indexOf(p=p||t+"_STUFF"))throw new Error('Cannot create new base unit "'+t+'": a base unit with that name already exists (and cannot be overridden)');for(var y in F.push(p),O)se(O,y)&&(O[y].dimensions[F.length-1]=0);for(var v={dimensions:[]},g=0;g<F.length;g++)v.dimensions[g]=0;v.dimensions[F.length-1]=1,v.key=p,O[p]=v,l={name:t,value:1,dimensions:O[p].dimensions.slice(0),prefixes:c,offset:u,base:O[p]},B[p]={unit:l,prefix:M.NONE[""]}}E.UNITS[t]=l;for(var x=0;x<o.length;x++){var b,w=o[x],N={};for(b in l)se(l,b)&&(N[b]=l[b]);N.name=w,E.UNITS[w]=N}return delete S.cache,new E(null,t)},E.deleteUnit=function(e){delete E.UNITS[e],delete S.cache},E.PREFIXES=M,E.BASE_DIMENSIONS=F,E.BASE_UNITS=O,E.UNIT_SYSTEMS=_,E.UNITS=T,E},{isClass:!0}),Ys=N("unit",["typed","Unit"],function(e){var t=e.typed,r=e.Unit;return t("unit",{Unit:function(e){return e.clone()},string:function(e){return r.isValuelessUnit(e)?new r(null,e):r.parse(e,{allowNoUnits:!0})},"number | BigNumber | Fraction | Complex, string | Unit":function(e,t){return new r(e,t)},"number | BigNumber | Fraction":function(e){return new r(e)},"Array | Matrix":t.referToSelf(function(t){return function(e){return ce(e,t)}})})}),Js=N("sparse",["typed","SparseMatrix"],function(e){var t=e.typed,r=e.SparseMatrix;return t("sparse",{"":function(){return new r([])},string:function(e){return new r([],e)},"Array | Matrix":function(e){return new r(e)},"Array | Matrix, string":function(e,t){return new r(e,t)}})}),Xs="createUnit",Qs=N(Xs,["typed","Unit"],function(e){var t=e.typed,i=e.Unit;return t(Xs,{"Object, Object":function(e,t){return i.createUnit(e,t)},Object:function(e){return i.createUnit(e,{})},"string, Unit | string | Object, Object":function(e,t,r){var n={};return n[e]=t,i.createUnit(n,r)},"string, Unit | string | Object":function(e,t){var r={};return r[e]=t,i.createUnit(r,{})},string:function(e){var t={};return t[e]={},i.createUnit(t,{})}})}),Ks=N("acos",["typed","config","Complex"],function(e){var t=e.typed,r=e.config,n=e.Complex;return t("acos",{number:function(e){return-1<=e&&e<=1||r.predictable?Math.acos(e):new n(e,0).acos()},Complex:function(e){return e.acos()},BigNumber:function(e){return e.acos()}})}),Fi="number";function ec(e){return _e(e)}function tc(e){return Math.atan(1/e)}function rc(e){return isFinite(e)?(Math.log((e+1)/e)+Math.log(e/(e-1)))/2:0}function nc(e){return Math.asin(1/e)}function ic(e){e=1/e;return Math.log(e+Math.sqrt(e*e+1))}function ac(e){return Math.acos(1/e)}function oc(e){var e=1/e,t=Math.sqrt(e*e-1);return Math.log(t+e)}function uc(e){return Be(e)}function sc(e){return ke(e)}function cc(e){return 1/Math.tan(e)}function lc(e){e=Math.exp(2*e);return(e+1)/(e-1)}function fc(e){return 1/Math.sin(e)}function pc(e){return 0===e?Number.POSITIVE_INFINITY:Math.abs(2/(Math.exp(e)-Math.exp(-e)))*n(e)}function mc(e){return 1/Math.cos(e)}function hc(e){return 2/(Math.exp(e)+Math.exp(-e))}function dc(e){return ze(e)}dc.signature=hc.signature=mc.signature=pc.signature=fc.signature=lc.signature=cc.signature=sc.signature=uc.signature=oc.signature=ac.signature=ic.signature=nc.signature=rc.signature=tc.signature=ec.signature=Fi;var yc=N("acosh",["typed","config","Complex"],function(e){var t=e.typed,r=e.config,n=e.Complex;return t("acosh",{number:function(e){return 1<=e||r.predictable?ec(e):e<=-1?new n(Math.log(Math.sqrt(e*e-1)-e),Math.PI):new n(e,0).acosh()},Complex:function(e){return e.acosh()},BigNumber:function(e){return e.acosh()}})}),vc=N("acot",["typed","BigNumber"],function(e){var t=e.typed,r=e.BigNumber;return t("acot",{number:tc,Complex:function(e){return e.acot()},BigNumber:function(e){return new r(1).div(e).atan()}})}),gc=N("acoth",["typed","config","Complex","BigNumber"],function(e){var t=e.typed,r=e.config,n=e.Complex,i=e.BigNumber;return t("acoth",{number:function(e){return 1<=e||e<=-1||r.predictable?rc(e):new n(e,0).acoth()},Complex:function(e){return e.acoth()},BigNumber:function(e){return new i(1).div(e).atanh()}})}),xc=N("acsc",["typed","config","Complex","BigNumber"],function(e){var t=e.typed,r=e.config,n=e.Complex,i=e.BigNumber;return t("acsc",{number:function(e){return e<=-1||1<=e||r.predictable?nc(e):new n(e,0).acsc()},Complex:function(e){return e.acsc()},BigNumber:function(e){return new i(1).div(e).asin()}})}),bc=N("acsch",["typed","BigNumber"],function(e){var t=e.typed,r=e.BigNumber;return t("acsch",{number:ic,Complex:function(e){return e.acsch()},BigNumber:function(e){return new r(1).div(e).asinh()}})}),wc=N("asec",["typed","config","Complex","BigNumber"],function(e){var t=e.typed,r=e.config,n=e.Complex,i=e.BigNumber;return t("asec",{number:function(e){return e<=-1||1<=e||r.predictable?ac(e):new n(e,0).asec()},Complex:function(e){return e.asec()},BigNumber:function(e){return new i(1).div(e).acos()}})}),Nc=N("asech",["typed","config","Complex","BigNumber"],function(e){var t=e.typed,n=e.config,i=e.Complex,r=e.BigNumber;return t("asech",{number:function(e){if(e<=1&&-1<=e||n.predictable){var t=1/e;if(0<t||n.predictable)return oc(e);var r=Math.sqrt(t*t-1);return new i(Math.log(r-t),Math.PI)}return new i(e,0).asech()},Complex:function(e){return e.asech()},BigNumber:function(e){return new r(1).div(e).acosh()}})}),Dc=N("asin",["typed","config","Complex"],function(e){var t=e.typed,r=e.config,n=e.Complex;return t("asin",{number:function(e){return-1<=e&&e<=1||r.predictable?Math.asin(e):new n(e,0).asin()},Complex:function(e){return e.asin()},BigNumber:function(e){return e.asin()}})}),Ec=N("asinh",["typed"],function(e){return(0,e.typed)("asinh",{number:uc,Complex:function(e){return e.asinh()},BigNumber:function(e){return e.asinh()}})}),Ac=N("atan",["typed"],function(e){return(0,e.typed)("atan",{number:function(e){return Math.atan(e)},Complex:function(e){return e.atan()},BigNumber:function(e){return e.atan()}})}),Sc=N("atan2",["typed","matrix","equalScalar","BigNumber","DenseMatrix","concat"],function(e){var t=e.typed,r=e.matrix,n=e.equalScalar,i=e.BigNumber,a=e.DenseMatrix,e=e.concat,o=va({typed:t,equalScalar:n}),u=ga({typed:t}),s=$a({typed:t,equalScalar:n}),n=oa({typed:t,equalScalar:n}),a=f({typed:t,DenseMatrix:a}),r=p({typed:t,matrix:r,concat:e});return t("atan2",{"number, number":Math.atan2,"BigNumber, BigNumber":function(e,t){return i.atan2(e,t)}},r({scalar:"number | BigNumber",SS:s,DS:u,SD:o,Ss:n,sS:a}))}),Cc=N("atanh",["typed","config","Complex"],function(e){var t=e.typed,r=e.config,n=e.Complex;return t("atanh",{number:function(e){return e<=1&&-1<=e||r.predictable?sc(e):new n(e,0).atanh()},Complex:function(e){return e.atanh()},BigNumber:function(e){return e.atanh()}})}),Mc=N("trigUnit",["typed"],function(e){var r=e.typed;return{Unit:r.referToSelf(function(t){return function(e){if(e.hasBase(e.constructor.BASE_UNITS.ANGLE))return r.find(t,e.valueType())(e.value);throw new TypeError("Unit in function cot is no angle")}})}}),Fc=N("cos",["typed"],function(e){var e=e.typed,t=Mc({typed:e});return e("cos",{number:Math.cos,"Complex | BigNumber":function(e){return e.cos()}},t)}),Oc=N("cosh",["typed"],function(e){return(0,e.typed)("cosh",{number:Ie,"Complex | BigNumber":function(e){return e.cosh()}})}),Tc=N("cot",["typed","BigNumber"],function(e){var t=e.typed,r=e.BigNumber;return t("cot",{number:cc,Complex:function(e){return e.cot()},BigNumber:function(e){return new r(1).div(e.tan())}},Mc({typed:t}))}),_c=N("coth",["typed","BigNumber"],function(e){var t=e.typed,r=e.BigNumber;return t("coth",{number:lc,Complex:function(e){return e.coth()},BigNumber:function(e){return new r(1).div(e.tanh())}})}),Bc=N("csc",["typed","BigNumber"],function(e){var t=e.typed,r=e.BigNumber;return t("csc",{number:fc,Complex:function(e){return e.csc()},BigNumber:function(e){return new r(1).div(e.sin())}},Mc({typed:t}))}),kc=N("csch",["typed","BigNumber"],function(e){var t=e.typed,r=e.BigNumber;return t("csch",{number:pc,Complex:function(e){return e.csch()},BigNumber:function(e){return new r(1).div(e.sinh())}})}),Ic=N("sec",["typed","BigNumber"],function(e){var t=e.typed,r=e.BigNumber;return t("sec",{number:mc,Complex:function(e){return e.sec()},BigNumber:function(e){return new r(1).div(e.cos())}},Mc({typed:t}))}),zc=N("sech",["typed","BigNumber"],function(e){var t=e.typed,r=e.BigNumber;return t("sech",{number:hc,Complex:function(e){return e.sech()},BigNumber:function(e){return new r(1).div(e.cosh())}})}),Rc=N("sin",["typed"],function(e){var e=e.typed,t=Mc({typed:e});return e("sin",{number:Math.sin,"Complex | BigNumber":function(e){return e.sin()}},t)}),qc=N("sinh",["typed"],function(e){return(0,e.typed)("sinh",{number:dc,"Complex | BigNumber":function(e){return e.sinh()}})}),jc=N("tan",["typed"],function(e){var e=e.typed,t=Mc({typed:e});return e("tan",{number:Math.tan,"Complex | BigNumber":function(e){return e.tan()}},t)}),Pc=N("tanh",["typed"],function(e){return(0,e.typed)("tanh",{number:Re,"Complex | BigNumber":function(e){return e.tanh()}})}),Lc="setCartesian",Uc=N(Lc,["typed","size","subset","compareNatural","Index","DenseMatrix"],function(e){var t=e.typed,u=e.size,s=e.subset,c=e.compareNatural,l=e.Index,f=e.DenseMatrix;return t(Lc,{"Array | Matrix, Array | Matrix":function(e,t){var r=[];if(0!==s(u(e),new l(0))&&0!==s(u(t),new l(0)))for(var n=E(Array.isArray(e)?e:e.toArray()).sort(c),i=E(Array.isArray(t)?t:t.toArray()).sort(c),r=[],a=0;a<n.length;a++)for(var o=0;o<i.length;o++)r.push([n[a],i[o]]);return Array.isArray(e)&&Array.isArray(t)?r:new f(r)}})}),$c="setDifference",Hc=N($c,["typed","size","subset","compareNatural","Index","DenseMatrix"],function(e){var t=e.typed,s=e.size,c=e.subset,l=e.compareNatural,f=e.Index,p=e.DenseMatrix;return t($c,{"Array | Matrix, Array | Matrix":function(e,t){if(0===c(s(e),new f(0)))i=[];else{if(0===c(s(t),new f(0)))return E(e.toArray());for(var r=Mn(E(Array.isArray(e)?e:e.toArray()).sort(l)),n=Mn(E(Array.isArray(t)?t:t.toArray()).sort(l)),i=[],a=0;a<r.length;a++){for(var o=!1,u=0;u<n.length;u++)if(0===l(r[a].value,n[u].value)&&r[a].identifier===n[u].identifier){o=!0;break}o||i.push(r[a])}}return Array.isArray(e)&&Array.isArray(t)?Fn(i):new p(Fn(i))}})}),Gc="setDistinct",Vc=N(Gc,["typed","size","subset","compareNatural","Index","DenseMatrix"],function(e){var t=e.typed,i=e.size,a=e.subset,o=e.compareNatural,u=e.Index,s=e.DenseMatrix;return t(Gc,{"Array | Matrix":function(e){var t;if(0===a(i(e),new u(0)))t=[];else{var r=E(Array.isArray(e)?e:e.toArray()).sort(o);(t=[]).push(r[0]);for(var n=1;n<r.length;n++)0!==o(r[n],r[n-1])&&t.push(r[n])}return Array.isArray(e)?t:new s(t)}})}),Zc="setIntersect",Wc=N(Zc,["typed","size","subset","compareNatural","Index","DenseMatrix"],function(e){var t=e.typed,u=e.size,s=e.subset,c=e.compareNatural,l=e.Index,f=e.DenseMatrix;return t(Zc,{"Array | Matrix, Array | Matrix":function(e,t){if(0===s(u(e),new l(0))||0===s(u(t),new l(0)))i=[];else for(var r=Mn(E(Array.isArray(e)?e:e.toArray()).sort(c)),n=Mn(E(Array.isArray(t)?t:t.toArray()).sort(c)),i=[],a=0;a<r.length;a++)for(var o=0;o<n.length;o++)if(0===c(r[a].value,n[o].value)&&r[a].identifier===n[o].identifier){i.push(r[a]);break}return Array.isArray(e)&&Array.isArray(t)?Fn(i):new f(Fn(i))}})}),Yc="setIsSubset",Jc=N(Yc,["typed","size","subset","compareNatural","Index"],function(e){var t=e.typed,u=e.size,s=e.subset,c=e.compareNatural,l=e.Index;return t(Yc,{"Array | Matrix, Array | Matrix":function(e,t){if(0===s(u(e),new l(0)))return!0;if(0===s(u(t),new l(0)))return!1;for(var r=Mn(E(Array.isArray(e)?e:e.toArray()).sort(c)),n=Mn(E(Array.isArray(t)?t:t.toArray()).sort(c)),i=0;i<r.length;i++){for(var a=!1,o=0;o<n.length;o++)if(0===c(r[i].value,n[o].value)&&r[i].identifier===n[o].identifier){a=!0;break}if(!1===a)return!1}return!0}})}),Xc="setMultiplicity",Qc=N(Xc,["typed","size","subset","compareNatural","Index"],function(e){var t=e.typed,a=e.size,o=e.subset,u=e.compareNatural,s=e.Index;return t(Xc,{"number | BigNumber | Fraction | Complex, Array | Matrix":function(e,t){if(0===o(a(t),new s(0)))return 0;for(var r=E(Array.isArray(t)?t:t.toArray()),n=0,i=0;i<r.length;i++)0===u(r[i],e)&&n++;return n}})}),Kc="setPowerset",el=N(Kc,["typed","size","subset","compareNatural","Index"],function(e){var t=e.typed,s=e.size,c=e.subset,l=e.compareNatural,f=e.Index;return t(Kc,{"Array | Matrix":function(e){if(0===c(s(e),new f(0)))return[];for(var t=E(Array.isArray(e)?e:e.toArray()).sort(l),r=[],n=0;n.toString(2).length<=t.length;)r.push(function(e,t){for(var r=[],n=0;n<t.length;n++)"1"===t[n]&&r.push(e[n]);return r}(t,n.toString(2).split("").reverse())),n++;for(var i,a=r,o=a.length-1;0<o;o--)for(var u=0;u<o;u++)a[u].length>a[u+1].length&&(i=a[u],a[u]=a[u+1],a[u+1]=i);return a}})}),tl=N("setSize",["typed","compareNatural"],function(e){var t=e.typed,a=e.compareNatural;return t("setSize",{"Array | Matrix":function(e){return(Array.isArray(e)?E(e):E(e.toArray())).length},"Array | Matrix, boolean":function(e,t){if(!1===t||0===e.length)return(Array.isArray(e)?E(e):E(e.toArray())).length;for(var r=E(Array.isArray(e)?e:e.toArray()).sort(a),n=1,i=1;i<r.length;i++)0!==a(r[i],r[i-1])&&n++;return n}})}),rl="setSymDifference",nl=N(rl,["typed","size","concat","subset","setDifference","Index"],function(e){var t=e.typed,r=e.size,n=e.concat,i=e.subset,a=e.setDifference,o=e.Index;return t(rl,{"Array | Matrix, Array | Matrix":function(e,t){if(0===i(r(e),new o(0)))return E(t);if(0===i(r(t),new o(0)))return E(e);e=E(e),t=E(t);return n(a(e,t),a(t,e))}})}),il=N("setUnion",["typed","size","concat","subset","setIntersect","setSymDifference","Index"],function(e){var t=e.typed,r=e.size,n=e.concat,i=e.subset,a=e.setIntersect,o=e.setSymDifference,u=e.Index;return t("setUnion",{"Array | Matrix, Array | Matrix":function(e,t){if(0===i(r(e),new u(0)))return E(t);if(0===i(r(t),new u(0)))return E(e);e=E(e),t=E(t);return n(o(e,t),a(e,t))}})}),al=N("add",["typed","matrix","addScalar","equalScalar","DenseMatrix","SparseMatrix","concat"],function(e){var t=e.typed,r=e.matrix,n=e.addScalar,i=e.equalScalar,a=e.DenseMatrix,e=(e.SparseMatrix,e.concat),o=Da({typed:t}),i=Ea({typed:t,equalScalar:i}),a=Aa({typed:t,DenseMatrix:a}),r=p({typed:t,matrix:r,concat:e});return t("add",{"any, any":n,"any, any, ...any":t.referToSelf(function(a){return function(e,t,r){for(var n=a(e,t),i=0;i<r.length;i++)n=a(n,r[i]);return n}})},r({elop:n,DS:o,SS:i,Ss:a}))}),ol=N("hypot",["typed","abs","addScalar","divideScalar","multiplyScalar","sqrt","smaller","isPositive"],function(e){var t=e.typed,a=e.abs,o=e.addScalar,u=e.divideScalar,s=e.multiplyScalar,c=e.sqrt,l=e.smaller,f=e.isPositive;return t("hypot",{"... number | BigNumber":r,Array:r,Matrix:function(e){return r(E(e.toArray()))}});function r(e){for(var t=0,r=0,n=0;n<e.length;n++){if(Oe(e[n]))throw new TypeError("Unexpected type of argument to hypot");var i=a(e[n]);l(r,i)?(t=s(t,s(u(r,i),u(r,i))),t=o(t,1),r=i):t=o(t,f(i)?s(u(i,r),u(i,r)):i)}return s(r,c(t))}}),ul=N("norm",["typed","abs","add","pow","conj","sqrt","multiply","equalScalar","larger","smaller","matrix","ctranspose","eigs"],function(e){var t=e.typed,m=e.abs,h=e.add,d=e.pow,y=e.conj,v=e.sqrt,g=e.multiply,x=e.equalScalar,b=e.larger,w=e.smaller,r=e.matrix,N=e.ctranspose,D=e.eigs;return t("norm",{number:Math.abs,Complex:function(e){return e.abs()},BigNumber:function(e){return e.abs()},boolean:function(e){return Math.abs(e)},Array:function(e){return E(r(e),2)},Matrix:function(e){return E(e,2)},"Array, number | BigNumber | string":function(e,t){return E(r(e),t)},"Matrix, number | BigNumber | string":E});function E(e,t){var r,n,i,a=e.size();if(1===a.length){var o=e,u=t;if(u===Number.POSITIVE_INFINITY||"inf"===u)return r=0,o.forEach(function(e){e=m(e);b(e,r)&&(r=e)},!0),r;if(u===Number.NEGATIVE_INFINITY||"-inf"===u)return o.forEach(function(e){e=m(e);n&&!w(e,n)||(n=e)},!0),n||0;if("fro"===u)return E(o,2);if("number"!=typeof u||isNaN(u))throw new Error("Unsupported parameter value");return x(u,0)?Number.POSITIVE_INFINITY:(i=0,o.forEach(function(e){i=h(d(m(e),u),i)},!0),d(i,1/u))}if(2===a.length){if(a[0]&&a[1]){var s,c,l,f,p,o=e,a=t;if(1===a)return s=[],c=0,o.forEach(function(e,t){t=t[1],e=h(s[t]||0,m(e));b(e,c)&&(c=e),s[t]=e},!0),c;if(a===Number.POSITIVE_INFINITY||"inf"===a)return l=[],f=0,o.forEach(function(e,t){t=t[0],e=h(l[t]||0,m(e));b(e,f)&&(f=e),l[t]=e},!0),f;if("fro"===a)return p=0,o.forEach(function(e,t){p=h(p,g(e,y(e)))}),m(v(p));if(2!==a)throw new Error("Unsupported parameter value "+a);if((o=(a=o).size())[0]!==o[1])throw new RangeError("Invalid matrix dimensions");return o=N(a),o=g(o,a),a=D(o).values.toArray(),o=a[a.length-1],m(v(o))}throw new RangeError("Invalid matrix dimensions")}}}),sl=N("dot",["typed","addScalar","multiplyScalar","conj","size"],function(e){var v=e.typed,g=e.addScalar,x=e.multiplyScalar,b=e.conj,t=e.size;return v("dot",{"Array | DenseMatrix, Array | DenseMatrix":function(e,t){var r=w(e,t),n=P(e)?e._data:e,i=P(e)?e._datatype||e.getDataType():void 0,a=P(t)?t._data:t,o=P(t)?t._datatype||t.getDataType():void 0,e=2===N(e).length,t=2===N(t).length,u=g,s=x;if(i&&o&&i===o&&"string"==typeof i&&"mixed"!==i&&(u=v.find(g,[o=i,o]),s=v.find(x,[o,o])),!e&&!t){for(var c=s(b(n[0]),a[0]),l=1;l<r;l++)c=u(c,s(b(n[l]),a[l]));return c}if(!e&&t){for(var f=s(b(n[0]),a[0][0]),p=1;p<r;p++)f=u(f,s(b(n[p]),a[p][0]));return f}if(e&&!t){for(var m=s(b(n[0][0]),a[0]),h=1;h<r;h++)m=u(m,s(b(n[h][0]),a[h]));return m}if(e&&t){for(var d=s(b(n[0][0]),a[0][0]),y=1;y<r;y++)d=u(d,s(b(n[y][0]),a[y][0]));return d}},"SparseMatrix, SparseMatrix":function(e,t){w(e,t);for(var r=e._index,n=e._values,i=t._index,a=t._values,o=0,u=g,s=x,c=0,l=0;c<r.length&&l<i.length;){var f=r[c],p=i[l];f<p?c++:p<f?l++:f===p&&(o=u(o,s(n[c],a[l])),c++,l++)}return o}});function w(e,t){var r,n,e=N(e),t=N(t);if(1===e.length)r=e[0];else{if(2!==e.length||1!==e[1])throw new RangeError("Expected a column vector, instead got a matrix of size ("+e.join(", ")+")");r=e[0]}if(1===t.length)n=t[0];else{if(2!==t.length||1!==t[1])throw new RangeError("Expected a column vector, instead got a matrix of size ("+t.join(", ")+")");n=t[0]}if(r!==n)throw new RangeError("Vectors must have equal length ("+r+" != "+n+")");if(0===r)throw new RangeError("Cannot calculate the dot product of empty vectors");return r}function N(e){return P(e)?e.size():t(e)}}),cl=N("trace",["typed","matrix","add"],function(e){var t=e.typed,r=e.matrix,p=e.add;return t("trace",{Array:function(e){return n(r(e))},SparseMatrix:function(e){var t=e._values,r=e._index,n=e._ptr,e=e._size,i=e[0],a=e[1];if(i!==a)throw new RangeError("Matrix must be square (size: "+Fe(e)+")");var o=0;if(0<t.length)for(var u=0;u<a;u++)for(var s=n[u],c=n[u+1],l=s;l<c;l++){var f=r[l];if(f===u){o=p(o,t[l]);break}if(u<f)break}return o},DenseMatrix:n,any:Ce});function n(e){var t=e._size,r=e._data;switch(t.length){case 1:if(1===t[0])return Ce(r[0]);throw new RangeError("Matrix must be square (size: "+Fe(t)+")");case 2:var n=t[0];if(n!==t[1])throw new RangeError("Matrix must be square (size: "+Fe(t)+")");for(var i=0,a=0;a<n;a++)i=p(i,r[a][a]);return i;default:throw new RangeError("Matrix must be two dimensional (size: "+Fe(t)+")")}}}),ll=N("index",["typed","Index"],function(e){var t=e.typed,r=e.Index;return t("index",{"...number | string | BigNumber | Range | Array | Matrix":function(e){var e=e.map(function(e){return Ae(e)?e.toNumber():b(e)||P(e)?e.map(function(e){return Ae(e)?e.toNumber():e}):e}),t=new r;return r.apply(t,e),t}})}),fl=new Set(["end"]),pl=N("Node",["mathWithTransform"],function(e){var t=e.mathWithTransform;return c(function e(){h(this,e)},[{key:"type",get:function(){return"Node"}},{key:"isNode",get:function(){return!0}},{key:"evaluate",value:function(e){return this.compile().evaluate(e)}},{key:"compile",value:function(){var a=this._compile(t,{}),o={};return{evaluate:function(e){for(var e=lt(e),t=e,r=0,n=Me(fl);r<n.length;r++){var i=n[r];if(t.has(i))throw new Error('Scope contains an illegal symbol, "'+i+'" is a reserved keyword')}return a(e,o,null)}}}},{key:"_compile",value:function(e,t){throw new Error("Method _compile must be implemented by type "+this.type)}},{key:"forEach",value:function(e){throw new Error("Cannot run forEach on a Node interface")}},{key:"map",value:function(e){throw new Error("Cannot run map on a Node interface")}},{key:"_ifNode",value:function(e){if(L(e))return e;throw new TypeError("Callback function must return a Node")}},{key:"traverse",value:function(e){e(this,null,null),function n(e,i){e.forEach(function(e,t,r){i(e,t,r),n(e,i)})}(this,e)}},{key:"transform",value:function(i){return function e(t,r,n){r=i(t,r,n);return r!==t?r:t.map(e)}(this,null,null)}},{key:"filter",value:function(n){var i=[];return this.traverse(function(e,t,r){n(e,t,r)&&i.push(e)}),i}},{key:"clone",value:function(){throw new Error("Cannot clone a Node interface")}},{key:"cloneDeep",value:function(){return this.map(function(e){return e.cloneDeep()})}},{key:"equals",value:function(e){return!!e&&this.type===e.type&&Ue(this,e)}},{key:"toString",value:function(e){var t=this._getCustomString(e);return void 0!==t?t:this._toString(e)}},{key:"_toString",value:function(){throw new Error("_toString not implemented for "+this.type)}},{key:"toJSON",value:function(){throw new Error("Cannot serialize object: toJSON not implemented by "+this.type)}},{key:"toHTML",value:function(e){var t=this._getCustomString(e);return void 0!==t?t:this._toHTML(e)}},{key:"_toHTML",value:function(){throw new Error("_toHTML not implemented for "+this.type)}},{key:"toTex",value:function(e){var t=this._getCustomString(e);return void 0!==t?t:this._toTex(e)}},{key:"_toTex",value:function(e){throw new Error("_toTex not implemented for "+this.type)}},{key:"_getCustomString",value:function(e){if(e&&"object"===V(e))switch(V(e.handler)){case"object":case"undefined":return;case"function":return e.handler(this,e);default:throw new TypeError("Object or function expected as callback")}}},{key:"getIdentifier",value:function(){return this.type}},{key:"getContent",value:function(){return this}}])},{isClass:!0,isNode:!0});function ml(e,t){if(t&&("object"===V(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");t=e;if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function g(e){return(g=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function hl(e,t){return(hl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function dl(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&hl(e,t)}function yl(e){return e&&e.isIndexError?new mn(e.index+1,e.min+1,void 0!==e.max?e.max+1:void 0):e}function vl(e){var r=e.subset;return function(e,t){try{if(Array.isArray(e))return r(e,t);if(e&&"function"==typeof e.subset)return e.subset(t);if("string"==typeof e)return r(e,t);if("object"!==V(e))throw new TypeError("Cannot apply index: unsupported type of object");if(t.isObjectProperty())return Xe(e,t.getObjectProperty());throw new TypeError("Cannot apply a numeric index as object property")}catch(e){throw yl(e)}}}function gl(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(gl=function(){return!!e})()}Mh(825);var xl="AccessorNode",bl=N(xl,["subset","Node"],function(e){var t=e.subset,e=e.Node,o=vl({subset:t});function r(e){return!(le(e)||J(e)||ae(e)||pe(e)||re(e)||ne(e)||ue(e))}dl(a,e);t=c(a,[{key:"name",get:function(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}},{key:"type",get:function(){return xl}},{key:"isAccessorNode",get:function(){return!0}},{key:"_compile",value:function(e,t){var n,i=this.object._compile(e,t),a=this.index._compile(e,t);return this.index.isObjectProperty()?(n=this.index.getObjectProperty(),function(e,t,r){return Xe(i(e,t,r),n)}):function(e,t,r){r=i(e,t,r),e=a(e,t,r);return o(r,e)}}},{key:"forEach",value:function(e){e(this.object,"object",this),e(this.index,"index",this)}},{key:"map",value:function(e){return new a(this._ifNode(e(this.object,"object",this)),this._ifNode(e(this.index,"index",this)))}},{key:"clone",value:function(){return new a(this.object,this.index)}},{key:"_toString",value:function(e){var t=this.object.toString(e);return(t=r(this.object)?"("+t+")":t)+this.index.toString(e)}},{key:"_toHTML",value:function(e){var t=this.object.toHTML(e);return(t=r(this.object)?'<span class="math-parenthesis math-round-parenthesis">(</span>'+t+'<span class="math-parenthesis math-round-parenthesis">)</span>':t)+this.index.toHTML(e)}},{key:"_toTex",value:function(e){var t=this.object.toTex(e);return(t=r(this.object)?"\\left(' + object + '\\right)":t)+this.index.toTex(e)}},{key:"toJSON",value:function(){return{mathjs:xl,object:this.object,index:this.index}}}],[{key:"fromJSON",value:function(e){return new a(e.object,e.index)}}]);function a(e,t){var r,n,i;if(h(this,a),r=this,n=g(n=a),n=ml(r,gl()?Reflect.construct(n,i||[],g(r).constructor):n.apply(r,i)),!L(e))throw new TypeError('Node expected for parameter "object"');if(te(t))return n.object=e,n.index=t,n;throw new TypeError('IndexNode expected for parameter "index"')}return A(t,"name",xl),t},{isClass:!0,isNode:!0});function wl(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(wl=function(){return!!e})()}var Nl="ArrayNode",Dl=N(Nl,["Node"],function(e){dl(i,e.Node);e=c(i,[{key:"type",get:function(){return Nl}},{key:"isArrayNode",get:function(){return!0}},{key:"_compile",value:function(t,r){var e,i=Dn(this.items,function(e){return e._compile(t,r)});return"Array"!==t.config.matrix?(e=t.matrix,function(t,r,n){return e(Dn(i,function(e){return e(t,r,n)}))}):function(t,r,n){return Dn(i,function(e){return e(t,r,n)})}}},{key:"forEach",value:function(e){for(var t=0;t<this.items.length;t++)e(this.items[t],"items["+t+"]",this)}},{key:"map",value:function(e){for(var t=[],r=0;r<this.items.length;r++)t[r]=this._ifNode(e(this.items[r],"items["+r+"]",this));return new i(t)}},{key:"clone",value:function(){return new i(this.items.slice(0))}},{key:"_toString",value:function(t){return"["+this.items.map(function(e){return e.toString(t)}).join(", ")+"]"}},{key:"toJSON",value:function(){return{mathjs:Nl,items:this.items}}},{key:"_toHTML",value:function(t){return'<span class="math-parenthesis math-square-parenthesis">[</span>'+this.items.map(function(e){return e.toHTML(t)}).join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-square-parenthesis">]</span>'}},{key:"_toTex",value:function(o){return function t(e,r){var n=e.some(J)&&!e.every(J),i=r||n,a=i?"&":"\\\\",e=e.map(function(e){return e.items?t(e.items,!r):e.toTex(o)}).join(a);return n||!i||i&&!r?"\\begin{bmatrix}"+e+"\\end{bmatrix}":e}(this.items,!1)}}],[{key:"fromJSON",value:function(e){return new i(e.items)}}]);function i(e){var t,r,n;if(h(this,i),t=this,r=g(r=i),(r=ml(t,wl()?Reflect.construct(r,n||[],g(t).constructor):r.apply(t,n))).items=e||[],Array.isArray(r.items)&&r.items.every(L))return r;throw new TypeError("Array containing Nodes expected")}return A(e,"name",Nl),e},{isClass:!0,isNode:!0});function El(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var Al=[{AssignmentNode:{},FunctionAssignmentNode:{}},{ConditionalNode:{latexLeftParens:!1,latexRightParens:!1,latexParens:!1}},{"OperatorNode:or":{op:"or",associativity:"left",associativeWith:[]}},{"OperatorNode:xor":{op:"xor",associativity:"left",associativeWith:[]}},{"OperatorNode:and":{op:"and",associativity:"left",associativeWith:[]}},{"OperatorNode:bitOr":{op:"|",associativity:"left",associativeWith:[]}},{"OperatorNode:bitXor":{op:"^|",associativity:"left",associativeWith:[]}},{"OperatorNode:bitAnd":{op:"&",associativity:"left",associativeWith:[]}},{"OperatorNode:equal":{op:"==",associativity:"left",associativeWith:[]},"OperatorNode:unequal":{op:"!=",associativity:"left",associativeWith:[]},"OperatorNode:smaller":{op:"<",associativity:"left",associativeWith:[]},"OperatorNode:larger":{op:">",associativity:"left",associativeWith:[]},"OperatorNode:smallerEq":{op:"<=",associativity:"left",associativeWith:[]},"OperatorNode:largerEq":{op:">=",associativity:"left",associativeWith:[]},RelationalNode:{associativity:"left",associativeWith:[]}},{"OperatorNode:leftShift":{op:"<<",associativity:"left",associativeWith:[]},"OperatorNode:rightArithShift":{op:">>",associativity:"left",associativeWith:[]},"OperatorNode:rightLogShift":{op:">>>",associativity:"left",associativeWith:[]}},{"OperatorNode:to":{op:"to",associativity:"left",associativeWith:[]}},{RangeNode:{}},{"OperatorNode:add":{op:"+",associativity:"left",associativeWith:["OperatorNode:add","OperatorNode:subtract"]},"OperatorNode:subtract":{op:"-",associativity:"left",associativeWith:[]}},{"OperatorNode:multiply":{op:"*",associativity:"left",associativeWith:["OperatorNode:multiply","OperatorNode:divide","Operator:dotMultiply","Operator:dotDivide"]},"OperatorNode:divide":{op:"/",associativity:"left",associativeWith:[],latexLeftParens:!1,latexRightParens:!1,latexParens:!1},"OperatorNode:dotMultiply":{op:".*",associativity:"left",associativeWith:["OperatorNode:multiply","OperatorNode:divide","OperatorNode:dotMultiply","OperatorNode:doDivide"]},"OperatorNode:dotDivide":{op:"./",associativity:"left",associativeWith:[]},"OperatorNode:mod":{op:"mod",associativity:"left",associativeWith:[]}},{"OperatorNode:multiply":{associativity:"left",associativeWith:["OperatorNode:multiply","OperatorNode:divide","Operator:dotMultiply","Operator:dotDivide"]}},{"OperatorNode:unaryPlus":{op:"+",associativity:"right"},"OperatorNode:unaryMinus":{op:"-",associativity:"right"},"OperatorNode:bitNot":{op:"~",associativity:"right"},"OperatorNode:not":{op:"not",associativity:"right"}},{"OperatorNode:pow":{op:"^",associativity:"right",associativeWith:[],latexRightParens:!1},"OperatorNode:dotPow":{op:".^",associativity:"right",associativeWith:[]}},{"OperatorNode:factorial":{op:"!",associativity:"left"}},{"OperatorNode:ctranspose":{op:"'",associativity:"left"}}];function Sl(e,t){if(!t||"auto"!==t)return e;for(var r=e;ne(r);)r=r.content;return r}function y(e,t,r,n){for(var i=e,a=(i="keep"!==t?e.getContent():i).getIdentifier(),o=null,u=0;u<Al.length;u++)if(a in Al[u]){o=u;break}return"OperatorNode:multiply"!==a||!i.implicit||"show"===r||ae(e=Sl(i.args[0],t))&&n&&"OperatorNode:divide"===n.getIdentifier()&&fe(Sl(n.args[0],t))||"OperatorNode:divide"===e.getIdentifier()&&fe(Sl(e.args[0],t))&&ae(Sl(e.args[1]))||(o+=1),o}function Cl(e,t){var r=e,e=(r="keep"!==t?e.getContent():r).getIdentifier(),r=y(r,t);if(null===r)return null;t=Al[r][e];if(se(t,"associativity")){if("left"===t.associativity)return"left";if("right"===t.associativity)return"right";throw Error("'"+e+"' has the invalid associativity '"+t.associativity+"'.")}return null}function Ml(e,t,r){var n="keep"!==r?e.getContent():e,e="keep"!==r?e.getContent():t,t=n.getIdentifier(),i=e.getIdentifier(),e=y(n,r);if(null===e)return null;var a=Al[e][t];if(se(a,"associativeWith")&&a.associativeWith instanceof Array){for(var o=0;o<a.associativeWith.length;o++)if(a.associativeWith[o]===i)return!0;return!1}return null}function Fl(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Fl=function(){return!!e})()}var Ol="AssignmentNode",Tl=N(Ol,["subset","?matrix","Node"],function(e){var n,i,t=e.subset,r=e.matrix,e=e.Node,p=vl({subset:t}),m=(n=(t={subset:t,matrix:r}).subset,i=t.matrix,function(r,e,t){try{if(Array.isArray(r))return i(r).subset(e,t).valueOf().forEach(function(e,t){r[t]=e}),r;if(r&&"function"==typeof r.subset)return r.subset(e,t);if("string"==typeof r)return n(r,e,t);if("object"!==V(r))throw new TypeError("Cannot apply index: unsupported type of object");if(e.isObjectProperty())return Qe(r,e.getObjectProperty(),t),r;throw TypeError("Cannot apply a numeric index as object property")}catch(r){throw yl(r)}});function a(e,t,r){var n=y(e,t=t||"keep",r),e=y(e.value,t,r);return"all"===t||null!==e&&e<=n}dl(o,e);r=c(o,[{key:"name",get:function(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}},{key:"type",get:function(){return Ol}},{key:"isAssignmentNode",get:function(){return!0}},{key:"_compile",value:function(e,t){var i,a=this.object._compile(e,t),u=this.index?this.index._compile(e,t):null,s=this.value._compile(e,t),o=this.object.name;if(this.index){if(this.index.isObjectProperty())return i=this.index.getObjectProperty(),function(e,t,r){var n=a(e,t,r),e=s(e,t,r);return Qe(n,i,e),e};if(ue(this.object))return function(e,t,r){var n=a(e,t,r),r=s(e,t,r),t=u(e,t,n);return e.set(o,m(n,t,r)),r};var c,l=this.object.object._compile(e,t);if(this.object.index.isObjectProperty())return c=this.object.index.getObjectProperty(),function(e,t,r){var n=l(e,t,r),i=Xe(n,c),a=u(e,t,i),e=s(e,t,r);return Qe(n,c,m(i,a,e)),e};var f=this.object.index._compile(e,t);return function(e,t,r){var n=l(e,t,r),i=f(e,t,n),a=p(n,i),o=u(e,t,a),e=s(e,t,r);return m(n,i,m(a,o,e)),e}}if(ue(this.object))return function(e,t,r){t=s(e,t,r);return e.set(o,t),t};throw new TypeError("SymbolNode expected as object")}},{key:"forEach",value:function(e){e(this.object,"object",this),this.index&&e(this.index,"index",this),e(this.value,"value",this)}},{key:"map",value:function(e){return new o(this._ifNode(e(this.object,"object",this)),this.index?this._ifNode(e(this.index,"index",this)):null,this._ifNode(e(this.value,"value",this)))}},{key:"clone",value:function(){return new o(this.object,this.index,this.value)}},{key:"_toString",value:function(e){var t=this.object.toString(e),r=this.index?this.index.toString(e):"",n=this.value.toString(e);return t+r+" = "+(n=a(this,e&&e.parenthesis,e&&e.implicit)?"("+n+")":n)}},{key:"toJSON",value:function(){return{mathjs:Ol,object:this.object,index:this.index,value:this.value}}},{key:"_toHTML",value:function(e){var t=this.object.toHTML(e),r=this.index?this.index.toHTML(e):"",n=this.value.toHTML(e);return t+r+'<span class="math-operator math-assignment-operator math-variable-assignment-operator math-binary-operator">=</span>'+(n=a(this,e&&e.parenthesis,e&&e.implicit)?'<span class="math-paranthesis math-round-parenthesis">(</span>'+n+'<span class="math-paranthesis math-round-parenthesis">)</span>':n)}},{key:"_toTex",value:function(e){var t=this.object.toTex(e),r=this.index?this.index.toTex(e):"",n=this.value.toTex(e);return t+r+"="+(n=a(this,e&&e.parenthesis,e&&e.implicit)?"\\left(".concat(n,"\\right)"):n)}}],[{key:"fromJSON",value:function(e){return new o(e.object,e.index,e.value)}}]);function o(e,t,r){var n,i,a;if(h(this,o),n=this,i=g(i=o),(i=ml(n,Fl()?Reflect.construct(i,a||[],g(n).constructor):i.apply(n,a))).object=e,i.index=r?t:null,i.value=r||t,!ue(e)&&!le(e))throw new TypeError('SymbolNode or AccessorNode expected as "object"');if(ue(e)&&"end"===e.name)throw new Error('Cannot assign to symbol "end"');if(i.index&&!te(i.index))throw new TypeError('IndexNode expected as "index"');if(L(i.value))return i;throw new TypeError('Node expected as "value"')}return A(r,"name",Ol),r},{isClass:!0,isNode:!0});function _l(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(_l=function(){return!!e})()}var Bl="BlockNode",kl=N(Bl,["ResultSet","Node"],function(e){var o=e.ResultSet,e=(dl(a,e.Node),c(a,[{key:"type",get:function(){return Bl}},{key:"isBlockNode",get:function(){return!0}},{key:"_compile",value:function(t,r){var e=Dn(this.blocks,function(e){return{evaluate:e.node._compile(t,r),visible:e.visible}});return function(r,n,i){var a=[];return En(e,function(e){var t=e.evaluate(r,n,i);e.visible&&a.push(t)}),new o(a)}}},{key:"forEach",value:function(e){for(var t=0;t<this.blocks.length;t++)e(this.blocks[t].node,"blocks["+t+"].node",this)}},{key:"map",value:function(e){for(var t=[],r=0;r<this.blocks.length;r++){var n=this.blocks[r],i=this._ifNode(e(n.node,"blocks["+r+"].node",this));t[r]={node:i,visible:n.visible}}return new a(t)}},{key:"clone",value:function(){return new a(this.blocks.map(function(e){return{node:e.node,visible:e.visible}}))}},{key:"_toString",value:function(t){return this.blocks.map(function(e){return e.node.toString(t)+(e.visible?"":";")}).join("\n")}},{key:"toJSON",value:function(){return{mathjs:Bl,blocks:this.blocks}}},{key:"_toHTML",value:function(t){return this.blocks.map(function(e){return e.node.toHTML(t)+(e.visible?"":'<span class="math-separator">;</span>')}).join('<span class="math-separator"><br /></span>')}},{key:"_toTex",value:function(t){return this.blocks.map(function(e){return e.node.toTex(t)+(e.visible?"":";")}).join("\\;\\;\n")}}],[{key:"fromJSON",value:function(e){return new a(e.blocks)}}]));function a(e){var t,r,n;if(h(this,a),t=this,r=g(r=a),r=ml(t,_l()?Reflect.construct(r,n||[],g(t).constructor):r.apply(t,n)),Array.isArray(e))return r.blocks=e.map(function(e){var t=e&&e.node,e=!e||void 0===e.visible||e.visible;if(!L(t))throw new TypeError('Property "node" must be a Node');if("boolean"!=typeof e)throw new TypeError('Property "visible" must be a boolean');return{node:t,visible:e}}),r;throw new Error("Array expected")}return A(e,"name",Bl),e},{isClass:!0,isNode:!0});function Il(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Il=function(){return!!e})()}var zl="ConditionalNode",Rl=N(zl,["Node"],function(e){dl(o,e.Node);e=c(o,[{key:"type",get:function(){return zl}},{key:"isConditionalNode",get:function(){return!0}},{key:"_compile",value:function(e,t){var n=this.condition._compile(e,t),i=this.trueExpr._compile(e,t),a=this.falseExpr._compile(e,t);return function(e,t,r){return(function(e){if("number"==typeof e||"boolean"==typeof e||"string"==typeof e)return e;if(e){if(Ae(e))return!e.isZero();if(Oe(e))return e.re||e.im;if(Z(e))return e.value}if(null!=e)throw new TypeError('Unsupported type of condition "'+Se(e)+'"')}(n(e,t,r))?i:a)(e,t,r)}}},{key:"forEach",value:function(e){e(this.condition,"condition",this),e(this.trueExpr,"trueExpr",this),e(this.falseExpr,"falseExpr",this)}},{key:"map",value:function(e){return new o(this._ifNode(e(this.condition,"condition",this)),this._ifNode(e(this.trueExpr,"trueExpr",this)),this._ifNode(e(this.falseExpr,"falseExpr",this)))}},{key:"clone",value:function(){return new o(this.condition,this.trueExpr,this.falseExpr)}},{key:"_toString",value:function(e){var t=e&&e.parenthesis?e.parenthesis:"keep",r=y(this,t,e&&e.implicit),n=this.condition.toString(e),i=y(this.condition,t,e&&e.implicit),i=(("all"===t||"OperatorNode"===this.condition.type||null!==i&&i<=r)&&(n="("+n+")"),this.trueExpr.toString(e)),a=y(this.trueExpr,t,e&&e.implicit),a=(("all"===t||"OperatorNode"===this.trueExpr.type||null!==a&&a<=r)&&(i="("+i+")"),this.falseExpr.toString(e)),e=y(this.falseExpr,t,e&&e.implicit);return n+" ? "+i+" : "+(a="all"===t||"OperatorNode"===this.falseExpr.type||null!==e&&e<=r?"("+a+")":a)}},{key:"toJSON",value:function(){return{mathjs:zl,condition:this.condition,trueExpr:this.trueExpr,falseExpr:this.falseExpr}}},{key:"_toHTML",value:function(e){var t=e&&e.parenthesis?e.parenthesis:"keep",r=y(this,t,e&&e.implicit),n=this.condition.toHTML(e),i=y(this.condition,t,e&&e.implicit),i=(("all"===t||"OperatorNode"===this.condition.type||null!==i&&i<=r)&&(n='<span class="math-parenthesis math-round-parenthesis">(</span>'+n+'<span class="math-parenthesis math-round-parenthesis">)</span>'),this.trueExpr.toHTML(e)),a=y(this.trueExpr,t,e&&e.implicit),a=(("all"===t||"OperatorNode"===this.trueExpr.type||null!==a&&a<=r)&&(i='<span class="math-parenthesis math-round-parenthesis">(</span>'+i+'<span class="math-parenthesis math-round-parenthesis">)</span>'),this.falseExpr.toHTML(e)),e=y(this.falseExpr,t,e&&e.implicit);return n+'<span class="math-operator math-conditional-operator">?</span>'+i+'<span class="math-operator math-conditional-operator">:</span>'+(a="all"===t||"OperatorNode"===this.falseExpr.type||null!==e&&e<=r?'<span class="math-parenthesis math-round-parenthesis">(</span>'+a+'<span class="math-parenthesis math-round-parenthesis">)</span>':a)}},{key:"_toTex",value:function(e){return"\\begin{cases} {"+this.trueExpr.toTex(e)+"}, &\\quad{\\text{if }\\;"+this.condition.toTex(e)+"}\\\\{"+this.falseExpr.toTex(e)+"}, &\\quad{\\text{otherwise}}\\end{cases}"}}],[{key:"fromJSON",value:function(e){return new o(e.condition,e.trueExpr,e.falseExpr)}}]);function o(e,t,r){var n,i,a;if(h(this,o),n=this,i=g(i=o),i=ml(n,Il()?Reflect.construct(i,a||[],g(n).constructor):i.apply(n,a)),!L(e))throw new TypeError("Parameter condition must be a Node");if(!L(t))throw new TypeError("Parameter trueExpr must be a Node");if(L(r))return i.condition=e,i.trueExpr=t,i.falseExpr=r,i;throw new TypeError("Parameter falseExpr must be a Node")}return A(e,"name",zl),e},{isClass:!0,isNode:!0}),ql=Mh(3144),jl={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{?}"},m={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"},Pl={abs:{1:"\\left|${args[0]}\\right|"},add:{2:"\\left(${args[0]}".concat(m.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(m.dotDivide,"${args[1]}\\right)")},dotMultiply:{2:"\\left(${args[0]}".concat(m.dotMultiply,"${args[1]}\\right)")},dotPow:{2:"\\left(${args[0]}".concat(m.dotPow,"${args[1]}\\right)")},exp:{1:"\\exp\\left(${args[0]}\\right)"},expm1:"\\left(e".concat(m.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(m.mod,"${args[1]}\\right)")},multiply:{2:"\\left(${args[0]}".concat(m.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(m.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(m.subtract,"${args[1]}\\right)")},unaryMinus:{1:"".concat(m.unaryMinus,"\\left(${args[0]}\\right)")},unaryPlus:{1:"".concat(m.unaryPlus,"\\left(${args[0]}\\right)")},bitAnd:{2:"\\left(${args[0]}".concat(m.bitAnd,"${args[1]}\\right)")},bitNot:{1:m.bitNot+"\\left(${args[0]}\\right)"},bitOr:{2:"\\left(${args[0]}".concat(m.bitOr,"${args[1]}\\right)")},bitXor:{2:"\\left(${args[0]}".concat(m.bitXor,"${args[1]}\\right)")},leftShift:{2:"\\left(${args[0]}".concat(m.leftShift,"${args[1]}\\right)")},rightArithShift:{2:"\\left(${args[0]}".concat(m.rightArithShift,"${args[1]}\\right)")},rightLogShift:{2:"\\left(${args[0]}".concat(m.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(m.and,"${args[1]}\\right)")},not:{1:m.not+"\\left(${args[0]}\\right)"},or:{2:"\\left(${args[0]}".concat(m.or,"${args[1]}\\right)")},xor:{2:"\\left(${args[0]}".concat(m.xor,"${args[1]}\\right)")},cross:{2:"\\left(${args[0]}\\right)\\times\\left(${args[1]}\\right)"},ctranspose:{1:"\\left(${args[0]}\\right)".concat(m.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(m.pow,"{\\frac{1}{2}}")},trace:{1:"\\mathrm{tr}\\left(${args[0]}\\right)"},transpose:{1:"\\left(${args[0]}\\right)".concat(m.transpose)},combinations:{2:"\\binom{${args[0]}}{${args[1]}}"},combinationsWithRep:{2:"\\left(\\!\\!{\\binom{${args[0]}}{${args[1]}}}\\!\\!\\right)"},factorial:{1:"\\left(${args[0]}\\right)".concat(m.factorial)},gamma:{1:"\\Gamma\\left(${args[0]}\\right)"},lgamma:{1:"\\ln\\Gamma\\left(${args[0]}\\right)"},equal:{2:"\\left(${args[0]}".concat(m.equal,"${args[1]}\\right)")},larger:{2:"\\left(${args[0]}".concat(m.larger,"${args[1]}\\right)")},largerEq:{2:"\\left(${args[0]}".concat(m.largerEq,"${args[1]}\\right)")},smaller:{2:"\\left(${args[0]}".concat(m.smaller,"${args[1]}\\right)")},smallerEq:{2:"\\left(${args[0]}".concat(m.smallerEq,"${args[1]}\\right)")},unequal:{2:"\\left(${args[0]}".concat(m.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(m.to,"${args[1]}\\right)")},numeric:function(e,t){return e.args[0].toTex()},number:{0:"0",1:"\\left(${args[0]}\\right)",2:"\\left(\\left(${args[0]}\\right)${args[1]}\\right)"},string:{0:'\\mathtt{""}',1:"\\mathrm{string}\\left(${args[0]}\\right)"},bignumber:{0:"0",1:"\\left(${args[0]}\\right)"},complex:{0:"0",1:"\\left(${args[0]}\\right)",2:"\\left(\\left(${args[0]}\\right)+".concat(jl.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)"}},Ll={deg:"^\\circ"};function Ul(e){return ql(e,{preserveFormatting:!0})}function $l(e,t){return(t=void 0!==t&&t)?se(Ll,e)?Ll[e]:"\\mathrm{"+Ul(e)+"}":se(jl,e)?jl[e]:Ul(e)}function Hl(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Hl=function(){return!!e})()}var Gl="ConstantNode",Vl=N(Gl,["Node"],function(e){dl(i,e.Node);e=c(i,[{key:"type",get:function(){return Gl}},{key:"isConstantNode",get:function(){return!0}},{key:"_compile",value:function(e,t){var r=this.value;return function(){return r}}},{key:"forEach",value:function(e){}},{key:"map",value:function(e){return this.clone()}},{key:"clone",value:function(){return new i(this.value)}},{key:"_toString",value:function(e){return Fe(this.value,e)}},{key:"_toHTML",value:function(e){var t=this._toString(e);switch(Se(this.value)){case"number":case"BigNumber":case"Fraction":return'<span class="math-number">'+t+"</span>";case"string":return'<span class="math-string">'+t+"</span>";case"boolean":return'<span class="math-boolean">'+t+"</span>";case"null":return'<span class="math-null-symbol">'+t+"</span>";case"undefined":return'<span class="math-undefined">'+t+"</span>";default:return'<span class="math-symbol">'+t+"</span>"}}},{key:"toJSON",value:function(){return{mathjs:Gl,value:this.value}}},{key:"_toTex",value:function(e){var t=this._toString(e),r=Se(this.value);switch(r){case"string":return"\\mathtt{"+Ul(t)+"}";case"number":case"BigNumber":if(!("BigNumber"===r?this.value.isFinite():isFinite(this.value)))return this.value.valueOf()<0?"-\\infty":"\\infty";var n=t.toLowerCase().indexOf("e");return-1!==n?t.substring(0,n)+"\\cdot10^{"+t.substring(n+1)+"}":t;case"Fraction":return this.value.toLatex();default:return t}}}],[{key:"fromJSON",value:function(e){return new i(e.value)}}]);function i(e){var t,r,n;return h(this,i),t=this,r=g(r=i),(r=ml(t,Hl()?Reflect.construct(r,n||[],g(t).constructor):r.apply(t,n))).value=e,r}return A(e,"name",Gl),e},{isClass:!0,isNode:!0});function Zl(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Wl(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Wl=function(){return!!e})()}var Yl="FunctionAssignmentNode",Jl=N(Yl,["typed","Node"],function(e){var l=e.typed;function a(e,t,r){var n=y(e,t,r),e=y(e.expr,t,r);return"all"===t||null!==e&&e<=n}dl(f,e.Node);e=c(f,[{key:"type",get:function(){return Yl}},{key:"isFunctionAssignmentNode",get:function(){return!0}},{key:"_compile",value:function(e,t){var r=Object.create(t),a=(En(this.params,function(e){r[e]=!0}),this.expr._compile(e,r)),o=this.name,u=this.params,s=Cn(this.types,","),c=o+"("+Cn(this.params,", ")+")";return function(r,n,i){var e={},e=(e[s]=function(){for(var e=Object.create(n),t=0;t<u.length;t++)e[u[t]]=arguments[t];return a(r,e,i)},l(o,e));return e.syntax=c,r.set(o,e),e}}},{key:"forEach",value:function(e){e(this.expr,"expr",this)}},{key:"map",value:function(e){e=this._ifNode(e(this.expr,"expr",this));return new f(this.name,this.params.slice(0),e)}},{key:"clone",value:function(){return new f(this.name,this.params.slice(0),this.expr)}},{key:"_toString",value:function(e){var t=e&&e.parenthesis?e.parenthesis:"keep",r=this.expr.toString(e);return a(this,t,e&&e.implicit)&&(r="("+r+")"),this.name+"("+this.params.join(", ")+") = "+r}},{key:"toJSON",value:function(){var r=this.types;return{mathjs:Yl,name:this.name,params:this.params.map(function(e,t){return{name:e,type:r[t]}}),expr:this.expr}}},{key:"_toHTML",value:function(e){for(var t=e&&e.parenthesis?e.parenthesis:"keep",r=[],n=0;n<this.params.length;n++)r.push('<span class="math-symbol math-parameter">'+fn(this.params[n])+"</span>");var i=this.expr.toHTML(e);return a(this,t,e&&e.implicit)&&(i='<span class="math-parenthesis math-round-parenthesis">(</span>'+i+'<span class="math-parenthesis math-round-parenthesis">)</span>'),'<span class="math-function">'+fn(this.name)+'</span><span class="math-parenthesis math-round-parenthesis">(</span>'+r.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>'+i}},{key:"_toTex",value:function(e){var t=e&&e.parenthesis?e.parenthesis:"keep",r=this.expr.toTex(e);return a(this,t,e&&e.implicit)&&(r="\\left(".concat(r,"\\right)")),"\\mathrm{"+this.name+"}\\left("+this.params.map($l).join(",")+"\\right)="+r}}],[{key:"fromJSON",value:function(e){return new f(e.name,e.params,e.expr)}}]);function f(e,t,r){var n,i,a;if(h(this,f),n=this,i=g(i=f),i=ml(n,Wl()?Reflect.construct(i,a||[],g(n).constructor):i.apply(n,a)),"string"!=typeof e)throw new TypeError('String expected for parameter "name"');if(!Array.isArray(t))throw new TypeError('Array containing strings or objects expected for parameter "params"');if(!L(r))throw new TypeError('Node expected for parameter "expr"');if(fl.has(e))throw new Error('Illegal function name, "'+e+'" is a reserved keyword');var o,u=new Set,s=function(e){var t,r,n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e){if(e){if("string"==typeof e)return Zl(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(t="Object"===t&&e.constructor?e.constructor.name:t)||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Zl(e,void 0):void 0}}(e)))return n&&(e=n),t=0,{s:r=function(){},n:function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}},e:function(e){throw e},f:r};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,o=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){o=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(o)throw i}}}}(t);try{for(s.s();!(o=s.n()).done;){var c=o.value,l="string"==typeof c?c:c.name;if(u.has(l))throw new Error('Duplicate parameter name "'.concat(l,'"'));u.add(l)}}catch(e){s.e(e)}finally{s.f()}return i.name=e,i.params=t.map(function(e){return e&&e.name||e}),i.types=t.map(function(e){return e&&e.type||"any"}),i.expr=r,i}return A(e,"name",Yl),e},{isClass:!0,isNode:!0});function Xl(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Xl=function(){return!!e})()}var Ql="IndexNode",Kl=N(Ql,["Node","size"],function(e){var t=e.Node,o=e.size,e=(dl(a,t),c(a,[{key:"type",get:function(){return Ql}},{key:"isIndexNode",get:function(){return!0}},{key:"_compile",value:function(r,n){var i=Dn(this.dimensions,function(e,i){var t,a;return 0<e.filter(function(e){return e.isSymbolNode&&"end"===e.name}).length?((t=Object.create(n)).end=!0,a=e._compile(r,t),function(e,t,r){if(!P(r)&&!b(r)&&!S(r))throw new TypeError('Cannot resolve "end": context must be a Matrix, Array, or string but is '+Se(r));var n=o(r).valueOf(),t=Object.create(t);return t.end=n[i],a(e,t,r)}):e._compile(r,n)}),a=Xe(r,"index");return function(t,r,n){var e=Dn(i,function(e){return e(t,r,n)});return a.apply(void 0,Me(e))}}},{key:"forEach",value:function(e){for(var t=0;t<this.dimensions.length;t++)e(this.dimensions[t],"dimensions["+t+"]",this)}},{key:"map",value:function(e){for(var t=[],r=0;r<this.dimensions.length;r++)t[r]=this._ifNode(e(this.dimensions[r],"dimensions["+r+"]",this));return new a(t,this.dotNotation)}},{key:"clone",value:function(){return new a(this.dimensions.slice(0),this.dotNotation)}},{key:"isObjectProperty",value:function(){return 1===this.dimensions.length&&ae(this.dimensions[0])&&"string"==typeof this.dimensions[0].value}},{key:"getObjectProperty",value:function(){return this.isObjectProperty()?this.dimensions[0].value:null}},{key:"_toString",value:function(e){return this.dotNotation?"."+this.getObjectProperty():"["+this.dimensions.join(", ")+"]"}},{key:"toJSON",value:function(){return{mathjs:Ql,dimensions:this.dimensions,dotNotation:this.dotNotation}}},{key:"_toHTML",value:function(e){for(var t=[],r=0;r<this.dimensions.length;r++)t[r]=this.dimensions[r].toHTML();return this.dotNotation?'<span class="math-operator math-accessor-operator">.</span><span class="math-symbol math-property">'+fn(this.getObjectProperty())+"</span>":'<span class="math-parenthesis math-square-parenthesis">[</span>'+t.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-square-parenthesis">]</span>'}},{key:"_toTex",value:function(t){var e=this.dimensions.map(function(e){return e.toTex(t)});return this.dotNotation?"."+this.getObjectProperty():"_{"+e.join(",")+"}"}}],[{key:"fromJSON",value:function(e){return new a(e.dimensions,e.dotNotation)}}]));function a(e,t){var r,n,i;if(h(this,a),r=this,n=g(n=a),(n=ml(r,Xl()?Reflect.construct(n,i||[],g(r).constructor):n.apply(r,i))).dimensions=e,n.dotNotation=t||!1,!Array.isArray(e)||!e.every(L))throw new TypeError('Array containing Nodes expected for parameter "dimensions"');if(n.dotNotation&&!n.isObjectProperty())throw new Error("dotNotation only applicable for object properties");return n}return A(e,"name",Ql),e},{isClass:!0,isNode:!0});function ef(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ef=function(){return!!e})()}var tf="ObjectNode",rf=N(tf,["Node"],function(e){dl(i,e.Node);e=c(i,[{key:"type",get:function(){return tf}},{key:"isObjectNode",get:function(){return!0}},{key:"_compile",value:function(e,t){var r,n,i,a={};for(r in this.properties)se(this.properties,r)&&(n=cn(r),n=JSON.parse(n),i=Xe(this.properties,r),a[n]=i._compile(e,t));return function(e,t,r){var n,i={};for(n in a)se(a,n)&&(i[n]=a[n](e,t,r));return i}}},{key:"forEach",value:function(e){for(var t in this.properties)se(this.properties,t)&&e(this.properties[t],"properties["+cn(t)+"]",this)}},{key:"map",value:function(e){var t,r={};for(t in this.properties)se(this.properties,t)&&(r[t]=this._ifNode(e(this.properties[t],"properties["+cn(t)+"]",this)));return new i(r)}},{key:"clone",value:function(){var e,t={};for(e in this.properties)se(this.properties,e)&&(t[e]=this.properties[e]);return new i(t)}},{key:"_toString",value:function(e){var t,r=[];for(t in this.properties)se(this.properties,t)&&r.push(cn(t)+": "+this.properties[t].toString(e));return"{"+r.join(", ")+"}"}},{key:"toJSON",value:function(){return{mathjs:tf,properties:this.properties}}},{key:"_toHTML",value:function(e){var t,r=[];for(t in this.properties)se(this.properties,t)&&r.push('<span class="math-symbol math-property">'+fn(t)+'</span><span class="math-operator math-assignment-operator math-property-assignment-operator math-binary-operator">:</span>'+this.properties[t].toHTML(e));return'<span class="math-parenthesis math-curly-parenthesis">{</span>'+r.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-curly-parenthesis">}</span>'}},{key:"_toTex",value:function(e){var t,r=[];for(t in this.properties)se(this.properties,t)&&r.push("\\mathbf{"+t+":} & "+this.properties[t].toTex(e)+"\\\\");return"\\left\\{\\begin{array}{ll}"+r.join("\n")+"\\end{array}\\right\\}"}}],[{key:"fromJSON",value:function(e){return new i(e.properties)}}]);function i(t){var e,r,n;if(h(this,i),e=this,r=g(r=i),(r=ml(e,ef()?Reflect.construct(r,n||[],g(e).constructor):r.apply(e,n))).properties=t||{},!t||"object"===V(t)&&Object.keys(t).every(function(e){return L(t[e])}))return r;throw new TypeError("Object containing Nodes expected")}return A(e,"name",tf),e},{isClass:!0,isNode:!0});function nf(e,t){return new ut(e,new ot(t),new Set(Object.keys(t)))}function af(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(af=function(){return!!e})()}var of="OperatorNode",uf=N(of,["Node"],function(e){function f(n,i,a,e,t){var r,o=y(n,i,a),u=Cl(n,i);if("all"===i||2<e.length&&"OperatorNode:add"!==n.getIdentifier()&&"OperatorNode:multiply"!==n.getIdentifier())return e.map(function(e){switch(e.getContent().type){case"ArrayNode":case"ConstantNode":case"SymbolNode":case"ParenthesisNode":return!1;default:return!0}});switch(e.length){case 0:r=[];break;case 1:var s=y(e[0],i,a,n);if(t&&null!==s){var c="keep"===i?(m=e[0].getIdentifier(),n.getIdentifier()):(m=e[0].getContent().getIdentifier(),n.getContent().getIdentifier());if(!1===Al[o][c].latexLeftParens){r=[!1];break}if(!1===Al[s][m].latexParens){r=[!1];break}}if(null===s){r=[!1];break}if(s<=o){r=[!0];break}r=[!1];break;case 2:var l,f,p,c=y(e[0],i,a,n),m=Ml(n,e[0],i),s=null!==c&&(c===o&&"right"===u&&!m||c<o),m=y(e[1],i,a,n),h=Ml(n,e[1],i),h=null!==m&&(m===o&&"left"===u&&!h||m<o);t&&(p="keep"===i?(l=n.getIdentifier(),f=n.args[0].getIdentifier(),n.args[1].getIdentifier()):(l=n.getContent().getIdentifier(),f=n.args[0].getContent().getIdentifier(),n.args[1].getContent().getIdentifier()),null!==c&&(!1===Al[o][l].latexLeftParens&&(s=!1),!1===Al[c][f].latexParens&&(s=!1)),null!==m&&(!1===Al[o][l].latexRightParens&&(h=!1),!1===Al[m][p].latexParens&&(h=!1))),r=[s,h];break;default:"OperatorNode:add"!==n.getIdentifier()&&"OperatorNode:multiply"!==n.getIdentifier()||(r=e.map(function(e){var t=y(e,i,a,n),r=Ml(n,e,i),e=Cl(e,i);return null!==t&&(o===t&&u===e&&!r||t<o)}))}if(2<=e.length&&"OperatorNode:multiply"===n.getIdentifier()&&n.implicit&&"all"!==i&&"hide"===a)for(var d=1;d<r.length;++d)!function e(t,r){var n=t;if("auto"===r)for(;ne(n);)n=n.content;return!!ae(n)||!!oe(n)&&e(n.args[0],r)}(e[d],i)||r[d-1]||"keep"===i&&ne(e[d-1])||(r[d]=!0);return r}dl(s,e.Node);e=c(s,[{key:"type",get:function(){return of}},{key:"isOperatorNode",get:function(){return!0}},{key:"_compile",value:function(n,t){if("string"!=typeof this.fn||!et(n,this.fn))throw n[this.fn]?new Error('No access to function "'+this.fn+'"'):new Error("Function "+this.fn+' missing in provided namespace "math"');var i,a,o,u,s=Xe(n,this.fn),e=Dn(this.args,function(e){return e._compile(n,t)});return"function"==typeof s&&!0===s.rawArgs?(i=this.args,function(e,t,r){return s(i,n,nf(e,t))}):1===e.length?(a=e[0],function(e,t,r){return s(a(e,t,r))}):2===e.length?(o=e[0],u=e[1],function(e,t,r){return s(o(e,t,r),u(e,t,r))}):function(t,r,n){return s.apply(null,Dn(e,function(e){return e(t,r,n)}))}}},{key:"forEach",value:function(e){for(var t=0;t<this.args.length;t++)e(this.args[t],"args["+t+"]",this)}},{key:"map",value:function(e){for(var t=[],r=0;r<this.args.length;r++)t[r]=this._ifNode(e(this.args[r],"args["+r+"]",this));return new s(this.op,this.fn,t,this.implicit,this.isPercentage)}},{key:"clone",value:function(){return new s(this.op,this.fn,this.args.slice(0),this.implicit,this.isPercentage)}},{key:"isUnary",value:function(){return 1===this.args.length}},{key:"isBinary",value:function(){return 2===this.args.length}},{key:"_toString",value:function(r){var e,t,n=r&&r.parenthesis?r.parenthesis:"keep",i=r&&r.implicit?r.implicit:"hide",a=this.args,o=f(this,n,i,a,!1);return 1===a.length?(n=Cl(this,n),t=a[0].toString(r),o[0]&&(t="("+t+")"),e=/[a-zA-Z]+/.test(this.op),"right"===n?this.op+(e?" ":"")+t:"left"===n?t+(e?" ":"")+this.op:t+this.op):2===a.length?(n=a[0].toString(r),e=a[1].toString(r),o[0]&&(n="("+n+")"),o[1]&&(e="("+e+")"),this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===i?n+" "+e:n+" "+this.op+" "+e):2<a.length&&("OperatorNode:add"===this.getIdentifier()||"OperatorNode:multiply"===this.getIdentifier())?(t=a.map(function(e,t){return e=e.toString(r),e=o[t]?"("+e+")":e}),this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===i?t.join(" "):t.join(" "+this.op+" ")):this.fn+"("+this.args.join(", ")+")"}},{key:"toJSON",value:function(){return{mathjs:of,op:this.op,fn:this.fn,args:this.args,implicit:this.implicit,isPercentage:this.isPercentage}}},{key:"_toHTML",value:function(r){var e,t=r&&r.parenthesis?r.parenthesis:"keep",n=r&&r.implicit?r.implicit:"hide",i=this.args,a=f(this,t,n,i,!1);if(1===i.length)return t=Cl(this,t),e=i[0].toHTML(r),a[0]&&(e='<span class="math-parenthesis math-round-parenthesis">(</span>'+e+'<span class="math-parenthesis math-round-parenthesis">)</span>'),"right"===t?'<span class="math-operator math-unary-operator math-lefthand-unary-operator">'+fn(this.op)+"</span>"+e:e+'<span class="math-operator math-unary-operator math-righthand-unary-operator">'+fn(this.op)+"</span>";if(2===i.length)return t=i[0].toHTML(r),e=i[1].toHTML(r),a[0]&&(t='<span class="math-parenthesis math-round-parenthesis">(</span>'+t+'<span class="math-parenthesis math-round-parenthesis">)</span>'),a[1]&&(e='<span class="math-parenthesis math-round-parenthesis">(</span>'+e+'<span class="math-parenthesis math-round-parenthesis">)</span>'),this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===n?t+'<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>'+e:t+'<span class="math-operator math-binary-operator math-explicit-binary-operator">'+fn(this.op)+"</span>"+e;t=i.map(function(e,t){return e=e.toHTML(r),e=a[t]?'<span class="math-parenthesis math-round-parenthesis">(</span>'+e+'<span class="math-parenthesis math-round-parenthesis">)</span>':e});return 2<i.length&&("OperatorNode:add"===this.getIdentifier()||"OperatorNode:multiply"===this.getIdentifier())?this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===n?t.join('<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>'):t.join('<span class="math-operator math-binary-operator math-explicit-binary-operator">'+fn(this.op)+"</span>"):'<span class="math-function">'+fn(this.fn)+'</span><span class="math-paranthesis math-round-parenthesis">(</span>'+t.join('<span class="math-separator">,</span>')+'<span class="math-paranthesis math-round-parenthesis">)</span>'}},{key:"_toTex",value:function(r){var e,t=r&&r.parenthesis?r.parenthesis:"keep",n=r&&r.implicit?r.implicit:"hide",i=this.args,a=f(this,t,n,i,!0),o=void 0===(o=m[this.fn])?this.op:o;if(1===i.length)return e=Cl(this,t),u=i[0].toTex(r),a[0]&&(u="\\left(".concat(u,"\\right)")),"right"===e?o+u:u+o;if(2!==i.length)return 2<i.length&&("OperatorNode:add"===this.getIdentifier()||"OperatorNode:multiply"===this.getIdentifier())?(e=i.map(function(e,t){return e=e.toTex(r),e=a[t]?"\\left(".concat(e,"\\right)"):e}),"OperatorNode:multiply"===this.getIdentifier()&&this.implicit&&"hide"===n?e.join("~"):e.join(o)):"\\mathrm{"+this.fn+"}\\left("+i.map(function(e){return e.toTex(r)}).join(",")+"\\right)";var u=i[0],s=u.toTex(r);a[0]&&(s="\\left(".concat(s,"\\right)"));var c,l=i[1].toTex(r);switch(a[1]&&(l="\\left(".concat(l,"\\right)")),c=("keep"===t?u:u.getContent()).getIdentifier(),this.getIdentifier()){case"OperatorNode:divide":return o+"{"+s+"}{"+l+"}";case"OperatorNode:pow":switch(s="{"+s+"}",l="{"+l+"}",c){case"ConditionalNode":case"OperatorNode:divide":s="\\left(".concat(s,"\\right)")}break;case"OperatorNode:multiply":if(this.implicit&&"hide"===n)return s+"~"+l}return s+o+l}},{key:"getIdentifier",value:function(){return this.type+":"+this.fn}}],[{key:"fromJSON",value:function(e){return new s(e.op,e.fn,e.args,e.implicit,e.isPercentage)}}]);function s(e,t,r,n,i){var a,o,u;if(h(this,s),a=this,o=g(o=s),o=ml(a,af()?Reflect.construct(o,u||[],g(a).constructor):o.apply(a,u)),"string"!=typeof e)throw new TypeError('string expected for parameter "op"');if("string"!=typeof t)throw new TypeError('string expected for parameter "fn"');if(Array.isArray(r)&&r.every(L))return o.implicit=!0===n,o.isPercentage=!0===i,o.op=e,o.fn=t,o.args=r||[],o;throw new TypeError('Array containing Nodes expected for parameter "args"')}return A(e,"name",of),e},{isClass:!0,isNode:!0});function sf(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(sf=function(){return!!e})()}var cf="ParenthesisNode",lf=N(cf,["Node"],function(e){dl(i,e.Node);e=c(i,[{key:"type",get:function(){return cf}},{key:"isParenthesisNode",get:function(){return!0}},{key:"_compile",value:function(e,t){return this.content._compile(e,t)}},{key:"getContent",value:function(){return this.content.getContent()}},{key:"forEach",value:function(e){e(this.content,"content",this)}},{key:"map",value:function(e){return new i(e(this.content,"content",this))}},{key:"clone",value:function(){return new i(this.content)}},{key:"_toString",value:function(e){return!e||!e.parenthesis||e&&"keep"===e.parenthesis?"("+this.content.toString(e)+")":this.content.toString(e)}},{key:"toJSON",value:function(){return{mathjs:cf,content:this.content}}},{key:"_toHTML",value:function(e){return!e||!e.parenthesis||e&&"keep"===e.parenthesis?'<span class="math-parenthesis math-round-parenthesis">(</span>'+this.content.toHTML(e)+'<span class="math-parenthesis math-round-parenthesis">)</span>':this.content.toHTML(e)}},{key:"_toTex",value:function(e){return!e||!e.parenthesis||e&&"keep"===e.parenthesis?"\\left(".concat(this.content.toTex(e),"\\right)"):this.content.toTex(e)}}],[{key:"fromJSON",value:function(e){return new i(e.content)}}]);function i(e){var t,r,n;if(h(this,i),t=this,r=g(r=i),r=ml(t,sf()?Reflect.construct(r,n||[],g(t).constructor):r.apply(t,n)),L(e))return r.content=e,r;throw new TypeError('Node expected for parameter "content"')}return A(e,"name",cf),e},{isClass:!0,isNode:!0});function ff(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ff=function(){return!!e})()}var pf="RangeNode",mf=N(pf,["Node"],function(e){function i(e,t,r){var n=y(e,t,r),i={},a=y(e.start,t,r),a=(i.start=null!==a&&a<=n||"all"===t,e.step&&(a=y(e.step,t,r),i.step=null!==a&&a<=n||"all"===t),y(e.end,t,r));return i.end=null!==a&&a<=n||"all"===t,i}dl(o,e.Node);e=c(o,[{key:"type",get:function(){return pf}},{key:"isRangeNode",get:function(){return!0}},{key:"needsEnd",value:function(){return 0<this.filter(function(e){return ue(e)&&"end"===e.name}).length}},{key:"_compile",value:function(e,t){var n,i=e.range,a=this.start._compile(e,t),o=this.end._compile(e,t);return this.step?(n=this.step._compile(e,t),function(e,t,r){return i(a(e,t,r),o(e,t,r),n(e,t,r))}):function(e,t,r){return i(a(e,t,r),o(e,t,r))}}},{key:"forEach",value:function(e){e(this.start,"start",this),e(this.end,"end",this),this.step&&e(this.step,"step",this)}},{key:"map",value:function(e){return new o(this._ifNode(e(this.start,"start",this)),this._ifNode(e(this.end,"end",this)),this.step&&this._ifNode(e(this.step,"step",this)))}},{key:"clone",value:function(){return new o(this.start,this.end,this.step&&this.step)}},{key:"_toString",value:function(e){var t=i(this,e&&e.parenthesis?e.parenthesis:"keep",e&&e.implicit),r=this.start.toString(e),r=r=t.start?"("+r+")":r,n=(this.step&&(n=this.step.toString(e),r+=":"+(n=t.step?"("+n+")":n)),this.end.toString(e));return r+":"+(n=t.end?"("+n+")":n)}},{key:"toJSON",value:function(){return{mathjs:pf,start:this.start,end:this.end,step:this.step}}},{key:"_toHTML",value:function(e){var t=i(this,e&&e.parenthesis?e.parenthesis:"keep",e&&e.implicit),r=this.start.toHTML(e),r=r=t.start?'<span class="math-parenthesis math-round-parenthesis">(</span>'+r+'<span class="math-parenthesis math-round-parenthesis">)</span>':r,n=(this.step&&(n=this.step.toHTML(e),r+='<span class="math-operator math-range-operator">:</span>'+(n=t.step?'<span class="math-parenthesis math-round-parenthesis">(</span>'+n+'<span class="math-parenthesis math-round-parenthesis">)</span>':n)),this.end.toHTML(e));return r+'<span class="math-operator math-range-operator">:</span>'+(n=t.end?'<span class="math-parenthesis math-round-parenthesis">(</span>'+n+'<span class="math-parenthesis math-round-parenthesis">)</span>':n)}},{key:"_toTex",value:function(e){var t=i(this,e&&e.parenthesis?e.parenthesis:"keep",e&&e.implicit),r=this.start.toTex(e),n=(t.start&&(r="\\left(".concat(r,"\\right)")),this.step&&(n=this.step.toTex(e),r+=":"+(n=t.step?"\\left(".concat(n,"\\right)"):n)),this.end.toTex(e));return r+":"+(n=t.end?"\\left(".concat(n,"\\right)"):n)}}],[{key:"fromJSON",value:function(e){return new o(e.start,e.end,e.step)}}]);function o(e,t,r){var n,i,a;if(h(this,o),n=this,i=g(i=o),i=ml(n,ff()?Reflect.construct(i,a||[],g(n).constructor):i.apply(n,a)),!L(e))throw new TypeError("Node expected");if(!L(t))throw new TypeError("Node expected");if(r&&!L(r))throw new TypeError("Node expected");if(3<arguments.length)throw new Error("Too many arguments");return i.start=e,i.end=t,i.step=r||null,i}return A(e,"name",pf),e},{isClass:!0,isNode:!0});function hf(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(hf=function(){return!!e})()}var df="RelationalNode",yf=N(df,["Node"],function(e){var e=e.Node,o={equal:"==",unequal:"!=",smaller:"<",larger:">",smallerEq:"<=",largerEq:">="},e=(dl(a,e),c(a,[{key:"type",get:function(){return df}},{key:"isRelationalNode",get:function(){return!0}},{key:"_compile",value:function(o,t){var u=this,s=this.params.map(function(e){return e._compile(o,t)});return function(e,t,r){for(var n,i=s[0](e,t,r),a=0;a<u.conditionals.length;a++)if(n=i,i=s[a+1](e,t,r),!Xe(o,u.conditionals[a])(n,i))return!1;return!0}}},{key:"forEach",value:function(r){var n=this;this.params.forEach(function(e,t){return r(e,"params["+t+"]",n)},this)}},{key:"map",value:function(r){var n=this;return new a(this.conditionals.slice(),this.params.map(function(e,t){return n._ifNode(r(e,"params["+t+"]",n))},this))}},{key:"clone",value:function(){return new a(this.conditionals,this.params)}},{key:"_toString",value:function(n){for(var i=n&&n.parenthesis?n.parenthesis:"keep",a=y(this,i,n&&n.implicit),e=this.params.map(function(e,t){var r=y(e,i,n&&n.implicit);return"all"===i||null!==r&&r<=a?"("+e.toString(n)+")":e.toString(n)}),t=e[0],r=0;r<this.conditionals.length;r++)t=(t+=" "+o[this.conditionals[r]])+(" "+e[r+1]);return t}},{key:"toJSON",value:function(){return{mathjs:df,conditionals:this.conditionals,params:this.params}}},{key:"_toHTML",value:function(n){for(var i=n&&n.parenthesis?n.parenthesis:"keep",a=y(this,i,n&&n.implicit),e=this.params.map(function(e,t){var r=y(e,i,n&&n.implicit);return"all"===i||null!==r&&r<=a?'<span class="math-parenthesis math-round-parenthesis">(</span>'+e.toHTML(n)+'<span class="math-parenthesis math-round-parenthesis">)</span>':e.toHTML(n)}),t=e[0],r=0;r<this.conditionals.length;r++)t+='<span class="math-operator math-binary-operator math-explicit-binary-operator">'+fn(o[this.conditionals[r]])+"</span>"+e[r+1];return t}},{key:"_toTex",value:function(n){for(var i=n&&n.parenthesis?n.parenthesis:"keep",a=y(this,i,n&&n.implicit),e=this.params.map(function(e,t){var r=y(e,i,n&&n.implicit);return"all"===i||null!==r&&r<=a?"\\left("+e.toTex(n)+"\right)":e.toTex(n)}),t=e[0],r=0;r<this.conditionals.length;r++)t+=m[this.conditionals[r]]+e[r+1];return t}}],[{key:"fromJSON",value:function(e){return new a(e.conditionals,e.params)}}]));function a(e,t){var r,n,i;if(h(this,a),r=this,n=g(n=a),n=ml(r,hf()?Reflect.construct(n,i||[],g(r).constructor):n.apply(r,i)),!Array.isArray(e))throw new TypeError("Parameter conditionals must be an array");if(!Array.isArray(t))throw new TypeError("Parameter params must be an array");if(e.length!==t.length-1)throw new TypeError("Parameter params must contain exactly one more element than parameter conditionals");return n.conditionals=e,n.params=t,n}return A(e,"name",df),e},{isClass:!0,isNode:!0});function vf(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(vf=function(){return!!e})()}var gf=N("SymbolNode",["math","?Unit","Node"],function(e){var r=e.math,o=e.Unit;function u(e){return!!o&&o.isValuelessUnit(e)}function s(e){var t,r,n;if(h(this,s),t=this,r=g(r=s),r=ml(t,vf()?Reflect.construct(r,n||[],g(t).constructor):r.apply(t,n)),"string"!=typeof e)throw new TypeError('String expected for parameter "name"');return r.name=e,r}return dl(s,e.Node),c(s,[{key:"type",get:function(){return"SymbolNode"}},{key:"isSymbolNode",get:function(){return!0}},{key:"_compile",value:function(n,e){var i=this.name;if(!0===e[i])return function(e,t,r){return Xe(t,i)};if(i in n)return function(e,t,r){return e.has(i)?e.get(i):Xe(n,i)};var a=u(i);return function(e,t,r){return e.has(i)?e.get(i):a?new o(null,i):s.onUndefinedSymbol(i)}}},{key:"forEach",value:function(e){}},{key:"map",value:function(e){return this.clone()}},{key:"clone",value:function(){return new s(this.name)}},{key:"_toString",value:function(e){return this.name}},{key:"_toHTML",value:function(e){var t=fn(this.name);return"true"===t||"false"===t?'<span class="math-symbol math-boolean">'+t+"</span>":"i"===t?'<span class="math-symbol math-imaginary-symbol">'+t+"</span>":"Infinity"===t?'<span class="math-symbol math-infinity-symbol">'+t+"</span>":"NaN"===t?'<span class="math-symbol math-nan-symbol">'+t+"</span>":"null"===t?'<span class="math-symbol math-null-symbol">'+t+"</span>":"undefined"===t?'<span class="math-symbol math-undefined-symbol">'+t+"</span>":'<span class="math-symbol">'+t+"</span>"}},{key:"toJSON",value:function(){return{mathjs:"SymbolNode",name:this.name}}},{key:"_toTex",value:function(e){var t=!1,t=(void 0===r[this.name]&&u(this.name)&&(t=!0),$l(this.name,t));return"\\"===t[0]?t:" "+t}}],[{key:"onUndefinedSymbol",value:function(e){throw new Error("Undefined symbol "+e)}},{key:"fromJSON",value:function(e){return new s(e.name)}}])},{isClass:!0,isNode:!0});function xf(){return(xf="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=g(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function bf(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(bf=function(){return!!e})()}var wf="FunctionNode",Nf=N(wf,["math","Node","SymbolNode"],function(e){function y(e){return Fe(e,{truncate:78})}var t,i=e.math,r=e.Node,a=e.SymbolNode;function o(e,t,r){for(var n,i="",a=/\$(?:\{([a-z_][a-z_0-9]*)(?:\[([0-9]+)\])?\}|\$)/gi,o=0;null!==(n=a.exec(e));)if(i+=e.substring(o,n.index),o=n.index,"$$"===n[0])i+="$",o++;else{o+=n[0].length;var u=t[n[1]];if(!u)throw new ReferenceError("Template: Property "+n[1]+" does not exist.");if(void 0===n[2])switch(V(u)){case"string":i+=u;break;case"object":if(L(u))i+=u.toTex(r);else{if(!Array.isArray(u))throw new TypeError("Template: "+n[1]+" has to be a Node, String or array of Nodes");i+=u.map(function(e,t){if(L(e))return e.toTex(r);throw new TypeError("Template: "+n[1]+"["+t+"] is not a Node.")}).join(",")}break;default:throw new TypeError("Template: "+n[1]+" has to be a Node, String or array of Nodes")}else{if(!L(u[n[2]]&&u[n[2]]))throw new TypeError("Template: "+n[1]+"["+n[2]+"] is not a Node.");i+=u[n[2]].toTex(r)}}return i+e.slice(o)}dl(v,r);e=c(v,[{key:"name",get:function(){return this.fn.name||""}},{key:"type",get:function(){return wf}},{key:"isFunctionNode",get:function(){return!0}},{key:"_compile",value:function(o,t){var u,s,c,l=this.args.map(function(e){return e._compile(o,t)});if(!ue(this.fn)){if(le(this.fn)&&te(this.fn.index)&&this.fn.index.isObjectProperty())return u=this.fn.object._compile(o,t),s=this.fn.index.getObjectProperty(),c=this.args,function(t,r,n){var e=u(t,r,n),i=function(e,t){if(et(e,t))return e[t];throw new Error('No access to method "'+t+'"')}(e,s);if(null!=i&&i.rawArgs)return i(c,o,nf(t,r));var a=l.map(function(e){return e(t,r,n)});return i.apply(e,a)};var a=this.fn.toString(),f=this.fn._compile(o,t),p=this.args;return function(t,r,n){var e=f(t,r,n);if("function"!=typeof e)throw new TypeError("Expression '".concat(a,"' did not evaluate to a function; value is:")+"\n ".concat(y(e)));if(e.rawArgs)return e(p,o,nf(t,r));var i=l.map(function(e){return e(t,r,n)});return e.apply(e,i)}}var m,h=this.fn.name;if(t[h])return m=this.args,function(t,r,n){var e=Xe(r,h);if("function"!=typeof e)throw new TypeError("Argument '".concat(h,"' was not a function; received: ").concat(y(e)));if(e.rawArgs)return e(m,o,nf(t,r));var i=l.map(function(e){return e(t,r,n)});return e.apply(e,i)};function d(e){var t;if(e.has(h))t=e.get(h);else{if(!(h in o))return v.onUndefinedFunction(h);t=Xe(o,h)}if("function"==typeof t)return t;throw new TypeError("'".concat(h,"' is not a function; its value is:\n ").concat(y(t)))}var n,e=h in o?Xe(o,h):void 0,e="function"==typeof e&&!0===e.rawArgs;if(e)return n=this.args,function(e,t,r){return d(e)(n,o,nf(e,t))};switch(l.length){case 0:return function(e,t,r){return d(e)()};case 1:return function(e,t,r){return d(e)((0,l[0])(e,t,r))};case 2:return function(e,t,r){var n=d(e),i=l[0],a=l[1];return n(i(e,t,r),a(e,t,r))};default:return function(t,r,n){var e=d(t),i=l.map(function(e){return e(t,r,n)});return e.apply(void 0,Me(i))}}}},{key:"forEach",value:function(e){e(this.fn,"fn",this);for(var t=0;t<this.args.length;t++)e(this.args[t],"args["+t+"]",this)}},{key:"map",value:function(e){for(var t=this._ifNode(e(this.fn,"fn",this)),r=[],n=0;n<this.args.length;n++)r[n]=this._ifNode(e(this.args[n],"args["+n+"]",this));return new v(t,r)}},{key:"clone",value:function(){return new v(this.fn,this.args.slice(0))}},{key:"toString",value:function(e){var t,r=this.fn.toString(e);return void 0!==(t=e&&"object"===V(e.handler)&&se(e.handler,r)?e.handler[r](this,e):t)?t:xf(g(v.prototype),"toString",this).call(this,e)}},{key:"_toString",value:function(t){var e=this.args.map(function(e){return e.toString(t)});return(ee(this.fn)?"("+this.fn.toString(t)+")":this.fn.toString(t))+"("+e.join(", ")+")"}},{key:"toJSON",value:function(){return{mathjs:wf,fn:this.fn,args:this.args}}},{key:"_toHTML",value:function(t){var e=this.args.map(function(e){return e.toHTML(t)});return'<span class="math-function">'+fn(this.fn)+'</span><span class="math-paranthesis math-round-parenthesis">(</span>'+e.join('<span class="math-separator">,</span>')+'<span class="math-paranthesis math-round-parenthesis">)</span>'}},{key:"toTex",value:function(e){var t;return void 0!==(t=e&&"object"===V(e.handler)&&se(e.handler,this.name)?e.handler[this.name](this,e):t)?t:xf(g(v.prototype),"toTex",this).call(this,e)}},{key:"_toTex",value:function(t){var e,r,n=this.args.map(function(e){return e.toTex(t)});switch(Pl[this.name]&&(e=Pl[this.name]),!i[this.name]||"function"!=typeof i[this.name].toTex&&"object"!==V(i[this.name].toTex)&&"string"!=typeof i[this.name].toTex||(e=i[this.name].toTex),V(e)){case"function":r=e(this,t);break;case"string":r=o(e,this,t);break;case"object":switch(V(e[n.length])){case"function":r=e[n.length](this,t);break;case"string":r=o(e[n.length],this,t)}}return void 0!==r?r:o("\\mathrm{${name}}\\left(${args}\\right)",this,t)}},{key:"getIdentifier",value:function(){return this.type+":"+this.name}}]);function v(e,t){var r,n,i;if(h(this,v),r=this,n=g(n=v),n=ml(r,bf()?Reflect.construct(n,i||[],g(r).constructor):n.apply(r,i)),!L(e="string"==typeof e?new a(e):e))throw new TypeError('Node expected as parameter "fn"');if(Array.isArray(t)&&t.every(L))return n.fn=e,n.args=t||[],n;throw new TypeError('Array containing Nodes expected for parameter "args"')}return A(t=e,"name",wf),A(e,"onUndefinedFunction",function(e){throw new Error("Undefined function "+e)}),A(e,"fromJSON",function(e){return new t(e.fn,e.args)}),e},{isClass:!0,isNode:!0}),Df=N("parse",["typed","numeric","config","AccessorNode","ArrayNode","AssignmentNode","BlockNode","ConditionalNode","ConstantNode","FunctionAssignmentNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","RangeNode","RelationalNode","SymbolNode"],function(e){var t=e.typed,y=e.numeric,z=e.config,i=e.AccessorNode,v=e.ArrayNode,o=e.AssignmentNode,R=e.BlockNode,q=e.ConditionalNode,g=e.ConstantNode,j=e.FunctionAssignmentNode,P=e.FunctionNode,a=e.IndexNode,L=e.ObjectNode,u=e.OperatorNode,U=e.ParenthesisNode,n=e.RangeNode,$=e.RelationalNode,x=e.SymbolNode,s=t("parse",{string:function(e){return S(e,{})},"Array | Matrix":function(e){return r(e,{})},"string, Object":function(e,t){return S(e,void 0!==t.nodes?t.nodes:{})},"Array | Matrix, Object":r});function r(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r=void 0!==t.nodes?t.nodes:{};return ce(e,function(e){if("string"!=typeof e)throw new TypeError("String expected");return S(e,r)})}var b={NULL:0,DELIMITER:1,NUMBER:2,SYMBOL:3,UNKNOWN:4},c={",":!0,"(":!0,")":!0,"[":!0,"]":!0,"{":!0,"}":!0,'"':!0,"'":!0,";":!0,"+":!0,"-":!0,"*":!0,".*":!0,"/":!0,"./":!0,"%":!0,"^":!0,".^":!0,"~":!0,"!":!0,"&":!0,"|":!0,"^|":!0,"=":!0,":":!0,"?":!0,"==":!0,"!=":!0,"<":!0,">":!0,"<=":!0,">=":!0,"<<":!0,">>":!0,">>>":!0},w={mod:!0,to:!0,in:!0,and:!0,xor:!0,or:!0,not:!0},N={true:!0,false:!1,null:null,undefined:void 0},H=["NaN","Infinity"],G={'"':'"',"'":"'","\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"};function l(e,t){return e.expression.substr(e.index,t)}function f(e){return l(e,1)}function p(e){e.index++}function m(e){return e.expression.charAt(e.index-1)}function h(e){return e.expression.charAt(e.index+1)}function D(e){for(e.tokenType=b.NULL,e.token="",e.comment="";;){if("#"===f(e))for(;"\n"!==f(e)&&""!==f(e);)e.comment+=f(e),p(e);if(!s.isWhitespace(f(e),e.nestingLevel))break;p(e)}if(""!==f(e)){if("\n"===f(e)&&!e.nestingLevel)return e.tokenType=b.DELIMITER,e.token=f(e),p(e);var t=f(e),r=l(e,2),n=l(e,3);if(3===n.length&&c[n])return e.tokenType=b.DELIMITER,e.token=n,p(e),p(e),p(e);if(2===r.length&&c[r])return e.tokenType=b.DELIMITER,e.token=r,p(e),p(e);if(c[t])return e.tokenType=b.DELIMITER,e.token=t,p(e);if(s.isDigitDot(t)){e.tokenType=b.NUMBER;n=l(e,2);if("0b"===n||"0o"===n||"0x"===n){for(e.token+=f(e),p(e),e.token+=f(e),p(e);s.isHexDigit(f(e));)e.token+=f(e),p(e);if("."===f(e))for(e.token+=".",p(e);s.isHexDigit(f(e));)e.token+=f(e),p(e);else if("i"===f(e))for(e.token+="i",p(e);s.isDigit(f(e));)e.token+=f(e),p(e)}else{if("."===f(e)){if(e.token+=f(e),p(e),!s.isDigit(f(e)))return e.tokenType=b.DELIMITER}else{for(;s.isDigit(f(e));)e.token+=f(e),p(e);s.isDecimalMark(f(e),h(e))&&(e.token+=f(e),p(e))}for(;s.isDigit(f(e));)e.token+=f(e),p(e);if("E"===f(e)||"e"===f(e))if(s.isDigit(h(e))||"-"===h(e)||"+"===h(e)){if(e.token+=f(e),p(e),"+"!==f(e)&&"-"!==f(e)||(e.token+=f(e),p(e)),!s.isDigit(f(e)))throw I(e,'Digit expected, got "'+f(e)+'"');for(;s.isDigit(f(e));)e.token+=f(e),p(e);if(s.isDecimalMark(f(e),h(e)))throw I(e,'Digit expected, got "'+f(e)+'"')}else if("."===h(e))throw p(e),I(e,'Digit expected, got "'+f(e)+'"')}}else{if(!s.isAlpha(f(e),m(e),h(e))){for(e.tokenType=b.UNKNOWN;""!==f(e);)e.token+=f(e),p(e);throw I(e,'Syntax error in part "'+e.token+'"')}for(;s.isAlpha(f(e),m(e),h(e))||s.isDigit(f(e));)e.token+=f(e),p(e);se(w,e.token)?e.tokenType=b.DELIMITER:e.tokenType=b.SYMBOL}}else e.tokenType=b.DELIMITER}function d(e){for(;D(e),"\n"===e.token;);}function E(e){e.nestingLevel++}function A(e){e.nestingLevel--}function S(e,t){var r={extraNodes:{},expression:"",comment:"",index:0,token:"",tokenType:b.NULL,nestingLevel:0,conditionalLevel:null},e=(an(r,{expression:e,extraNodes:t}),D(r),function(e){var t,r=[];for(""!==e.token&&"\n"!==e.token&&";"!==e.token&&(t=C(e),e.comment&&(t.comment=e.comment));"\n"===e.token||";"===e.token;)0===r.length&&t&&r.push({node:t,visible:";"!==e.token}),D(e),"\n"!==e.token&&";"!==e.token&&""!==e.token&&(t=C(e),e.comment&&(t.comment=e.comment),r.push({node:t,visible:";"!==e.token}));return 0<r.length?new R(r):(t||(t=new g(void 0),e.comment&&(t.comment=e.comment)),t)}(r));if(""!==r.token)throw r.tokenType===b.DELIMITER?ie(r,"Unexpected operator "+r.token):I(r,'Unexpected part "'+r.token+'"');return e}function C(e){var t,r,n,i,a=function(e){for(var t=function(e){for(var t=M(e);"or"===e.token;)d(e),t=new u("or","or",[t,M(e)]);return t}(e);"?"===e.token;){var r=e.conditionalLevel,n=(e.conditionalLevel=e.nestingLevel,d(e),t),i=C(e);if(":"!==e.token)throw I(e,"False part of conditional expression expected");e.conditionalLevel=null,d(e);var a=C(e),t=new q(n,i,a);e.conditionalLevel=r}return t}(e);if("="!==e.token)return a;if(ue(a))return t=a.name,d(e),n=C(e),new o(new x(t),n);if(le(a))return d(e),n=C(e),new o(a.object,a.index,n);if(pe(a)&&ue(a.fn)&&(i=!0,r=[],t=a.name,a.args.forEach(function(e,t){ue(e)?r[t]=e.name:i=!1}),i))return d(e),n=C(e),new j(t,r,n);throw I(e,"Invalid left hand side of assignment operator =")}function M(e){for(var t=F(e);"xor"===e.token;)d(e),t=new u("xor","xor",[t,F(e)]);return t}function F(e){for(var t=O(e);"and"===e.token;)d(e),t=new u("and","and",[t,O(e)]);return t}function O(e){for(var t=T(e);"|"===e.token;)d(e),t=new u("|","bitOr",[t,T(e)]);return t}function T(e){for(var t=_(e);"^|"===e.token;)d(e),t=new u("^|","bitXor",[t,_(e)]);return t}function _(e){for(var t=V(e);"&"===e.token;)d(e),t=new u("&","bitAnd",[t,V(e)]);return t}function V(e){for(var t=[Z(e)],r=[],n={"==":"equal","!=":"unequal","<":"smaller",">":"larger","<=":"smallerEq",">=":"largerEq"};se(n,e.token);){var i={name:e.token,fn:n[e.token]};r.push(i),d(e),t.push(Z(e))}return 1===t.length?t[0]:2===t.length?new u(r[0].name,r[0].fn,t):new $(r.map(function(e){return e.fn}),t)}function Z(e){for(var t,r,n,i=W(e),a={"<<":"leftShift",">>":"rightArithShift",">>>":"rightLogShift"};se(a,e.token);)r=a[t=e.token],d(e),n=[i,W(e)],i=new u(t,r,n);return i}function W(e){for(var t,r,n,i=Y(e),a={to:"to",in:"to"};se(a,e.token);)r=a[t=e.token],d(e),i="in"===t&&""===e.token?new u("*","multiply",[i,new x("in")],!0):(n=[i,Y(e)],new u(t,r,n));return i}function Y(e){var t=[],r=":"===e.token?new g(1):J(e);if(":"===e.token&&e.conditionalLevel!==e.nestingLevel){for(t.push(r);":"===e.token&&t.length<3;)d(e),")"===e.token||"]"===e.token||","===e.token||""===e.token?t.push(new x("end")):t.push(J(e));r=3===t.length?new n(t[0],t[2],t[1]):new n(t[0],t[1])}return r}function J(e){var t,r;a=X(e);for(var n={"+":"add","-":"subtract"};se(n,e.token);){r=n[t=e.token],d(e);var i=X(e),i=i.isPercentage?[a,new u("*","multiply",[a,i])]:[a,i],a=new u(t,r,i)}return a}function X(e){t=Q(e);for(var t,r,n,i,a={"*":"multiply",".*":"dotMultiply","/":"divide","./":"dotDivide"};se(a,e.token);)n=a[r=e.token],d(e),i=Q(e),t=new u(r,n,[t,i]);return t}function Q(e){for(var t,r=t=K(e);e.tokenType===b.SYMBOL||"in"===e.token&&ae(t)||!(e.tokenType!==b.NUMBER||ae(r)||oe(r)&&"!"!==r.op)||"("===e.token;)r=K(e),t=new u("*","multiply",[t,r],!0);return t}function K(e){for(var t=ee(e),r=t,n=[];"/"===e.token&&fe(r);){if(n.push(an({},e)),d(e),e.tokenType!==b.NUMBER){an(e,n.pop());break}if(n.push(an({},e)),d(e),e.tokenType!==b.SYMBOL&&"("!==e.token){n.pop(),an(e,n.pop());break}an(e,n.pop()),n.pop(),r=ee(e),t=new u("/","divide",[t,r])}return t}function ee(e){for(var t,r,n,i=B(e),a={"%":"mod",mod:"mod"};se(a,e.token);)r=a[t=e.token],d(e),i="%"===t&&e.tokenType===b.DELIMITER&&"("!==e.token?new u("/","divide",[i,new g(100)],!1,!0):(n=[i,B(e)],new u(t,r,n));return i}function B(e){var t,r,n={"-":"unaryMinus","+":"unaryPlus","~":"bitNot",not:"not"};return se(n,e.token)?(n=n[e.token],t=e.token,d(e),r=[B(e)],new u(t,n,r)):(n=function(e){for(var t,r,n=function(e){var t,r,n,i=[];if(e.tokenType===b.SYMBOL&&se(e.extraNodes,e.token)){var a=e.extraNodes[e.token];if(D(e),"("===e.token){if(i=[],E(e),D(e),")"!==e.token)for(i.push(C(e));","===e.token;)D(e),i.push(C(e));if(")"!==e.token)throw I(e,"Parenthesis ) expected");A(e),D(e)}return new a(i)}a=e;if(a.tokenType===b.SYMBOL||a.tokenType===b.DELIMITER&&a.token in w)return o=a.token,D(a),k(a,se(N,o)?new g(N[o]):H.includes(o)?new g(y(o,"number")):new x(o));var o=a;if('"'===o.token||"'"===o.token)return a=te(o,o.token),k(o,new g(a));var u=o;if("["!==u.token){var s=u;if("{"!==s.token){var c,l=s;if(l.tokenType===b.NUMBER)return f=l.token,D(l),new g(y(f,z.number));var f=l;if("("!==f.token)throw""===(c=f).token?I(c,"Unexpected end of expression"):I(c,"Value expected");if(E(f),D(f),c=C(f),")"!==f.token)throw I(f,"Parenthesis ) expected");return A(f),D(f),k(f,new U(c))}E(s);var p,m={};do{if(D(s),"}"!==s.token){if('"'===s.token||"'"===s.token)p=te(s,s.token);else{if(!(s.tokenType===b.SYMBOL||s.tokenType===b.DELIMITER&&s.token in w))throw I(s,"Symbol or string expected as object key");p=s.token,D(s)}if(":"!==s.token)throw I(s,"Colon : expected after object key");D(s),m[p]=C(s)}}while(","===s.token);if("}"!==s.token)throw I(s,"Comma , or bracket } expected after object value");return A(s),D(s),k(s,new L(m))}if(E(u),D(u),"]"!==u.token){l=re(u);if(";"===u.token){for(n=1,r=[l];";"===u.token;)D(u),"]"!==u.token&&(r[n]=re(u),n++);if("]"!==u.token)throw I(u,"End of matrix ] expected");A(u),D(u);for(var h=r[0].items.length,d=1;d<n;d++)if(r[d].items.length!==h)throw ie(u,"Column dimensions mismatch ("+r[d].items.length+" !== "+h+")");t=new v(r)}else{if("]"!==u.token)throw I(u,"End of matrix ] expected");A(u),D(u),t=l}}else A(u),D(u),t=new v([]);return k(u,t)}(e),i={"!":"factorial","'":"ctranspose"};se(i,e.token);)r=i[t=e.token],D(e),n=k(e,n=new u(t,r,[n]));return n}(t=e),"^"!==t.token&&".^"!==t.token||(e="^"===(r=t.token)?"pow":"dotPow",d(t),t=[n,B(t)],n=new u(r,e,t)),n)}function k(e,t,r){for(var n;("("===e.token||"["===e.token||"."===e.token)&&(!r||r.includes(e.token));)if(n=[],"("===e.token){if(!ue(t)&&!le(t))return t;if(E(e),D(e),")"!==e.token)for(n.push(C(e));","===e.token;)D(e),n.push(C(e));if(")"!==e.token)throw I(e,"Parenthesis ) expected");A(e),D(e),t=new P(t,n)}else if("["===e.token){if(E(e),D(e),"]"!==e.token)for(n.push(C(e));","===e.token;)D(e),n.push(C(e));if("]"!==e.token)throw I(e,"Parenthesis ] expected");A(e),D(e),t=new i(t,new a(n))}else{if(D(e),!(e.tokenType===b.SYMBOL||e.tokenType===b.DELIMITER&&e.token in w))throw I(e,"Property name expected after dot");n.push(new g(e.token)),D(e),t=new i(t,new a(n,!0))}return t}function te(e,t){for(var r="";""!==f(e)&&f(e)!==t;)if("\\"===f(e)){p(e);var n=f(e),i=G[n];if(void 0!==i)r+=i,e.index+=1;else{if("u"!==n)throw I(e,"Bad escape character \\".concat(n));i=e.expression.slice(e.index+1,e.index+5);if(!/^[0-9A-Fa-f]{4}$/.test(i))throw I(e,"Invalid unicode character \\u".concat(i));r+=String.fromCharCode(parseInt(i,16)),e.index+=5}}else r+=f(e),p(e);if(D(e),e.token!==t)throw I(e,"End of string ".concat(t," expected"));return D(e),r}function re(e){for(var t=[C(e)],r=1;","===e.token;)D(e),"]"!==e.token&&";"!==e.token&&(t[r]=C(e),r++);return new v(t)}function ne(e){return e.index-e.token.length+1}function I(e,t){e=ne(e),t=new SyntaxError(t+" (char "+e+")");return t.char=e,t}function ie(e,t){e=ne(e),t=new SyntaxError(t+" (char "+e+")");return t.char=e,t}return s.isAlpha=function(e,t,r){return s.isValidLatinOrGreek(e)||s.isValidMathSymbol(e,r)||s.isValidMathSymbol(t,e)},s.isValidLatinOrGreek=function(e){return/^[a-zA-Z_$\u00C0-\u02AF\u0370-\u03FF\u2100-\u214F]$/.test(e)},s.isValidMathSymbol=function(e,t){return/^[\uD835]$/.test(e)&&/^[\uDC00-\uDFFF]$/.test(t)&&/^[^\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDFCC\uDFCD]$/.test(t)},s.isWhitespace=function(e,t){return" "===e||"\t"===e||"\n"===e&&0<t},s.isDecimalMark=function(e,t){return"."===e&&"/"!==t&&"*"!==t&&"^"!==t},s.isDigitDot=function(e){return"0"<=e&&e<="9"||"."===e},s.isDigit=function(e){return"0"<=e&&e<="9"},s.isHexDigit=function(e){return"0"<=e&&e<="9"||"a"<=e&&e<="f"||"A"<=e&&e<="F"},t.addConversion({from:"string",to:"Node",convert:s}),s}),Ef=N("compile",["typed","parse"],function(e){var t=e.typed,r=e.parse;return t("compile",{string:function(e){return r(e).compile()},"Array | Matrix":function(e){return ce(e,function(e){return r(e).compile()})}})}),Af=N("evaluate",["typed","parse"],function(e){var t=e.typed,r=e.parse;return t("evaluate",{string:function(e){var t=ct();return r(e).compile().evaluate(t)},"string, Map | Object":function(e,t){return r(e).compile().evaluate(t)},"Array | Matrix":function(e){var t=ct();return ce(e,function(e){return r(e).compile().evaluate(t)})},"Array | Matrix, Map | Object":function(e,t){return ce(e,function(e){return r(e).compile().evaluate(t)})}})}),Sf=N("Parser",["evaluate"],function(e){var t=e.evaluate;function r(){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");Object.defineProperty(this,"scope",{value:ct(),writable:!1})}return r.prototype.type="Parser",r.prototype.isParser=!0,r.prototype.evaluate=function(e){return t(e,this.scope)},r.prototype.get=function(e){if(this.scope.has(e))return this.scope.get(e)},r.prototype.getAll=function(){var e=this.scope;if(e instanceof ot)return e.wrappedObject;var t,r={},n=it(e.keys());try{for(n.s();!(t=n.n()).done;){var i=t.value;Qe(r,i,e.get(i))}}catch(e){n.e(e)}finally{n.f()}return r},r.prototype.getAllAsMap=function(){return this.scope},r.prototype.set=function(e,t){return this.scope.set(e,t),t},r.prototype.remove=function(e){this.scope.delete(e)},r.prototype.clear=function(){this.scope.clear()},r},{isClass:!0}),Cf=N("parser",["typed","Parser"],function(e){var t=e.typed,r=e.Parser;return t("parser",{"":function(){return new r}})}),Mf=N("lup",["typed","matrix","abs","addScalar","divideScalar","multiplyScalar","subtractScalar","larger","equalScalar","unaryMinus","DenseMatrix","SparseMatrix","Spa"],function(e){var t=e.typed,r=e.matrix,S=e.abs,w=e.addScalar,C=e.divideScalar,M=e.multiplyScalar,N=e.subtractScalar,F=e.larger,O=e.equalScalar,T=e.unaryMinus,D=e.DenseMatrix,_=e.SparseMatrix,B=e.Spa;return t("lup",{DenseMatrix:n,SparseMatrix:function(e){for(var c,l=e._size[0],t=e._size[1],r=Math.min(l,t),f=e._values,p=e._index,m=e._ptr,h=[],d=[],y=[],v=[l,r],g=[],x=[],b=[],w=[r,t],N=[],D=[],E=0;E<l;E++)N[E]=E,D[E]=E;for(var A=0;A<t;A++)!function(){var i=new B,e=(A<l&&(y.push(h.length),h.push(1),d.push(A)),b.push(g.length),m[A]),t=m[A+1];for(c=e;c<t;c++)E=p[c],i.set(N[E],f[c]);0<A&&i.forEach(0,A-1,function(r,n){_._forEachRow(r,h,d,y,function(e,t){r<e&&i.accumulate(e,T(M(t,n)))})});var r,n,a,o=A,u=i.get(A),s=S(u);i.forEach(A+1,l-1,function(e,t){var r=S(t);F(r,s)&&(o=e,s=r,u=t)}),A!==o&&(_._swapRows(A,o,v[1],h,d,y),_._swapRows(A,o,w[1],g,x,b),i.swap(A,o),e=o,n=D[r=A],a=D[e],N[n]=e,N[a]=r,D[r]=a,D[e]=n),i.forEach(0,l-1,function(e,t){e<=A?(g.push(t),x.push(e)):(t=C(t,u),O(t,0)||(h.push(t),d.push(e)))})}();return b.push(g.length),y.push(h.length),{L:new _({values:h,index:d,ptr:y,size:v}),U:new _({values:g,index:x,ptr:b,size:w}),p:N,toString:function(){return"L: "+this.L.toString()+"\nU: "+this.U.toString()+"\nP: "+this.p}}},Array:function(e){e=n(r(e));return{L:e.L.valueOf(),U:e.U.valueOf(),p:e.p}}});function n(e){var t,r=e._size[0],n=e._size[1],i=Math.min(r,n),a=Ce(e._data),o=[],e=[r,i],u=[],s=[i,n],c=[];for(y=0;y<r;y++)c[y]=y;for(t=0;t<n;t++){if(0<t)for(y=0;y<r;y++){for(var l=Math.min(y,t),f=0,p=0;p<l;p++)f=w(f,M(a[y][p],a[p][t]));a[y][t]=N(a[y][t],f)}for(var m=t,h=0,d=0,y=t;y<r;y++){var v=a[y][t],g=S(v);F(g,h)&&(m=y,h=g,d=v)}if(t!==m&&(c[t]=[c[m],c[m]=c[t]][0],D._swapRows(t,m,a)),t<r)for(y=t+1;y<r;y++){var x=a[y][t];O(x,0)||(a[y][t]=C(a[y][t],d))}}for(t=0;t<n;t++)for(y=0;y<r;y++)0===t&&(y<n&&(u[y]=[]),o[y]=[]),y<t?(y<n&&(u[y][t]=a[y][t]),t<r&&(o[y][t]=0)):y!==t?(y<n&&(u[y][t]=0),t<r&&(o[y][t]=a[y][t])):(y<n&&(u[y][t]=a[y][t]),t<r&&(o[y][t]=1));var e=new D({data:o,size:e}),s=new D({data:u,size:s}),b=[];for(y=0,i=c.length;y<i;y++)b[c[y]]=y;return{L:e,U:s,p:b,toString:function(){return"L: "+this.L.toString()+"\nU: "+this.U.toString()+"\nP: "+this.p}}}}),Ff=N("qr",["typed","matrix","zeros","identity","isZero","equal","sign","sqrt","conj","unaryMinus","addScalar","divideScalar","multiplyScalar","subtractScalar","complex"],function(e){var t=e.typed,r=e.matrix,v=e.zeros,g=e.identity,x=e.isZero,b=e.equal,w=e.sign,N=e.sqrt,D=e.conj,E=e.unaryMinus,A=e.addScalar,S=e.divideScalar,C=e.multiplyScalar,M=e.subtractScalar,o=e.complex;return an(t("qr",{DenseMatrix:n,SparseMatrix:function(e){throw new Error("qr not implemented for sparse matrices yet")},Array:function(e){e=n(r(e));return{Q:e.Q.valueOf(),R:e.R.valueOf()}}}),{_denseQRimpl:u});function u(e){for(var t=e._size[0],r=e._size[1],n=g([t],"dense"),i=n._data,e=e.clone(),a=e._data,o=v([t],""),u=0;u<Math.min(r,t);++u){var s=a[u][u],c=E(b(s,0)?1:w(s)),l=D(c),f=0;for(m=u;m<t;m++)f=A(f,C(a[m][u],D(a[m][u])));c=C(c,N(f));if(!x(c)){for(var p=M(s,c),m=u+(o[u]=1);m<t;m++)o[m]=S(a[m][u],p);for(var h=E(D(S(p,c))),d=void 0,y=u;y<r;y++){for(d=0,m=u;m<t;m++)d=A(d,C(D(o[m]),a[m][y]));for(d=C(d,h),m=u;m<t;m++)a[m][y]=C(M(a[m][y],C(o[m],d)),l)}for(m=0;m<t;m++){for(d=0,y=u;y<t;y++)d=A(d,C(i[m][y],o[y]));for(d=C(d,h),y=u;y<t;++y)i[m][y]=S(M(i[m][y],C(d,D(o[y]))),l)}}}return{Q:n,R:e,toString:function(){return"Q: "+this.Q.toString()+"\nR: "+this.R.toString()}}}function n(e){var t=u(e),r=t.R._data;if(0<e._data.length)for(var n="Complex"===r[0][0].type?o(0):0,i=0;i<r.length;++i)for(var a=0;a<i&&a<(r[0]||[]).length;++a)r[i][a]=n;return t}});function Of(e,t,r,n,i,a,o){var u=0;for(r[o]=e;0<=u;){var s=r[o+u],c=r[n+s];-1===c?(u--,a[t++]=s):(r[n+s]=r[i+c],r[o+ ++u]=c)}return t}var Tf=N("csAmd",["add","multiply","transpose"],function(e){var ae=e.add,oe=e.multiply,ue=e.transpose;return function(e,z){if(!z||e<=0||3<e)return null;for(var t=z._size,R=t[0],r=t[1],q=0,t=Math.max(16,10*Math.sqrt(r)),e=function(e,t,r,n,i){var a=ue(t);if(1===e&&n===r)return ae(t,a);if(2!==e)return oe(a,t);for(var o=a._index,u=a._ptr,s=0,c=0;c<r;c++){var l=u[c];if(u[c]=s,!(u[c+1]-l>i))for(var f=u[c+1];l<f;l++)o[s++]=o[l]}return u[r]=s,t=ue(a),oe(a,t)}(e,z,R,r,t=Math.min(r-2,t)),j=ce,n=e._values,i=e._index,P=e._ptr,L=e._size[1],a=0,o=0;o<L;o++){var u=P[o];for(P[o]=a;u<P[o+1];u++)j(i[u],o,n?n[u]:1,null)&&(i[a]=i[u],n&&(n[a]=n[u]),a++)}P[L]=a,i.splice(a,i.length-a),n&&n.splice(a,n.length-a);for(var s,c,U,l,$,f,p,m,H,G,h,d,y,v=e._index,g=e._ptr,V=g[r],Z=[],x=[],b=r+1,w=2*(r+1),N=3*(r+1),D=4*(r+1),E=5*(r+1),A=6*(r+1),W=7*(r+1),S=Z,C=function(e,t,r,n,i,a,o,u,s,c,l){for(var f=0;f<e;f++)r[0+f]=t[f+1]-t[f];for(var p=r[0+e]=0;p<=e;p++)r[n+p]=-1,i[p]=-1,r[a+p]=-1,r[o+p]=-1,r[u+p]=1,r[s+p]=1,r[c+p]=0,r[l+p]=r[0+p];var m=se(0,0,r,s,e);return r[c+e]=-2,t[e]=-1,r[s+e]=0,m}(r,g,x,N,S,w,W,b,A,D,E),Y=function(e,t,r,n,i,a,o,u,s,c,l){for(var f=0,p=0;p<e;p++){var m,h=r[n+p];0===h?(r[i+p]=-2,f++,t[p]=-1,r[a+p]=0):o<h?(r[u+p]=0,r[i+p]=-1,f++,t[p]=-e-2,r[u+e]++):(-1!==(m=r[s+h])&&(c[m]=p),r[l+p]=r[s+h],r[s+h]=p)}return f}(r,g,x,E,D,A,t,b,N,S,w),M=0;Y<r;){for(c=-1;M<r&&-1===(c=x[N+M]);M++);-1!==x[w+c]&&(S[x[w+c]]=-1),x[N+M]=x[w+c];for(var J,F=x[D+c],X=x[b+c],O=(Y+=X,0),T=(x[b+c]=-X,g[c]),_=0===F?T:V,B=_,Q=1;Q<=F+1;Q++){for(f=F<Q?($=T,x[0+(l=c)]-F):($=g[l=v[T++]],x[0+l]),U=1;U<=f;U++)(p=x[b+(s=v[$++])])<=0||(O+=p,x[b+s]=-p,-1!==x[w+(v[B++]=s)]&&(S[x[w+s]]=S[s]),-1!==S[s]?x[w+S[s]]=x[w+s]:x[N+x[E+s]]=x[w+s]);l!==c&&(g[l]=-c-2,x[A+l]=0)}for(0!==F&&(V=B),x[E+c]=O,g[c]=_,x[0+c]=B-_,x[D+c]=-2,C=se(C,q,x,A,r),m=_;m<B;m++)if(!((H=x[D+(s=v[m])])<=0))for(var K=C-(p=-x[b+s]),T=g[s],k=g[s]+H-1;T<=k;T++)x[A+(l=v[T])]>=C?x[A+l]-=p:0!==x[A+l]&&(x[A+l]=x[E+l]+K);for(m=_;m<B;m++){for(G=(k=g[s=v[m]])+x[D+s]-1,y=d=0,T=h=k;T<=G;T++)0!==x[A+(l=v[T])]&&(0<(J=x[A+l]-C)?(y+=J,d+=v[h++]=l):(g[l]=-c-2,x[A+l]=0));x[D+s]=h-k+1;var ee=h,te=k+x[0+s];for(T=1+G;T<te;T++){var re=x[b+(I=v[T])];re<=0||(y+=re,d+=v[h++]=I)}0===y?(g[s]=-c-2,O-=p=-x[b+s],X+=p,Y+=p,x[b+s]=0,x[D+s]=-1):(x[E+s]=Math.min(x[E+s],y),v[h]=v[ee],v[ee]=v[k],v[k]=c,x[0+s]=h-k+1,x[w+s]=x[W+(d=(d<0?-d:d)%r)],S[x[W+d]=s]=d)}for(x[E+c]=O,C=se(C+(q=Math.max(q,O)),q,x,A,r),m=_;m<B;m++)if(!(0<=x[b+(s=v[m])]))for(s=x[W+(d=S[s])],x[W+d]=-1;-1!==s&&-1!==x[w+s];s=x[w+s],C++){for(f=x[0+s],H=x[D+s],T=g[s]+1;T<=g[s]+f-1;T++)x[A+v[T]]=C;for(var ne=s,I=x[w+s];-1!==I;){var ie=x[0+I]===f&&x[D+I]===H;for(T=g[I]+1;ie&&T<=g[I]+f-1;T++)x[A+v[T]]!==C&&(ie=0);ie?(g[I]=-s-2,x[b+s]+=x[b+I],x[b+I]=0,x[D+I]=-1,I=x[w+I],x[w+ne]=I):I=x[w+(ne=I)]}}for(m=T=_;m<B;m++)(p=-x[b+(s=v[m])])<=0||(x[b+s]=p,y=x[E+s]+O-p,-1!==x[N+(y=Math.min(y,r-Y-p))]&&(S[x[N+y]]=s),x[w+s]=x[N+y],S[s]=-1,x[N+y]=s,M=Math.min(M,y),x[E+s]=y,v[T++]=s);x[b+c]=X,0==(x[0+c]=T-_)&&(g[c]=-1,x[A+c]=0),0!==F&&(V=T)}for(s=0;s<r;s++)g[s]=-g[s]-2;for(I=0;I<=r;I++)x[N+I]=-1;for(I=r;0<=I;I--)0<x[b+I]||(x[w+I]=x[N+g[I]],x[N+g[I]]=I);for(l=r;0<=l;l--)x[b+l]<=0||-1!==g[l]&&(x[w+l]=x[N+g[l]],x[N+g[l]]=l);for(s=c=0;s<=r;s++)-1===g[s]&&(c=Of(s,c,x,N,w,Z,A));return Z.splice(Z.length-1,1),Z};function se(e,t,r,n,i){if(e<2||e+t<0){for(var a=0;a<i;a++)0!==r[n+a]&&(r[n+a]=1);e=2}return e}function ce(e,t){return e!==t}});var _f=N("csCounts",["transpose"],function(e){var A=e.transpose;return function(e,t,r,n){if(!e||!t||!r)return null;for(var i,a,o,u,s,c,l=e._size,f=l[0],p=l[1],m=4*p+(n?p+f+1:0),h=[],d=p,y=2*p,v=3*p,g=4*p,x=5*p+1,b=0;b<m;b++)h[b]=-1;var w=[],l=A(e),N=l._index,D=l._ptr;for(b=0;b<p;b++)for(w[a=r[b]]=-1===h[v+a]?1:0;-1!==a&&-1===h[v+a];a=t[a])h[v+a]=b;if(n){for(b=0;b<p;b++)h[r[b]]=b;for(i=0;i<f;i++){for(b=p,s=D[i],c=D[i+1],u=s;u<c;u++)b=Math.min(b,h[N[u]]);h[x+i]=h[g+b],h[g+b]=i}}for(i=0;i<p;i++)h[0+i]=i;for(b=0;b<p;b++){for(-1!==t[a=r[b]]&&w[t[a]]--,o=n?h[g+b]:a;-1!==o;o=n?h[x+o]:-1)for(u=D[o];u<D[o+1];u++){var E=function(e,t,r,n,i,a,o){var u,s,c,l=0;if(e<=t||r[n+t]<=r[i+e])return-1;if(r[i+e]=r[n+t],i=r[a+e],r[a+e]=t,-1===i)l=1,c=e;else{for(l=2,c=i;c!==r[o+c];c=r[o+c]);for(u=i;u!==c;u=s)s=r[o+u],r[o+u]=c}return{jleaf:l,q:c}}(i=N[u],a,h,v,d,y,0);1<=E.jleaf&&w[a]++,2===E.jleaf&&w[E.q]--}-1!==t[a]&&(h[0+a]=t[a])}for(a=0;a<p;a++)-1!==t[a]&&(w[t[a]]+=w[a]);return w}}),Bf=N("csSqr",["add","multiply","transpose"],function(e){var t=e.add,r=e.multiply,e=e.transpose,u=Tf({add:t,multiply:r,transpose:e}),s=_f({transpose:e});return function(e,t,r){var n,i=t._ptr,a=t._size[1],o={};if(o.q=u(e,t),e&&!o.q)return null;if(r){var x=e?function(e,t){e._values;for(var r=e._index,n=e._ptr,i=e._size,a=e._datatype,o=i[0],u=i[1],s=[],c=[],l=0,f=0;f<u;f++){c[f]=l;for(var p=t?t[f]:f,m=n[p],h=n[p+1],d=m;d<h;d++){var y=r[d];s[l]=y,l++}}return c[u]=l,e.createSparseMatrix({values:null,index:s,ptr:c,size:[o,u],datatype:a})}(t,o.q):t,r=(o.parent=function(){if(!x)return null;var e,t=x._index,r=x._ptr,n=x._size,i=n[0],a=n[1],o=[],u=[],s=a;for(h=0;h<i;h++)u[s+h]=-1;for(var c=0;c<a;c++){o[c]=-1,u[0+c]=-1;for(var l=r[c],f=r[c+1],p=l;p<f;p++){for(var m=t[p],h=u[s+m];-1!==h&&h<c;h=e)e=u[0+h],u[0+h]=c,-1===e&&(o[h]=c);u[s+m]=c}}return o}(),function(e,t){if(!e)return null;for(var r=0,n=[],i=[],a=t,o=2*t,u=0;u<t;u++)i[0+u]=-1;for(u=t-1;0<=u;u--)-1!==e[u]&&(i[a+u]=i[0+e[u]],i[0+e[u]]=u);for(u=0;u<t;u++)-1===e[u]&&(r=Of(u,r,i,0,a,n,o));return n}(o.parent,a));if(o.cp=s(x,o.parent,r,1),x&&o.parent&&o.cp&&function(e){var t=x._ptr,r=x._index,n=x._size,i=n[0],a=n[1];e.pinv=[],e.leftmost=[];for(var o,u,s,c=e.parent,l=e.pinv,f=e.leftmost,p=[],m=i,h=i+a,d=i+2*a,y=0;y<a;y++)p[m+y]=-1,p[h+y]=-1,p[d+y]=0;for(g=0;g<i;g++)f[g]=-1;for(y=a-1;0<=y;y--)for(u=t[y],s=t[y+1],o=u;o<s;o++)f[r[o]]=y;for(g=i-1;0<=g;g--)(l[g]=-1)!==(y=f[g])&&(0==p[d+y]++&&(p[h+y]=g),p[0+g]=p[m+y],p[m+y]=g);for(e.lnz=0,e.m2=i,y=0;y<a;y++){var v,g=p[m+y];e.lnz++,--d[l[g=g<0?e.m2++:g]=y]<=0||(e.lnz+=p[d+y],-1!==(v=c[y])&&(0===p[d+v]&&(p[h+v]=p[h+y]),p[0+p[h+y]]=p[m+v],p[m+v]=p[0+g],p[d+v]+=p[d+y]))}for(g=0;g<i;g++)l[g]<0&&(l[g]=y++);return 1}(o))for(n=o.unz=0;n<a;n++)o.unz+=o.cp[n]}else o.unz=4*i[a]+a,o.lnz=o.unz;return o}});function kf(e,t){e[t]=-e[t]-2}function If(e){return e<0?-e-2:e}var zf=N("csSpsolve",["divideScalar","multiply","subtract"],function(e){var N=e.divideScalar,D=e.multiply,E=e.subtract;return function(e,p,m,t,r,n,i){for(var a,o,u,s=e._values,c=e._index,l=e._ptr,f=e._size[1],h=p._values,d=p._index,y=p._ptr,e=function(e,t,r){for(var n=e._ptr,i=e._size,a=p._index,o=p._ptr,u=i[1],s=u,i=o[m],c=o[m+1],l=i;l<c;l++){var f=a[l];n[f]<0||(s=function(e,t,r,n,i){var a,o=t._index,u=t._ptr,s=t._size[1],c=0;for(n[0]=e;0<=c;){e=n[c];for(var l=i?i[e]:e,f=(u[e]<0||(kf(u,e),n[s+c]=l<0?0:If(u[l])),1),p=n[s+c],m=l<0?0:If(u[l+1]);p<m;p++)if(!(u[a=o[p]]<0)){n[s+c]=p,n[++c]=a,f=0;break}f&&(c--,n[--r]=e)}return r}(f,e,s,t,r))}for(l=s;l<u;l++)kf(n,t[l]);return s}(e,t,n),v=e;v<f;v++)r[t[v]]=0;for(a=y[m],o=y[m+1],v=a;v<o;v++)r[d[v]]=h[v];for(var g=e;g<f;g++){var x=t[g],b=n?n[x]:x;if(!(b<0))for(a=l[b],o=l[b+1],r[x]=N(r[x],s[i?a:o-1]),v=i?a+1:a,u=i?o:o-1;v<u;v++){var w=c[v];r[w]=E(r[w],D(s[v],r[x]))}}return e}}),Rf=N("csLu",["abs","divideScalar","multiply","subtract","larger","largerEq","SparseMatrix"],function(e){var S=e.abs,C=e.divideScalar,M=e.multiply,t=e.subtract,F=e.larger,O=e.largerEq,T=e.SparseMatrix,_=zf({divideScalar:C,multiply:M,subtract:t});return function(e,t,r){if(!e)return null;var n,i=e._size[1],a=100,o=100;t&&(n=t.q,a=t.lnz||a,o=t.unz||o);for(var u=[],s=[],c=[],l=new T({values:u,index:s,ptr:c,size:[i,i]}),f=[],p=[],m=[],t=new T({values:f,index:p,ptr:m,size:[i,i]}),h=[],d=[],y=[],v=0;v<i;v++)d[v]=0,h[v]=-1,c[v+1]=0;for(var a=0,o=0,g=0;g<i;g++){c[g]=a,m[g]=o;for(var x,b=n?n[g]:g,w=_(l,e,b,y,d,h,1),N=-1,D=-1,E=w;E<i;E++)h[v=y[E]]<0?(x=S(d[v]),F(x,D)&&(D=x,N=v)):(p[o]=h[v],f[o++]=d[v]);if(-1===N||D<=0)return null;var A=d[N=h[b]<0&&O(S(d[b]),M(D,r))?b:N];for(p[o]=g,f[o++]=A,h[N]=g,s[a]=N,u[a++]=1,E=w;E<i;E++)h[v=y[E]]<0&&(s[a]=v,u[a++]=C(d[v],A)),d[v]=0}for(c[i]=a,m[i]=o,E=0;E<a;E++)s[E]=h[s[E]];return u.splice(a,u.length-a),s.splice(a,s.length-a),f.splice(o,f.length-o),p.splice(o,p.length-o),{L:l,U:t,pinv:h}}}),qf=N("slu",["typed","abs","add","multiply","transpose","divideScalar","subtract","larger","largerEq","SparseMatrix"],function(e){var t=e.typed,r=e.abs,n=e.add,i=e.multiply,a=e.transpose,o=e.divideScalar,u=e.subtract,s=e.larger,c=e.largerEq,e=e.SparseMatrix,l=Bf({add:n,multiply:i,transpose:a}),f=Rf({abs:r,divideScalar:o,multiply:i,subtract:u,larger:s,largerEq:c,SparseMatrix:e});return t("slu",{"SparseMatrix, number, number":function(e,t,r){if(!w(t)||t<0||3<t)throw new Error("Symbolic Ordering and Analysis order must be an integer number in the interval [0, 3]");if(r<0||1<r)throw new Error("Partial pivoting threshold must be a number from 0 to 1");t=l(t,e,!1),e=f(e,t,r);return{L:e.L,U:e.U,p:e.pinv,q:t.q,toString:function(){return"L: "+this.L.toString()+"\nU: "+this.U.toString()+"\np: "+this.p.toString()+(this.q?"\nq: "+this.q.toString():"")+"\n"}}}})});function jf(e,t){var r,n=t.length,i=[];if(e)for(r=0;r<n;r++)i[e[r]]=t[r];else for(r=0;r<n;r++)i[r]=t[r];return i}var Pf=N("lusolve",["typed","matrix","lup","slu","usolve","lsolve","DenseMatrix"],function(e){var t=e.typed,r=e.matrix,n=e.lup,i=e.slu,a=e.usolve,o=e.lsolve,u=Hu({DenseMatrix:e.DenseMatrix});return t("lusolve",{"Array, Array | Matrix":function(e,t){e=r(e);e=n(e);return c(e.L,e.U,e.p,null,t).valueOf()},"DenseMatrix, Array | Matrix":function(e,t){e=n(e);return c(e.L,e.U,e.p,null,t)},"SparseMatrix, Array | Matrix":function(e,t){e=n(e);return c(e.L,e.U,e.p,null,t)},"SparseMatrix, Array | Matrix, number, number":function(e,t,r,n){e=i(e,r,n);return c(e.L,e.U,e.p,e.q,t)},"Object, Array | Matrix":function(e,t){return c(e.L,e.U,e.p,e.q,t)}});function s(e){if(P(e))return e;if(b(e))return r(e);throw new TypeError("Invalid Matrix LU decomposition")}function c(e,t,r,n,i){e=s(e),t=s(t),r&&((i=u(e,i,!0))._data=jf(r,i._data));r=o(e,i),e=a(t,r);return n&&(e._data=jf(n,e._data)),e}}),Lf="polynomialRoot",Uf=N(Lf,["typed","isZero","equalScalar","add","subtract","multiply","divide","sqrt","unaryMinus","cbrt","typeOf","im","re"],function(e){var t=e.typed,h=e.isZero,d=e.equalScalar,y=e.add,v=e.subtract,g=e.multiply,x=e.divide,b=e.sqrt,w=e.unaryMinus,N=e.cbrt,D=e.typeOf,E=e.im,A=e.re;return t(Lf,{"number|Complex, ...number|Complex":function(e,t){for(var r=[e].concat(Me(t));0<r.length&&h(r[r.length-1]);)r.pop();if(r.length<2)throw new RangeError("Polynomial [".concat(e,", ").concat(t,"] must have a non-zero non-constant coefficient"));switch(r.length){case 2:return[w(x(r[0],r[1]))];case 3:var n=aa(r,3),i=n[0],a=n[1],n=n[2],o=g(2,n),u=g(a,a),n=g(4,n,i);if(d(u,n))return[x(w(a),o)];i=b(v(u,n));return[x(v(i,a),o),x(v(w(i),a),o)];case 4:var u=aa(r,4),n=u[0],i=u[1],s=u[2],a=u[3],c=w(g(3,a)),o=g(s,s),u=g(3,a,i),l=y(g(2,s,s,s),g(27,a,a,n)),f=g(9,a,s,i);if(d(o,u)&&d(l,f))return[x(s,c)];var p=v(o,u),l=v(l,f),f=y(g(18,a,s,i,n),g(s,s,i,i)),m=y(g(4,s,s,s,n),g(4,a,i,i,i),g(27,a,a,n,n));return d(f,m)?[x(v(g(4,a,s,i),y(g(9,a,a,n),g(s,s,s))),g(a,p)),x(v(g(9,a,n),g(s,i)),g(2,p))]:(f=d(o,u)?l:x(y(l,b(v(g(l,l),g(4,p,p,p)))),2),N(f,!0).toArray().map(function(e){return x(y(s,e,x(p,e)),c)}).map(function(e){return"Complex"===D(e)&&d(A(e),A(e)+E(e))?A(e):e}));default:throw new RangeError("only implemented for cubic or lower-order polynomials, not ".concat(r))}}})}),$f=N("Help",["evaluate"],function(e){var s=e.evaluate;function n(e){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");if(!e)throw new Error('Argument "doc" missing');this.doc=e}return n.prototype.type="Help",n.prototype.isHelp=!0,n.prototype.toString=function(){var e=this.doc||{},t="\n";if(e.name&&(t+="Name: "+e.name+"\n\n"),e.category&&(t+="Category: "+e.category+"\n\n"),e.description&&(t+="Description:\n "+e.description+"\n\n"),e.syntax&&(t+="Syntax:\n "+e.syntax.join("\n ")+"\n\n"),e.examples){t+="Examples:\n";for(var r=!1,n=s("config()"),i={config:function(e){return r=!0,s("config(newConfig)",{newConfig:e})}},a=0;a<e.examples.length;a++){var o=e.examples[a],u=(t+=" "+o+"\n",void 0);try{u=s(o,i)}catch(e){u=e}void 0===u||j(u)||(t+=" "+Fe(u,{precision:14})+"\n")}t+="\n",r&&s("config(originalConfig)",{originalConfig:n})}return e.mayThrow&&e.mayThrow.length&&(t+="Throws: "+e.mayThrow.join(", ")+"\n\n"),e.seealso&&e.seealso.length&&(t+="See also: "+e.seealso.join(", ")+"\n"),t},n.prototype.toJSON=function(){var e=Ce(this.doc);return e.mathjs="Help",e},n.fromJSON=function(t){var r={};return Object.keys(t).filter(function(e){return"mathjs"!==e}).forEach(function(e){r[e]=t[e]}),new n(r)},n.prototype.valueOf=n.prototype.toString,n},{isClass:!0}),Hf=N("Chain",["?on","math","typed"],function(e){var t=e.on,r=e.math,i=e.typed;function a(e){if(!(this instanceof a))throw new SyntaxError("Constructor must be called with the new operator");he(e)?this.value=e.value:this.value=e}function n(e,t){He(a.prototype,e,function(){var e=t();if("function"==typeof e)return o(e)})}function o(n){return function(){if(0===arguments.length)return new a(n(this.value));for(var e=[this.value],t=0;t<arguments.length;t++)e[t+1]=arguments[t];if(i.isTypedFunction(n)){var r=i.resolve(n,e);if(1===r.params.length)throw new Error("chain function "+n.name+" cannot match rest parameter between chain value and additional arguments.");return new a(r.implementation.apply(n,e))}return new a(n.apply(n,e))}}a.prototype.type="Chain",a.prototype.isChain=!0,a.prototype.done=function(){return this.value},a.prototype.valueOf=function(){return this.value},a.prototype.toString=function(){return Fe(this.value)},a.prototype.toJSON=function(){return{mathjs:"Chain",value:this.value}},a.fromJSON=function(e){return new a(e.value)};var u={expression:!0,docs:!0,type:!0,classes:!0,json:!0,error:!0,isChain:!0};return(a.createProxy=function(t,e){if("string"==typeof t)"function"==typeof e&&(a.prototype[t]=o(e));else for(var r in t)!function(e){se(t,e)&&void 0===u[e]&&n(e,function(){return t[e]})}(r)})(r),t&&t("import",function(e,t,r){r||n(e,t)}),a},{isClass:!0}),Zn={name:"e",category:"Constants",syntax:["e"],description:"Euler's number, the base of the natural logarithm. Approximately equal to 2.71828",examples:["e","e ^ 2","exp(2)","log(e)"],seealso:["exp"]},Fi={name:"pi",category:"Constants",syntax:["pi"],description:"The number pi is a mathematical constant that is the ratio of a circle's circumference to its diameter, and is approximately equal to 3.14159",examples:["pi","sin(pi/2)"],seealso:["tau"]},Gf={bignumber:{name:"bignumber",category:"Construction",syntax:["bignumber(x)"],description:"Create a big number from a number or string.",examples:["0.1 + 0.2","bignumber(0.1) + bignumber(0.2)",'bignumber("7.2")','bignumber("7.2e500")',"bignumber([0.1, 0.2, 0.3])"],seealso:["boolean","complex","fraction","index","matrix","string","unit"]},boolean:{name:"boolean",category:"Construction",syntax:["x","boolean(x)"],description:"Convert a string or number into a boolean.",examples:["boolean(0)","boolean(1)","boolean(3)",'boolean("true")','boolean("false")',"boolean([1, 0, 1, 1])"],seealso:["bignumber","complex","index","matrix","number","string","unit"]},complex:{name:"complex",category:"Construction",syntax:["complex()","complex(re, im)","complex(string)"],description:"Create a complex number.",examples:["complex()","complex(2, 3)",'complex("7 - 2i")'],seealso:["bignumber","boolean","index","matrix","number","string","unit"]},createUnit:{name:"createUnit",category:"Construction",syntax:["createUnit(definitions)","createUnit(name, definition)"],description:"Create a user-defined unit and register it with the Unit type.",examples:['createUnit("foo")','createUnit("knot", {definition: "0.514444444 m/s", aliases: ["knots", "kt", "kts"]})','createUnit("mph", "1 mile/hour")'],seealso:["unit","splitUnit"]},fraction:{name:"fraction",category:"Construction",syntax:["fraction(num)","fraction(matrix)","fraction(num,den)","fraction({n: num, d: den})"],description:"Create a fraction from a number or from integer numerator and denominator.",examples:["fraction(0.125)","fraction(1, 3) + fraction(2, 5)","fraction({n: 333, d: 53})","fraction([sqrt(9), sqrt(10), sqrt(11)])"],seealso:["bignumber","boolean","complex","index","matrix","string","unit"]},index:{name:"index",category:"Construction",syntax:["[start]","[start:end]","[start:step:end]","[start1, start 2, ...]","[start1:end1, start2:end2, ...]","[start1:step1:end1, start2:step2:end2, ...]"],description:"Create an index to get or replace a subset of a matrix",examples:["A = [1, 2, 3; 4, 5, 6]","A[1, :]","A[1, 2] = 50","A[1:2, 1:2] = 1","B = [1, 2, 3]","B[B>1 and B<3]"],seealso:["bignumber","boolean","complex","matrix,","number","range","string","unit"]},matrix:{name:"matrix",category:"Construction",syntax:["[]","[a1, b1, ...; a2, b2, ...]","matrix()",'matrix("dense")',"matrix([...])"],description:"Create a matrix.",examples:["[]","[1, 2, 3]","[1, 2, 3; 4, 5, 6]","matrix()","matrix([3, 4])",'matrix([3, 4; 5, 6], "sparse")','matrix([3, 4; 5, 6], "sparse", "number")'],seealso:["bignumber","boolean","complex","index","number","string","unit","sparse"]},number:{name:"number",category:"Construction",syntax:["x","number(x)","number(unit, valuelessUnit)"],description:"Create a number or convert a string or boolean into a number.",examples:["2","2e3","4.05","number(2)",'number("7.2")',"number(true)","number([true, false, true, true])",'number(unit("52cm"), "m")'],seealso:["bignumber","boolean","complex","fraction","index","matrix","string","unit"]},sparse:{name:"sparse",category:"Construction",syntax:["sparse()","sparse([a1, b1, ...; a1, b2, ...])",'sparse([a1, b1, ...; a1, b2, ...], "number")'],description:"Create a sparse matrix.",examples:["sparse()","sparse([3, 4; 5, 6])",'sparse([3, 0; 5, 0], "number")'],seealso:["bignumber","boolean","complex","index","number","string","unit","matrix"]},splitUnit:{name:"splitUnit",category:"Construction",syntax:["splitUnit(unit: Unit, parts: Unit[])"],description:"Split a unit in an array of units whose sum is equal to the original unit.",examples:['splitUnit(1 m, ["feet", "inch"])'],seealso:["unit","createUnit"]},string:{name:"string",category:"Construction",syntax:['"text"',"string(x)"],description:"Create a string or convert a value to a string",examples:['"Hello World!"',"string(4.2)","string(3 + 2i)"],seealso:["bignumber","boolean","complex","index","matrix","number","unit"]},unit:{name:"unit",category:"Construction",syntax:["value unit","unit(value, unit)","unit(string)"],description:"Create a unit.",examples:["5.5 mm","3 inch",'unit(7.1, "kilogram")','unit("23 deg")'],seealso:["bignumber","boolean","complex","index","matrix","number","string"]},e:Zn,E:Zn,false:{name:"false",category:"Constants",syntax:["false"],description:"Boolean value false",examples:["false"],seealso:["true"]},i:{name:"i",category:"Constants",syntax:["i"],description:"Imaginary unit, defined as i*i=-1. A complex number is described as a + b*i, where a is the real part, and b is the imaginary part.",examples:["i","i * i","sqrt(-1)"],seealso:[]},Infinity:{name:"Infinity",category:"Constants",syntax:["Infinity"],description:"Infinity, a number which is larger than the maximum number that can be handled by a floating point number.",examples:["Infinity","1 / 0"],seealso:[]},LN2:{name:"LN2",category:"Constants",syntax:["LN2"],description:"Returns the natural logarithm of 2, approximately equal to 0.693",examples:["LN2","log(2)"],seealso:[]},LN10:{name:"LN10",category:"Constants",syntax:["LN10"],description:"Returns the natural logarithm of 10, approximately equal to 2.302",examples:["LN10","log(10)"],seealso:[]},LOG2E:{name:"LOG2E",category:"Constants",syntax:["LOG2E"],description:"Returns the base-2 logarithm of E, approximately equal to 1.442",examples:["LOG2E","log(e, 2)"],seealso:[]},LOG10E:{name:"LOG10E",category:"Constants",syntax:["LOG10E"],description:"Returns the base-10 logarithm of E, approximately equal to 0.434",examples:["LOG10E","log(e, 10)"],seealso:[]},NaN:{name:"NaN",category:"Constants",syntax:["NaN"],description:"Not a number",examples:["NaN","0 / 0"],seealso:[]},null:{name:"null",category:"Constants",syntax:["null"],description:"Value null",examples:["null"],seealso:["true","false"]},pi:Fi,PI:Fi,phi:{name:"phi",category:"Constants",syntax:["phi"],description:"Phi is the golden ratio. Two quantities are in the golden ratio if their ratio is the same as the ratio of their sum to the larger of the two quantities. Phi is defined as `(1 + sqrt(5)) / 2` and is approximately 1.618034...",examples:["phi"],seealso:[]},SQRT1_2:{name:"SQRT1_2",category:"Constants",syntax:["SQRT1_2"],description:"Returns the square root of 1/2, approximately equal to 0.707",examples:["SQRT1_2","sqrt(1/2)"],seealso:[]},SQRT2:{name:"SQRT2",category:"Constants",syntax:["SQRT2"],description:"Returns the square root of 2, approximately equal to 1.414",examples:["SQRT2","sqrt(2)"],seealso:[]},tau:{name:"tau",category:"Constants",syntax:["tau"],description:"Tau is the ratio constant of a circle's circumference to radius, equal to 2 * pi, approximately 6.2832.",examples:["tau","2 * pi"],seealso:["pi"]},true:{name:"true",category:"Constants",syntax:["true"],description:"Boolean value true",examples:["true"],seealso:["false"]},version:{name:"version",category:"Constants",syntax:["version"],description:"A string with the version number of math.js",examples:["version"],seealso:[]},speedOfLight:{description:"Speed of light in vacuum",examples:["speedOfLight"]},gravitationConstant:{description:"Newtonian constant of gravitation",examples:["gravitationConstant"]},planckConstant:{description:"Planck constant",examples:["planckConstant"]},reducedPlanckConstant:{description:"Reduced Planck constant",examples:["reducedPlanckConstant"]},magneticConstant:{description:"Magnetic constant (vacuum permeability)",examples:["magneticConstant"]},electricConstant:{description:"Electric constant (vacuum permeability)",examples:["electricConstant"]},vacuumImpedance:{description:"Characteristic impedance of vacuum",examples:["vacuumImpedance"]},coulomb:{description:"Coulomb's constant",examples:["coulomb"]},elementaryCharge:{description:"Elementary charge",examples:["elementaryCharge"]},bohrMagneton:{description:"Borh magneton",examples:["bohrMagneton"]},conductanceQuantum:{description:"Conductance quantum",examples:["conductanceQuantum"]},inverseConductanceQuantum:{description:"Inverse conductance quantum",examples:["inverseConductanceQuantum"]},magneticFluxQuantum:{description:"Magnetic flux quantum",examples:["magneticFluxQuantum"]},nuclearMagneton:{description:"Nuclear magneton",examples:["nuclearMagneton"]},klitzing:{description:"Von Klitzing constant",examples:["klitzing"]},bohrRadius:{description:"Borh radius",examples:["bohrRadius"]},classicalElectronRadius:{description:"Classical electron radius",examples:["classicalElectronRadius"]},electronMass:{description:"Electron mass",examples:["electronMass"]},fermiCoupling:{description:"Fermi coupling constant",examples:["fermiCoupling"]},fineStructure:{description:"Fine-structure constant",examples:["fineStructure"]},hartreeEnergy:{description:"Hartree energy",examples:["hartreeEnergy"]},protonMass:{description:"Proton mass",examples:["protonMass"]},deuteronMass:{description:"Deuteron Mass",examples:["deuteronMass"]},neutronMass:{description:"Neutron mass",examples:["neutronMass"]},quantumOfCirculation:{description:"Quantum of circulation",examples:["quantumOfCirculation"]},rydberg:{description:"Rydberg constant",examples:["rydberg"]},thomsonCrossSection:{description:"Thomson cross section",examples:["thomsonCrossSection"]},weakMixingAngle:{description:"Weak mixing angle",examples:["weakMixingAngle"]},efimovFactor:{description:"Efimov factor",examples:["efimovFactor"]},atomicMass:{description:"Atomic mass constant",examples:["atomicMass"]},avogadro:{description:"Avogadro's number",examples:["avogadro"]},boltzmann:{description:"Boltzmann constant",examples:["boltzmann"]},faraday:{description:"Faraday constant",examples:["faraday"]},firstRadiation:{description:"First radiation constant",examples:["firstRadiation"]},loschmidt:{description:"Loschmidt constant at T=273.15 K and p=101.325 kPa",examples:["loschmidt"]},gasConstant:{description:"Gas constant",examples:["gasConstant"]},molarPlanckConstant:{description:"Molar Planck constant",examples:["molarPlanckConstant"]},molarVolume:{description:"Molar volume of an ideal gas at T=273.15 K and p=101.325 kPa",examples:["molarVolume"]},sackurTetrode:{description:"Sackur-Tetrode constant at T=1 K and p=101.325 kPa",examples:["sackurTetrode"]},secondRadiation:{description:"Second radiation constant",examples:["secondRadiation"]},stefanBoltzmann:{description:"Stefan-Boltzmann constant",examples:["stefanBoltzmann"]},wienDisplacement:{description:"Wien displacement law constant",examples:["wienDisplacement"]},molarMass:{description:"Molar mass constant",examples:["molarMass"]},molarMassC12:{description:"Molar mass constant of carbon-12",examples:["molarMassC12"]},gravity:{description:"Standard acceleration of gravity (standard acceleration of free-fall on Earth)",examples:["gravity"]},planckLength:{description:"Planck length",examples:["planckLength"]},planckMass:{description:"Planck mass",examples:["planckMass"]},planckTime:{description:"Planck time",examples:["planckTime"]},planckCharge:{description:"Planck charge",examples:["planckCharge"]},planckTemperature:{description:"Planck temperature",examples:["planckTemperature"]},derivative:{name:"derivative",category:"Algebra",syntax:["derivative(expr, variable)","derivative(expr, variable, {simplify: boolean})"],description:"Takes the derivative of an expression expressed in parser Nodes. The derivative will be taken over the supplied variable in the second parameter. If there are multiple variables in the expression, it will return a partial derivative.",examples:['derivative("2x^3", "x")','derivative("2x^3", "x", {simplify: false})','derivative("2x^2 + 3x + 4", "x")','derivative("sin(2x)", "x")','f = parse("x^2 + x")','x = parse("x")',"df = derivative(f, x)","df.evaluate({x: 3})"],seealso:["simplify","parse","evaluate"]},lsolve:{name:"lsolve",category:"Algebra",syntax:["x=lsolve(L, b)"],description:"Finds one solution of the linear system L * x = b where L is an [n x n] lower triangular matrix and b is a [n] column vector.",examples:["a = [-2, 3; 2, 1]","b = [11, 9]","x = lsolve(a, b)"],seealso:["lsolveAll","lup","lusolve","usolve","matrix","sparse"]},lsolveAll:{name:"lsolveAll",category:"Algebra",syntax:["x=lsolveAll(L, b)"],description:"Finds all solutions of the linear system L * x = b where L is an [n x n] lower triangular matrix and b is a [n] column vector.",examples:["a = [-2, 3; 2, 1]","b = [11, 9]","x = lsolve(a, b)"],seealso:["lsolve","lup","lusolve","usolve","matrix","sparse"]},lup:{name:"lup",category:"Algebra",syntax:["lup(m)"],description:"Calculate the Matrix LU decomposition with partial pivoting. Matrix A is decomposed in three matrices (L, U, P) where P * A = L * U",examples:["lup([[2, 1], [1, 4]])","lup(matrix([[2, 1], [1, 4]]))","lup(sparse([[2, 1], [1, 4]]))"],seealso:["lusolve","lsolve","usolve","matrix","sparse","slu","qr"]},lusolve:{name:"lusolve",category:"Algebra",syntax:["x=lusolve(A, b)","x=lusolve(lu, b)"],description:"Solves the linear system A * x = b where A is an [n x n] matrix and b is a [n] column vector.",examples:["a = [-2, 3; 2, 1]","b = [11, 9]","x = lusolve(a, b)"],seealso:["lup","slu","lsolve","usolve","matrix","sparse"]},leafCount:{name:"leafCount",category:"Algebra",syntax:["leafCount(expr)"],description:"Computes the number of leaves in the parse tree of the given expression",examples:['leafCount("e^(i*pi)-1")','leafCount(parse("{a: 22/7, b: 10^(1/2)}"))'],seealso:["simplify"]},polynomialRoot:{name:"polynomialRoot",category:"Algebra",syntax:["x=polynomialRoot(-6, 3)","x=polynomialRoot(4, -4, 1)","x=polynomialRoot(-8, 12, -6, 1)"],description:"Finds the roots of a univariate polynomial given by its coefficients starting from constant, linear, and so on, increasing in degree.",examples:["a = polynomialRoot(-6, 11, -6, 1)"],seealso:["cbrt","sqrt"]},resolve:{name:"resolve",category:"Algebra",syntax:["resolve(node, scope)"],description:"Recursively substitute variables in an expression tree.",examples:['resolve(parse("1 + x"), { x: 7 })','resolve(parse("size(text)"), { text: "Hello World" })','resolve(parse("x + y"), { x: parse("3z") })','resolve(parse("3x"), { x: parse("y+z"), z: parse("w^y") })'],seealso:["simplify","evaluate"],mayThrow:["ReferenceError"]},simplify:{name:"simplify",category:"Algebra",syntax:["simplify(expr)","simplify(expr, rules)"],description:"Simplify an expression tree.",examples:['simplify("3 + 2 / 4")','simplify("2x + x")','f = parse("x * (x + 2 + x)")',"simplified = simplify(f)","simplified.evaluate({x: 2})"],seealso:["simplifyCore","derivative","evaluate","parse","rationalize","resolve"]},simplifyConstant:{name:"simplifyConstant",category:"Algebra",syntax:["simplifyConstant(expr)","simplifyConstant(expr, options)"],description:"Replace constant subexpressions of node with their values.",examples:['simplifyConstant("(3-3)*x")','simplifyConstant(parse("z-cos(tau/8)"))'],seealso:["simplify","simplifyCore","evaluate"]},simplifyCore:{name:"simplifyCore",category:"Algebra",syntax:["simplifyCore(node)"],description:"Perform simple one-pass simplifications on an expression tree.",examples:['simplifyCore(parse("0*x"))','simplifyCore(parse("(x+0)*2"))'],seealso:["simplify","simplifyConstant","evaluate"]},symbolicEqual:{name:"symbolicEqual",category:"Algebra",syntax:["symbolicEqual(expr1, expr2)","symbolicEqual(expr1, expr2, options)"],description:"Returns true if the difference of the expressions simplifies to 0",examples:['symbolicEqual("x*y","y*x")','symbolicEqual("abs(x^2)", "x^2")','symbolicEqual("abs(x)", "x", {context: {abs: {trivial: true}}})'],seealso:["simplify","evaluate"]},rationalize:{name:"rationalize",category:"Algebra",syntax:["rationalize(expr)","rationalize(expr, scope)","rationalize(expr, scope, detailed)"],description:"Transform a rationalizable expression in a rational fraction. If rational fraction is one variable polynomial then converts the numerator and denominator in canonical form, with decreasing exponents, returning the coefficients of numerator.",examples:['rationalize("2x/y - y/(x+1)")','rationalize("2x/y - y/(x+1)", true)'],seealso:["simplify"]},slu:{name:"slu",category:"Algebra",syntax:["slu(A, order, threshold)"],description:"Calculate the Matrix LU decomposition with full pivoting. Matrix A is decomposed in two matrices (L, U) and two permutation vectors (pinv, q) where P * A * Q = L * U",examples:["slu(sparse([4.5, 0, 3.2, 0; 3.1, 2.9, 0, 0.9; 0, 1.7, 3, 0; 3.5, 0.4, 0, 1]), 1, 0.001)"],seealso:["lusolve","lsolve","usolve","matrix","sparse","lup","qr"]},usolve:{name:"usolve",category:"Algebra",syntax:["x=usolve(U, b)"],description:"Finds one solution of the linear system U * x = b where U is an [n x n] upper triangular matrix and b is a [n] column vector.",examples:["x=usolve(sparse([1, 1, 1, 1; 0, 1, 1, 1; 0, 0, 1, 1; 0, 0, 0, 1]), [1; 2; 3; 4])"],seealso:["usolveAll","lup","lusolve","lsolve","matrix","sparse"]},usolveAll:{name:"usolveAll",category:"Algebra",syntax:["x=usolve(U, b)"],description:"Finds all solutions of the linear system U * x = b where U is an [n x n] upper triangular matrix and b is a [n] column vector.",examples:["x=usolve(sparse([1, 1, 1, 1; 0, 1, 1, 1; 0, 0, 1, 1; 0, 0, 0, 1]), [1; 2; 3; 4])"],seealso:["usolve","lup","lusolve","lsolve","matrix","sparse"]},qr:{name:"qr",category:"Algebra",syntax:["qr(A)"],description:"Calculates the Matrix QR decomposition. Matrix `A` is decomposed in two matrices (`Q`, `R`) where `Q` is an orthogonal matrix and `R` is an upper triangular matrix.",examples:["qr([[1, -1, 4], [1, 4, -2], [1, 4, 2], [1, -1, 0]])"],seealso:["lup","slu","matrix"]},abs:{name:"abs",category:"Arithmetic",syntax:["abs(x)"],description:"Compute the absolute value.",examples:["abs(3.5)","abs(-4.2)"],seealso:["sign"]},add:{name:"add",category:"Operators",syntax:["x + y","add(x, y)"],description:"Add two values.",examples:["a = 2.1 + 3.6","a - 3.6","3 + 2i","3 cm + 2 inch",'"2.3" + "4"'],seealso:["subtract"]},cbrt:{name:"cbrt",category:"Arithmetic",syntax:["cbrt(x)","cbrt(x, allRoots)"],description:"Compute the cubic root value. If x = y * y * y, then y is the cubic root of x. When `x` is a number or complex number, an optional second argument `allRoots` can be provided to return all three cubic roots. If not provided, the principal root is returned",examples:["cbrt(64)","cube(4)","cbrt(-8)","cbrt(2 + 3i)","cbrt(8i)","cbrt(8i, true)","cbrt(27 m^3)"],seealso:["square","sqrt","cube","multiply"]},ceil:{name:"ceil",category:"Arithmetic",syntax:["ceil(x)"],description:"Round a value towards plus infinity. If x is complex, both real and imaginary part are rounded towards plus infinity.",examples:["ceil(3.2)","ceil(3.8)","ceil(-4.2)"],seealso:["floor","fix","round"]},cube:{name:"cube",category:"Arithmetic",syntax:["cube(x)"],description:"Compute the cube of a value. The cube of x is x * x * x.",examples:["cube(2)","2^3","2 * 2 * 2"],seealso:["multiply","square","pow"]},divide:{name:"divide",category:"Operators",syntax:["x / y","divide(x, y)"],description:"Divide two values.",examples:["a = 2 / 3","a * 3","4.5 / 2","3 + 4 / 2","(3 + 4) / 2","18 km / 4.5"],seealso:["multiply"]},dotDivide:{name:"dotDivide",category:"Operators",syntax:["x ./ y","dotDivide(x, y)"],description:"Divide two values element wise.",examples:["a = [1, 2, 3; 4, 5, 6]","b = [2, 1, 1; 3, 2, 5]","a ./ b"],seealso:["multiply","dotMultiply","divide"]},dotMultiply:{name:"dotMultiply",category:"Operators",syntax:["x .* y","dotMultiply(x, y)"],description:"Multiply two values element wise.",examples:["a = [1, 2, 3; 4, 5, 6]","b = [2, 1, 1; 3, 2, 5]","a .* b"],seealso:["multiply","divide","dotDivide"]},dotPow:{name:"dotPow",category:"Operators",syntax:["x .^ y","dotPow(x, y)"],description:"Calculates the power of x to y element wise.",examples:["a = [1, 2, 3; 4, 5, 6]","a .^ 2"],seealso:["pow"]},exp:{name:"exp",category:"Arithmetic",syntax:["exp(x)"],description:"Calculate the exponent of a value.",examples:["exp(1.3)","e ^ 1.3","log(exp(1.3))","x = 2.4","(exp(i*x) == cos(x) + i*sin(x)) # Euler's formula"],seealso:["expm","expm1","pow","log"]},expm:{name:"expm",category:"Arithmetic",syntax:["exp(x)"],description:"Compute the matrix exponential, expm(A) = e^A. The matrix must be square. Not to be confused with exp(a), which performs element-wise exponentiation.",examples:["expm([[0,2],[0,0]])"],seealso:["exp"]},expm1:{name:"expm1",category:"Arithmetic",syntax:["expm1(x)"],description:"Calculate the value of subtracting 1 from the exponential value.",examples:["expm1(2)","pow(e, 2) - 1","log(expm1(2) + 1)"],seealso:["exp","pow","log"]},fix:{name:"fix",category:"Arithmetic",syntax:["fix(x)"],description:"Round a value towards zero. If x is complex, both real and imaginary part are rounded towards zero.",examples:["fix(3.2)","fix(3.8)","fix(-4.2)","fix(-4.8)"],seealso:["ceil","floor","round"]},floor:{name:"floor",category:"Arithmetic",syntax:["floor(x)"],description:"Round a value towards minus infinity.If x is complex, both real and imaginary part are rounded towards minus infinity.",examples:["floor(3.2)","floor(3.8)","floor(-4.2)"],seealso:["ceil","fix","round"]},gcd:{name:"gcd",category:"Arithmetic",syntax:["gcd(a, b)","gcd(a, b, c, ...)"],description:"Compute the greatest common divisor.",examples:["gcd(8, 12)","gcd(-4, 6)","gcd(25, 15, -10)"],seealso:["lcm","xgcd"]},hypot:{name:"hypot",category:"Arithmetic",syntax:["hypot(a, b, c, ...)","hypot([a, b, c, ...])"],description:"Calculate the hypotenusa of a list with values. ",examples:["hypot(3, 4)","sqrt(3^2 + 4^2)","hypot(-2)","hypot([3, 4, 5])"],seealso:["abs","norm"]},lcm:{name:"lcm",category:"Arithmetic",syntax:["lcm(x, y)"],description:"Compute the least common multiple.",examples:["lcm(4, 6)","lcm(6, 21)","lcm(6, 21, 5)"],seealso:["gcd"]},log:{name:"log",category:"Arithmetic",syntax:["log(x)","log(x, base)"],description:"Compute the logarithm of a value. If no base is provided, the natural logarithm of x is calculated. If base if provided, the logarithm is calculated for the specified base. log(x, base) is defined as log(x) / log(base).",examples:["log(3.5)","a = log(2.4)","exp(a)","10 ^ 4","log(10000, 10)","log(10000) / log(10)","b = log(1024, 2)","2 ^ b"],seealso:["exp","log1p","log2","log10"]},log2:{name:"log2",category:"Arithmetic",syntax:["log2(x)"],description:"Calculate the 2-base of a value. This is the same as calculating `log(x, 2)`.",examples:["log2(0.03125)","log2(16)","log2(16) / log2(2)","pow(2, 4)"],seealso:["exp","log1p","log","log10"]},log1p:{name:"log1p",category:"Arithmetic",syntax:["log1p(x)","log1p(x, base)"],description:"Calculate the logarithm of a `value+1`",examples:["log1p(2.5)","exp(log1p(1.4))","pow(10, 4)","log1p(9999, 10)","log1p(9999) / log(10)"],seealso:["exp","log","log2","log10"]},log10:{name:"log10",category:"Arithmetic",syntax:["log10(x)"],description:"Compute the 10-base logarithm of a value.",examples:["log10(0.00001)","log10(10000)","10 ^ 4","log(10000) / log(10)","log(10000, 10)"],seealso:["exp","log"]},mod:{name:"mod",category:"Operators",syntax:["x % y","x mod y","mod(x, y)"],description:"Calculates the modulus, the remainder of an integer division.",examples:["7 % 3","11 % 2","10 mod 4","isOdd(x) = x % 2","isOdd(2)","isOdd(3)"],seealso:["divide"]},multiply:{name:"multiply",category:"Operators",syntax:["x * y","multiply(x, y)"],description:"multiply two values.",examples:["a = 2.1 * 3.4","a / 3.4","2 * 3 + 4","2 * (3 + 4)","3 * 2.1 km"],seealso:["divide"]},norm:{name:"norm",category:"Arithmetic",syntax:["norm(x)","norm(x, p)"],description:"Calculate the norm of a number, vector or matrix.",examples:["abs(-3.5)","norm(-3.5)","norm(3 - 4i)","norm([1, 2, -3], Infinity)","norm([1, 2, -3], -Infinity)","norm([3, 4], 2)","norm([[1, 2], [3, 4]], 1)",'norm([[1, 2], [3, 4]], "inf")','norm([[1, 2], [3, 4]], "fro")']},nthRoot:{name:"nthRoot",category:"Arithmetic",syntax:["nthRoot(a)","nthRoot(a, root)"],description:'Calculate the nth root of a value. The principal nth root of a positive real number A, is the positive real solution of the equation "x^root = A".',examples:["4 ^ 3","nthRoot(64, 3)","nthRoot(9, 2)","sqrt(9)"],seealso:["nthRoots","pow","sqrt"]},nthRoots:{name:"nthRoots",category:"Arithmetic",syntax:["nthRoots(A)","nthRoots(A, root)"],description:'Calculate the nth roots of a value. An nth root of a positive real number A, is a positive real solution of the equation "x^root = A". This function returns an array of complex values.',examples:["nthRoots(1)","nthRoots(1, 3)"],seealso:["sqrt","pow","nthRoot"]},pow:{name:"pow",category:"Operators",syntax:["x ^ y","pow(x, y)"],description:"Calculates the power of x to y, x^y.",examples:["2^3","2*2*2","1 + e ^ (pi * i)","pow([[1, 2], [4, 3]], 2)","pow([[1, 2], [4, 3]], -1)"],seealso:["multiply","nthRoot","nthRoots","sqrt"]},round:{name:"round",category:"Arithmetic",syntax:["round(x)","round(x, n)","round(unit, valuelessUnit)","round(unit, n, valuelessUnit)"],description:"round a value towards the nearest integer.If x is complex, both real and imaginary part are rounded towards the nearest integer. When n is specified, the value is rounded to n decimals.",examples:["round(3.2)","round(3.8)","round(-4.2)","round(-4.8)","round(pi, 3)","round(123.45678, 2)","round(3.241cm, 2, cm)","round([3.2, 3.8, -4.7])"],seealso:["ceil","floor","fix"]},sign:{name:"sign",category:"Arithmetic",syntax:["sign(x)"],description:"Compute the sign of a value. The sign of a value x is 1 when x>1, -1 when x<0, and 0 when x=0.",examples:["sign(3.5)","sign(-4.2)","sign(0)"],seealso:["abs"]},sqrt:{name:"sqrt",category:"Arithmetic",syntax:["sqrt(x)"],description:"Compute the square root value. If x = y * y, then y is the square root of x.",examples:["sqrt(25)","5 * 5","sqrt(-1)"],seealso:["square","sqrtm","multiply","nthRoot","nthRoots","pow"]},sqrtm:{name:"sqrtm",category:"Arithmetic",syntax:["sqrtm(x)"],description:"Calculate the principal square root of a square matrix. The principal square root matrix `X` of another matrix `A` is such that `X * X = A`.",examples:["sqrtm([[33, 24], [48, 57]])"],seealso:["sqrt","abs","square","multiply"]},square:{name:"square",category:"Arithmetic",syntax:["square(x)"],description:"Compute the square of a value. The square of x is x * x.",examples:["square(3)","sqrt(9)","3^2","3 * 3"],seealso:["multiply","pow","sqrt","cube"]},subtract:{name:"subtract",category:"Operators",syntax:["x - y","subtract(x, y)"],description:"subtract two values.",examples:["a = 5.3 - 2","a + 2","2/3 - 1/6","2 * 3 - 3","2.1 km - 500m"],seealso:["add"]},unaryMinus:{name:"unaryMinus",category:"Operators",syntax:["-x","unaryMinus(x)"],description:"Inverse the sign of a value. Converts booleans and strings to numbers.",examples:["-4.5","-(-5.6)",'-"22"'],seealso:["add","subtract","unaryPlus"]},unaryPlus:{name:"unaryPlus",category:"Operators",syntax:["+x","unaryPlus(x)"],description:"Converts booleans and strings to numbers.",examples:["+true",'+"2"'],seealso:["add","subtract","unaryMinus"]},xgcd:{name:"xgcd",category:"Arithmetic",syntax:["xgcd(a, b)"],description:"Calculate the extended greatest common divisor for two values. The result is an array [d, x, y] with 3 entries, where d is the greatest common divisor, and d = x * a + y * b.",examples:["xgcd(8, 12)","gcd(8, 12)","xgcd(36163, 21199)"],seealso:["gcd","lcm"]},invmod:{name:"invmod",category:"Arithmetic",syntax:["invmod(a, b)"],description:"Calculate the (modular) multiplicative inverse of a modulo b. Solution to the equation ax ≣ 1 (mod b)",examples:["invmod(8, 12)","invmod(7, 13)","invmod(15151, 15122)"],seealso:["gcd","xgcd"]},bitAnd:{name:"bitAnd",category:"Bitwise",syntax:["x & y","bitAnd(x, y)"],description:"Bitwise AND operation. Performs the logical AND operation on each pair of the corresponding bits of the two given values by multiplying them. If both bits in the compared position are 1, the bit in the resulting binary representation is 1, otherwise, the result is 0",examples:["5 & 3","bitAnd(53, 131)","[1, 12, 31] & 42"],seealso:["bitNot","bitOr","bitXor","leftShift","rightArithShift","rightLogShift"]},bitNot:{name:"bitNot",category:"Bitwise",syntax:["~x","bitNot(x)"],description:"Bitwise NOT operation. Performs a logical negation on each bit of the given value. Bits that are 0 become 1, and those that are 1 become 0.",examples:["~1","~2","bitNot([2, -3, 4])"],seealso:["bitAnd","bitOr","bitXor","leftShift","rightArithShift","rightLogShift"]},bitOr:{name:"bitOr",category:"Bitwise",syntax:["x | y","bitOr(x, y)"],description:"Bitwise OR operation. Performs the logical inclusive OR operation on each pair of corresponding bits of the two given values. The result in each position is 1 if the first bit is 1 or the second bit is 1 or both bits are 1, otherwise, the result is 0.",examples:["5 | 3","bitOr([1, 2, 3], 4)"],seealso:["bitAnd","bitNot","bitXor","leftShift","rightArithShift","rightLogShift"]},bitXor:{name:"bitXor",category:"Bitwise",syntax:["bitXor(x, y)"],description:"Bitwise XOR operation, exclusive OR. Performs the logical exclusive OR operation on each pair of corresponding bits of the two given values. The result in each position is 1 if only the first bit is 1 or only the second bit is 1, but will be 0 if both are 0 or both are 1.",examples:["bitOr(1, 2)","bitXor([2, 3, 4], 4)"],seealso:["bitAnd","bitNot","bitOr","leftShift","rightArithShift","rightLogShift"]},leftShift:{name:"leftShift",category:"Bitwise",syntax:["x << y","leftShift(x, y)"],description:"Bitwise left logical shift of a value x by y number of bits.",examples:["4 << 1","8 >> 1"],seealso:["bitAnd","bitNot","bitOr","bitXor","rightArithShift","rightLogShift"]},rightArithShift:{name:"rightArithShift",category:"Bitwise",syntax:["x >> y","rightArithShift(x, y)"],description:"Bitwise right arithmetic shift of a value x by y number of bits.",examples:["8 >> 1","4 << 1","-12 >> 2"],seealso:["bitAnd","bitNot","bitOr","bitXor","leftShift","rightLogShift"]},rightLogShift:{name:"rightLogShift",category:"Bitwise",syntax:["x >>> y","rightLogShift(x, y)"],description:"Bitwise right logical shift of a value x by y number of bits.",examples:["8 >>> 1","4 << 1","-12 >>> 2"],seealso:["bitAnd","bitNot","bitOr","bitXor","leftShift","rightArithShift"]},bellNumbers:{name:"bellNumbers",category:"Combinatorics",syntax:["bellNumbers(n)"],description:"The Bell Numbers count the number of partitions of a set. A partition is a pairwise disjoint subset of S whose union is S. `bellNumbers` only takes integer arguments. The following condition must be enforced: n >= 0.",examples:["bellNumbers(3)","bellNumbers(8)"],seealso:["stirlingS2"]},catalan:{name:"catalan",category:"Combinatorics",syntax:["catalan(n)"],description:"The Catalan Numbers enumerate combinatorial structures of many different types. catalan only takes integer arguments. The following condition must be enforced: n >= 0.",examples:["catalan(3)","catalan(8)"],seealso:["bellNumbers"]},composition:{name:"composition",category:"Combinatorics",syntax:["composition(n, k)"],description:"The composition counts of n into k parts. composition only takes integer arguments. The following condition must be enforced: k <= n.",examples:["composition(5, 3)"],seealso:["combinations"]},stirlingS2:{name:"stirlingS2",category:"Combinatorics",syntax:["stirlingS2(n, k)"],description:"he Stirling numbers of the second kind, counts the number of ways to partition a set of n labelled objects into k nonempty unlabelled subsets. `stirlingS2` only takes integer arguments. The following condition must be enforced: k <= n. If n = k or k = 1, then s(n,k) = 1.",examples:["stirlingS2(5, 3)"],seealso:["bellNumbers"]},config:{name:"config",category:"Core",syntax:["config()","config(options)"],description:"Get configuration or change configuration.",examples:["config()","1/3 + 1/4",'config({number: "Fraction"})',"1/3 + 1/4"],seealso:[]},import:{name:"import",category:"Core",syntax:["import(functions)","import(functions, options)"],description:"Import functions or constants from an object.",examples:["import({myFn: f(x)=x^2, myConstant: 32 })","myFn(2)","myConstant"],seealso:[]},typed:{name:"typed",category:"Core",syntax:["typed(signatures)","typed(name, signatures)"],description:"Create a typed function.",examples:['double = typed({ "number": f(x)=x+x, "string": f(x)=concat(x,x) })',"double(2)",'double("hello")'],seealso:[]},arg:{name:"arg",category:"Complex",syntax:["arg(x)"],description:"Compute the argument of a complex value. If x = a+bi, the argument is computed as atan2(b, a).",examples:["arg(2 + 2i)","atan2(3, 2)","arg(2 + 3i)"],seealso:["re","im","conj","abs"]},conj:{name:"conj",category:"Complex",syntax:["conj(x)"],description:"Compute the complex conjugate of a complex value. If x = a+bi, the complex conjugate is a-bi.",examples:["conj(2 + 3i)","conj(2 - 3i)","conj(-5.2i)"],seealso:["re","im","abs","arg"]},re:{name:"re",category:"Complex",syntax:["re(x)"],description:"Get the real part of a complex number.",examples:["re(2 + 3i)","im(2 + 3i)","re(-5.2i)","re(2.4)"],seealso:["im","conj","abs","arg"]},im:{name:"im",category:"Complex",syntax:["im(x)"],description:"Get the imaginary part of a complex number.",examples:["im(2 + 3i)","re(2 + 3i)","im(-5.2i)","im(2.4)"],seealso:["re","conj","abs","arg"]},evaluate:{name:"evaluate",category:"Expression",syntax:["evaluate(expression)","evaluate(expression, scope)","evaluate([expr1, expr2, expr3, ...])","evaluate([expr1, expr2, expr3, ...], scope)"],description:"Evaluate an expression or an array with expressions.",examples:['evaluate("2 + 3")','evaluate("sqrt(16)")','evaluate("2 inch to cm")','evaluate("sin(x * pi)", { "x": 1/2 })','evaluate(["width=2", "height=4","width*height"])'],seealso:[]},help:{name:"help",category:"Expression",syntax:["help(object)","help(string)"],description:"Display documentation on a function or data type.",examples:["help(sqrt)",'help("complex")'],seealso:[]},distance:{name:"distance",category:"Geometry",syntax:["distance([x1, y1], [x2, y2])","distance([[x1, y1], [x2, y2]])"],description:"Calculates the Euclidean distance between two points.",examples:["distance([0,0], [4,4])","distance([[0,0], [4,4]])"],seealso:[]},intersect:{name:"intersect",category:"Geometry",syntax:["intersect(expr1, expr2, expr3, expr4)","intersect(expr1, expr2, expr3)"],description:"Computes the intersection point of lines and/or planes.",examples:["intersect([0, 0], [10, 10], [10, 0], [0, 10])","intersect([1, 0, 1], [4, -2, 2], [1, 1, 1, 6])"],seealso:[]},and:{name:"and",category:"Logical",syntax:["x and y","and(x, y)"],description:"Logical and. Test whether two values are both defined with a nonzero/nonempty value.",examples:["true and false","true and true","2 and 4"],seealso:["not","or","xor"]},not:{name:"not",category:"Logical",syntax:["not x","not(x)"],description:"Logical not. Flips the boolean value of given argument.",examples:["not true","not false","not 2","not 0"],seealso:["and","or","xor"]},or:{name:"or",category:"Logical",syntax:["x or y","or(x, y)"],description:"Logical or. Test if at least one value is defined with a nonzero/nonempty value.",examples:["true or false","false or false","0 or 4"],seealso:["not","and","xor"]},xor:{name:"xor",category:"Logical",syntax:["x xor y","xor(x, y)"],description:"Logical exclusive or, xor. Test whether one and only one value is defined with a nonzero/nonempty value.",examples:["true xor false","false xor false","true xor true","0 xor 4"],seealso:["not","and","or"]},concat:{name:"concat",category:"Matrix",syntax:["concat(A, B, C, ...)","concat(A, B, C, ..., dim)"],description:"Concatenate matrices. By default, the matrices are concatenated by the last dimension. The dimension on which to concatenate can be provided as last argument.",examples:["A = [1, 2; 5, 6]","B = [3, 4; 7, 8]","concat(A, B)","concat(A, B, 1)","concat(A, B, 2)"],seealso:["det","diag","identity","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]},count:{name:"count",category:"Matrix",syntax:["count(x)"],description:"Count the number of elements of a matrix, array or string.",examples:["a = [1, 2; 3, 4; 5, 6]","count(a)","size(a)",'count("hello world")'],seealso:["size"]},cross:{name:"cross",category:"Matrix",syntax:["cross(A, B)"],description:"Calculate the cross product for two vectors in three dimensional space.",examples:["cross([1, 1, 0], [0, 1, 1])","cross([3, -3, 1], [4, 9, 2])","cross([2, 3, 4], [5, 6, 7])"],seealso:["multiply","dot"]},column:{name:"column",category:"Matrix",syntax:["column(x, index)"],description:"Return a column from a matrix or array.",examples:["A = [[1, 2], [3, 4]]","column(A, 1)","column(A, 2)"],seealso:["row","matrixFromColumns"]},ctranspose:{name:"ctranspose",category:"Matrix",syntax:["x'","ctranspose(x)"],description:"Complex Conjugate and Transpose a matrix",examples:["a = [1, 2, 3; 4, 5, 6]","a'","ctranspose(a)"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","trace","zeros"]},det:{name:"det",category:"Matrix",syntax:["det(x)"],description:"Calculate the determinant of a matrix",examples:["det([1, 2; 3, 4])","det([-2, 2, 3; -1, 1, 3; 2, 0, -1])"],seealso:["concat","diag","identity","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]},diag:{name:"diag",category:"Matrix",syntax:["diag(x)","diag(x, k)"],description:"Create a diagonal matrix or retrieve the diagonal of a matrix. When x is a vector, a matrix with the vector values on the diagonal will be returned. When x is a matrix, a vector with the diagonal values of the matrix is returned. When k is provided, the k-th diagonal will be filled in or retrieved, if k is positive, the values are placed on the super diagonal. When k is negative, the values are placed on the sub diagonal.",examples:["diag(1:3)","diag(1:3, 1)","a = [1, 2, 3; 4, 5, 6; 7, 8, 9]","diag(a)"],seealso:["concat","det","identity","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]},diff:{name:"diff",category:"Matrix",syntax:["diff(arr)","diff(arr, dim)"],description:["Create a new matrix or array with the difference of the passed matrix or array.","Dim parameter is optional and used to indicant the dimension of the array/matrix to apply the difference","If no dimension parameter is passed it is assumed as dimension 0","Dimension is zero-based in javascript and one-based in the parser","Arrays must be 'rectangular' meaning arrays like [1, 2]","If something is passed as a matrix it will be returned as a matrix but other than that all matrices are converted to arrays"],examples:["A = [1, 2, 4, 7, 0]","diff(A)","diff(A, 1)","B = [[1, 2], [3, 4]]","diff(B)","diff(B, 1)","diff(B, 2)","diff(B, bignumber(2))","diff([[1, 2], matrix([3, 4])], 2)"],seealso:["subtract","partitionSelect"]},dot:{name:"dot",category:"Matrix",syntax:["dot(A, B)","A * B"],description:"Calculate the dot product of two vectors. The dot product of A = [a1, a2, a3, ..., an] and B = [b1, b2, b3, ..., bn] is defined as dot(A, B) = a1 * b1 + a2 * b2 + a3 * b3 + ... + an * bn",examples:["dot([2, 4, 1], [2, 2, 3])","[2, 4, 1] * [2, 2, 3]"],seealso:["multiply","cross"]},getMatrixDataType:{name:"getMatrixDataType",category:"Matrix",syntax:["getMatrixDataType(x)"],description:'Find the data type of all elements in a matrix or array, for example "number" if all items are a number and "Complex" if all values are complex numbers. If a matrix contains more than one data type, it will return "mixed".',examples:["getMatrixDataType([1, 2, 3])","getMatrixDataType([[5 cm], [2 inch]])",'getMatrixDataType([1, "text"])',"getMatrixDataType([1, bignumber(4)])"],seealso:["matrix","sparse","typeOf"]},identity:{name:"identity",category:"Matrix",syntax:["identity(n)","identity(m, n)","identity([m, n])"],description:"Returns the identity matrix with size m-by-n. The matrix has ones on the diagonal and zeros elsewhere.",examples:["identity(3)","identity(3, 5)","a = [1, 2, 3; 4, 5, 6]","identity(size(a))"],seealso:["concat","det","diag","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]},filter:{name:"filter",category:"Matrix",syntax:["filter(x, test)"],description:"Filter items in a matrix.",examples:["isPositive(x) = x > 0","filter([6, -2, -1, 4, 3], isPositive)","filter([6, -2, 0, 1, 0], x != 0)"],seealso:["sort","map","forEach"]},flatten:{name:"flatten",category:"Matrix",syntax:["flatten(x)"],description:"Flatten a multi dimensional matrix into a single dimensional matrix.",examples:["a = [1, 2, 3; 4, 5, 6]","size(a)","b = flatten(a)","size(b)"],seealso:["concat","resize","size","squeeze"]},forEach:{name:"forEach",category:"Matrix",syntax:["forEach(x, callback)"],description:"Iterates over all elements of a matrix/array, and executes the given callback function.",examples:["numberOfPets = {}","addPet(n) = numberOfPets[n] = (numberOfPets[n] ? numberOfPets[n]:0 ) + 1;",'forEach(["Dog","Cat","Cat"], addPet)',"numberOfPets"],seealso:["map","sort","filter"]},inv:{name:"inv",category:"Matrix",syntax:["inv(x)"],description:"Calculate the inverse of a matrix",examples:["inv([1, 2; 3, 4])","inv(4)","1 / 4"],seealso:["concat","det","diag","identity","ones","range","size","squeeze","subset","trace","transpose","zeros"]},pinv:{name:"pinv",category:"Matrix",syntax:["pinv(x)"],description:"Calculate the Moore–Penrose inverse of a matrix",examples:["pinv([1, 2; 3, 4])","pinv([[1, 0], [0, 1], [0, 1]])","pinv(4)"],seealso:["inv"]},eigs:{name:"eigs",category:"Matrix",syntax:["eigs(x)"],description:"Calculate the eigenvalues and optionally eigenvectors of a square matrix",examples:["eigs([[5, 2.3], [2.3, 1]])","eigs([[1, 2, 3], [4, 5, 6], [7, 8, 9]], { precision: 1e-6, eigenvectors: false })"],seealso:["inv"]},kron:{name:"kron",category:"Matrix",syntax:["kron(x, y)"],description:"Calculates the kronecker product of 2 matrices or vectors.",examples:["kron([[1, 0], [0, 1]], [[1, 2], [3, 4]])","kron([1,1], [2,3,4])"],seealso:["multiply","dot","cross"]},matrixFromFunction:{name:"matrixFromFunction",category:"Matrix",syntax:["matrixFromFunction(size, fn)","matrixFromFunction(size, fn, format)","matrixFromFunction(size, fn, format, datatype)","matrixFromFunction(size, format, fn)","matrixFromFunction(size, format, datatype, fn)"],description:"Create a matrix by evaluating a generating function at each index.",examples:["f(I) = I[1] - I[2]","matrixFromFunction([3,3], f)","g(I) = I[1] - I[2] == 1 ? 4 : 0",'matrixFromFunction([100, 100], "sparse", g)',"matrixFromFunction([5], random)"],seealso:["matrix","matrixFromRows","matrixFromColumns","zeros"]},matrixFromRows:{name:"matrixFromRows",category:"Matrix",syntax:["matrixFromRows(...arr)","matrixFromRows(row1, row2)","matrixFromRows(row1, row2, row3)"],description:"Create a dense matrix from vectors as individual rows.",examples:["matrixFromRows([1, 2, 3], [[4],[5],[6]])"],seealso:["matrix","matrixFromColumns","matrixFromFunction","zeros"]},matrixFromColumns:{name:"matrixFromColumns",category:"Matrix",syntax:["matrixFromColumns(...arr)","matrixFromColumns(row1, row2)","matrixFromColumns(row1, row2, row3)"],description:"Create a dense matrix from vectors as individual columns.",examples:["matrixFromColumns([1, 2, 3], [[4],[5],[6]])"],seealso:["matrix","matrixFromRows","matrixFromFunction","zeros"]},map:{name:"map",category:"Matrix",syntax:["map(x, callback)"],description:"Create a new matrix or array with the results of the callback function executed on each entry of the matrix/array.",examples:["map([1, 2, 3], square)"],seealso:["filter","forEach"]},ones:{name:"ones",category:"Matrix",syntax:["ones(m)","ones(m, n)","ones(m, n, p, ...)","ones([m])","ones([m, n])","ones([m, n, p, ...])"],description:"Create a matrix containing ones.",examples:["ones(3)","ones(3, 5)","ones([2,3]) * 4.5","a = [1, 2, 3; 4, 5, 6]","ones(size(a))"],seealso:["concat","det","diag","identity","inv","range","size","squeeze","subset","trace","transpose","zeros"]},partitionSelect:{name:"partitionSelect",category:"Matrix",syntax:["partitionSelect(x, k)","partitionSelect(x, k, compare)"],description:"Partition-based selection of an array or 1D matrix. Will find the kth smallest value, and mutates the input array. Uses Quickselect.",examples:["partitionSelect([5, 10, 1], 2)",'partitionSelect(["C", "B", "A", "D"], 1, compareText)',"arr = [5, 2, 1]","partitionSelect(arr, 0) # returns 1, arr is now: [1, 2, 5]","arr","partitionSelect(arr, 1, 'desc') # returns 2, arr is now: [5, 2, 1]","arr"],seealso:["sort"]},range:{name:"range",category:"Type",syntax:["start:end","start:step:end","range(start, end)","range(start, end, step)","range(string)"],description:"Create a range. Lower bound of the range is included, upper bound is excluded.",examples:["1:5","3:-1:-3","range(3, 7)","range(0, 12, 2)",'range("4:10")',"range(1m, 1m, 3m)","a = [1, 2, 3, 4; 5, 6, 7, 8]","a[1:2, 1:2]"],seealso:["concat","det","diag","identity","inv","ones","size","squeeze","subset","trace","transpose","zeros"]},resize:{name:"resize",category:"Matrix",syntax:["resize(x, size)","resize(x, size, defaultValue)"],description:"Resize a matrix.",examples:["resize([1,2,3,4,5], [3])","resize([1,2,3], [5])","resize([1,2,3], [5], -1)","resize(2, [2, 3])",'resize("hello", [8], "!")'],seealso:["size","subset","squeeze","reshape"]},reshape:{name:"reshape",category:"Matrix",syntax:["reshape(x, sizes)"],description:"Reshape a multi dimensional array to fit the specified dimensions.",examples:["reshape([1, 2, 3, 4, 5, 6], [2, 3])","reshape([[1, 2], [3, 4]], [1, 4])","reshape([[1, 2], [3, 4]], [4])","reshape([1, 2, 3, 4], [-1, 2])"],seealso:["size","squeeze","resize"]},rotate:{name:"rotate",category:"Matrix",syntax:["rotate(w, theta)","rotate(w, theta, v)"],description:"Returns a 2-D rotation matrix (2x2) for a given angle (in radians). Returns a 2-D rotation matrix (3x3) of a given angle (in radians) around given axis.",examples:["rotate([1, 0], pi / 2)",'rotate(matrix([1, 0]), unit("35deg"))','rotate([1, 0, 0], unit("90deg"), [0, 0, 1])','rotate(matrix([1, 0, 0]), unit("90deg"), matrix([0, 0, 1]))'],seealso:["matrix","rotationMatrix"]},rotationMatrix:{name:"rotationMatrix",category:"Matrix",syntax:["rotationMatrix(theta)","rotationMatrix(theta, v)","rotationMatrix(theta, v, format)"],description:"Returns a 2-D rotation matrix (2x2) for a given angle (in radians). Returns a 2-D rotation matrix (3x3) of a given angle (in radians) around given axis.",examples:["rotationMatrix(pi / 2)",'rotationMatrix(unit("45deg"), [0, 0, 1])','rotationMatrix(1, matrix([0, 0, 1]), "sparse")'],seealso:["cos","sin"]},row:{name:"row",category:"Matrix",syntax:["row(x, index)"],description:"Return a row from a matrix or array.",examples:["A = [[1, 2], [3, 4]]","row(A, 1)","row(A, 2)"],seealso:["column","matrixFromRows"]},size:{name:"size",category:"Matrix",syntax:["size(x)"],description:"Calculate the size of a matrix.",examples:["size(2.3)",'size("hello world")',"a = [1, 2; 3, 4; 5, 6]","size(a)","size(1:6)"],seealso:["concat","count","det","diag","identity","inv","ones","range","squeeze","subset","trace","transpose","zeros"]},sort:{name:"sort",category:"Matrix",syntax:["sort(x)","sort(x, compare)"],description:'Sort the items in a matrix. Compare can be a string "asc", "desc", "natural", or a custom sort function.',examples:["sort([5, 10, 1])",'sort(["C", "B", "A", "D"], "natural")',"sortByLength(a, b) = size(a)[1] - size(b)[1]",'sort(["Langdon", "Tom", "Sara"], sortByLength)','sort(["10", "1", "2"], "natural")'],seealso:["map","filter","forEach"]},squeeze:{name:"squeeze",category:"Matrix",syntax:["squeeze(x)"],description:"Remove inner and outer singleton dimensions from a matrix.",examples:["a = zeros(3,2,1)","size(squeeze(a))","b = zeros(1,1,3)","size(squeeze(b))"],seealso:["concat","det","diag","identity","inv","ones","range","size","subset","trace","transpose","zeros"]},subset:{name:"subset",category:"Matrix",syntax:["value(index)","value(index) = replacement","subset(value, [index])","subset(value, [index], replacement)"],description:"Get or set a subset of the entries of a matrix or characters of a string. Indexes are one-based. There should be one index specification for each dimension of the target. Each specification can be a single index, a list of indices, or a range in colon notation `l:u`. In a range, both the lower bound l and upper bound u are included; and if a bound is omitted it defaults to the most extreme valid value. The cartesian product of the indices specified in each dimension determines the target of the operation.",examples:["d = [1, 2; 3, 4]","e = []","e[1, 1:2] = [5, 6]","e[2, :] = [7, 8]","f = d * e","f[2, 1]","f[:, 1]","f[[1,2], [1,3]] = [9, 10; 11, 12]","f"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","trace","transpose","zeros"]},trace:{name:"trace",category:"Matrix",syntax:["trace(A)"],description:"Calculate the trace of a matrix: the sum of the elements on the main diagonal of a square matrix.",examples:["A = [1, 2, 3; -1, 2, 3; 2, 0, 3]","trace(A)"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","transpose","zeros"]},transpose:{name:"transpose",category:"Matrix",syntax:["x'","transpose(x)"],description:"Transpose a matrix",examples:["a = [1, 2, 3; 4, 5, 6]","a'","transpose(a)"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","trace","zeros"]},zeros:{name:"zeros",category:"Matrix",syntax:["zeros(m)","zeros(m, n)","zeros(m, n, p, ...)","zeros([m])","zeros([m, n])","zeros([m, n, p, ...])"],description:"Create a matrix containing zeros.",examples:["zeros(3)","zeros(3, 5)","a = [1, 2, 3; 4, 5, 6]","zeros(size(a))"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","trace","transpose"]},fft:{name:"fft",category:"Matrix",syntax:["fft(x)"],description:"Calculate N-dimensional fourier transform",examples:["fft([[1, 0], [1, 0]])"],seealso:["ifft"]},ifft:{name:"ifft",category:"Matrix",syntax:["ifft(x)"],description:"Calculate N-dimensional inverse fourier transform",examples:["ifft([[2, 2], [0, 0]])"],seealso:["fft"]},sylvester:{name:"sylvester",category:"Algebra",syntax:["sylvester(A,B,C)"],description:"Solves the real-valued Sylvester equation AX+XB=C for X",examples:["sylvester([[-1, -2], [1, 1]], [[-2, 1], [-1, 2]], [[-3, 2], [3, 0]])","A = [[-1, -2], [1, 1]]; B = [[2, -1], [1, -2]]; C = [[-3, 2], [3, 0]]","sylvester(A, B, C)"],seealso:["schur","lyap"]},schur:{name:"schur",category:"Algebra",syntax:["schur(A)"],description:"Performs a real Schur decomposition of the real matrix A = UTU'",examples:["schur([[1, 0], [-4, 3]])","A = [[1, 0], [-4, 3]]","schur(A)"],seealso:["lyap","sylvester"]},lyap:{name:"lyap",category:"Algebra",syntax:["lyap(A,Q)"],description:"Solves the Continuous-time Lyapunov equation AP+PA'+Q=0 for P",examples:["lyap([[-2, 0], [1, -4]], [[3, 1], [1, 3]])","A = [[-2, 0], [1, -4]]","Q = [[3, 1], [1, 3]]","lyap(A,Q)"],seealso:["schur","sylvester"]},solveODE:{name:"solveODE",category:"Numeric",syntax:["solveODE(func, tspan, y0)","solveODE(func, tspan, y0, options)"],description:"Numerical Integration of Ordinary Differential Equations.",examples:["f(t,y) = y","tspan = [0, 4]","solveODE(f, tspan, 1)","solveODE(f, tspan, [1, 2])",'solveODE(f, tspan, 1, { method:"RK23", maxStep:0.1 })'],seealso:["derivative","simplifyCore"]},combinations:{name:"combinations",category:"Probability",syntax:["combinations(n, k)"],description:"Compute the number of combinations of n items taken k at a time",examples:["combinations(7, 5)"],seealso:["combinationsWithRep","permutations","factorial"]},combinationsWithRep:{name:"combinationsWithRep",category:"Probability",syntax:["combinationsWithRep(n, k)"],description:"Compute the number of combinations of n items taken k at a time with replacements.",examples:["combinationsWithRep(7, 5)"],seealso:["combinations","permutations","factorial"]},factorial:{name:"factorial",category:"Probability",syntax:["n!","factorial(n)"],description:"Compute the factorial of a value",examples:["5!","5 * 4 * 3 * 2 * 1","3!"],seealso:["combinations","combinationsWithRep","permutations","gamma"]},gamma:{name:"gamma",category:"Probability",syntax:["gamma(n)"],description:"Compute the gamma function. For small values, the Lanczos approximation is used, and for large values the extended Stirling approximation.",examples:["gamma(4)","3!","gamma(1/2)","sqrt(pi)"],seealso:["factorial"]},kldivergence:{name:"kldivergence",category:"Probability",syntax:["kldivergence(x, y)"],description:"Calculate the Kullback-Leibler (KL) divergence between two distributions.",examples:["kldivergence([0.7,0.5,0.4], [0.2,0.9,0.5])"],seealso:[]},lgamma:{name:"lgamma",category:"Probability",syntax:["lgamma(n)"],description:"Logarithm of the gamma function for real, positive numbers and complex numbers, using Lanczos approximation for numbers and Stirling series for complex numbers.",examples:["lgamma(4)","lgamma(1/2)","lgamma(i)","lgamma(complex(1.1, 2))"],seealso:["gamma"]},multinomial:{name:"multinomial",category:"Probability",syntax:["multinomial(A)"],description:"Multinomial Coefficients compute the number of ways of picking a1, a2, ..., ai unordered outcomes from `n` possibilities. multinomial takes one array of integers as an argument. The following condition must be enforced: every ai > 0.",examples:["multinomial([1, 2, 1])"],seealso:["combinations","factorial"]},permutations:{name:"permutations",category:"Probability",syntax:["permutations(n)","permutations(n, k)"],description:"Compute the number of permutations of n items taken k at a time",examples:["permutations(5)","permutations(5, 3)"],seealso:["combinations","combinationsWithRep","factorial"]},pickRandom:{name:"pickRandom",category:"Probability",syntax:["pickRandom(array)","pickRandom(array, number)","pickRandom(array, weights)","pickRandom(array, number, weights)","pickRandom(array, weights, number)"],description:"Pick a random entry from a given array.",examples:["pickRandom(0:10)","pickRandom([1, 3, 1, 6])","pickRandom([1, 3, 1, 6], 2)","pickRandom([1, 3, 1, 6], [2, 3, 2, 1])","pickRandom([1, 3, 1, 6], 2, [2, 3, 2, 1])","pickRandom([1, 3, 1, 6], [2, 3, 2, 1], 2)"],seealso:["random","randomInt"]},random:{name:"random",category:"Probability",syntax:["random()","random(max)","random(min, max)","random(size)","random(size, max)","random(size, min, max)"],description:"Return a random number.",examples:["random()","random(10, 20)","random([2, 3])"],seealso:["pickRandom","randomInt"]},randomInt:{name:"randomInt",category:"Probability",syntax:["randomInt(max)","randomInt(min, max)","randomInt(size)","randomInt(size, max)","randomInt(size, min, max)"],description:"Return a random integer number",examples:["randomInt(10, 20)","randomInt([2, 3], 10)"],seealso:["pickRandom","random"]},compare:{name:"compare",category:"Relational",syntax:["compare(x, y)"],description:"Compare two values. Returns 1 when x > y, -1 when x < y, and 0 when x == y.",examples:["compare(2, 3)","compare(3, 2)","compare(2, 2)","compare(5cm, 40mm)","compare(2, [1, 2, 3])"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compareNatural","compareText"]},compareNatural:{name:"compareNatural",category:"Relational",syntax:["compareNatural(x, y)"],description:"Compare two values of any type in a deterministic, natural way. Returns 1 when x > y, -1 when x < y, and 0 when x == y.",examples:["compareNatural(2, 3)","compareNatural(3, 2)","compareNatural(2, 2)","compareNatural(5cm, 40mm)",'compareNatural("2", "10")',"compareNatural(2 + 3i, 2 + 4i)","compareNatural([1, 2, 4], [1, 2, 3])","compareNatural([1, 5], [1, 2, 3])","compareNatural([1, 2], [1, 2])","compareNatural({a: 2}, {a: 4})"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compare","compareText"]},compareText:{name:"compareText",category:"Relational",syntax:["compareText(x, y)"],description:"Compare two strings lexically. Comparison is case sensitive. Returns 1 when x > y, -1 when x < y, and 0 when x == y.",examples:['compareText("B", "A")','compareText("A", "B")','compareText("A", "A")','compareText("2", "10")','compare("2", "10")',"compare(2, 10)",'compareNatural("2", "10")','compareText("B", ["A", "B", "C"])'],seealso:["compare","compareNatural"]},deepEqual:{name:"deepEqual",category:"Relational",syntax:["deepEqual(x, y)"],description:"Check equality of two matrices element wise. Returns true if the size of both matrices is equal and when and each of the elements are equal.",examples:["deepEqual([1,3,4], [1,3,4])","deepEqual([1,3,4], [1,3])"],seealso:["equal","unequal","smaller","larger","smallerEq","largerEq","compare"]},equal:{name:"equal",category:"Relational",syntax:["x == y","equal(x, y)"],description:"Check equality of two values. Returns true if the values are equal, and false if not.",examples:["2+2 == 3","2+2 == 4","a = 3.2","b = 6-2.8","a == b","50cm == 0.5m"],seealso:["unequal","smaller","larger","smallerEq","largerEq","compare","deepEqual","equalText"]},equalText:{name:"equalText",category:"Relational",syntax:["equalText(x, y)"],description:"Check equality of two strings. Comparison is case sensitive. Returns true if the values are equal, and false if not.",examples:['equalText("Hello", "Hello")','equalText("a", "A")','equal("2e3", "2000")','equalText("2e3", "2000")','equalText("B", ["A", "B", "C"])'],seealso:["compare","compareNatural","compareText","equal"]},larger:{name:"larger",category:"Relational",syntax:["x > y","larger(x, y)"],description:"Check if value x is larger than y. Returns true if x is larger than y, and false if not.",examples:["2 > 3","5 > 2*2","a = 3.3","b = 6-2.8","(a > b)","(b < a)","5 cm > 2 inch"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compare"]},largerEq:{name:"largerEq",category:"Relational",syntax:["x >= y","largerEq(x, y)"],description:"Check if value x is larger or equal to y. Returns true if x is larger or equal to y, and false if not.",examples:["2 >= 1+1","2 > 1+1","a = 3.2","b = 6-2.8","(a >= b)"],seealso:["equal","unequal","smallerEq","smaller","compare"]},smaller:{name:"smaller",category:"Relational",syntax:["x < y","smaller(x, y)"],description:"Check if value x is smaller than value y. Returns true if x is smaller than y, and false if not.",examples:["2 < 3","5 < 2*2","a = 3.3","b = 6-2.8","(a < b)","5 cm < 2 inch"],seealso:["equal","unequal","larger","smallerEq","largerEq","compare"]},smallerEq:{name:"smallerEq",category:"Relational",syntax:["x <= y","smallerEq(x, y)"],description:"Check if value x is smaller or equal to value y. Returns true if x is smaller than y, and false if not.",examples:["2 <= 1+1","2 < 1+1","a = 3.2","b = 6-2.8","(a <= b)"],seealso:["equal","unequal","larger","smaller","largerEq","compare"]},unequal:{name:"unequal",category:"Relational",syntax:["x != y","unequal(x, y)"],description:"Check unequality of two values. Returns true if the values are unequal, and false if they are equal.",examples:["2+2 != 3","2+2 != 4","a = 3.2","b = 6-2.8","a != b","50cm != 0.5m","5 cm != 2 inch"],seealso:["equal","smaller","larger","smallerEq","largerEq","compare","deepEqual"]},setCartesian:{name:"setCartesian",category:"Set",syntax:["setCartesian(set1, set2)"],description:"Create the cartesian product of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays and the values will be sorted in ascending order before the operation.",examples:["setCartesian([1, 2], [3, 4])"],seealso:["setUnion","setIntersect","setDifference","setPowerset"]},setDifference:{name:"setDifference",category:"Set",syntax:["setDifference(set1, set2)"],description:"Create the difference of two (multi)sets: every element of set1, that is not the element of set2. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setDifference([1, 2, 3, 4], [3, 4, 5, 6])","setDifference([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setUnion","setIntersect","setSymDifference"]},setDistinct:{name:"setDistinct",category:"Set",syntax:["setDistinct(set)"],description:"Collect the distinct elements of a multiset. A multi-dimension array will be converted to a single-dimension array before the operation.",examples:["setDistinct([1, 1, 1, 2, 2, 3])"],seealso:["setMultiplicity"]},setIntersect:{name:"setIntersect",category:"Set",syntax:["setIntersect(set1, set2)"],description:"Create the intersection of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setIntersect([1, 2, 3, 4], [3, 4, 5, 6])","setIntersect([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setUnion","setDifference"]},setIsSubset:{name:"setIsSubset",category:"Set",syntax:["setIsSubset(set1, set2)"],description:"Check whether a (multi)set is a subset of another (multi)set: every element of set1 is the element of set2. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setIsSubset([1, 2], [3, 4, 5, 6])","setIsSubset([3, 4], [3, 4, 5, 6])"],seealso:["setUnion","setIntersect","setDifference"]},setMultiplicity:{name:"setMultiplicity",category:"Set",syntax:["setMultiplicity(element, set)"],description:"Count the multiplicity of an element in a multiset. A multi-dimension array will be converted to a single-dimension array before the operation.",examples:["setMultiplicity(1, [1, 2, 2, 4])","setMultiplicity(2, [1, 2, 2, 4])"],seealso:["setDistinct","setSize"]},setPowerset:{name:"setPowerset",category:"Set",syntax:["setPowerset(set)"],description:"Create the powerset of a (multi)set: the powerset contains very possible subsets of a (multi)set. A multi-dimension array will be converted to a single-dimension array before the operation.",examples:["setPowerset([1, 2, 3])"],seealso:["setCartesian"]},setSize:{name:"setSize",category:"Set",syntax:["setSize(set)","setSize(set, unique)"],description:'Count the number of elements of a (multi)set. When the second parameter "unique" is true, count only the unique values. A multi-dimension array will be converted to a single-dimension array before the operation.',examples:["setSize([1, 2, 2, 4])","setSize([1, 2, 2, 4], true)"],seealso:["setUnion","setIntersect","setDifference"]},setSymDifference:{name:"setSymDifference",category:"Set",syntax:["setSymDifference(set1, set2)"],description:"Create the symmetric difference of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setSymDifference([1, 2, 3, 4], [3, 4, 5, 6])","setSymDifference([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setUnion","setIntersect","setDifference"]},setUnion:{name:"setUnion",category:"Set",syntax:["setUnion(set1, set2)"],description:"Create the union of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setUnion([1, 2, 3, 4], [3, 4, 5, 6])","setUnion([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setIntersect","setDifference"]},zpk2tf:{name:"zpk2tf",category:"Signal",syntax:["zpk2tf(z, p, k)"],description:"Compute the transfer function of a zero-pole-gain model.",examples:["zpk2tf([1, 2], [-1, -2], 1)","zpk2tf([1, 2], [-1, -2])","zpk2tf([1 - 3i, 2 + 2i], [-1, -2])"],seealso:[]},freqz:{name:"freqz",category:"Signal",syntax:["freqz(b, a)","freqz(b, a, w)"],description:"Calculates the frequency response of a filter given its numerator and denominator coefficients.",examples:["freqz([1, 2], [1, 2, 3])","freqz([1, 2], [1, 2, 3], [0, 1])","freqz([1, 2], [1, 2, 3], 512)"],seealso:[]},erf:{name:"erf",category:"Special",syntax:["erf(x)"],description:"Compute the erf function of a value using a rational Chebyshev approximations for different intervals of x",examples:["erf(0.2)","erf(-0.5)","erf(4)"],seealso:[]},zeta:{name:"zeta",category:"Special",syntax:["zeta(s)"],description:"Compute the Riemann Zeta Function using an infinite series and Riemanns Functional Equation for the entire complex plane",examples:["zeta(0.2)","zeta(-0.5)","zeta(4)"],seealso:[]},cumsum:{name:"cumsum",category:"Statistics",syntax:["cumsum(a, b, c, ...)","cumsum(A)"],description:"Compute the cumulative sum of all values.",examples:["cumsum(2, 3, 4, 1)","cumsum([2, 3, 4, 1])","cumsum([1, 2; 3, 4])","cumsum([1, 2; 3, 4], 1)","cumsum([1, 2; 3, 4], 2)"],seealso:["max","mean","median","min","prod","std","sum","variance"]},mad:{name:"mad",category:"Statistics",syntax:["mad(a, b, c, ...)","mad(A)"],description:"Compute the median absolute deviation of a matrix or a list with values. The median absolute deviation is defined as the median of the absolute deviations from the median.",examples:["mad(10, 20, 30)","mad([1, 2, 3])"],seealso:["mean","median","std","abs"]},max:{name:"max",category:"Statistics",syntax:["max(a, b, c, ...)","max(A)","max(A, dimension)"],description:"Compute the maximum value of a list of values.",examples:["max(2, 3, 4, 1)","max([2, 3, 4, 1])","max([2, 5; 4, 3])","max([2, 5; 4, 3], 1)","max([2, 5; 4, 3], 2)","max(2.7, 7.1, -4.5, 2.0, 4.1)","min(2.7, 7.1, -4.5, 2.0, 4.1)"],seealso:["mean","median","min","prod","std","sum","variance"]},mean:{name:"mean",category:"Statistics",syntax:["mean(a, b, c, ...)","mean(A)","mean(A, dimension)"],description:"Compute the arithmetic mean of a list of values.",examples:["mean(2, 3, 4, 1)","mean([2, 3, 4, 1])","mean([2, 5; 4, 3])","mean([2, 5; 4, 3], 1)","mean([2, 5; 4, 3], 2)","mean([1.0, 2.7, 3.2, 4.0])"],seealso:["max","median","min","prod","std","sum","variance"]},median:{name:"median",category:"Statistics",syntax:["median(a, b, c, ...)","median(A)"],description:"Compute the median of all values. The values are sorted and the middle value is returned. In case of an even number of values, the average of the two middle values is returned.",examples:["median(5, 2, 7)","median([3, -1, 5, 7])"],seealso:["max","mean","min","prod","std","sum","variance","quantileSeq"]},min:{name:"min",category:"Statistics",syntax:["min(a, b, c, ...)","min(A)","min(A, dimension)"],description:"Compute the minimum value of a list of values.",examples:["min(2, 3, 4, 1)","min([2, 3, 4, 1])","min([2, 5; 4, 3])","min([2, 5; 4, 3], 1)","min([2, 5; 4, 3], 2)","min(2.7, 7.1, -4.5, 2.0, 4.1)","max(2.7, 7.1, -4.5, 2.0, 4.1)"],seealso:["max","mean","median","prod","std","sum","variance"]},mode:{name:"mode",category:"Statistics",syntax:["mode(a, b, c, ...)","mode(A)","mode(A, a, b, B, c, ...)"],description:"Computes the mode of all values as an array. In case mode being more than one, multiple values are returned in an array.",examples:["mode(2, 1, 4, 3, 1)","mode([1, 2.7, 3.2, 4, 2.7])","mode(1, 4, 6, 1, 6)"],seealso:["max","mean","min","median","prod","std","sum","variance"]},prod:{name:"prod",category:"Statistics",syntax:["prod(a, b, c, ...)","prod(A)"],description:"Compute the product of all values.",examples:["prod(2, 3, 4)","prod([2, 3, 4])","prod([2, 5; 4, 3])"],seealso:["max","mean","min","median","min","std","sum","variance"]},quantileSeq:{name:"quantileSeq",category:"Statistics",syntax:["quantileSeq(A, prob[, sorted])","quantileSeq(A, [prob1, prob2, ...][, sorted])","quantileSeq(A, N[, sorted])"],description:"Compute the prob order quantile of a matrix or a list with values. The sequence is sorted and the middle value is returned. Supported types of sequence values are: Number, BigNumber, Unit Supported types of probablity are: Number, BigNumber. \n\nIn case of a (multi dimensional) array or matrix, the prob order quantile of all elements will be calculated.",examples:["quantileSeq([3, -1, 5, 7], 0.5)","quantileSeq([3, -1, 5, 7], [1/3, 2/3])","quantileSeq([3, -1, 5, 7], 2)","quantileSeq([-1, 3, 5, 7], 0.5, true)"],seealso:["mean","median","min","max","prod","std","sum","variance"]},std:{name:"std",category:"Statistics",syntax:["std(a, b, c, ...)","std(A)","std(A, dimension)","std(A, normalization)","std(A, dimension, normalization)"],description:'Compute the standard deviation of all values, defined as std(A) = sqrt(variance(A)). Optional parameter normalization can be "unbiased" (default), "uncorrected", or "biased".',examples:["std(2, 4, 6)","std([2, 4, 6, 8])",'std([2, 4, 6, 8], "uncorrected")','std([2, 4, 6, 8], "biased")',"std([1, 2, 3; 4, 5, 6])"],seealso:["max","mean","min","median","prod","sum","variance"]},sum:{name:"sum",category:"Statistics",syntax:["sum(a, b, c, ...)","sum(A)","sum(A, dimension)"],description:"Compute the sum of all values.",examples:["sum(2, 3, 4, 1)","sum([2, 3, 4, 1])","sum([2, 5; 4, 3])"],seealso:["max","mean","median","min","prod","std","sum","variance"]},variance:{name:"variance",category:"Statistics",syntax:["variance(a, b, c, ...)","variance(A)","variance(A, dimension)","variance(A, normalization)","variance(A, dimension, normalization)"],description:'Compute the variance of all values. Optional parameter normalization can be "unbiased" (default), "uncorrected", or "biased".',examples:["variance(2, 4, 6)","variance([2, 4, 6, 8])",'variance([2, 4, 6, 8], "uncorrected")','variance([2, 4, 6, 8], "biased")',"variance([1, 2, 3; 4, 5, 6])"],seealso:["max","mean","min","median","min","prod","std","sum"]},corr:{name:"corr",category:"Statistics",syntax:["corr(A,B)"],description:"Compute the correlation coefficient of a two list with values, For matrices, the matrix correlation coefficient is calculated.",examples:["corr([2, 4, 6, 8],[1, 2, 3, 6])","corr(matrix([[1, 2.2, 3, 4.8, 5], [1, 2, 3, 4, 5]]), matrix([[4, 5.3, 6.6, 7, 8], [1, 2, 3, 4, 5]]))"],seealso:["max","mean","min","median","min","prod","std","sum"]},acos:{name:"acos",category:"Trigonometry",syntax:["acos(x)"],description:"Compute the inverse cosine of a value in radians.",examples:["acos(0.5)","acos(cos(2.3))"],seealso:["cos","atan","asin"]},acosh:{name:"acosh",category:"Trigonometry",syntax:["acosh(x)"],description:"Calculate the hyperbolic arccos of a value, defined as `acosh(x) = ln(sqrt(x^2 - 1) + x)`.",examples:["acosh(1.5)"],seealso:["cosh","asinh","atanh"]},acot:{name:"acot",category:"Trigonometry",syntax:["acot(x)"],description:"Calculate the inverse cotangent of a value.",examples:["acot(0.5)","acot(cot(0.5))","acot(2)"],seealso:["cot","atan"]},acoth:{name:"acoth",category:"Trigonometry",syntax:["acoth(x)"],description:"Calculate the hyperbolic arccotangent of a value, defined as `acoth(x) = (ln((x+1)/x) + ln(x/(x-1))) / 2`.",examples:["acoth(2)","acoth(0.5)"],seealso:["acsch","asech"]},acsc:{name:"acsc",category:"Trigonometry",syntax:["acsc(x)"],description:"Calculate the inverse cotangent of a value.",examples:["acsc(2)","acsc(csc(0.5))","acsc(0.5)"],seealso:["csc","asin","asec"]},acsch:{name:"acsch",category:"Trigonometry",syntax:["acsch(x)"],description:"Calculate the hyperbolic arccosecant of a value, defined as `acsch(x) = ln(1/x + sqrt(1/x^2 + 1))`.",examples:["acsch(0.5)"],seealso:["asech","acoth"]},asec:{name:"asec",category:"Trigonometry",syntax:["asec(x)"],description:"Calculate the inverse secant of a value.",examples:["asec(0.5)","asec(sec(0.5))","asec(2)"],seealso:["acos","acot","acsc"]},asech:{name:"asech",category:"Trigonometry",syntax:["asech(x)"],description:"Calculate the inverse secant of a value.",examples:["asech(0.5)"],seealso:["acsch","acoth"]},asin:{name:"asin",category:"Trigonometry",syntax:["asin(x)"],description:"Compute the inverse sine of a value in radians.",examples:["asin(0.5)","asin(sin(0.5))"],seealso:["sin","acos","atan"]},asinh:{name:"asinh",category:"Trigonometry",syntax:["asinh(x)"],description:"Calculate the hyperbolic arcsine of a value, defined as `asinh(x) = ln(x + sqrt(x^2 + 1))`.",examples:["asinh(0.5)"],seealso:["acosh","atanh"]},atan:{name:"atan",category:"Trigonometry",syntax:["atan(x)"],description:"Compute the inverse tangent of a value in radians.",examples:["atan(0.5)","atan(tan(0.5))"],seealso:["tan","acos","asin"]},atanh:{name:"atanh",category:"Trigonometry",syntax:["atanh(x)"],description:"Calculate the hyperbolic arctangent of a value, defined as `atanh(x) = ln((1 + x)/(1 - x)) / 2`.",examples:["atanh(0.5)"],seealso:["acosh","asinh"]},atan2:{name:"atan2",category:"Trigonometry",syntax:["atan2(y, x)"],description:"Computes the principal value of the arc tangent of y/x in radians.",examples:["atan2(2, 2) / pi","angle = 60 deg in rad","x = cos(angle)","y = sin(angle)","atan2(y, x)"],seealso:["sin","cos","tan"]},cos:{name:"cos",category:"Trigonometry",syntax:["cos(x)"],description:"Compute the cosine of x in radians.",examples:["cos(2)","cos(pi / 4) ^ 2","cos(180 deg)","cos(60 deg)","sin(0.2)^2 + cos(0.2)^2"],seealso:["acos","sin","tan"]},cosh:{name:"cosh",category:"Trigonometry",syntax:["cosh(x)"],description:"Compute the hyperbolic cosine of x in radians.",examples:["cosh(0.5)"],seealso:["sinh","tanh","coth"]},cot:{name:"cot",category:"Trigonometry",syntax:["cot(x)"],description:"Compute the cotangent of x in radians. Defined as 1/tan(x)",examples:["cot(2)","1 / tan(2)"],seealso:["sec","csc","tan"]},coth:{name:"coth",category:"Trigonometry",syntax:["coth(x)"],description:"Compute the hyperbolic cotangent of x in radians.",examples:["coth(2)","1 / tanh(2)"],seealso:["sech","csch","tanh"]},csc:{name:"csc",category:"Trigonometry",syntax:["csc(x)"],description:"Compute the cosecant of x in radians. Defined as 1/sin(x)",examples:["csc(2)","1 / sin(2)"],seealso:["sec","cot","sin"]},csch:{name:"csch",category:"Trigonometry",syntax:["csch(x)"],description:"Compute the hyperbolic cosecant of x in radians. Defined as 1/sinh(x)",examples:["csch(2)","1 / sinh(2)"],seealso:["sech","coth","sinh"]},sec:{name:"sec",category:"Trigonometry",syntax:["sec(x)"],description:"Compute the secant of x in radians. Defined as 1/cos(x)",examples:["sec(2)","1 / cos(2)"],seealso:["cot","csc","cos"]},sech:{name:"sech",category:"Trigonometry",syntax:["sech(x)"],description:"Compute the hyperbolic secant of x in radians. Defined as 1/cosh(x)",examples:["sech(2)","1 / cosh(2)"],seealso:["coth","csch","cosh"]},sin:{name:"sin",category:"Trigonometry",syntax:["sin(x)"],description:"Compute the sine of x in radians.",examples:["sin(2)","sin(pi / 4) ^ 2","sin(90 deg)","sin(30 deg)","sin(0.2)^2 + cos(0.2)^2"],seealso:["asin","cos","tan"]},sinh:{name:"sinh",category:"Trigonometry",syntax:["sinh(x)"],description:"Compute the hyperbolic sine of x in radians.",examples:["sinh(0.5)"],seealso:["cosh","tanh"]},tan:{name:"tan",category:"Trigonometry",syntax:["tan(x)"],description:"Compute the tangent of x in radians.",examples:["tan(0.5)","sin(0.5) / cos(0.5)","tan(pi / 4)","tan(45 deg)"],seealso:["atan","sin","cos"]},tanh:{name:"tanh",category:"Trigonometry",syntax:["tanh(x)"],description:"Compute the hyperbolic tangent of x in radians.",examples:["tanh(0.5)","sinh(0.5) / cosh(0.5)"],seealso:["sinh","cosh"]},to:{name:"to",category:"Units",syntax:["x to unit","to(x, unit)"],description:"Change the unit of a value.",examples:["5 inch to cm","3.2kg to g","16 bytes in bits"],seealso:[]},clone:{name:"clone",category:"Utils",syntax:["clone(x)"],description:"Clone a variable. Creates a copy of primitive variables,and a deep copy of matrices",examples:["clone(3.5)","clone(2 - 4i)","clone(45 deg)","clone([1, 2; 3, 4])",'clone("hello world")'],seealso:[]},format:{name:"format",category:"Utils",syntax:["format(value)","format(value, precision)"],description:"Format a value of any type as string.",examples:["format(2.3)","format(3 - 4i)","format([])","format(pi, 3)"],seealso:["print"]},bin:{name:"bin",category:"Utils",syntax:["bin(value)"],description:"Format a number as binary",examples:["bin(2)"],seealso:["oct","hex"]},oct:{name:"oct",category:"Utils",syntax:["oct(value)"],description:"Format a number as octal",examples:["oct(56)"],seealso:["bin","hex"]},hex:{name:"hex",category:"Utils",syntax:["hex(value)"],description:"Format a number as hexadecimal",examples:["hex(240)"],seealso:["bin","oct"]},isNaN:{name:"isNaN",category:"Utils",syntax:["isNaN(x)"],description:"Test whether a value is NaN (not a number)",examples:["isNaN(2)","isNaN(0 / 0)","isNaN(NaN)","isNaN(Infinity)"],seealso:["isNegative","isNumeric","isPositive","isZero"]},isInteger:{name:"isInteger",category:"Utils",syntax:["isInteger(x)"],description:"Test whether a value is an integer number.",examples:["isInteger(2)","isInteger(3.5)","isInteger([3, 0.5, -2])"],seealso:["isNegative","isNumeric","isPositive","isZero"]},isNegative:{name:"isNegative",category:"Utils",syntax:["isNegative(x)"],description:"Test whether a value is negative: smaller than zero.",examples:["isNegative(2)","isNegative(0)","isNegative(-4)","isNegative([3, 0.5, -2])"],seealso:["isInteger","isNumeric","isPositive","isZero"]},isNumeric:{name:"isNumeric",category:"Utils",syntax:["isNumeric(x)"],description:"Test whether a value is a numeric value. Returns true when the input is a number, BigNumber, Fraction, or boolean.",examples:["isNumeric(2)",'isNumeric("2")','hasNumericValue("2")',"isNumeric(0)","isNumeric(bignumber(500))","isNumeric(fraction(0.125))","isNumeric(2 + 3i)",'isNumeric([2.3, "foo", false])'],seealso:["isInteger","isZero","isNegative","isPositive","isNaN","hasNumericValue"]},hasNumericValue:{name:"hasNumericValue",category:"Utils",syntax:["hasNumericValue(x)"],description:"Test whether a value is an numeric value. In case of a string, true is returned if the string contains a numeric value.",examples:["hasNumericValue(2)",'hasNumericValue("2")','isNumeric("2")',"hasNumericValue(0)","hasNumericValue(bignumber(500))","hasNumericValue(fraction(0.125))","hasNumericValue(2 + 3i)",'hasNumericValue([2.3, "foo", false])'],seealso:["isInteger","isZero","isNegative","isPositive","isNaN","isNumeric"]},isPositive:{name:"isPositive",category:"Utils",syntax:["isPositive(x)"],description:"Test whether a value is positive: larger than zero.",examples:["isPositive(2)","isPositive(0)","isPositive(-4)","isPositive([3, 0.5, -2])"],seealso:["isInteger","isNumeric","isNegative","isZero"]},isPrime:{name:"isPrime",category:"Utils",syntax:["isPrime(x)"],description:"Test whether a value is prime: has no divisors other than itself and one.",examples:["isPrime(3)","isPrime(-2)","isPrime([2, 17, 100])"],seealso:["isInteger","isNumeric","isNegative","isZero"]},isZero:{name:"isZero",category:"Utils",syntax:["isZero(x)"],description:"Test whether a value is zero.",examples:["isZero(2)","isZero(0)","isZero(-4)","isZero([3, 0, -2, 0])"],seealso:["isInteger","isNumeric","isNegative","isPositive"]},print:{name:"print",category:"Utils",syntax:["print(template, values)","print(template, values, precision)"],description:"Interpolate values into a string template.",examples:['print("Lucy is $age years old", {age: 5})','print("The value of pi is $pi", {pi: pi}, 3)','print("Hello, $user.name!", {user: {name: "John"}})','print("Values: $1, $2, $3", [6, 9, 4])'],seealso:["format"]},typeOf:{name:"typeOf",category:"Utils",syntax:["typeOf(x)"],description:"Get the type of a variable.",examples:["typeOf(3.5)","typeOf(2 - 4i)","typeOf(45 deg)",'typeOf("hello world")'],seealso:["getMatrixDataType"]},numeric:{name:"numeric",category:"Utils",syntax:["numeric(x)"],description:"Convert a numeric input to a specific numeric type: number, BigNumber, or Fraction.",examples:['numeric("4")','numeric("4", "number")','numeric("4", "BigNumber")','numeric("4", "Fraction")','numeric(4, "Fraction")','numeric(fraction(2, 5), "number")'],seealso:["number","fraction","bignumber","string","format"]}},Vf=N("help",["typed","mathWithTransform","Help"],function(e){var t=e.typed,i=e.mathWithTransform,a=e.Help;return t("help",{any:function(e){var t,r=e;if("string"!=typeof e)for(t in i)if(se(i,t)&&e===i[t]){r=t;break}var n=Xe(Gf,r);if(n)return new a(n);throw n="function"==typeof r?r.name:r,new Error('No documentation found on "'+n+'"')}})}),Zf=N("chain",["typed","Chain"],function(e){var t=e.typed,r=e.Chain;return t("chain",{"":function(){return new r},any:function(e){return new r(e)}})}),Wf=N("det",["typed","matrix","subtractScalar","multiply","divideScalar","isZero","unaryMinus"],function(e){var t=e.typed,y=e.matrix,v=e.subtractScalar,g=e.multiply,x=e.divideScalar,b=e.isZero,w=e.unaryMinus;return t("det",{any:Ce,"Array | Matrix":function(e){var t;switch((t=P(e)?e.size():Array.isArray(e)?(e=y(e)).size():[]).length){case 0:return Ce(e);case 1:if(1===t[0])return Ce(e.valueOf()[0]);if(0===t[0])return 1;throw new RangeError("Matrix must be square (size: "+Fe(t)+")");case 2:var r=t[0],n=t[1];if(r===n){var i=e.clone().valueOf();var a=r;if(1===a)return Ce(i[0][0]);if(2===a)return v(g(i[0][0],i[1][1]),g(i[1][0],i[0][1]));for(var o=!1,u=new Array(a).fill(0).map(function(e,t){return t}),s=0;s<a;s++){var c=u[s];if(b(i[c][s])){for(var l=void 0,l=s+1;l<a;l++)if(!b(i[u[l]][s])){c=u[l],u[l]=u[s],u[s]=c,o=!o;break}if(l===a)return i[c][s]}for(var f=i[c][s],p=0===s?1:i[u[s-1]][s-1],m=s+1;m<a;m++)for(var h=u[m],d=s+1;d<a;d++)i[h][d]=x(v(g(i[h][d],f),g(i[h][s],i[c][d])),p)}r=i[u[a-1]][a-1];return o?w(r):r;return}if(0===n)return 1;throw new RangeError("Matrix must be square (size: "+Fe(t)+")");default:throw new RangeError("Matrix must be two dimensional (size: "+Fe(t)+")")}}})}),Yf=N("inv",["typed","matrix","divideScalar","addScalar","multiply","unaryMinus","det","identity","abs"],function(e){var t=e.typed,i=e.matrix,v=e.divideScalar,g=e.addScalar,x=e.multiply,b=e.unaryMinus,w=e.det,N=e.identity,D=e.abs;return t("inv",{"Array | Matrix":function(e){var t=P(e)?e.size():_(e);switch(t.length){case 1:if(1===t[0])return P(e)?i([v(1,e.valueOf()[0])]):[v(1,e[0])];throw new RangeError("Matrix must be square (size: "+Fe(t)+")");case 2:var r=t[0],n=t[1];if(r===n)return P(e)?i(a(e.valueOf(),r,n),e.storage()):a(e,r,n);throw new RangeError("Matrix must be square (size: "+Fe(t)+")");default:throw new RangeError("Matrix must be two dimensional (size: "+Fe(t)+")")}},any:function(e){return v(1,e)}});function a(e,t,r){var n,i,a;if(1===t){if(0===(o=e[0][0]))throw Error("Cannot calculate inverse, determinant is zero");return[[v(1,o)]]}if(2===t){var o=w(e);if(0===o)throw Error("Cannot calculate inverse, determinant is zero");return[[v(e[1][1],o),v(b(e[0][1]),o)],[v(b(e[1][0]),o),v(e[0][0],o)]]}var u=e.concat();for(p=0;p<t;p++)u[p]=u[p].concat();for(var s=N(t).valueOf(),c=0;c<r;c++){for(var l=D(u[c][c]),f=c,p=c+1;p<t;)D(u[p][c])>l&&(l=D(u[p][c]),f=p),p++;if(0===l)throw Error("Cannot calculate inverse, determinant is zero");(p=f)!==c&&(a=u[c],u[c]=u[p],u[p]=a,a=s[c],s[c]=s[p],s[p]=a);var m=u[c],h=s[c];for(p=0;p<t;p++){var d=u[p],y=s[p];if(p!==c){if(0!==d[c]){for(i=v(b(d[c]),m[c]),n=c;n<r;n++)d[n]=g(d[n],x(i,m[n]));for(n=0;n<r;n++)y[n]=g(y[n],x(i,h[n]))}}else{for(i=m[c],n=c;n<r;n++)d[n]=v(d[n],i);for(n=0;n<r;n++)y[n]=v(y[n],i)}}}return s}}),Jf=N("pinv",["typed","matrix","inv","deepEqual","equal","dotDivide","dot","ctranspose","divideScalar","multiply","add","Complex"],function(e){var t=e.typed,i=e.matrix,a=e.inv,r=e.deepEqual,n=e.equal,p=e.dotDivide,o=e.dot,u=e.ctranspose,s=e.divideScalar,m=e.multiply,h=e.add,c=e.Complex;return t("pinv",{"Array | Matrix":function(e){var t=P(e)?e.size():_(e);switch(t.length){case 1:return f(e)?u(e):1===t[0]?a(e):p(u(e),o(e,e));case 2:if(f(e))return u(e);var r=t[0],n=t[1];if(r===n)try{return a(e)}catch(e){if(!(e instanceof Error&&e.message.match(/Cannot calculate inverse, determinant is zero/)))throw e}return P(e)?i(l(e.valueOf(),r,n),e.storage()):l(e,r,n);default:throw new RangeError("Matrix must be two dimensional (size: "+Fe(t)+")")}},any:function(e){return n(e,0)?Ce(e):s(1,e)}});function l(e,t,r){f=e,i=function(e,t){for(var r=Ce(f),n=0,i=0;i<e;i++){if(t<=n)return r;for(var a=i;d(r[a][n]);)if(e===++a&&(a=i,t===++n))return r;var o=[r[i],r[a]];r[a]=o[0],r[i]=o[1];for(var u=r[i][n],s=0;s<t;s++)r[i][s]=p(r[i][s],u);for(var c=0;c<e;c++)if(c!==i)for(var u=r[c][n],l=0;l<t;l++)r[c][l]=h(r[c][l],m(-1,m(u,r[i][l])));n++}return r}(n=t,r);var f,n,i,e={C:f.map(function(e,t){return e.filter(function(e,t){return t<n&&!d(o(i[t],i[t]))})}),F:i.filter(function(e,t){return!d(o(i[t],i[t]))})},t=e.C,r=e.F,e=m(a(m(u(t),t)),u(t)),t=m(u(r),a(m(r,u(r))));return m(t,e)}function d(e){return n(h(e,c(1,1)),h(0,c(1,1)))}function f(e){return r(h(e,c(1,1)),h(m(e,0),c(1,1)))}});function Xf(e,t){var r,n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e){if(e){if("string"==typeof e)return Qf(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(t="Object"===t&&e.constructor?e.constructor.name:t)||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Qf(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length)return n&&(e=n),r=0,{s:t=function(){},n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,o=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){o=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(o)throw i}}}}function Qf(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var Kf=N("eigs",["config","typed","matrix","addScalar","equal","subtract","abs","atan","cos","sin","multiplyScalar","divideScalar","inv","bignumber","multiply","add","larger","column","flatten","number","complex","sqrt","diag","size","reshape","qr","usolve","usolveAll","im","re","smaller","matrixFromColumns","dot"],function(e){var O,T,J,_,B,C,k,I,z,R,l,f,M,X,h,Q,F,q,j,P,o,L,U,$,H,K,G,V,Z,ee,W,Y,te,n=e.config,p=e.typed,i=e.matrix,m=e.addScalar,u=e.subtract,v=e.equal,s=e.abs,t=e.atan,g=e.cos,x=e.sin,b=e.multiplyScalar,w=e.divideScalar,N=e.inv,d=e.bignumber,D=e.multiply,E=e.add,c=e.larger,r=e.column,A=e.flatten,S=e.number,y=e.complex,re=e.sqrt,ne=e.diag,ie=e.size,ae=e.reshape,oe=e.qr,ue=e.usolve,se=e.usolveAll,ce=e.im,le=e.re,fe=e.smaller,pe=e.matrixFromColumns,e=e.dot,me=(L=(r={config:n,addScalar:m,subtract:u,column:r,flatten:A,equal:v,abs:s,atan:t,cos:g,sin:x,multiplyScalar:b,inv:N,bignumber:d,complex:y,multiply:D,add:E}).config,U=r.addScalar,$=r.subtract,H=r.abs,K=r.atan,G=r.cos,V=r.sin,Z=r.multiplyScalar,ee=r.inv,W=r.bignumber,Y=r.multiply,te=r.add,function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:L.epsilon,n=3<arguments.length?arguments[3]:void 0,i=4<arguments.length?arguments[4]:void 0;if("number"===n){var a=e,o=i,u=a.length,s=Math.abs(r/u);if(o)for(var c=new Array(u),l=0;l<u;l++)c[l]=Array(u).fill(0),c[l][l]=1;for(var f,p,m,h=be(a);Math.abs(h[1])>=Math.abs(s);){var d=h[0][0],y=h[0][1];a=function(e,t,r,n){for(var i=e.length,a=Math.cos(t),o=Math.sin(t),t=a*a,u=o*o,s=Array(i).fill(0),c=Array(i).fill(0),l=t*e[r][r]-2*a*o*e[r][n]+u*e[n][n],u=u*e[r][r]+2*a*o*e[r][n]+t*e[n][n],f=0;f<i;f++)s[f]=a*e[r][f]-o*e[n][f],c[f]=o*e[r][f]+a*e[n][f];e[r][r]=l,e[n][n]=u,e[r][n]=0;for(var p=e[n][r]=0;p<i;p++)p!==r&&p!==n&&(e[r][p]=s[p],e[p][r]=s[p],e[n][p]=c[p],e[p][n]=c[p]);return e}(a,(f=a[d][d],p=a[y][y],m=a[d][y],m=Math.abs(p-f)<=L.epsilon?Math.PI/4:.5*Math.atan(2*m/(p-f))),d,y),o&&(c=function(e,t,r,n){for(var i=e.length,a=Math.cos(t),o=Math.sin(t),u=Array(i).fill(0),s=Array(i).fill(0),c=0;c<i;c++)u[c]=a*e[c][r]-o*e[c][n],s[c]=o*e[c][r]+a*e[c][n];for(var l=0;l<i;l++)e[l][r]=u[l],e[l][n]=s[l];return e}(c,m,d,y)),h=be(a)}for(var v=Array(u).fill(0),g=0;g<u;g++)v[g]=a[g][g];return Ne(Ce(v),c,o)}if("BigNumber"!==n)throw TypeError("Unsupported data type: "+n);var x=e,b=i,w=x.length,N=H(r/w);if(b)for(var D=new Array(w),E=0;E<w;E++)D[E]=Array(w).fill(0),D[E][E]=1;for(var A,S,C,M=we(x);H(M[1])>=H(N);){var F=M[0][0],O=M[0][1];x=function(e,t,r,n){for(var i=e.length,a=W(G(t)),o=W(V(t)),t=Z(a,a),u=Z(o,o),s=Array(i).fill(W(0)),c=Array(i).fill(W(0)),l=Y(W(2),a,o,e[r][n]),f=U($(Z(t,e[r][r]),l),Z(u,e[n][n])),u=te(Z(u,e[r][r]),l,Z(t,e[n][n])),p=0;p<i;p++)s[p]=$(Z(a,e[r][p]),Z(o,e[n][p])),c[p]=U(Z(o,e[r][p]),Z(a,e[n][p]));e[r][r]=f,e[n][n]=u,e[r][n]=W(0),e[n][r]=W(0);for(var m=0;m<i;m++)m!==r&&m!==n&&(e[r][m]=s[m],e[m][r]=s[m],e[n][m]=c[m],e[m][n]=c[m]);return e}(x,(A=x[F][F],C=x[O][O],S=x[F][O],C=$(C,A),A=H(C)<=L.epsilon?W(-1).acos().div(4):Z(.5,K(Y(2,S,ee(C))))),F,O),b&&(D=function(e,t,r,n){for(var i=e.length,a=G(t),o=V(t),u=Array(i).fill(W(0)),s=Array(i).fill(W(0)),c=0;c<i;c++)u[c]=$(Z(a,e[c][r]),Z(o,e[c][n])),s[c]=U(Z(o,e[c][r]),Z(a,e[c][n]));for(var l=0;l<i;l++)e[l][r]=u[l],e[l][n]=s[l];return e}(D,A,F,O)),M=we(x)}for(var T=Array(w).fill(0),_=0;_<w;_++)T[_]=x[_][_];return Ne(Ce(T),D,b)}),he=(O=(t={config:n,addScalar:m,subtract:u,multiply:D,multiplyScalar:b,flatten:A,divideScalar:w,sqrt:re,abs:s,bignumber:d,diag:ne,size:ie,reshape:ae,qr:oe,inv:N,usolve:ue,usolveAll:se,equal:v,complex:y,larger:c,smaller:fe,matrixFromColumns:pe,dot:e}).addScalar,T=t.subtract,J=t.flatten,_=t.multiply,B=t.multiplyScalar,C=t.divideScalar,k=t.sqrt,I=t.abs,z=t.bignumber,R=t.diag,l=t.size,f=t.reshape,M=t.inv,X=t.qr,h=t.usolve,Q=t.usolveAll,F=t.equal,q=t.complex,j=t.larger,P=t.smaller,o=t.dot,function(e,t,r,w){var n=!(4<arguments.length&&void 0!==arguments[4])||arguments[4],i=function(e,t,r){var n,i="BigNumber"===w,a="Complex"===w,o=i?z(0):0,a=i?z(1):a?q(1):1,u=i?z(1):1,s=i?z(10):2,c=B(s,s);r&&(n=Array(t).fill(a));for(var l=!1;!l;){l=!0;for(var f=0;f<t;f++){for(var p=o,m=o,h=0;h<t;h++)f!==h&&(p=O(p,I(e[h][f])),m=O(m,I(e[f][h])));if(!F(p,0)&&!F(m,0)){for(var d=u,y=p,v=C(m,s),g=B(m,s);P(y,v);)y=B(y,c),d=B(d,s);for(;j(y,g);)y=C(y,c),d=C(d,s);if(P(C(O(y,m),d),B(O(p,m),.95))){for(var l=!1,x=C(1,d),b=0;b<t;b++)f!==b&&(e[f][b]=B(e[f][b],x),e[b][f]=B(e[b][f],d));r&&(n[f]=B(n[f],x))}}}}return r?R(n):null}(e,t,n),a=e,o=t,u=r,s=n,c=i,l="BigNumber"===w,f="Complex"===w,p=l?z(0):f?q(0):0;l&&(u=z(u));for(var m=0;m<o-2;m++){for(var h=0,d=p,y=m+1;y<o;y++){var v=a[y][m];P(I(d),I(v))&&(d=v,h=y)}if(!P(I(d),u)){if(h!==m+1){var g=a[h];a[h]=a[m+1],a[m+1]=g;for(var x=0;x<o;x++){var b=a[x][h];a[x][h]=a[x][m+1],a[x][m+1]=b}s&&(g=c[h],c[h]=c[m+1],c[m+1]=g)}for(var N=m+2;N<o;N++){var D=C(a[N][m],d);if(0!==D){for(var E=0;E<o;E++)a[N][E]=T(a[N][E],B(D,a[m+1][E]));for(var A=0;A<o;A++)a[A][m+1]=O(a[A][m+1],B(D,a[A][N]));if(s)for(var S=0;S<o;S++)c[N][S]=T(c[N][S],B(D,c[m+1][S]))}}}}f=function(e,t,r,n,i){var a="BigNumber"===n,o="Complex"===n,u=a?z(1):o?q(1):1;a&&(r=z(r));for(var s,c,l,f,p,m,h,d=Ce(e),y=[],v=t,g=[],x=i?R(Array(t).fill(u)):void 0,b=i?R(Array(v).fill(u)):void 0,w=0;w<=100;){w+=1;for(var N=d[v-1][v-1],D=0;D<v;D++)d[D][D]=T(d[D][D],N);for(var E=X(d),A=E.Q,E=E.R,d=_(E,A),S=0;S<v;S++)d[S][S]=O(d[S][S],N);if(i&&(b=_(b,A)),1===v||P(I(d[v-1][v-2]),r)){w=0,y.push(d[v-1][v-1]),i&&(g.unshift([[1]]),de(b,t),x=_(x,b),1<v&&(b=R(Array(v-1).fill(u)))),--v,d.pop();for(var C=0;C<v;C++)d[C].pop()}else if(2===v||P(I(d[v-2][v-3]),r)){var w=0,M=(E=d[v-2][v-2],A=d[v-2][v-1],M=d[v-1][v-2],c=d[v-1][v-1],0,s=O(E,c),E=T(B(E,c),B(A,M)),c=B(s,.5),A=B(k(T(B(s,s),B(4,E))),.5),[O(c,A),T(c,A)]);y.push.apply(y,Me(M)),i&&(g.unshift((s=d[v-2][v-2],E=d[v-2][v-1],c=d[v-1][v-2],A=d[v-1][v-1],l=M[0],M=M[1],f=r,m=h=m=void 0,m="BigNumber"===(p=n),p="Complex"===p,h=m?z(0):p?q(0):0,m=m?z(1):p?q(1):1,P(I(c),f)?[[m,h],[h,m]]:j(I(T(l,M)),f)?[[T(l,A),T(M,A)],[c,c]]:(p=T(s,l),M=T(A,l),P(I(E),f)&&P(I(M),f)?[[p,m],[c,h]]:[[E,h],[M,m]]))),de(b,t),x=_(x,b),2<v&&(b=R(Array(v-2).fill(u)))),v-=2,d.pop(),d.pop();for(var F=0;F<v;F++)d[F].pop(),d[F].pop()}if(0===v)break}if(y.sort(function(e,t){return+T(I(e),I(t))}),100<w)throw(o=Error("The eigenvalues failed to converge. Only found these eigenvalues: "+y.join(", "))).values=y,o.vectors=[],o;return{values:y,C:i?_(x,function(e,t){for(var r=[],n=0;n<t;n++)r[n]=Array(t).fill(0);var i,a=0,o=Xf(e);try{for(o.s();!(i=o.n()).done;){for(var u=i.value,s=u.length,c=0;c<s;c++)for(var l=0;l<s;l++)r[a+c][a+l]=u[c][l];a+=s}}catch(e){o.e(e)}finally{o.f()}return r}(g,t)):void 0}}(e,t,r,w,n),l=f.values,f=f.C;return n?{values:l,eigenvectors:function(e,a,o,u,t,s,c){var r,n=M(o),l=_(n,e,o),n="BigNumber"===c,i="Complex"===c,f=n?z(0):i?q(0):0,n=n?z(1):i?q(1):1,p=[],m=[],h=Xf(t);try{for(h.s();!(r=h.n()).done;){var d=r.value,y=function(e,t,r){for(var n=0;n<e.length;n++)if(r(e[n],t))return n;return-1}(p,d,F);-1===y?(p.push(d),m.push(1)):m[y]+=1}}catch(e){h.e(e)}finally{h.f()}for(var v=[],g=p.length,x=Array(a).fill(f),b=R(Array(a).fill(n)),w=0;w<g;w++)!function(){var t=p[w],e=T(l,_(t,b));for((i=Q(e,x)).shift();i.length<m[w];){var r=ye(e,a,i,s,c);if(null===r)break;i.push(r)}var n=_(M(u),o),i=i.map(function(e){return _(n,e)});v.push.apply(v,Me(i.map(function(e){return{value:t,vector:J(e)}})))}();return v}(e,t,f,i,l,r,w)}:{values:l}});function de(e,t){for(var r,n=0;n<e.length;n++)(r=e[n]).push.apply(r,Me(Array(t-e[n].length).fill(0)));for(var i=e.length;i<t;i++)e.push(Array(t).fill(0)),e[i][i]=1}function ye(e,t,r,n,i){for(var a,o,u,s,c,l,f="BigNumber"===i?z(1e3):1e3,p=0;p<5;++p){o=t,u=r,l=c=void 0,c="BigNumber"===(s=i),l="Complex"===s,o=Array(o).fill(0).map(function(e){return 2*Math.random()-1}),c&&(o=o.map(function(e){return z(e)})),a=xe(o=ve(o=l?o.map(function(e){return q(e)}):o,u),s);try{a=h(e,a)}catch(e){continue}if(j(ge(a),f))break}if(5<=p)return null;for(p=0;;){var m=h(e,a);if(P(ge(ve(a,[m])),n))break;if(10<=++p)return null;a=xe(m)}return a}function ve(e,t){var r,n=l(e),i=Xf(t);try{for(i.s();!(r=i.n()).done;){var a=r.value,a=f(a,n);e=T(e,_(C(o(a,e),o(a,a)),a))}}catch(e){i.e(e)}finally{i.f()}return e}function ge(e){return I(k(o(e,e)))}function xe(e,t){var r="Complex"===t,t="BigNumber"===t?z(1):r?q(1):1;return _(C(t,ge(e)),e)}function be(e){for(var t=e.length,r=0,n=[0,1],i=0;i<t;i++)for(var a=i+1;a<t;a++)Math.abs(r)<Math.abs(e[i][a])&&(r=Math.abs(e[i][a]),n=[i,a]);return[n,r]}function we(e){for(var t=e.length,r=0,n=[0,1],i=0;i<t;i++)for(var a=i+1;a<t;a++)H(r)<H(e[i][a])&&(r=H(e[i][a]),n=[i,a]);return[n,r]}function Ne(e,t,r){var n=e.length,i=Array(n);if(r)for(var a=Array(n),o=0;o<n;o++)a[o]=Array(n);for(var u=0;u<n;u++){for(var s=0,c=e[0],l=0;l<e.length;l++)H(e[l])<H(c)&&(c=e[s=l]);if(i[u]=e.splice(s,1)[0],r)for(var f=0;f<n;f++)a[u][f]=t[f][s],t[f].splice(s,1)}if(!r)return{values:i};var p=a.map(function(e,t){return{value:i[t],vector:e}});return{values:i,eigenvectors:p}}return p("eigs",{Array:function(e){return a(i(e))},"Array, number|BigNumber":function(e,t){return a(i(e),{precision:t})},"Array, Object":function(e,t){return a(i(e),t)},Matrix:function(e){return a(e,{matricize:!0})},"Matrix, number|BigNumber":function(e,t){return a(e,{precision:t,matricize:!0})},"Matrix, Object":function(e,t){var r={matricize:!0};return an(r,t),a(e,r)}});function a(e,t){var t=1<arguments.length&&void 0!==t?t:{},r=!("eigenvectors"in t)||t.eigenvectors,e=function(e,t,r){var n=e.toArray(),i=e.size();if(2!==i.length||i[0]!==i[1])throw new RangeError("Matrix must be square (size: ".concat(Fe(i),")"));i=i[0];if(function(e,t,r){for(var n=0;n<t;n++)for(var i=0;i<t;i++)if(c(d(s(ce(e[n][i]))),r))return;return 1}(n,i,t)&&(function(e,t){for(var r=0;r<t;r++)for(var n=0;n<t;n++)e[r][n]=le(e[r][n])}(n,i),function(e,t,r){for(var n=0;n<t;n++)for(var i=n;i<t;i++)if(c(d(s(u(e[n][i],e[i][n]))),r))return;return 1}(n,i,t)))return a=De(e,n,i),me(n,i,t,a,r);var a=De(e,n,i);return he(n,i,t,a,r)}(e,null!=(e=t.precision)?e:n.epsilon,r);return t.matricize&&(e.values=i(e.values),r&&(e.eigenvectors=e.eigenvectors.map(function(e){var t=e.value,e=e.vector;return{value:t,vector:i(e)}}))),r&&Object.defineProperty(e,"vectors",{enumerable:!1,get:function(){throw new Error("eigs(M).vectors replaced with eigs(M).eigenvectors")}}),e}function De(e,t,r){e=e.datatype();if("number"===e||"BigNumber"===e||"Complex"===e)return e;for(var n=!1,i=!1,a=!1,o=0;o<r;o++)for(var u=0;u<r;u++){var s=t[o][u];if(Ee(s)||Te(s))n=!0;else if(Ae(s))i=!0;else{if(!Oe(s))throw TypeError("Unsupported type in Matrix: "+Se(s));a=!0}}if(i&&a&&console.warn("Complex BigNumbers not supported, this operation will lose precission."),a){for(var c=0;c<r;c++)for(var l=0;l<r;l++)t[c][l]=y(t[c][l]);return"Complex"}if(i){for(var f=0;f<r;f++)for(var p=0;p<r;p++)t[f][p]=d(t[f][p]);return"BigNumber"}if(n){for(var m=0;m<r;m++)for(var h=0;h<r;h++)t[m][h]=S(t[m][h]);return"number"}throw TypeError("Matrix contains unsupported types only.")}}),ep=N("expm",["typed","abs","add","identity","inv","multiply"],function(e){var t=e.typed,h=e.abs,d=e.add,y=e.identity,v=e.inv,g=e.multiply;return t("expm",{Matrix:function(e){var t=e.size();if(2!==t.length||t[0]!==t[1])throw new RangeError("Matrix must be square (size: "+Fe(t)+")");for(var t=t[0],r=function(e){for(var t=0;t<30;t++)for(var r=0;r<=t;r++){var n=t-r;if(function(e,t,r){for(var n=1,i=2;i<=t;i++)n*=i;for(var a=n,o=t+1;o<=2*t;o++)a*=o;var u=a*(2*t+1);return 8*Math.pow(e/Math.pow(2,r),2*t)*n*n/(a*u)}(e,r,n)<1e-15)return{q:r,j:n}}throw new Error("Could not find acceptable parameters to compute the matrix exponential (try increasing maxSearchSize in expm.js)")}(function(e){for(var t=e.size()[0],r=0,n=0;n<t;n++){for(var i=0,a=0;a<t;a++)i+=h(e.get([n,a]));r=Math.max(i,r)}return r}(e)),n=r.q,i=r.j,a=g(e,Math.pow(2,-i)),o=y(t),u=y(t),s=1,c=a,l=-1,f=1;f<=n;f++)1<f&&(c=g(c,a),l=-l),o=d(o,g(s=s*(n-f+1)/((2*n-f+1)*f),c)),u=d(u,g(s*l,c));for(var p=g(v(u),o),m=0;m<i;m++)p=g(p,p);return B(e)?e.createSparseMatrix(p):p}})}),tp=N("sqrtm",["typed","abs","add","multiply","map","sqrt","subtract","inv","size","max","identity"],function(e){var t=e.typed,o=e.abs,u=e.add,s=e.multiply,c=e.map,l=e.sqrt,f=e.subtract,p=e.inv,m=e.size,h=e.max,d=e.identity;return t("sqrtm",{"Array | Matrix":function(e){var t=P(e)?e.size():_(e);switch(t.length){case 1:if(1===t[0])return c(e,l);throw new RangeError("Matrix must be square (size: "+Fe(t)+")");case 2:if(t[0]!==t[1])throw new RangeError("Matrix must be square (size: "+Fe(t)+")");var r=0,n=e,i=d(m(e));do{var a=n,n=s(.5,u(a,p(i))),i=s(.5,u(i,p(a)));if(1e-6<(a=h(o(f(n,a))))&&1e3<++r)throw new Error("computing square root of matrix: iterative method could not converge")}while(1e-6<a);return n;default:throw new RangeError("Matrix must be at most two dimensional (size: "+Fe(t)+")")}}})}),rp=N("sylvester",["typed","schur","matrixFromColumns","matrix","multiply","range","concat","transpose","index","subset","add","subtract","identity","lusolve","abs"],function(e){var t=e.typed,w=e.schur,N=e.matrixFromColumns,D=e.matrix,E=e.multiply,A=e.range,S=e.concat,C=e.transpose,M=e.index,F=e.subset,O=e.add,T=e.subtract,_=e.identity,B=e.lusolve,k=e.abs;return t("sylvester",{"Matrix, Matrix, Matrix":n,"Array, Matrix, Matrix":function(e,t,r){return n(D(e),t,r)},"Array, Array, Matrix":function(e,t,r){return n(D(e),D(t),r)},"Array, Matrix, Array":function(e,t,r){return n(D(e),t,D(r))},"Matrix, Array, Matrix":function(e,t,r){return n(e,D(t),r)},"Matrix, Array, Array":function(e,t,r){return n(e,D(t),D(r))},"Matrix, Matrix, Array":function(e,t,r){return n(e,t,D(r))},"Array, Array, Array":function(e,t,r){return n(D(e),D(t),D(r)).toArray()}});function n(e,t,r){for(var n=t.size()[0],i=e.size()[0],e=w(e),a=e.T,e=e.U,t=w(E(-1,t)),o=t.T,t=t.U,u=E(E(C(e),r),t),s=A(0,i),c=[],l=function(e,t){return S(e,t,1)},f=function(e,t){return S(e,t,0)},p=0;p<n;p++)if(p<n-1&&1e-5<k(F(o,M(p+1,p)))){for(var m=f(F(u,M(s,p)),F(u,M(s,p+1))),h=0;h<p;h++)m=O(m,f(E(c[h],F(o,M(h,p))),E(c[h],F(o,M(h,p+1)))));var d=E(_(i),E(-1,F(o,M(p,p)))),y=E(_(i),E(-1,F(o,M(p+1,p)))),v=E(_(i),E(-1,F(o,M(p,p+1)))),g=E(_(i),E(-1,F(o,M(p+1,p+1)))),d=f(l(O(a,d),y),l(v,O(a,g))),y=B(d,m);c[p]=y.subset(M(A(0,i),0)),c[p+1]=y.subset(M(A(i,2*i),0)),p++}else{for(var x=F(u,M(s,p)),b=0;b<p;b++)x=O(x,E(c[b],F(o,M(b,p))));v=F(o,M(p,p)),g=T(a,E(v,_(i)));c[p]=B(g,x)}r=D(N.apply(void 0,c));return E(e,E(r,C(t)))}}),np=N("schur",["typed","matrix","identity","multiply","qr","norm","subtract"],function(e){var t=e.typed,r=e.matrix,s=e.identity,c=e.multiply,l=e.qr,f=e.norm,p=e.subtract;return t("schur",{Array:function(e){e=n(r(e));return{U:e.U.valueOf(),T:e.T.valueOf()}},Matrix:n});function n(e){var t=e.size()[0],r=e,n=s(t),i=0;do{var a=r,o=l(r),u=o.Q,o=o.R,r=c(o,u),n=c(n,u)}while(!(100<i++)&&1e-4<f(p(r,a)));return{U:n,T:r}}}),ip=N("lyap",["typed","matrix","sylvester","multiply","transpose"],function(e){var t=e.typed,r=e.matrix,n=e.sylvester,i=e.multiply,a=e.transpose;return t("lyap",{"Matrix, Matrix":function(e,t){return n(e,a(e),i(-1,t))},"Array, Matrix":function(e,t){return n(r(e),a(r(e)),i(-1,t))},"Matrix, Array":function(e,t){return n(e,a(r(e)),r(i(-1,t)))},"Array, Array":function(e,t){return n(r(e),a(r(e)),r(i(-1,t))).toArray()}})}),ap=N("divide",["typed","matrix","multiply","equalScalar","divideScalar","inv"],function(e){var t=e.typed,r=e.matrix,n=e.multiply,i=e.equalScalar,a=e.divideScalar,o=e.inv,u=oa({typed:t,equalScalar:i}),s=ua({typed:t});return t("divide",Le({"Array | Matrix, Array | Matrix":function(e,t){return n(e,o(t))},"DenseMatrix, any":function(e,t){return s(e,t,a,!1)},"SparseMatrix, any":function(e,t){return u(e,t,a,!1)},"Array, any":function(e,t){return s(r(e),t,a,!1).valueOf()},"any, Array | Matrix":function(e,t){return n(e,o(t))}},a.signatures))}),op=N("distance",["typed","addScalar","subtractScalar","divideScalar","multiplyScalar","deepEqual","sqrt","abs"],function(e){var t=e.typed,c=e.addScalar,l=e.subtractScalar,f=e.multiplyScalar,p=e.divideScalar,a=e.deepEqual,m=e.sqrt,o=e.abs;return t("distance",{"Array, Array, Array":function(e,t,r){if(2!==e.length||2!==t.length||2!==r.length)throw new TypeError("Invalid Arguments: Try again");if(!s(e))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!s(t))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!s(r))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(a(t,r))throw new TypeError("LinePoint1 should not be same with LinePoint2");var n=l(r[1],t[1]),i=l(t[0],r[0]),t=l(f(r[0],t[1]),f(t[0],r[1]));return d(e[0],e[1],n,i,t)},"Object, Object, Object":function(e,t,r){if(2!==Object.keys(e).length||2!==Object.keys(t).length||2!==Object.keys(r).length)throw new TypeError("Invalid Arguments: Try again");if(!s(e))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!s(t))throw new TypeError("Values of lineOnePtX and lineOnePtY should be numbers or BigNumbers");if(!s(r))throw new TypeError("Values of lineTwoPtX and lineTwoPtY should be numbers or BigNumbers");if(a(h(t),h(r)))throw new TypeError("LinePoint1 should not be same with LinePoint2");var n,i;if("pointX"in e&&"pointY"in e&&"lineOnePtX"in t&&"lineOnePtY"in t&&"lineTwoPtX"in r&&"lineTwoPtY"in r)return n=l(r.lineTwoPtY,t.lineOnePtY),i=l(t.lineOnePtX,r.lineTwoPtX),t=l(f(r.lineTwoPtX,t.lineOnePtY),f(t.lineOnePtX,r.lineTwoPtY)),d(e.pointX,e.pointY,n,i,t);throw new TypeError("Key names do not match")},"Array, Array":function(e,t){if(2===e.length&&3===t.length){if(!s(e))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(r(t))return d(e[0],e[1],t[0],t[1],t[2]);throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument")}if(3===e.length&&6===t.length){if(!r(e))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(i(t))return y(e[0],e[1],e[2],t[0],t[1],t[2],t[3],t[4],t[5]);throw new TypeError("Array with 6 numbers or BigNumbers expected for second argument")}if(e.length===t.length&&0<e.length){if(!n(e))throw new TypeError("All values of an array should be numbers or BigNumbers");if(n(t))return v(e,t);throw new TypeError("All values of an array should be numbers or BigNumbers")}throw new TypeError("Invalid Arguments: Try again")},"Object, Object":function(e,t){if(2===Object.keys(e).length&&3===Object.keys(t).length){if(!s(e))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!r(t))throw new TypeError("Values of xCoeffLine, yCoeffLine and constant should be numbers or BigNumbers");if("pointX"in e&&"pointY"in e&&"xCoeffLine"in t&&"yCoeffLine"in t&&"constant"in t)return d(e.pointX,e.pointY,t.xCoeffLine,t.yCoeffLine,t.constant);throw new TypeError("Key names do not match")}if(3===Object.keys(e).length&&6===Object.keys(t).length){if(!r(e))throw new TypeError("Values of pointX, pointY and pointZ should be numbers or BigNumbers");if(!i(t))throw new TypeError("Values of x0, y0, z0, a, b and c should be numbers or BigNumbers");if("pointX"in e&&"pointY"in e&&"x0"in t&&"y0"in t&&"z0"in t&&"a"in t&&"b"in t&&"c"in t)return y(e.pointX,e.pointY,e.pointZ,t.x0,t.y0,t.z0,t.a,t.b,t.c);throw new TypeError("Key names do not match")}if(2===Object.keys(e).length&&2===Object.keys(t).length){if(!s(e))throw new TypeError("Values of pointOneX and pointOneY should be numbers or BigNumbers");if(!s(t))throw new TypeError("Values of pointTwoX and pointTwoY should be numbers or BigNumbers");if("pointOneX"in e&&"pointOneY"in e&&"pointTwoX"in t&&"pointTwoY"in t)return v([e.pointOneX,e.pointOneY],[t.pointTwoX,t.pointTwoY]);throw new TypeError("Key names do not match")}if(3!==Object.keys(e).length||3!==Object.keys(t).length)throw new TypeError("Invalid Arguments: Try again");if(!r(e))throw new TypeError("Values of pointOneX, pointOneY and pointOneZ should be numbers or BigNumbers");if(!r(t))throw new TypeError("Values of pointTwoX, pointTwoY and pointTwoZ should be numbers or BigNumbers");if("pointOneX"in e&&"pointOneY"in e&&"pointOneZ"in e&&"pointTwoX"in t&&"pointTwoY"in t&&"pointTwoZ"in t)return v([e.pointOneX,e.pointOneY,e.pointOneZ],[t.pointTwoX,t.pointTwoY,t.pointTwoZ]);throw new TypeError("Key names do not match")},Array:function(e){if(function(e){if(2===e[0].length&&u(e[0][0])&&u(e[0][1])){if(e.some(function(e){return 2!==e.length||!u(e[0])||!u(e[1])}))return}else{if(!(3===e[0].length&&u(e[0][0])&&u(e[0][1])&&u(e[0][2])))return;if(e.some(function(e){return 3!==e.length||!u(e[0])||!u(e[1])||!u(e[2])}))return}return 1}(e)){for(var t=e,r=[],n=[],i=[],a=0;a<t.length-1;a++)for(var o=a+1;o<t.length;o++)2===t[0].length?(n=[t[a][0],t[a][1]],i=[t[o][0],t[o][1]]):3===t[0].length&&(n=[t[a][0],t[a][1],t[a][2]],i=[t[o][0],t[o][1],t[o][2]]),r.push(v(n,i));return r}throw new TypeError("Incorrect array format entered for pairwise distance calculation")}});function u(e){return"number"==typeof e||Ae(e)}function s(e){return u((e=e.constructor!==Array?h(e):e)[0])&&u(e[1])}function r(e){return u((e=e.constructor!==Array?h(e):e)[0])&&u(e[1])&&u(e[2])}function n(e){return(e=Array.isArray(e)?e:h(e)).every(u)}function i(e){return u((e=e.constructor!==Array?h(e):e)[0])&&u(e[1])&&u(e[2])&&u(e[3])&&u(e[4])&&u(e[5])}function h(e){for(var t=Object.keys(e),r=[],n=0;n<t.length;n++)r.push(e[t[n]]);return r}function d(e,t,r,n,i){e=o(c(c(f(r,e),f(n,t)),i)),t=m(c(f(r,r),f(n,n)));return p(e,t)}function y(e,t,r,n,i,a,o,u,s){a=[l(f(l(i,t),s),f(l(a,r),u)),l(f(l(a,r),o),f(l(n,e),s)),l(f(l(n,e),u),f(l(i,t),o))],a=m(c(c(f(a[0],a[0]),f(a[1],a[1])),f(a[2],a[2]))),r=m(c(c(f(o,o),f(u,u)),f(s,s)));return p(a,r)}function v(e,t){for(var r,n=e.length,i=0,a=0;a<n;a++)r=l(e[a],t[a]),i=c(f(r,r),i);return m(i)}}),up=N("intersect",["typed","config","abs","add","addScalar","matrix","multiply","multiplyScalar","divideScalar","subtract","smaller","equalScalar","flatten","isZero","isNumeric"],function(e){var t=e.typed,v=e.config,g=e.abs,x=e.add,b=e.addScalar,i=e.matrix,w=e.multiply,N=e.multiplyScalar,D=e.divideScalar,E=e.subtract,A=e.smaller,S=e.equalScalar,r=e.flatten,C=e.isZero,m=e.isNumeric;return t("intersect",{"Array, Array, Array":n,"Array, Array, Array, Array":a,"Matrix, Matrix, Matrix":function(e,t,r){e=n(e.valueOf(),t.valueOf(),r.valueOf());return null===e?null:i(e)},"Matrix, Matrix, Matrix, Matrix":function(e,t,r,n){e=a(e.valueOf(),t.valueOf(),r.valueOf(),n.valueOf());return null===e?null:i(e)}});function n(e,t,r){if(e=M(e),t=M(t),r=M(r),!O(e))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!O(t))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(4===(n=r).length&&m(n[0])&&m(n[1])&&m(n[2])&&m(n[3]))return n=e[0],i=e[1],e=e[2],a=t[0],o=t[1],t=t[2],u=r[0],s=r[1],c=r[2],r=r[3],l=N(n,u),u=N(a,u),f=N(i,s),s=N(o,s),p=N(e,c),c=N(t,c),r=E(E(E(r,l),f),p),u=E(E(E(b(b(u,s),c),l),f),p),s=D(r,u),[b(n,N(s,E(a,n))),b(i,N(s,E(o,i))),b(e,N(s,E(t,e)))];var n,i,a,o,u,s,c,l,f,p;throw new TypeError("Array with 4 numbers expected as third argument")}function a(e,t,r,n){if(e=M(e),t=M(t),r=M(r),n=M(n),2===e.length){if(!F(e))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!F(t))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!F(r))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(F(n)){var i=n;var a=e,o=r,u=E(a,t),i=E(o,i),s=E(N(u[0],i[1]),N(i[0],u[1]));if(C(s))return null;if(A(g(s),v.epsilon))return null;var c=N(i[0],a[1]),l=N(i[1],a[0]),f=N(i[0],o[1]),i=N(i[1],o[0]),o=D(b(E(E(c,l),f),i),s);return x(w(u,o),a);return}throw new TypeError("Array with 2 numbers or BigNumbers expected for fourth argument")}if(3!==e.length)throw new TypeError("Arrays with two or thee dimensional points expected");if(!O(e))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!O(t))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!O(r))throw new TypeError("Array with 3 numbers or BigNumbers expected for third argument");var p,m,h,d,y;{if(O(n))return c=e[0],l=e[1],f=e[2],i=t[0],s=t[1],u=t[2],o=r[0],a=r[1],e=r[2],t=n[0],r=n[1],n=n[2],p=T(c,o,t,o,l,a,r,a,f,e,n,e),m=T(t,o,i,c,r,a,s,l,n,e,u,f),d=T(c,o,i,c,l,a,s,l,f,e,u,f),h=T(t,o,t,o,r,a,r,a,n,e,n,e),y=T(i,c,i,c,s,l,s,l,u,f,u,f),d=E(N(p,m),N(d,h)),y=E(N(y,h),N(m,m)),C(y)?null:(d=D(d,y),y=D(b(p,N(d,m)),h),p=b(c,N(d,E(i,c))),m=b(l,N(d,E(s,l))),h=b(f,N(d,E(u,f))),i=b(o,N(y,E(t,o))),c=b(a,N(y,E(r,a))),s=b(e,N(y,E(n,e))),S(p,i)&&S(m,c)&&S(h,s)?[p,m,h]:null);throw new TypeError("Array with 3 numbers or BigNumbers expected for fourth argument")}}function M(e){return 1===e.length?e[0]:1<e.length&&Array.isArray(e[0])&&e.every(function(e){return Array.isArray(e)&&1===e.length})?r(e):e}function F(e){return 2===e.length&&m(e[0])&&m(e[1])}function O(e){return 3===e.length&&m(e[0])&&m(e[1])&&m(e[2])}function T(e,t,r,n,i,a,o,u,s,c,l,f){e=N(E(e,t),E(r,n)),t=N(E(i,a),E(o,u)),r=N(E(s,c),E(l,f));return b(b(e,t),r)}}),sp=N("sum",["typed","config","add","numeric"],function(e){var t=e.typed,n=e.config,i=e.add,a=e.numeric;return t("sum",{"Array | Matrix":r,"Array | Matrix, number | BigNumber":function(e,t){try{return $n(e,t,i)}catch(e){throw Nu(e,"sum")}},"...":function(e){if(Ln(e))throw new TypeError("Scalar values expected in function sum");return r(e)}});function r(e){var r;return Un(e,function(t){try{r=void 0===r?t:i(r,t)}catch(e){throw Nu(e,"sum",t)}}),r="string"==typeof(r=void 0===r?a(0,n.number):r)?a(r,n.number):r}}),cp="cumsum",lp=N(cp,["typed","add","unaryPlus"],function(e){var t=e.typed,n=e.add,i=e.unaryPlus;return t(cp,{Array:r,Matrix:function(e){return e.create(r(e.valueOf()))},"Array, number | BigNumber":a,"Matrix, number | BigNumber":function(e,t){return e.create(a(e.valueOf(),t))},"...":function(e){if(Ln(e))throw new TypeError("All values expected to be scalar in function cumsum");return r(e)}});function r(e){try{return u(e)}catch(e){throw Nu(e,cp)}}function u(e){if(0===e.length)return[];for(var t=[i(e[0])],r=1;r<e.length;++r)t.push(n(t[r-1],e[r]));return t}function a(e,t){var r=_(e);if(t<0||t>=r.length)throw new mn(t,r.length);try{return function e(t,r){var n,i,a;if(r<=0){var o=t[0][0];if(Array.isArray(o)){for(a=Pn(t),i=[],n=0;n<a.length;n++)i[n]=e(a[n],r-1);return i}return u(t)}for(i=[],n=0;n<t.length;n++)i[n]=e(t[n],r-1);return i}(e,t)}catch(e){throw Nu(e,cp)}}}),fp=N("mean",["typed","add","divide"],function(e){var t=e.typed,i=e.add,a=e.divide;return t("mean",{"Array | Matrix":r,"Array | Matrix, number | BigNumber":function(e,t){try{var r=$n(e,t,i),n=Array.isArray(e)?_(e):e.size();return a(r,n[t])}catch(e){throw Nu(e,"mean")}},"...":function(e){if(Ln(e))throw new TypeError("Scalar values expected in function mean");return r(e)}});function r(e){var r,n=0;if(Un(e,function(t){try{r=void 0===r?t:i(r,t),n++}catch(e){throw Nu(e,"mean",t)}}),0===n)throw new Error("Cannot calculate the mean of an empty array");return a(r,n)}}),pp=N("median",["typed","add","divide","compare","partitionSelect"],function(e){var t=e.typed,r=e.add,n=e.divide,u=e.compare,s=e.partitionSelect;function i(e){try{var t=(e=E(e.valueOf())).length;if(0===t)throw new Error("Cannot calculate median of an empty array");if(t%2==0){for(var r=t/2-1,n=s(e,1+r),i=e[r],a=0;a<r;++a)0<u(e[a],i)&&(i=e[a]);return l(i,n)}var o=s(e,(t-1)/2);return c(o)}catch(e){throw Nu(e,"median")}}var c=t({"number | BigNumber | Complex | Unit":function(e){return e}}),l=t({"number | BigNumber | Complex | Unit, number | BigNumber | Complex | Unit":function(e,t){return n(r(e,t),2)}});return t("median",{"Array | Matrix":i,"Array | Matrix, number | BigNumber":function(e,t){throw new Error("median(A, dim) is not yet supported")},"...":function(e){if(Ln(e))throw new TypeError("Scalar values expected in function median");return i(e)}})}),mp=N("mad",["typed","abs","map","median","subtract"],function(e){var t=e.typed,r=e.abs,n=e.map,i=e.median,a=e.subtract;return t("mad",{"Array | Matrix":o,"...":o});function o(e){if(0===(e=E(e.valueOf())).length)throw new Error("Cannot calculate median absolute deviation (mad) of an empty array");try{var t=i(e);return i(n(e,function(e){return r(a(e,t))}))}catch(e){throw e instanceof TypeError&&e.message.includes("median")?new TypeError(e.message.replace("median","mad")):Nu(e,"mad")}}}),hp="unbiased",dp=N("variance",["typed","add","subtract","multiply","divide","apply","isNaN"],function(e){var t=e.typed,o=e.add,u=e.subtract,s=e.multiply,c=e.divide,n=e.apply,l=e.isNaN;return t("variance",{"Array | Matrix":function(e){return i(e,hp)},"Array | Matrix, string":i,"Array | Matrix, number | BigNumber":function(e,t){return r(e,t,hp)},"Array | Matrix, number | BigNumber, string":r,"...":function(e){return i(e,hp)}});function i(e,t){var r=0;if(0===e.length)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");if(Un(e,function(t){try{i=void 0===i?t:o(i,t),r++}catch(e){throw Nu(e,"variance",t)}}),0===r)throw new Error("Cannot calculate variance of an empty array");var n=c(i,r),i=void 0;if(Un(e,function(e){e=u(e,n);i=void 0===i?s(e,e):o(i,s(e,e))}),l(i))return i;switch(t){case"uncorrected":return c(i,r);case"biased":return c(i,r+1);case"unbiased":var a=Ae(i)?i.mul(0):0;return 1===r?a:c(i,r-1);default:throw new Error('Unknown normalization "'+t+'". Choose "unbiased" (default), "uncorrected", or "biased".')}}function r(e,t,r){try{if(0===e.length)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");return n(e,t,function(e){return i(e,r)})}catch(e){throw Nu(e,"variance")}}}),yp="quantileSeq",vp=N(yp,["typed","?bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger"],function(e){var t=e.typed,s=e.bignumber,c=e.add,l=e.subtract,f=e.divide,p=e.multiply,m=e.partitionSelect,h=e.compare,d=e.isInteger,y=e.smaller,v=e.smallerEq,g=e.larger,a=Ki({typed:t,isInteger:d});return t(yp,{"Array | Matrix, number | BigNumber":function(e,t){return o(e,t,!1)},"Array | Matrix, number | BigNumber, number":function(e,t,r){return i(e,t,!1,r,o)},"Array | Matrix, number | BigNumber, boolean":o,"Array | Matrix, number | BigNumber, boolean, number":function(e,t,r,n){return i(e,t,r,n,o)},"Array | Matrix, Array | Matrix":function(e,t){return u(e,t,!1)},"Array | Matrix, Array | Matrix, number":function(e,t,r){return i(e,t,!1,r,u)},"Array | Matrix, Array | Matrix, boolean":u,"Array | Matrix, Array | Matrix, boolean, number":function(e,t,r,n){return i(e,t,r,n,u)}});function i(e,t,r,n,i){return a(e,n,function(e){return i(e,t,r)})}function o(e,t,r){var n=e.valueOf();if(y(t,0))throw new Error("N/prob must be non-negative");if(v(t,1))return Ee(t)?x(n,t,r):s(x(n,t,r));if(g(t,1)){if(!d(t))throw new Error("N must be a positive integer");if(g(t,4294967295))throw new Error("N must be less than or equal to 2^32-1, as that is the maximum length of an Array");for(var i=c(t,1),a=[],o=0;y(o,t);o++){var u=f(o+1,i);a.push(x(n,u,r))}return Ee(t)?a:s(a)}}function u(e,t,r){for(var n=e.valueOf(),i=t.valueOf(),a=[],o=0;o<i.length;++o)a.push(x(n,i[o],r));return a}function x(e,t,r){var n=E(e),e=n.length;if(0===e)throw new Error("Cannot calculate quantile of an empty sequence");var e=Ee(t)?t*(e-1):t.times(e-1),i=Ee(t)?Math.floor(e):e.floor().toNumber(),a=Ee(t)?e%1:e.minus(i);if(d(e))return r?n[e]:m(n,Ee(t)?e:e.valueOf());if(r)u=n[i],o=n[i+1];else for(var o=m(n,i+1),u=n[i],s=0;s<i;++s)0<h(n[s],u)&&(u=n[s]);return c(p(u,l(1,a)),p(o,a))}}),gp=N("std",["typed","map","sqrt","variance"],function(e){var t=e.typed,n=e.map,i=e.sqrt,a=e.variance;return t("std",{"Array | Matrix":r,"Array | Matrix, string":r,"Array | Matrix, number | BigNumber":r,"Array | Matrix, number | BigNumber, string":r,"...":function(e){return r(e)}});function r(e,t){if(0===e.length)throw new SyntaxError("Function std requires one or more parameters (0 provided)");try{var r=a.apply(null,arguments);return C(r)?n(r,i):i(r)}catch(e){throw e instanceof TypeError&&e.message.includes(" variance")?new TypeError(e.message.replace(" variance"," std")):e}}}),xp=N("corr",["typed","matrix","mean","sqrt","sum","add","subtract","multiply","pow","divide"],function(e){var t=e.typed,r=e.matrix,u=e.sqrt,s=e.sum,c=e.add,l=e.subtract,f=e.multiply,p=e.pow,m=e.divide;return t("corr",{"Array, Array":n,"Matrix, Matrix":function(e,t){e=n(e.toArray(),t.toArray());return Array.isArray(e)?r(e):e}});function n(e,t){var r=[];if(Array.isArray(e[0])&&Array.isArray(t[0])){if(e.length!==t.length)throw new SyntaxError("Dimension mismatch. Array A and B must have the same length.");for(var n=0;n<e.length;n++){if(e[n].length!==t[n].length)throw new SyntaxError("Dimension mismatch. Array A and B must have the same number of elements.");r.push(i(e[n],t[n]))}return r}if(e.length!==t.length)throw new SyntaxError("Dimension mismatch. Array A and B must have the same number of elements.");return i(e,t)}function i(e,n){var t=e.length,r=s(e),i=s(n),a=e.reduce(function(e,t,r){return c(e,f(t,n[r]))},0),e=s(e.map(function(e){return p(e,2)})),o=s(n.map(function(e){return p(e,2)})),a=l(f(t,a),f(r,i)),e=u(f(l(f(t,e),p(r,2)),l(f(t,o),p(i,2))));return m(a,e)}});function bp(e,t){if(t<e)return 1;if(t===e)return t;var r=t+e>>1;return bp(e,r)*bp(1+r,t)}function wp(e,t){if(!w(e)||e<0)throw new TypeError("Positive integer value expected in function combinations");if(!w(t)||t<0)throw new TypeError("Positive integer value expected in function combinations");if(e<t)throw new TypeError("k must be less than or equal to n");for(var r=e-t,n=1,i=2,a=t<r?t:r,o=t<r?1+r:t+1;o<=e;++o)for(n*=o;i<=a&&n%i==0;)n/=i,++i;return i<=a&&(n/=bp(i,a)),n}wp.signature="number, number";var Np="combinations",Dp=N(Np,["typed"],function(e){return(0,e.typed)(Np,{"number, number":wp,"BigNumber, BigNumber":function(e,t){var r,n,i=e.constructor,a=e.minus(t),o=new i(1);if(!Ep(e)||!Ep(t))throw new TypeError("Positive integer value expected in function combinations");if(t.gt(e))throw new TypeError("k must be less than n in function combinations");if(r=o,t.lt(a))for(n=o;n.lte(a);n=n.plus(o))r=r.times(t.plus(n)).dividedBy(n);else for(n=o;n.lte(t);n=n.plus(o))r=r.times(a.plus(n)).dividedBy(n);return r}})});function Ep(e){return e.isInteger()&&e.gte(0)}var Ap="combinationsWithRep",Sp=N(Ap,["typed"],function(e){return(0,e.typed)(Ap,{"number, number":function(e,t){if(!w(e)||e<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(!w(t)||t<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(e<1)throw new TypeError("k must be less than or equal to n + k - 1");return t<e-1?bp(e,e+t-1)/bp(1,t):bp(t+1,e+t-1)/bp(1,e-1)},"BigNumber, BigNumber":function(e,t){var r,n,i=new e.constructor(1),a=e.minus(i);if(!Cp(e)||!Cp(t))throw new TypeError("Positive integer value expected in function combinationsWithRep");if(e.lt(i))throw new TypeError("k must be less than or equal to n + k - 1 in function combinationsWithRep");if(r=i,t.lt(a))for(n=i;n.lte(a);n=n.plus(i))r=r.times(t.plus(n)).dividedBy(n);else for(n=i;n.lte(t);n=n.plus(i))r=r.times(a.plus(n)).dividedBy(n);return r}})});function Cp(e){return e.isInteger()&&e.gte(0)}function Mp(e){var t,r,n;if(w(e))return e<=0?isFinite(e)?1/0:NaN:171<e?1/0:bp(1,e-1);if(e<.5)return Math.PI/(Math.sin(Math.PI*e)*Mp(1-e));if(171.35<=e)return 1/0;if(85<e)return n=(r=(t=(o=e*e)*e)*e)*e,Math.sqrt(2*Math.PI/e)*Math.pow(e/Math.E,e)*(1+1/(12*e)+1/(288*o)-139/(51840*t)-571/(2488320*r)+163879/(209018880*n)+5246819/(75246796800*n*e));--e;for(var i=Op[0],a=1;a<Op.length;++a)i+=Op[a]/(e+a);var o=e+Fp+.5;return Math.sqrt(2*Math.PI)*Math.pow(o,e+.5)*Math.exp(-o)*i}var Fp=4.7421875,Op=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22],Tp=.9189385332046728,_p=[1.000000000190015,76.18009172947146,-86.50532032941678,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18];function Bp(e){if(e<0)return NaN;if(0===e)return 1/0;if(!isFinite(e))return e;if(e<.5)return Math.log(Math.PI/Math.sin(Math.PI*e))-Bp(1-e);for(var t=5+--e+.5,r=_p[0],n=6;1<=n;n--)r+=_p[n]/(e+n);return Tp+(e+.5)*Math.log(t)-t+Math.log(r)}Bp.signature=Mp.signature="number";var kp=N("gamma",["typed","config","multiplyScalar","pow","BigNumber","Complex"],function(e){var t=e.typed,o=e.config,u=(e.multiplyScalar,e.pow,e.BigNumber),s=e.Complex;return t("gamma",{number:Mp,Complex:function e(t){if(0===t.im)return Mp(t.re);if(t.re<.5)return o=new s(1-t.re,-t.im),a=new s(Math.PI*t.re,Math.PI*t.im),new s(Math.PI).div(a.sin()).div(e(o));t=new s(t.re-1,t.im);for(var r=new s(Op[0],0),n=1;n<Op.length;++n)var i=new s(Op[n],0),r=r.add(i.div(t.add(n)));var a=new s(t.re+Fp+.5,t.im),o=Math.sqrt(2*Math.PI),u=a.pow(t.add(.5)),a=a.neg().exp();return r.mul(o).mul(u).mul(a)},BigNumber:function(e){if(e.isInteger())return e.isNegative()||e.isZero()?new u(1/0):function e(t){if(t<8)return new u([1,1,2,6,24,120,720,5040][t]);var r=o.precision+(0|Math.log(t.toNumber())),r=u.clone({precision:r});if(t%2==1)return t.times(e(new u(t-1)));for(var n=t,i=new r(t),a=t.toNumber();2<n;)a+=n-=2,i=i.times(a);return new u(i.toPrecision(u.precision))}(e.minus(1));if(e.isFinite())throw new Error("Integer BigNumber expected");return new u(e.isNegative()?NaN:1/0)}})}),Ip=N("lgamma",["Complex","typed"],function(e){var c=e.Complex,e=e.typed,l=[-.029550653594771242,.00641025641025641,-.0019175269175269176,.0008417508417508417,-.0005952380952380953,.0007936507936507937,-.002777777777777778,.08333333333333333];return e("lgamma",{number:Bp,Complex:function e(t){return t.isNaN()?new c(NaN,NaN):0===t.im?new c(Bp(t.re),0):7<=t.re||7<=Math.abs(t.im)?a(t):t.re<=.1?(n=6.283185307179586,i=(!0^(0<(i=t.im)||!(i<0)&&1/i==1/0)?-n:n)*Math.floor(.5*t.re+.25),n=t.mul(Math.PI).sin().log(),r=e(new c(1-t.re,-t.im)),new c(1.1447298858494002,i).sub(n).sub(r)):0<=t.im?o(t):o(t.conjugate()).conjugate();var r,n,i},BigNumber:function(){throw new Error("mathjs doesn't yet provide an implementation of the algorithm lgamma for BigNumber")}});function a(e){for(var t=e.sub(.5).mul(e.log()).sub(e).add(Tp),r=new c(1,0).div(e),e=r.div(e),n=l[0],i=l[1],a=2*e.re,o=e.re*e.re+e.im*e.im,u=2;u<8;u++)var s=i,i=-o*n+l[u],n=a*n+s;r=r.mul(e.mul(n).add(i));return t.add(r)}function o(e){var t=0,r=0,n=e;for(e=e.add(1);e.re<=7;){var i=(n=n.mul(e)).im<0?1:0;0!=i&&0===r&&t++,r=i,e=e.add(1)}return a(e).sub(n.log()).sub(new c(0,2*t*Math.PI*1))}}),zp=N("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":t.referToSelf(function(t){return function(e){return ce(e,t)}})})}),Rp="kldivergence",qp=N(Rp,["typed","matrix","divide","sum","multiply","map","dotDivide","log","isNumeric"],function(e){var t=e.typed,r=e.matrix,i=e.divide,a=e.sum,o=e.multiply,u=e.map,s=e.dotDivide,c=e.log,l=e.isNumeric;return t(Rp,{"Array, Array":function(e,t){return n(r(e),r(t))},"Matrix, Array":function(e,t){return n(e,r(t))},"Array, Matrix":function(e,t){return n(r(e),t)},"Matrix, Matrix":n});function n(e,t){var r=t.size().length,n=e.size().length;if(1<r)throw new Error("first object must be one dimensional");if(1<n)throw new Error("second object must be one dimensional");if(r!==n)throw new Error("Length of two vectors must be equal");if(0===a(e))throw new Error("Sum of elements in first object must be non zero");if(0===a(t))throw new Error("Sum of elements in second object must be non zero");r=i(e,a(e)),n=i(t,a(t)),e=a(o(r,u(s(r,n),function(e){return c(e)})));return l(e)?e:Number.NaN}}),jp="multinomial",Pp=N(jp,["typed","add","divide","multiply","factorial","isInteger","isPositive"],function(e){var t=e.typed,n=e.add,i=e.divide,a=e.multiply,o=e.factorial,u=e.isInteger,s=e.isPositive;return t(jp,{"Array | Matrix":function(e){var t=0,r=1;return Un(e,function(e){if(!u(e)||!s(e))throw new TypeError("Positive integer value expected in function multinomial");t=n(t,e),r=a(r,o(e))}),i(o(t),r)}})}),Lp="permutations",Up=N(Lp,["typed","factorial"],function(e){var t=e.typed,e=e.factorial;return t(Lp,{"number | BigNumber":e,"number, number":function(e,t){if(!w(e)||e<0)throw new TypeError("Positive integer value expected in function permutations");if(!w(t)||t<0)throw new TypeError("Positive integer value expected in function permutations");if(e<t)throw new TypeError("second argument k must be less than or equal to first argument n");return bp(e-t+1,e)},"BigNumber, BigNumber":function(e,t){var r,n;if(!$p(e)||!$p(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 $p(e){return e.isInteger()&&e.gte(0)}Mh(9089);var Hp=Mh(7391),Gp=Hp(Date.now());function Vp(e){var t=null===e?Gp:Hp(String(e));return function(){return t()}}var Zp="pickRandom",Wp=N(Zp,["typed","config","?on"],function(e){var t=e.typed,r=e.config,e=e.on,d=Vp(r.randomSeed);return e&&e("config",function(e,t){e.randomSeed!==t.randomSeed&&(d=Vp(e.randomSeed))}),t(Zp,{"Array | Matrix":function(e){return n(e,{})},"Array | Matrix, Object":n,"Array | Matrix, number":function(e,t){return n(e,{number:t})},"Array | Matrix, Array | Matrix":function(e,t){return n(e,{weights:t})},"Array | Matrix, Array | Matrix, number":function(e,t,r){return n(e,{number:r,weights:t})},"Array | Matrix, number, Array | Matrix":function(e,t,r){return n(e,{number:t,weights:r})}});function n(e,t){var r=t.number,n=t.weights,t=t.elementWise,t=void 0===t||t,i=void 0===r,a=(i&&(r=1),P(e)?e.create:P(n)?n.create:null),o=(e=e.valueOf(),n=n&&n.valueOf(),!0===t&&(e=E(e),n=E(n)),0);if(void 0!==n){if(n.length!==e.length)throw new Error("Weights must have the same length as possibles");for(var u=0,s=n.length;u<s;u++){if(!Ee(n[u])||n[u]<0)throw new Error("Weights must be an array of positive numbers");o+=n[u]}}for(var c,l=e.length,f=[];f.length<r;){if(void 0===n)c=e[Math.floor(d()*l)];else for(var p=d()*o,m=0,h=e.length;m<h;m++)if((p-=n[m])<0){c=e[m];break}f.push(c)}return i?f[0]:a?a(f):f}});function Yp(e,t){var r=[];if(1<(e=e.slice(0)).length)for(var n=0,i=e.shift();n<i;n++)r.push(Yp(e,t));else for(var a=0,o=e.shift();a<o;a++)r.push(t());return r}var Jp=N("random",["typed","config","?on"],function(e){var t=e.typed,r=e.config,e=e.on,n=Vp(r.randomSeed);return e&&e("config",function(e,t){e.randomSeed!==t.randomSeed&&(n=Vp(e.randomSeed))}),t("random",{"":function(){return a(0,1)},number:function(e){return a(0,e)},"number, number":a,"Array | Matrix":function(e){return i(e,0,1)},"Array | Matrix, number":function(e,t){return i(e,0,t)},"Array | Matrix, number, number":i});function i(e,t,r){var n=Yp(e.valueOf(),function(){return a(t,r)});return P(e)?e.create(n):n}function a(e,t){return e+n()*(t-e)}}),Xp=N("randomInt",["typed","config","?on"],function(e){var t=e.typed,r=e.config,e=e.on,n=Vp(r.randomSeed);return e&&e("config",function(e,t){e.randomSeed!==t.randomSeed&&(n=Vp(e.randomSeed))}),t("randomInt",{"":function(){return a(0,1)},number:function(e){return a(0,e)},"number, number":a,"Array | Matrix":function(e){return i(e,0,1)},"Array | Matrix, number":function(e,t){return i(e,0,t)},"Array | Matrix, number, number":i});function i(e,t,r){var n=Yp(e.valueOf(),function(){return a(t,r)});return P(e)?e.create(n):n}function a(e,t){return Math.floor(e+n()*(t-e))}}),Qp="stirlingS2",Kp=N(Qp,["typed","addScalar","subtractScalar","multiplyScalar","divideScalar","pow","factorial","combinations","isNegative","isInteger","number","?bignumber","larger"],function(e){var t=e.typed,f=e.addScalar,p=(e.subtractScalar,e.multiplyScalar),m=(e.divideScalar,e.pow,e.factorial,e.combinations,e.isNegative),h=e.isInteger,d=e.number,y=e.bignumber,v=e.larger,g=[],x=[];return t(Qp,{"number | BigNumber, number | BigNumber":function(e,t){if(!h(e)||m(e)||!h(t)||m(t))throw new TypeError("Non-negative integer value expected in function stirlingS2");if(v(t,e))throw new TypeError("k must be less than or equal to n in function stirlingS2");var r=!(Ee(e)&&Ee(t)),n=r?x:g,i=r?y:d,a=d(e),o=d(t);if(n[a]&&n[a].length>o)return n[a][o];for(var u=0;u<=a;++u)if(n[u]||(n[u]=[i(0===u?1:0)]),0!==u)for(var s=n[u],c=n[u-1],l=s.length;l<=u&&l<=o;++l)s[l]=l===u?1:f(p(i(l),c[l]),c[l-1]);return n[a][o]}})}),em="bellNumbers",tm=N(em,["typed","addScalar","isNegative","isInteger","stirlingS2"],function(e){var t=e.typed,n=e.addScalar,i=e.isNegative,a=e.isInteger,o=e.stirlingS2;return t(em,{"number | BigNumber":function(e){if(!a(e)||i(e))throw new TypeError("Non-negative integer value expected in function bellNumbers");for(var t=0,r=0;r<=e;r++)t=n(t,o(e,r));return t}})}),rm=N("catalan",["typed","addScalar","divideScalar","multiplyScalar","combinations","isNegative","isInteger"],function(e){var t=e.typed,r=e.addScalar,n=e.divideScalar,i=e.multiplyScalar,a=e.combinations,o=e.isNegative,u=e.isInteger;return t("catalan",{"number | BigNumber":function(e){if(!u(e)||o(e))throw new TypeError("Non-negative integer value expected in function catalan");return n(a(i(e,2),e),r(e,1))}})}),nm="composition",im=N(nm,["typed","addScalar","combinations","isNegative","isPositive","isInteger","larger"],function(e){var t=e.typed,r=e.addScalar,n=e.combinations,i=e.isPositive,a=(e.isNegative,e.isInteger),o=e.larger;return t(nm,{"number | BigNumber, number | BigNumber":function(e,t){if(!(a(e)&&i(e)&&a(t)&&i(t)))throw new TypeError("Positive integer value expected in function composition");if(o(t,e))throw new TypeError("k must be less than or equal to n in function composition");return n(r(e,-1),r(t,-1))}})}),am=N("leafCount",["parse","typed"],function(e){return e.parse,(0,e.typed)("leafCount",{Node:function t(e){var r=0;return e.forEach(function(e){r+=t(e)}),r||1}})});function om(e){return ae(e)||oe(e)&&e.isUnary()&&ae(e.args[0])}function um(e){return!!ae(e)||!(!pe(e)&&!oe(e)||!e.args.every(um))||!(!ne(e)||!um(e.content))}function sm(t,e){var r,n=Object.keys(t);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)),n}function cm(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?sm(Object(r),!0).forEach(function(e){A(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):sm(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}Mh(2781);var lm=N("simplifyUtil",["FunctionNode","OperatorNode","SymbolNode"],function(e){var r=e.FunctionNode,n=e.OperatorNode,i=e.SymbolNode,a="defaultF",o={add:{trivial:!0,total:!0,commutative:!0,associative:!0},unaryPlus:{trivial:!0,total:!0,commutative:!0,associative:!0},subtract:{trivial:!1,total:!0,commutative:!1,associative:!1},multiply:{trivial:!0,total:!0,commutative:!0,associative:!0},divide:{trivial:!1,total:!0,commutative:!1,associative:!1},paren:{trivial:!0,total:!0,commutative:!0,associative:!1},defaultF:{trivial:!1,total:!0,commutative:!1,associative:!1}};function t(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:o,n=a;if("string"==typeof e?n=e:oe(e)?n=e.fn.toString():pe(e)?n=e.name:ne(e)&&(n="paren"),se(r,n)){var e=r[n];if(se(e,t))return e[t];if(se(o,n))return o[n][t]}if(se(r,a))return(se(e=r[a],t)?e:o[a])[t];if(se(o,n)){r=o[n];if(se(r,t))return r[t]}return o[a][t]}function u(e){return t(e,"associative",1<arguments.length&&void 0!==arguments[1]?arguments[1]:o)}function s(e,t){var i,a=[];return u(e,t)?(i=e.op,function e(t){for(var r=0;r<t.args.length;r++){var n=t.args[r];oe(n)&&i===n.op?e(n):a.push(n)}}(e),a):e.args}function c(t){return oe(t)?function(e){try{return new n(t.op,t.fn,e,t.implicit)}catch(e){return console.error(e),[]}}:function(e){return new r(new i(t.name),e)}}return{createMakeNodeFunction:c,hasProperty:t,isCommutative:function(e){return t(e,"commutative",1<arguments.length&&void 0!==arguments[1]?arguments[1]:o)},isAssociative:u,mergeContext:function(e,t){var r,n=cm({},e);for(r in t)se(e,r)?n[r]=cm(cm({},t[r]),e[r]):n[r]=t[r];return n},flatten:function e(t,r){if(!t.args||0===t.args.length)return t;t.args=s(t,r);for(var n=0;n<t.args.length;n++)e(t.args[n],r)},allChildren:s,unflattenr:function e(t,r){if(t.args&&0!==t.args.length){for(var n=c(t),i=t.args.length,a=0;a<i;a++)e(t.args[a],r);if(2<i&&u(t,r)){for(var o=t.args.pop();0<t.args.length;)o=n([t.args.pop(),o]);t.args=o.args}}},unflattenl:function e(t,r){if(t.args&&0!==t.args.length){for(var n=c(t),i=t.args.length,a=0;a<i;a++)e(t.args[a],r);if(2<i&&u(t,r)){for(var o=t.args.shift();0<t.args.length;)o=n([o,t.args.shift()]);t.args=o.args}}},defaultContext:o,realContext:{divide:{total:!1},log:{total:!1}},positiveContext:{subtract:{total:!1},abs:{trivial:!0},log:{total:!0}}}}),fm=N("simplify",["config","typed","parse","add","subtract","multiply","divide","pow","isZero","equal","resolve","simplifyConstant","simplifyCore","?fraction","?bignumber","mathWithTransform","matrix","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],function(e){e.config;var t=e.typed,p=e.parse,m=(e.add,e.subtract,e.multiply,e.divide,e.pow,e.isZero,e.equal),h=e.resolve,r=e.simplifyConstant,n=e.simplifyCore,d=(e.fraction,e.bignumber,e.mathWithTransform,e.matrix,e.AccessorNode),y=e.ArrayNode,v=e.ConstantNode,g=e.FunctionNode,x=e.IndexNode,b=e.ObjectNode,w=e.OperatorNode,N=e.ParenthesisNode,D=e.SymbolNode,e=lm({FunctionNode:g,OperatorNode:w,SymbolNode:D}),E=e.hasProperty,A=e.isCommutative,S=e.isAssociative,C=e.mergeContext,M=e.flatten,F=e.unflattenr,O=e.unflattenl,T=e.createMakeNodeFunction,i=e.defaultContext,a=e.realContext,e=e.positiveContext,_=(t.addConversion({from:"Object",to:"Map",convert:lt}),t("simplify",{Node:o,"Node, Map":function(e,t){return o(e,!1,t)},"Node, Map, Object":function(e,t,r){return o(e,!1,t,r)},"Node, Array":o,"Node, Array, Map":o,"Node, Array, Map, Object":o}));function B(e){return e.transform(function(e,t,r){return ne(e)?B(e.content):e})}t.removeConversion({from:"Object",to:"Map",convert:lt}),_.defaultContext=i,_.realContext=a,_.positiveContext=e;var k={true:!0,false:!0,e:!0,i:!0,Infinity:!0,LN2:!0,LN10:!0,LOG2E:!0,LOG10E:!0,NaN:!0,phi:!0,pi:!0,SQRT1_2:!0,SQRT2:!0,tau:!0};_.rules=[n,{l:"log(e)",r:"1"},{s:"n-n1 -> n+-n1",assuming:{subtract:{total:!0}}},{s:"n-n -> 0",assuming:{subtract:{total:!1}}},{s:"-(cl*v) -> v * (-cl)",assuming:{multiply:{commutative:!0},subtract:{total:!0}}},{s:"-(cl*v) -> (-cl) * v",assuming:{multiply:{commutative:!1},subtract:{total:!0}}},{s:"-(v*cl) -> v * (-cl)",assuming:{multiply:{commutative:!1},subtract:{total:!0}}},{l:"-(n1/n2)",r:"-n1/n2"},{l:"-v",r:"v * (-1)"},{l:"(n1 + n2)*(-1)",r:"n1*(-1) + n2*(-1)",repeat:!0},{l:"n/n1^n2",r:"n*n1^-n2"},{l:"n/n1",r:"n*n1^-1"},{s:"(n1*n2)^n3 -> n1^n3 * n2^n3",assuming:{multiply:{commutative:!0}}},{s:"(n1*n2)^(-1) -> n2^(-1) * n1^(-1)",assuming:{multiply:{commutative:!1}}},{s:"(n ^ n1) ^ n2 -> n ^ (n1 * n2)",assuming:{divide:{total:!0}}},{l:" vd * ( vd * n1 + n2)",r:"vd^2 * n1 + vd * n2"},{s:" vd * (vd^n4 * n1 + n2) -> vd^(1+n4) * n1 + vd * n2",assuming:{divide:{total:!0}}},{s:"vd^n3 * ( vd * n1 + n2) -> vd^(n3+1) * n1 + vd^n3 * n2",assuming:{divide:{total:!0}}},{s:"vd^n3 * (vd^n4 * n1 + n2) -> vd^(n3+n4) * n1 + vd^n3 * n2",assuming:{divide:{total:!0}}},{l:"n*n",r:"n^2"},{s:"n * n^n1 -> n^(n1+1)",assuming:{divide:{total:!0}}},{s:"n^n1 * n^n2 -> n^(n1+n2)",assuming:{divide:{total:!0}}},r,{s:"n+n -> 2*n",assuming:{add:{total:!0}}},{l:"n+-n",r:"0"},{l:"vd*n + vd",r:"vd*(n+1)"},{l:"n3*n1 + n3*n2",r:"n3*(n1+n2)"},{l:"n3^(-n4)*n1 + n3 * n2",r:"n3^(-n4)*(n1 + n3^(n4+1) *n2)"},{l:"n3^(-n4)*n1 + n3^n5 * n2",r:"n3^(-n4)*(n1 + n3^(n4+n5)*n2)"},{s:"n*vd + vd -> (n+1)*vd",assuming:{multiply:{commutative:!1}}},{s:"vd + n*vd -> (1+n)*vd",assuming:{multiply:{commutative:!1}}},{s:"n1*n3 + n2*n3 -> (n1+n2)*n3",assuming:{multiply:{commutative:!1}}},{s:"n^n1 * n -> n^(n1+1)",assuming:{divide:{total:!0},multiply:{commutative:!1}}},{s:"n1*n3^(-n4) + n2 * n3 -> (n1 + n2*n3^(n4 + 1))*n3^(-n4)",assuming:{multiply:{commutative:!1}}},{s:"n1*n3^(-n4) + n2 * n3^n5 -> (n1 + n2*n3^(n4 + n5))*n3^(-n4)",assuming:{multiply:{commutative:!1}}},{l:"n*cd + cd",r:"(n+1)*cd"},{s:"cd*n + cd -> cd*(n+1)",assuming:{multiply:{commutative:!1}}},{s:"cd + cd*n -> cd*(1+n)",assuming:{multiply:{commutative:!1}}},r,{s:"(-n)*n1 -> -(n*n1)",assuming:{subtract:{total:!0}}},{s:"n1*(-n) -> -(n1*n)",assuming:{subtract:{total:!0},multiply:{commutative:!1}}},{s:"ce+ve -> ve+ce",assuming:{add:{commutative:!0}},imposeContext:{add:{commutative:!1}}},{s:"vd*cd -> cd*vd",assuming:{multiply:{commutative:!0}},imposeContext:{multiply:{commutative:!1}}},{l:"n+-n1",r:"n-n1"},{l:"n+-(n1)",r:"n-(n1)"},{s:"n*(n1^-1) -> n/n1",assuming:{multiply:{commutative:!0}}},{s:"n*n1^-n2 -> n/n1^n2",assuming:{multiply:{commutative:!0}}},{s:"n^-1 -> 1/n",assuming:{multiply:{commutative:!0}}},{l:"n^1",r:"n"},{s:"n*(n1/n2) -> (n*n1)/n2",assuming:{multiply:{associative:!0}}},{s:"n-(n1+n2) -> n-n1-n2",assuming:{addition:{associative:!0,commutative:!0}}},{l:"1*n",r:"n",imposeContext:{multiply:{commutative:!0}}},{s:"n1/(n2/n3) -> (n1*n3)/n2",assuming:{multiply:{associative:!0}}},{l:"n1/(-n2)",r:"-n1/n2"}];var I=0;function z(){return new D("_p"+I++)}function o(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:ct(),n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{},i=n.consoleDebug;t=function(e,t){for(var r=[],n=0;n<e.length;n++){var i=e[n],a=void 0,o=V(i);switch(o){case"string":i={s:i};case"object":a=function(e,t){var r={};if(e.s){var n=e.s.split("->");if(2!==n.length)throw SyntaxError("Could not parse rule: "+e.s);r.l=n[0],r.r=n[1]}else r.l=e.l,r.r=e.r;r.l=B(p(r.l)),r.r=B(p(r.r));for(var i,a,o,u=0,s=["imposeContext","repeat","assuming"];u<s.length;u++){var c=s[u];c in e&&(r[c]=e[c])}return e.evaluate&&(r.evaluate=p(e.evaluate)),S(r.l,t)&&((n=!A(r.l,t))&&(i=z()),a=T(r.l),o=z(),r.expanded={},r.expanded.l=a([r.l,o]),M(r.expanded.l,t),F(r.expanded.l,t),r.expanded.r=a([r.r,o]),n&&(r.expandedNC1={},r.expandedNC1.l=a([i,r.l]),r.expandedNC1.r=a([i,r.r]),r.expandedNC2={},r.expandedNC2.l=a([i,r.expanded.l]),r.expandedNC2.r=a([i,r.expanded.r]))),r}(i,t);break;case"function":a=i;break;default:throw TypeError("Unsupported type of rule: "+o)}r.push(a)}return r}(t||_.rules,n.context);for(var a=h(e,r),o={},u=(a=B(a)).toString({parenthesis:"all"});!o[u];){o[u]=!0,I=0;var s=u;i&&console.log("Working on: ",u);for(var c=0;c<t.length;c++){var l,f="";"function"==typeof t[c]?(a=t[c](a,n),i&&(f=t[c].name)):(M(a,n.context),a=q(a,t[c],n.context),i&&(f="".concat(t[c].l.toString()," -> ").concat(t[c].r.toString()))),i&&(l=a.toString({parenthesis:"all"}))!==s&&(console.log("Applying",f,"produced",l),s=l),O(a,n.context)}u=a.toString({parenthesis:"all"})}return a}function R(e,t,r){var n=e;if(e)for(var i=0;i<e.length;++i){var a=q(e[i],t,r);a!==e[i]&&((n=n===e?e.slice():n)[i]=a)}return n}function q(e,t,r){if(t.assuming)for(var n in t.assuming)for(var i in t.assuming[n])if(E(n,i,r)!==t.assuming[n][i])return e;var a=C(t.imposeContext,r),o=e;if(o instanceof w||o instanceof g){var u=R(o.args,t,r);u!==o.args&&((o=o.clone()).args=u)}else if(o instanceof N)!o.content||(u=q(o.content,t,r))!==o.content&&(o=new N(u));else if(o instanceof y){u=R(o.items,t,r);u!==o.items&&(o=new y(u))}else if(o instanceof d){var u=o.object,s=(o.object&&(u=q(o.object,t,r)),o.index);o.index&&(s=q(o.index,t,r)),u===o.object&&s===o.index||(o=new d(u,s))}else if(o instanceof x){u=R(o.dimensions,t,r);u!==o.dimensions&&(o=new x(u))}else if(o instanceof b){var c,l=!1,f={};for(c in o.properties)f[c]=q(o.properties[c],t,r),f[c]!==o.properties[c]&&(l=!0);l&&(o=new b(f))}var s=t.r,p=j(t.l,o,a)[0];return!p&&t.expanded&&(s=t.expanded.r,p=j(t.expanded.l,o,a)[0]),!p&&t.expandedNC1&&(s=t.expandedNC1.r,(p=j(t.expandedNC1.l,o,a)[0])||(s=t.expandedNC2.r,p=j(t.expandedNC2.l,o,a)[0])),p&&(u=o.implicit,o=s.clone(),u&&"implicit"in s&&(o.implicit=!0),o=o.transform(function(e){return e.isSymbolNode&&se(p.placeholders,e.name)?p.placeholders[e.name].clone():e})),o=t.repeat&&o!==e?q(o,t,r):o}function u(e,t){var r,n,i={placeholders:{}};if(!e.placeholders&&!t.placeholders)return i;if(!e.placeholders)return t;if(!t.placeholders)return e;for(r in e.placeholders)if(se(e.placeholders,r)&&(i.placeholders[r]=e.placeholders[r],se(t.placeholders,r)&&!function e(t,r){if(t instanceof v&&r instanceof v){if(!m(t.value,r.value))return!1}else if(t instanceof D&&r instanceof D){if(t.name!==r.name)return!1}else{if(!(t instanceof w&&r instanceof w||t instanceof g&&r instanceof g))return!1;if(t instanceof w){if(t.op!==r.op||t.fn!==r.fn)return!1}else if(t instanceof g&&t.name!==r.name)return!1;if(t.args.length!==r.args.length)return!1;for(var n=0;n<t.args.length;n++)if(!e(t.args[n],r.args[n]))return!1}return!0}(e.placeholders[r],t.placeholders[r])))return null;for(n in t.placeholders)se(t.placeholders,n)&&(i.placeholders[n]=t.placeholders[n]);return i}function P(e,t){var r,n=[];if(0===e.length||0===t.length)return n;for(var i=0;i<e.length;i++)for(var a=0;a<t.length;a++)(r=u(e[i],t[a]))&&n.push(r);return n}function j(e,t,r,n){var i=[{placeholders:{}}];if(e instanceof w&&t instanceof w||e instanceof g&&t instanceof g){if(e instanceof w){if(e.op!==t.op||e.fn!==t.fn)return[]}else if(e instanceof g&&e.name!==t.name)return[];if(!(1===t.args.length&&1===e.args.length||!S(t,r)&&t.args.length===e.args.length||n)){if(2<=t.args.length&&2===e.args.length){for(var a=function(e,t){var r,n,i=[],a=T(e);if(A(e,t))for(var o=0;o<e.args.length;o++)(n=e.args.slice(0)).splice(o,1),r=1===n.length?n[0]:a(n),i.push(a([e.args[o],r]));else for(var u=1;u<e.args.length;u++){var s=e.args[0];1<u&&(s=a(e.args.slice(0,u))),r=1===(n=e.args.slice(u)).length?n[0]:a(n),i.push(a([s,r]))}return i}(t,r),o=[],u=0;u<a.length;u++)var s=j(e,a[u],r,!0),o=o.concat(s);return o}if(2<e.args.length)throw Error("Unexpected non-binary associative function: "+e.toString());return[]}for(var c=[],l=0;l<e.args.length;l++){var f=j(e.args[l],t.args[l],r);if(0===f.length)break;c.push(f)}if(c.length!==e.args.length){if(!A(t,r)||1===e.args.length)return[];if(2<e.args.length)throw new Error("permuting >2 commutative non-associative rule arguments not yet implemented");n=j(e.args[0],t.args[1],r);if(0===n.length)return[];var p=j(e.args[1],t.args[0],r);if(0===p.length)return[];c=[n,p]}i=function(e){if(0===e.length)return e;for(var t=e.reduce(P),r=[],n={},i=0;i<t.length;i++){var a=JSON.stringify(t[i]);n[a]||(n[a]=!0,r.push(t[i]))}return r}(c)}else if(e instanceof D){if(0===e.name.length)throw new Error("Symbol in rule has 0 length...!?");if(k[e.name]){if(e.name!==t.name)return[]}else switch("a"<=e.name[1]&&e.name[1]<="z"?e.name.substring(0,2):e.name[0]){case"n":case"_p":i[0].placeholders[e.name]=t;break;case"c":case"cl":if(!ae(t))return[];i[0].placeholders[e.name]=t;break;case"v":if(ae(t))return[];i[0].placeholders[e.name]=t;break;case"vl":if(!ue(t))return[];i[0].placeholders[e.name]=t;break;case"cd":if(!om(t))return[];i[0].placeholders[e.name]=t;break;case"vd":if(om(t))return[];i[0].placeholders[e.name]=t;break;case"ce":if(!um(t))return[];i[0].placeholders[e.name]=t;break;case"ve":if(um(t))return[];i[0].placeholders[e.name]=t;break;default:throw new Error("Invalid symbol in rule: "+e.name)}}else{if(!(e instanceof v))return[];if(!m(e.value,t.value))return[]}return i}return _});function pm(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var mm=N("simplifyConstant",["typed","config","mathWithTransform","matrix","?fraction","?bignumber","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","SymbolNode"],function(e){var t=e.typed,r=e.config,N=e.mathWithTransform,D=e.matrix,n=e.fraction,i=e.bignumber,E=e.AccessorNode,A=e.ArrayNode,S=e.ConstantNode,C=e.FunctionNode,M=e.IndexNode,F=e.ObjectNode,a=e.OperatorNode,e=e.SymbolNode,e=lm({FunctionNode:C,OperatorNode:a,SymbolNode:e}),O=e.isCommutative,T=e.isAssociative,_=e.allChildren,B=e.createMakeNodeFunction,k=t("simplifyConstant",{Node:function(e){return z(j(e,{}))},"Node, Object":function(e,t){return z(j(e,t))}});function o(e){return Te(e)?e.valueOf():e instanceof Array?e.map(o):P(e)?D(o(e.valueOf())):e}function I(t,r,n){try{return N[t].apply(null,r)}catch(e){return r=r.map(o),R(N[t].apply(null,r),n)}}var u=t({Fraction:function(e){var t=e.s*e.n,t=t<0?new a("-","unaryMinus",[new S(-t)]):new S(t);return 1===e.d?t:new a("/","divide",[t,new S(e.d)])},number:function(e){return e<0?c(new S(-e)):new S(e)},BigNumber:function(e){return e<0?c(new S(-e)):new S(e)},Complex:function(e){throw new Error("Cannot convert Complex number to Node")},string:function(e){return new S(e)},Matrix:function(e){return new A(e.valueOf().map(function(e){return u(e)}))}});function z(e){return L(e)?e:u(e)}function s(e,t){if(t&&!1!==t.exactFractions&&isFinite(e)&&n){var r=n(e),t=t&&"number"==typeof t.fractionsLimit?t.fractionsLimit:1/0;if(r.valueOf()===e&&r.n<t&&r.d<t)return r}return e}var R=t({"string, Object":function(e,t){return"BigNumber"===r.number?(void 0===i&&$o(),i(e)):"Fraction"===r.number?(void 0===n&&Ho(),n(e)):s(parseFloat(e),t)},"Fraction, Object":function(e,t){return e},"BigNumber, Object":function(e,t){return e},"number, Object":s,"Complex, Object":function(e,t){return 0!==e.im?e:s(e.re,t)},"Matrix, Object":function(e,t){return D(s(e.valueOf()))},"Array, Object":function(e,t){return e.map(s)}});function c(e){return new a("-","unaryMinus",[e])}function q(n,e,i,a){var t=e.shift(),e=e.reduce(function(t,e){if(!L(e)){var r=t.pop();if(L(r))return[r,e];try{return t.push(I(n,[r,e],a)),t}catch(e){t.push(r)}}t.push(z(t.pop()));r=1===t.length?t[0]:i(t);return[i([r,z(e)])]},[t]);return 1===e.length?e[0]:i([e[0],u(e[1])])}function j(e,t){switch(e.type){case"SymbolNode":return e;case"ConstantNode":switch(V(e.value)){case"number":return R(e.value,t);case"string":return e.value;default:if(!isNaN(e.value))return R(e.value,t)}return e;case"FunctionNode":if(N[e.name]&&N[e.name].rawArgs)return e;if(!["add","multiply"].includes(e.name)){var r=e.args.map(function(e){return j(e,t)});if(!r.some(L))try{return I(e.name,r,t)}catch(e){}if("size"===e.name&&1===r.length&&J(r[0])){for(var n=[],i=r[0];J(i);)n.push(i.items.length),i=i.items[0];return D(n)}return new C(e.name,r.map(z))}case"OperatorNode":var a,r=e.fn.toString(),o=B(e);if(oe(e)&&e.isUnary())x=L((a=[j(e.args[0],t)])[0])?o(a):I(r,a,t);else if(T(e,t.context))if(a=(a=_(e,t.context)).map(function(e){return j(e,t)}),O(r,t.context)){for(var u=[],s=[],c=0;c<a.length;c++)(L(a[c])?s:u).push(a[c]);x=1<u.length?(x=q(r,u,o,t),s.unshift(x),q(r,s,o,t)):q(r,a,o,t)}else x=q(r,a,o,t);else x=q(r,a=e.args.map(function(e){return j(e,t)}),o,t);return x;case"ParenthesisNode":return j(e.content,t);case"AccessorNode":var l=j(e.object,t),r=j(e.index,t),f=t;if(!te(r))return new E(z(l),z(r));if(J(l)||P(l)){for(var p=Array.from(r.dimensions);0<p.length;)if(ae(p[0])&&"string"!=typeof p[0].value){var m=R(p.shift().value,f);J(l)?l=l.items[m-1]:(l=l.valueOf()[m-1])instanceof Array&&(l=D(l))}else{if(!(1<p.length&&ae(p[1])&&"string"!=typeof p[1].value))break;var h,d=R(p[1].value,f),y=[],m=J(l)?l.items:l.valueOf(),v=function(e,t){var r,n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e){if(e){if("string"==typeof e)return pm(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(t="Object"===t&&e.constructor?e.constructor.name:t)||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?pm(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length)return n&&(e=n),r=0,{s:t=function(){},n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,o=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){o=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(o)throw i}}}}(m);try{for(v.s();!(h=v.n()).done;){var g=h.value;if(J(g))y.push(g.items[d-1]);else{if(!P(l))break;y.push(g[d-1])}}}catch(l){v.e(l)}finally{v.f()}if(y.length!==m.length)break;l=J(l)?new A(y):D(y),p.splice(1,1)}return p.length===r.dimensions.length?new E(z(l),r):0<p.length?(r=new M(p),new E(z(l),r)):l}return re(l)&&1===r.dimensions.length&&ae(r.dimensions[0])?(o=r.dimensions[0].value)in l.properties?l.properties[o]:new S:new E(z(l),r);case"ArrayNode":var x=e.items.map(function(e){return j(e,t)});return x.some(L)?new A(x.map(z)):D(x);case"IndexNode":return new M(e.dimensions.map(function(e){return k(e,t)}));case"ObjectNode":var b,w={};for(b in e.properties)w[b]=k(e.properties[b],t);return new F(w);default:throw new Error("Unimplemented node type in simplifyConstant: ".concat(e.type))}}return k}),hm="simplifyCore",dm=N(hm,["typed","parse","equal","isZero","add","subtract","multiply","divide","pow","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],function(e){var t=e.typed,p=(e.parse,e.equal),m=e.isZero,h=(e.add,e.subtract,e.multiply,e.divide,e.pow,e.AccessorNode),d=e.ArrayNode,r=e.ConstantNode,y=e.FunctionNode,v=e.IndexNode,g=e.ObjectNode,x=e.OperatorNode,e=(e.ParenthesisNode,e.SymbolNode),b=new r(0),w=new r(1),N=new r(!0),D=new r(!1);function E(e){return oe(e)&&["and","not","or"].includes(e.op)}var r=lm({FunctionNode:y,OperatorNode:x,SymbolNode:e}),A=r.hasProperty,S=r.isCommutative;function C(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r=t?t.context:void 0;if(A(e,"trivial",r)){if(pe(e)&&1===e.args.length)return C(e.args[0],t);var n=!1,i=0;if(e.forEach(function(e){1==++i&&(n=C(e,t))}),1===i)return n}var a=e;if(pe(a)){var o=function(){var e,t="OperatorNode:"+a.name,r=function(e){var t,r,n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e){if(e){if("string"==typeof e)return El(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(t="Object"===t&&e.constructor?e.constructor.name:t)||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?El(e,void 0):void 0}}(e)))return n&&(e=n),t=0,{s:r=function(){},n:function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}},e:function(e){throw e},f:r};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,o=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){o=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(o)throw i}}}}(Al);try{for(r.s();!(e=r.n()).done;){var n=e.value;if(t in n)return n[t].op}}catch(e){r.e(e)}finally{r.f()}return null}();if(!o)return new y(C(a.fn),a.args.map(function(e){return C(e,t)}));if(2<a.args.length&&A(a,"associative",r))for(;2<a.args.length;){var u=a.args.pop(),s=a.args.pop();a.args.push(new x(o,a.name,[u,s]))}a=new x(o,a.name,a.args)}if(oe(a)&&a.isUnary()){e=C(a.args[0],t);if("~"===a.op&&oe(e)&&e.isUnary()&&"~"===e.op)return e.args[0];if("not"===a.op&&oe(e)&&e.isUnary()&&"not"===e.op&&E(e.args[0]))return e.args[0];var c=!0;if("-"===a.op&&oe(e)&&(e.isBinary()&&"subtract"===e.fn&&(a=new x("-","subtract",[e.args[1],e.args[0]]),c=!1),e.isUnary()&&"-"===e.op))return e.args[0];if(c)return new x(a.op,a.fn,[e])}if(oe(a)&&a.isBinary()){c=C(a.args[0],t),e=C(a.args[1],t);if("+"===a.op){if(ae(c)&&m(c.value))return e;if(ae(e)&&m(e.value))return c;oe(e)&&e.isUnary()&&"-"===e.op&&(e=e.args[0],a=new x("-","subtract",[c,e]))}if("-"===a.op)return oe(e)&&e.isUnary()&&"-"===e.op?C(new x("+","add",[c,e.args[0]]),t):ae(c)&&m(c.value)?C(new x("-","unaryMinus",[e])):ae(e)&&m(e.value)?c:new x(a.op,a.fn,[c,e]);if("*"===a.op){if(ae(c)){if(m(c.value))return b;if(p(c.value,1))return e}if(ae(e)){if(m(e.value))return b;if(p(e.value,1))return c;if(S(a,r))return new x(a.op,a.fn,[e,c],a.implicit)}return new x(a.op,a.fn,[c,e],a.implicit)}if("/"===a.op)return ae(c)&&m(c.value)?b:ae(e)&&p(e.value,1)?c:new x(a.op,a.fn,[c,e]);if("^"===a.op&&ae(e)){if(m(e.value))return w;if(p(e.value,1))return c}if("and"===a.op){if(ae(c)){if(!c.value)return D;if(E(e))return e;if(ae(e))return e.value?N:D}if(ae(e)){if(!e.value)return D;if(E(c))return c}}if("or"===a.op){if(ae(c)){if(c.value)return N;if(E(e))return e}if(ae(e)){if(e.value)return N;if(E(c))return c}}return new x(a.op,a.fn,[c,e])}if(oe(a))return new x(a.op,a.fn,a.args.map(function(e){return C(e,t)}));if(J(a))return new d(a.items.map(function(e){return C(e,t)}));if(le(a))return new h(C(a.object,t),C(a.index,t));if(te(a))return new v(a.dimensions.map(function(e){return C(e,t)}));if(re(a)){var l,f={};for(l in a.properties)f[l]=C(a.properties[l],t);return new g(f)}return a}return t(hm,{Node:C,"Node,Object":C})}),ym=N("resolve",["typed","parse","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode"],function(e){var t=e.typed,a=e.parse,o=e.ConstantNode,u=e.FunctionNode,s=e.OperatorNode,c=e.ParenthesisNode;function l(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:new Set;if(!t)return e;if(ue(e)){if(r.has(e.name))throw i=Array.from(r).join(", "),new ReferenceError("recursive loop of variable definitions among {".concat(i,"}"));var n,i=t.get(e.name);return L(i)?((n=new Set(r)).add(e.name),l(i,t,n)):"number"==typeof i?a(String(i)):void 0!==i?new o(i):e}return oe(e)?(n=e.args.map(function(e){return l(e,t,r)}),new s(e.op,e.fn,n,e.implicit)):ne(e)?new c(l(e.content,t,r)):pe(e)?(i=e.args.map(function(e){return l(e,t,r)}),new u(e.name,i)):e.map(function(e){return l(e,t,r)})}return t("resolve",{Node:l,"Node, Map | null | undefined":l,"Node, Object":function(e,t){return l(e,lt(t))},"Array | Matrix":t.referToSelf(function(t){return function(e){return e.map(function(e){return t(e)})}}),"Array | Matrix, null | undefined":t.referToSelf(function(t){return function(e){return e.map(function(e){return t(e)})}}),"Array, Object":t.referTo("Array,Map",function(r){return function(e,t){return r(e,lt(t))}}),"Matrix, Object":t.referTo("Matrix,Map",function(r){return function(e,t){return r(e,lt(t))}}),"Array | Matrix, Map":t.referToSelf(function(r){return function(e,t){return e.map(function(e){return r(e,t)})}})})}),vm="symbolicEqual",gm=N(vm,["parse","simplify","typed","OperatorNode"],function(e){e.parse;var n=e.simplify,t=e.typed,i=e.OperatorNode;function r(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},e=new i("-","subtract",[e,t]),t=n(e,{},r);return ae(t)&&!t.value}return t(vm,{"Node, Node":r,"Node, Node, Object":r})}),xm="derivative",bm=N(xm,["typed","config","parse","simplify","equal","isZero","numeric","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode","SymbolNode"],function(e){var t=e.typed,r=e.config,n=e.parse,i=e.simplify,a=e.equal,o=e.isZero,u=e.numeric,s=e.ConstantNode,l=e.FunctionNode,f=e.OperatorNode,c=e.ParenthesisNode,p=e.SymbolNode;function m(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{simplify:!0},n={},t=(d(n,e,t.name),y(e,n));return r.simplify?i(t):t}t.addConversion({from:"identifier",to:"SymbolNode",convert:n});var e=t(xm,{"Node, SymbolNode":m,"Node, SymbolNode, Object":m}),h=(t.removeConversion({from:"identifier",to:"SymbolNode",convert:n}),e._simplify=!0,e.toTex=function(e){return h.apply(null,e.args)},t("_derivTex",{"Node, SymbolNode":function(e,t){return ae(e)&&"string"===Se(e.value)?h(n(e.value).toString(),t.toString(),1):h(e.toTex(),t.toString(),1)},"Node, ConstantNode":function(e,t){if("string"===Se(t.value))return h(e,n(t.value));throw new Error("The second parameter to 'derivative' is a non-string constant")},"Node, SymbolNode, ConstantNode":function(e,t,r){return h(e.toString(),t.name,r.value)},"string, string, number":function(e,t,r){return(1===r?"{d\\over d"+t+"}":"{d^{"+r+"}\\over d"+t+"^{"+r+"}}")+"\\left[".concat(e,"\\right]")}})),d=t("constTag",{"Object, ConstantNode, string":function(e,t){return e[t]=!0},"Object, SymbolNode, string":function(e,t,r){return t.name!==r&&(e[t]=!0)},"Object, ParenthesisNode, string":function(e,t,r){return d(e,t.content,r)},"Object, FunctionAssignmentNode, string":function(e,t,r){return t.params.includes(r)?d(e,t.expr,r):e[t]=!0},"Object, FunctionNode | OperatorNode, string":function(e,t,r){if(0<t.args.length){for(var n=d(e,t.args[0],r),i=1;i<t.args.length;++i)n=d(e,t.args[i],r)&&n;if(n)return e[t]=!0}return!1}}),y=t("_derivative",{"ConstantNode, Object":function(e){return v(0)},"SymbolNode, Object":function(e,t){return void 0!==t[e]?v(0):v(1)},"ParenthesisNode, Object":function(e,t){return new c(y(e.content,t))},"FunctionAssignmentNode, Object":function(e,t){return void 0!==t[e]?v(0):y(e.expr,t)},"FunctionNode, Object":function(e,t){if(void 0!==t[e])return v(0);var r,n,i,a=e.args[0],o=!1,u=!1;switch(e.name){case"cbrt":o=!0,n=new f("*","multiply",[v(3),new f("^","pow",[a,new f("/","divide",[v(2),v(3)])])]);break;case"sqrt":case"nthRoot":if(1===e.args.length)o=!0,n=new f("*","multiply",[v(2),new l("sqrt",[a])]);else if(2===e.args.length)return t[r=new f("/","divide",[v(1),e.args[1]])]=t[e.args[1]],y(new f("^","pow",[a,r]),t);break;case"log10":r=v(10);case"log":if(r||1!==e.args.length){if(1===e.args.length&&r||2===e.args.length&&void 0!==t[e.args[1]])n=new f("*","multiply",[a.clone(),new l("log",[r||e.args[1]])]),o=!0;else if(2===e.args.length)return y(new f("/","divide",[new l("log",[a]),new l("log",[e.args[1]])]),t)}else n=a.clone(),o=!0;break;case"pow":if(2===e.args.length)return t[r]=t[e.args[1]],y(new f("^","pow",[a,e.args[1]]),t);break;case"exp":n=new l("exp",[a.clone()]);break;case"sin":n=new l("cos",[a.clone()]);break;case"cos":n=new f("-","unaryMinus",[new l("sin",[a.clone()])]);break;case"tan":n=new f("^","pow",[new l("sec",[a.clone()]),v(2)]);break;case"sec":n=new f("*","multiply",[e,new l("tan",[a.clone()])]);break;case"csc":u=!0,n=new f("*","multiply",[e,new l("cot",[a.clone()])]);break;case"cot":u=!0,n=new f("^","pow",[new l("csc",[a.clone()]),v(2)]);break;case"asin":o=!0,n=new l("sqrt",[new f("-","subtract",[v(1),new f("^","pow",[a.clone(),v(2)])])]);break;case"acos":u=o=!0,n=new l("sqrt",[new f("-","subtract",[v(1),new f("^","pow",[a.clone(),v(2)])])]);break;case"atan":o=!0,n=new f("+","add",[new f("^","pow",[a.clone(),v(2)]),v(1)]);break;case"asec":o=!0,n=new f("*","multiply",[new l("abs",[a.clone()]),new l("sqrt",[new f("-","subtract",[new f("^","pow",[a.clone(),v(2)]),v(1)])])]);break;case"acsc":u=o=!0,n=new f("*","multiply",[new l("abs",[a.clone()]),new l("sqrt",[new f("-","subtract",[new f("^","pow",[a.clone(),v(2)]),v(1)])])]);break;case"acot":u=o=!0,n=new f("+","add",[new f("^","pow",[a.clone(),v(2)]),v(1)]);break;case"sinh":n=new l("cosh",[a.clone()]);break;case"cosh":n=new l("sinh",[a.clone()]);break;case"tanh":n=new f("^","pow",[new l("sech",[a.clone()]),v(2)]);break;case"sech":u=!0,n=new f("*","multiply",[e,new l("tanh",[a.clone()])]);break;case"csch":u=!0,n=new f("*","multiply",[e,new l("coth",[a.clone()])]);break;case"coth":u=!0,n=new f("^","pow",[new l("csch",[a.clone()]),v(2)]);break;case"asinh":o=!0,n=new l("sqrt",[new f("+","add",[new f("^","pow",[a.clone(),v(2)]),v(1)])]);break;case"acosh":o=!0,n=new l("sqrt",[new f("-","subtract",[new f("^","pow",[a.clone(),v(2)]),v(1)])]);break;case"atanh":o=!0,n=new f("-","subtract",[v(1),new f("^","pow",[a.clone(),v(2)])]);break;case"asech":u=o=!0,n=new f("*","multiply",[a.clone(),new l("sqrt",[new f("-","subtract",[v(1),new f("^","pow",[a.clone(),v(2)])])])]);break;case"acsch":u=o=!0,n=new f("*","multiply",[new l("abs",[a.clone()]),new l("sqrt",[new f("+","add",[new f("^","pow",[a.clone(),v(2)]),v(1)])])]);break;case"acoth":u=o=!0,n=new f("-","subtract",[v(1),new f("^","pow",[a.clone(),v(2)])]);break;case"abs":n=new f("/","divide",[new l(new p("abs"),[a.clone()]),a.clone()]);break;default:throw new Error('Cannot process function "'+e.name+'" in derivative: the function is not supported, undefined, or the number of arguments passed to it are not supported')}var s=o?(i="/","divide"):(i="*","multiply"),c=y(a,t);return u&&(c=new f("-","unaryMinus",[c])),new f(i,s,[c,n])},"OperatorNode, Object":function(e,r){if(void 0!==r[e])return v(0);if("+"===e.op)return new f(e.op,e.fn,e.args.map(function(e){return y(e,r)}));if("-"===e.op){if(e.isUnary())return new f(e.op,e.fn,[y(e.args[0],r)]);if(e.isBinary())return new f(e.op,e.fn,[y(e.args[0],r),y(e.args[1],r)])}if("*"===e.op)return 0<(n=e.args.filter(function(e){return void 0!==r[e]})).length?(t=1===(t=e.args.filter(function(e){return void 0===r[e]})).length?t[0]:new f("*","multiply",t),n=n.concat(y(t,r)),new f("*","multiply",n)):new f("+","add",e.args.map(function(t){return new f("*","multiply",e.args.map(function(e){return e===t?y(e,r):e.clone()}))}));if("/"===e.op&&e.isBinary())return t=e.args[0],n=e.args[1],void 0!==r[n]?new f("/","divide",[y(t,r),n]):void 0!==r[t]?new f("*","multiply",[new f("-","unaryMinus",[t]),new f("/","divide",[y(n,r),new f("^","pow",[n.clone(),v(2)])])]):new f("/","divide",[new f("-","subtract",[new f("*","multiply",[y(t,r),n.clone()]),new f("*","multiply",[t.clone(),y(n,r)])]),new f("^","pow",[n.clone(),v(2)])]);if("^"===e.op&&e.isBinary()){var t=e.args[0],n=e.args[1];if(void 0!==r[t])return ae(t)&&(o(t.value)||a(t.value,1))?v(0):new f("*","multiply",[e,new f("*","multiply",[new l("log",[t.clone()]),y(n.clone(),r)])]);if(void 0===r[n])return new f("*","multiply",[new f("^","pow",[t.clone(),n.clone()]),new f("+","add",[new f("*","multiply",[y(t,r),new f("/","divide",[n.clone(),t.clone()])]),new f("*","multiply",[y(n,r),new l("log",[t.clone()])])])]);if(ae(n)){if(o(n.value))return v(0);if(a(n.value,1))return y(t,r)}var i=new f("^","pow",[t.clone(),new f("-","subtract",[n,v(1)])]);return new f("*","multiply",[n.clone(),new f("*","multiply",[y(t,r),i])])}throw new Error('Cannot process operator "'+e.op+'" in derivative: the operator is not supported, undefined, or the number of arguments passed to it are not supported')}});function v(e,t){return new s(u(e,t||r.number))}return e}),wm="rationalize",Nm=N(wm,["config","typed","equal","isZero","add","subtract","multiply","divide","pow","parse","simplifyConstant","simplifyCore","simplify","?bignumber","?fraction","mathWithTransform","matrix","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","SymbolNode","ParenthesisNode"],function(e){e.config;var t=e.typed,d=(e.equal,e.isZero,e.add,e.subtract,e.multiply,e.divide,e.pow,e.parse,e.simplifyConstant),y=e.simplifyCore,v=e.simplify,g=(e.fraction,e.bignumber,e.mathWithTransform,e.matrix,e.AccessorNode,e.ArrayNode,e.ConstantNode),x=(e.FunctionNode,e.IndexNode,e.ObjectNode,e.OperatorNode),f=e.SymbolNode;function r(e){var a,o,t,r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},n=2<arguments.length&&void 0!==arguments[2]&&arguments[2],i=((s={}).firstRules=(h=[y,{l:"n+n",r:"2*n"},{l:"n+-n",r:"0"},d,{l:"n*(n1^-1)",r:"n/n1"},{l:"n*n1^-n2",r:"n/n1^n2"},{l:"n1^-1",r:"1/n1"},{l:"n*(n1/n2)",r:"(n*n1)/n2"},{l:"1*n",r:"n"}]).concat(u=[{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)"}],m=[{l:"(n1/(n2/n3))",r:"((n1*n3)/n2)"},{l:"(n1/n2/n3)",r:"(n1/(n2*n3))"}]),s.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)"}],s.sucDivRules=m,s.firstRulesAgain=h.concat(u),s.finalRules=[y,{l:"n*-n",r:"-n^2"},{l:"n*n",r:"n^2"},d,{l:"n*-n^n1",r:"-n^(n1+1)"},{l:"n*n^n1",r:"n^(n1+1)"},{l:"n^n1*-n^n2",r:"-n^(n1+n2)"},{l:"n^n1*n^n2",r:"n^(n1+n2)"},{l:"n^n1*-n",r:"-n^(n1+1)"},{l:"n^n1*n",r:"n^(n1+1)"},{l:"n^n1/-n",r:"-n^(n1-1)"},{l:"n^n1/n",r:"n^(n1-1)"},{l:"n/-n^n1",r:"-n^(1-n1)"},{l:"n/n^n1",r:"n^(1-n1)"},{l:"n^n1/-n^n2",r:"n^(n1-n2)"},{l:"n^n1/n^n2",r:"n^(n1-n2)"},{l:"n1+(-n2*n3)",r:"n1-n2*n3"},{l:"v*(-c)",r:"-c*v"},{l:"n1+-n2",r:"n1-n2"},{l:"v*c",r:"c*v"},{l:"(n1^n2)^n3",r:"(n1^(n2*n3))"}],s),u=(m=e,h=i.firstRules,m=v(m,h,r,{exactFractions:!(a=[])}),o="+-*/",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||!w(parseFloat(t.args[1].value)))throw new Error("There is a non-integer exponent");e(t.args[0])}else{if(!o.includes(t.op))throw new Error("Operator "+t.op+" invalid in polynomial expression");for(var n=0;n<t.args.length;n++)e(t.args[n])}else if("SymbolNode"===r){var i=t.name;-1===a.indexOf(i)&&a.push(i)}else if("ParenthesisNode"===r)e(t.content);else if("ConstantNode"!==r)throw new Error("type "+r+" is not allowed in polynomial expression")}(m),(h={}).expression=m,h.variables=a,h),s=u.variables.length,r={exactFractions:!1},c={exactFractions:!0};if(e=u.expression,1<=s){e=function e(t,r,n){var i=t.type,a=1<arguments.length;{var o,u;"OperatorNode"===i&&t.isBinary()&&(o=!1,(o="^"!==t.op||"ParenthesisNode"!==t.args[0].type&&"OperatorNode"!==t.args[0].type||"ConstantNode"!==t.args[1].type?o:2<=(u=parseFloat(t.args[1].value))&&w(u))&&(t=2<u?(o=t.args[0],u=new x("^","pow",[t.args[0].cloneDeep(),new g(u-1)]),new x("*","multiply",[o,u])):new x("*","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 s=0;s<t.args.length;s++)e(t.args[s],t,s);if(!a)return t}(e);var l,f=!0,p=!1;for(e=v(e,i.firstRules,{},r);l=f?i.distrDivRules:i.sucDivRules,f=!f,(l=(e=v(e,l,{},c)).toString())!==t;)p=!0,t=l;p&&(e=v(e,i.firstRulesAgain,{},r)),e=v(e,i.finalRules,{},r)}var m=[],h={};return"OperatorNode"===e.type&&e.isBinary()&&"/"===e.op?(1===s&&(e.args[0]=b(e.args[0],m),e.args[1]=b(e.args[1])),n&&(h.numerator=e.args[0],h.denominator=e.args[1])):(1===s&&(e=b(e,m)),n&&(h.numerator=e,h.denominator=null)),n?(h.coefficients=m,h.variables=u.variables,h.expression=e,h):e}return e.ParenthesisNode,t(wm,{Node:r,"Node, boolean":function(e,t){return r(e,{},t)},"Node, Object":r,"Node, Object, boolean":r});function b(e,s){var c=(s=void 0===s?[]:s)[0]=0,l="";!function e(t,r,n){var i=t.type;if("FunctionNode"===i)throw new Error("There is an unsolved function call");if("OperatorNode"===i){if(!"+-*^".includes(t.op))throw new Error("Operator "+t.op+" invalid");if(null!==r){if(("unaryMinus"===t.fn||"pow"===t.fn)&&"add"!==r.fn&&"subtract"!==r.fn&&"multiply"!==r.fn)throw new Error("Invalid "+t.op+" placing");if(("subtract"===t.fn||"add"===t.fn||"multiply"===t.fn)&&"add"!==r.fn&&"subtract"!==r.fn)throw new Error("Invalid "+t.op+" placing");if(("subtract"===t.fn||"add"===t.fn||"unaryMinus"===t.fn)&&0!==n.noFil)throw new Error("Invalid "+t.op+" placing")}"^"!==t.op&&"*"!==t.op||(n.fire=t.op);for(var a=0;a<t.args.length;a++)"unaryMinus"===t.fn&&(n.oper="-"),"+"!==t.op&&"subtract"!==t.fn||(n.fire="",n.cte=1,n.oper=0===a?"+":t.op),n.noFil=a,e(t.args[a],t,n)}else if("SymbolNode"===i){if(t.name!==l&&""!==l)throw new Error("There is more than one variable");if(l=t.name,null===r)return s[1]=1,0;if("^"===r.op&&0!==n.noFil)throw new Error("In power the variable should be the first parameter");if("*"===r.op&&1!==n.noFil)throw new Error("In multiply the variable should be the second parameter");""!==n.fire&&"*"!==n.fire||(c<1&&(s[1]=0),s[1]+=n.cte*("+"===n.oper?1:-1),c=Math.max(1,c))}else{if("ConstantNode"!==i)throw new Error("Type "+i+" is not allowed");var o=parseFloat(t.value);if(null===r)return s[0]=o,0;if("^"===r.op){if(1!==n.noFil)throw new Error("Constant cannot be powered");if(!w(o)||o<=0)throw new Error("Non-integer exponent is not allowed");for(var u=c+1;u<o;u++)s[u]=0;return c<o&&(s[o]=0),s[o]+=n.cte*("+"===n.oper?1:-1),c=Math.max(o,c),0}n.cte=o,""===n.fire&&(s[0]+=n.cte*("+"===n.oper?1:-1))}}(e,null,{cte:1,oper:"+",fire:""});for(var t,r,n,i,a,o=!0,u=c=s.length-1;0<=u;u--)0!==s[u]&&(r=new g(o?s[u]:Math.abs(s[u])),n=s[u]<0?"-":"+",0<u&&(a=new f(l),1<u&&(i=new g(u),a=new x("^","pow",[a,i])),r=-1===s[u]&&o?new x("-","unaryMinus",[a]):1===Math.abs(s[u])?a:new x("*","multiply",[r,a])),t=o?r:"+"==n?new x("+","add",[t,r]):new x("-","subtract",[t,r]),o=!1);return o?new g(0):t}}),Dm=N("zpk2tf",["typed","add","multiply","Complex","number"],function(e){var t=e.typed,a=e.add,l=e.multiply,f=e.Complex,p=e.number;return t("zpk2tf",{"Array,Array,number":n,"Array,Array":function(e,t){return n(e,t,1)},"Matrix,Matrix,number":function(e,t,r){return n(e.valueOf(),t.valueOf(),r)},"Matrix,Matrix":function(e,t){return n(e.valueOf(),t.valueOf(),1)}});function n(e,t,r){e.some(function(e){return"BigNumber"===e.type})&&(e=e.map(function(e){return p(e)})),t.some(function(e){return"BigNumber"===e.type})&&(t=t.map(function(e){return p(e)}));for(var n=[f(1,0)],i=[f(1,0)],a=0;a<e.length;a++){var o=e[a];"number"==typeof o&&(o=f(o,0)),n=m(n,[f(1,0),f(-o.re,-o.im)])}for(var u=0;u<t.length;u++){var s=t[u];"number"==typeof s&&(s=f(s,0)),i=m(i,[f(1,0),f(-s.re,-s.im)])}for(var c=0;c<n.length;c++)n[c]=l(n[c],r);return[n,i]}function m(e,t){for(var r=[],n=0;n<e.length+t.length-1;n++){r[n]=f(0,0);for(var i=0;i<e.length;i++)0<=n-i&&n-i<t.length&&(r[n]=a(r[n],l(e[i],t[n-i])))}return r}}),Em=N("freqz",["typed","add","multiply","Complex","divide","matrix"],function(e){var t=e.typed,p=e.add,m=e.multiply,h=e.Complex,d=e.divide,n=e.matrix;return t("freqz",{"Array, Array":function(e,t){return i(e,t,a(512))},"Array, Array, Array":i,"Array, Array, number":function(e,t,r){if(r<0)throw new Error("w must be a positive number");return i(e,t,a(r))},"Matrix, Matrix":function(e,t){var r=a(512),e=i(e.valueOf(),t.valueOf(),r),t=e.w,r=e.h;return{w:n(t),h:n(r)}},"Matrix, Matrix, Matrix":function(e,t,r){e=i(e.valueOf(),t.valueOf(),r.valueOf()).h;return{h:n(e),w:n(r)}},"Matrix, Matrix, number":function(e,t,r){if(r<0)throw new Error("w must be a positive number");r=a(r),e=i(e.valueOf(),t.valueOf(),r).h;return{h:n(e),w:n(r)}}});function i(e,t,r){for(var n=[],i=[],a=0;a<r.length;a++){for(var o=h(0,0),u=h(0,0),s=0;s<e.length;s++)o=p(o,m(e[s],h(Math.cos(-s*r[a]),Math.sin(-s*r[a]))));for(var c=0;c<t.length;c++)u=p(u,m(t[c],h(Math.cos(-c*r[a]),Math.sin(-c*r[a]))));n.push(o),i.push(u)}for(var l=[],f=0;f<n.length;f++)l.push(d(n[f],i[f]));return{h:l,w:r}}function a(e){for(var t=[],r=0;r<e;r++)t.push(r/e*Math.PI);return t}}),Am=N("reviver",["classes"],function(e){var n=e.classes;return function(e,t){var r=n[t&&t.mathjs];return r&&"function"==typeof r.fromJSON?r.fromJSON(t):t}}),Sm=N("replacer",[],function(){return function(e,t){return"number"!=typeof t||isFinite(t)&&!isNaN(t)?t:{mathjs:"number",value:String(t)}}}),Cm=Math.PI,Mm=2*Math.PI,Fm=Math.E,Om=N("true",[],function(){return!0}),Tm=N("false",[],function(){return!1}),_m=N("null",[],function(){return null}),Bm=Ym("Infinity",["config","?BigNumber"],function(e){var t=e.config,e=e.BigNumber;return"BigNumber"===t.number?new e(1/0):1/0}),km=Ym("NaN",["config","?BigNumber"],function(e){var t=e.config,e=e.BigNumber;return"BigNumber"===t.number?new e(NaN):NaN}),Im=Ym("pi",["config","?BigNumber"],function(e){var t=e.config,e=e.BigNumber;return"BigNumber"===t.number?$s(e):Cm}),zm=Ym("tau",["config","?BigNumber"],function(e){var t=e.config,e=e.BigNumber;return"BigNumber"===t.number?Hs(e):Mm}),Rm=Ym("e",["config","?BigNumber"],function(e){var t=e.config,e=e.BigNumber;return"BigNumber"===t.number?Ls(e):Fm}),qm=Ym("phi",["config","?BigNumber"],function(e){var t=e.config,e=e.BigNumber;return"BigNumber"===t.number?Us(e):1.618033988749895}),jm=Ym("LN2",["config","?BigNumber"],function(e){var t=e.config,e=e.BigNumber;return"BigNumber"===t.number?new e(2).ln():Math.LN2}),Pm=Ym("LN10",["config","?BigNumber"],function(e){var t=e.config,e=e.BigNumber;return"BigNumber"===t.number?new e(10).ln():Math.LN10}),Lm=Ym("LOG2E",["config","?BigNumber"],function(e){var t=e.config,e=e.BigNumber;return"BigNumber"===t.number?new e(1).div(new e(2).ln()):Math.LOG2E}),Um=Ym("LOG10E",["config","?BigNumber"],function(e){var t=e.config,e=e.BigNumber;return"BigNumber"===t.number?new e(1).div(new e(10).ln()):Math.LOG10E}),$m=Ym("SQRT1_2",["config","?BigNumber"],function(e){var t=e.config,e=e.BigNumber;return"BigNumber"===t.number?new e("0.5").sqrt():Math.SQRT1_2}),Hm=Ym("SQRT2",["config","?BigNumber"],function(e){var t=e.config,e=e.BigNumber;return"BigNumber"===t.number?new e(2).sqrt():Math.SQRT2}),Gm=Ym("i",["Complex"],function(e){return e.Complex.I}),Vm=N("PI",["pi"],function(e){return e.pi}),Zm=N("E",["e"],function(e){return e.e}),Wm=N("version",[],function(){return"12.4.3"});function Ym(e,t,r){return N(e,t,r,{recreateOnConfigChange:!0})}var Jm=e("speedOfLight","299792458","m s^-1"),Xm=e("gravitationConstant","6.67430e-11","m^3 kg^-1 s^-2"),Qm=e("planckConstant","6.62607015e-34","J s"),Km=e("reducedPlanckConstant","1.0545718176461565e-34","J s"),e0=e("magneticConstant","1.25663706212e-6","N A^-2"),t0=e("electricConstant","8.8541878128e-12","F m^-1"),r0=e("vacuumImpedance","376.730313667","ohm"),n0=e("coulomb","8.987551792261171e9","N m^2 C^-2"),i0=e("elementaryCharge","1.602176634e-19","C"),a0=e("bohrMagneton","9.2740100783e-24","J T^-1"),o0=e("conductanceQuantum","7.748091729863649e-5","S"),u0=e("inverseConductanceQuantum","12906.403729652257","ohm"),s0=e("magneticFluxQuantum","2.0678338484619295e-15","Wb"),c0=e("nuclearMagneton","5.0507837461e-27","J T^-1"),l0=e("klitzing","25812.807459304513","ohm"),f0=e("bohrRadius","5.29177210903e-11","m"),p0=e("classicalElectronRadius","2.8179403262e-15","m"),m0=e("electronMass","9.1093837015e-31","kg"),h0=e("fermiCoupling","1.1663787e-5","GeV^-2"),d0=V0("fineStructure",.0072973525693),y0=e("hartreeEnergy","4.3597447222071e-18","J"),v0=e("protonMass","1.67262192369e-27","kg"),g0=e("deuteronMass","3.3435830926e-27","kg"),x0=e("neutronMass","1.6749271613e-27","kg"),b0=e("quantumOfCirculation","3.6369475516e-4","m^2 s^-1"),w0=e("rydberg","10973731.568160","m^-1"),N0=e("thomsonCrossSection","6.6524587321e-29","m^2"),D0=V0("weakMixingAngle",.2229),E0=V0("efimovFactor",22.7),A0=e("atomicMass","1.66053906660e-27","kg"),S0=e("avogadro","6.02214076e23","mol^-1"),C0=e("boltzmann","1.380649e-23","J K^-1"),M0=e("faraday","96485.33212331001","C mol^-1"),F0=e("firstRadiation","3.7417718521927573e-16","W m^2"),O0=e("loschmidt","2.686780111798444e25","m^-3"),T0=e("gasConstant","8.31446261815324","J K^-1 mol^-1"),_0=e("molarPlanckConstant","3.990312712893431e-10","J s mol^-1"),B0=e("molarVolume","0.022413969545014137","m^3 mol^-1"),k0=V0("sackurTetrode",-1.16487052358),I0=e("secondRadiation","0.014387768775039337","m K"),z0=e("stefanBoltzmann","5.67037441918443e-8","W m^-2 K^-4"),R0=e("wienDisplacement","2.897771955e-3","m K"),q0=e("molarMass","0.99999999965e-3","kg mol^-1"),j0=e("molarMassC12","11.9999999958e-3","kg mol^-1"),P0=e("gravity","9.80665","m s^-2"),L0=e("planckLength","1.616255e-35","m"),U0=e("planckMass","2.176435e-8","kg"),$0=e("planckTime","5.391245e-44","s"),H0=e("planckCharge","1.87554603778e-18","C"),G0=e("planckTemperature","1.416785e+32","K");function e(e,n,i){return N(e,["config","Unit","BigNumber"],function(e){var t=e.config,r=e.Unit,e=e.BigNumber,r=new r("BigNumber"===t.number?new e(n):parseFloat(n),i);return r.fixPrefix=!0,r})}function V0(e,r){return N(e,["config","BigNumber"],function(e){var t=e.config,e=e.BigNumber;return"BigNumber"===t.number?new e(r):r})}var Z0=N("apply",["typed","isInteger"],function(e){var t=e.typed,e=e.isInteger,r=Ki({typed:t,isInteger:e});return t("apply",{"...any":function(e){var t=e[1];Ee(t)?e[1]=t-1:Ae(t)&&(e[1]=t.minus(1));try{return r.apply(null,e)}catch(e){throw yl(e)}}})},{isTransformFunction:!0}),W0=N("column",["typed","Index","matrix","range"],function(e){var t=e.typed,r=e.Index,n=e.matrix,e=e.range,i=Ao({typed:t,Index:r,matrix:n,range:e});return t("column",{"...any":function(e){var t=e.length-1,r=e[t];Ee(r)&&(e[t]=r-1);try{return i.apply(null,e)}catch(e){throw yl(e)}}})},{isTransformFunction:!0});function Y0(e,t,r){var n=e.filter(function(e){return ue(e)&&!(e.name in t)&&!r.has(e.name)})[0];if(!n)throw new Error('No undefined variable found in inline expression "'+e+'"');var i=n.name,a=new Map,o=new ut(r,a,new Set([i])),u=e.compile();return function(e){return a.set(i,e),u.evaluate(o)}}var J0=N("filter",["typed"],function(e){e=e.typed;function t(e,t,r){var n,i;return e[0]&&(n=e[0].compile().evaluate(r)),e[1]&&(i=ue(e[1])||ee(e[1])?e[1].compile().evaluate(r):Y0(e[1],t,r)),a(n,i)}t.rawArgs=!0;var a=e("filter",{"Array, function":X0,"Matrix, function":function(e,t){return e.create(X0(e.toArray(),t))},"Array, RegExp":Sn,"Matrix, RegExp":function(e,t){return e.create(Sn(e.toArray(),t))}});return t},{isTransformFunction:!0});function X0(e,n){return An(e,function(e,t,r){return Fo(n,e,[t+1],r,"filter")})}var Q0=N("forEach",["typed"],function(e){e=e.typed;function t(e,t,r){var n,i;return e[0]&&(n=e[0].compile().evaluate(r)),e[1]&&(i=ue(e[1])||ee(e[1])?e[1].compile().evaluate(r):Y0(e[1],t,r)),a(n,i)}t.rawArgs=!0;var a=e("forEach",{"Array | Matrix, function":function(t,i){!function r(e,n){return Array.isArray(e)?void En(e,function(e,t){r(e,n.concat(t+1))}):Fo(i,e,n,t,"forEach")}(t.valueOf(),[])}});return t},{isTransformFunction:!0}),K0=N("index",["Index","getMatrixDataType"],function(e){var a=e.Index,o=e.getMatrixDataType;return function(){for(var e=[],t=0,r=arguments.length;t<r;t++){var n=arguments[t];if(I(n))n.start--,n.end-=0<n.step?0:2;else if(n&&!0===n.isSet)n=n.map(function(e){return e-1});else if(b(n)||P(n))"boolean"!==o(n)&&(n=n.map(function(e){return e-1}));else if(Ee(n))n--;else if(Ae(n))n=n.toNumber()-1;else if("string"!=typeof n)throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range");e[t]=n}var i=new a;return a.apply(i,e),i}},{isTransformFunction:!0}),eh=N("map",["typed"],function(e){e=e.typed;function t(e,t,r){var n,i;return e[0]&&(n=e[0].compile().evaluate(r)),e[1]&&(i=ue(e[1])||ee(e[1])?e[1].compile().evaluate(r):Y0(e[1],t,r)),a(n,i)}t.rawArgs=!0;var a=e("map",{"Array, function":function(e,t){return th(e,t,e)},"Matrix, function":function(e,t){return e.create(th(e.valueOf(),t,e))}});return t},{isTransformFunction:!0});function th(e,t,i){return function r(e,n){return Array.isArray(e)?Dn(e,function(e,t){return r(e,n.concat(t+1))}):Fo(t,e,n,i,"map")}(e,[])}function rh(e){var t;return 2===e.length&&C(e[0])&&(Ee(t=(e=e.slice())[1])?e[1]=t-1:Ae(t)&&(e[1]=t.minus(1))),e}var nh=N("max",["typed","config","numeric","larger"],function(e){var t=e.typed,r=e.config,n=e.numeric,e=e.larger,i=ks({typed:t,config:r,numeric:n,larger:e});return t("max",{"...any":function(e){e=rh(e);try{return i.apply(null,e)}catch(e){throw yl(e)}}})},{isTransformFunction:!0}),ih=N("mean",["typed","add","divide"],function(e){var t=e.typed,r=e.add,e=e.divide,n=fp({typed:t,add:r,divide:e});return t("mean",{"...any":function(e){e=rh(e);try{return n.apply(null,e)}catch(e){throw yl(e)}}})},{isTransformFunction:!0}),ah=N("min",["typed","config","numeric","smaller"],function(e){var t=e.typed,r=e.config,n=e.numeric,e=e.smaller,i=Is({typed:t,config:r,numeric:n,smaller:e});return t("min",{"...any":function(e){e=rh(e);try{return i.apply(null,e)}catch(e){throw yl(e)}}})},{isTransformFunction:!0}),oh=N("range",["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],function(e){var t=e.typed,r=e.config,n=e.matrix,i=e.bignumber,a=e.smaller,o=e.smallerEq,u=e.larger,s=e.largerEq,c=e.add,e=e.isPositive,l=Vo({typed:t,config:r,matrix:n,bignumber:i,smaller:a,smallerEq:o,larger:u,largerEq:s,add:c,isPositive:e});return t("range",{"...any":function(e){return"boolean"!=typeof e[e.length-1]&&e.push(!0),l.apply(null,e)}})},{isTransformFunction:!0}),uh=N("row",["typed","Index","matrix","range"],function(e){var t=e.typed,r=e.Index,n=e.matrix,e=e.range,i=Qo({typed:t,Index:r,matrix:n,range:e});return t("row",{"...any":function(e){var t=e.length-1,r=e[t];Ee(r)&&(e[t]=r-1);try{return i.apply(null,e)}catch(e){throw yl(e)}}})},{isTransformFunction:!0}),sh=N("subset",["typed","matrix","zeros","add"],function(e){var t=e.typed,r=e.matrix,n=e.zeros,e=e.add,i=tu({typed:t,matrix:r,zeros:n,add:e});return t("subset",{"...any":function(e){try{return i.apply(null,e)}catch(e){throw yl(e)}}})},{isTransformFunction:!0}),ch=N("concat",["typed","matrix","isInteger"],function(e){var t=e.typed,r=e.matrix,e=e.isInteger,n=Eo({typed:t,matrix:r,isInteger:e});return t("concat",{"...any":function(e){var t=e.length-1,r=e[t];Ee(r)?e[t]=r-1:Ae(r)&&(e[t]=r.minus(1));try{return n.apply(null,e)}catch(e){throw yl(e)}}})},{isTransformFunction:!0}),lh=N("diff",["typed","matrix","subtract","number","bignumber"],function(e){var t=e.typed,r=e.matrix,n=e.subtract,i=e.number,e=e.bignumber,a=Lo({typed:t,matrix:r,subtract:n,number:i,bignumber:e});return t("diff",{"...any":function(e){e=rh(e);try{return a.apply(null,e)}catch(e){throw yl(e)}}})},{isTransformFunction:!0}),fh=N("std",["typed","map","sqrt","variance"],function(e){var t=e.typed,r=e.map,n=e.sqrt,e=e.variance,i=gp({typed:t,map:r,sqrt:n,variance:e});return t("std",{"...any":function(e){e=rh(e);try{return i.apply(null,e)}catch(e){throw yl(e)}}})},{isTransformFunction:!0}),ph=N("sum",["typed","config","add","numeric"],function(e){var t=e.typed,r=e.config,n=e.add,e=e.numeric,i=sp({typed:t,config:r,add:n,numeric:e});return t("sum",{"...any":function(e){e=rh(e);try{return i.apply(null,e)}catch(e){throw yl(e)}}})},{isTransformFunction:!0}),mh=N("quantileSeq",["typed","bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger"],function(e){var t=e.typed,r=e.bignumber,n=e.add,i=e.subtract,a=e.divide,o=e.multiply,u=e.partitionSelect,s=e.compare,c=e.isInteger,l=e.smaller,f=e.smallerEq,e=e.larger,p=vp({typed:t,bignumber:r,add:n,subtract:i,divide:a,multiply:o,partitionSelect:u,compare:s,isInteger:c,smaller:l,smallerEq:f,larger:e});return t("quantileSeq",{"Array | Matrix, number | BigNumber":p,"Array | Matrix, number | BigNumber, number":function(e,t,r){return p(e,t,m(r))},"Array | Matrix, number | BigNumber, boolean":p,"Array | Matrix, number | BigNumber, boolean, number":function(e,t,r,n){return p(e,t,r,m(n))},"Array | Matrix, Array | Matrix":p,"Array | Matrix, Array | Matrix, number":function(e,t,r){return p(e,t,m(r))},"Array | Matrix, Array | Matrix, boolean":p,"Array | Matrix, Array | Matrix, boolean, number":function(e,t,r,n){return p(e,t,r,m(n))}});function m(e){return rh([[],e])[1]}},{isTransformFunction:!0}),hh=N("cumsum",["typed","add","unaryPlus"],function(e){var t=e.typed,r=e.add,e=e.unaryPlus,n=lp({typed:t,add:r,unaryPlus:e});return t("cumsum",{"...any":function(e){var t;2===e.length&&C(e[0])&&(Ee(t=e[1])?e[1]=t-1:Ae(t)&&(e[1]=t.minus(1)));try{return n.apply(null,e)}catch(e){throw yl(e)}}})},{isTransformFunction:!0}),dh=N("variance",["typed","add","subtract","multiply","divide","apply","isNaN"],function(e){var t=e.typed,r=e.add,n=e.subtract,i=e.multiply,a=e.divide,o=e.apply,e=e.isNaN,u=dp({typed:t,add:r,subtract:n,multiply:i,divide:a,apply:o,isNaN:e});return t("variance",{"...any":function(e){e=rh(e);try{return u.apply(null,e)}catch(e){throw yl(e)}}})},{isTransformFunction:!0}),yh=N("print",["typed","matrix","zeros","add"],function(e){var t=e.typed,r=e.matrix,n=e.zeros,e=e.add,i=Fu({typed:t,matrix:r,zeros:n,add:e});return t("print",{"string, Object | Array":function(e,t){return i(a(e),t)},"string, Object | Array, number | Object":function(e,t,r){return i(a(e),t,r)}});function a(e){return e.replace(Mu,function(e){return"$"+e.slice(1).split(".").map(function(e){return!isNaN(e)&&0<e.length?parseInt(e)-1:e}).join(".")})}},{isTransformFunction:!0}),vh=N("and",["typed","matrix","zeros","add","equalScalar","not","concat"],function(e){var t=e.typed,r=e.matrix,n=e.equalScalar,i=e.zeros,a=e.not,e=e.concat,o=rs({typed:t,matrix:r,equalScalar:n,zeros:i,not:a,concat:e});function u(e,t,r){var n=e[0].compile().evaluate(r);if(!C(n)&&!o(n,!0))return!1;e=e[1].compile().evaluate(r);return o(n,e)}return u.rawArgs=!0,u},{isTransformFunction:!0}),gh=N("or",["typed","matrix","equalScalar","DenseMatrix","concat"],function(e){var t=e.typed,r=e.matrix,n=e.equalScalar,i=e.DenseMatrix,e=e.concat,a=No({typed:t,matrix:r,equalScalar:n,DenseMatrix:i,concat:e});function o(e,t,r){var n=e[0].compile().evaluate(r);if(!C(n)&&a(n,!1))return!0;e=e[1].compile().evaluate(r);return a(n,e)}return o.rawArgs=!0,o},{isTransformFunction:!0}),xh=N("bitAnd",["typed","matrix","zeros","add","equalScalar","not","concat"],function(e){var t=e.typed,r=e.matrix,n=e.equalScalar,i=e.zeros,a=e.not,e=e.concat,o=uo({typed:t,matrix:r,equalScalar:n,zeros:i,not:a,concat:e});function u(e,t,r){var n=e[0].compile().evaluate(r);if(!C(n)){if(isNaN(n))return NaN;if(0===n||!1===n)return 0}e=e[1].compile().evaluate(r);return o(n,e)}return u.rawArgs=!0,u},{isTransformFunction:!0}),bh=N("bitOr",["typed","matrix","equalScalar","DenseMatrix","concat"],function(e){var t=e.typed,r=e.matrix,n=e.equalScalar,i=e.DenseMatrix,e=e.concat,a=co({typed:t,matrix:r,equalScalar:n,DenseMatrix:i,concat:e});function o(e,t,r){var n=e[0].compile().evaluate(r);if(!C(n)){if(isNaN(n))return NaN;if(-1===n)return-1;if(!0===n)return 1}e=e[1].compile().evaluate(r);return a(n,e)}return o.rawArgs=!0,o},{isTransformFunction:!0}),wh=(Mh(4170),Mh(6034),Mh(1504)),Nh={epsilon:1e-12,matrix:"Matrix",number:"number",precision:64,predictable:!1,randomSeed:null},Dh=["Matrix","Array"],Eh=["number","BigNumber","Fraction"];function Ah(n,i){function t(e){var t,r;return e?(t=Pe(n,Ce),Sh(e,"matrix",Dh),Sh(e,"number",Eh),function e(t,r){if(Array.isArray(r))throw new TypeError("Arrays are not supported by deepExtend");for(var n in r)if(se(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]}}(n,e),r=Pe(n,Ce),e=Pe(e,Ce),i("config",r,t,e),r):Pe(n,Ce)}return t.MATRIX_OPTIONS=Dh,t.NUMBER_OPTIONS=Eh,Object.keys(Nh).forEach(function(e){Object.defineProperty(t,e,{get:function(){return n[e]},enumerable:!0,configurable:!0})}),t}function Sh(e,t,r){void 0===e[t]||r.includes(e[t])||console.warn('Warning: Unknown value "'+e[t]+'" for configuration option "'+t+'". Available options: '+r.map(function(e){return JSON.stringify(e)}).join(", ")+".")}const Ch=function e(t,r){r=an({},Nh,r);if("function"!=typeof Object.create)throw new Error("ES5 not supported by this JavaScript engine. Please load the es5-shim and es5-sham library for compatibility.");n={isNumber:Ee,isComplex:Oe,isBigNumber:Ae,isFraction:Te,isUnit:Z,isString:S,isArray:b,isMatrix:P,isCollection:C,isDenseMatrix:M,isSparseMatrix:B,isRange:I,isIndex:z,isBoolean:R,isResultSet:q,isHelp:j,isFunction:U,isDate:$,isRegExp:H,isObject:G,isNull:W,isUndefined:Y,isAccessorNode:le,isArrayNode:J,isAssignmentNode:X,isBlockNode:Q,isConditionalNode:K,isConstantNode:ae,isFunctionAssignmentNode:ee,isFunctionNode:pe,isIndexNode:te,isNode:L,isObjectNode:re,isOperatorNode:oe,isParenthesisNode:ne,isRangeNode:ie,isRelationalNode:me,isSymbolNode:ue,isChain:he},i=new wh,n.on=i.on.bind(i),n.off=i.off.bind(i),n.once=i.once.bind(i),n.emit=i.emit.bind(i);var n,i,a=n,o=(a.config=Ah(r,a.emit),a.expression={transform:{},mathWithTransform:{config:a.config}},{});function u(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return a.typed.apply(a.typed,t)}u.isTypedFunction=de.isTypedFunction;s=u,l=o,f={expression:!0,type:!0,docs:!0,error:!0,json:!0,chain:!0};var s,c,l,f,p=function(e,a){var t=arguments.length;if(1!==t&&2!==t)throw new Sa("import",t,1,2);a=a||{};var r,n,i={};for(n in function t(r,e,n){if(Array.isArray(e))e.forEach(function(e){return t(r,e)});else if("object"===V(e))for(var i in e)se(e,i)&&t(r,e[i],i);else if(Ge(e)||void 0!==n){n=Ge(e)?x(e)?e.fn+".transform":e.fn:n;if(se(r,n)&&r[n]!==e&&!a.silent)throw new Error('Cannot import "'+n+'" twice');r[n]=e}else if(!a.silent)throw new TypeError("Factory, Object, or Array expected")}(i,e),i)if(se(i,n)){var o=i[n];if(Ge(o))y(o,a);else if("function"==typeof(r=o)||"number"==typeof r||"string"==typeof r||"boolean"==typeof r||null===r||Z(r)||Oe(r)||Ae(r)||Te(r)||P(r)||Array.isArray(r))m(n,o,a);else if(!a.silent)throw new TypeError("Factory, Object, or Array expected")}};function m(e,t,r){var i;if(r.wrap&&"function"==typeof t&&((i=t).transform&&(n.transform=i.transform),t=n),"function"==typeof t&&"string"==typeof t.signature&&(t=s(e,A({},t.signature,t))),s.isTypedFunction(c[e])&&s.isTypedFunction(t))return t=r.override?s(e,t.signatures):s(c[e],t),c[e]=t,delete l[e],h(e,t),c.emit("import",e,function(){return t});function n(){for(var e=[],t=0,r=arguments.length;t<r;t++){var n=arguments[t];e[t]=n&&n.valueOf()}return i.apply(c,e)}if(void 0===c[e]||r.override)return c[e]=t,delete l[e],h(e,t),c.emit("import",e,function(){return t});if(!r.silent)throw new Error('Cannot import "'+e+'": already exists')}function h(e,t){t&&"function"==typeof t.transform?(c.expression.transform[e]=t.transform,v(e)&&(c.expression.mathWithTransform[e]=t.transform)):(delete c.expression.transform[e],v(e)&&(c.expression.mathWithTransform[e]=t))}function d(e){delete c.expression.transform[e],v(e)?c.expression.mathWithTransform[e]=c[e]:delete c.expression.mathWithTransform[e]}function y(r,n,e){var i=2<arguments.length&&void 0!==e?e:r.fn;if(i.includes("."))throw new Error("Factory name should not contain a nested path. Name: "+JSON.stringify(i));function t(){var t={},e=(r.dependencies.map(Ve).forEach(function(e){if(e.includes("."))throw new Error("Factory dependency should not contain a nested path. Name: "+JSON.stringify(e));"math"===e?t.math=c:"mathWithTransform"===e?t.mathWithTransform=c.expression.mathWithTransform:"classes"===e?t.classes=c:t[e]=c[e]}),r(t));if(e&&"function"==typeof e.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===o||n.override)return e;if(s.isTypedFunction(o)&&s.isTypedFunction(e))return s(o,e);if(n.silent)return o;throw new Error('Cannot import "'+i+'": already exists')}var a=x(r)?c.expression.transform:c,e=i in c.expression.transform,o=se(a,i)?a[i]:void 0;r.meta&&!1===r.meta.lazy?a[i]=t():He(a,i,t),o&&e?d(i):(x(r)||g(r))&&He(c.expression.mathWithTransform,i,function(){return a[i]}),l[i]=r,c.emit("import",i,t)}function v(e){return!se(f,e)}function g(e){return!(e.fn.includes(".")||se(f,e.fn)||e.meta&&e.meta.isClass)}function x(e){return void 0!==e&&void 0!==e.meta&&!0===e.meta.isTransformFunction}return(c=a).import=p,a.on("config",function(){Object.values(o).forEach(function(e){e&&e.meta&&e.meta.recreateOnConfigChange&&p(e,{override:!0})})}),a.create=e.bind(null,t),a.factory=N,a.import(Object.values($e(t))),a.ArgumentsError=Sa,a.DimensionError=k,a.IndexError=mn,a}(t)})(),Fh.default});