Files
dicom-proxy/public/220.bundle.d0b0df6e3678c751fa3c.js
2025-03-11 13:16:07 +07:00

3 lines
592 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*! For license information please see 220.bundle.d0b0df6e3678c751fa3c.js.LICENSE.txt */
(self.webpackChunk=self.webpackChunk||[]).push([[220],{45730:function(e,r){var t;!function(n){"use strict";var i=Math.cosh||function(e){return Math.abs(e)<1e-9?1-e:.5*(Math.exp(e)+Math.exp(-e))},a=Math.sinh||function(e){return Math.abs(e)<1e-9?e:.5*(Math.exp(e)-Math.exp(-e))},o=function(){throw SyntaxError("Invalid Param")};function s(e,r){var t=Math.abs(e),n=Math.abs(r);return 0===e?Math.log(n):0===r?Math.log(t):t<3e3&&n<3e3?.5*Math.log(e*e+r*r):(e/=2,r/=2,.5*Math.log(e*e+r*r)+Math.LN2)}function u(e,r){if(!(this instanceof u))return new u(e,r);var t=function(e,r){var t={re:0,im:0};if(null==e)t.re=t.im=0;else if(void 0!==r)t.re=e,t.im=r;else switch(typeof e){case"object":if("im"in e&&"re"in e)t.re=e.re,t.im=e.im;else if("abs"in e&&"arg"in e){if(!Number.isFinite(e.abs)&&Number.isFinite(e.arg))return u.INFINITY;t.re=e.abs*Math.cos(e.arg),t.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 u.INFINITY;t.re=e.r*Math.cos(e.phi),t.im=e.r*Math.sin(e.phi)}else 2===e.length?(t.re=e[0],t.im=e[1]):o();break;case"string":t.im=t.re=0;var n=e.match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g),i=1,a=0;null===n&&o();for(var s=0;s<n.length;s++){var c=n[s];" "===c||"\t"===c||"\n"===c||("+"===c?i++:"-"===c?a++:"i"===c||"I"===c?(i+a===0&&o()," "===n[s+1]||isNaN(n[s+1])?t.im+=parseFloat((a%2?"-":"")+"1"):(t.im+=parseFloat((a%2?"-":"")+n[s+1]),s++),i=a=0):((i+a===0||isNaN(c))&&o(),"i"===n[s+1]||"I"===n[s+1]?(t.im+=parseFloat((a%2?"-":"")+c),s++):t.re+=parseFloat((a%2?"-":"")+c),i=a=0))}i+a>0&&o();break;case"number":t.im=0,t.re=e;break;default:o()}return isNaN(t.re)||isNaN(t.im),t}(e,r);this.re=t.re,this.im=t.im}u.prototype={re:0,im:0,sign:function(){var e=this.abs();return new u(this.re/e,this.im/e)},add:function(e,r){var t=new u(e,r);return this.isInfinite()&&t.isInfinite()?u.NAN:this.isInfinite()||t.isInfinite()?u.INFINITY:new u(this.re+t.re,this.im+t.im)},sub:function(e,r){var t=new u(e,r);return this.isInfinite()&&t.isInfinite()?u.NAN:this.isInfinite()||t.isInfinite()?u.INFINITY:new u(this.re-t.re,this.im-t.im)},mul:function(e,r){var t=new u(e,r);return this.isInfinite()&&t.isZero()||this.isZero()&&t.isInfinite()?u.NAN:this.isInfinite()||t.isInfinite()?u.INFINITY:0===t.im&&0===this.im?new u(this.re*t.re,0):new u(this.re*t.re-this.im*t.im,this.re*t.im+this.im*t.re)},div:function(e,r){var t=new u(e,r);if(this.isZero()&&t.isZero()||this.isInfinite()&&t.isInfinite())return u.NAN;if(this.isInfinite()||t.isZero())return u.INFINITY;if(this.isZero()||t.isInfinite())return u.ZERO;e=this.re,r=this.im;var n,i,a=t.re,o=t.im;return 0===o?new u(e/a,r/a):Math.abs(a)<Math.abs(o)?new u((e*(i=a/o)+r)/(n=a*i+o),(r*i-e)/n):new u((e+r*(i=o/a))/(n=o*i+a),(r-e*i)/n)},pow:function(e,r){var t=new u(e,r);if(e=this.re,r=this.im,t.isZero())return u.ONE;if(0===t.im){if(0===r&&e>0)return new u(Math.pow(e,t.re),0);if(0===e)switch((t.re%4+4)%4){case 0:return new u(Math.pow(r,t.re),0);case 1:return new u(0,Math.pow(r,t.re));case 2:return new u(-Math.pow(r,t.re),0);case 3:return new u(0,-Math.pow(r,t.re))}}if(0===e&&0===r&&t.re>0&&t.im>=0)return u.ZERO;var n=Math.atan2(r,e),i=s(e,r);return e=Math.exp(t.re*i-t.im*n),r=t.im*i+t.re*n,new u(e*Math.cos(r),e*Math.sin(r))},sqrt:function(){var e,r,t=this.re,n=this.im,i=this.abs();if(t>=0){if(0===n)return new u(Math.sqrt(t),0);e=.5*Math.sqrt(2*(i+t))}else e=Math.abs(n)/Math.sqrt(2*(i-t));return r=t<=0?.5*Math.sqrt(2*(i-t)):Math.abs(n)/Math.sqrt(2*(i+t)),new u(e,n<0?-r:r)},exp:function(){var e=Math.exp(this.re);return this.im,new u(e*Math.cos(this.im),e*Math.sin(this.im))},expm1:function(){var e=this.re,r=this.im;return new u(Math.expm1(e)*Math.cos(r)+function(e){var r=Math.PI/4;if(-r>e||e>r)return Math.cos(e)-1;var 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)}(r),Math.exp(e)*Math.sin(r))},log:function(){var e=this.re,r=this.im;return new u(s(e,r),Math.atan2(r,e))},abs:function(){return e=this.re,r=this.im,t=Math.abs(e),n=Math.abs(r),t<3e3&&n<3e3?Math.sqrt(t*t+n*n):(t<n?(t=n,n=e/r):n=r/e,t*Math.sqrt(1+n*n));var e,r,t,n},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){var e=this.re,r=this.im;return new u(Math.sin(e)*i(r),Math.cos(e)*a(r))},cos:function(){var e=this.re,r=this.im;return new u(Math.cos(e)*i(r),-Math.sin(e)*a(r))},tan:function(){var e=2*this.re,r=2*this.im,t=Math.cos(e)+i(r);return new u(Math.sin(e)/t,a(r)/t)},cot:function(){var e=2*this.re,r=2*this.im,t=Math.cos(e)-i(r);return new u(-Math.sin(e)/t,a(r)/t)},sec:function(){var e=this.re,r=this.im,t=.5*i(2*r)+.5*Math.cos(2*e);return new u(Math.cos(e)*i(r)/t,Math.sin(e)*a(r)/t)},csc:function(){var e=this.re,r=this.im,t=.5*i(2*r)-.5*Math.cos(2*e);return new u(Math.sin(e)*i(r)/t,-Math.cos(e)*a(r)/t)},asin:function(){var e=this.re,r=this.im,t=new u(r*r-e*e+1,-2*e*r).sqrt(),n=new u(t.re-r,t.im+e).log();return new u(n.im,-n.re)},acos:function(){var e=this.re,r=this.im,t=new u(r*r-e*e+1,-2*e*r).sqrt(),n=new u(t.re-r,t.im+e).log();return new u(Math.PI/2-n.im,n.re)},atan:function(){var e=this.re,r=this.im;if(0===e){if(1===r)return new u(0,1/0);if(-1===r)return new u(0,-1/0)}var t=e*e+(1-r)*(1-r),n=new u((1-r*r-e*e)/t,-2*e/t).log();return new u(-.5*n.im,.5*n.re)},acot:function(){var e=this.re,r=this.im;if(0===r)return new u(Math.atan2(1,e),0);var t=e*e+r*r;return 0!==t?new u(e/t,-r/t).atan():new u(0!==e?e/0:0,0!==r?-r/0:0).atan()},asec:function(){var e=this.re,r=this.im;if(0===e&&0===r)return new u(0,1/0);var t=e*e+r*r;return 0!==t?new u(e/t,-r/t).acos():new u(0!==e?e/0:0,0!==r?-r/0:0).acos()},acsc:function(){var e=this.re,r=this.im;if(0===e&&0===r)return new u(Math.PI/2,1/0);var t=e*e+r*r;return 0!==t?new u(e/t,-r/t).asin():new u(0!==e?e/0:0,0!==r?-r/0:0).asin()},sinh:function(){var e=this.re,r=this.im;return new u(a(e)*Math.cos(r),i(e)*Math.sin(r))},cosh:function(){var e=this.re,r=this.im;return new u(i(e)*Math.cos(r),a(e)*Math.sin(r))},tanh:function(){var e=2*this.re,r=2*this.im,t=i(e)+Math.cos(r);return new u(a(e)/t,Math.sin(r)/t)},coth:function(){var e=2*this.re,r=2*this.im,t=i(e)-Math.cos(r);return new u(a(e)/t,-Math.sin(r)/t)},csch:function(){var e=this.re,r=this.im,t=Math.cos(2*r)-i(2*e);return new u(-2*a(e)*Math.cos(r)/t,2*i(e)*Math.sin(r)/t)},sech:function(){var e=this.re,r=this.im,t=Math.cos(2*r)+i(2*e);return new u(2*i(e)*Math.cos(r)/t,-2*a(e)*Math.sin(r)/t)},asinh:function(){var e=this.im;this.im=-this.re,this.re=e;var r=this.asin();return this.re=-this.im,this.im=e,e=r.re,r.re=-r.im,r.im=e,r},acosh:function(){var e=this.acos();if(e.im<=0){var r=e.re;e.re=-e.im,e.im=r}else{r=e.im;e.im=-e.re,e.re=r}return e},atanh:function(){var e=this.re,r=this.im,t=e>1&&0===r,n=1-e,i=1+e,a=n*n+r*r,o=0!==a?new u((i*n-r*r)/a,(r*n+i*r)/a):new u(-1!==e?e/0:0,0!==r?r/0:0),c=o.re;return o.re=s(o.re,o.im)/2,o.im=Math.atan2(o.im,c)/2,t&&(o.im=-o.im),o},acoth:function(){var e=this.re,r=this.im;if(0===e&&0===r)return new u(0,Math.PI/2);var t=e*e+r*r;return 0!==t?new u(e/t,-r/t).atanh():new u(0!==e?e/0:0,0!==r?-r/0:0).atanh()},acsch:function(){var e=this.re,r=this.im;if(0===r)return new u(0!==e?Math.log(e+Math.sqrt(e*e+1)):1/0,0);var t=e*e+r*r;return 0!==t?new u(e/t,-r/t).asinh():new u(0!==e?e/0:0,0!==r?-r/0:0).asinh()},asech:function(){var e=this.re,r=this.im;if(this.isZero())return u.INFINITY;var t=e*e+r*r;return 0!==t?new u(e/t,-r/t).acosh():new u(0!==e?e/0:0,0!==r?-r/0:0).acosh()},inverse:function(){if(this.isZero())return u.INFINITY;if(this.isInfinite())return u.ZERO;var e=this.re,r=this.im,t=e*e+r*r;return new u(e/t,-r/t)},conjugate:function(){return new u(this.re,-this.im)},neg:function(){return new u(-this.re,-this.im)},ceil:function(e){return e=Math.pow(10,e||0),new u(Math.ceil(this.re*e)/e,Math.ceil(this.im*e)/e)},floor:function(e){return e=Math.pow(10,e||0),new u(Math.floor(this.re*e)/e,Math.floor(this.im*e)/e)},round:function(e){return e=Math.pow(10,e||0),new u(Math.round(this.re*e)/e,Math.round(this.im*e)/e)},equals:function(e,r){var t=new u(e,r);return Math.abs(t.re-this.re)<=u.EPSILON&&Math.abs(t.im-this.im)<=u.EPSILON},clone:function(){return new u(this.re,this.im)},toString:function(){var e=this.re,r=this.im,t="";return this.isNaN()?"NaN":this.isInfinite()?"Infinity":(Math.abs(e)<u.EPSILON&&(e=0),Math.abs(r)<u.EPSILON&&(r=0),0===r?t+e:(0!==e?(t+=e,t+=" ",r<0?(r=-r,t+="-"):t+="+",t+=" "):r<0&&(r=-r,t+="-"),1!==r&&(t+=r),t+"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())}},u.ZERO=new u(0,0),u.ONE=new u(1,0),u.I=new u(0,1),u.PI=new u(Math.PI,0),u.E=new u(Math.E,0),u.INFINITY=new u(1/0,1/0),u.NAN=new u(NaN,NaN),u.EPSILON=1e-15,void 0===(t=function(){return u}.apply(r,[]))||(e.exports=t)}()},93907:e=>{"use strict";var r=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},t={"{":"\\{","}":"\\}","\\":"\\textbackslash{}","#":"\\#",$:"\\$","%":"\\%","&":"\\&","^":"\\textasciicircum{}",_:"\\_","~":"\\textasciitilde{}"},n={"":"\\--","—":"\\---"," ":"~","\t":"\\qquad{}","\r\n":"\\newline{}","\n":"\\newline{}"},i=function(e,t){return r({},e,t)};e.exports=function(e){for(var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=a.preserveFormatting,s=void 0!==o&&o,u=a.escapeMapFn,c=void 0===u?i:u,l=String(e),f="",p=c(r({},t),s?r({},n):{}),m=Object.keys(p),d=function(){var e=!1;m.forEach((function(r,t){e||l.length>=r.length&&l.slice(0,r.length)===r&&(f+=p[m[t]],l=l.slice(r.length,l.length),e=!0)})),e||(f+=l.slice(0,1),l=l.slice(1,l.length))};l;)d();return f}},1638:function(e,r){var t;!function(n){"use strict";var i={s:1,n:0,d:1};function a(e,r){if(isNaN(e=parseInt(e,10)))throw l.InvalidParameter;return e*r}function o(e,r){if(0===r)throw l.DivisionByZero;var t=Object.create(l.prototype);t.s=e<0?-1:1;var n=c(e=e<0?-e:e,r);return t.n=e/n,t.d=r/n,t}function s(e){for(var r={},t=e,n=2,i=4;i<=t;){for(;t%n==0;)t/=n,r[n]=(r[n]||0)+1;i+=1+2*n++}return t!==e?t>1&&(r[t]=(r[t]||0)+1):r[e]=(r[e]||0)+1,r}var u=function(e,r){var t,n=0,o=1,s=1,u=0,c=0,f=0,p=1,m=1,d=0,h=1,g=1,y=1,v=1e7;if(null==e);else if(void 0!==r){if(s=(n=e)*(o=r),n%1!=0||o%1!=0)throw l.NonIntegerParameter}else switch(typeof e){case"object":if("d"in e&&"n"in e)n=e.n,o=e.d,"s"in e&&(n*=e.s);else{if(!(0 in e))throw l.InvalidParameter;n=e[0],1 in e&&(o=e[1])}s=n*o;break;case"number":if(e<0&&(s=e,e=-e),e%1==0)n=e;else if(e>0){for(e>=1&&(e/=m=Math.pow(10,Math.floor(1+Math.log(e)/Math.LN10)));h<=v&&y<=v;){if(e===(t=(d+g)/(h+y))){h+y<=v?(n=d+g,o=h+y):y>h?(n=g,o=y):(n=d,o=h);break}e>t?(d+=g,h+=y):(g+=d,y+=h),h>v?(n=g,o=y):(n=d,o=h)}n*=m}else(isNaN(e)||isNaN(r))&&(o=n=NaN);break;case"string":if(null===(h=e.match(/\d+|./g)))throw l.InvalidParameter;if("-"===h[d]?(s=-1,d++):"+"===h[d]&&d++,h.length===d+1?c=a(h[d++],s):"."===h[d+1]||"."===h[d]?("."!==h[d]&&(u=a(h[d++],s)),(++d+1===h.length||"("===h[d+1]&&")"===h[d+3]||"'"===h[d+1]&&"'"===h[d+3])&&(c=a(h[d],s),p=Math.pow(10,h[d].length),d++),("("===h[d]&&")"===h[d+2]||"'"===h[d]&&"'"===h[d+2])&&(f=a(h[d+1],s),m=Math.pow(10,h[d+1].length)-1,d+=3)):"/"===h[d+1]||":"===h[d+1]?(c=a(h[d],s),p=a(h[d+2],1),d+=3):"/"===h[d+3]&&" "===h[d+1]&&(u=a(h[d],s),c=a(h[d+2],s),p=a(h[d+4],1),d+=5),h.length<=d){s=n=f+(o=p*m)*u+m*c;break}default:throw l.InvalidParameter}if(0===o)throw l.DivisionByZero;i.s=s<0?-1:1,i.n=Math.abs(n),i.d=Math.abs(o)};function c(e,r){if(!e)return r;if(!r)return e;for(;;){if(!(e%=r))return r;if(!(r%=e))return e}}function l(e,r){if(u(e,r),!(this instanceof l))return o(i.s*i.n,i.d);e=c(i.d,i.n),this.s=i.s,this.n=i.n/e,this.d=i.d/e}l.DivisionByZero=new Error("Division by Zero"),l.InvalidParameter=new Error("Invalid argument"),l.NonIntegerParameter=new Error("Parameters must be integer"),l.prototype={s:1,n:0,d:1,abs:function(){return o(this.n,this.d)},neg:function(){return o(-this.s*this.n,this.d)},add:function(e,r){return u(e,r),o(this.s*this.n*i.d+i.s*this.d*i.n,this.d*i.d)},sub:function(e,r){return u(e,r),o(this.s*this.n*i.d-i.s*this.d*i.n,this.d*i.d)},mul:function(e,r){return u(e,r),o(this.s*i.s*this.n*i.n,this.d*i.d)},div:function(e,r){return u(e,r),o(this.s*i.s*this.n*i.d,this.d*i.n)},clone:function(){return o(this.s*this.n,this.d)},mod:function(e,r){if(isNaN(this.n)||isNaN(this.d))return new l(NaN);if(void 0===e)return o(this.s*this.n%this.d,1);if(u(e,r),0===i.n&&0===this.d)throw l.DivisionByZero;return o(this.s*(i.d*this.n)%(i.n*this.d),i.d*this.d)},gcd:function(e,r){return u(e,r),o(c(i.n,this.n)*c(i.d,this.d),i.d*this.d)},lcm:function(e,r){return u(e,r),0===i.n&&0===this.n?o(0,1):o(i.n*this.n,c(i.n,this.n)*c(i.d,this.d))},ceil:function(e){return e=Math.pow(10,e||0),isNaN(this.n)||isNaN(this.d)?new l(NaN):o(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 l(NaN):o(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 l(NaN):o(Math.round(e*this.s*this.n/this.d),e)},inverse:function(){return o(this.s*this.d,this.n)},pow:function(e,r){if(u(e,r),1===i.d)return i.s<0?o(Math.pow(this.s*this.d,i.n),Math.pow(this.n,i.n)):o(Math.pow(this.s*this.n,i.n),Math.pow(this.d,i.n));if(this.s<0)return null;var t=s(this.n),n=s(this.d),a=1,c=1;for(var l in t)if("1"!==l){if("0"===l){a=0;break}if(t[l]*=i.n,t[l]%i.d!=0)return null;t[l]/=i.d,a*=Math.pow(l,t[l])}for(var l in n)if("1"!==l){if(n[l]*=i.n,n[l]%i.d!=0)return null;n[l]/=i.d,c*=Math.pow(l,n[l])}return i.s<0?o(c,a):o(a,c)},equals:function(e,r){return u(e,r),this.s*this.n*i.d==i.s*i.n*this.d},compare:function(e,r){u(e,r);var t=this.s*this.n*i.d-i.s*i.n*this.d;return(0<t)-(t<0)},simplify:function(e){if(isNaN(this.n)||isNaN(this.d))return this;e=e||.001;for(var r=this.abs(),t=r.toContinued(),n=1;n<t.length;n++){for(var i=o(t[n-1],1),a=n-2;a>=0;a--)i=i.inverse().add(t[a]);if(i.sub(r).abs().valueOf()<e)return i.mul(this.s)}return this},divisible:function(e,r){return u(e,r),!(!(i.n*this.d)||this.n*i.d%(i.n*this.d))},valueOf:function(){return this.s*this.n/this.d},toFraction:function(e){var r,t="",n=this.n,i=this.d;return this.s<0&&(t+="-"),1===i?t+=n:(e&&(r=Math.floor(n/i))>0&&(t+=r,t+=" ",n%=i),t+=n,t+="/",t+=i),t},toLatex:function(e){var r,t="",n=this.n,i=this.d;return this.s<0&&(t+="-"),1===i?t+=n:(e&&(r=Math.floor(n/i))>0&&(t+=r,n%=i),t+="\\frac{",t+=n,t+="}{",t+=i,t+="}"),t},toContinued:function(){var e,r=this.n,t=this.d,n=[];if(isNaN(r)||isNaN(t))return n;do{n.push(Math.floor(r/t)),e=r%t,r=t,t=e}while(1!==r);return n},toString:function(e){var r=this.n,t=this.d;if(isNaN(r)||isNaN(t))return"NaN";e=e||15;var n=function(e,r){for(;r%2==0;r/=2);for(;r%5==0;r/=5);if(1===r)return 0;for(var t=10%r,n=1;1!==t;n++)if(t=10*t%r,n>2e3)return 0;return n}(0,t),i=function(e,r,t){for(var n=1,i=function(e,r,t){for(var n=1;r>0;e=e*e%t,r>>=1)1&r&&(n=n*e%t);return n}(10,t,r),a=0;a<300;a++){if(n===i)return a;n=10*n%r,i=10*i%r}return 0}(0,t,n),a=this.s<0?"-":"";if(a+=r/t|0,r%=t,(r*=10)&&(a+="."),n){for(var o=i;o--;)a+=r/t|0,r%=t,r*=10;a+="(";for(o=n;o--;)a+=r/t|0,r%=t,r*=10;a+=")"}else for(o=e;r&&o--;)a+=r/t|0,r%=t,r*=10;return a}},void 0===(t=function(){return l}.apply(r,[]))||(e.exports=t)}()},74681:e=>{e.exports=function e(r,t){"use strict";var n,i,a=/(^([+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/gi,o=/(^[ ]*|[ ]*$)/g,s=/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,u=/^0x[0-9a-f]+$/i,c=/^0/,l=function(r){return e.insensitive&&(""+r).toLowerCase()||""+r},f=l(r).replace(o,"")||"",p=l(t).replace(o,"")||"",m=f.replace(a,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),d=p.replace(a,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),h=parseInt(f.match(u),16)||1!==m.length&&f.match(s)&&Date.parse(f),g=parseInt(p.match(u),16)||h&&p.match(s)&&Date.parse(p)||null;if(g){if(h<g)return-1;if(h>g)return 1}for(var y=0,v=Math.max(m.length,d.length);y<v;y++){if(n=!(m[y]||"").match(c)&&parseFloat(m[y])||m[y]||0,i=!(d[y]||"").match(c)&&parseFloat(d[y])||d[y]||0,isNaN(n)!==isNaN(i))return isNaN(n)?1:-1;if(typeof n!=typeof i&&(n+="",i+=""),n<i)return-1;if(n>i)return 1}return 0}},89757:e=>{function r(){}r.prototype={on:function(e,r,t){var n=this.e||(this.e={});return(n[e]||(n[e]=[])).push({fn:r,ctx:t}),this},once:function(e,r,t){var n=this;function i(){n.off(e,i),r.apply(t,arguments)}return i._=r,this.on(e,i,t)},emit:function(e){for(var r=[].slice.call(arguments,1),t=((this.e||(this.e={}))[e]||[]).slice(),n=0,i=t.length;n<i;n++)t[n].fn.apply(t[n].ctx,r);return this},off:function(e,r){var t=this.e||(this.e={}),n=t[e],i=[];if(n&&r)for(var a=0,o=n.length;a<o;a++)n[a].fn!==r&&n[a].fn._!==r&&i.push(n[a]);return i.length?t[e]=i:delete t[e],this}},e.exports=r,e.exports.TinyEmitter=r},55220:(e,r,t)=>{"use strict";t.d(r,{JBn:()=>vw,JpY:()=>Ab});var n=t(76805),i={epsilon:1e-12,matrix:"Matrix",number:"number",precision:64,predictable:!1,randomSeed:null};function a(e){return"number"==typeof e}function o(e){return!(!e||"object"!=typeof e||"function"!=typeof e.constructor)&&(!0===e.isBigNumber&&"object"==typeof e.constructor.prototype&&!0===e.constructor.prototype.isBigNumber||"function"==typeof e.constructor.isDecimal&&!0===e.constructor.isDecimal(e))}function s(e){return e&&"object"==typeof e&&!0===Object.getPrototypeOf(e).isComplex||!1}function u(e){return e&&"object"==typeof e&&!0===Object.getPrototypeOf(e).isFraction||!1}function c(e){return e&&!0===e.constructor.prototype.isUnit||!1}function l(e){return"string"==typeof e}var f=Array.isArray;function p(e){return e&&!0===e.constructor.prototype.isMatrix||!1}function m(e){return Array.isArray(e)||p(e)}function d(e){return e&&e.isDenseMatrix&&!0===e.constructor.prototype.isMatrix||!1}function h(e){return e&&e.isSparseMatrix&&!0===e.constructor.prototype.isMatrix||!1}function g(e){return e&&!0===e.constructor.prototype.isRange||!1}function y(e){return e&&!0===e.constructor.prototype.isIndex||!1}function v(e){return"boolean"==typeof e}function x(e){return e&&!0===e.constructor.prototype.isResultSet||!1}function b(e){return e&&!0===e.constructor.prototype.isHelp||!1}function w(e){return"function"==typeof e}function N(e){return e instanceof Date}function D(e){return e instanceof RegExp}function E(e){return!(!e||"object"!=typeof e||e.constructor!==Object||s(e)||u(e))}function A(e){return null===e}function C(e){return void 0===e}function S(e){return e&&!0===e.isAccessorNode&&!0===e.constructor.prototype.isNode||!1}function M(e){return e&&!0===e.isArrayNode&&!0===e.constructor.prototype.isNode||!1}function F(e){return e&&!0===e.isAssignmentNode&&!0===e.constructor.prototype.isNode||!1}function B(e){return e&&!0===e.isBlockNode&&!0===e.constructor.prototype.isNode||!1}function T(e){return e&&!0===e.isConditionalNode&&!0===e.constructor.prototype.isNode||!1}function O(e){return e&&!0===e.isConstantNode&&!0===e.constructor.prototype.isNode||!1}function _(e){return O(e)||P(e)&&1===e.args.length&&O(e.args[0])&&"-+~".includes(e.op)}function z(e){return e&&!0===e.isFunctionAssignmentNode&&!0===e.constructor.prototype.isNode||!1}function q(e){return e&&!0===e.isFunctionNode&&!0===e.constructor.prototype.isNode||!1}function I(e){return e&&!0===e.isIndexNode&&!0===e.constructor.prototype.isNode||!1}function k(e){return e&&!0===e.isNode&&!0===e.constructor.prototype.isNode||!1}function R(e){return e&&!0===e.isObjectNode&&!0===e.constructor.prototype.isNode||!1}function P(e){return e&&!0===e.isOperatorNode&&!0===e.constructor.prototype.isNode||!1}function U(e){return e&&!0===e.isParenthesisNode&&!0===e.constructor.prototype.isNode||!1}function j(e){return e&&!0===e.isRangeNode&&!0===e.constructor.prototype.isNode||!1}function L(e){return e&&!0===e.isRelationalNode&&!0===e.constructor.prototype.isNode||!1}function H(e){return e&&!0===e.isSymbolNode&&!0===e.constructor.prototype.isNode||!1}function $(e){return e&&!0===e.constructor.prototype.isChain||!1}function Z(e){var r=typeof e;return"object"===r?null===e?"null":o(e)?"BigNumber":e.constructor&&e.constructor.name?e.constructor.name:"Object":r}function G(e){var r=typeof e;if("number"===r||"string"===r||"boolean"===r||null==e)return e;if("function"==typeof e.clone)return e.clone();if(Array.isArray(e))return e.map((function(e){return G(e)}));if(e instanceof Date)return new Date(e.valueOf());if(o(e))return e;if(e instanceof RegExp)throw new TypeError("Cannot clone "+e);return function(e,r){var t={};for(var n in e)Y(e,n)&&(t[n]=r(e[n]));return t}(e,G)}function V(e,r){for(var t in r)Y(r,t)&&(e[t]=r[t]);return e}function W(e,r){var t,n,i;if(Array.isArray(e)){if(!Array.isArray(r))return!1;if(e.length!==r.length)return!1;for(n=0,i=e.length;n<i;n++)if(!W(e[n],r[n]))return!1;return!0}if("function"==typeof e)return e===r;if(e instanceof Object){if(Array.isArray(r)||!(r instanceof Object))return!1;for(t in e)if(!(t in r)||!W(e[t],r[t]))return!1;for(t in r)if(!(t in e))return!1;return!0}return e===r}function Y(e,r){return e&&Object.hasOwnProperty.call(e,r)}var J=["Matrix","Array"],X=["number","BigNumber","Fraction"];var Q=function(e){if(e)throw new Error("The global config is readonly. \nPlease create a mathjs instance if you want to change the default configuration. \nExample:\n\n import { create, all } from 'mathjs';\n const mathjs = create(all);\n mathjs.config({ number: 'BigNumber' });\n");return Object.freeze(i)};function K(e,r){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=function(e,r){if(!e)return;if("string"==typeof e)return ee(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return ee(e,r)}(e))||r&&e&&"number"==typeof e.length){t&&(e=t);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}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 a,o=!0,s=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==t.return||t.return()}finally{if(s)throw a}}}}function ee(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function re(e){return re="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},re(e)}function te(){return!0}function ne(){return!1}function ie(){}(0,n.Z)(Q,i,{MATRIX_OPTIONS:J,NUMBER_OPTIONS:X});var ae="Argument is not a typed-function.";const oe=function e(){function r(e){return"object"===re(e)&&null!==e&&e.constructor===Object}var t,n,i=[{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:r},{name:"null",test:function(e){return null===e}},{name:"undefined",test:function(e){return void 0===e}}],a={name:"any",test:te,isAny:!0},o=0,s={createCount:0};function u(e){var r=t.get(e);if(r)return r;var i,a,o='Unknown type "'+e+'"',s=e.toLowerCase(),u=K(n);try{for(u.s();!(a=u.n()).done;)if((i=a.value).toLowerCase()===s){o+='. Did you mean "'+i+'" ?';break}}catch(e){u.e(e)}finally{u.f()}throw new TypeError(o)}function c(e){for(var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"any",i=r?u(r).index:n.length,a=[],o=0;o<e.length;++o){if(!e[o]||"string"!=typeof e[o].name||"function"!=typeof e[o].test)throw new TypeError("Object with properties {name: string, test: function} expected");var s=e[o].name;if(t.has(s))throw new TypeError('Duplicate type name "'+s+'"');a.push(s),t.set(s,{name:s,test:e[o].test,isAny:e[o].isAny,index:i+o,conversionsTo:[]})}var c=n.slice(i);n=n.slice(0,i).concat(a).concat(c);for(var l=i+a.length;l<n.length;++l)t.get(n[l]).index=l}function l(){t=new Map,n=[],o=0,c([a],!1)}function f(e){var r=n.filter((function(r){var n=t.get(r);return!n.isAny&&n.test(e)}));return r.length?r:["any"]}function p(e){return e&&"function"==typeof e&&"_typedFunctionData"in e}function m(e,r,t){if(!p(e))throw new TypeError(ae);var n=t&&t.exact,i=v(Array.isArray(r)?r.join(","):r),a=d(i);if(!n||a in e.signatures){var o=e._typedFunctionData.signatureMap.get(a);if(o)return o}var s,u,c,l=i.length;if(n)for(u in s=[],e.signatures)s.push(e._typedFunctionData.signatureMap.get(u));else s=e._typedFunctionData.signatures;for(var f=0;f<l;++f){var m,h=i[f],g=[],x=void 0,b=K(s);try{for(b.s();!(m=b.n()).done;){var w=N((x=m.value).params,f);if(w&&(!h.restParam||w.restParam)){if(!w.hasAny)if("continue"===function(){var e=y(w);if(h.types.some((function(r){return!e.has(r.name)})))return"continue"}())continue;g.push(x)}}}catch(e){b.e(e)}finally{b.f()}if(0===(s=g).length)break}var D,E=K(s);try{for(E.s();!(D=E.n()).done;)if((c=D.value).params.length<=l)return c}catch(e){E.e(e)}finally{E.f()}throw new TypeError("Signature not found (signature: "+(e.name||"unnamed")+"("+d(i,", ")+"))")}function d(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:",";return e.map((function(e){return e.name})).join(r)}function h(e){var r=0===e.indexOf("..."),t=(r?e.length>3?e.slice(3):"any":e).split("|").map((function(e){return u(e.trim())})),n=!1,i=r?"...":"";return{types:t.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:r}}function g(e){var r=function(e){if(0===e.length)return[];var r=e.map(u);e.length>1&&r.sort((function(e,r){return e.index-r.index}));var t=r[0].conversionsTo;if(1===e.length)return t;t=t.concat([]);for(var n=new Set(e),i=1;i<r.length;++i){var a,o=void 0,s=K(r[i].conversionsTo);try{for(s.s();!(a=s.n()).done;)o=a.value,n.has(o.from)||(t.push(o),n.add(o.from))}catch(e){s.e(e)}finally{s.f()}}return t}(e.types.map((function(e){return e.name}))),t=e.hasAny,n=e.name,i=r.map((function(e){var r=u(e.from);return t=r.isAny||t,n+="|"+e.from,{name:e.from,typeIndex:r.index,test:r.test,isAny:r.isAny,conversion:e,conversionIndex:e.index}}));return{types:e.types.concat(i),name:n,hasAny:t,hasConversion:i.length>0,restParam:e.restParam}}function y(e){return e.typeSet||(e.typeSet=new Set,e.types.forEach((function(r){return e.typeSet.add(r.name)}))),e.typeSet}function v(e){var r=[];if("string"!=typeof e)throw new TypeError("Signatures must be strings");var t=e.trim();if(""===t)return r;for(var n=t.split(","),i=0;i<n.length;++i){var a=h(n[i].trim());if(a.restParam&&i!==n.length-1)throw new SyntaxError('Unexpected rest parameter "'+n[i]+'": only allowed for the last parameter');if(0===a.types.length)return null;r.push(a)}return r}function x(e){var r=P(e);return!!r&&r.restParam}function b(e){if(e&&0!==e.types.length){if(1===e.types.length)return u(e.types[0].name).test;if(2===e.types.length){var r=u(e.types[0].name).test,t=u(e.types[1].name).test;return function(e){return r(e)||t(e)}}var n=e.types.map((function(e){return u(e.name).test}));return function(e){for(var r=0;r<n.length;r++)if(n[r](e))return!0;return!1}}return te}function w(e){var r,t,n;if(x(e)){var i=(r=R(e).map(b)).length,a=b(P(e));return function(e){for(var t=0;t<r.length;t++)if(!r[t](e[t]))return!1;return function(e){for(var r=i;r<e.length;r++)if(!a(e[r]))return!1;return!0}(e)&&e.length>=i+1}}return 0===e.length?function(e){return 0===e.length}:1===e.length?(t=b(e[0]),function(e){return t(e[0])&&1===e.length}):2===e.length?(t=b(e[0]),n=b(e[1]),function(e){return t(e[0])&&n(e[1])&&2===e.length}):(r=e.map(b),function(e){for(var t=0;t<r.length;t++)if(!r[t](e[t]))return!1;return e.length===r.length})}function N(e,r){return r<e.length?e[r]:x(e)?P(e):null}function D(e,r){var t=N(e,r);return t?y(t):new Set}function E(e){return null===e.conversion||void 0===e.conversion}function A(e,r){var t=new Set;return e.forEach((function(e){var n,i,a=K(D(e.params,r));try{for(a.s();!(i=a.n()).done;)n=i.value,t.add(n)}catch(e){a.e(e)}finally{a.f()}})),t.has("any")?["any"]:Array.from(t)}function C(e,r,t){var n,i,a,o=e||"unnamed",s=t,u=function(){var e=[];if(s.forEach((function(t){var n=b(N(t.params,a));(a<t.params.length||x(t.params))&&n(r[a])&&e.push(t)})),0===e.length){if((i=A(s,a)).length>0){var t=f(r[a]);return(n=new TypeError("Unexpected type of argument in function "+o+" (expected: "+i.join(" or ")+", actual: "+t.join(" | ")+", index: "+a+")")).data={category:"wrongType",fn:o,index:a,actual:t,expected:i},{v:n}}}else s=e};for(a=0;a<r.length;a++){var c=u();if("object"===re(c))return c.v}var l=s.map((function(e){return x(e.params)?1/0:e.params.length}));if(r.length<Math.min.apply(null,l))return i=A(s,a),(n=new TypeError("Too few arguments in function "+o+" (expected: "+i.join(" or ")+", index: "+r.length+")")).data={category:"tooFewArgs",fn:o,index:r.length,expected:i},n;var p=Math.max.apply(null,l);if(r.length>p)return(n=new TypeError("Too many arguments in function "+o+" (expected: "+p+", actual: "+r.length+")")).data={category:"tooManyArgs",fn:o,index:r.length,expectedLength:p},n;for(var m=[],d=0;d<r.length;++d)m.push(f(r[d]).join("|"));return(n=new TypeError('Arguments of type "'+m.join(", ")+'" do not match any of the defined signatures of function '+o+".")).data={category:"mismatch",actual:m},n}function S(e){for(var r=n.length+1,t=0;t<e.types.length;t++)E(e.types[t])&&(r=Math.min(r,e.types[t].typeIndex));return r}function M(e){for(var r=o+1,t=0;t<e.types.length;t++)E(e.types[t])||(r=Math.min(r,e.types[t].conversionIndex));return r}function F(e,r){if(e.hasAny){if(!r.hasAny)return 1}else if(r.hasAny)return-1;if(e.restParam){if(!r.restParam)return 1}else if(r.restParam)return-1;if(e.hasConversion){if(!r.hasConversion)return 1}else if(r.hasConversion)return-1;var t=S(e)-S(r);if(t<0)return-1;if(t>0)return 1;var n=M(e)-M(r);return n<0?-1:n>0?1:0}function B(e,r){var t=e.params,n=r.params,i=P(t),a=P(n),o=x(t),s=x(n);if(o&&i.hasAny){if(!s||!a.hasAny)return 1}else if(s&&a.hasAny)return-1;var u,c,l=0,f=0,p=K(t);try{for(p.s();!(c=p.n()).done;)(u=c.value).hasAny&&++l,u.hasConversion&&++f}catch(e){p.e(e)}finally{p.f()}var m,d=0,h=0,g=K(n);try{for(g.s();!(m=g.n()).done;)(u=m.value).hasAny&&++d,u.hasConversion&&++h}catch(e){g.e(e)}finally{g.f()}if(l!==d)return l-d;if(o&&i.hasConversion){if(!s||!a.hasConversion)return 1}else if(s&&a.hasConversion)return-1;if(f!==h)return f-h;if(o){if(!s)return 1}else if(s)return-1;var y=(t.length-n.length)*(o?-1:1);if(0!==y)return y;for(var v,b=[],w=0,N=0;N<t.length;++N){var D=F(t[N],n[N]);b.push(D),w+=D}if(0!==w)return w;for(var E=0,A=b;E<A.length;E++)if(0!==(v=A[E]))return v;return 0}function T(e,r){var t=r;if(e.some((function(e){return e.hasConversion}))){var n=x(e),i=e.map(O);t=function(){for(var e=[],t=n?arguments.length-1:arguments.length,a=0;a<t;a++)e[a]=i[a](arguments[a]);return n&&(e[t]=arguments[t].map(i[t])),r.apply(this,e)}}var a=t;if(x(e)){var o=e.length-1;a=function(){return t.apply(this,U(arguments,0,o).concat([U(arguments,o)]))}}return a}function O(e){var r,t,n,i,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 r=a[0],n=o[0],function(e){return r(e)?n(e):e};case 2:return r=a[0],t=a[1],n=o[0],i=o[1],function(e){return r(e)?n(e):t(e)?i(e):e};default:return function(e){for(var r=0;r<o.length;r++)if(a[r](e))return o[r](e);return e}}}function _(e){return function e(r,t,n){if(t<r.length){var i=r[t],a=[];if(i.restParam){var o=i.types.filter(E);o.length<i.types.length&&a.push({types:o,name:"..."+o.map((function(e){return e.name})).join("|"),hasAny:o.some((function(e){return e.isAny})),hasConversion:!1,restParam:!0}),a.push(i)}else a=i.types.map((function(e){return{types:[e],name:e.name,hasAny:e.isAny,hasConversion:e.conversion,restParam:!1}}));return s=a,u=function(i){return e(r,t+1,n.concat([i]))},Array.prototype.concat.apply([],s.map(u))}return[n];var s,u}(e,0,[])}function z(e,r,t){var n,i,a=[],o=K(e);try{for(o.s();!(i=o.n()).done;){var s=t[n=i.value];if("number"!=typeof s)throw new TypeError('No definition for referenced signature "'+n+'"');if("function"!=typeof(s=r[s]))return!1;a.push(s)}}catch(e){o.e(e)}finally{o.f()}return a}function q(e,r,t){for(var n=function(e){return e.map((function(e){return $(e)?L(e.referToSelf.callback):H(e)?j(e.referTo.references,e.referTo.callback):e}))}(e),i=new Array(n.length).fill(!1),a=!0;a;){a=!1;for(var o=!0,s=0;s<n.length;++s)if(!i[s]){var u=n[s];if($(u))n[s]=u.referToSelf.callback(t),n[s].referToSelf=u.referToSelf,i[s]=!0,o=!1;else if(H(u)){var c=z(u.referTo.references,n,r);c?(n[s]=u.referTo.callback.apply(this,c),n[s].referTo=u.referTo,i[s]=!0,o=!1):a=!0}}if(o&&a)throw new SyntaxError("Circular reference detected in resolving typed.referTo")}return n}function I(e,r){if(s.createCount++,0===Object.keys(r).length)throw new SyntaxError("No signatures provided");s.warnAgainstDeprecatedThis&&function(e){var r=/\bthis(\(|\.signatures\b)/;Object.keys(e).forEach((function(t){var n=e[t];if(r.test(n.toString()))throw new SyntaxError("Using `this` to self-reference a function is deprecated since typed-function@3. Use typed.referTo and typed.referToSelf instead.")}))}(r);var t,n=[],i=[],a={},o=[],u=function(){if(!Object.prototype.hasOwnProperty.call(r,t))return"continue";var e=v(t);if(!e)return"continue";n.forEach((function(r){if(function(e,r){for(var t=Math.max(e.length,r.length),n=0;n<t;n++){var i,a=D(e,n),o=!1,s=void 0,u=K(D(r,n));try{for(u.s();!(i=u.n()).done;)if(s=i.value,a.has(s)){o=!0;break}}catch(e){u.e(e)}finally{u.f()}if(!o)return!1}var c=e.length,l=r.length,f=x(e),p=x(r);return f?p?c===l:l>=c:p?c>=l:c===l}(r,e))throw new TypeError('Conflicting signatures "'+d(r)+'" and "'+d(e)+'".')})),n.push(e);var s=i.length;i.push(r[t]);var u,c=void 0,l=K(_(e.map(g)));try{for(l.s();!(u=l.n()).done;){var f=d(c=u.value);o.push({params:c,name:f,fn:s}),c.every((function(e){return!e.hasConversion}))&&(a[f]=s)}}catch(e){l.e(e)}finally{l.f()}};for(t in r)u();o.sort(B);var c,l=q(i,a,me);for(c in a)Object.prototype.hasOwnProperty.call(a,c)&&(a[c]=l[a[c]]);for(var f=[],p=new Map,m=0,h=o;m<h.length;m++)c=h[m],p.has(c.name)||(c.fn=l[c.fn],f.push(c),p.set(c.name,c));for(var y=f[0]&&f[0].params.length<=2&&!x(f[0].params),N=f[1]&&f[1].params.length<=2&&!x(f[1].params),E=f[2]&&f[2].params.length<=2&&!x(f[2].params),A=f[3]&&f[3].params.length<=2&&!x(f[3].params),C=f[4]&&f[4].params.length<=2&&!x(f[4].params),S=f[5]&&f[5].params.length<=2&&!x(f[5].params),M=y&&N&&E&&A&&C&&S,F=0;F<f.length;++F)f[F].test=w(f[F].params);for(var O=y?b(f[0].params[0]):ne,z=N?b(f[1].params[0]):ne,I=E?b(f[2].params[0]):ne,k=A?b(f[3].params[0]):ne,R=C?b(f[4].params[0]):ne,P=S?b(f[5].params[0]):ne,U=y?b(f[0].params[1]):ne,j=N?b(f[1].params[1]):ne,L=E?b(f[2].params[1]):ne,H=A?b(f[3].params[1]):ne,$=C?b(f[4].params[1]):ne,Z=S?b(f[5].params[1]):ne,G=0;G<f.length;++G)f[G].implementation=T(f[G].params,f[G].fn);var V=y?f[0].implementation:ie,W=N?f[1].implementation:ie,Y=E?f[2].implementation:ie,J=A?f[3].implementation:ie,X=C?f[4].implementation:ie,Q=S?f[5].implementation:ie,ee=y?f[0].params.length:-1,re=N?f[1].params.length:-1,te=E?f[2].params.length:-1,ae=A?f[3].params.length:-1,oe=C?f[4].params.length:-1,se=S?f[5].params.length:-1,ue=M?6:0,ce=f.length,le=f.map((function(e){return e.test})),fe=f.map((function(e){return e.implementation})),pe=function(){for(var r=ue;r<ce;r++)if(le[r](arguments))return fe[r].apply(this,arguments);return s.onMismatch(e,arguments,f)};function me(e,r){return arguments.length===ee&&O(e)&&U(r)?V.apply(this,arguments):arguments.length===re&&z(e)&&j(r)?W.apply(this,arguments):arguments.length===te&&I(e)&&L(r)?Y.apply(this,arguments):arguments.length===ae&&k(e)&&H(r)?J.apply(this,arguments):arguments.length===oe&&R(e)&&$(r)?X.apply(this,arguments):arguments.length===se&&P(e)&&Z(r)?Q.apply(this,arguments):pe.apply(this,arguments)}try{Object.defineProperty(me,"name",{value:e})}catch(e){}return me.signatures=a,me._typedFunctionData={signatures:f,signatureMap:p},me}function k(e,r,t){throw C(e,r,t)}function R(e){return U(e,0,e.length-1)}function P(e){return e[e.length-1]}function U(e,r,t){return Array.prototype.slice.call(e,r,t)}function j(e,r){return{referTo:{references:e,callback:r}}}function L(e){if("function"!=typeof e)throw new TypeError("Callback function expected as first argument");return{referToSelf:{callback:e}}}function H(e){return e&&"object"===re(e.referTo)&&Array.isArray(e.referTo.references)&&"function"==typeof e.referTo.callback}function $(e){return e&&"object"===re(e.referToSelf)&&"function"==typeof e.referToSelf.callback}function Z(e,r){if(!e)return r;if(r&&r!==e){var t=new Error("Function names do not match (expected: "+e+", actual: "+r+")");throw t.data={actual:r,expected:e},t}return e}function G(e){var r;for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(p(e[t])||"string"==typeof e[t].signature)&&(r=Z(r,e[t].name));return r}function V(e,r){var t;for(t in r)if(Object.prototype.hasOwnProperty.call(r,t)){if(t in e&&r[t]!==e[t]){var n=new Error('Signature "'+t+'" is defined twice');throw n.data={signature:t,sourceFunction:r[t],destFunction:e[t]},n}e[t]=r[t]}}l(),c(i);var W=s;function Y(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 s=function(e){for(var t="string"==typeof e,n=t?e:"",i={},a=t?1:0;a<arguments.length;++a){var o=arguments[a],s={},u=void 0;if("function"==typeof o?(u=o.name,"string"==typeof o.signature?s[o.signature]=o:p(o)&&(s=o.signatures)):r(o)&&(s=o,t||(u=G(o))),0===Object.keys(s).length){var c=new TypeError("Argument to 'typed' at index "+a+" is not a (typed) function, nor an object with signatures as keys and functions as values.");throw c.data={index:a,argument:o},c}t||(n=Z(n,u)),V(i,s)}return I(n||"",i)},s.create=e,s.createCount=W.createCount,s.onMismatch=k,s.throwMismatchError=k,s.createError=C,s.clear=l,s.clearConversions=function(){var e,r,i=K(n);try{for(i.s();!(r=i.n()).done;)e=r.value,t.get(e).conversionsTo=[]}catch(e){i.e(e)}finally{i.f()}o=0},s.addTypes=c,s._findType=u,s.referTo=function(){var e=R(arguments).map((function(e){return d(v(e))})),r=P(arguments);if("function"!=typeof r)throw new TypeError("Callback function expected as last argument");return j(e,r)},s.referToSelf=L,s.convert=function(e,r){var t=u(r);if(t.test(e))return e;var n=t.conversionsTo;if(0===n.length)throw new Error("There are no conversions to "+r+" defined.");for(var i=0;i<n.length;i++){if(u(n[i].from).test(e))return n[i].convert(e)}throw new Error("Cannot convert "+e+" to "+r)},s.findSignature=m,s.find=function(e,r,t){return m(e,r,t).implementation},s.isTypedFunction=p,s.warnAgainstDeprecatedThis=!0,s.addType=function(e,r){var n="any";!1!==r&&t.has("Object")&&(n="Object"),s.addTypes([e],n)},s.addConversion=function(e){Y(e);var r=u(e.to);if(!r.conversionsTo.every((function(r){return r.from!==e.from})))throw new Error('There is already a conversion from "'+e.from+'" to "'+r.name+'"');r.conversionsTo.push({from:e.from,convert:e.convert,index:o++})},s.addConversions=function(e){e.forEach(s.addConversion)},s.removeConversion=function(e){Y(e);var r=u(e.to),t=function(e,r){for(var t=0;t<e.length;t++)if(r(e[t]))return e[t]}(r.conversionsTo,(function(r){return r.from===e.from}));if(!t)throw new Error("Attempt to remove nonexistent conversion from "+e.from+" to "+e.to);if(t.convert!==e.convert)throw new Error("Conversion to remove does not match existing conversion");var n=r.conversionsTo.indexOf(t);r.conversionsTo.splice(n,1)},s.resolve=function(e,r){if(!p(e))throw new TypeError(ae);for(var t=e._typedFunctionData.signatures,n=0;n<t.length;++n)if(t[n].test(r))return t[n];return null},s}();function se(e){return"boolean"==typeof e||!!isFinite(e)&&e===Math.round(e)}var ue=Math.sign||function(e){return e>0?1:e<0?-1:0},ce=Math.log2||function(e){return Math.log(e)/Math.LN2},le=Math.log10||function(e){return Math.log(e)/Math.LN10},fe=Math.log1p||function(e){return Math.log(e+1)},pe=Math.cbrt||function(e){if(0===e)return e;var r,t=e<0;return t&&(e=-e),r=isFinite(e)?(e/((r=Math.exp(Math.log(e)/3))*r)+2*r)/3:e,t?-r:r},me=Math.expm1||function(e){return e>=2e-4||e<=-2e-4?Math.exp(e)-1:e+e*e/2+e*e*e/6};function de(e,r,t){var n={2:"0b",8:"0o",16:"0x"}[r],i="";if(t){if(t<1)throw new Error("size must be in greater than 0");if(!se(t))throw new Error("size must be an integer");if(e>2**(t-1)-1||e<-(2**(t-1)))throw new Error("Value must be in range [-2^".concat(t-1,", 2^").concat(t-1,"-1]"));if(!se(e))throw new Error("Value must be an integer");e<0&&(e+=2**t),i="i".concat(t)}var a="";return e<0&&(e=-e,a="-"),"".concat(a).concat(n).concat(e.toString(r)).concat(i)}function he(e,r){if("function"==typeof r)return r(e);if(e===1/0)return"Infinity";if(e===-1/0)return"-Infinity";if(isNaN(e))return"NaN";var t,n,i="auto";if(r&&(r.notation&&(i=r.notation),a(r)?t=r:a(r.precision)&&(t=r.precision),r.wordSize&&"number"!=typeof(n=r.wordSize)))throw new Error('Option "wordSize" must be a number');switch(i){case"fixed":return ye(e,t);case"exponential":return ve(e,t);case"engineering":return function(e,r){if(isNaN(e)||!isFinite(e))return String(e);var t=ge(e),n=xe(t,r),i=n.exponent,o=n.coefficients,s=i%3==0?i:i<0?i-3-i%3:i-i%3;if(a(r))for(;r>o.length||i-s+1>o.length;)o.push(0);else for(var u=Math.abs(i-s)-(o.length-1),c=0;c<u;c++)o.push(0);var l=Math.abs(i-s),f=1;for(;l>0;)f++,l--;var p=o.slice(f).join(""),m=a(r)&&p.length||p.match(/[1-9]/)?"."+p:"",d=o.slice(0,f).join("")+m+"e"+(i>=0?"+":"")+s.toString();return n.sign+d}(e,t);case"bin":return de(e,2,n);case"oct":return de(e,8,n);case"hex":return de(e,16,n);case"auto":return function(e,r,t){if(isNaN(e)||!isFinite(e))return String(e);var n=t&&void 0!==t.lowerExp?t.lowerExp:-3,i=t&&void 0!==t.upperExp?t.upperExp:5,a=ge(e),o=r?xe(a,r):a;if(o.exponent<n||o.exponent>=i)return ve(e,r);var s=o.coefficients,u=o.exponent;s.length<r&&(s=s.concat(be(r-s.length))),s=s.concat(be(u-s.length+1+(s.length<r?r-s.length:0)));var c=u>0?u:0;return c<(s=be(-u).concat(s)).length-1&&s.splice(c+1,0,"."),o.sign+s.join("")}(e,t,r&&r).replace(/((\.\d*?)(0+))($|e)/,(function(){var e=arguments[2],r=arguments[4];return"."!==e?e+r:r}));default:throw new Error('Unknown notation "'+i+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function ge(e){var r=String(e).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!r)throw new SyntaxError("Invalid number "+e);var t=r[1],n=r[2],i=parseFloat(r[4]||"0"),a=n.indexOf(".");i+=-1!==a?a-1:n.length-1;var o=n.replace(".","").replace(/^0*/,(function(e){return i-=e.length,""})).replace(/0*$/,"").split("").map((function(e){return parseInt(e)}));return 0===o.length&&(o.push(0),i++),{sign:t,coefficients:o,exponent:i}}function ye(e,r){if(isNaN(e)||!isFinite(e))return String(e);var t=ge(e),n="number"==typeof r?xe(t,t.exponent+1+r):t,i=n.coefficients,a=n.exponent+1,o=a+(r||0);return i.length<o&&(i=i.concat(be(o-i.length))),a<0&&(i=be(1-a).concat(i),a=1),a<i.length&&i.splice(a,0,0===a?"0.":"."),n.sign+i.join("")}function ve(e,r){if(isNaN(e)||!isFinite(e))return String(e);var t=ge(e),n=r?xe(t,r):t,i=n.coefficients,a=n.exponent;i.length<r&&(i=i.concat(be(r-i.length)));var o=i.shift();return n.sign+o+(i.length>0?"."+i.join(""):"")+"e"+(a>=0?"+":"")+a}function xe(e,r){for(var t={sign:e.sign,coefficients:e.coefficients,exponent:e.exponent},n=t.coefficients;r<=0;)n.unshift(0),t.exponent++,r++;if(n.length>r&&n.splice(r,n.length-r)[0]>=5){var i=r-1;for(n[i]++;10===n[i];)n.pop(),0===i&&(n.unshift(0),t.exponent++,i++),n[--i]++}return t}function be(e){for(var r=[],t=0;t<e;t++)r.push(0);return r}var we=Number.EPSILON||2220446049250313e-31;function Ne(e,r,t){if(null==t)return e===r;if(e===r)return!0;if(isNaN(e)||isNaN(r))return!1;if(isFinite(e)&&isFinite(r)){var n=Math.abs(e-r);return n<we||n<=Math.max(Math.abs(e),Math.abs(r))*t}return!1}var De=Math.acosh||function(e){return Math.log(Math.sqrt(e*e-1)+e)},Ee=Math.asinh||function(e){return Math.log(Math.sqrt(e*e+1)+e)},Ae=Math.atanh||function(e){return Math.log((1+e)/(1-e))/2},Ce=Math.cosh||function(e){return(Math.exp(e)+Math.exp(-e))/2},Se=Math.sinh||function(e){return(Math.exp(e)-Math.exp(-e))/2},Me=Math.tanh||function(e){var r=Math.exp(2*e);return(r-1)/(r+1)};function Fe(e,r,t){var n=new(0,e.constructor)(2),i="";if(t){if(t<1)throw new Error("size must be in greater than 0");if(!se(t))throw new Error("size must be an integer");if(e.greaterThan(n.pow(t-1).sub(1))||e.lessThan(n.pow(t-1).mul(-1)))throw new Error("Value must be in range [-2^".concat(t-1,", 2^").concat(t-1,"-1]"));if(!e.isInteger())throw new Error("Value must be an integer");e.lessThan(0)&&(e=e.add(n.pow(t))),i="i".concat(t)}switch(r){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(r," not supported "))}}function Be(e,r){if("function"==typeof r)return r(e);if(!e.isFinite())return e.isNaN()?"NaN":e.gt(0)?"Infinity":"-Infinity";var t,n,i="auto";if(void 0!==r&&(r.notation&&(i=r.notation),"number"==typeof r?t=r:void 0!==r.precision&&(t=r.precision),r.wordSize&&"number"!=typeof(n=r.wordSize)))throw new Error('Option "wordSize" must be a number');switch(i){case"fixed":return function(e,r){return e.toFixed(r)}(e,t);case"exponential":return Te(e,t);case"engineering":return function(e,r){var t=e.e,n=t%3==0?t:t<0?t-3-t%3:t-t%3,i=e.mul(Math.pow(10,-n)),a=i.toPrecision(r);if(-1!==a.indexOf("e")){a=new(0,e.constructor)(a).toFixed()}return a+"e"+(t>=0?"+":"")+n.toString()}(e,t);case"bin":return Fe(e,2,n);case"oct":return Fe(e,8,n);case"hex":return Fe(e,16,n);case"auto":var a=r&&void 0!==r.lowerExp?r.lowerExp:-3,o=r&&void 0!==r.upperExp?r.upperExp:5;if(e.isZero())return"0";var s=e.toSignificantDigits(t),u=s.e;return(u>=a&&u<o?s.toFixed():Te(e,t)).replace(/((\.\d*?)(0+))($|e)/,(function(){var e=arguments[2],r=arguments[4];return"."!==e?e+r:r}));default:throw new Error('Unknown notation "'+i+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function Te(e,r){return void 0!==r?e.toExponential(r-1):e.toExponential()}function Oe(e,r){var t=e.length-r.length,n=e.length;return e.substring(t,n)===r}function _e(e,r){var t=function(e,r){if("number"==typeof e)return he(e,r);if(o(e))return Be(e,r);if(function(e){return e&&"object"==typeof e&&"number"==typeof e.s&&"number"==typeof e.n&&"number"==typeof e.d||!1}(e))return r&&"decimal"===r.fraction?e.toString():e.s*e.n+"/"+e.d;if(Array.isArray(e))return Ie(e,r);if(l(e))return'"'+e+'"';if("function"==typeof e)return e.syntax?String(e.syntax):"function";if(e&&"object"==typeof e){return"function"==typeof e.format?e.format(r):e&&e.toString(r)!=={}.toString()?e.toString(r):"{"+Object.keys(e).map((t=>'"'+t+'": '+_e(e[t],r))).join(", ")+"}"}return String(e)}(e,r);return r&&"object"==typeof r&&"truncate"in r&&t.length>r.truncate?t.substring(0,r.truncate-3)+"...":t}function ze(e){for(var r=String(e),t="",n=0;n<r.length;){var i=r.charAt(n);"\\"===i?(t+=i,n++,""!==(i=r.charAt(n))&&-1!=='"\\/bfnrtu'.indexOf(i)||(t+="\\"),t+=i):t+='"'===i?'\\"':i,n++}return'"'+t+'"'}function qe(e){var r=String(e);return r=r.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Ie(e,r){if(Array.isArray(e)){for(var t="[",n=e.length,i=0;i<n;i++)0!==i&&(t+=", "),t+=Ie(e[i],r);return t+="]"}return _e(e,r)}function ke(e,r){if(!l(e))throw new TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: "+Z(e)+", index: 0)");if(!l(r))throw new TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: "+Z(r)+", index: 1)");return e===r?0:e>r?1:-1}function Re(e,r,t){if(!(this instanceof Re))throw new SyntaxError("Constructor must be called with the new operator");this.actual=e,this.expected=r,this.relation=t,this.message="Dimension mismatch ("+(Array.isArray(e)?"["+e.join(", ")+"]":e)+" "+(this.relation||"!=")+" "+(Array.isArray(r)?"["+r.join(", ")+"]":r)+")",this.stack=(new Error).stack}function Pe(e,r,t){if(!(this instanceof Pe))throw new SyntaxError("Constructor must be called with the new operator");this.index=e,arguments.length<3?(this.min=0,this.max=r):(this.min=r,this.max=t),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 Ue(e){for(var r=[];Array.isArray(e);)r.push(e.length),e=e[0];return r}function je(e,r,t){var n,i=e.length;if(i!==r[t])throw new Re(i,r[t]);if(t<r.length-1){var a=t+1;for(n=0;n<i;n++){var o=e[n];if(!Array.isArray(o))throw new Re(r.length-1,r.length,"<");je(e[n],r,a)}}else for(n=0;n<i;n++)if(Array.isArray(e[n]))throw new Re(r.length+1,r.length,">")}function Le(e,r){if(0===r.length){if(Array.isArray(e))throw new Re(e.length,0)}else je(e,r,0)}function He(e,r){if(!a(e)||!se(e))throw new TypeError("Index must be an integer (value: "+e+")");if(e<0||"number"==typeof r&&e>=r)throw new Pe(e,r)}function $e(e,r,t){if(!Array.isArray(e)||!Array.isArray(r))throw new TypeError("Array expected");if(0===r.length)throw new Error("Resizing to scalar is not supported");return r.forEach((function(e){if(!a(e)||!se(e)||e<0)throw new TypeError("Invalid size, must contain positive integers (size: "+_e(r)+")")})),Ze(e,r,0,void 0!==t?t:0),e}function Ze(e,r,t,n){var i,a,o=e.length,s=r[t],u=Math.min(o,s);if(e.length=s,t<r.length-1){var c=t+1;for(i=0;i<u;i++)a=e[i],Array.isArray(a)||(a=[a],e[i]=a),Ze(a,r,c,n);for(i=u;i<s;i++)a=[],e[i]=a,Ze(a,r,c,n)}else{for(i=0;i<u;i++)for(;Array.isArray(e[i]);)e[i]=e[i][0];for(i=u;i<s;i++)e[i]=n}}function Ge(e,r){var t=Ke(e),n=t.length;if(!Array.isArray(e)||!Array.isArray(r))throw new TypeError("Array expected");if(0===r.length)throw new Re(0,n,"!=");var i=We(r=Ve(r,n));if(n!==i)throw new Re(i,n,"!=");try{return function(e,r){for(var t,n=e,i=r.length-1;i>0;i--){var a=r[i];t=[];for(var o=n.length/a,s=0;s<o;s++)t.push(n.slice(s*a,(s+1)*a));n=t}return n}(t,r)}catch(e){if(e instanceof Re)throw new Re(i,n,"!=");throw e}}function Ve(e,r){var t=We(e),n=e.slice(),i=e.indexOf(-1);if(e.indexOf(-1,i+1)>=0)throw new Error("More than one wildcard in sizes");if(i>=0){if(!(r%t==0))throw new Error("Could not replace wildcard, since "+r+" is no multiple of "+-t);n[i]=-r/t}return n}function We(e){return e.reduce(((e,r)=>e*r),1)}function Ye(e,r){for(var t=r||Ue(e);Array.isArray(e)&&1===e.length;)e=e[0],t.shift();for(var n=t.length;1===t[n-1];)n--;return n<t.length&&(e=Je(e,n,0),t.length=n),e}function Je(e,r,t){var n,i;if(t<r){var a=t+1;for(n=0,i=e.length;n<i;n++)e[n]=Je(e[n],r,a)}else for(;Array.isArray(e);)e=e[0];return e}function Xe(e,r,t,n){var i=n||Ue(e);if(t)for(var a=0;a<t;a++)e=[e],i.unshift(1);for(e=Qe(e,r,0);i.length<r;)i.push(1);return e}function Qe(e,r,t){var n,i;if(Array.isArray(e)){var a=t+1;for(n=0,i=e.length;n<i;n++)e[n]=Qe(e[n],r,a)}else for(var o=t;o<r;o++)e=[e];return e}function Ke(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 er(e,r){return Array.prototype.map.call(e,r)}function rr(e,r){Array.prototype.forEach.call(e,r)}function tr(e,r){if(1!==Ue(e).length)throw new Error("Only one dimensional matrices supported");return Array.prototype.filter.call(e,r)}function nr(e,r){if(1!==Ue(e).length)throw new Error("Only one dimensional matrices supported");return Array.prototype.filter.call(e,(e=>r.test(e)))}function ir(e,r){return Array.prototype.join.call(e,r)}function ar(e){if(!Array.isArray(e))throw new TypeError("Array input expected");if(0===e.length)return e;var r=[],t=0;r[0]={value:e[0],identifier:0};for(var n=1;n<e.length;n++)e[n]===e[n-1]?t++:t=0,r.push({value:e[n],identifier:t});return r}function or(e){if(!Array.isArray(e))throw new TypeError("Array input expected");if(0===e.length)return e;for(var r=[],t=0;t<e.length;t++)r.push(e[t].value);return r}function sr(e,r){for(var t,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;var s=o?sr(a,r):r(a);if(void 0===t)t=s;else if(t!==s)return"mixed"}return t}function ur(e,r,t,n){function i(n){var i=function(e,r){for(var t={},n=0;n<r.length;n++){var i=r[n],a=e[i];void 0!==a&&(t[i]=a)}return t}(n,r.map(cr));return function(e,r,t){var n=r.filter((e=>!function(e){return e&&"?"===e[0]}(e))).every((e=>void 0!==t[e]));if(!n){var i=r.filter((e=>void 0===t[e]));throw new Error('Cannot create function "'.concat(e,'", ')+"some dependencies are missing: ".concat(i.map((e=>'"'.concat(e,'"'))).join(", "),"."))}}(e,r,n),t(i)}return i.isFactory=!0,i.fn=e,i.dependencies=r.slice().sort(),n&&(i.meta=n),i}function cr(e){return e&&"?"===e[0]?e.slice(1):e}function lr(e,r){if(dr(e)&&pr(e,r))return e[r];if("function"==typeof e[r]&&mr(e,r))throw new Error('Cannot access method "'+r+'" as a property');throw new Error('No access to property "'+r+'"')}function fr(e,r,t){if(dr(e)&&pr(e,r))return e[r]=t,t;throw new Error('No access to property "'+r+'"')}function pr(e,r){return!(!e||"object"!=typeof e)&&(!!Y(hr,r)||!(r in Object.prototype)&&!(r in Function.prototype))}function mr(e,r){return null!=e&&"function"==typeof e[r]&&(!(Y(e,r)&&Object.getPrototypeOf&&r in Object.getPrototypeOf(e))&&(!!Y(gr,r)||!(r in Object.prototype)&&!(r in Function.prototype)))}function dr(e){return"object"==typeof e&&e&&e.constructor===Object}Re.prototype=new RangeError,Re.prototype.constructor=RangeError,Re.prototype.name="DimensionError",Re.prototype.isDimensionError=!0,Pe.prototype=new RangeError,Pe.prototype.constructor=RangeError,Pe.prototype.name="IndexError",Pe.prototype.isIndexError=!0;var hr={length:!0,name:!0},gr={toString:!0,valueOf:!0,toLocaleString:!0};class yr{constructor(e){this.wrappedObject=e}keys(){return Object.keys(this.wrappedObject)}get(e){return lr(this.wrappedObject,e)}set(e,r){return fr(this.wrappedObject,e,r),this}has(e){return r=this.wrappedObject,e in r;var r}}function vr(){return new Map}function xr(e){if(!e)return vr();if(br(e))return e;if(E(e))return new yr(e);throw new Error("createMap can create maps from objects or Maps")}function br(e){return!!e&&(e instanceof Map||e instanceof yr||"function"==typeof e.set&&"function"==typeof e.get&&"function"==typeof e.keys&&"function"==typeof e.has)}function wr(e){for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++)t[n-1]=arguments[n];for(var i of t)if(i)if(br(i))for(var a of i.keys())e.set(a,i.get(a));else if(E(i))for(var o of Object.keys(i))e.set(o,i[o]);return e}var Nr=function(){return Nr=oe.create,oe},Dr=ur("typed",["?BigNumber","?Complex","?DenseMatrix","?Fraction"],(function(e){var{BigNumber:r,Complex:t,DenseMatrix:n,Fraction:i}=e,_=Nr();return _.clear(),_.addTypes([{name:"number",test:a},{name:"Complex",test:s},{name:"BigNumber",test:o},{name:"Fraction",test:u},{name:"Unit",test:c},{name:"identifier",test:e=>l&&/^(?:[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:l},{name:"Chain",test:$},{name:"Array",test:f},{name:"Matrix",test:p},{name:"DenseMatrix",test:d},{name:"SparseMatrix",test:h},{name:"Range",test:g},{name:"Index",test:y},{name:"boolean",test:v},{name:"ResultSet",test:x},{name:"Help",test:b},{name:"function",test:w},{name:"Date",test:N},{name:"RegExp",test:D},{name:"null",test:A},{name:"undefined",test:C},{name:"AccessorNode",test:S},{name:"ArrayNode",test:M},{name:"AssignmentNode",test:F},{name:"BlockNode",test:B},{name:"ConditionalNode",test:T},{name:"ConstantNode",test:O},{name:"FunctionNode",test:q},{name:"FunctionAssignmentNode",test:z},{name:"IndexNode",test:I},{name:"Node",test:k},{name:"ObjectNode",test:R},{name:"OperatorNode",test:P},{name:"ParenthesisNode",test:U},{name:"RangeNode",test:j},{name:"RelationalNode",test:L},{name:"SymbolNode",test:H},{name:"Map",test:br},{name:"Object",test:E}]),_.addConversions([{from:"number",to:"BigNumber",convert:function(e){if(r||Er(e),e.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length>15)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 t||Ar(e),new t(e,0)}},{from:"BigNumber",to:"Complex",convert:function(e){return t||Ar(e),new t(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 t||Ar(e),new t(e.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(e){i||Cr(e);var r=new i(e);if(r.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 r}},{from:"string",to:"number",convert:function(e){var r=Number(e);if(isNaN(r))throw new Error('Cannot convert "'+e+'" to a number');return r}},{from:"string",to:"BigNumber",convert:function(e){r||Er(e);try{return new r(e)}catch(r){throw new Error('Cannot convert "'+e+'" to BigNumber')}}},{from:"string",to:"Fraction",convert:function(e){i||Cr(e);try{return new i(e)}catch(r){throw new Error('Cannot convert "'+e+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(e){t||Ar(e);try{return new t(e)}catch(r){throw new Error('Cannot convert "'+e+'" to Complex')}}},{from:"boolean",to:"number",convert:function(e){return+e}},{from:"boolean",to:"BigNumber",convert:function(e){return r||Er(e),new r(+e)}},{from:"boolean",to:"Fraction",convert:function(e){return i||Cr(e),new i(+e)}},{from:"boolean",to:"string",convert:function(e){return String(e)}},{from:"Array",to:"Matrix",convert:function(e){return n||function(){throw new Error("Cannot convert array into a Matrix: no class 'DenseMatrix' provided")}(),new n(e)}},{from:"Matrix",to:"Array",convert:function(e){return e.valueOf()}}]),_.onMismatch=(e,r,t)=>{var n=_.createError(e,r,t);if(["wrongType","mismatch"].includes(n.data.category)&&1===r.length&&m(r[0])&&t.some((e=>!e.params.includes(",")))){var i=new TypeError("Function '".concat(e,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(e,")'."));throw i.data=n.data,i}throw n},_.onMismatch=(e,r,t)=>{var n=_.createError(e,r,t);if(["wrongType","mismatch"].includes(n.data.category)&&1===r.length&&m(r[0])&&t.some((e=>!e.params.includes(",")))){var i=new TypeError("Function '".concat(e,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(e,")'."));throw i.data=n.data,i}throw n},_}));function Er(e){throw new Error("Cannot convert value ".concat(e," into a BigNumber: no class 'BigNumber' provided"))}function Ar(e){throw new Error("Cannot convert value ".concat(e," into a Complex number: no class 'Complex' provided"))}function Cr(e){throw new Error("Cannot convert value ".concat(e," into a Fraction, no class 'Fraction' provided."))}var Sr,Mr,Fr=ur("ResultSet",[],(()=>{function e(r){if(!(this instanceof e))throw new SyntaxError("Constructor must be called with the new operator");this.entries=r||[]}return e.prototype.type="ResultSet",e.prototype.isResultSet=!0,e.prototype.valueOf=function(){return this.entries},e.prototype.toString=function(){return"["+this.entries.join(", ")+"]"},e.prototype.toJSON=function(){return{mathjs:"ResultSet",entries:this.entries}},e.fromJSON=function(r){return new e(r.entries)},e}),{isClass:!0}),Br=9e15,Tr=1e9,Or="0123456789abcdef",_r="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",zr="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",qr={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-Br,maxE:Br,crypto:!1},Ir=!0,kr="[DecimalError] ",Rr=kr+"Invalid argument: ",Pr=kr+"Precision limit exceeded",Ur=kr+"crypto unavailable",jr="[object Decimal]",Lr=Math.floor,Hr=Math.pow,$r=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,Zr=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,Gr=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,Vr=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Wr=1e7,Yr=7,Jr=_r.length-1,Xr=zr.length-1,Qr={toStringTag:jr};function Kr(e){var r,t,n,i=e.length-1,a="",o=e[0];if(i>0){for(a+=o,r=1;r<i;r++)n=e[r]+"",(t=Yr-n.length)&&(a+=lt(t)),a+=n;o=e[r],(t=Yr-(n=o+"").length)&&(a+=lt(t))}else if(0===o)return"0";for(;o%10==0;)o/=10;return a+o}function et(e,r,t){if(e!==~~e||e<r||e>t)throw Error(Rr+e)}function rt(e,r,t,n){var i,a,o,s;for(a=e[0];a>=10;a/=10)--r;return--r<0?(r+=Yr,i=0):(i=Math.ceil((r+1)/Yr),r%=Yr),a=Hr(10,Yr-r),s=e[i]%a|0,null==n?r<3?(0==r?s=s/100|0:1==r&&(s=s/10|0),o=t<4&&99999==s||t>3&&49999==s||5e4==s||0==s):o=(t<4&&s+1==a||t>3&&s+1==a/2)&&(e[i+1]/a/100|0)==Hr(10,r-2)-1||(s==a/2||0==s)&&0==(e[i+1]/a/100|0):r<4?(0==r?s=s/1e3|0:1==r?s=s/100|0:2==r&&(s=s/10|0),o=(n||t<4)&&9999==s||!n&&t>3&&4999==s):o=((n||t<4)&&s+1==a||!n&&t>3&&s+1==a/2)&&(e[i+1]/a/1e3|0)==Hr(10,r-3)-1,o}function tt(e,r,t){for(var n,i,a=[0],o=0,s=e.length;o<s;){for(i=a.length;i--;)a[i]*=r;for(a[0]+=Or.indexOf(e.charAt(o++)),n=0;n<a.length;n++)a[n]>t-1&&(void 0===a[n+1]&&(a[n+1]=0),a[n+1]+=a[n]/t|0,a[n]%=t)}return a.reverse()}Qr.absoluteValue=Qr.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),it(e)},Qr.ceil=function(){return it(new this.constructor(this),this.e+1,2)},Qr.clampedTo=Qr.clamp=function(e,r){var t=this,n=t.constructor;if(e=new n(e),r=new n(r),!e.s||!r.s)return new n(NaN);if(e.gt(r))throw Error(Rr+r);return t.cmp(e)<0?e:t.cmp(r)>0?r:new n(t)},Qr.comparedTo=Qr.cmp=function(e){var r,t,n,i,a=this,o=a.d,s=(e=new a.constructor(e)).d,u=a.s,c=e.s;if(!o||!s)return u&&c?u!==c?u:o===s?0:!o^u<0?1:-1:NaN;if(!o[0]||!s[0])return o[0]?u:s[0]?-c:0;if(u!==c)return u;if(a.e!==e.e)return a.e>e.e^u<0?1:-1;for(r=0,t=(n=o.length)<(i=s.length)?n:i;r<t;++r)if(o[r]!==s[r])return o[r]>s[r]^u<0?1:-1;return n===i?0:n>i^u<0?1:-1},Qr.cosine=Qr.cos=function(){var e,r,t=this,n=t.constructor;return t.d?t.d[0]?(e=n.precision,r=n.rounding,n.precision=e+Math.max(t.e,t.sd())+Yr,n.rounding=1,t=function(e,r){var t,n,i;if(r.isZero())return r;n=r.d.length,n<32?i=(1/bt(4,t=Math.ceil(n/3))).toString():(t=16,i="2.3283064365386962890625e-10");e.precision+=t,r=xt(e,1,r.times(i),new e(1));for(var a=t;a--;){var o=r.times(r);r=o.times(o).minus(o).times(8).plus(1)}return e.precision-=t,r}(n,wt(n,t)),n.precision=e,n.rounding=r,it(2==Mr||3==Mr?t.neg():t,e,r,!0)):new n(1):new n(NaN)},Qr.cubeRoot=Qr.cbrt=function(){var e,r,t,n,i,a,o,s,u,c,l=this,f=l.constructor;if(!l.isFinite()||l.isZero())return new f(l);for(Ir=!1,(a=l.s*Hr(l.s*l,1/3))&&Math.abs(a)!=1/0?n=new f(a.toString()):(t=Kr(l.d),(a=((e=l.e)-t.length+1)%3)&&(t+=1==a||-2==a?"0":"00"),a=Hr(t,1/3),e=Lr((e+1)/3)-(e%3==(e<0?-1:2)),(n=new f(t=a==1/0?"5e"+e:(t=a.toExponential()).slice(0,t.indexOf("e")+1)+e)).s=l.s),o=(e=f.precision)+3;;)if(c=(u=(s=n).times(s).times(s)).plus(l),n=nt(c.plus(l).times(s),c.plus(u),o+2,1),Kr(s.d).slice(0,o)===(t=Kr(n.d)).slice(0,o)){if("9999"!=(t=t.slice(o-3,o+1))&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(it(n,e+1,1),r=!n.times(n).times(n).eq(l));break}if(!i&&(it(s,e+1,0),s.times(s).times(s).eq(l))){n=s;break}o+=4,i=1}return Ir=!0,it(n,e,f.rounding,r)},Qr.decimalPlaces=Qr.dp=function(){var e,r=this.d,t=NaN;if(r){if(t=((e=r.length-1)-Lr(this.e/Yr))*Yr,e=r[e])for(;e%10==0;e/=10)t--;t<0&&(t=0)}return t},Qr.dividedBy=Qr.div=function(e){return nt(this,new this.constructor(e))},Qr.dividedToIntegerBy=Qr.divToInt=function(e){var r=this.constructor;return it(nt(this,new r(e),0,1,1),r.precision,r.rounding)},Qr.equals=Qr.eq=function(e){return 0===this.cmp(e)},Qr.floor=function(){return it(new this.constructor(this),this.e+1,3)},Qr.greaterThan=Qr.gt=function(e){return this.cmp(e)>0},Qr.greaterThanOrEqualTo=Qr.gte=function(e){var r=this.cmp(e);return 1==r||0===r},Qr.hyperbolicCosine=Qr.cosh=function(){var e,r,t,n,i,a=this,o=a.constructor,s=new o(1);if(!a.isFinite())return new o(a.s?1/0:NaN);if(a.isZero())return s;t=o.precision,n=o.rounding,o.precision=t+Math.max(a.e,a.sd())+4,o.rounding=1,(i=a.d.length)<32?r=(1/bt(4,e=Math.ceil(i/3))).toString():(e=16,r="2.3283064365386962890625e-10"),a=xt(o,1,a.times(r),new o(1),!0);for(var u,c=e,l=new o(8);c--;)u=a.times(a),a=s.minus(u.times(l.minus(u.times(l))));return it(a,o.precision=t,o.rounding=n,!0)},Qr.hyperbolicSine=Qr.sinh=function(){var e,r,t,n,i=this,a=i.constructor;if(!i.isFinite()||i.isZero())return new a(i);if(r=a.precision,t=a.rounding,a.precision=r+Math.max(i.e,i.sd())+4,a.rounding=1,(n=i.d.length)<3)i=xt(a,2,i,i,!0);else{e=(e=1.4*Math.sqrt(n))>16?16:0|e,i=xt(a,2,i=i.times(1/bt(5,e)),i,!0);for(var o,s=new a(5),u=new a(16),c=new a(20);e--;)o=i.times(i),i=i.times(s.plus(o.times(u.times(o).plus(c))))}return a.precision=r,a.rounding=t,it(i,r,t,!0)},Qr.hyperbolicTangent=Qr.tanh=function(){var e,r,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(e=n.precision,r=n.rounding,n.precision=e+7,n.rounding=1,nt(t.sinh(),t.cosh(),n.precision=e,n.rounding=r)):new n(t.s)},Qr.inverseCosine=Qr.acos=function(){var e,r=this,t=r.constructor,n=r.abs().cmp(1),i=t.precision,a=t.rounding;return-1!==n?0===n?r.isNeg()?ut(t,i,a):new t(0):new t(NaN):r.isZero()?ut(t,i+4,a).times(.5):(t.precision=i+6,t.rounding=1,r=r.asin(),e=ut(t,i+4,a).times(.5),t.precision=i,t.rounding=a,e.minus(r))},Qr.inverseHyperbolicCosine=Qr.acosh=function(){var e,r,t=this,n=t.constructor;return t.lte(1)?new n(t.eq(1)?0:NaN):t.isFinite()?(e=n.precision,r=n.rounding,n.precision=e+Math.max(Math.abs(t.e),t.sd())+4,n.rounding=1,Ir=!1,t=t.times(t).minus(1).sqrt().plus(t),Ir=!0,n.precision=e,n.rounding=r,t.ln()):new n(t)},Qr.inverseHyperbolicSine=Qr.asinh=function(){var e,r,t=this,n=t.constructor;return!t.isFinite()||t.isZero()?new n(t):(e=n.precision,r=n.rounding,n.precision=e+2*Math.max(Math.abs(t.e),t.sd())+6,n.rounding=1,Ir=!1,t=t.times(t).plus(1).sqrt().plus(t),Ir=!0,n.precision=e,n.rounding=r,t.ln())},Qr.inverseHyperbolicTangent=Qr.atanh=function(){var e,r,t,n,i=this,a=i.constructor;return i.isFinite()?i.e>=0?new a(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=a.precision,r=a.rounding,n=i.sd(),Math.max(n,e)<2*-i.e-1?it(new a(i),e,r,!0):(a.precision=t=n-i.e,i=nt(i.plus(1),new a(1).minus(i),t+e,1),a.precision=e+4,a.rounding=1,i=i.ln(),a.precision=e,a.rounding=r,i.times(.5))):new a(NaN)},Qr.inverseSine=Qr.asin=function(){var e,r,t,n,i=this,a=i.constructor;return i.isZero()?new a(i):(r=i.abs().cmp(1),t=a.precision,n=a.rounding,-1!==r?0===r?((e=ut(a,t+4,n).times(.5)).s=i.s,e):new a(NaN):(a.precision=t+6,a.rounding=1,i=i.div(new a(1).minus(i.times(i)).sqrt().plus(1)).atan(),a.precision=t,a.rounding=n,i.times(2)))},Qr.inverseTangent=Qr.atan=function(){var e,r,t,n,i,a,o,s,u,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<=Xr)return(o=ut(l,f+4,p).times(.25)).s=c.s,o}else{if(!c.s)return new l(NaN);if(f+4<=Xr)return(o=ut(l,f+4,p).times(.5)).s=c.s,o}for(l.precision=s=f+10,l.rounding=1,e=t=Math.min(28,s/Yr+2|0);e;--e)c=c.div(c.times(c).plus(1).sqrt().plus(1));for(Ir=!1,r=Math.ceil(s/Yr),n=1,u=c.times(c),o=new l(c),i=c;-1!==e;)if(i=i.times(u),a=o.minus(i.div(n+=2)),i=i.times(u),void 0!==(o=a.plus(i.div(n+=2))).d[r])for(e=r;o.d[e]===a.d[e]&&e--;);return t&&(o=o.times(2<<t-1)),Ir=!0,it(o,l.precision=f,l.rounding=p,!0)},Qr.isFinite=function(){return!!this.d},Qr.isInteger=Qr.isInt=function(){return!!this.d&&Lr(this.e/Yr)>this.d.length-2},Qr.isNaN=function(){return!this.s},Qr.isNegative=Qr.isNeg=function(){return this.s<0},Qr.isPositive=Qr.isPos=function(){return this.s>0},Qr.isZero=function(){return!!this.d&&0===this.d[0]},Qr.lessThan=Qr.lt=function(e){return this.cmp(e)<0},Qr.lessThanOrEqualTo=Qr.lte=function(e){return this.cmp(e)<1},Qr.logarithm=Qr.log=function(e){var r,t,n,i,a,o,s,u,c=this,l=c.constructor,f=l.precision,p=l.rounding;if(null==e)e=new l(10),r=!0;else{if(t=(e=new l(e)).d,e.s<0||!t||!t[0]||e.eq(1))return new l(NaN);r=e.eq(10)}if(t=c.d,c.s<0||!t||!t[0]||c.eq(1))return new l(t&&!t[0]?-1/0:1!=c.s?NaN:t?0:1/0);if(r)if(t.length>1)a=!0;else{for(i=t[0];i%10==0;)i/=10;a=1!==i}if(Ir=!1,o=ht(c,s=f+5),n=r?st(l,s+10):ht(e,s),rt((u=nt(o,n,s,1)).d,i=f,p))do{if(o=ht(c,s+=10),n=r?st(l,s+10):ht(e,s),u=nt(o,n,s,1),!a){+Kr(u.d).slice(i+1,i+15)+1==1e14&&(u=it(u,f+1,0));break}}while(rt(u.d,i+=10,p));return Ir=!0,it(u,f,p)},Qr.minus=Qr.sub=function(e){var r,t,n,i,a,o,s,u,c,l,f,p,m=this,d=m.constructor;if(e=new d(e),!m.d||!e.d)return m.s&&e.s?m.d?e.s=-e.s:e=new d(e.d||m.s!==e.s?m:NaN):e=new d(NaN),e;if(m.s!=e.s)return e.s=-e.s,m.plus(e);if(c=m.d,p=e.d,s=d.precision,u=d.rounding,!c[0]||!p[0]){if(p[0])e.s=-e.s;else{if(!c[0])return new d(3===u?-0:0);e=new d(m)}return Ir?it(e,s,u):e}if(t=Lr(e.e/Yr),l=Lr(m.e/Yr),c=c.slice(),a=l-t){for((f=a<0)?(r=c,a=-a,o=p.length):(r=p,t=l,o=c.length),a>(n=Math.max(Math.ceil(s/Yr),o)+2)&&(a=n,r.length=1),r.reverse(),n=a;n--;)r.push(0);r.reverse()}else{for((f=(n=c.length)<(o=p.length))&&(o=n),n=0;n<o;n++)if(c[n]!=p[n]){f=c[n]<p[n];break}a=0}for(f&&(r=c,c=p,p=r,e.s=-e.s),o=c.length,n=p.length-o;n>0;--n)c[o++]=0;for(n=p.length;n>a;){if(c[--n]<p[n]){for(i=n;i&&0===c[--i];)c[i]=Wr-1;--c[i],c[n]+=Wr}c[n]-=p[n]}for(;0===c[--o];)c.pop();for(;0===c[0];c.shift())--t;return c[0]?(e.d=c,e.e=ot(c,t),Ir?it(e,s,u):e):new d(3===u?-0:0)},Qr.modulo=Qr.mod=function(e){var r,t=this,n=t.constructor;return e=new n(e),!t.d||!e.s||e.d&&!e.d[0]?new n(NaN):!e.d||t.d&&!t.d[0]?it(new n(t),n.precision,n.rounding):(Ir=!1,9==n.modulo?(r=nt(t,e.abs(),0,3,1)).s*=e.s:r=nt(t,e,0,n.modulo,1),r=r.times(e),Ir=!0,t.minus(r))},Qr.naturalExponential=Qr.exp=function(){return dt(this)},Qr.naturalLogarithm=Qr.ln=function(){return ht(this)},Qr.negated=Qr.neg=function(){var e=new this.constructor(this);return e.s=-e.s,it(e)},Qr.plus=Qr.add=function(e){var r,t,n,i,a,o,s,u,c,l,f=this,p=f.constructor;if(e=new p(e),!f.d||!e.d)return f.s&&e.s?f.d||(e=new p(e.d||f.s===e.s?f:NaN)):e=new p(NaN),e;if(f.s!=e.s)return e.s=-e.s,f.minus(e);if(c=f.d,l=e.d,s=p.precision,u=p.rounding,!c[0]||!l[0])return l[0]||(e=new p(f)),Ir?it(e,s,u):e;if(a=Lr(f.e/Yr),n=Lr(e.e/Yr),c=c.slice(),i=a-n){for(i<0?(t=c,i=-i,o=l.length):(t=l,n=a,o=c.length),i>(o=(a=Math.ceil(s/Yr))>o?a+1:o+1)&&(i=o,t.length=1),t.reverse();i--;)t.push(0);t.reverse()}for((o=c.length)-(i=l.length)<0&&(i=o,t=l,l=c,c=t),r=0;i;)r=(c[--i]=c[i]+l[i]+r)/Wr|0,c[i]%=Wr;for(r&&(c.unshift(r),++n),o=c.length;0==c[--o];)c.pop();return e.d=c,e.e=ot(c,n),Ir?it(e,s,u):e},Qr.precision=Qr.sd=function(e){var r,t=this;if(void 0!==e&&e!==!!e&&1!==e&&0!==e)throw Error(Rr+e);return t.d?(r=ct(t.d),e&&t.e+1>r&&(r=t.e+1)):r=NaN,r},Qr.round=function(){var e=this,r=e.constructor;return it(new r(e),e.e+1,r.rounding)},Qr.sine=Qr.sin=function(){var e,r,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(e=n.precision,r=n.rounding,n.precision=e+Math.max(t.e,t.sd())+Yr,n.rounding=1,t=function(e,r){var t,n=r.d.length;if(n<3)return r.isZero()?r:xt(e,2,r,r);t=(t=1.4*Math.sqrt(n))>16?16:0|t,r=r.times(1/bt(5,t)),r=xt(e,2,r,r);for(var i,a=new e(5),o=new e(16),s=new e(20);t--;)i=r.times(r),r=r.times(a.plus(i.times(o.times(i).minus(s))));return r}(n,wt(n,t)),n.precision=e,n.rounding=r,it(Mr>2?t.neg():t,e,r,!0)):new n(NaN)},Qr.squareRoot=Qr.sqrt=function(){var e,r,t,n,i,a,o=this,s=o.d,u=o.e,c=o.s,l=o.constructor;if(1!==c||!s||!s[0])return new l(!c||c<0&&(!s||s[0])?NaN:s?o:1/0);for(Ir=!1,0==(c=Math.sqrt(+o))||c==1/0?(((r=Kr(s)).length+u)%2==0&&(r+="0"),c=Math.sqrt(r),u=Lr((u+1)/2)-(u<0||u%2),n=new l(r=c==1/0?"5e"+u:(r=c.toExponential()).slice(0,r.indexOf("e")+1)+u)):n=new l(c.toString()),t=(u=l.precision)+3;;)if(n=(a=n).plus(nt(o,a,t+2,1)).times(.5),Kr(a.d).slice(0,t)===(r=Kr(n.d)).slice(0,t)){if("9999"!=(r=r.slice(t-3,t+1))&&(i||"4999"!=r)){+r&&(+r.slice(1)||"5"!=r.charAt(0))||(it(n,u+1,1),e=!n.times(n).eq(o));break}if(!i&&(it(a,u+1,0),a.times(a).eq(o))){n=a;break}t+=4,i=1}return Ir=!0,it(n,u,l.rounding,e)},Qr.tangent=Qr.tan=function(){var e,r,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(e=n.precision,r=n.rounding,n.precision=e+10,n.rounding=1,(t=t.sin()).s=1,t=nt(t,new n(1).minus(t.times(t)).sqrt(),e+10,0),n.precision=e,n.rounding=r,it(2==Mr||4==Mr?t.neg():t,e,r,!0)):new n(NaN)},Qr.times=Qr.mul=function(e){var r,t,n,i,a,o,s,u,c,l=this,f=l.constructor,p=l.d,m=(e=new f(e)).d;if(e.s*=l.s,!(p&&p[0]&&m&&m[0]))return new f(!e.s||p&&!p[0]&&!m||m&&!m[0]&&!p?NaN:p&&m?0*e.s:e.s/0);for(t=Lr(l.e/Yr)+Lr(e.e/Yr),(u=p.length)<(c=m.length)&&(a=p,p=m,m=a,o=u,u=c,c=o),a=[],n=o=u+c;n--;)a.push(0);for(n=c;--n>=0;){for(r=0,i=u+n;i>n;)s=a[i]+m[n]*p[i-n-1]+r,a[i--]=s%Wr|0,r=s/Wr|0;a[i]=(a[i]+r)%Wr|0}for(;!a[--o];)a.pop();return r?++t:a.shift(),e.d=a,e.e=ot(a,t),Ir?it(e,f.precision,f.rounding):e},Qr.toBinary=function(e,r){return Nt(this,2,e,r)},Qr.toDecimalPlaces=Qr.toDP=function(e,r){var t=this,n=t.constructor;return t=new n(t),void 0===e?t:(et(e,0,Tr),void 0===r?r=n.rounding:et(r,0,8),it(t,e+t.e+1,r))},Qr.toExponential=function(e,r){var t,n=this,i=n.constructor;return void 0===e?t=at(n,!0):(et(e,0,Tr),void 0===r?r=i.rounding:et(r,0,8),t=at(n=it(new i(n),e+1,r),!0,e+1)),n.isNeg()&&!n.isZero()?"-"+t:t},Qr.toFixed=function(e,r){var t,n,i=this,a=i.constructor;return void 0===e?t=at(i):(et(e,0,Tr),void 0===r?r=a.rounding:et(r,0,8),t=at(n=it(new a(i),e+i.e+1,r),!1,e+n.e+1)),i.isNeg()&&!i.isZero()?"-"+t:t},Qr.toFraction=function(e){var r,t,n,i,a,o,s,u,c,l,f,p,m=this,d=m.d,h=m.constructor;if(!d)return new h(m);if(c=t=new h(1),n=u=new h(0),o=(a=(r=new h(n)).e=ct(d)-m.e-1)%Yr,r.d[0]=Hr(10,o<0?Yr+o:o),null==e)e=a>0?r:c;else{if(!(s=new h(e)).isInt()||s.lt(c))throw Error(Rr+s);e=s.gt(r)?a>0?r:c:s}for(Ir=!1,s=new h(Kr(d)),l=h.precision,h.precision=a=d.length*Yr*2;f=nt(s,r,0,1,1),1!=(i=t.plus(f.times(n))).cmp(e);)t=n,n=i,i=c,c=u.plus(f.times(i)),u=i,i=r,r=s.minus(f.times(i)),s=i;return i=nt(e.minus(t),n,0,1,1),u=u.plus(i.times(c)),t=t.plus(i.times(n)),u.s=c.s=m.s,p=nt(c,n,a,1).minus(m).abs().cmp(nt(u,t,a,1).minus(m).abs())<1?[c,n]:[u,t],h.precision=l,Ir=!0,p},Qr.toHexadecimal=Qr.toHex=function(e,r){return Nt(this,16,e,r)},Qr.toNearest=function(e,r){var t=this,n=t.constructor;if(t=new n(t),null==e){if(!t.d)return t;e=new n(1),r=n.rounding}else{if(e=new n(e),void 0===r?r=n.rounding:et(r,0,8),!t.d)return e.s?t:e;if(!e.d)return e.s&&(e.s=t.s),e}return e.d[0]?(Ir=!1,t=nt(t,e,0,r,1).times(e),Ir=!0,it(t)):(e.s=t.s,t=e),t},Qr.toNumber=function(){return+this},Qr.toOctal=function(e,r){return Nt(this,8,e,r)},Qr.toPower=Qr.pow=function(e){var r,t,n,i,a,o,s=this,u=s.constructor,c=+(e=new u(e));if(!(s.d&&e.d&&s.d[0]&&e.d[0]))return new u(Hr(+s,c));if((s=new u(s)).eq(1))return s;if(n=u.precision,a=u.rounding,e.eq(1))return it(s,n,a);if((r=Lr(e.e/Yr))>=e.d.length-1&&(t=c<0?-c:c)<=9007199254740991)return i=ft(u,s,t,n),e.s<0?new u(1).div(i):it(i,n,a);if((o=s.s)<0){if(r<e.d.length-1)return new u(NaN);if(0==(1&e.d[r])&&(o=1),0==s.e&&1==s.d[0]&&1==s.d.length)return s.s=o,s}return(r=0!=(t=Hr(+s,c))&&isFinite(t)?new u(t+"").e:Lr(c*(Math.log("0."+Kr(s.d))/Math.LN10+s.e+1)))>u.maxE+1||r<u.minE-1?new u(r>0?o/0:0):(Ir=!1,u.rounding=s.s=1,t=Math.min(12,(r+"").length),(i=dt(e.times(ht(s,n+t)),n)).d&&rt((i=it(i,n+5,1)).d,n,a)&&(r=n+10,+Kr((i=it(dt(e.times(ht(s,r+t)),r),r+5,1)).d).slice(n+1,n+15)+1==1e14&&(i=it(i,n+1,0))),i.s=o,Ir=!0,u.rounding=a,it(i,n,a))},Qr.toPrecision=function(e,r){var t,n=this,i=n.constructor;return void 0===e?t=at(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(et(e,1,Tr),void 0===r?r=i.rounding:et(r,0,8),t=at(n=it(new i(n),e,r),e<=n.e||n.e<=i.toExpNeg,e)),n.isNeg()&&!n.isZero()?"-"+t:t},Qr.toSignificantDigits=Qr.toSD=function(e,r){var t=this.constructor;return void 0===e?(e=t.precision,r=t.rounding):(et(e,1,Tr),void 0===r?r=t.rounding:et(r,0,8)),it(new t(this),e,r)},Qr.toString=function(){var e=this,r=e.constructor,t=at(e,e.e<=r.toExpNeg||e.e>=r.toExpPos);return e.isNeg()&&!e.isZero()?"-"+t:t},Qr.truncated=Qr.trunc=function(){return it(new this.constructor(this),this.e+1,1)},Qr.valueOf=Qr.toJSON=function(){var e=this,r=e.constructor,t=at(e,e.e<=r.toExpNeg||e.e>=r.toExpPos);return e.isNeg()?"-"+t:t};var nt=function(){function e(e,r,t){var n,i=0,a=e.length;for(e=e.slice();a--;)n=e[a]*r+i,e[a]=n%t|0,i=n/t|0;return i&&e.unshift(i),e}function r(e,r,t,n){var i,a;if(t!=n)a=t>n?1:-1;else for(i=a=0;i<t;i++)if(e[i]!=r[i]){a=e[i]>r[i]?1:-1;break}return a}function t(e,r,t,n){for(var i=0;t--;)e[t]-=i,i=e[t]<r[t]?1:0,e[t]=i*n+e[t]-r[t];for(;!e[0]&&e.length>1;)e.shift()}return function(n,i,a,o,s,u){var c,l,f,p,m,d,h,g,y,v,x,b,w,N,D,E,A,C,S,M,F=n.constructor,B=n.s==i.s?1:-1,T=n.d,O=i.d;if(!(T&&T[0]&&O&&O[0]))return new F(n.s&&i.s&&(T?!O||T[0]!=O[0]:O)?T&&0==T[0]||!O?0*B:B/0:NaN);for(u?(m=1,l=n.e-i.e):(u=Wr,m=Yr,l=Lr(n.e/m)-Lr(i.e/m)),S=O.length,A=T.length,v=(y=new F(B)).d=[],f=0;O[f]==(T[f]||0);f++);if(O[f]>(T[f]||0)&&l--,null==a?(N=a=F.precision,o=F.rounding):N=s?a+(n.e-i.e)+1:a,N<0)v.push(1),d=!0;else{if(N=N/m+2|0,f=0,1==S){for(p=0,O=O[0],N++;(f<A||p)&&N--;f++)D=p*u+(T[f]||0),v[f]=D/O|0,p=D%O|0;d=p||f<A}else{for((p=u/(O[0]+1)|0)>1&&(O=e(O,p,u),T=e(T,p,u),S=O.length,A=T.length),E=S,b=(x=T.slice(0,S)).length;b<S;)x[b++]=0;(M=O.slice()).unshift(0),C=O[0],O[1]>=u/2&&++C;do{p=0,(c=r(O,x,S,b))<0?(w=x[0],S!=b&&(w=w*u+(x[1]||0)),(p=w/C|0)>1?(p>=u&&(p=u-1),1==(c=r(h=e(O,p,u),x,g=h.length,b=x.length))&&(p--,t(h,S<g?M:O,g,u))):(0==p&&(c=p=1),h=O.slice()),(g=h.length)<b&&h.unshift(0),t(x,h,b,u),-1==c&&(c=r(O,x,S,b=x.length))<1&&(p++,t(x,S<b?M:O,b,u)),b=x.length):0===c&&(p++,x=[0]),v[f++]=p,c&&x[0]?x[b++]=T[E]||0:(x=[T[E]],b=1)}while((E++<A||void 0!==x[0])&&N--);d=void 0!==x[0]}v[0]||v.shift()}if(1==m)y.e=l,Sr=d;else{for(f=1,p=v[0];p>=10;p/=10)f++;y.e=f+l*m-1,it(y,s?a+y.e+1:a,o,d)}return y}}();function it(e,r,t,n){var i,a,o,s,u,c,l,f,p,m=e.constructor;e:if(null!=r){if(!(f=e.d))return e;for(i=1,s=f[0];s>=10;s/=10)i++;if((a=r-i)<0)a+=Yr,o=r,u=(l=f[p=0])/Hr(10,i-o-1)%10|0;else if((p=Math.ceil((a+1)/Yr))>=(s=f.length)){if(!n)break e;for(;s++<=p;)f.push(0);l=u=0,i=1,o=(a%=Yr)-Yr+1}else{for(l=s=f[p],i=1;s>=10;s/=10)i++;u=(o=(a%=Yr)-Yr+i)<0?0:l/Hr(10,i-o-1)%10|0}if(n=n||r<0||void 0!==f[p+1]||(o<0?l:l%Hr(10,i-o-1)),c=t<4?(u||n)&&(0==t||t==(e.s<0?3:2)):u>5||5==u&&(4==t||n||6==t&&(a>0?o>0?l/Hr(10,i-o):0:f[p-1])%10&1||t==(e.s<0?8:7)),r<1||!f[0])return f.length=0,c?(r-=e.e+1,f[0]=Hr(10,(Yr-r%Yr)%Yr),e.e=-r||0):f[0]=e.e=0,e;if(0==a?(f.length=p,s=1,p--):(f.length=p+1,s=Hr(10,Yr-a),f[p]=o>0?(l/Hr(10,i-o)%Hr(10,o)|0)*s:0),c)for(;;){if(0==p){for(a=1,o=f[0];o>=10;o/=10)a++;for(o=f[0]+=s,s=1;o>=10;o/=10)s++;a!=s&&(e.e++,f[0]==Wr&&(f[0]=1));break}if(f[p]+=s,f[p]!=Wr)break;f[p--]=0,s=1}for(a=f.length;0===f[--a];)f.pop()}return Ir&&(e.e>m.maxE?(e.d=null,e.e=NaN):e.e<m.minE&&(e.e=0,e.d=[0])),e}function at(e,r,t){if(!e.isFinite())return gt(e);var n,i=e.e,a=Kr(e.d),o=a.length;return r?(t&&(n=t-o)>0?a=a.charAt(0)+"."+a.slice(1)+lt(n):o>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(e.e<0?"e":"e+")+e.e):i<0?(a="0."+lt(-i-1)+a,t&&(n=t-o)>0&&(a+=lt(n))):i>=o?(a+=lt(i+1-o),t&&(n=t-i-1)>0&&(a=a+"."+lt(n))):((n=i+1)<o&&(a=a.slice(0,n)+"."+a.slice(n)),t&&(n=t-o)>0&&(i+1===o&&(a+="."),a+=lt(n))),a}function ot(e,r){var t=e[0];for(r*=Yr;t>=10;t/=10)r++;return r}function st(e,r,t){if(r>Jr)throw Ir=!0,t&&(e.precision=t),Error(Pr);return it(new e(_r),r,1,!0)}function ut(e,r,t){if(r>Xr)throw Error(Pr);return it(new e(zr),r,t,!0)}function ct(e){var r=e.length-1,t=r*Yr+1;if(r=e[r]){for(;r%10==0;r/=10)t--;for(r=e[0];r>=10;r/=10)t++}return t}function lt(e){for(var r="";e--;)r+="0";return r}function ft(e,r,t,n){var i,a=new e(1),o=Math.ceil(n/Yr+4);for(Ir=!1;;){if(t%2&&Dt((a=a.times(r)).d,o)&&(i=!0),0===(t=Lr(t/2))){t=a.d.length-1,i&&0===a.d[t]&&++a.d[t];break}Dt((r=r.times(r)).d,o)}return Ir=!0,a}function pt(e){return 1&e.d[e.d.length-1]}function mt(e,r,t){for(var n,i=new e(r[0]),a=0;++a<r.length;){if(!(n=new e(r[a])).s){i=n;break}i[t](n)&&(i=n)}return i}function dt(e,r){var t,n,i,a,o,s,u,c=0,l=0,f=0,p=e.constructor,m=p.rounding,d=p.precision;if(!e.d||!e.d[0]||e.e>17)return new p(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:NaN);for(null==r?(Ir=!1,u=d):u=r,s=new p(.03125);e.e>-2;)e=e.times(s),f+=5;for(u+=n=Math.log(Hr(2,f))/Math.LN10*2+5|0,t=a=o=new p(1),p.precision=u;;){if(a=it(a.times(e),u,1),t=t.times(++l),Kr((s=o.plus(nt(a,t,u,1))).d).slice(0,u)===Kr(o.d).slice(0,u)){for(i=f;i--;)o=it(o.times(o),u,1);if(null!=r)return p.precision=d,o;if(!(c<3&&rt(o.d,u-n,m,c)))return it(o,p.precision=d,m,Ir=!0);p.precision=u+=10,t=a=s=new p(1),l=0,c++}o=s}}function ht(e,r){var t,n,i,a,o,s,u,c,l,f,p,m=1,d=e,h=d.d,g=d.constructor,y=g.rounding,v=g.precision;if(d.s<0||!h||!h[0]||!d.e&&1==h[0]&&1==h.length)return new g(h&&!h[0]?-1/0:1!=d.s?NaN:h?0:d);if(null==r?(Ir=!1,l=v):l=r,g.precision=l+=10,n=(t=Kr(h)).charAt(0),!(Math.abs(a=d.e)<15e14))return c=st(g,l+2,v).times(a+""),d=ht(new g(n+"."+t.slice(1)),l-10).plus(c),g.precision=v,null==r?it(d,v,y,Ir=!0):d;for(;n<7&&1!=n||1==n&&t.charAt(1)>3;)n=(t=Kr((d=d.times(e)).d)).charAt(0),m++;for(a=d.e,n>1?(d=new g("0."+t),a++):d=new g(n+"."+t.slice(1)),f=d,u=o=d=nt(d.minus(1),d.plus(1),l,1),p=it(d.times(d),l,1),i=3;;){if(o=it(o.times(p),l,1),Kr((c=u.plus(nt(o,new g(i),l,1))).d).slice(0,l)===Kr(u.d).slice(0,l)){if(u=u.times(2),0!==a&&(u=u.plus(st(g,l+2,v).times(a+""))),u=nt(u,new g(m),l,1),null!=r)return g.precision=v,u;if(!rt(u.d,l-10,y,s))return it(u,g.precision=v,y,Ir=!0);g.precision=l+=10,c=o=d=nt(f.minus(1),f.plus(1),l,1),p=it(d.times(d),l,1),i=s=1}u=c,i+=2}}function gt(e){return String(e.s*e.s/0)}function yt(e,r){var t,n,i;for((t=r.indexOf("."))>-1&&(r=r.replace(".","")),(n=r.search(/e/i))>0?(t<0&&(t=n),t+=+r.slice(n+1),r=r.substring(0,n)):t<0&&(t=r.length),n=0;48===r.charCodeAt(n);n++);for(i=r.length;48===r.charCodeAt(i-1);--i);if(r=r.slice(n,i)){if(i-=n,e.e=t=t-n-1,e.d=[],n=(t+1)%Yr,t<0&&(n+=Yr),n<i){for(n&&e.d.push(+r.slice(0,n)),i-=Yr;n<i;)e.d.push(+r.slice(n,n+=Yr));r=r.slice(n),n=Yr-r.length}else n-=i;for(;n--;)r+="0";e.d.push(+r),Ir&&(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 vt(e,r){var t,n,i,a,o,s,u,c,l;if(r.indexOf("_")>-1){if(r=r.replace(/(\d)_(?=\d)/g,"$1"),Vr.test(r))return yt(e,r)}else if("Infinity"===r||"NaN"===r)return+r||(e.s=NaN),e.e=NaN,e.d=null,e;if(Zr.test(r))t=16,r=r.toLowerCase();else if($r.test(r))t=2;else{if(!Gr.test(r))throw Error(Rr+r);t=8}for((a=r.search(/p/i))>0?(u=+r.slice(a+1),r=r.substring(2,a)):r=r.slice(2),o=(a=r.indexOf("."))>=0,n=e.constructor,o&&(a=(s=(r=r.replace(".","")).length)-a,i=ft(n,new n(t),a,2*a)),a=l=(c=tt(r,t,Wr)).length-1;0===c[a];--a)c.pop();return a<0?new n(0*e.s):(e.e=ot(c,l),e.d=c,Ir=!1,o&&(e=nt(e,i,4*s)),u&&(e=e.times(Math.abs(u)<54?Hr(2,u):fn.pow(2,u))),Ir=!0,e)}function xt(e,r,t,n,i){var a,o,s,u,c=e.precision,l=Math.ceil(c/Yr);for(Ir=!1,u=t.times(t),s=new e(n);;){if(o=nt(s.times(u),new e(r++*r++),c,1),s=i?n.plus(o):n.minus(o),n=nt(o.times(u),new e(r++*r++),c,1),void 0!==(o=s.plus(n)).d[l]){for(a=l;o.d[a]===s.d[a]&&a--;);if(-1==a)break}a=s,s=n,n=o,o=a}return Ir=!0,o.d.length=l+1,o}function bt(e,r){for(var t=e;--r;)t*=e;return t}function wt(e,r){var t,n=r.s<0,i=ut(e,e.precision,1),a=i.times(.5);if((r=r.abs()).lte(a))return Mr=n?4:1,r;if((t=r.divToInt(i)).isZero())Mr=n?3:2;else{if((r=r.minus(t.times(i))).lte(a))return Mr=pt(t)?n?2:3:n?4:1,r;Mr=pt(t)?n?1:4:n?3:2}return r.minus(i).abs()}function Nt(e,r,t,n){var i,a,o,s,u,c,l,f,p,m=e.constructor,d=void 0!==t;if(d?(et(t,1,Tr),void 0===n?n=m.rounding:et(n,0,8)):(t=m.precision,n=m.rounding),e.isFinite()){for(d?(i=2,16==r?t=4*t-3:8==r&&(t=3*t-2)):i=r,(o=(l=at(e)).indexOf("."))>=0&&(l=l.replace(".",""),(p=new m(1)).e=l.length-o,p.d=tt(at(p),10,i),p.e=p.d.length),a=u=(f=tt(l,10,i)).length;0==f[--u];)f.pop();if(f[0]){if(o<0?a--:((e=new m(e)).d=f,e.e=a,f=(e=nt(e,p,t,n,0,i)).d,a=e.e,c=Sr),o=f[t],s=i/2,c=c||void 0!==f[t+1],c=n<4?(void 0!==o||c)&&(0===n||n===(e.s<0?3:2)):o>s||o===s&&(4===n||c||6===n&&1&f[t-1]||n===(e.s<0?8:7)),f.length=t,c)for(;++f[--t]>i-1;)f[t]=0,t||(++a,f.unshift(1));for(u=f.length;!f[u-1];--u);for(o=0,l="";o<u;o++)l+=Or.charAt(f[o]);if(d){if(u>1)if(16==r||8==r){for(o=16==r?4:3,--u;u%o;u++)l+="0";for(u=(f=tt(l,i,r)).length;!f[u-1];--u);for(o=1,l="1.";o<u;o++)l+=Or.charAt(f[o])}else l=l.charAt(0)+"."+l.slice(1);l=l+(a<0?"p":"p+")+a}else if(a<0){for(;++a;)l="0"+l;l="0."+l}else if(++a>u)for(a-=u;a--;)l+="0";else a<u&&(l=l.slice(0,a)+"."+l.slice(a))}else l=d?"0p+0":"0";l=(16==r?"0x":2==r?"0b":8==r?"0o":"")+l}else l=gt(e);return e.s<0?"-"+l:l}function Dt(e,r){if(e.length>r)return e.length=r,!0}function Et(e){return new this(e).abs()}function At(e){return new this(e).acos()}function Ct(e){return new this(e).acosh()}function St(e,r){return new this(e).plus(r)}function Mt(e){return new this(e).asin()}function Ft(e){return new this(e).asinh()}function Bt(e){return new this(e).atan()}function Tt(e){return new this(e).atanh()}function Ot(e,r){e=new this(e),r=new this(r);var t,n=this.precision,i=this.rounding,a=n+4;return e.s&&r.s?e.d||r.d?!r.d||e.isZero()?(t=r.s<0?ut(this,n,i):new this(0)).s=e.s:!e.d||r.isZero()?(t=ut(this,a,1).times(.5)).s=e.s:r.s<0?(this.precision=a,this.rounding=1,t=this.atan(nt(e,r,a,1)),r=ut(this,a,1),this.precision=n,this.rounding=i,t=e.s<0?t.minus(r):t.plus(r)):t=this.atan(nt(e,r,a,1)):(t=ut(this,a,1).times(r.s>0?.25:.75)).s=e.s:t=new this(NaN),t}function _t(e){return new this(e).cbrt()}function zt(e){return it(e=new this(e),e.e+1,2)}function qt(e,r,t){return new this(e).clamp(r,t)}function It(e){if(!e||"object"!=typeof e)throw Error(kr+"Object expected");var r,t,n,i=!0===e.defaults,a=["precision",1,Tr,"rounding",0,8,"toExpNeg",-Br,0,"toExpPos",0,Br,"maxE",0,Br,"minE",-Br,0,"modulo",0,9];for(r=0;r<a.length;r+=3)if(t=a[r],i&&(this[t]=qr[t]),void 0!==(n=e[t])){if(!(Lr(n)===n&&n>=a[r+1]&&n<=a[r+2]))throw Error(Rr+t+": "+n);this[t]=n}if(t="crypto",i&&(this[t]=qr[t]),void 0!==(n=e[t])){if(!0!==n&&!1!==n&&0!==n&&1!==n)throw Error(Rr+t+": "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw Error(Ur);this[t]=!0}else this[t]=!1}return this}function kt(e){return new this(e).cos()}function Rt(e){return new this(e).cosh()}function Pt(e,r){return new this(e).div(r)}function Ut(e){return new this(e).exp()}function jt(e){return it(e=new this(e),e.e+1,3)}function Lt(){var e,r,t=new this(0);for(Ir=!1,e=0;e<arguments.length;)if((r=new this(arguments[e++])).d)t.d&&(t=t.plus(r.times(r)));else{if(r.s)return Ir=!0,new this(1/0);t=r}return Ir=!0,t.sqrt()}function Ht(e){return e instanceof fn||e&&e.toStringTag===jr||!1}function $t(e){return new this(e).ln()}function Zt(e,r){return new this(e).log(r)}function Gt(e){return new this(e).log(2)}function Vt(e){return new this(e).log(10)}function Wt(){return mt(this,arguments,"lt")}function Yt(){return mt(this,arguments,"gt")}function Jt(e,r){return new this(e).mod(r)}function Xt(e,r){return new this(e).mul(r)}function Qt(e,r){return new this(e).pow(r)}function Kt(e){var r,t,n,i,a=0,o=new this(1),s=[];if(void 0===e?e=this.precision:et(e,1,Tr),n=Math.ceil(e/Yr),this.crypto)if(crypto.getRandomValues)for(r=crypto.getRandomValues(new Uint32Array(n));a<n;)(i=r[a])>=429e7?r[a]=crypto.getRandomValues(new Uint32Array(1))[0]:s[a++]=i%1e7;else{if(!crypto.randomBytes)throw Error(Ur);for(r=crypto.randomBytes(n*=4);a<n;)(i=r[a]+(r[a+1]<<8)+(r[a+2]<<16)+((127&r[a+3])<<24))>=214e7?crypto.randomBytes(4).copy(r,a):(s.push(i%1e7),a+=4);a=n/4}else for(;a<n;)s[a++]=1e7*Math.random()|0;for(n=s[--a],e%=Yr,n&&e&&(i=Hr(10,Yr-e),s[a]=(n/i|0)*i);0===s[a];a--)s.pop();if(a<0)t=0,s=[0];else{for(t=-1;0===s[0];t-=Yr)s.shift();for(n=1,i=s[0];i>=10;i/=10)n++;n<Yr&&(t-=Yr-n)}return o.e=t,o.d=s,o}function en(e){return it(e=new this(e),e.e+1,this.rounding)}function rn(e){return(e=new this(e)).d?e.d[0]?e.s:0*e.s:e.s||NaN}function tn(e){return new this(e).sin()}function nn(e){return new this(e).sinh()}function an(e){return new this(e).sqrt()}function on(e,r){return new this(e).sub(r)}function sn(){var e=0,r=arguments,t=new this(r[e]);for(Ir=!1;t.s&&++e<r.length;)t=t.plus(r[e]);return Ir=!0,it(t,this.precision,this.rounding)}function un(e){return new this(e).tan()}function cn(e){return new this(e).tanh()}function ln(e){return it(e=new this(e),e.e+1,1)}Qr[Symbol.for("nodejs.util.inspect.custom")]=Qr.toString,Qr[Symbol.toStringTag]="Decimal";var fn=Qr.constructor=function e(r){var t,n,i;function a(e){var r,t,n,i=this;if(!(i instanceof a))return new a(e);if(i.constructor=a,Ht(e))return i.s=e.s,void(Ir?!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():e.d));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(r=0,t=e;t>=10;t/=10)r++;return void(Ir?r>a.maxE?(i.e=NaN,i.d=null):r<a.minE?(i.e=0,i.d=[0]):(i.e=r,i.d=[e]):(i.e=r,i.d=[e]))}return 0*e!=0?(e||(i.s=NaN),i.e=NaN,void(i.d=null)):yt(i,e.toString())}if("string"!==n)throw Error(Rr+e);return 45===(t=e.charCodeAt(0))?(e=e.slice(1),i.s=-1):(43===t&&(e=e.slice(1)),i.s=1),Vr.test(e)?yt(i,e):vt(i,e)}if(a.prototype=Qr,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=It,a.clone=e,a.isDecimal=Ht,a.abs=Et,a.acos=At,a.acosh=Ct,a.add=St,a.asin=Mt,a.asinh=Ft,a.atan=Bt,a.atanh=Tt,a.atan2=Ot,a.cbrt=_t,a.ceil=zt,a.clamp=qt,a.cos=kt,a.cosh=Rt,a.div=Pt,a.exp=Ut,a.floor=jt,a.hypot=Lt,a.ln=$t,a.log=Zt,a.log10=Vt,a.log2=Gt,a.max=Wt,a.min=Yt,a.mod=Jt,a.mul=Xt,a.pow=Qt,a.random=Kt,a.round=en,a.sign=rn,a.sin=tn,a.sinh=nn,a.sqrt=an,a.sub=on,a.sum=sn,a.tan=un,a.tanh=cn,a.trunc=ln,void 0===r&&(r={}),r&&!0!==r.defaults)for(i=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],t=0;t<i.length;)r.hasOwnProperty(n=i[t++])||(r[n]=this[n]);return a.config(r),a}(qr);_r=new fn(_r),zr=new fn(zr);const pn=fn;var mn=ur("BigNumber",["?on","config"],(e=>{var{on:r,config:t}=e,n=pn.clone({precision:t.precision,modulo:pn.EUCLID});return n.prototype=Object.create(n.prototype),n.prototype.type="BigNumber",n.prototype.isBigNumber=!0,n.prototype.toJSON=function(){return{mathjs:"BigNumber",value:this.toString()}},n.fromJSON=function(e){return new n(e.value)},r&&r("config",(function(e,r){e.precision!==r.precision&&n.config({precision:e.precision})})),n}),{isClass:!0}),dn=t(45730),hn=ur("Complex",[],(()=>(Object.defineProperty(dn,"name",{value:"Complex"}),dn.prototype.constructor=dn,dn.prototype.type="Complex",dn.prototype.isComplex=!0,dn.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},dn.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},dn.prototype.format=function(e){var r=this.im,t=this.re,n=he(this.re,e),i=he(this.im,e),o=a(e)?e:e?e.precision:null;if(null!==o){var s=Math.pow(10,-o);Math.abs(t/r)<s&&(t=0),Math.abs(r/t)<s&&(r=0)}return 0===r?n:0===t?1===r?"i":-1===r?"-i":i+"i":r<0?-1===r?n+" - i":n+" - "+i.substring(1)+"i":1===r?n+" + i":n+" + "+i+"i"},dn.fromPolar=function(e){switch(arguments.length){case 1:var r=arguments[0];if("object"==typeof r)return dn(r);throw new TypeError("Input has to be an object with r and phi keys.");case 2:var t=arguments[0],n=arguments[1];if(a(t)){if(c(n)&&n.hasBase("ANGLE")&&(n=n.toNumber("rad")),a(n))return new dn({r:t,phi:n});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")}},dn.prototype.valueOf=dn.prototype.toString,dn.fromJSON=function(e){return new dn(e)},dn.compare=function(e,r){return e.re>r.re?1:e.re<r.re?-1:e.im>r.im?1:e.im<r.im?-1:0},dn)),{isClass:!0}),gn=t(1638),yn=ur("Fraction",[],(()=>(Object.defineProperty(gn,"name",{value:"Fraction"}),gn.prototype.constructor=gn,gn.prototype.type="Fraction",gn.prototype.isFraction=!0,gn.prototype.toJSON=function(){return{mathjs:"Fraction",n:this.s*this.n,d:this.d}},gn.fromJSON=function(e){return new gn(e)},gn)),{isClass:!0}),vn=ur("Range",[],(()=>{function e(r,t,n){if(!(this instanceof e))throw new SyntaxError("Constructor must be called with the new operator");var i=null!=r,a=null!=t,s=null!=n;if(i)if(o(r))r=r.toNumber();else if("number"!=typeof r)throw new TypeError("Parameter start must be a number");if(a)if(o(t))t=t.toNumber();else if("number"!=typeof t)throw new TypeError("Parameter end must be a number");if(s)if(o(n))n=n.toNumber();else if("number"!=typeof n)throw new TypeError("Parameter step must be a number");this.start=i?parseFloat(r):0,this.end=a?parseFloat(t):0,this.step=s?parseFloat(n):1}return e.prototype.type="Range",e.prototype.isRange=!0,e.parse=function(r){if("string"!=typeof r)return null;var t=r.split(":").map((function(e){return parseFloat(e)}));if(t.some((function(e){return isNaN(e)})))return null;switch(t.length){case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[2],t[1]);default:return null}},e.prototype.clone=function(){return new e(this.start,this.end,this.step)},e.prototype.size=function(){var e=0,r=this.start,t=this.step,n=this.end-r;return ue(t)===ue(n)?e=Math.ceil(n/t):0===n&&(e=0),isNaN(e)&&(e=0),[e]},e.prototype.min=function(){var e=this.size()[0];return e>0?this.step>0?this.start:this.start+(e-1)*this.step:void 0},e.prototype.max=function(){var e=this.size()[0];return e>0?this.step>0?this.start+(e-1)*this.step:this.start:void 0},e.prototype.forEach=function(e){var r=this.start,t=this.step,n=this.end,i=0;if(t>0)for(;r<n;)e(r,[i],this),r+=t,i++;else if(t<0)for(;r>n;)e(r,[i],this),r+=t,i++},e.prototype.map=function(e){var r=[];return this.forEach((function(t,n,i){r[n[0]]=e(t,n,i)})),r},e.prototype.toArray=function(){var e=[];return this.forEach((function(r,t){e[t[0]]=r})),e},e.prototype.valueOf=function(){return this.toArray()},e.prototype.format=function(e){var r=he(this.start,e);return 1!==this.step&&(r+=":"+he(this.step,e)),r+=":"+he(this.end,e)},e.prototype.toString=function(){return this.format()},e.prototype.toJSON=function(){return{mathjs:"Range",start:this.start,end:this.end,step:this.step}},e.fromJSON=function(r){return new e(r.start,r.end,r.step)},e}),{isClass:!0}),xn=ur("Matrix",[],(()=>{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,r){throw new Error("Cannot invoke create on a Matrix interface")},e.prototype.subset=function(e,r,t){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,r,t){throw new Error("Cannot invoke set on a Matrix interface")},e.prototype.resize=function(e,r){throw new Error("Cannot invoke resize on a Matrix interface")},e.prototype.reshape=function(e,r){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,r){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});function bn(e){var r=0,t=1,n=Object.create(null),i=Object.create(null),a=0,o=function(e){var o=i[e];if(o&&(delete n[o],delete i[e],--r,t===o)){if(!r)return a=0,void(t=1);for(;!hasOwnProperty.call(n,++t);)continue}};return e=Math.abs(e),{hit:function(s){var u=i[s],c=++a;if(n[c]=s,i[s]=c,!u){if(++r<=e)return;return s=n[t],o(s),s}if(delete n[u],t===u)for(;!hasOwnProperty.call(n,++t);)continue},delete:o,clear:function(){r=a=0,t=1,n=Object.create(null),i=Object.create(null)}}}function wn(e){var{hasher:r,limit:t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t=null==t?Number.POSITIVE_INFINITY:t,r=null==r?JSON.stringify:r,function n(){"object"!=typeof n.cache&&(n.cache={values:new Map,lru:bn(t||Number.POSITIVE_INFINITY)});for(var i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];var o=r(i);if(n.cache.values.has(o))return n.cache.lru.hit(o),n.cache.values.get(o);var s=e.apply(e,i);return n.cache.values.set(o,s),n.cache.values.delete(n.cache.lru.hit(o)),s}}function Nn(e){return Object.keys(e.signatures||{}).reduce((function(e,r){var t=(r.match(/,/g)||[]).length+1;return Math.max(e,t)}),-1)}var Dn=ur("DenseMatrix",["Matrix"],(e=>{var{Matrix:r}=e;function t(e,r){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");if(r&&!l(r))throw new Error("Invalid datatype: "+r);if(p(e))"DenseMatrix"===e.type?(this._data=G(e._data),this._size=G(e._size),this._datatype=r||e._datatype):(this._data=e.toArray(),this._size=e.size(),this._datatype=r||e._datatype);else if(e&&f(e.data)&&f(e.size))this._data=e.data,this._size=e.size,Le(this._data,this._size),this._datatype=r||e.datatype;else if(f(e))this._data=c(e),this._size=Ue(this._data),Le(this._data,this._size),this._datatype=r;else{if(e)throw new TypeError("Unsupported type of data ("+Z(e)+")");this._data=[],this._size=[0],this._datatype=r}}function n(e,r,t,i){var a=i===t-1,o=r.dimension(i);return a?o.map((function(r){return He(r,e.length),e[r]})).valueOf():o.map((function(a){return He(a,e.length),n(e[a],r,t,i+1)})).valueOf()}function i(e,r,t,n,a){var o=a===n-1,s=r.dimension(a);o?s.forEach((function(r,n){He(r),e[r]=t[n[0]]})):s.forEach((function(o,s){He(o),i(e[o],r,t[s[0]],n,a+1)}))}function s(e,r,t){if(0===r.length){for(var n=e._data;f(n);)n=n[0];return n}return e._size=r.slice(0),e._data=$e(e._data,e._size,t),e}function u(e,r,t){for(var n=e._size.slice(0),i=!1;n.length<r.length;)n.push(0),i=!0;for(var a=0,o=r.length;a<o;a++)r[a]>n[a]&&(n[a]=r[a],i=!0);i&&s(e,n,t)}function c(e){for(var r=0,t=e.length;r<t;r++){var n=e[r];f(n)?e[r]=c(n):n&&!0===n.isMatrix&&(e[r]=c(n.valueOf()))}return e}return t.prototype=new r,t.prototype.createDenseMatrix=function(e,r){return new t(e,r)},Object.defineProperty(t,"name",{value:"DenseMatrix"}),t.prototype.constructor=t,t.prototype.type="DenseMatrix",t.prototype.isDenseMatrix=!0,t.prototype.getDataType=function(){return sr(this._data,Z)},t.prototype.storage=function(){return"dense"},t.prototype.datatype=function(){return this._datatype},t.prototype.create=function(e,r){return new t(e,r)},t.prototype.subset=function(e,r,a){switch(arguments.length){case 1:return function(e,r){if(!y(r))throw new TypeError("Invalid index");var i=r.isScalar();if(i)return e.get(r.min());var a=r.size();if(a.length!==e._size.length)throw new Re(a.length,e._size.length);for(var o=r.min(),s=r.max(),u=0,c=e._size.length;u<c;u++)He(o[u],e._size[u]),He(s[u],e._size[u]);return new t(n(e._data,r,a.length,0),e._datatype)}(this,e);case 2:case 3:return function(e,r,t,n){if(!r||!0!==r.isIndex)throw new TypeError("Invalid index");var a,o=r.size(),s=r.isScalar();p(t)?(a=t.size(),t=t.valueOf()):a=Ue(t);if(s){if(0!==a.length)throw new TypeError("Scalar expected");e.set(r.min(),t,n)}else{if(o.length<e._size.length)throw new Re(o.length,e._size.length,"<");if(a.length<o.length){for(var c=0,l=0;1===o[c]&&1===a[c];)c++;for(;1===o[c];)l++,c++;t=Xe(t,o.length,l,a)}if(!W(o,a))throw new Re(o,a,">");var f=r.max().map((function(e){return e+1}));u(e,f,n);var m=o.length,d=0;i(e._data,r,t,m,d)}return e}(this,e,r,a);default:throw new SyntaxError("Wrong number of arguments")}},t.prototype.get=function(e){if(!f(e))throw new TypeError("Array expected");if(e.length!==this._size.length)throw new Re(e.length,this._size.length);for(var r=0;r<e.length;r++)He(e[r],this._size[r]);for(var t=this._data,n=0,i=e.length;n<i;n++){var a=e[n];He(a,t.length),t=t[a]}return t},t.prototype.set=function(e,r,t){if(!f(e))throw new TypeError("Array expected");if(e.length<this._size.length)throw new Re(e.length,this._size.length,"<");var n,i,a,o=e.map((function(e){return e+1}));u(this,o,t);var s=this._data;for(n=0,i=e.length-1;n<i;n++)He(a=e[n],s.length),s=s[a];return He(a=e[e.length-1],s.length),s[a]=r,this},t.prototype.resize=function(e,r,t){if(!m(e))throw new TypeError("Array or Matrix expected");var n=e.valueOf().map((e=>Array.isArray(e)&&1===e.length?e[0]:e));return s(t?this.clone():this,n,r)},t.prototype.reshape=function(e,r){var t=r?this.clone():this;t._data=Ge(t._data,e);var n=t._size.reduce(((e,r)=>e*r));return t._size=Ve(e,n),t},t.prototype.clone=function(){return new t({data:G(this._data),size:G(this._size),datatype:this._datatype})},t.prototype.size=function(){return this._size.slice(0)},t.prototype.map=function(e){var r=this,n=Nn(e),i=function t(i,a){return f(i)?i.map((function(e,r){return t(e,a.concat(r))})):1===n?e(i):2===n?e(i,a):e(i,a,r)}(this._data,[]);return new t(i,void 0!==this._datatype?sr(i,Z):void 0)},t.prototype.forEach=function(e){var r=this;!function t(n,i){f(n)?n.forEach((function(e,r){t(e,i.concat(r))})):e(n,i,r)}(this._data,[])},t.prototype[Symbol.iterator]=function*(){yield*function*e(r,t){if(f(r))for(var n=0;n<r.length;n++)yield*e(r[n],t.concat(n));else yield{value:r,index:t}}(this._data,[])},t.prototype.rows=function(){var e=[];if(2!==this.size().length)throw new TypeError("Rows can only be returned for a 2D matrix.");var r=this._data;for(var n of r)e.push(new t([n],this._datatype));return e},t.prototype.columns=function(){var e=this,r=[],n=this.size();if(2!==n.length)throw new TypeError("Rows can only be returned for a 2D matrix.");for(var i=this._data,a=function(n){var a=i.map((e=>[e[n]]));r.push(new t(a,e._datatype))},o=0;o<n[1];o++)a(o);return r},t.prototype.toArray=function(){return G(this._data)},t.prototype.valueOf=function(){return this._data},t.prototype.format=function(e){return _e(this._data,e)},t.prototype.toString=function(){return _e(this._data)},t.prototype.toJSON=function(){return{mathjs:"DenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},t.prototype.diagonal=function(e){if(e){if(o(e)&&(e=e.toNumber()),!a(e)||!se(e))throw new TypeError("The parameter k must be an integer number")}else e=0;for(var r=e>0?e:0,n=e<0?-e:0,i=this._size[0],s=this._size[1],u=Math.min(i-n,s-r),c=[],l=0;l<u;l++)c[l]=this._data[l+n][l+r];return new t({data:c,size:[u],datatype:this._datatype})},t.diagonal=function(e,r,n,i){if(!f(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(o(e)&&(e=e.toNumber()),!a(e)||!se(e)||e<1)throw new Error("Size values must be positive integers");return e})),n){if(o(n)&&(n=n.toNumber()),!a(n)||!se(n))throw new TypeError("The parameter k must be an integer number")}else n=0;var s,u=n>0?n:0,c=n<0?-n:0,l=e[0],m=e[1],d=Math.min(l-c,m-u);if(f(r)){if(r.length!==d)throw new Error("Invalid value array length");s=function(e){return r[e]}}else if(p(r)){var h=r.size();if(1!==h.length||h[0]!==d)throw new Error("Invalid matrix length");s=function(e){return r.get([e])}}else s=function(){return r};i||(i=o(s(0))?s(0).mul(0):0);var g=[];if(e.length>0){g=$e(g,e,i);for(var y=0;y<d;y++)g[y+c][y+u]=s(y)}return new t({data:g,size:[l,m]})},t.fromJSON=function(e){return new t(e)},t.prototype.swapRows=function(e,r){if(!(a(e)&&se(e)&&a(r)&&se(r)))throw new Error("Row index must be positive integers");if(2!==this._size.length)throw new Error("Only two dimensional matrix is supported");return He(e,this._size[0]),He(r,this._size[0]),t._swapRows(e,r,this._data),this},t._swapRows=function(e,r,t){var n=t[e];t[e]=t[r],t[r]=n},t}),{isClass:!0}),En="clone",An=ur(En,["typed"],(e=>{var{typed:r}=e;return r(En,{any:G})}));function Cn(e){var r,t,n=e.length,i=e[0].length,a=[];for(t=0;t<i;t++){var o=[];for(r=0;r<n;r++)o.push(e[r][t]);a.push(o)}return a}function Sn(e){for(var r=0;r<e.length;r++)if(m(e[r]))return!0;return!1}function Mn(e,r){p(e)&&(e=e.valueOf());for(var t=0,n=e.length;t<n;t++){var i=e[t];Array.isArray(i)?Mn(i,r):r(i)}}function Fn(e,r,t){return e&&"function"==typeof e.map?e.map((function(e){return Fn(e,r,t)})):r(e)}function Bn(e,r,t){var n=Array.isArray(e)?Ue(e):e.size();if(r<0||r>=n.length)throw new Pe(r,n.length);return p(e)?e.create(Tn(e.valueOf(),r,t)):Tn(e,r,t)}function Tn(e,r,t){var n,i,a,o;if(r<=0){if(Array.isArray(e[0])){for(o=Cn(e),i=[],n=0;n<o.length;n++)i[n]=Tn(o[n],r-1,t);return i}for(a=e[0],n=1;n<e.length;n++)a=t(a,e[n]);return a}for(i=[],n=0;n<e.length;n++)i[n]=Tn(e[n],r-1,t);return i}function On(e,r,t,n,i,a,o,s,u,c,l){var f,p,m,d,h=e._values,g=e._index,y=e._ptr;if(n)for(p=y[r],m=y[r+1],f=p;f<m;f++)t[d=g[f]]!==a?(t[d]=a,o.push(d),c?(n[d]=u?s(h[f],l):s(l,h[f]),i[d]=a):n[d]=h[f]):(n[d]=u?s(h[f],n[d]):s(n[d],h[f]),i[d]=a);else for(p=y[r],m=y[r+1],f=p;f<m;f++)t[d=g[f]]!==a?(t[d]=a,o.push(d)):i[d]=a}var _n="isInteger",zn=ur(_n,["typed"],(e=>{var{typed:r}=e;return r(_n,{number:se,BigNumber:function(e){return e.isInt()},Fraction:function(e){return 1===e.d&&isFinite(e.n)},"Array | Matrix":r.referToSelf((e=>r=>Fn(r,e)))})})),qn="number",In="number, number";function kn(e){return Math.abs(e)}function Rn(e,r){return e+r}function Pn(e,r){return e*r}function Un(e){return-e}function jn(e){return e}function Ln(e){return pe(e)}function Hn(e){return e*e*e}function $n(e){return Math.exp(e)}function Zn(e){return me(e)}function Gn(e,r){if(!se(e)||!se(r))throw new Error("Parameters in function gcd must be integer numbers");for(var t;0!==r;)t=e%r,e=r,r=t;return e<0?-e:e}function Vn(e,r){if(!se(e)||!se(r))throw new Error("Parameters in function lcm must be integer numbers");if(0===e||0===r)return 0;for(var t,n=e*r;0!==r;)r=e%(t=r),e=t;return Math.abs(n/e)}function Wn(e){return le(e)}function Yn(e){return ce(e)}function Jn(e,r){if(r>0)return e-r*Math.floor(e/r);if(0===r)return e;throw new Error("Cannot calculate mod for a negative divisor")}function Xn(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,t=r<0;if(t&&(r=-r),0===r)throw new Error("Root must be non-zero");if(e<0&&Math.abs(r)%2!=1)throw new Error("Root must be odd when a is negative.");if(0===e)return t?1/0:0;if(!isFinite(e))return t?0:e;var n=Math.pow(Math.abs(e),1/r);return n=e<0?-n:n,t?1/n:n}function Qn(e){return ue(e)}function Kn(e){return e*e}function ei(e,r){var t,n,i,a=0,o=1,s=1,u=0;if(!se(e)||!se(r))throw new Error("Parameters in function xgcd must be integer numbers");for(;r;)i=e-(n=Math.floor(e/r))*r,t=a,a=o-n*a,o=t,t=s,s=u-n*s,u=t,e=r,r=i;return e<0?[-e,-o,-u]:[e,e?o:0,u]}function ri(e,r){return e*e<1&&r===1/0||e*e>1&&r===-1/0?0:Math.pow(e,r)}function ti(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!se(r)||r<0||r>15)throw new Error("Number of decimals in function round must be an integer from 0 to 15 inclusive");return parseFloat(ye(e,r))}kn.signature=qn,Rn.signature=In,Pn.signature=In,Un.signature=qn,jn.signature=qn,Ln.signature=qn,Hn.signature=qn,$n.signature=qn,Zn.signature=qn,Gn.signature=In,Vn.signature=In,Wn.signature=qn,Yn.signature=qn,Jn.signature=In,Qn.signature=qn,Kn.signature=qn,ei.signature=In,ri.signature=In;var ni="number, number";function ii(e,r){if(!se(e)||!se(r))throw new Error("Integers expected in function bitAnd");return e&r}function ai(e){if(!se(e))throw new Error("Integer expected in function bitNot");return~e}function oi(e,r){if(!se(e)||!se(r))throw new Error("Integers expected in function bitOr");return e|r}function si(e,r){if(!se(e)||!se(r))throw new Error("Integers expected in function bitXor");return e^r}function ui(e,r){if(!se(e)||!se(r))throw new Error("Integers expected in function leftShift");return e<<r}function ci(e,r){if(!se(e)||!se(r))throw new Error("Integers expected in function rightArithShift");return e>>r}function li(e,r){if(!se(e)||!se(r))throw new Error("Integers expected in function rightLogShift");return e>>>r}function fi(e,r){if(r<e)return 1;if(r===e)return r;var t=r+e>>1;return fi(e,t)*fi(t+1,r)}function pi(e,r){if(!se(e)||e<0)throw new TypeError("Positive integer value expected in function combinations");if(!se(r)||r<0)throw new TypeError("Positive integer value expected in function combinations");if(r>e)throw new TypeError("k must be less than or equal to n");for(var t=e-r,n=1,i=2,a=r<t?r:t,o=r<t?t+1:r+1;o<=e;++o)for(n*=o;i<=a&&n%i==0;)n/=i,++i;return i<=a&&(n/=fi(i,a)),n}ii.signature=ni,ai.signature="number",oi.signature=ni,si.signature=ni,ui.signature=ni,ci.signature=ni,li.signature=ni,pi.signature="number, number";var mi=Math.PI,di=2*Math.PI,hi=Math.E,gi="number, number";function yi(e){return!e}function vi(e,r){return!(!e&&!r)}function xi(e,r){return!!e!=!!r}function bi(e,r){return!(!e||!r)}function wi(e){var r;if(se(e))return e<=0?isFinite(e)?1/0:NaN:e>171?1/0:fi(1,e-1);if(e<.5)return Math.PI/(Math.sin(Math.PI*e)*wi(1-e));if(e>=171.35)return 1/0;if(e>85){var t=e*e,n=t*e,i=n*e,a=i*e;return Math.sqrt(2*Math.PI/e)*Math.pow(e/Math.E,e)*(1+1/(12*e)+1/(288*t)-139/(51840*n)-571/(2488320*i)+163879/(209018880*a)+5246819/(75246796800*a*e))}--e,r=Di[0];for(var o=1;o<Di.length;++o)r+=Di[o]/(e+o);var s=e+Ni+.5;return Math.sqrt(2*Math.PI)*Math.pow(s,e+.5)*Math.exp(-s)*r}yi.signature="number",vi.signature=gi,xi.signature=gi,bi.signature=gi,wi.signature="number";var Ni=4.7421875,Di=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22],Ei=.9189385332046728,Ai=[1.000000000190015,76.18009172947146,-86.50532032941678,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18];function Ci(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))-Ci(1-e);for(var r=(e-=1)+5+.5,t=Ai[0],n=6;n>=1;n--)t+=Ai[n]/(e+n);return Ei+(e+.5)*Math.log(r)-r+Math.log(t)}Ci.signature="number";var Si="number";function Mi(e){return De(e)}function Fi(e){return Math.atan(1/e)}function Bi(e){return isFinite(e)?(Math.log((e+1)/e)+Math.log(e/(e-1)))/2:0}function Ti(e){return Math.asin(1/e)}function Oi(e){var r=1/e;return Math.log(r+Math.sqrt(r*r+1))}function _i(e){return Math.acos(1/e)}function zi(e){var r=1/e,t=Math.sqrt(r*r-1);return Math.log(t+r)}function qi(e){return Ee(e)}function Ii(e){return Ae(e)}function ki(e){return 1/Math.tan(e)}function Ri(e){var r=Math.exp(2*e);return(r+1)/(r-1)}function Pi(e){return 1/Math.sin(e)}function Ui(e){return 0===e?Number.POSITIVE_INFINITY:Math.abs(2/(Math.exp(e)-Math.exp(-e)))*ue(e)}function ji(e){return 1/Math.cos(e)}function Li(e){return 2/(Math.exp(e)+Math.exp(-e))}function Hi(e){return Se(e)}Mi.signature=Si,Fi.signature=Si,Bi.signature=Si,Ti.signature=Si,Oi.signature=Si,_i.signature=Si,zi.signature=Si,qi.signature=Si,Ii.signature=Si,ki.signature=Si,Ri.signature=Si,Pi.signature=Si,Ui.signature=Si,ji.signature=Si,Li.signature=Si,Hi.signature=Si;var $i="number";function Zi(e){return e<0}function Gi(e){return e>0}function Vi(e){return 0===e}function Wi(e){return Number.isNaN(e)}Zi.signature=$i,Gi.signature=$i,Vi.signature=$i,Wi.signature=$i;var Yi="isNegative",Ji=ur(Yi,["typed"],(e=>{var{typed:r}=e;return r(Yi,{number:Zi,BigNumber:function(e){return e.isNeg()&&!e.isZero()&&!e.isNaN()},Fraction:function(e){return e.s<0},Unit:r.referToSelf((e=>t=>r.find(e,t.valueType())(t.value))),"Array | Matrix":r.referToSelf((e=>r=>Fn(r,e)))})})),Xi="isNumeric",Qi=ur(Xi,["typed"],(e=>{var{typed:r}=e;return r(Xi,{"number | BigNumber | Fraction | boolean":()=>!0,"Complex | Unit | string | null | undefined | Node":()=>!1,"Array | Matrix":r.referToSelf((e=>r=>Fn(r,e)))})})),Ki="hasNumericValue",ea=ur(Ki,["typed","isNumeric"],(e=>{var{typed:r,isNumeric:t}=e;return r(Ki,{boolean:()=>!0,string:function(e){return e.trim().length>0&&!isNaN(Number(e))},any:function(e){return t(e)}})})),ra="isPositive",ta=ur(ra,["typed"],(e=>{var{typed:r}=e;return r(ra,{number:Gi,BigNumber:function(e){return!e.isNeg()&&!e.isZero()&&!e.isNaN()},Fraction:function(e){return e.s>0&&e.n>0},Unit:r.referToSelf((e=>t=>r.find(e,t.valueType())(t.value))),"Array | Matrix":r.referToSelf((e=>r=>Fn(r,e)))})})),na="isZero",ia=ur(na,["typed"],(e=>{var{typed:r}=e;return r(na,{number:Vi,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((e=>t=>r.find(e,t.valueType())(t.value))),"Array | Matrix":r.referToSelf((e=>r=>Fn(r,e)))})})),aa="isNaN",oa=ur(aa,["typed"],(e=>{var{typed:r}=e;return r(aa,{number:Wi,BigNumber:function(e){return e.isNaN()},Fraction:function(e){return!1},Complex:function(e){return e.isNaN()},Unit:function(e){return Number.isNaN(e.value)},"Array | Matrix":function(e){return Fn(e,Number.isNaN)}})})),sa="typeOf",ua=ur(sa,["typed"],(e=>{var{typed:r}=e;return r(sa,{any:Z})}));function ca(e,r,t){if(null==t)return e.eq(r);if(e.eq(r))return!0;if(e.isNaN()||r.isNaN())return!1;if(e.isFinite()&&r.isFinite()){var n=e.minus(r).abs();if(n.isZero())return!0;var i=e.constructor.max(e.abs(),r.abs());return n.lte(i.times(t))}return!1}var la=ur("compareUnits",["typed"],(e=>{var{typed:r}=e;return{"Unit, Unit":r.referToSelf((e=>(t,n)=>{if(!t.equalBase(n))throw new Error("Cannot compare units with different base");return r.find(e,[t.valueType(),n.valueType()])(t.value,n.value)}))}})),fa="equalScalar",pa=ur(fa,["typed","config"],(e=>{var{typed:r,config:t}=e,n=la({typed:r});return r(fa,{"boolean, boolean":function(e,r){return e===r},"number, number":function(e,r){return Ne(e,r,t.epsilon)},"BigNumber, BigNumber":function(e,r){return e.eq(r)||ca(e,r,t.epsilon)},"Fraction, Fraction":function(e,r){return e.equals(r)},"Complex, Complex":function(e,r){return function(e,r,t){return Ne(e.re,r.re,t)&&Ne(e.im,r.im,t)}(e,r,t.epsilon)}},n)})),ma=(ur(fa,["typed","config"],(e=>{var{typed:r,config:t}=e;return r(fa,{"number, number":function(e,r){return Ne(e,r,t.epsilon)}})})),ur("SparseMatrix",["typed","equalScalar","Matrix"],(e=>{var{typed:r,equalScalar:t,Matrix:n}=e;function i(e,r){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if(r&&!l(r))throw new Error("Invalid datatype: "+r);if(p(e))!function(e,r,t){"SparseMatrix"===r.type?(e._values=r._values?G(r._values):void 0,e._index=G(r._index),e._ptr=G(r._ptr),e._size=G(r._size),e._datatype=t||r._datatype):s(e,r.valueOf(),t||r._datatype)}(this,e,r);else if(e&&f(e.index)&&f(e.ptr)&&f(e.size))this._values=e.values,this._index=e.index,this._ptr=e.ptr,this._size=e.size,this._datatype=r||e.datatype;else if(f(e))s(this,e,r);else{if(e)throw new TypeError("Unsupported type of data ("+Z(e)+")");this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=r}}function s(e,n,i){e._values=[],e._index=[],e._ptr=[],e._datatype=i;var a=n.length,o=0,s=t,u=0;if(l(i)&&(s=r.find(t,[i,i])||t,u=r.convert(0,i)),a>0){var c=0;do{e._ptr.push(e._index.length);for(var p=0;p<a;p++){var m=n[p];if(f(m)){if(0===c&&o<m.length&&(o=m.length),c<m.length){var d=m[c];s(d,u)||(e._values.push(d),e._index.push(p))}}else 0===c&&o<1&&(o=1),s(m,u)||(e._values.push(m),e._index.push(p))}c++}while(c<o)}e._ptr.push(e._index.length),e._size=[a,o]}function u(e,r,t,n){if(t-r==0)return t;for(var i=r;i<t;i++)if(n[i]===e)return i;return r}function c(e,r,t,n,i,a,o){i.splice(e,0,n),a.splice(e,0,r);for(var s=t+1;s<o.length;s++)o[s]++}function d(e,n,i,a){var o=a||0,s=t,u=0;l(e._datatype)&&(s=r.find(t,[e._datatype,e._datatype])||t,u=r.convert(0,e._datatype),o=r.convert(o,e._datatype));var c,f,p,m=!s(o,u),d=e._size[0],h=e._size[1];if(i>h){for(f=h;f<i;f++)if(e._ptr[f]=e._values.length,m)for(c=0;c<d;c++)e._values.push(o),e._index.push(c);e._ptr[i]=e._values.length}else i<h&&(e._ptr.splice(i+1,h-i),e._values.splice(e._ptr[i],e._values.length),e._index.splice(e._ptr[i],e._index.length));if(h=i,n>d){if(m){var g=0;for(f=0;f<h;f++){e._ptr[f]=e._ptr[f]+g,p=e._ptr[f+1]+g;var y=0;for(c=d;c<n;c++,y++)e._values.splice(p+y,0,o),e._index.splice(p+y,0,c),g++}e._ptr[h]=e._values.length}}else if(n<d){var v=0;for(f=0;f<h;f++){e._ptr[f]=e._ptr[f]-v;var x=e._ptr[f],b=e._ptr[f+1]-v;for(p=x;p<b;p++)(c=e._index[p])>n-1&&(e._values.splice(p,1),e._index.splice(p,1),v++)}e._ptr[f]=e._values.length}return e._size[0]=n,e._size[1]=i,e}function h(e,r,t,n,i){var a,o,s=n[0],u=n[1],c=[];for(a=0;a<s;a++)for(c[a]=[],o=0;o<u;o++)c[a][o]=0;for(o=0;o<u;o++)for(var l=t[o],f=t[o+1],p=l;p<f;p++)c[a=r[p]][o]=e?i?G(e[p]):e[p]:1;return c}return i.prototype=new n,i.prototype.createSparseMatrix=function(e,r){return new i(e,r)},Object.defineProperty(i,"name",{value:"SparseMatrix"}),i.prototype.constructor=i,i.prototype.type="SparseMatrix",i.prototype.isSparseMatrix=!0,i.prototype.getDataType=function(){return sr(this._values,Z)},i.prototype.storage=function(){return"sparse"},i.prototype.datatype=function(){return this._datatype},i.prototype.create=function(e,r){return new i(e,r)},i.prototype.density=function(){var e=this._size[0],r=this._size[1];return 0!==e&&0!==r?this._index.length/(e*r):0},i.prototype.subset=function(e,r,t){if(!this._values)throw new Error("Cannot invoke subset on a Pattern only matrix");switch(arguments.length){case 1:return function(e,r){if(!y(r))throw new TypeError("Invalid index");if(r.isScalar())return e.get(r.min());var t,n,a,o,s=r.size();if(s.length!==e._size.length)throw new Re(s.length,e._size.length);var u=r.min(),c=r.max();for(t=0,n=e._size.length;t<n;t++)He(u[t],e._size[t]),He(c[t],e._size[t]);var l=e._values,f=e._index,p=e._ptr,m=r.dimension(0),d=r.dimension(1),h=[],g=[];m.forEach((function(e,r){g[e]=r[0],h[e]=!0}));var v=l?[]:void 0,x=[],b=[];return d.forEach((function(e){for(b.push(x.length),a=p[e],o=p[e+1];a<o;a++)t=f[a],!0===h[t]&&(x.push(g[t]),v&&v.push(l[a]))})),b.push(x.length),new i({values:v,index:x,ptr:b,size:s,datatype:e._datatype})}(this,e);case 2:case 3:return function(e,r,t,n){if(!r||!0!==r.isIndex)throw new TypeError("Invalid index");var i,a=r.size(),o=r.isScalar();p(t)?(i=t.size(),t=t.toArray()):i=Ue(t);if(o){if(0!==i.length)throw new TypeError("Scalar expected");e.set(r.min(),t,n)}else{if(1!==a.length&&2!==a.length)throw new Re(a.length,e._size.length,"<");if(i.length<a.length){for(var s=0,u=0;1===a[s]&&1===i[s];)s++;for(;1===a[s];)u++,s++;t=Xe(t,a.length,u,i)}if(!W(a,i))throw new Re(a,i,">");if(1===a.length){r.dimension(0).forEach((function(r,i){He(r),e.set([r,0],t[i[0]],n)}))}else{var c=r.dimension(0),l=r.dimension(1);c.forEach((function(r,i){He(r),l.forEach((function(a,o){He(a),e.set([r,a],t[i[0]][o[0]],n)}))}))}}return e}(this,e,r,t);default:throw new SyntaxError("Wrong number of arguments")}},i.prototype.get=function(e){if(!f(e))throw new TypeError("Array expected");if(e.length!==this._size.length)throw new Re(e.length,this._size.length);if(!this._values)throw new Error("Cannot invoke get on a Pattern only matrix");var r=e[0],t=e[1];He(r,this._size[0]),He(t,this._size[1]);var n=u(r,this._ptr[t],this._ptr[t+1],this._index);return n<this._ptr[t+1]&&this._index[n]===r?this._values[n]:0},i.prototype.set=function(e,n,i){if(!f(e))throw new TypeError("Array expected");if(e.length!==this._size.length)throw new Re(e.length,this._size.length);if(!this._values)throw new Error("Cannot invoke set on a Pattern only matrix");var a=e[0],o=e[1],s=this._size[0],p=this._size[1],m=t,h=0;l(this._datatype)&&(m=r.find(t,[this._datatype,this._datatype])||t,h=r.convert(0,this._datatype)),(a>s-1||o>p-1)&&(d(this,Math.max(a+1,s),Math.max(o+1,p),i),s=this._size[0],p=this._size[1]),He(a,s),He(o,p);var g=u(a,this._ptr[o],this._ptr[o+1],this._index);return g<this._ptr[o+1]&&this._index[g]===a?m(n,h)?function(e,r,t,n,i){t.splice(e,1),n.splice(e,1);for(var a=r+1;a<i.length;a++)i[a]--}(g,o,this._values,this._index,this._ptr):this._values[g]=n:m(n,h)||c(g,a,o,n,this._values,this._index,this._ptr),this},i.prototype.resize=function(e,r,t){if(!m(e))throw new TypeError("Array or Matrix expected");var n=e.valueOf().map((e=>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(!a(e)||!se(e)||e<0)throw new TypeError("Invalid size, must contain positive integers (size: "+_e(n)+")")})),d(t?this.clone():this,n[0],n[1],r)},i.prototype.reshape=function(e,r){if(!f(e))throw new TypeError("Array expected");if(2!==e.length)throw new Error("Sparse matrices can only be reshaped in two dimensions");e.forEach((function(r){if(!a(r)||!se(r)||r<=-2||0===r)throw new TypeError("Invalid size, must contain positive integers or -1 (size: "+_e(e)+")")}));var t=this._size[0]*this._size[1];if(t!==(e=Ve(e,t))[0]*e[1])throw new Error("Reshaping sparse matrix will result in the wrong number of elements");var n=r?this.clone():this;if(this._size[0]===e[0]&&this._size[1]===e[1])return n;for(var i=[],o=0;o<n._ptr.length;o++)for(var s=0;s<n._ptr[o+1]-n._ptr[o];s++)i.push(o);for(var l=n._values.slice(),p=n._index.slice(),m=0;m<n._index.length;m++){var d=p[m],h=i[m],g=d*n._size[1]+h;i[m]=g%e[1],p[m]=Math.floor(g/e[1])}n._values.length=0,n._index.length=0,n._ptr.length=e[1]+1,n._size=e.slice();for(var y=0;y<n._ptr.length;y++)n._ptr[y]=0;for(var v=0;v<l.length;v++){var x=p[v],b=i[v],w=l[v];c(u(x,n._ptr[b],n._ptr[b+1],n._index),x,b,w,n._values,n._index,n._ptr)}return n},i.prototype.clone=function(){return new i({values:this._values?G(this._values):void 0,index:G(this._index),ptr:G(this._ptr),size:G(this._size),datatype:this._datatype})},i.prototype.size=function(){return this._size.slice(0)},i.prototype.map=function(e,n){if(!this._values)throw new Error("Cannot invoke map on a Pattern only matrix");var a=this,o=this._size[0],s=this._size[1],u=Nn(e);return function(e,n,a,o,s,u,c){var f=[],p=[],m=[],d=t,h=0;l(e._datatype)&&(d=r.find(t,[e._datatype,e._datatype])||t,h=r.convert(0,e._datatype));for(var g=function(e,r,t){e=u(e,r,t),d(e,h)||(f.push(e),p.push(r))},y=o;y<=s;y++){m.push(f.length);var v=e._ptr[y],x=e._ptr[y+1];if(c)for(var b=v;b<x;b++){var w=e._index[b];w>=n&&w<=a&&g(e._values[b],w-n,y-o)}else{for(var N={},D=v;D<x;D++){N[e._index[D]]=e._values[D]}for(var E=n;E<=a;E++){g(E in N?N[E]:0,E-n,y-o)}}}return m.push(f.length),new i({values:f,index:p,ptr:m,size:[a-n+1,s-o+1]})}(this,0,o-1,0,s-1,(function(r,t,n){return 1===u?e(r):2===u?e(r,[t,n]):e(r,[t,n],a)}),n)},i.prototype.forEach=function(e,r){if(!this._values)throw new Error("Cannot invoke forEach on a Pattern only matrix");for(var t=this._size[0],n=this._size[1],i=0;i<n;i++){var a=this._ptr[i],o=this._ptr[i+1];if(r)for(var s=a;s<o;s++){var u=this._index[s];e(this._values[s],[u,i],this)}else{for(var c={},l=a;l<o;l++){c[this._index[l]]=this._values[l]}for(var f=0;f<t;f++){e(f in c?c[f]:0,[f,i],this)}}}},i.prototype[Symbol.iterator]=function*(){if(!this._values)throw new Error("Cannot iterate a Pattern only matrix");for(var e=this._size[1],r=0;r<e;r++)for(var t=this._ptr[r],n=this._ptr[r+1],i=t;i<n;i++){var a=this._index[i];yield{value:this._values[i],index:[a,r]}}},i.prototype.toArray=function(){return h(this._values,this._index,this._ptr,this._size,!0)},i.prototype.valueOf=function(){return h(this._values,this._index,this._ptr,this._size,!1)},i.prototype.format=function(e){for(var r=this._size[0],t=this._size[1],n=this.density(),i="Sparse Matrix ["+_e(r,e)+" x "+_e(t,e)+"] density: "+_e(n,e)+"\n",a=0;a<t;a++)for(var o=this._ptr[a],s=this._ptr[a+1],u=o;u<s;u++){i+="\n ("+_e(this._index[u],e)+", "+_e(a,e)+") ==> "+(this._values?_e(this._values[u],e):"X")}return i},i.prototype.toString=function(){return _e(this.toArray())},i.prototype.toJSON=function(){return{mathjs:"SparseMatrix",values:this._values,index:this._index,ptr:this._ptr,size:this._size,datatype:this._datatype}},i.prototype.diagonal=function(e){if(e){if(o(e)&&(e=e.toNumber()),!a(e)||!se(e))throw new TypeError("The parameter k must be an integer number")}else e=0;var r=e>0?e:0,t=e<0?-e:0,n=this._size[0],s=this._size[1],u=Math.min(n-t,s-r),c=[],l=[],f=[];f[0]=0;for(var p=r;p<s&&c.length<u;p++)for(var m=this._ptr[p],d=this._ptr[p+1],h=m;h<d;h++){var g=this._index[h];if(g===p-r+t){c.push(this._values[h]),l[c.length-1]=g-t;break}}return f.push(c.length),new i({values:c,index:l,ptr:f,size:[u,1]})},i.fromJSON=function(e){return new i(e)},i.diagonal=function(e,n,s,u,c){if(!f(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(o(e)&&(e=e.toNumber()),!a(e)||!se(e)||e<1)throw new Error("Size values must be positive integers");return e})),s){if(o(s)&&(s=s.toNumber()),!a(s)||!se(s))throw new TypeError("The parameter k must be an integer number")}else s=0;var m=t,d=0;l(c)&&(m=r.find(t,[c,c])||t,d=r.convert(0,c));var h,g=s>0?s:0,y=s<0?-s:0,v=e[0],x=e[1],b=Math.min(v-y,x-g);if(f(n)){if(n.length!==b)throw new Error("Invalid value array length");h=function(e){return n[e]}}else if(p(n)){var w=n.size();if(1!==w.length||w[0]!==b)throw new Error("Invalid matrix length");h=function(e){return n.get([e])}}else h=function(){return n};for(var N=[],D=[],E=[],A=0;A<x;A++){E.push(N.length);var C=A-g;if(C>=0&&C<b){var S=h(C);m(S,d)||(D.push(C+y),N.push(S))}}return E.push(N.length),new i({values:N,index:D,ptr:E,size:[v,x]})},i.prototype.swapRows=function(e,r){if(!(a(e)&&se(e)&&a(r)&&se(r)))throw new Error("Row index must be positive integers");if(2!==this._size.length)throw new Error("Only two dimensional matrix is supported");return He(e,this._size[0]),He(r,this._size[0]),i._swapRows(e,r,this._size[1],this._values,this._index,this._ptr),this},i._forEachRow=function(e,r,t,n,i){for(var a=n[e],o=n[e+1],s=a;s<o;s++)i(t[s],r[s])},i._swapRows=function(e,r,t,n,i,a){for(var o=0;o<t;o++){var s=a[o],c=a[o+1],l=u(e,s,c,i),f=u(r,s,c,i);if(l<c&&f<c&&i[l]===e&&i[f]===r){if(n){var p=n[l];n[l]=n[f],n[f]=p}}else if(l<c&&i[l]===e&&(f>=c||i[f]!==r)){var m=n?n[l]:void 0;i.splice(f,0,r),n&&n.splice(f,0,m),i.splice(f<=l?l+1:l,1),n&&n.splice(f<=l?l+1:l,1)}else if(f<c&&i[f]===r&&(l>=c||i[l]!==e)){var d=n?n[f]:void 0;i.splice(l,0,e),n&&n.splice(l,0,d),i.splice(l<=f?f+1:f,1),n&&n.splice(l<=f?f+1:f,1)}}},i}),{isClass:!0}));var da=ur("number",["typed"],(e=>{var{typed:r}=e,t=r("number",{"":function(){return 0},number:function(e){return e},string:function(e){if("NaN"===e)return NaN;var r,t,n=(t=(r=e).match(/(0[box])([0-9a-fA-F]*)\.([0-9a-fA-F]*)/))?{input:r,radix:{"0b":2,"0o":8,"0x":16}[t[1]],integerPart:t[2],fractionalPart:t[3]}:null;if(n)return function(e){for(var r=parseInt(e.integerPart,e.radix),t=0,n=0;n<e.fractionalPart.length;n++)t+=parseInt(e.fractionalPart[n],e.radix)/Math.pow(e.radix,n+1);var i=r+t;if(isNaN(i))throw new SyntaxError('String "'+e.input+'" is no valid number');return i}(n);var i=0,a=e.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);a&&(i=Number(a[2]),e=a[1]);var o=Number(e);if(isNaN(o))throw new SyntaxError('String "'+e+'" is no valid number');if(a){if(o>2**i-1)throw new SyntaxError('String "'.concat(e,'" is out of range'));o>=2**(i-1)&&(o-=2**i)}return o},BigNumber:function(e){return e.toNumber()},Fraction:function(e){return e.valueOf()},Unit:r.referToSelf((e=>r=>{var t=r.clone();return t.value=e(r.value),t})),null:function(e){return 0},"Unit, string | Unit":function(e,r){return e.toNumber(r)},"Array | Matrix":r.referToSelf((e=>r=>Fn(r,e)))});return t.fromJSON=function(e){return parseFloat(e.value)},t})),ha="string",ga=ur(ha,["typed"],(e=>{var{typed:r}=e;return r(ha,{"":function(){return""},number:he,null:function(e){return"null"},boolean:function(e){return e+""},string:function(e){return e},"Array | Matrix":r.referToSelf((e=>r=>Fn(r,e))),any:function(e){return String(e)}})})),ya="boolean",va=ur(ya,["typed"],(e=>{var{typed:r}=e;return r(ya,{"":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 r=e.toLowerCase();if("true"===r)return!0;if("false"===r)return!1;var t=Number(e);if(""!==e&&!isNaN(t))return!!t;throw new Error('Cannot convert "'+e+'" to a boolean')},"Array | Matrix":r.referToSelf((e=>r=>Fn(r,e)))})})),xa=ur("bignumber",["typed","BigNumber"],(e=>{var{typed:r,BigNumber:t}=e;return r("bignumber",{"":function(){return new t(0)},number:function(e){return new t(e+"")},string:function(e){var r=e.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);if(r){var n=r[2],i=t(r[1]),a=new t(2).pow(Number(n));if(i.gt(a.sub(1)))throw new SyntaxError('String "'.concat(e,'" is out of range'));var o=new t(2).pow(Number(n)-1);return i.gte(o)?i.sub(a):i}return new t(e)},BigNumber:function(e){return e},Unit:r.referToSelf((e=>r=>{var t=r.clone();return t.value=e(r.value),t})),Fraction:function(e){return new t(e.n).div(e.d).times(e.s)},null:function(e){return new t(0)},"Array | Matrix":r.referToSelf((e=>r=>Fn(r,e)))})})),ba=ur("complex",["typed","Complex"],(e=>{var{typed:r,Complex:t}=e;return r("complex",{"":function(){return t.ZERO},number:function(e){return new t(e,0)},"number, number":function(e,r){return new t(e,r)},"BigNumber, BigNumber":function(e,r){return new t(e.toNumber(),r.toNumber())},Fraction:function(e){return new t(e.valueOf(),0)},Complex:function(e){return e.clone()},string:function(e){return t(e)},null:function(e){return t(0)},Object:function(e){if("re"in e&&"im"in e)return new t(e.re,e.im);if("r"in e&&"phi"in e||"abs"in e&&"arg"in e)return new t(e);throw new Error("Expected object with properties (re and im) or (r and phi) or (abs and arg)")},"Array | Matrix":r.referToSelf((e=>r=>Fn(r,e)))})})),wa=ur("fraction",["typed","Fraction"],(e=>{var{typed:r,Fraction:t}=e;return r("fraction",{number:function(e){if(!isFinite(e)||isNaN(e))throw new Error(e+" cannot be represented as a fraction");return new t(e)},string:function(e){return new t(e)},"number, number":function(e,r){return new t(e,r)},null:function(e){return new t(0)},BigNumber:function(e){return new t(e.toString())},Fraction:function(e){return e},Unit:r.referToSelf((e=>r=>{var t=r.clone();return t.value=e(r.value),t})),Object:function(e){return new t(e)},"Array | Matrix":r.referToSelf((e=>r=>Fn(r,e)))})})),Na="matrix",Da=ur(Na,["typed","Matrix","DenseMatrix","SparseMatrix"],(e=>{var{typed:r,Matrix:t,DenseMatrix:n,SparseMatrix:i}=e;return r(Na,{"":function(){return a([])},string:function(e){return a([],e)},"string, string":function(e,r){return a([],e,r)},Array:function(e){return a(e)},Matrix:function(e){return a(e,e.storage())},"Array | Matrix, string":a,"Array | Matrix, string, string":a});function a(e,r,t){if("dense"===r||"default"===r||void 0===r)return new n(e,t);if("sparse"===r)return new i(e,t);throw new TypeError("Unknown matrix type "+JSON.stringify(r)+".")}})),Ea="matrixFromFunction",Aa=ur(Ea,["typed","matrix","isZero"],(e=>{var{typed:r,matrix:t,isZero:n}=e;return r(Ea,{"Array | Matrix, function, string, string":function(e,r,t,n){return i(e,r,t,n)},"Array | Matrix, function, string":function(e,r,t){return i(e,r,t)},"Matrix, function":function(e,r){return i(e,r,"dense")},"Array, function":function(e,r){return i(e,r,"dense").toArray()},"Array | Matrix, string, function":function(e,r,t){return i(e,t,r)},"Array | Matrix, string, string, function":function(e,r,t,n){return i(e,n,r,t)}});function i(e,r,i,a){var o;return(o=void 0!==a?t(i,a):t(i)).resize(e),o.forEach((function(e,t){var i=r(t);n(i)||o.set(t,i)})),o}})),Ca="matrixFromRows",Sa=ur(Ca,["typed","matrix","flatten","size"],(e=>{var{typed:r,matrix:t,flatten:n,size:i}=e;return r(Ca,{"...Array":function(e){return a(e)},"...Matrix":function(e){return t(a(e.map((e=>e.toArray()))))}});function a(e){if(0===e.length)throw new TypeError("At least one row is needed to construct a matrix.");var r=o(e[0]),t=[];for(var i of e){var a=o(i);if(a!==r)throw new TypeError("The vectors had different length: "+(0|r)+" ≠ "+(0|a));t.push(n(i))}return t}function o(e){var r=i(e);if(1===r.length)return r[0];if(2===r.length){if(1===r[0])return r[1];if(1===r[1])return r[0];throw new TypeError("At least one of the arguments is not a vector.")}throw new TypeError("Only one- or two-dimensional vectors are supported.")}})),Ma="matrixFromColumns",Fa=ur(Ma,["typed","matrix","flatten","size"],(e=>{var{typed:r,matrix:t,flatten:n,size:i}=e;return r(Ma,{"...Array":function(e){return a(e)},"...Matrix":function(e){return t(a(e.map((e=>e.toArray()))))}});function a(e){if(0===e.length)throw new TypeError("At least one column is needed to construct a matrix.");for(var r=o(e[0]),t=[],i=0;i<r;i++)t[i]=[];for(var a of e){var s=o(a);if(s!==r)throw new TypeError("The vectors had different length: "+(0|r)+" ≠ "+(0|s));for(var u=n(a),c=0;c<r;c++)t[c].push(u[c])}return t}function o(e){var r=i(e);if(1===r.length)return r[0];if(2===r.length){if(1===r[0])return r[1];if(1===r[1])return r[0];throw new TypeError("At least one of the arguments is not a vector.")}throw new TypeError("Only one- or two-dimensional vectors are supported.")}})),Ba="splitUnit",Ta=ur(Ba,["typed"],(e=>{var{typed:r}=e;return r(Ba,{"Unit, Array":function(e,r){return e.splitUnit(r)}})})),Oa="unaryMinus",_a=ur(Oa,["typed"],(e=>{var{typed:r}=e;return r(Oa,{number:Un,"Complex | BigNumber | Fraction":e=>e.neg(),Unit:r.referToSelf((e=>t=>{var n=t.clone();return n.value=r.find(e,n.valueType())(t.value),n})),"Array | Matrix":r.referToSelf((e=>r=>Fn(r,e,!0)))})})),za="unaryPlus",qa=ur(za,["typed","config","BigNumber"],(e=>{var{typed:r,config:t,BigNumber:n}=e;return r(za,{number:jn,Complex:function(e){return e},BigNumber:function(e){return e},Fraction:function(e){return e},Unit:function(e){return e.clone()},"Array | Matrix":r.referToSelf((e=>r=>Fn(r,e,!0))),"boolean | string":function(e){return"BigNumber"===t.number?new n(+e):+e}})})),Ia=ur("abs",["typed"],(e=>{var{typed:r}=e;return r("abs",{number:kn,"Complex | BigNumber | Fraction | Unit":e=>e.abs(),"Array | Matrix":r.referToSelf((e=>r=>Fn(r,e,!0)))})})),ka="apply",Ra=ur(ka,["typed","isInteger"],(e=>{var{typed:r,isInteger:t}=e;return r(ka,{"Array | Matrix, number | BigNumber, function":function(e,r,n){if(!t(r))throw new TypeError("Integer number expected for dimension");var i=Array.isArray(e)?Ue(e):e.size();if(r<0||r>=i.length)throw new Pe(r,i.length);return p(e)?e.create(Pa(e.valueOf(),r,n)):Pa(e,r,n)}})}));function Pa(e,r,t){var n,i,a;if(r<=0){if(Array.isArray(e[0])){for(a=function(e){var r,t,n=e.length,i=e[0].length,a=[];for(t=0;t<i;t++){var o=[];for(r=0;r<n;r++)o.push(e[r][t]);a.push(o)}return a}(e),i=[],n=0;n<a.length;n++)i[n]=Pa(a[n],r-1,t);return i}return t(e)}for(i=[],n=0;n<e.length;n++)i[n]=Pa(e[n],r-1,t);return i}var Ua="addScalar",ja=ur(Ua,["typed"],(e=>{var{typed:r}=e;return r(Ua,{"number, number":Rn,"Complex, Complex":function(e,r){return e.add(r)},"BigNumber, BigNumber":function(e,r){return e.plus(r)},"Fraction, Fraction":function(e,r){return e.add(r)},"Unit, Unit":r.referToSelf((e=>(t,n)=>{if(null===t.value||void 0===t.value)throw new Error("Parameter x contains a unit with undefined value");if(null===n.value||void 0===n.value)throw new Error("Parameter y contains a unit with undefined value");if(!t.equalBase(n))throw new Error("Units do not match");var i=t.clone();return i.value=r.find(e,[i.valueType(),n.valueType()])(i.value,n.value),i.fixPrefix=!1,i}))})})),La="cbrt",Ha=ur(La,["config","typed","isNegative","unaryMinus","matrix","Complex","BigNumber","Fraction"],(e=>{var{config:r,typed:t,isNegative:n,unaryMinus:i,matrix:a,Complex:c,BigNumber:l,Fraction:f}=e;return t(La,{number:Ln,Complex:p,"Complex, boolean":p,BigNumber:function(e){return e.cbrt()},Unit:function(e){if(e.value&&s(e.value)){var r=e.clone();return r.value=1,(r=r.pow(1/3)).value=p(e.value),r}var t,a=n(e.value);a&&(e.value=i(e.value)),t=o(e.value)?new l(1).div(3):u(e.value)?new f(1,3):1/3;var c=e.pow(t);return a&&(c.value=i(c.value)),c}});function p(e,t){var n=e.arg()/3,i=e.abs(),o=new c(Ln(i),0).mul(new c(0,n).exp());if(t){var s=[o,new c(Ln(i),0).mul(new c(0,n+2*Math.PI/3).exp()),new c(Ln(i),0).mul(new c(0,n-2*Math.PI/3).exp())];return"Array"===r.matrix?s:a(s)}return o}})),$a=ur("matAlgo11xS0s",["typed","equalScalar"],(e=>{var{typed:r,equalScalar:t}=e;return function(e,n,i,a){var o=e._values,s=e._index,u=e._ptr,c=e._size,l=e._datatype;if(!o)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var f,p=c[0],m=c[1],d=t,h=0,g=i;"string"==typeof l&&(f=l,d=r.find(t,[f,f]),h=r.convert(0,f),n=r.convert(n,f),g=r.find(i,[f,f]));for(var y=[],v=[],x=[],b=0;b<m;b++){x[b]=v.length;for(var w=u[b],N=u[b+1],D=w;D<N;D++){var E=s[D],A=a?g(n,o[D]):g(o[D],n);d(A,h)||(v.push(E),y.push(A))}}return x[m]=v.length,e.createSparseMatrix({values:y,index:v,ptr:x,size:[p,m],datatype:f})}})),Za=ur("matAlgo12xSfs",["typed","DenseMatrix"],(e=>{var{typed:r,DenseMatrix:t}=e;return function(e,n,i,a){var o=e._values,s=e._index,u=e._ptr,c=e._size,l=e._datatype;if(!o)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var f,p=c[0],m=c[1],d=i;"string"==typeof l&&(f=l,n=r.convert(n,f),d=r.find(i,[f,f]));for(var h=[],g=[],y=[],v=0;v<m;v++){for(var x=v+1,b=u[v],w=u[v+1],N=b;N<w;N++){var D=s[N];g[D]=o[N],y[D]=x}for(var E=0;E<p;E++)0===v&&(h[E]=[]),y[E]===x?h[E][v]=a?d(n,g[E]):d(g[E],n):h[E][v]=a?d(n,0):d(0,n)}return new t({data:h,size:[p,m],datatype:f})}})),Ga=ur("matAlgo14xDs",["typed"],(e=>{var{typed:r}=e;return function(e,n,i,a){var o,s=e._data,u=e._size,c=e._datatype,l=i;"string"==typeof c&&(o=c,n=r.convert(n,o),l=r.find(i,[o,o]));var f=u.length>0?t(l,0,u,u[0],s,n,a):[];return e.createDenseMatrix({data:f,size:G(u),datatype:o})};function t(e,r,n,i,a,o,s){var u=[];if(r===n.length-1)for(var c=0;c<i;c++)u[c]=s?e(o,a[c]):e(a[c],o);else for(var l=0;l<i;l++)u[l]=t(e,r+1,n,n[r+1],a[l],o,s);return u}})),Va="ceil",Wa=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],Ya=ur(Va,["typed","config","round"],(e=>{var{typed:r,config:t,round:n}=e;return r(Va,{number:function(e){return Ne(e,n(e),t.epsilon)?n(e):Math.ceil(e)},"number, number":function(e,r){if(Ne(e,n(e,r),t.epsilon))return n(e,r);var[i,a]="".concat(e,"e").split("e"),o=Math.ceil(Number("".concat(i,"e").concat(Number(a)+r)));return[i,a]="".concat(o,"e").split("e"),Number("".concat(i,"e").concat(Number(a)-r))}})})),Ja=ur(Va,Wa,(e=>{var{typed:r,config:t,round:n,matrix:i,equalScalar:a,zeros:o,DenseMatrix:s}=e,u=$a({typed:r,equalScalar:a}),c=Za({typed:r,DenseMatrix:s}),l=Ga({typed:r}),f=Ya({typed:r,config:t,round:n});return r("ceil",{number:f.signatures.number,"number,number":f.signatures["number,number"],Complex:function(e){return e.ceil()},"Complex, number":function(e,r){return e.ceil(r)},"Complex, BigNumber":function(e,r){return e.ceil(r.toNumber())},BigNumber:function(e){return ca(e,n(e),t.epsilon)?n(e):e.ceil()},"BigNumber, BigNumber":function(e,r){return ca(e,n(e,r),t.epsilon)?n(e,r):e.toDecimalPlaces(r.toNumber(),pn.ROUND_CEIL)},Fraction:function(e){return e.ceil()},"Fraction, number":function(e,r){return e.ceil(r)},"Fraction, BigNumber":function(e,r){return e.ceil(r.toNumber())},"Array | Matrix":r.referToSelf((e=>r=>Fn(r,e,!0))),"Array, number | BigNumber":r.referToSelf((e=>(r,t)=>Fn(r,(r=>e(r,t)),!0))),"SparseMatrix, number | BigNumber":r.referToSelf((e=>(r,t)=>u(r,t,e,!1))),"DenseMatrix, number | BigNumber":r.referToSelf((e=>(r,t)=>l(r,t,e,!1))),"number | Complex | Fraction | BigNumber, Array":r.referToSelf((e=>(r,t)=>l(i(t),r,e,!0).valueOf())),"number | Complex | Fraction | BigNumber, Matrix":r.referToSelf((e=>(r,t)=>a(r,0)?o(t.size(),t.storage()):"dense"===t.storage()?l(t,r,e,!0):c(t,r,e,!0)))})})),Xa="cube",Qa=ur(Xa,["typed"],(e=>{var{typed:r}=e;return r(Xa,{number:Hn,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)}})})),Ka=ur("exp",["typed"],(e=>{var{typed:r}=e;return r("exp",{number:$n,Complex:function(e){return e.exp()},BigNumber:function(e){return e.exp()}})})),eo="expm1",ro=ur(eo,["typed","Complex"],(e=>{var{typed:r,Complex:t}=e;return r(eo,{number:Zn,Complex:function(e){var r=Math.exp(e.re);return new t(r*Math.cos(e.im)-1,r*Math.sin(e.im))},BigNumber:function(e){return e.exp().minus(1)}})})),to="fix",no=["typed","Complex","matrix","ceil","floor","equalScalar","zeros","DenseMatrix"],io=ur(to,["typed","ceil","floor"],(e=>{var{typed:r,ceil:t,floor:n}=e;return r(to,{number:function(e){return e>0?n(e):t(e)},"number, number":function(e,r){return e>0?n(e,r):t(e,r)}})})),ao=ur(to,no,(e=>{var{typed:r,Complex:t,matrix:n,ceil:i,floor:a,equalScalar:o,zeros:s,DenseMatrix:u}=e,c=Za({typed:r,DenseMatrix:u}),l=Ga({typed:r}),f=io({typed:r,ceil:i,floor:a});return r("fix",{number:f.signatures.number,"number, number | BigNumber":f.signatures["number,number"],Complex:function(e){return new t(e.re>0?Math.floor(e.re):Math.ceil(e.re),e.im>0?Math.floor(e.im):Math.ceil(e.im))},"Complex, number":function(e,r){return new t(e.re>0?a(e.re,r):i(e.re,r),e.im>0?a(e.im,r):i(e.im,r))},"Complex, BigNumber":function(e,r){var n=r.toNumber();return new t(e.re>0?a(e.re,n):i(e.re,n),e.im>0?a(e.im,n):i(e.im,n))},BigNumber:function(e){return e.isNegative()?i(e):a(e)},"BigNumber, number | BigNumber":function(e,r){return e.isNegative()?i(e,r):a(e,r)},Fraction:function(e){return e.s<0?e.ceil():e.floor()},"Fraction, number | BigNumber":function(e,r){return e.s<0?i(e,r):a(e,r)},"Array | Matrix":r.referToSelf((e=>r=>Fn(r,e,!0))),"Array | Matrix, number | BigNumber":r.referToSelf((e=>(r,t)=>Fn(r,(r=>e(r,t)),!0))),"number | Complex | Fraction | BigNumber, Array":r.referToSelf((e=>(r,t)=>l(n(t),r,e,!0).valueOf())),"number | Complex | Fraction | BigNumber, Matrix":r.referToSelf((e=>(r,t)=>o(r,0)?s(t.size(),t.storage()):"dense"===t.storage()?l(t,r,e,!0):c(t,r,e,!0)))})})),oo="floor",so=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],uo=ur(oo,["typed","config","round"],(e=>{var{typed:r,config:t,round:n}=e;return r(oo,{number:function(e){return Ne(e,n(e),t.epsilon)?n(e):Math.floor(e)},"number, number":function(e,r){if(Ne(e,n(e,r),t.epsilon))return n(e,r);var[i,a]="".concat(e,"e").split("e"),o=Math.floor(Number("".concat(i,"e").concat(Number(a)+r)));return[i,a]="".concat(o,"e").split("e"),Number("".concat(i,"e").concat(Number(a)-r))}})})),co=ur(oo,so,(e=>{var{typed:r,config:t,round:n,matrix:i,equalScalar:a,zeros:o,DenseMatrix:s}=e,u=$a({typed:r,equalScalar:a}),c=Za({typed:r,DenseMatrix:s}),l=Ga({typed:r}),f=uo({typed:r,config:t,round:n});return r("floor",{number:f.signatures.number,"number,number":f.signatures["number,number"],Complex:function(e){return e.floor()},"Complex, number":function(e,r){return e.floor(r)},"Complex, BigNumber":function(e,r){return e.floor(r.toNumber())},BigNumber:function(e){return ca(e,n(e),t.epsilon)?n(e):e.floor()},"BigNumber, BigNumber":function(e,r){return ca(e,n(e,r),t.epsilon)?n(e,r):e.toDecimalPlaces(r.toNumber(),pn.ROUND_FLOOR)},Fraction:function(e){return e.floor()},"Fraction, number":function(e,r){return e.floor(r)},"Fraction, BigNumber":function(e,r){return e.floor(r.toNumber())},"Array | Matrix":r.referToSelf((e=>r=>Fn(r,e,!0))),"Array, number | BigNumber":r.referToSelf((e=>(r,t)=>Fn(r,(r=>e(r,t)),!0))),"SparseMatrix, number | BigNumber":r.referToSelf((e=>(r,t)=>u(r,t,e,!1))),"DenseMatrix, number | BigNumber":r.referToSelf((e=>(r,t)=>l(r,t,e,!1))),"number | Complex | Fraction | BigNumber, Array":r.referToSelf((e=>(r,t)=>l(i(t),r,e,!0).valueOf())),"number | Complex | Fraction | BigNumber, Matrix":r.referToSelf((e=>(r,t)=>a(r,0)?o(t.size(),t.storage()):"dense"===t.storage()?l(t,r,e,!0):c(t,r,e,!0)))})})),lo=ur("matAlgo01xDSid",["typed"],(e=>{var{typed:r}=e;return function(e,t,n,i){var a=e._data,o=e._size,s=e._datatype,u=t._values,c=t._index,l=t._ptr,f=t._size,p=t._datatype;if(o.length!==f.length)throw new Re(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(!u)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var m,d,h=o[0],g=o[1],y="string"==typeof s&&s===p?s:void 0,v=y?r.find(n,[y,y]):n,x=[];for(m=0;m<h;m++)x[m]=[];var b=[],w=[];for(d=0;d<g;d++){for(var N=d+1,D=l[d],E=l[d+1],A=D;A<E;A++)b[m=c[A]]=i?v(u[A],a[m][d]):v(a[m][d],u[A]),w[m]=N;for(m=0;m<h;m++)w[m]===N?x[m][d]=b[m]:x[m][d]=a[m][d]}return e.createDenseMatrix({data:x,size:[h,g],datatype:y})}})),fo=ur("matAlgo04xSidSid",["typed","equalScalar"],(e=>{var{typed:r,equalScalar:t}=e;return function(e,n,i){var a=e._values,o=e._index,s=e._ptr,u=e._size,c=e._datatype,l=n._values,f=n._index,p=n._ptr,m=n._size,d=n._datatype;if(u.length!==m.length)throw new Re(u.length,m.length);if(u[0]!==m[0]||u[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+m+")");var h,g=u[0],y=u[1],v=t,x=0,b=i;"string"==typeof c&&c===d&&(h=c,v=r.find(t,[h,h]),x=r.convert(0,h),b=r.find(i,[h,h]));var w,N,D,E,A,C=a&&l?[]:void 0,S=[],M=[],F=a&&l?[]:void 0,B=a&&l?[]:void 0,T=[],O=[];for(N=0;N<y;N++){M[N]=S.length;var _=N+1;for(E=s[N],A=s[N+1],D=E;D<A;D++)w=o[D],S.push(w),T[w]=_,F&&(F[w]=a[D]);for(E=p[N],A=p[N+1],D=E;D<A;D++)if(T[w=f[D]]===_){if(F){var z=b(F[w],l[D]);v(z,x)?T[w]=null:F[w]=z}}else S.push(w),O[w]=_,B&&(B[w]=l[D]);if(F&&B)for(D=M[N];D<S.length;)T[w=S[D]]===_?(C[D]=F[w],D++):O[w]===_?(C[D]=B[w],D++):S.splice(D,1)}return M[y]=S.length,e.createSparseMatrix({values:C,index:S,ptr:M,size:[g,y],datatype:h})}})),po=ur("matAlgo10xSids",["typed","DenseMatrix"],(e=>{var{typed:r,DenseMatrix:t}=e;return function(e,n,i,a){var o=e._values,s=e._index,u=e._ptr,c=e._size,l=e._datatype;if(!o)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var f,p=c[0],m=c[1],d=i;"string"==typeof l&&(f=l,n=r.convert(n,f),d=r.find(i,[f,f]));for(var h=[],g=[],y=[],v=0;v<m;v++){for(var x=v+1,b=u[v],w=u[v+1],N=b;N<w;N++){var D=s[N];g[D]=o[N],y[D]=x}for(var E=0;E<p;E++)0===v&&(h[E]=[]),y[E]===x?h[E][v]=a?d(n,g[E]):d(g[E],n):h[E][v]=n}return new t({data:h,size:[p,m],datatype:f})}})),mo=ur("matAlgo13xDD",["typed"],(e=>{var{typed:r}=e;return function(e,n,i){var a,o=e._data,s=e._size,u=e._datatype,c=n._data,l=n._size,f=n._datatype,p=[];if(s.length!==l.length)throw new Re(s.length,l.length);for(var m=0;m<s.length;m++){if(s[m]!==l[m])throw new RangeError("Dimension mismatch. Matrix A ("+s+") must match Matrix B ("+l+")");p[m]=s[m]}var d=i;"string"==typeof u&&u===f&&(a=u,d=r.find(i,[a,a]));var h=p.length>0?t(d,0,p,p[0],o,c):[];return e.createDenseMatrix({data:h,size:p,datatype:a})};function t(e,r,n,i,a,o){var s=[];if(r===n.length-1)for(var u=0;u<i;u++)s[u]=e(a[u],o[u]);else for(var c=0;c<i;c++)s[c]=t(e,r+1,n,n[r+1],a[c],o[c]);return s}})),ho=ur("broadcast",["concat"],(e=>{var{concat:r}=e;return function(e,r){var a=Math.max(e._size.length,r._size.length);if(e._size.length===r._size.length&&e._size.every(((e,t)=>e===r._size[t])))return[e,r];for(var o=t(e._size,a,0),s=t(r._size,a,0),u=[],c=0;c<a;c++)u[c]=Math.max(o[c],s[c]);for(var l=0;l<a;l++)i(o,u,l),i(s,u,l);var f=e.clone(),p=r.clone();f._size.length<a?f.reshape(t(f._size,a,1)):p._size.length<a&&p.reshape(t(p._size,a,1));for(var m=0;m<a;m++)f._size[m]<u[m]&&(f=n(f,u[m],m)),p._size[m]<u[m]&&(p=n(p,u[m],m));return[f,p]};function t(e,r,t){return[...Array(r-e.length).fill(t),...e]}function n(e,t,n){return r(...Array(t).fill(e),n)}function i(e,r,t){if(e[t]<r[t]&e[t]>1)throw new Error("shape missmatch: missmatch is found in arg with shape (".concat(e,") not possible to broadcast dimension ").concat(t," with size ").concat(e[t]," to size ").concat(r[t]))}})),go=ur("matrixAlgorithmSuite",["typed","matrix","concat"],(e=>{var{typed:r,matrix:t,concat:n}=e,i=mo({typed:r}),a=Ga({typed:r}),o=ho({concat:n});return function(e){var n,s=e.elop,u=e.SD||e.DS;s?(n={"DenseMatrix, DenseMatrix":(e,r)=>i(...o(e,r),s),"Array, Array":(e,r)=>i(...o(t(e),t(r)),s).valueOf(),"Array, DenseMatrix":(e,r)=>i(...o(t(e),r),s),"DenseMatrix, Array":(e,r)=>i(...o(e,t(r)),s)},e.SS&&(n["SparseMatrix, SparseMatrix"]=(r,t)=>e.SS(...o(r,t),s,!1)),e.DS&&(n["DenseMatrix, SparseMatrix"]=(r,t)=>e.DS(...o(r,t),s,!1),n["Array, SparseMatrix"]=(r,n)=>e.DS(...o(t(r),n),s,!1)),u&&(n["SparseMatrix, DenseMatrix"]=(e,r)=>u(...o(r,e),s,!0),n["SparseMatrix, Array"]=(e,r)=>u(...o(t(r),e),s,!0))):(n={"DenseMatrix, DenseMatrix":r.referToSelf((e=>(r,t)=>i(...o(r,t),e))),"Array, Array":r.referToSelf((e=>(r,n)=>i(...o(t(r),t(n)),e).valueOf())),"Array, DenseMatrix":r.referToSelf((e=>(r,n)=>i(...o(t(r),n),e))),"DenseMatrix, Array":r.referToSelf((e=>(r,n)=>i(...o(r,t(n)),e)))},e.SS&&(n["SparseMatrix, SparseMatrix"]=r.referToSelf((r=>(t,n)=>e.SS(...o(t,n),r,!1)))),e.DS&&(n["DenseMatrix, SparseMatrix"]=r.referToSelf((r=>(t,n)=>e.DS(...o(t,n),r,!1))),n["Array, SparseMatrix"]=r.referToSelf((r=>(n,i)=>e.DS(...o(t(n),i),r,!1)))),u&&(n["SparseMatrix, DenseMatrix"]=r.referToSelf((e=>(r,t)=>u(...o(t,r),e,!0))),n["SparseMatrix, Array"]=r.referToSelf((e=>(r,n)=>u(...o(t(n),r),e,!0)))));var c=e.scalar||"any";(e.Ds||e.Ss)&&(s?(n["DenseMatrix,"+c]=(e,r)=>a(e,r,s,!1),n[c+", DenseMatrix"]=(e,r)=>a(r,e,s,!0),n["Array,"+c]=(e,r)=>a(t(e),r,s,!1).valueOf(),n[c+", Array"]=(e,r)=>a(t(r),e,s,!0).valueOf()):(n["DenseMatrix,"+c]=r.referToSelf((e=>(r,t)=>a(r,t,e,!1))),n[c+", DenseMatrix"]=r.referToSelf((e=>(r,t)=>a(t,r,e,!0))),n["Array,"+c]=r.referToSelf((e=>(r,n)=>a(t(r),n,e,!1).valueOf())),n[c+", Array"]=r.referToSelf((e=>(r,n)=>a(t(n),r,e,!0).valueOf()))));var l=void 0!==e.sS?e.sS:e.Ss;return s?(e.Ss&&(n["SparseMatrix,"+c]=(r,t)=>e.Ss(r,t,s,!1)),l&&(n[c+", SparseMatrix"]=(e,r)=>l(r,e,s,!0))):(e.Ss&&(n["SparseMatrix,"+c]=r.referToSelf((r=>(t,n)=>e.Ss(t,n,r,!1)))),l&&(n[c+", SparseMatrix"]=r.referToSelf((e=>(r,t)=>l(t,r,e,!0))))),s&&s.signatures&&V(n,s.signatures),n}}));function yo(e,r,t,n){if(!(this instanceof yo))throw new SyntaxError("Constructor must be called with the new operator");this.fn=e,this.count=r,this.min=t,this.max=n,this.message="Wrong number of arguments in function "+e+" ("+r+" provided, "+t+(null!=n?"-"+n:"")+" expected)",this.stack=(new Error).stack}yo.prototype=new Error,yo.prototype.constructor=Error,yo.prototype.name="ArgumentsError",yo.prototype.isArgumentsError=!0;var vo=["typed","matrix","equalScalar","BigNumber","DenseMatrix","concat"],xo="number | BigNumber | Fraction | Matrix | Array",bo="".concat(xo,", ").concat(xo,", ...").concat(xo);function wo(e){return!e.some((e=>Array.isArray(e)))}var No=ur("gcd",vo,(e=>{var{typed:r,matrix:t,equalScalar:n,BigNumber:i,DenseMatrix:a,concat:o}=e,s=lo({typed:r}),u=fo({typed:r,equalScalar:n}),c=po({typed:r,DenseMatrix:a});return r("gcd",{"number, number":Gn,"BigNumber, BigNumber":function(e,r){if(!e.isInt()||!r.isInt())throw new Error("Parameters in function gcd must be integer numbers");var t=new i(0);for(;!r.isZero();){var n=e.mod(r);e=r,r=n}return e.lt(t)?e.neg():e},"Fraction, Fraction":(e,r)=>e.gcd(r)},go({typed:r,matrix:t,concat:o})({SS:u,DS:s,Ss:c}),{[bo]:r.referToSelf((e=>(r,t,n)=>{for(var i=e(r,t),a=0;a<n.length;a++)i=e(i,n[a]);return i})),Array:r.referToSelf((e=>r=>{if(1===r.length&&Array.isArray(r[0])&&wo(r[0]))return e(...r[0]);if(wo(r))return e(...r);throw new yo("gcd() supports only 1d matrices!")})),Matrix:r.referToSelf((e=>r=>e(r.toArray())))})})),Do=ur("matAlgo02xDS0",["typed","equalScalar"],(e=>{var{typed:r,equalScalar:t}=e;return function(e,n,i,a){var o=e._data,s=e._size,u=e._datatype,c=n._values,l=n._index,f=n._ptr,p=n._size,m=n._datatype;if(s.length!==p.length)throw new Re(s.length,p.length);if(s[0]!==p[0]||s[1]!==p[1])throw new RangeError("Dimension mismatch. Matrix A ("+s+") must match Matrix B ("+p+")");if(!c)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var d,h=s[0],g=s[1],y=t,v=0,x=i;"string"==typeof u&&u===m&&(d=u,y=r.find(t,[d,d]),v=r.convert(0,d),x=r.find(i,[d,d]));for(var b=[],w=[],N=[],D=0;D<g;D++){N[D]=w.length;for(var E=f[D],A=f[D+1],C=E;C<A;C++){var S=l[C],M=a?x(c[C],o[S][D]):x(o[S][D],c[C]);y(M,v)||(w.push(S),b.push(M))}}return N[g]=w.length,n.createSparseMatrix({values:b,index:w,ptr:N,size:[h,g],datatype:d})}})),Eo=ur("matAlgo06xS0S0",["typed","equalScalar"],(e=>{var{typed:r,equalScalar:t}=e;return function(e,n,i){var a=e._values,o=e._size,s=e._datatype,u=n._values,c=n._size,l=n._datatype;if(o.length!==c.length)throw new Re(o.length,c.length);if(o[0]!==c[0]||o[1]!==c[1])throw new RangeError("Dimension mismatch. Matrix A ("+o+") must match Matrix B ("+c+")");var f,p=o[0],m=o[1],d=t,h=0,g=i;"string"==typeof s&&s===l&&(f=s,d=r.find(t,[f,f]),h=r.convert(0,f),g=r.find(i,[f,f]));for(var y=a&&u?[]:void 0,v=[],x=[],b=y?[]:void 0,w=[],N=[],D=0;D<m;D++){x[D]=v.length;var E=D+1;if(On(e,D,w,b,N,E,v,g),On(n,D,w,b,N,E,v,g),b)for(var A=x[D];A<v.length;){var C=v[A];if(N[C]===E){var S=b[C];d(S,h)?v.splice(A,1):(y.push(S),A++)}else v.splice(A,1)}else for(var M=x[D];M<v.length;){N[v[M]]!==E?v.splice(M,1):M++}}return x[m]=v.length,e.createSparseMatrix({values:y,index:v,ptr:x,size:[p,m],datatype:f})}})),Ao=ur("lcm",["typed","matrix","equalScalar","concat"],(e=>{var{typed:r,matrix:t,equalScalar:n,concat:i}=e,a=Do({typed:r,equalScalar:n}),o=Eo({typed:r,equalScalar:n}),s=$a({typed:r,equalScalar:n}),u=go({typed:r,matrix:t,concat:i}),c="number | BigNumber | Fraction | Matrix | Array",l={};return l["".concat(c,", ").concat(c,", ...").concat(c)]=r.referToSelf((e=>(r,t,n)=>{for(var i=e(r,t),a=0;a<n.length;a++)i=e(i,n[a]);return i})),r("lcm",{"number, number":Vn,"BigNumber, BigNumber":function(e,r){if(!e.isInt()||!r.isInt())throw new Error("Parameters in function lcm must be integer numbers");if(e.isZero())return e;if(r.isZero())return r;var t=e.times(r);for(;!r.isZero();){var n=r;r=e.mod(n),e=n}return t.div(e).abs()},"Fraction, Fraction":(e,r)=>e.lcm(r)},u({SS:o,DS:a,Ss:s}),l)})),Co="log10",So=ur(Co,["typed","config","Complex"],(e=>{var{typed:r,config:t,Complex:n}=e;return r(Co,{number:function(e){return e>=0||t.predictable?Wn(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()||t.predictable?e.log():new n(e.toNumber(),0).log().div(Math.LN10)},"Array | Matrix":r.referToSelf((e=>r=>Fn(r,e)))})})),Mo="log2",Fo=ur(Mo,["typed","config","Complex"],(e=>{var{typed:r,config:t,Complex:n}=e;return r(Mo,{number:function(e){return e>=0||t.predictable?Yn(e):i(new n(e,0))},Complex:i,BigNumber:function(e){return!e.isNegative()||t.predictable?e.log(2):i(new n(e.toNumber(),0))},"Array | Matrix":r.referToSelf((e=>r=>Fn(r,e)))});function i(e){var r=Math.sqrt(e.re*e.re+e.im*e.im);return new n(Math.log2?Math.log2(r):Math.log(r)/Math.LN2,Math.atan2(e.im,e.re)/Math.LN2)}})),Bo=ur("matAlgo03xDSf",["typed"],(e=>{var{typed:r}=e;return function(e,t,n,i){var a=e._data,o=e._size,s=e._datatype,u=t._values,c=t._index,l=t._ptr,f=t._size,p=t._datatype;if(o.length!==f.length)throw new Re(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(!u)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var m,d=o[0],h=o[1],g=0,y=n;"string"==typeof s&&s===p&&(m=s,g=r.convert(0,m),y=r.find(n,[m,m]));for(var v=[],x=0;x<d;x++)v[x]=[];for(var b=[],w=[],N=0;N<h;N++){for(var D=N+1,E=l[N],A=l[N+1],C=E;C<A;C++){var S=c[C];b[S]=i?y(u[C],a[S][N]):y(a[S][N],u[C]),w[S]=D}for(var M=0;M<d;M++)w[M]===D?v[M][N]=b[M]:v[M][N]=i?y(g,a[M][N]):y(a[M][N],g)}return e.createDenseMatrix({data:v,size:[d,h],datatype:m})}})),To=ur("matAlgo05xSfSf",["typed","equalScalar"],(e=>{var{typed:r,equalScalar:t}=e;return function(e,n,i){var a=e._values,o=e._index,s=e._ptr,u=e._size,c=e._datatype,l=n._values,f=n._index,p=n._ptr,m=n._size,d=n._datatype;if(u.length!==m.length)throw new Re(u.length,m.length);if(u[0]!==m[0]||u[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+m+")");var h,g=u[0],y=u[1],v=t,x=0,b=i;"string"==typeof c&&c===d&&(h=c,v=r.find(t,[h,h]),x=r.convert(0,h),b=r.find(i,[h,h]));var w,N,D,E,A=a&&l?[]:void 0,C=[],S=[],M=A?[]:void 0,F=A?[]:void 0,B=[],T=[];for(N=0;N<y;N++){S[N]=C.length;var O=N+1;for(D=s[N],E=s[N+1];D<E;D++)w=o[D],C.push(w),B[w]=O,M&&(M[w]=a[D]);for(D=p[N],E=p[N+1];D<E;D++)B[w=f[D]]!==O&&C.push(w),T[w]=O,F&&(F[w]=l[D]);if(A)for(D=S[N];D<C.length;){var _=B[w=C[D]],z=T[w];if(_===O||z===O){var q=b(_===O?M[w]:x,z===O?F[w]:x);v(q,x)?C.splice(D,1):(A.push(q),D++)}}}return S[y]=C.length,e.createSparseMatrix({values:A,index:C,ptr:S,size:[g,y],datatype:h})}})),Oo=ur("mod",["typed","matrix","equalScalar","DenseMatrix","concat"],(e=>{var{typed:r,matrix:t,equalScalar:n,DenseMatrix:i,concat:a}=e,o=Do({typed:r,equalScalar:n}),s=Bo({typed:r}),u=To({typed:r,equalScalar:n}),c=$a({typed:r,equalScalar:n}),l=Za({typed:r,DenseMatrix:i});return r("mod",{"number, number":Jn,"BigNumber, BigNumber":function(e,r){if(r.isNeg())throw new Error("Cannot calculate mod for a negative divisor");return r.isZero()?e:e.mod(r)},"Fraction, Fraction":function(e,r){if(r.compare(0)<0)throw new Error("Cannot calculate mod for a negative divisor");return e.compare(0)>=0?e.mod(r):e.mod(r).add(r).mod(r)}},go({typed:r,matrix:t,concat:a})({SS:u,DS:s,SD:o,Ss:c,sS:l}))})),_o=ur("multiplyScalar",["typed"],(e=>{var{typed:r}=e;return r("multiplyScalar",{"number, number":Pn,"Complex, Complex":function(e,r){return e.mul(r)},"BigNumber, BigNumber":function(e,r){return e.times(r)},"Fraction, Fraction":function(e,r){return e.mul(r)},"number | Fraction | BigNumber | Complex, Unit":(e,r)=>r.multiply(e),"Unit, number | Fraction | BigNumber | Complex | Unit":(e,r)=>e.multiply(r)})})),zo="multiply",qo=ur(zo,["typed","matrix","addScalar","multiplyScalar","equalScalar","dot"],(e=>{var{typed:r,matrix:t,addScalar:n,multiplyScalar:i,equalScalar:a,dot:o}=e,s=$a({typed:r,equalScalar:a}),u=Ga({typed:r});function c(e,r){switch(e.length){case 1:switch(r.length){case 1:if(e[0]!==r[0])throw new RangeError("Dimension mismatch in multiplication. Vectors must have the same length");break;case 2:if(e[0]!==r[0])throw new RangeError("Dimension mismatch in multiplication. Vector length ("+e[0]+") must match Matrix rows ("+r[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+r.length+" dimensions)")}break;case 2:switch(r.length){case 1:if(e[1]!==r[0])throw new RangeError("Dimension mismatch in multiplication. Matrix columns ("+e[1]+") must match Vector length ("+r[0]+")");break;case 2:if(e[1]!==r[0])throw new RangeError("Dimension mismatch in multiplication. Matrix A columns ("+e[1]+") must match Matrix B rows ("+r[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+r.length+" dimensions)")}break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix A has "+e.length+" dimensions)")}}function l(e,t){if("dense"!==t.storage())throw new Error("Support for SparseMatrix not implemented");return function(e,t){var a,o=e._data,s=e._size,u=e._datatype,c=t._data,l=t._size,f=t._datatype,p=s[0],m=l[1],d=n,h=i;u&&f&&u===f&&"string"==typeof u&&(a=u,d=r.find(n,[a,a]),h=r.find(i,[a,a]));for(var g=[],y=0;y<m;y++){for(var v=h(o[0],c[0][y]),x=1;x<p;x++)v=d(v,h(o[x],c[x][y]));g[y]=v}return e.createDenseMatrix({data:g,size:[m],datatype:a})}(e,t)}var f=r("_multiplyMatrixVector",{"DenseMatrix, any":function(e,t){var a,o=e._data,s=e._size,u=e._datatype,c=t._data,l=t._datatype,f=s[0],p=s[1],m=n,d=i;u&&l&&u===l&&"string"==typeof u&&(a=u,m=r.find(n,[a,a]),d=r.find(i,[a,a]));for(var h=[],g=0;g<f;g++){for(var y=o[g],v=d(y[0],c[0]),x=1;x<p;x++)v=m(v,d(y[x],c[x]));h[g]=v}return e.createDenseMatrix({data:h,size:[f],datatype:a})},"SparseMatrix, any":function(e,t){var o=e._values,s=e._index,u=e._ptr,c=e._datatype;if(!o)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var l,f=t._data,p=t._datatype,m=e._size[0],d=t._size[0],h=[],g=[],y=[],v=n,x=i,b=a,w=0;c&&p&&c===p&&"string"==typeof c&&(l=c,v=r.find(n,[l,l]),x=r.find(i,[l,l]),b=r.find(a,[l,l]),w=r.convert(0,l));var N=[],D=[];y[0]=0;for(var E=0;E<d;E++){var A=f[E];if(!b(A,w))for(var C=u[E],S=u[E+1],M=C;M<S;M++){var F=s[M];D[F]?N[F]=v(N[F],x(A,o[M])):(D[F]=!0,g.push(F),N[F]=x(A,o[M]))}}for(var B=g.length,T=0;T<B;T++){var O=g[T];h[T]=N[O]}return y[1]=g.length,e.createSparseMatrix({values:h,index:g,ptr:y,size:[m,1],datatype:l})}}),m=r("_multiplyMatrixMatrix",{"DenseMatrix, DenseMatrix":function(e,t){var a,o=e._data,s=e._size,u=e._datatype,c=t._data,l=t._size,f=t._datatype,p=s[0],m=s[1],d=l[1],h=n,g=i;u&&f&&u===f&&"string"==typeof u&&(a=u,h=r.find(n,[a,a]),g=r.find(i,[a,a]));for(var y=[],v=0;v<p;v++){var x=o[v];y[v]=[];for(var b=0;b<d;b++){for(var w=g(x[0],c[0][b]),N=1;N<m;N++)w=h(w,g(x[N],c[N][b]));y[v][b]=w}}return e.createDenseMatrix({data:y,size:[p,d],datatype:a})},"DenseMatrix, SparseMatrix":function(e,t){var o=e._data,s=e._size,u=e._datatype,c=t._values,l=t._index,f=t._ptr,p=t._size,m=t._datatype;if(!c)throw new Error("Cannot multiply Dense Matrix times Pattern only Matrix");var d,h=s[0],g=p[1],y=n,v=i,x=a,b=0;u&&m&&u===m&&"string"==typeof u&&(d=u,y=r.find(n,[d,d]),v=r.find(i,[d,d]),x=r.find(a,[d,d]),b=r.convert(0,d));for(var w=[],N=[],D=[],E=t.createSparseMatrix({values:w,index:N,ptr:D,size:[h,g],datatype:d}),A=0;A<g;A++){D[A]=N.length;var C=f[A],S=f[A+1];if(S>C)for(var M=0,F=0;F<h;F++){for(var B=F+1,T=void 0,O=C;O<S;O++){var _=l[O];M!==B?(T=v(o[F][_],c[O]),M=B):T=y(T,v(o[F][_],c[O]))}M!==B||x(T,b)||(N.push(F),w.push(T))}}return D[g]=N.length,E},"SparseMatrix, DenseMatrix":function(e,t){var o=e._values,s=e._index,u=e._ptr,c=e._datatype;if(!o)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var l,f=t._data,p=t._datatype,m=e._size[0],d=t._size[0],h=t._size[1],g=n,y=i,v=a,x=0;c&&p&&c===p&&"string"==typeof c&&(l=c,g=r.find(n,[l,l]),y=r.find(i,[l,l]),v=r.find(a,[l,l]),x=r.convert(0,l));for(var b=[],w=[],N=[],D=e.createSparseMatrix({values:b,index:w,ptr:N,size:[m,h],datatype:l}),E=[],A=[],C=0;C<h;C++){N[C]=w.length;for(var S=C+1,M=0;M<d;M++){var F=f[M][C];if(!v(F,x))for(var B=u[M],T=u[M+1],O=B;O<T;O++){var _=s[O];A[_]!==S?(A[_]=S,w.push(_),E[_]=y(F,o[O])):E[_]=g(E[_],y(F,o[O]))}}for(var z=N[C],q=w.length,I=z;I<q;I++){var k=w[I];b[I]=E[k]}}return N[h]=w.length,D},"SparseMatrix, SparseMatrix":function(e,t){var a,o=e._values,s=e._index,u=e._ptr,c=e._datatype,l=t._values,f=t._index,p=t._ptr,m=t._datatype,d=e._size[0],h=t._size[1],g=o&&l,y=n,v=i;c&&m&&c===m&&"string"==typeof c&&(a=c,y=r.find(n,[a,a]),v=r.find(i,[a,a]));for(var x,b,w,N,D,E,A,C,S=g?[]:void 0,M=[],F=[],B=e.createSparseMatrix({values:S,index:M,ptr:F,size:[d,h],datatype:a}),T=g?[]:void 0,O=[],_=0;_<h;_++){F[_]=M.length;var z=_+1;for(D=p[_],E=p[_+1],N=D;N<E;N++)if(C=f[N],g)for(b=u[C],w=u[C+1],x=b;x<w;x++)O[A=s[x]]!==z?(O[A]=z,M.push(A),T[A]=v(l[N],o[x])):T[A]=y(T[A],v(l[N],o[x]));else for(b=u[C],w=u[C+1],x=b;x<w;x++)O[A=s[x]]!==z&&(O[A]=z,M.push(A));if(g)for(var q=F[_],I=M.length,k=q;k<I;k++){var R=M[k];S[k]=T[R]}}return F[h]=M.length,B}});return r(zo,i,{"Array, Array":r.referTo("Matrix, Matrix",(e=>(r,n)=>{c(Ue(r),Ue(n));var i=e(t(r),t(n));return p(i)?i.valueOf():i})),"Matrix, Matrix":function(e,r){var t=e.size(),n=r.size();return c(t,n),1===t.length?1===n.length?function(e,r,t){if(0===t)throw new Error("Cannot multiply two empty vectors");return o(e,r)}(e,r,t[0]):l(e,r):1===n.length?f(e,r):m(e,r)},"Matrix, Array":r.referTo("Matrix,Matrix",(e=>(r,n)=>e(r,t(n)))),"Array, Matrix":r.referToSelf((e=>(r,n)=>e(t(r,n.storage()),n))),"SparseMatrix, any":function(e,r){return s(e,r,i,!1)},"DenseMatrix, any":function(e,r){return u(e,r,i,!1)},"any, SparseMatrix":function(e,r){return s(r,e,i,!0)},"any, DenseMatrix":function(e,r){return u(r,e,i,!0)},"Array, any":function(e,r){return u(t(e),r,i,!1).valueOf()},"any, Array":function(e,r){return u(t(r),e,i,!0).valueOf()},"any, any":i,"any, any, ...any":r.referToSelf((e=>(r,t,n)=>{for(var i=e(r,t),a=0;a<n.length;a++)i=e(i,n[a]);return i}))})})),Io="nthRoot",ko=ur(Io,["typed","matrix","equalScalar","BigNumber","concat"],(e=>{var{typed:r,matrix:t,equalScalar:n,BigNumber:i,concat:a}=e,o=lo({typed:r}),s=Do({typed:r,equalScalar:n}),u=Eo({typed:r,equalScalar:n}),c=$a({typed:r,equalScalar:n}),l=go({typed:r,matrix:t,concat:a});function f(){throw new Error("Complex number not supported in function nthRoot. Use nthRoots instead.")}return r(Io,{number:Xn,"number, number":Xn,BigNumber:e=>p(e,new i(2)),"BigNumber, BigNumber":p,Complex:f,"Complex, number":f,Array:r.referTo("DenseMatrix,number",(e=>r=>e(t(r),2).valueOf())),DenseMatrix:r.referTo("DenseMatrix,number",(e=>r=>e(r,2))),SparseMatrix:r.referTo("SparseMatrix,number",(e=>r=>e(r,2))),"SparseMatrix, SparseMatrix":r.referToSelf((e=>(r,t)=>{if(1===t.density())return u(r,t,e);throw new Error("Root must be non-zero")})),"DenseMatrix, SparseMatrix":r.referToSelf((e=>(r,t)=>{if(1===t.density())return o(r,t,e,!1);throw new Error("Root must be non-zero")})),"Array, SparseMatrix":r.referTo("DenseMatrix,SparseMatrix",(e=>(r,n)=>e(t(r),n))),"number | BigNumber, SparseMatrix":r.referToSelf((e=>(r,t)=>{if(1===t.density())return c(t,r,e,!0);throw new Error("Root must be non-zero")}))},l({scalar:"number | BigNumber",SD:s,Ss:c,sS:!1}));function p(e,r){var t=i.precision,n=i.clone({precision:t+2}),a=new i(0),o=new n(1),s=r.isNegative();if(s&&(r=r.neg()),r.isZero())throw new Error("Root must be non-zero");if(e.isNegative()&&!r.abs().mod(2).equals(1))throw new Error("Root must be odd when a is negative.");if(e.isZero())return s?new n(1/0):0;if(!e.isFinite())return s?a:e;var u=e.abs().pow(o.div(r));return u=e.isNeg()?u.neg():u,new i((s?o.div(u):u).toPrecision(t))}})),Ro="sign",Po=ur(Ro,["typed","BigNumber","Fraction","complex"],(e=>{var{typed:r,BigNumber:t,complex:n,Fraction:i}=e;return r(Ro,{number:Qn,Complex:function(e){return 0===e.im?n(Qn(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((e=>r=>Fn(r,e,!0))),Unit:r.referToSelf((e=>t=>{if(!t._isDerived()&&0!==t.units[0].unit.offset)throw new TypeError("sign is ambiguous for units with offset");return r.find(e,t.valueType())(t.value)}))})})),Uo=ur("sqrt",["config","typed","Complex"],(e=>{var{config:r,typed:t,Complex:n}=e;return t("sqrt",{number:i,Complex:function(e){return e.sqrt()},BigNumber:function(e){return!e.isNegative()||r.predictable?e.sqrt():i(e.toNumber())},Unit:function(e){return e.pow(.5)}});function i(e){return isNaN(e)?NaN:e>=0||r.predictable?Math.sqrt(e):new n(e,0).sqrt()}})),jo="square",Lo=ur(jo,["typed"],(e=>{var{typed:r}=e;return r(jo,{number:Kn,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)}})})),Ho="subtract",$o=ur(Ho,["typed","matrix","equalScalar","addScalar","unaryMinus","DenseMatrix","concat"],(e=>{var{typed:r,matrix:t,equalScalar:n,addScalar:i,unaryMinus:a,DenseMatrix:o,concat:s}=e,u=lo({typed:r}),c=Bo({typed:r}),l=To({typed:r,equalScalar:n}),f=po({typed:r,DenseMatrix:o}),p=Za({typed:r,DenseMatrix:o}),m=go({typed:r,matrix:t,concat:s});return r(Ho,{"number, number":(e,r)=>e-r,"Complex, Complex":(e,r)=>e.sub(r),"BigNumber, BigNumber":(e,r)=>e.minus(r),"Fraction, Fraction":(e,r)=>e.sub(r),"Unit, Unit":r.referToSelf((e=>(t,n)=>{if(null===t.value)throw new Error("Parameter x contains a unit with undefined value");if(null===n.value)throw new Error("Parameter y contains a unit with undefined value");if(!t.equalBase(n))throw new Error("Units do not match");var i=t.clone();return i.value=r.find(e,[i.valueType(),n.valueType()])(i.value,n.value),i.fixPrefix=!1,i}))},m({SS:l,DS:u,SD:c,Ss:p,sS:f}))})),Zo="xgcd",Go=ur(Zo,["typed","config","matrix","BigNumber"],(e=>{var{typed:r,config:t,matrix:n,BigNumber:i}=e;return r(Zo,{"number, number":function(e,r){var i=ei(e,r);return"Array"===t.matrix?i:n(i)},"BigNumber, BigNumber":function(e,r){var a,o,s,u,c=new i(0),l=new i(1),f=c,p=l,m=l,d=c;if(!e.isInt()||!r.isInt())throw new Error("Parameters in function xgcd must be integer numbers");for(;!r.isZero();)o=e.div(r).floor(),s=e.mod(r),a=f,f=p.minus(o.times(f)),p=a,a=m,m=d.minus(o.times(m)),d=a,e=r,r=s;u=e.lt(c)?[e.neg(),p.neg(),d.neg()]:[e,e.isZero()?0:p,d];return"Array"===t.matrix?u:n(u)}})})),Vo="invmod",Wo=ur(Vo,["typed","config","BigNumber","xgcd","equal","smaller","mod","add","isInteger"],(e=>{var{typed:r,config:t,BigNumber:n,xgcd:i,equal:a,smaller:o,mod:s,add:u,isInteger:c}=e;return r(Vo,{"number, number":l,"BigNumber, BigNumber":l});function l(e,r){if(!c(e)||!c(r))throw new Error("Parameters in function invmod must be integer numbers");if(e=s(e,r),a(r,0))throw new Error("Divisor must be non zero");var t=i(e,r);t=t.valueOf();var[l,f]=t;return a(l,n(1))?(f=s(f,r),o(f,n(0))&&(f=u(f,r)),f):NaN}})),Yo=ur("matAlgo09xS0Sf",["typed","equalScalar"],(e=>{var{typed:r,equalScalar:t}=e;return function(e,n,i){var a=e._values,o=e._index,s=e._ptr,u=e._size,c=e._datatype,l=n._values,f=n._index,p=n._ptr,m=n._size,d=n._datatype;if(u.length!==m.length)throw new Re(u.length,m.length);if(u[0]!==m[0]||u[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+m+")");var h,g=u[0],y=u[1],v=t,x=0,b=i;"string"==typeof c&&c===d&&(h=c,v=r.find(t,[h,h]),x=r.convert(0,h),b=r.find(i,[h,h]));var w,N,D,E,A,C=a&&l?[]:void 0,S=[],M=[],F=C?[]:void 0,B=[];for(N=0;N<y;N++){M[N]=S.length;var T=N+1;if(F)for(E=p[N],A=p[N+1],D=E;D<A;D++)B[w=f[D]]=T,F[w]=l[D];for(E=s[N],A=s[N+1],D=E;D<A;D++)if(w=o[D],F){var O=B[w]===T?F[w]:x,_=b(a[D],O);v(_,x)||(S.push(w),C.push(_))}else S.push(w)}return M[y]=S.length,e.createSparseMatrix({values:C,index:S,ptr:M,size:[g,y],datatype:h})}})),Jo="dotMultiply",Xo=ur(Jo,["typed","matrix","equalScalar","multiplyScalar","concat"],(e=>{var{typed:r,matrix:t,equalScalar:n,multiplyScalar:i,concat:a}=e,o=Do({typed:r,equalScalar:n}),s=Yo({typed:r,equalScalar:n}),u=$a({typed:r,equalScalar:n}),c=go({typed:r,matrix:t,concat:a});return r(Jo,c({elop:i,SS:s,DS:o,Ss:u}))}));function Qo(e,r){if(e.isFinite()&&!e.isInteger()||r.isFinite()&&!r.isInteger())throw new Error("Integers expected in function bitAnd");var t=e.constructor;if(e.isNaN()||r.isNaN())return new t(NaN);if(e.isZero()||r.eq(-1)||e.eq(r))return e;if(r.isZero()||e.eq(-1))return r;if(!e.isFinite()||!r.isFinite()){if(!e.isFinite()&&!r.isFinite())return e.isNegative()===r.isNegative()?e:new t(0);if(!e.isFinite())return r.isNegative()?e:e.isNegative()?new t(0):r;if(!r.isFinite())return e.isNegative()?r:r.isNegative()?new t(0):e}return rs(e,r,(function(e,r){return e&r}))}function Ko(e){if(e.isFinite()&&!e.isInteger())throw new Error("Integer expected in function bitNot");var r=e.constructor,t=r.precision;r.config({precision:1e9});var n=e.plus(new r(1));return n.s=-n.s||null,r.config({precision:t}),n}function es(e,r){if(e.isFinite()&&!e.isInteger()||r.isFinite()&&!r.isInteger())throw new Error("Integers expected in function bitOr");var t=e.constructor;if(e.isNaN()||r.isNaN())return new t(NaN);var n=new t(-1);return e.isZero()||r.eq(n)||e.eq(r)?r:r.isZero()||e.eq(n)?e:e.isFinite()&&r.isFinite()?rs(e,r,(function(e,r){return e|r})):!e.isFinite()&&!e.isNegative()&&r.isNegative()||e.isNegative()&&!r.isNegative()&&!r.isFinite()?n:e.isNegative()&&r.isNegative()?e.isFinite()?e:r:e.isFinite()?r:e}function rs(e,r,t){var n,i,a,o,s,u=e.constructor,c=+(e.s<0),l=+(r.s<0);if(c){n=ts(Ko(e));for(var f=0;f<n.length;++f)n[f]^=1}else n=ts(e);if(l){i=ts(Ko(r));for(var p=0;p<i.length;++p)i[p]^=1}else i=ts(r);n.length<=i.length?(a=n,o=i,s=c):(a=i,o=n,s=l);var m=a.length,d=o.length,h=1^t(c,l),g=new u(1^h),y=new u(1),v=new u(2),x=u.precision;for(u.config({precision:1e9});m>0;)t(a[--m],o[--d])===h&&(g=g.plus(y)),y=y.times(v);for(;d>0;)t(s,o[--d])===h&&(g=g.plus(y)),y=y.times(v);return u.config({precision:x}),0===h&&(g.s=-g.s),g}function ts(e){for(var r=e.d,t=r[0]+"",n=1;n<r.length;++n){for(var i=r[n]+"",a=7-i.length;a--;)i="0"+i;t+=i}for(var o=t.length;"0"===t.charAt(o);)o--;var s=e.e,u=t.slice(0,o+1||1),c=u.length;if(s>0)if(++s>c)for(s-=c;s--;)u+="0";else s<c&&(u=u.slice(0,s)+"."+u.slice(s));for(var l=[0],f=0;f<u.length;){for(var p=l.length;p--;)l[p]*=10;l[0]+=parseInt(u.charAt(f++));for(var m=0;m<l.length;++m)l[m]>1&&(null!==l[m+1]&&void 0!==l[m+1]||(l[m+1]=0),l[m+1]+=l[m]>>1,l[m]&=1)}return l.reverse()}function ns(e,r){if(e.isFinite()&&!e.isInteger()||r.isFinite()&&!r.isInteger())throw new Error("Integers expected in function bitXor");var t=e.constructor;if(e.isNaN()||r.isNaN())return new t(NaN);if(e.isZero())return r;if(r.isZero())return e;if(e.eq(r))return new t(0);var n=new t(-1);return e.eq(n)?Ko(r):r.eq(n)?Ko(e):e.isFinite()&&r.isFinite()?rs(e,r,(function(e,r){return e^r})):e.isFinite()||r.isFinite()?new t(e.isNegative()===r.isNegative()?1/0:-1/0):n}function is(e,r){if(e.isFinite()&&!e.isInteger()||r.isFinite()&&!r.isInteger())throw new Error("Integers expected in function leftShift");var t=e.constructor;return e.isNaN()||r.isNaN()||r.isNegative()&&!r.isZero()?new t(NaN):e.isZero()||r.isZero()?e:e.isFinite()||r.isFinite()?r.lt(55)?e.times(Math.pow(2,r.toNumber())+""):e.times(new t(2).pow(r)):new t(NaN)}function as(e,r){if(e.isFinite()&&!e.isInteger()||r.isFinite()&&!r.isInteger())throw new Error("Integers expected in function rightArithShift");var t=e.constructor;return e.isNaN()||r.isNaN()||r.isNegative()&&!r.isZero()?new t(NaN):e.isZero()||r.isZero()?e:r.isFinite()?r.lt(55)?e.div(Math.pow(2,r.toNumber())+"").floor():e.div(new t(2).pow(r)).floor():e.isNegative()?new t(-1):e.isFinite()?new t(0):new t(NaN)}var os="bitAnd",ss=ur(os,["typed","matrix","equalScalar","concat"],(e=>{var{typed:r,matrix:t,equalScalar:n,concat:i}=e,a=Do({typed:r,equalScalar:n}),o=Eo({typed:r,equalScalar:n}),s=$a({typed:r,equalScalar:n}),u=go({typed:r,matrix:t,concat:i});return r(os,{"number, number":ii,"BigNumber, BigNumber":Qo},u({SS:o,DS:a,Ss:s}))})),us="bitNot",cs=ur(us,["typed"],(e=>{var{typed:r}=e;return r(us,{number:ai,BigNumber:Ko,"Array | Matrix":r.referToSelf((e=>r=>Fn(r,e)))})})),ls="bitOr",fs=ur(ls,["typed","matrix","equalScalar","DenseMatrix","concat"],(e=>{var{typed:r,matrix:t,equalScalar:n,DenseMatrix:i,concat:a}=e,o=lo({typed:r}),s=fo({typed:r,equalScalar:n}),u=po({typed:r,DenseMatrix:i}),c=go({typed:r,matrix:t,concat:a});return r(ls,{"number, number":oi,"BigNumber, BigNumber":es},c({SS:s,DS:o,Ss:u}))})),ps=ur("matAlgo07xSSf",["typed","DenseMatrix"],(e=>{var{typed:r,DenseMatrix:t}=e;return function(e,i,a){var o=e._size,s=e._datatype,u=i._size,c=i._datatype;if(o.length!==u.length)throw new Re(o.length,u.length);if(o[0]!==u[0]||o[1]!==u[1])throw new RangeError("Dimension mismatch. Matrix A ("+o+") must match Matrix B ("+u+")");var l,f,p,m=o[0],d=o[1],h=0,g=a;"string"==typeof s&&s===c&&(l=s,h=r.convert(0,l),g=r.find(a,[l,l]));var y=[];for(f=0;f<m;f++)y[f]=[];var v=[],x=[],b=[],w=[];for(p=0;p<d;p++){var N=p+1;for(n(e,p,b,v,N),n(i,p,w,x,N),f=0;f<m;f++){var D=b[f]===N?v[f]:h,E=w[f]===N?x[f]:h;y[f][p]=g(D,E)}}return new t({data:y,size:[m,d],datatype:l})};function n(e,r,t,n,i){for(var a=e._values,o=e._index,s=e._ptr,u=s[r],c=s[r+1];u<c;u++){var l=o[u];t[l]=i,n[l]=a[u]}}})),ms="bitXor",ds=ur(ms,["typed","matrix","DenseMatrix","concat"],(e=>{var{typed:r,matrix:t,DenseMatrix:n,concat:i}=e,a=Bo({typed:r}),o=ps({typed:r,DenseMatrix:n}),s=Za({typed:r,DenseMatrix:n}),u=go({typed:r,matrix:t,concat:i});return r(ms,{"number, number":si,"BigNumber, BigNumber":ns},u({SS:o,DS:a,Ss:s}))})),hs=ur("arg",["typed"],(e=>{var{typed:r}=e;return r("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":r.referToSelf((e=>r=>Fn(r,e)))})})),gs="conj",ys=ur(gs,["typed"],(e=>{var{typed:r}=e;return r(gs,{"number | BigNumber | Fraction":e=>e,Complex:e=>e.conjugate(),"Array | Matrix":r.referToSelf((e=>r=>Fn(r,e)))})})),vs=ur("im",["typed"],(e=>{var{typed:r}=e;return r("im",{number:()=>0,"BigNumber | Fraction":e=>e.mul(0),Complex:e=>e.im,"Array | Matrix":r.referToSelf((e=>r=>Fn(r,e)))})})),xs=ur("re",["typed"],(e=>{var{typed:r}=e;return r("re",{"number | BigNumber | Fraction":e=>e,Complex:e=>e.re,"Array | Matrix":r.referToSelf((e=>r=>Fn(r,e)))})})),bs=ur("not",["typed"],(e=>{var{typed:r}=e;return r("not",{"null | undefined":()=>!0,number:yi,Complex:function(e){return 0===e.re&&0===e.im},BigNumber:function(e){return e.isZero()||e.isNaN()},Unit:r.referToSelf((e=>t=>r.find(e,t.valueType())(t.value))),"Array | Matrix":r.referToSelf((e=>r=>Fn(r,e)))})})),ws=ur("or",["typed","matrix","equalScalar","DenseMatrix","concat"],(e=>{var{typed:r,matrix:t,equalScalar:n,DenseMatrix:i,concat:a}=e,o=Bo({typed:r}),s=To({typed:r,equalScalar:n}),u=Za({typed:r,DenseMatrix:i}),c=go({typed:r,matrix:t,concat:a});return r("or",{"number, number":vi,"Complex, Complex":function(e,r){return 0!==e.re||0!==e.im||0!==r.re||0!==r.im},"BigNumber, BigNumber":function(e,r){return!e.isZero()&&!e.isNaN()||!r.isZero()&&!r.isNaN()},"Unit, Unit":r.referToSelf((e=>(r,t)=>e(r.value||0,t.value||0)))},c({SS:s,DS:o,Ss:u}))})),Ns=ur("xor",["typed","matrix","DenseMatrix","concat"],(e=>{var{typed:r,matrix:t,DenseMatrix:n,concat:i}=e,a=Bo({typed:r}),o=ps({typed:r,DenseMatrix:n}),s=Za({typed:r,DenseMatrix:n}),u=go({typed:r,matrix:t,concat:i});return r("xor",{"number, number":xi,"Complex, Complex":function(e,r){return(0!==e.re||0!==e.im)!=(0!==r.re||0!==r.im)},"BigNumber, BigNumber":function(e,r){return(!e.isZero()&&!e.isNaN())!=(!r.isZero()&&!r.isNaN())},"Unit, Unit":r.referToSelf((e=>(r,t)=>e(r.value||0,t.value||0)))},u({SS:o,DS:a,Ss:s}))})),Ds="concat",Es=ur(Ds,["typed","matrix","isInteger"],(e=>{var{typed:r,matrix:t,isInteger:n}=e;return r(Ds,{"...Array | Matrix | number | BigNumber":function(e){var r,i,s=e.length,u=-1,c=!1,l=[];for(r=0;r<s;r++){var f=e[r];if(p(f)&&(c=!0),a(f)||o(f)){if(r!==s-1)throw new Error("Dimension must be specified as last argument");if(i=u,u=f.valueOf(),!n(u))throw new TypeError("Integer number expected for dimension");if(u<0||r>0&&u>i)throw new Pe(u,i+1)}else{var m=G(f).valueOf(),d=Ue(m);if(l[r]=m,i=u,u=d.length-1,r>0&&u!==i)throw new Re(i+1,u+1)}}if(0===l.length)throw new SyntaxError("At least one matrix expected");for(var h=l.shift();l.length;)h=As(h,l.shift(),u,0);return c?t(h):h},"...string":function(e){return e.join("")}})}));function As(e,r,t,n){if(n<t){if(e.length!==r.length)throw new Re(e.length,r.length);for(var i=[],a=0;a<e.length;a++)i[a]=As(e[a],r[a],t,n+1);return i}return e.concat(r)}var Cs="column",Ss=ur(Cs,["typed","Index","matrix","range"],(e=>{var{typed:r,Index:t,matrix:n,range:i}=e;return r(Cs,{"Matrix, number":a,"Array, number":function(e,r){return a(n(G(e)),r).valueOf()}});function a(e,r){if(2!==e.size().length)throw new Error("Only two dimensional matrix is supported");He(r,e.size()[1]);var a=i(0,e.size()[0]),o=new t(a,r),s=e.subset(o);return p(s)?s:n([[s]])}})),Ms="count",Fs=ur(Ms,["typed","size","prod"],(e=>{var{typed:r,size:t,prod:n}=e;return r(Ms,{string:function(e){return e.length},"Matrix | Array":function(e){return n(t(e))}})})),Bs="cross",Ts=ur(Bs,["typed","matrix","subtract","multiply"],(e=>{var{typed:r,matrix:t,subtract:n,multiply:i}=e;return r(Bs,{"Matrix, Matrix":function(e,r){return t(a(e.toArray(),r.toArray()))},"Matrix, Array":function(e,r){return t(a(e.toArray(),r))},"Array, Matrix":function(e,r){return t(a(e,r.toArray()))},"Array, Array":a});function a(e,r){var t=Math.max(Ue(e).length,Ue(r).length);e=Ye(e),r=Ye(r);var a=Ue(e),o=Ue(r);if(1!==a.length||1!==o.length||3!==a[0]||3!==o[0])throw new RangeError("Vectors with length 3 expected (Size A = ["+a.join(", ")+"], B = ["+o.join(", ")+"])");var s=[n(i(e[1],r[2]),i(e[2],r[1])),n(i(e[2],r[0]),i(e[0],r[2])),n(i(e[0],r[1]),i(e[1],r[0]))];return t>1?[s]:s}})),Os="diag",_s=ur(Os,["typed","matrix","DenseMatrix","SparseMatrix"],(e=>{var{typed:r,matrix:t,DenseMatrix:n,SparseMatrix:i}=e;return r(Os,{Array:function(e){return a(e,0,Ue(e),null)},"Array, number":function(e,r){return a(e,r,Ue(e),null)},"Array, BigNumber":function(e,r){return a(e,r.toNumber(),Ue(e),null)},"Array, string":function(e,r){return a(e,0,Ue(e),r)},"Array, number, string":function(e,r,t){return a(e,r,Ue(e),t)},"Array, BigNumber, string":function(e,r,t){return a(e,r.toNumber(),Ue(e),t)},Matrix:function(e){return a(e,0,e.size(),e.storage())},"Matrix, number":function(e,r){return a(e,r,e.size(),e.storage())},"Matrix, BigNumber":function(e,r){return a(e,r.toNumber(),e.size(),e.storage())},"Matrix, string":function(e,r){return a(e,0,e.size(),r)},"Matrix, number, string":function(e,r,t){return a(e,r,e.size(),t)},"Matrix, BigNumber, string":function(e,r,t){return a(e,r.toNumber(),e.size(),t)}});function a(e,r,a,o){if(!se(r))throw new TypeError("Second parameter in function diag must be an integer");var s=r>0?r:0,u=r<0?-r:0;switch(a.length){case 1:return function(e,r,t,a,o,s){var u=[a+o,a+s];if(t&&"sparse"!==t&&"dense"!==t)throw new TypeError("Unknown matrix type ".concat(t,'"'));var c="sparse"===t?i.diagonal(u,e,r):n.diagonal(u,e,r);return null!==t?c:c.valueOf()}(e,r,o,a[0],u,s);case 2:return function(e,r,n,i,a,o){if(p(e)){var s=e.diagonal(r);return null!==n?n!==s.storage()?t(s,n):s:s.valueOf()}for(var u=Math.min(i[0]-a,i[1]-o),c=[],l=0;l<u;l++)c[l]=e[l+a][l+o];return null!==n?t(c):c}(e,r,o,a,u,s)}throw new RangeError("Matrix for function diag must be 2 dimensional")}}));function zs(e,r,t,n,i){if(oe.isTypedFunction(e)){var a=[r,t,n],o=oe.resolve(e,a);if(o)return f(o.implementation,a);var s=[r,t],u=oe.resolve(e,s);if(u)return f(u.implementation,s);var c=[r],l=oe.resolve(e,c);return l?f(l.implementation,c):f(e,a)}return e(r,t,n);function f(a,o){try{return a.apply(a,o)}catch(a){var s;if(a instanceof TypeError&&"wrongType"===(null===(s=a.data)||void 0===s?void 0:s.category)){var u=[];throw u.push("value: ".concat(Z(r))),o.length>=2&&u.push("index: ".concat(Z(t))),o.length>=3&&u.push("array: ".concat(Z(n))),new TypeError("Function ".concat(i," cannot apply callback arguments ")+"".concat(e.name,"(").concat(u.join(", "),") at index ").concat(JSON.stringify(t)))}throw new TypeError("Function ".concat(i," cannot apply callback arguments ")+"to function ".concat(e.name,": ").concat(a.message))}}}var qs=ur("filter",["typed"],(e=>{var{typed:r}=e;return r("filter",{"Array, function":Is,"Matrix, function":function(e,r){return e.create(Is(e.toArray(),r))},"Array, RegExp":nr,"Matrix, RegExp":function(e,r){return e.create(nr(e.toArray(),r))}})}));function Is(e,r){return tr(e,(function(e,t,n){return zs(r,e,[t],n,"filter")}))}var ks="flatten",Rs=ur(ks,["typed","matrix"],(e=>{var{typed:r,matrix:t}=e;return r(ks,{Array:function(e){return Ke(e)},Matrix:function(e){var r=Ke(e.toArray());return t(r)}})})),Ps="forEach",Us=ur(Ps,["typed"],(e=>{var{typed:r}=e;return r(Ps,{"Array, function":js,"Matrix, function":function(e,r){e.forEach(r)}})}));function js(e,r){!function t(n,i){if(!Array.isArray(n))return zs(r,n,i,e,"forEach");rr(n,(function(e,r){t(e,i.concat(r))}))}(e,[])}var Ls="getMatrixDataType",Hs=ur(Ls,["typed"],(e=>{var{typed:r}=e;return r(Ls,{Array:function(e){return sr(e,Z)},Matrix:function(e){return e.getDataType()}})})),$s="identity",Zs=ur($s,["typed","config","matrix","BigNumber","DenseMatrix","SparseMatrix"],(e=>{var{typed:r,config:t,matrix:n,BigNumber:i,DenseMatrix:a,SparseMatrix:s}=e;return r($s,{"":function(){return"Matrix"===t.matrix?n([]):[]},string:function(e){return n(e)},"number | BigNumber":function(e){return c(e,e,"Matrix"===t.matrix?"dense":void 0)},"number | BigNumber, string":function(e,r){return c(e,e,r)},"number | BigNumber, number | BigNumber":function(e,r){return c(e,r,"Matrix"===t.matrix?"dense":void 0)},"number | BigNumber, number | BigNumber, string":function(e,r,t){return c(e,r,t)},Array:function(e){return u(e)},"Array, string":function(e,r){return u(e,r)},Matrix:function(e){return u(e.valueOf(),e.storage())},"Matrix, string":function(e,r){return u(e.valueOf(),r)}});function u(e,r){switch(e.length){case 0:return r?n(r):[];case 1:return c(e[0],e[0],r);case 2:return c(e[0],e[1],r);default:throw new Error("Vector containing two values expected")}}function c(e,r,t){var n=o(e)||o(r)?i:null;if(o(e)&&(e=e.toNumber()),o(r)&&(r=r.toNumber()),!se(e)||e<1)throw new Error("Parameters in function identity must be positive integers");if(!se(r)||r<1)throw new Error("Parameters in function identity must be positive integers");var u=n?new i(1):1,c=n?new n(0):0,l=[e,r];if(t){if("sparse"===t)return s.diagonal(l,u,0,c);if("dense"===t)return a.diagonal(l,u,0,c);throw new TypeError('Unknown matrix type "'.concat(t,'"'))}for(var f=$e([],l,c),p=e<r?e:r,m=0;m<p;m++)f[m][m]=u;return f}})),Gs="kron",Vs=ur(Gs,["typed","matrix","multiplyScalar"],(e=>{var{typed:r,matrix:t,multiplyScalar:n}=e;return r(Gs,{"Matrix, Matrix":function(e,r){return t(i(e.toArray(),r.toArray()))},"Matrix, Array":function(e,r){return t(i(e.toArray(),r))},"Array, Matrix":function(e,r){return t(i(e,r.toArray()))},"Array, Array":i});function i(e,r){if(1===Ue(e).length&&(e=[e]),1===Ue(r).length&&(r=[r]),Ue(e).length>2||Ue(r).length>2)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 t=[],i=[];return e.map((function(e){return r.map((function(r){return i=[],t.push(i),e.map((function(e){return r.map((function(r){return i.push(n(e,r))}))}))}))}))&&t}})),Ws=ur("map",["typed"],(e=>{var{typed:r}=e;return r("map",{"Array, function":Ys,"Matrix, function":function(e,r){return e.map(r)}})}));function Ys(e,r){return function t(n,i){return Array.isArray(n)?n.map((function(e,r){return t(e,i.concat(r))})):zs(r,n,i,e,"map")}(e,[])}var Js="diff",Xs=ur(Js,["typed","matrix","subtract","number"],(e=>{var{typed:r,matrix:t,subtract:n,number:i}=e;return r(Js,{"Array | Matrix":function(e){return p(e)?t(o(e.toArray())):o(e)},"Array | Matrix, number":function(e,r){if(!se(r))throw new RangeError("Dimension must be a whole number");return p(e)?t(a(e.toArray(),r)):a(e,r)},"Array, BigNumber":r.referTo("Array,number",(e=>(r,t)=>e(r,i(t)))),"Matrix, BigNumber":r.referTo("Matrix,number",(e=>(r,t)=>e(r,i(t))))});function a(e,r){if(p(e)&&(e=e.toArray()),!Array.isArray(e))throw RangeError("Array/Matrix does not have that many dimensions");if(r>0){var t=[];return e.forEach((e=>{t.push(a(e,r-1))})),t}if(0===r)return o(e);throw RangeError("Cannot have negative dimension")}function o(e){for(var r=[],t=e.length,n=1;n<t;n++)r.push(s(e[n-1],e[n]));return r}function s(e,r){p(e)&&(e=e.toArray()),p(r)&&(r=r.toArray());var t=Array.isArray(e),i=Array.isArray(r);if(t&&i)return function(e,r){if(e.length!==r.length)throw RangeError("Not all sub-arrays have the same length");for(var t=[],n=e.length,i=0;i<n;i++)t.push(s(e[i],r[i]));return t}(e,r);if(!t&&!i)return n(r,e);throw TypeError("Cannot calculate difference between 1 array and 1 non-array")}})),Qs=ur("ones",["typed","config","matrix","BigNumber"],(e=>{var{typed:r,config:t,matrix:n,BigNumber:i}=e;return r("ones",{"":function(){return"Array"===t.matrix?a([]):a([],"default")},"...number | BigNumber | string":function(e){if("string"==typeof e[e.length-1]){var r=e.pop();return a(e,r)}return"Array"===t.matrix?a(e):a(e,"default")},Array:a,Matrix:function(e){var r=e.storage();return a(e.valueOf(),r)},"Array | Matrix, string":function(e,r){return a(e.valueOf(),r)}});function a(e,r){var t=function(e){var r=!1;return e.forEach((function(e,t,n){o(e)&&(r=!0,n[t]=e.toNumber())})),r}(e),a=t?new i(1):1;if(function(e){e.forEach((function(e){if("number"!=typeof e||!se(e)||e<0)throw new Error("Parameters in function ones must be positive integers")}))}(e),r){var s=n(r);return e.length>0?s.resize(e,a):s}var u=[];return e.length>0?$e(u,e,a):u}}));function Ks(){throw new Error('No "bignumber" implementation available')}function eu(){throw new Error('No "fraction" implementation available')}function ru(){throw new Error('No "matrix" implementation available')}var tu="range",nu=ur(tu,["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],(e=>{var{typed:r,config:t,matrix:n,bignumber:i,smaller:a,smallerEq:o,larger:s,largerEq:u,add:c,isPositive:l}=e;return r(tu,{string:p,"string, boolean":p,"number, number":function(e,r){return f(m(e,r,1,!1))},"number, number, number":function(e,r,t){return f(m(e,r,t,!1))},"number, number, boolean":function(e,r,t){return f(m(e,r,1,t))},"number, number, number, boolean":function(e,r,t,n){return f(m(e,r,t,n))},"BigNumber, BigNumber":function(e,r){return f(m(e,r,new(0,e.constructor)(1),!1))},"BigNumber, BigNumber, BigNumber":function(e,r,t){return f(m(e,r,t,!1))},"BigNumber, BigNumber, boolean":function(e,r,t){return f(m(e,r,new(0,e.constructor)(1),t))},"BigNumber, BigNumber, BigNumber, boolean":function(e,r,t,n){return f(m(e,r,t,n))},"Unit, Unit, Unit":function(e,r,t){return f(m(e,r,t,!1))},"Unit, Unit, Unit, boolean":function(e,r,t,n){return f(m(e,r,t,n))}});function f(e){return"Matrix"===t.matrix?n?n(e):ru():e}function p(e,r){var n=function(e){var r=e.split(":"),t=r.map((function(e){return Number(e)}));if(t.some((function(e){return isNaN(e)})))return null;switch(t.length){case 2:return{start:t[0],end:t[1],step:1};case 3:return{start:t[0],end:t[2],step:t[1]};default:return null}}(e);if(!n)throw new SyntaxError('String "'+e+'" is no valid range');return"BigNumber"===t.number?(void 0===i&&Ks(),f(m(i(n.start),i(n.end),i(n.step)))):f(m(n.start,n.end,n.step,r))}function m(e,r,t,n){for(var i=[],f=l(t)?n?o:a:n?u:s,p=e;f(p,r);)i.push(p),p=c(p,t);return i}})),iu="reshape",au=ur(iu,["typed","isInteger","matrix"],(e=>{var{typed:r,isInteger:t}=e;return r(iu,{"Matrix, Array":function(e,r){return e.reshape(r,!0)},"Array, Array":function(e,r){return r.forEach((function(e){if(!t(e))throw new TypeError("Invalid size for dimension: "+e)})),Ge(e,r)}})})),ou=ur("resize",["config","matrix"],(e=>{var{config:r,matrix:t}=e;return function(e,n,i){if(2!==arguments.length&&3!==arguments.length)throw new yo("resize",arguments.length,2,3);if(p(n)&&(n=n.valueOf()),o(n[0])&&(n=n.map((function(e){return o(e)?e.toNumber():e}))),p(e))return e.resize(n,i,!0);if("string"==typeof e)return function(e,r,t){if(void 0!==t){if("string"!=typeof t||1!==t.length)throw new TypeError("Single character expected as defaultValue")}else t=" ";if(1!==r.length)throw new Re(r.length,1);var n=r[0];if("number"!=typeof n||!se(n))throw new TypeError("Invalid size, must contain positive integers (size: "+_e(r)+")");if(e.length>n)return e.substring(0,n);if(e.length<n){for(var i=e,a=0,o=n-e.length;a<o;a++)i+=t;return i}return e}(e,n,i);var a=!Array.isArray(e)&&"Array"!==r.matrix;if(0===n.length){for(;Array.isArray(e);)e=e[0];return G(e)}Array.isArray(e)||(e=[e]);var s=$e(e=G(e),n,i);return a?t(s):s}})),su="rotate",uu=ur(su,["typed","multiply","rotationMatrix"],(e=>{var{typed:r,multiply:t,rotationMatrix:n}=e;return r(su,{"Array , number | BigNumber | Complex | Unit":function(e,r){return i(e,2),t(n(r),e).toArray()},"Matrix , number | BigNumber | Complex | Unit":function(e,r){return i(e,2),t(n(r),e)},"Array, number | BigNumber | Complex | Unit, Array | Matrix":function(e,r,a){return i(e,3),t(n(r,a),e)},"Matrix, number | BigNumber | Complex | Unit, Array | Matrix":function(e,r,a){return i(e,3),t(n(r,a),e)}});function i(e,r){var t=Array.isArray(e)?Ue(e):e.size();if(t.length>2)throw new RangeError("Vector must be of dimensions 1x".concat(r));if(2===t.length&&1!==t[1])throw new RangeError("Vector must be of dimensions 1x".concat(r));if(t[0]!==r)throw new RangeError("Vector must be of dimensions 1x".concat(r))}})),cu="rotationMatrix",lu=ur(cu,["typed","config","multiplyScalar","addScalar","unaryMinus","norm","matrix","BigNumber","DenseMatrix","SparseMatrix","cos","sin"],(e=>{var{typed:r,config:t,multiplyScalar:n,addScalar:i,unaryMinus:a,norm:s,BigNumber:u,matrix:c,DenseMatrix:l,SparseMatrix:f,cos:p,sin:m}=e;return r(cu,{"":function(){return"Matrix"===t.matrix?c([]):[]},string:function(e){return c(e)},"number | BigNumber | Complex | Unit":function(e){return d(e,"Matrix"===t.matrix?"dense":void 0)},"number | BigNumber | Complex | Unit, string":function(e,r){return d(e,r)},"number | BigNumber | Complex | Unit, Array":function(e,r){var t=c(r);return h(t),v(e,t,void 0)},"number | BigNumber | Complex | Unit, Matrix":function(e,r){h(r);var n=r.storage()||("Matrix"===t.matrix?"dense":void 0);return v(e,r,n)},"number | BigNumber | Complex | Unit, Array, string":function(e,r,t){var n=c(r);return h(n),v(e,n,t)},"number | BigNumber | Complex | Unit, Matrix, string":function(e,r,t){return h(r),v(e,r,t)}});function d(e,r){var t=o(e)?new u(-1):-1,i=p(e),a=m(e);return y([[i,n(t,a)],[a,i]],r)}function h(e){var r=e.size();if(r.length<1||3!==r[0])throw new RangeError("Vector must be of dimensions 1x3")}function g(e){return e.reduce(((e,r)=>n(e,r)))}function y(e,r){if(r){if("sparse"===r)return new f(e);if("dense"===r)return new l(e);throw new TypeError('Unknown matrix type "'.concat(r,'"'))}return e}function v(e,r,t){var n=s(r);if(0===n)throw new RangeError("Rotation around zero vector");var c=o(e)?u:null,l=c?new c(1):1,f=c?new c(-1):-1,d=c?new c(r.get([0])/n):r.get([0])/n,h=c?new c(r.get([1])/n):r.get([1])/n,v=c?new c(r.get([2])/n):r.get([2])/n,x=p(e),b=i(l,a(x)),w=m(e);return y([[i(x,g([d,d,b])),i(g([d,h,b]),g([f,v,w])),i(g([d,v,b]),g([h,w]))],[i(g([d,h,b]),g([v,w])),i(x,g([h,h,b])),i(g([h,v,b]),g([f,d,w]))],[i(g([d,v,b]),g([f,h,w])),i(g([h,v,b]),g([d,w])),i(x,g([v,v,b]))]],t)}})),fu=ur("row",["typed","Index","matrix","range"],(e=>{var{typed:r,Index:t,matrix:n,range:i}=e;return r("row",{"Matrix, number":a,"Array, number":function(e,r){return a(n(G(e)),r).valueOf()}});function a(e,r){if(2!==e.size().length)throw new Error("Only two dimensional matrix is supported");He(r,e.size()[0]);var a=i(0,e.size()[1]),o=new t(r,a),s=e.subset(o);return p(s)?s:n([[s]])}})),pu="size",mu=ur(pu,["typed","config","?matrix"],(e=>{var{typed:r,config:t,matrix:n}=e;return r(pu,{Matrix:function(e){return e.create(e.size())},Array:Ue,string:function(e){return"Array"===t.matrix?[e.length]:n([e.length])},"number | Complex | BigNumber | Unit | boolean | null":function(e){return"Array"===t.matrix?[]:n?n([]):ru()}})})),du="squeeze",hu=ur(du,["typed","matrix"],(e=>{var{typed:r,matrix:t}=e;return r(du,{Array:function(e){return Ye(G(e))},Matrix:function(e){var r=Ye(e.toArray());return Array.isArray(r)?t(r):r},any:function(e){return G(e)}})})),gu="subset",yu=ur(gu,["typed","matrix"],(e=>{var{typed:r,matrix:t}=e;return r(gu,{"Array, Index":function(e,r){var n=t(e).subset(r);return r.isScalar()?n:n.valueOf()},"Matrix, Index":function(e,r){return e.subset(r)},"Object, Index":bu,"string, Index":vu,"Array, Index, any":function(e,r,n){return t(G(e)).subset(r,n,void 0).valueOf()},"Array, Index, any, any":function(e,r,n,i){return t(G(e)).subset(r,n,i).valueOf()},"Matrix, Index, any":function(e,r,t){return e.clone().subset(r,t)},"Matrix, Index, any, any":function(e,r,t,n){return e.clone().subset(r,t,n)},"string, Index, string":xu,"string, Index, string, string":xu,"Object, Index, any":wu})}));function vu(e,r){if(!y(r))throw new TypeError("Index expected");if(1!==r.size().length)throw new Re(r.size().length,1);var t=e.length;He(r.min()[0],t),He(r.max()[0],t);var n=r.dimension(0),i="";return n.forEach((function(r){i+=e.charAt(r)})),i}function xu(e,r,t,n){if(!r||!0!==r.isIndex)throw new TypeError("Index expected");if(1!==r.size().length)throw new Re(r.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=r.dimension(0);if(i.size()[0]!==t.length)throw new Re(i.size()[0],t.length);var a=e.length;He(r.min()[0]),He(r.max()[0]);for(var o=[],s=0;s<a;s++)o[s]=e.charAt(s);if(i.forEach((function(e,r){o[e]=t.charAt(r[0])})),o.length>a)for(var u=a-1,c=o.length;u<c;u++)o[u]||(o[u]=n);return o.join("")}function bu(e,r){if(1!==r.size().length)throw new Re(r.size(),1);var t=r.dimension(0);if("string"!=typeof t)throw new TypeError("String expected as index to retrieve an object property");return lr(e,t)}function wu(e,r,t){if(1!==r.size().length)throw new Re(r.size(),1);var n=r.dimension(0);if("string"!=typeof n)throw new TypeError("String expected as index to retrieve an object property");var i=G(e);return fr(i,n,t),i}var Nu="transpose",Du=ur(Nu,["typed","matrix"],(e=>{var{typed:r,matrix:t}=e;return r(Nu,{Array:e=>n(t(e)).valueOf(),Matrix:n,any:G});function n(e){var r,t=e.size();switch(t.length){case 1:r=e.clone();break;case 2:var n=t[0],i=t[1];if(0===i)throw new RangeError("Cannot transpose a 2D matrix with no columns (size: "+_e(t)+")");switch(e.storage()){case"dense":r=function(e,r,t){for(var n,i=e._data,a=[],o=0;o<t;o++){n=a[o]=[];for(var s=0;s<r;s++)n[s]=G(i[s][o])}return e.createDenseMatrix({data:a,size:[t,r],datatype:e._datatype})}(e,n,i);break;case"sparse":r=function(e,r,t){for(var n,i,a,o=e._values,s=e._index,u=e._ptr,c=o?[]:void 0,l=[],f=[],p=[],m=0;m<r;m++)p[m]=0;for(n=0,i=s.length;n<i;n++)p[s[n]]++;for(var d=0,h=0;h<r;h++)f.push(d),d+=p[h],p[h]=f[h];for(f.push(d),a=0;a<t;a++)for(var g=u[a],y=u[a+1],v=g;v<y;v++){var x=p[s[v]]++;l[x]=a,o&&(c[x]=G(o[v]))}return e.createSparseMatrix({values:c,index:l,ptr:f,size:[t,r],datatype:e._datatype})}(e,n,i)}break;default:throw new RangeError("Matrix must be a vector or two dimensional (size: "+_e(t)+")")}return r}})),Eu="ctranspose",Au=ur(Eu,["typed","transpose","conj"],(e=>{var{typed:r,transpose:t,conj:n}=e;return r(Eu,{any:function(e){return n(t(e))}})})),Cu="zeros",Su=ur(Cu,["typed","config","matrix","BigNumber"],(e=>{var{typed:r,config:t,matrix:n,BigNumber:i}=e;return r(Cu,{"":function(){return"Array"===t.matrix?a([]):a([],"default")},"...number | BigNumber | string":function(e){if("string"==typeof e[e.length-1]){var r=e.pop();return a(e,r)}return"Array"===t.matrix?a(e):a(e,"default")},Array:a,Matrix:function(e){var r=e.storage();return a(e.valueOf(),r)},"Array | Matrix, string":function(e,r){return a(e.valueOf(),r)}});function a(e,r){var t=function(e){var r=!1;return e.forEach((function(e,t,n){o(e)&&(r=!0,n[t]=e.toNumber())})),r}(e),a=t?new i(0):0;if(function(e){e.forEach((function(e){if("number"!=typeof e||!se(e)||e<0)throw new Error("Parameters in function zeros must be positive integers")}))}(e),r){var s=n(r);return e.length>0?s.resize(e,a):s}var u=[];return e.length>0?$e(u,e,a):u}})),Mu=ur("fft",["typed","matrix","addScalar","multiplyScalar","divideScalar","exp","tau","i","dotDivide","conj","pow","ceil","log2"],(e=>{var{typed:r,matrix:t,addScalar:n,multiplyScalar:i,divideScalar:a,exp:o,tau:s,i:u,dotDivide:c,conj:l,pow:f,ceil:p,log2:m}=e;return r("fft",{Array:d,Matrix:function(e){return e.create(d(e.toArray()))}});function d(e){var r=Ue(e);return 1===r.length?g(e,r[0]):h(e.map((e=>d(e,r.slice(1)))),0)}function h(e,r){var t=Ue(e);if(0!==r)return new Array(t[0]).fill(0).map(((t,n)=>h(e[n],r-1)));if(1===t.length)return g(e);function n(e){var r=Ue(e);return new Array(r[1]).fill(0).map(((t,n)=>new Array(r[0]).fill(0).map(((r,t)=>e[t][n]))))}return n(h(n(e),1))}function g(e){var r=e.length;if(1===r)return[e[0]];if(r%2==0){for(var t=[...g(e.filter(((e,r)=>r%2==0))),...g(e.filter(((e,r)=>r%2==1)))],h=0;h<r/2;h++){var y=t[h],v=i(t[h+r/2],o(i(i(s,u),a(-h,r))));t[h]=n(y,v),t[h+r/2]=n(y,i(-1,v))}return t}return function(e){for(var r=e.length,t=o(a(i(-1,i(u,s)),r)),n=[],h=1-r;h<r;h++)n.push(f(t,a(f(h,2),2)));for(var y=f(2,p(m(r+r-1))),v=[...new Array(r).fill(0).map(((t,a)=>i(e[a],n[r-1+a]))),...new Array(y-r).fill(0)],x=[...new Array(r+r-1).fill(0).map(((e,r)=>a(1,n[r]))),...new Array(y-(r+r-1)).fill(0)],b=g(v),w=g(x),N=new Array(y).fill(0).map(((e,r)=>i(b[r],w[r]))),D=c(l(d(l(N))),y),E=[],A=r-1;A<r+r-1;A++)E.push(i(D[A],n[A]));return E}(e)}})),Fu="ifft",Bu=ur(Fu,["typed","fft","dotDivide","conj"],(e=>{var{typed:r,fft:t,dotDivide:n,conj:i}=e;return r(Fu,{"Array | Matrix":function(e){var r=p(e)?e.size():Ue(e);return n(i(t(i(e))),r.reduce(((e,r)=>e*r),1))}})})),Tu=t(87765);function Ou(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}var _u=ur("solveODE",["typed","add","subtract","multiply","divide","max","map","abs","isPositive","isNegative","larger","smaller","matrix","bignumber","unaryMinus"],(e=>{var{typed:r,add:t,subtract:n,multiply:i,divide:s,max:u,map:l,abs:f,isPositive:p,isNegative:m,larger:d,smaller:h,matrix:g,bignumber:y,unaryMinus:v}=e;function x(e){return function(r,a,g,x){if(!(2===a.length&&(a.every(D)||a.every(c))))throw new Error('"tspan" must be an Array of two numeric values or two units [tStart, tEnd]');var b=a[0],w=a[1],N=d(w,b),E=x.firstStep;if(void 0!==E&&!p(E))throw new Error('"firstStep" must be positive');var A=x.maxStep;if(void 0!==A&&!p(A))throw new Error('"maxStep" must be positive');var C=x.minStep;if(C&&m(C))throw new Error('"minStep" must be positive or zero');var S=[b,w,E,C,A].filter((e=>void 0!==e));if(!S.every(D)&&!S.every(c))throw new Error('Inconsistent type of "t" dependant variables');for(var M=x.tol?x.tol:1e-4,F=x.minDelta?x.minDelta:.2,B=x.maxDelta?x.maxDelta:5,T=x.maxIter?x.maxIter:1e4,O=[b,w,...g,A,C].some(o),[_,z,q,I]=O?[y(e.a),y(e.c),y(e.b),y(e.bp)]:[e.a,e.c,e.b,e.bp],k=E?N?E:v(E):s(n(w,b),1),R=[b],P=[g],U=n(q,I),j=0,L=0,H=function(e){return e?h:d}(N),$=function(e){var r=e?d:h;return function(e,i,a){var o=t(e,a);return r(o,i)?n(i,e):a}}(N);H(R[j],w);){var Z=[];k=$(R[j],w,k),Z.push(r(R[j],P[j]));for(var G=1;G<z.length;++G)Z.push(r(t(R[j],i(z[G],k)),t(P[j],i(k,_[G],Z))));var V=u(f(l(i(U,Z),(e=>c(e)?e.value:e))));V<M&&M/V>1/4&&(R.push(t(R[j],k)),P.push(t(P[j],i(k,q,Z))),j++);var W=.84*(M/V)**.2;if(h(W,F)?W=F:d(W,B)&&(W=B),W=O?y(W):W,k=i(k,W),A&&d(f(k),A)?k=N?A:v(A):C&&h(f(k),C)&&(k=N?C:v(C)),++L>T)throw new Error("Maximum number of iterations reached, try changing options")}return{t:R,y:P}}}function b(e,r,t,n){return x({a:[[],[.5],[0,3/4],[2/9,1/3,4/9]],c:[null,.5,3/4,1],b:[2/9,1/3,4/9,0],bp:[7/24,1/4,1/3,1/8]})(e,r,t,n)}function w(e,r,t,n){return x({a:[[],[.2],[3/40,9/40],[44/45,-56/15,32/9],[19372/6561,-25360/2187,64448/6561,-212/729],[9017/3168,-355/33,46732/5247,49/176,-5103/18656],[35/384,0,500/1113,125/192,-2187/6784,11/84]],c:[null,.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,1/40]})(e,r,t,n)}function N(e,r,t,n){var i=n.method?n.method:"RK45",a={RK23:b,RK45:w};if(i.toUpperCase()in a){var o=function(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?Ou(Object(t),!0).forEach((function(r){(0,Tu.Z)(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Ou(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}({},n);return delete o.method,a[i.toUpperCase()](e,r,t,o)}var s=Object.keys(a).map((e=>'"'.concat(e,'"'))),u="".concat(s.slice(0,-1).join(", ")," and ").concat(s.slice(-1));throw new Error('Unavailable method "'.concat(i,'". Available methods are ').concat(u))}function D(e){return o(e)||a(e)}function E(e,r,t,n){var i=N(e,r.toArray(),t.toArray(),n);return{t:g(i.t),y:g(i.y)}}return r("solveODE",{"function, Array, Array, Object":N,"function, Matrix, Matrix, Object":E,"function, Array, Array":(e,r,t)=>N(e,r,t,{}),"function, Matrix, Matrix":(e,r,t)=>E(e,r,t,{}),"function, Array, number | BigNumber | Unit":(e,r,t)=>{var n=N(e,r,[t],{});return{t:n.t,y:n.y.map((e=>e[0]))}},"function, Matrix, number | BigNumber | Unit":(e,r,t)=>{var n=N(e,r.toArray(),[t],{});return{t:g(n.t),y:g(n.y.map((e=>e[0])))}},"function, Array, number | BigNumber | Unit, Object":(e,r,t,n)=>{var i=N(e,r,[t],n);return{t:i.t,y:i.y.map((e=>e[0]))}},"function, Matrix, number | BigNumber | Unit, Object":(e,r,t,n)=>{var i=N(e,r.toArray(),[t],n);return{t:g(i.t),y:g(i.y.map((e=>e[0])))}}})})),zu=ur("erf",["typed"],(e=>{var{typed:r}=e;return r("name",{number:function(e){var r=Math.abs(e);return r>=Pu?ue(e):r<=qu?ue(e)*function(e){var r,t=e*e,n=ku[0][4]*t,i=t;for(r=0;r<3;r+=1)n=(n+ku[0][r])*t,i=(i+Ru[0][r])*t;return e*(n+ku[0][3])/(i+Ru[0][3])}(r):r<=4?ue(e)*(1-function(e){var r,t=ku[1][8]*e,n=e;for(r=0;r<7;r+=1)t=(t+ku[1][r])*e,n=(n+Ru[1][r])*e;var i=(t+ku[1][7])/(n+Ru[1][7]),a=parseInt(16*e)/16,o=(e-a)*(e+a);return Math.exp(-a*a)*Math.exp(-o)*i}(r)):ue(e)*(1-function(e){var r,t=1/(e*e),n=ku[2][5]*t,i=t;for(r=0;r<4;r+=1)n=(n+ku[2][r])*t,i=(i+Ru[2][r])*t;var a=t*(n+ku[2][4])/(i+Ru[2][4]);a=(Iu-a)/e,t=parseInt(16*e)/16;var o=(e-t)*(e+t);return Math.exp(-t*t)*Math.exp(-o)*a}(r))},"Array | Matrix":r.referToSelf((e=>r=>Fn(r,e)))})})),qu=.46875,Iu=.5641895835477563,ku=[[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]],Ru=[[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]],Pu=Math.pow(2,53),Uu="mode",ju=ur(Uu,["typed","isNaN","isNumeric"],(e=>{var{typed:r,isNaN:t,isNumeric:n}=e;return r(Uu,{"Array | Matrix":i,"...":function(e){return i(e)}});function i(e){if(0===(e=Ke(e.valueOf())).length)throw new Error("Cannot calculate mode of an empty array");for(var r={},i=[],a=0,o=0;o<e.length;o++){var s=e[o];if(n(s)&&t(s))throw new Error("Cannot calculate mode of an array containing NaN values");s in r||(r[s]=0),r[s]++,r[s]===a?i.push(s):r[s]>a&&(a=r[s],i=[s])}return i}}));function Lu(e,r,t){var n;return-1!==String(e).indexOf("Unexpected type")?(n=arguments.length>2?" (type: "+Z(t)+", value: "+JSON.stringify(t)+")":" (type: "+e.data.actual+")",new TypeError("Cannot calculate "+r+", unexpected type of argument"+n)):-1!==String(e).indexOf("complex numbers")?(n=arguments.length>2?" (type: "+Z(t)+", value: "+JSON.stringify(t)+")":"",new TypeError("Cannot calculate "+r+", no ordering relation is defined for complex numbers"+n)):e}var Hu="prod",$u=ur(Hu,["typed","config","multiplyScalar","numeric"],(e=>{var{typed:r,config:t,multiplyScalar:n,numeric:i}=e;return r(Hu,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(e,r){throw new Error("prod(A, dim) is not yet supported")},"...":function(e){return a(e)}});function a(e){var r;if(Mn(e,(function(e){try{r=void 0===r?e:n(r,e)}catch(r){throw Lu(r,"prod",e)}})),"string"==typeof r&&(r=i(r,t.number)),void 0===r)throw new Error("Cannot calculate prod of an empty array");return r}})),Zu="format",Gu=ur(Zu,["typed"],(e=>{var{typed:r}=e;return r(Zu,{any:_e,"any, Object | function | number":_e})})),Vu=ur("bin",["typed","format"],(e=>{var{typed:r,format:t}=e;return r("bin",{"number | BigNumber":function(e){return t(e,{notation:"bin"})},"number | BigNumber, number":function(e,r){return t(e,{notation:"bin",wordSize:r})}})})),Wu=ur("oct",["typed","format"],(e=>{var{typed:r,format:t}=e;return r("oct",{"number | BigNumber":function(e){return t(e,{notation:"oct"})},"number | BigNumber, number":function(e,r){return t(e,{notation:"oct",wordSize:r})}})})),Yu=ur("hex",["typed","format"],(e=>{var{typed:r,format:t}=e;return r("hex",{"number | BigNumber":function(e){return t(e,{notation:"hex"})},"number | BigNumber, number":function(e,r){return t(e,{notation:"hex",wordSize:r})}})})),Ju="print",Xu=ur(Ju,["typed"],(e=>{var{typed:r}=e;return r(Ju,{"string, Object | Array":Qu,"string, Object | Array, number | Object":Qu})}));function Qu(e,r,t){return e.replace(/\$([\w.]+)/g,(function(e,n){for(var i=n.split("."),a=r[i.shift()];i.length&&void 0!==a;){var o=i.shift();a=o?a[o]:a+"."}return void 0!==a?l(a)?a:_e(a,t):e}))}var Ku=ur("to",["typed","matrix","concat"],(e=>{var{typed:r,matrix:t,concat:n}=e;return r("to",{"Unit, Unit | string":(e,r)=>e.to(r)},go({typed:r,matrix:t,concat:n})({Ds:!0}))})),ec="isPrime",rc=ur(ec,["typed"],(e=>{var{typed:r}=e;return r(ec,{number:function(e){if(0*e!=0)return!1;if(e<=3)return e>1;if(e%2==0||e%3==0)return!1;for(var r=5;r*r<=e;r+=6)if(e%r==0||e%(r+2)==0)return!1;return!0},BigNumber:function(e){if(0*e.toNumber()!=0)return!1;if(e.lte(3))return e.gt(1);if(e.mod(2).eq(0)||e.mod(3).eq(0))return!1;if(e.lt(Math.pow(2,32))){for(var r=e.toNumber(),t=5;t*t<=r;t+=6)if(r%t==0||r%(t+2)==0)return!1;return!0}function n(e,r,t){for(var n=1;!r.eq(0);)r.mod(2).eq(0)?(r=r.div(2),e=e.mul(e).mod(t)):(r=r.sub(1),n=e.mul(n).mod(t));return n}for(var i=e.constructor.clone({precision:2*e.toFixed(0).length}),a=0,o=(e=new i(e)).sub(1);o.mod(2).eq(0);)o=o.div(2),a+=1;var s=null;if(e.lt("3317044064679887385961981"))s=[2,3,5,7,11,13,17,19,23,29,31,37,41].filter((r=>r<e));else{var u=Math.min(e.toNumber()-2,Math.floor(2*Math.pow(e.toFixed(0).length*Math.log(10),2)));s=[];for(var c=2;c<=u;c+=1)s.push(u)}for(var l=0;l<s.length;l+=1){var f=s[l],p=n(e.sub(e).add(f),o,e);if(!p.eq(1))for(var m=0,d=p;!d.eq(e.sub(1));m+=1,d=d.mul(d).mod(e))if(m===a-1)return!1}return!0},"Array | Matrix":r.referToSelf((e=>r=>Fn(r,e)))})})),tc=ur("numeric",["number","?bignumber","?fraction"],(e=>{var{number:r,bignumber:t,fraction:n}=e,i={string:!0,number:!0,BigNumber:!0,Fraction:!0},a={number:e=>r(e),BigNumber:t?e=>t(e):Ks,Fraction:n?e=>n(e):eu};return function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"number";if(void 0!==(arguments.length>2?arguments[2]:void 0))throw new SyntaxError("numeric() takes one or two arguments");var t=Z(e);if(!(t in i))throw new TypeError("Cannot convert "+e+' of type "'+t+'"; valid input types are '+Object.keys(i).join(", "));if(!(r in a))throw new TypeError("Cannot convert "+e+' to type "'+r+'"; valid output types are '+Object.keys(a).join(", "));return r===t?e:a[r](e)}})),nc="divideScalar",ic=ur(nc,["typed","numeric"],(e=>{var{typed:r,numeric:t}=e;return r(nc,{"number, number":function(e,r){return e/r},"Complex, Complex":function(e,r){return e.div(r)},"BigNumber, BigNumber":function(e,r){return e.div(r)},"Fraction, Fraction":function(e,r){return e.div(r)},"Unit, number | Complex | Fraction | BigNumber | Unit":(e,r)=>e.divide(r),"number | Fraction | Complex | BigNumber, Unit":(e,r)=>r.divideInto(e)})})),ac=ur("pow",["typed","config","identity","multiply","matrix","inv","fraction","number","Complex"],(e=>{var{typed:r,config:t,identity:n,multiply:i,matrix:a,inv:o,number:s,fraction:u,Complex:c}=e;return r("pow",{"number, number":l,"Complex, Complex":function(e,r){return e.pow(r)},"BigNumber, BigNumber":function(e,r){return r.isInteger()||e>=0||t.predictable?e.pow(r):new c(e.toNumber(),0).pow(r.toNumber(),0)},"Fraction, Fraction":function(e,r){var n=e.pow(r);if(null!=n)return n;if(t.predictable)throw new Error("Result of pow is non-rational and cannot be expressed as a fraction");return l(e.valueOf(),r.valueOf())},"Array, number":f,"Array, BigNumber":function(e,r){return f(e,r.toNumber())},"Matrix, number":p,"Matrix, BigNumber":function(e,r){return p(e,r.toNumber())},"Unit, number | BigNumber":function(e,r){return e.pow(r)}});function l(e,r){if(t.predictable&&!se(r)&&e<0)try{var n=u(r),i=s(n);if((r===i||Math.abs((r-i)/r)<1e-14)&&n.d%2==1)return(n.n%2==0?1:-1)*Math.pow(-e,r)}catch(e){}return t.predictable&&(e<-1&&r===1/0||e>-1&&e<0&&r===-1/0)?NaN:se(r)||e>=0||t.predictable?ri(e,r):e*e<1&&r===1/0||e*e>1&&r===-1/0?0:new c(e,0).pow(r,0)}function f(e,r){if(!se(r))throw new TypeError("For A^b, b must be an integer (value is "+r+")");var t=Ue(e);if(2!==t.length)throw new Error("For A^b, A must be 2 dimensional (A has "+t.length+" dimensions)");if(t[0]!==t[1])throw new Error("For A^b, A must be square (size is "+t[0]+"x"+t[1]+")");if(r<0)try{return f(o(e),-r)}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 "+r+")");throw e}for(var a=n(t[0]).valueOf(),s=e;r>=1;)1==(1&r)&&(a=i(s,a)),r>>=1,s=i(s,s);return a}function p(e,r){return a(f(e.valueOf(),r))}})),oc="Number of decimals in function round must be an integer",sc="round",uc=ur(sc,["typed","matrix","equalScalar","zeros","BigNumber","DenseMatrix"],(e=>{var{typed:r,matrix:t,equalScalar:n,zeros:i,BigNumber:a,DenseMatrix:o}=e,s=$a({typed:r,equalScalar:n}),u=Za({typed:r,DenseMatrix:o}),c=Ga({typed:r});return r(sc,{number:ti,"number, number":ti,"number, BigNumber":function(e,r){if(!r.isInteger())throw new TypeError(oc);return new a(e).toDecimalPlaces(r.toNumber())},Complex:function(e){return e.round()},"Complex, number":function(e,r){if(r%1)throw new TypeError(oc);return e.round(r)},"Complex, BigNumber":function(e,r){if(!r.isInteger())throw new TypeError(oc);var t=r.toNumber();return e.round(t)},BigNumber:function(e){return e.toDecimalPlaces(0)},"BigNumber, BigNumber":function(e,r){if(!r.isInteger())throw new TypeError(oc);return e.toDecimalPlaces(r.toNumber())},Fraction:function(e){return e.round()},"Fraction, number":function(e,r){if(r%1)throw new TypeError(oc);return e.round(r)},"Fraction, BigNumber":function(e,r){if(!r.isInteger())throw new TypeError(oc);return e.round(r.toNumber())},"Array | Matrix":r.referToSelf((e=>r=>Fn(r,e,!0))),"SparseMatrix, number | BigNumber":r.referToSelf((e=>(r,t)=>s(r,t,e,!1))),"DenseMatrix, number | BigNumber":r.referToSelf((e=>(r,t)=>c(r,t,e,!1))),"Array, number | BigNumber":r.referToSelf((e=>(r,n)=>c(t(r),n,e,!1).valueOf())),"number | Complex | BigNumber | Fraction, SparseMatrix":r.referToSelf((e=>(r,t)=>n(r,0)?i(t.size(),t.storage()):u(t,r,e,!0))),"number | Complex | BigNumber | Fraction, DenseMatrix":r.referToSelf((e=>(r,t)=>n(r,0)?i(t.size(),t.storage()):c(t,r,e,!0))),"number | Complex | BigNumber | Fraction, Array":r.referToSelf((e=>(r,n)=>c(t(n),r,e,!0).valueOf()))})})),cc=ur("log",["config","typed","divideScalar","Complex"],(e=>{var{typed:r,config:t,divideScalar:n,Complex:i}=e;return r("log",{number:function(e){return e>=0||t.predictable?function(e,r){return r?Math.log(e)/Math.log(r):Math.log(e)}(e):new i(e,0).log()},Complex:function(e){return e.log()},BigNumber:function(e){return!e.isNegative()||t.predictable?e.ln():new i(e.toNumber(),0).log()},"any, any":r.referToSelf((e=>(r,t)=>n(e(r),e(t))))})})),lc="log1p",fc=ur(lc,["typed","config","divideScalar","log","Complex"],(e=>{var{typed:r,config:t,divideScalar:n,log:i,Complex:a}=e;return r(lc,{number:function(e){return e>=-1||t.predictable?fe(e):o(new a(e,0))},Complex:o,BigNumber:function(e){var r=e.plus(1);return!r.isNegative()||t.predictable?r.ln():o(new a(e.toNumber(),0))},"Array | Matrix":r.referToSelf((e=>r=>Fn(r,e))),"any, any":r.referToSelf((e=>(r,t)=>n(e(r),i(t))))});function o(e){var r=e.re+1;return new a(Math.log(Math.sqrt(r*r+e.im*e.im)),Math.atan2(e.im,r))}})),pc="nthRoots",mc=ur(pc,["config","typed","divideScalar","Complex"],(e=>{var{typed:r,config:t,divideScalar:n,Complex:i}=e,a=[function(e){return new i(e,0)},function(e){return new i(0,e)},function(e){return new i(-e,0)},function(e){return new i(0,-e)}];function o(e,r){if(r<0)throw new Error("Root must be greater than zero");if(0===r)throw new Error("Root must be non-zero");if(r%1!=0)throw new Error("Root must be an integer");if(0===e||0===e.abs())return[new i(0,0)];var t,n="number"==typeof e;(n||0===e.re||0===e.im)&&(t=n?2*+(e<0):0===e.im?2*+(e.re<0):2*+(e.im<0)+1);for(var o=e.arg(),s=e.abs(),u=[],c=Math.pow(s,1/r),l=0;l<r;l++){var f=(t+4*l)/r;f!==Math.round(f)?u.push(new i({r:c,phi:(o+2*Math.PI*l)/r})):u.push(a[f%4](c))}return u}return r(pc,{Complex:function(e){return o(e,2)},"Complex, number":o})})),dc="dotPow",hc=ur(dc,["typed","equalScalar","matrix","pow","DenseMatrix","concat"],(e=>{var{typed:r,equalScalar:t,matrix:n,pow:i,DenseMatrix:a,concat:o}=e,s=Bo({typed:r}),u=ps({typed:r,DenseMatrix:a}),c=$a({typed:r,equalScalar:t}),l=Za({typed:r,DenseMatrix:a}),f=go({typed:r,matrix:n,concat:o}),p={};for(var m in i.signatures)Object.prototype.hasOwnProperty.call(i.signatures,m)&&(m.includes("Matrix")||m.includes("Array")||(p[m]=i.signatures[m]));var d=r(p);return r(dc,f({elop:d,SS:u,DS:s,Ss:c,sS:l}))})),gc="dotDivide",yc=ur(gc,["typed","matrix","equalScalar","divideScalar","DenseMatrix","concat"],(e=>{var{typed:r,matrix:t,equalScalar:n,divideScalar:i,DenseMatrix:a,concat:o}=e,s=Do({typed:r,equalScalar:n}),u=Bo({typed:r}),c=ps({typed:r,DenseMatrix:a}),l=$a({typed:r,equalScalar:n}),f=Za({typed:r,DenseMatrix:a}),p=go({typed:r,matrix:t,concat:o});return r(gc,p({elop:i,SS:c,DS:u,SD:s,Ss:l,sS:f}))}));function vc(e){var{DenseMatrix:r}=e;return function(e,t,n){var i=e.size();if(2!==i.length)throw new RangeError("Matrix must be two dimensional (size: "+_e(i)+")");var a=i[0];if(a!==i[1])throw new RangeError("Matrix must be square (size: "+_e(i)+")");var o=[];if(p(t)){var s=t.size(),u=t._data;if(1===s.length){if(s[0]!==a)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var c=0;c<a;c++)o[c]=[u[c]];return new r({data:o,size:[a,1],datatype:t._datatype})}if(2===s.length){if(s[0]!==a||1!==s[1])throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");if(d(t)){if(n){o=[];for(var l=0;l<a;l++)o[l]=[u[l][0]];return new r({data:o,size:[a,1],datatype:t._datatype})}return t}if(h(t)){for(var m=0;m<a;m++)o[m]=[0];for(var g=t._values,y=t._index,v=t._ptr,x=v[1],b=v[0];b<x;b++){o[y[b]][0]=g[b]}return new r({data:o,size:[a,1],datatype:t._datatype})}}throw new RangeError("Dimension mismatch. The right side has to be either 1- or 2-dimensional vector.")}if(f(t)){var w=Ue(t);if(1===w.length){if(w[0]!==a)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var N=0;N<a;N++)o[N]=[t[N]];return new r({data:o,size:[a,1]})}if(2===w.length){if(w[0]!==a||1!==w[1])throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var D=0;D<a;D++)o[D]=[t[D][0]];return new r({data:o,size:[a,1]})}throw new RangeError("Dimension mismatch. The right side has to be either 1- or 2-dimensional vector.")}}}var xc="lsolve",bc=ur(xc,["typed","matrix","divideScalar","multiplyScalar","subtract","equalScalar","DenseMatrix"],(e=>{var{typed:r,matrix:t,divideScalar:n,multiplyScalar:i,subtract:a,equalScalar:o,DenseMatrix:s}=e,u=vc({DenseMatrix:s});return r(xc,{"SparseMatrix, Array | Matrix":function(e,r){return function(e,r){for(var t=(r=u(e,r,!0))._data,c=e._size[0],l=e._size[1],f=e._values,p=e._index,m=e._ptr,d=[],h=0;h<l;h++){var g=t[h][0]||0;if(o(g,0))d[h]=[0];else{for(var y=0,v=[],x=[],b=m[h],w=m[h+1],N=b;N<w;N++){var D=p[N];D===h?y=f[N]:D>h&&(v.push(f[N]),x.push(D))}if(o(y,0))throw new Error("Linear system cannot be solved since matrix is singular");for(var E=n(g,y),A=0,C=x.length;A<C;A++){var S=x[A];t[S]=[a(t[S][0]||0,i(E,v[A]))]}d[h]=[E]}}return new s({data:d,size:[c,1]})}(e,r)},"DenseMatrix, Array | Matrix":function(e,r){return c(e,r)},"Array, Array | Matrix":function(e,r){return c(t(e),r).valueOf()}});function c(e,r){for(var t=(r=u(e,r,!0))._data,c=e._size[0],l=e._size[1],f=[],p=e._data,m=0;m<l;m++){var d=t[m][0]||0,h=void 0;if(o(d,0))h=0;else{var g=p[m][m];if(o(g,0))throw new Error("Linear system cannot be solved since matrix is singular");h=n(d,g);for(var y=m+1;y<c;y++)t[y]=[a(t[y][0]||0,i(h,p[y][m]))]}f[m]=[h]}return new s({data:f,size:[c,1]})}})),wc="usolve",Nc=ur(wc,["typed","matrix","divideScalar","multiplyScalar","subtract","equalScalar","DenseMatrix"],(e=>{var{typed:r,matrix:t,divideScalar:n,multiplyScalar:i,subtract:a,equalScalar:o,DenseMatrix:s}=e,u=vc({DenseMatrix:s});return r(wc,{"SparseMatrix, Array | Matrix":function(e,r){return function(e,r){for(var t=(r=u(e,r,!0))._data,c=e._size[0],l=e._size[1],f=e._values,p=e._index,m=e._ptr,d=[],h=l-1;h>=0;h--){var g=t[h][0]||0;if(o(g,0))d[h]=[0];else{for(var y=0,v=[],x=[],b=m[h],w=m[h+1]-1;w>=b;w--){var N=p[w];N===h?y=f[w]:N<h&&(v.push(f[w]),x.push(N))}if(o(y,0))throw new Error("Linear system cannot be solved since matrix is singular");for(var D=n(g,y),E=0,A=x.length;E<A;E++){var C=x[E];t[C]=[a(t[C][0],i(D,v[E]))]}d[h]=[D]}}return new s({data:d,size:[c,1]})}(e,r)},"DenseMatrix, Array | Matrix":function(e,r){return c(e,r)},"Array, Array | Matrix":function(e,r){return c(t(e),r).valueOf()}});function c(e,r){for(var t=(r=u(e,r,!0))._data,c=e._size[0],l=e._size[1],f=[],p=e._data,m=l-1;m>=0;m--){var d=t[m][0]||0,h=void 0;if(o(d,0))h=0;else{var g=p[m][m];if(o(g,0))throw new Error("Linear system cannot be solved since matrix is singular");h=n(d,g);for(var y=m-1;y>=0;y--)t[y]=[a(t[y][0]||0,i(h,p[y][m]))]}f[m]=[h]}return new s({data:f,size:[c,1]})}})),Dc="lsolveAll",Ec=ur(Dc,["typed","matrix","divideScalar","multiplyScalar","subtract","equalScalar","DenseMatrix"],(e=>{var{typed:r,matrix:t,divideScalar:n,multiplyScalar:i,subtract:a,equalScalar:o,DenseMatrix:s}=e,u=vc({DenseMatrix:s});return r(Dc,{"SparseMatrix, Array | Matrix":function(e,r){return function(e,r){for(var t=[u(e,r,!0)._data.map((e=>e[0]))],c=e._size[0],l=e._size[1],f=e._values,p=e._index,m=e._ptr,d=0;d<l;d++)for(var h=t.length,g=0;g<h;g++){for(var y=t[g],v=[],x=[],b=m[d],w=m[d+1],N=0,D=b;D<w;D++){var E=p[D];E===d?N=f[D]:E>d&&(v.push(f[D]),x.push(E))}if(o(N,0))if(o(y[d],0)){if(0===g){var A=[...y];A[d]=1;for(var C=0,S=x.length;C<S;C++){var M=x[C];A[M]=a(A[M],v[C])}t.push(A)}}else{if(0===g)return[];t.splice(g,1),g-=1,h-=1}else{y[d]=n(y[d],N);for(var F=0,B=x.length;F<B;F++){var T=x[F];y[T]=a(y[T],i(y[d],v[F]))}}}return t.map((e=>new s({data:e.map((e=>[e])),size:[c,1]})))}(e,r)},"DenseMatrix, Array | Matrix":function(e,r){return c(e,r)},"Array, Array | Matrix":function(e,r){return c(t(e),r).map((e=>e.valueOf()))}});function c(e,r){for(var t=[u(e,r,!0)._data.map((e=>e[0]))],c=e._data,l=e._size[0],f=e._size[1],p=0;p<f;p++)for(var m=t.length,d=0;d<m;d++){var h=t[d];if(o(c[p][p],0))if(o(h[p],0)){if(0===d){var g=[...h];g[p]=1;for(var y=p+1;y<f;y++)g[y]=a(g[y],c[y][p]);t.push(g)}}else{if(0===d)return[];t.splice(d,1),d-=1,m-=1}else{h[p]=n(h[p],c[p][p]);for(var v=p+1;v<f;v++)h[v]=a(h[v],i(h[p],c[v][p]))}}return t.map((e=>new s({data:e.map((e=>[e])),size:[l,1]})))}})),Ac="usolveAll",Cc=ur(Ac,["typed","matrix","divideScalar","multiplyScalar","subtract","equalScalar","DenseMatrix"],(e=>{var{typed:r,matrix:t,divideScalar:n,multiplyScalar:i,subtract:a,equalScalar:o,DenseMatrix:s}=e,u=vc({DenseMatrix:s});return r(Ac,{"SparseMatrix, Array | Matrix":function(e,r){return function(e,r){for(var t=[u(e,r,!0)._data.map((e=>e[0]))],c=e._size[0],l=e._size[1],f=e._values,p=e._index,m=e._ptr,d=l-1;d>=0;d--)for(var h=t.length,g=0;g<h;g++){for(var y=t[g],v=[],x=[],b=m[d],w=0,N=m[d+1]-1;N>=b;N--){var D=p[N];D===d?w=f[N]:D<d&&(v.push(f[N]),x.push(D))}if(o(w,0))if(o(y[d],0)){if(0===g){var E=[...y];E[d]=1;for(var A=0,C=x.length;A<C;A++){var S=x[A];E[S]=a(E[S],v[A])}t.push(E)}}else{if(0===g)return[];t.splice(g,1),g-=1,h-=1}else{y[d]=n(y[d],w);for(var M=0,F=x.length;M<F;M++){var B=x[M];y[B]=a(y[B],i(y[d],v[M]))}}}return t.map((e=>new s({data:e.map((e=>[e])),size:[c,1]})))}(e,r)},"DenseMatrix, Array | Matrix":function(e,r){return c(e,r)},"Array, Array | Matrix":function(e,r){return c(t(e),r).map((e=>e.valueOf()))}});function c(e,r){for(var t=[u(e,r,!0)._data.map((e=>e[0]))],c=e._data,l=e._size[0],f=e._size[1]-1;f>=0;f--)for(var p=t.length,m=0;m<p;m++){var d=t[m];if(o(c[f][f],0))if(o(d[f],0)){if(0===m){var h=[...d];h[f]=1;for(var g=f-1;g>=0;g--)h[g]=a(h[g],c[g][f]);t.push(h)}}else{if(0===m)return[];t.splice(m,1),m-=1,p-=1}else{d[f]=n(d[f],c[f][f]);for(var y=f-1;y>=0;y--)d[y]=a(d[y],i(d[f],c[y][f]))}}return t.map((e=>new s({data:e.map((e=>[e])),size:[l,1]})))}})),Sc=ur("matAlgo08xS0Sid",["typed","equalScalar"],(e=>{var{typed:r,equalScalar:t}=e;return function(e,n,i){var a=e._values,o=e._index,s=e._ptr,u=e._size,c=e._datatype,l=n._values,f=n._index,p=n._ptr,m=n._size,d=n._datatype;if(u.length!==m.length)throw new Re(u.length,m.length);if(u[0]!==m[0]||u[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+m+")");if(!a||!l)throw new Error("Cannot perform operation on Pattern Sparse Matrices");var h,g=u[0],y=u[1],v=t,x=0,b=i;"string"==typeof c&&c===d&&(h=c,v=r.find(t,[h,h]),x=r.convert(0,h),b=r.find(i,[h,h]));for(var w,N,D,E,A=[],C=[],S=[],M=[],F=[],B=0;B<y;B++){S[B]=C.length;var T=B+1;for(N=s[B],D=s[B+1],w=N;w<D;w++)F[E=o[w]]=T,M[E]=a[w],C.push(E);for(N=p[B],D=p[B+1],w=N;w<D;w++)F[E=f[w]]===T&&(M[E]=b(M[E],l[w]));for(w=S[B];w<C.length;){var O=M[E=C[w]];v(O,x)?C.splice(w,1):(A.push(O),w++)}}return S[y]=C.length,e.createSparseMatrix({values:A,index:C,ptr:S,size:[g,y],datatype:h})}})),Mc=ur("useMatrixForArrayScalar",["typed","matrix"],(e=>{var{typed:r,matrix:t}=e;return{"Array, number":r.referTo("DenseMatrix, number",(e=>(r,n)=>e(t(r),n).valueOf())),"Array, BigNumber":r.referTo("DenseMatrix, BigNumber",(e=>(r,n)=>e(t(r),n).valueOf())),"number, Array":r.referTo("number, DenseMatrix",(e=>(r,n)=>e(r,t(n)).valueOf())),"BigNumber, Array":r.referTo("BigNumber, DenseMatrix",(e=>(r,n)=>e(r,t(n)).valueOf()))}})),Fc="leftShift",Bc=ur(Fc,["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],(e=>{var{typed:r,matrix:t,equalScalar:n,zeros:i,DenseMatrix:a,concat:o}=e,s=lo({typed:r}),u=Do({typed:r,equalScalar:n}),c=Sc({typed:r,equalScalar:n}),l=po({typed:r,DenseMatrix:a}),f=$a({typed:r,equalScalar:n}),p=Ga({typed:r}),m=go({typed:r,matrix:t,concat:o}),d=Mc({typed:r,matrix:t});return r(Fc,{"number, number":ui,"BigNumber, BigNumber":is,"SparseMatrix, number | BigNumber":r.referToSelf((e=>(r,t)=>n(t,0)?r.clone():f(r,t,e,!1))),"DenseMatrix, number | BigNumber":r.referToSelf((e=>(r,t)=>n(t,0)?r.clone():p(r,t,e,!1))),"number | BigNumber, SparseMatrix":r.referToSelf((e=>(r,t)=>n(r,0)?i(t.size(),t.storage()):l(t,r,e,!0))),"number | BigNumber, DenseMatrix":r.referToSelf((e=>(r,t)=>n(r,0)?i(t.size(),t.storage()):p(t,r,e,!0)))},d,m({SS:c,DS:s,SD:u}))})),Tc="rightArithShift",Oc=ur(Tc,["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],(e=>{var{typed:r,matrix:t,equalScalar:n,zeros:i,DenseMatrix:a,concat:o}=e,s=lo({typed:r}),u=Do({typed:r,equalScalar:n}),c=Sc({typed:r,equalScalar:n}),l=po({typed:r,DenseMatrix:a}),f=$a({typed:r,equalScalar:n}),p=Ga({typed:r}),m=go({typed:r,matrix:t,concat:o}),d=Mc({typed:r,matrix:t});return r(Tc,{"number, number":ci,"BigNumber, BigNumber":as,"SparseMatrix, number | BigNumber":r.referToSelf((e=>(r,t)=>n(t,0)?r.clone():f(r,t,e,!1))),"DenseMatrix, number | BigNumber":r.referToSelf((e=>(r,t)=>n(t,0)?r.clone():p(r,t,e,!1))),"number | BigNumber, SparseMatrix":r.referToSelf((e=>(r,t)=>n(r,0)?i(t.size(),t.storage()):l(t,r,e,!0))),"number | BigNumber, DenseMatrix":r.referToSelf((e=>(r,t)=>n(r,0)?i(t.size(),t.storage()):p(t,r,e,!0)))},d,m({SS:c,DS:s,SD:u}))})),_c="rightLogShift",zc=ur(_c,["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],(e=>{var{typed:r,matrix:t,equalScalar:n,zeros:i,DenseMatrix:a,concat:o}=e,s=lo({typed:r}),u=Do({typed:r,equalScalar:n}),c=Sc({typed:r,equalScalar:n}),l=po({typed:r,DenseMatrix:a}),f=$a({typed:r,equalScalar:n}),p=Ga({typed:r}),m=go({typed:r,matrix:t,concat:o}),d=Mc({typed:r,matrix:t});return r(_c,{"number, number":li,"SparseMatrix, number | BigNumber":r.referToSelf((e=>(r,t)=>n(t,0)?r.clone():f(r,t,e,!1))),"DenseMatrix, number | BigNumber":r.referToSelf((e=>(r,t)=>n(t,0)?r.clone():p(r,t,e,!1))),"number | BigNumber, SparseMatrix":r.referToSelf((e=>(r,t)=>n(r,0)?i(t.size(),t.storage()):l(t,r,e,!0))),"number | BigNumber, DenseMatrix":r.referToSelf((e=>(r,t)=>n(r,0)?i(t.size(),t.storage()):p(t,r,e,!0)))},d,m({SS:c,DS:s,SD:u}))})),qc=ur("and",["typed","matrix","equalScalar","zeros","not","concat"],(e=>{var{typed:r,matrix:t,equalScalar:n,zeros:i,not:a,concat:o}=e,s=Do({typed:r,equalScalar:n}),u=Eo({typed:r,equalScalar:n}),c=$a({typed:r,equalScalar:n}),l=Ga({typed:r}),f=go({typed:r,matrix:t,concat:o});return r("and",{"number, number":bi,"Complex, Complex":function(e,r){return!(0===e.re&&0===e.im||0===r.re&&0===r.im)},"BigNumber, BigNumber":function(e,r){return!(e.isZero()||r.isZero()||e.isNaN()||r.isNaN())},"Unit, Unit":r.referToSelf((e=>(r,t)=>e(r.value||0,t.value||0))),"SparseMatrix, any":r.referToSelf((e=>(r,t)=>a(t)?i(r.size(),r.storage()):c(r,t,e,!1))),"DenseMatrix, any":r.referToSelf((e=>(r,t)=>a(t)?i(r.size(),r.storage()):l(r,t,e,!1))),"any, SparseMatrix":r.referToSelf((e=>(r,t)=>a(r)?i(r.size(),r.storage()):c(t,r,e,!0))),"any, DenseMatrix":r.referToSelf((e=>(r,t)=>a(r)?i(r.size(),r.storage()):l(t,r,e,!0))),"Array, any":r.referToSelf((e=>(r,n)=>e(t(r),n).valueOf())),"any, Array":r.referToSelf((e=>(r,n)=>e(r,t(n)).valueOf()))},f({SS:u,DS:s}))})),Ic="compare",kc=ur(Ic,["typed","config","matrix","equalScalar","BigNumber","Fraction","DenseMatrix","concat"],(e=>{var{typed:r,config:t,equalScalar:n,matrix:i,BigNumber:a,Fraction:o,DenseMatrix:s,concat:u}=e,c=Bo({typed:r}),l=To({typed:r,equalScalar:n}),f=Za({typed:r,DenseMatrix:s}),p=go({typed:r,matrix:i,concat:u}),m=la({typed:r});return r(Ic,Rc({typed:r,config:t}),{"boolean, boolean":function(e,r){return e===r?0:e>r?1:-1},"BigNumber, BigNumber":function(e,r){return ca(e,r,t.epsilon)?new a(0):new a(e.cmp(r))},"Fraction, Fraction":function(e,r){return new o(e.compare(r))},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},m,p({SS:l,DS:c,Ss:f}))})),Rc=ur(Ic,["typed","config"],(e=>{var{typed:r,config:t}=e;return r(Ic,{"number, number":function(e,r){return Ne(e,r,t.epsilon)?0:e>r?1:-1}})})),Pc=t(74681),Uc="compareNatural",jc=ur(Uc,["typed","compare"],(e=>{var{typed:r,compare:t}=e,n=t.signatures["boolean,boolean"];return r(Uc,{"any, any":function e(r,o){var s,u=Z(r),c=Z(o);if(!("number"!==u&&"BigNumber"!==u&&"Fraction"!==u||"number"!==c&&"BigNumber"!==c&&"Fraction"!==c))return"0"!==(s=t(r,o)).toString()?s>0?1:-1:Pc(u,c);var l=["Array","DenseMatrix","SparseMatrix"];if(l.includes(u)||l.includes(c))return 0!==(s=i(e,r,o))?s:Pc(u,c);if(u!==c)return Pc(u,c);if("Complex"===u)return function(e,r){if(e.re>r.re)return 1;if(e.re<r.re)return-1;if(e.im>r.im)return 1;if(e.im<r.im)return-1;return 0}(r,o);if("Unit"===u)return r.equalBase(o)?e(r.value,o.value):a(e,r.formatUnits(),o.formatUnits());if("boolean"===u)return n(r,o);if("string"===u)return Pc(r,o);if("Object"===u)return function(e,r,t){var n=Object.keys(r),i=Object.keys(t);n.sort(Pc),i.sort(Pc);var o=a(e,n,i);if(0!==o)return o;for(var s=0;s<n.length;s++){var u=e(r[n[s]],t[i[s]]);if(0!==u)return u}return 0}(e,r,o);if("null"===u)return 0;if("undefined"===u)return 0;throw new TypeError('Unsupported type of value "'+u+'"')}});function i(e,r,t){return h(r)&&h(t)?a(e,r.toJSON().values,t.toJSON().values):h(r)?i(e,r.toArray(),t):h(t)?i(e,r,t.toArray()):d(r)?i(e,r.toJSON().data,t):d(t)?i(e,r,t.toJSON().data):Array.isArray(r)?Array.isArray(t)?a(e,r,t):i(e,r,[t]):i(e,[r],t)}function a(e,r,t){for(var n=0,i=Math.min(r.length,t.length);n<i;n++){var a=e(r[n],t[n]);if(0!==a)return a}return r.length>t.length?1:r.length<t.length?-1:0}}));var Lc="compareText",Hc=["typed","matrix","concat"];ke.signature="any, any";var $c=ur(Lc,Hc,(e=>{var{typed:r,matrix:t,concat:n}=e,i=go({typed:r,matrix:t,concat:n});return r(Lc,ke,i({elop:ke,Ds:!0}))})),Zc="equal",Gc=ur(Zc,["typed","matrix","equalScalar","DenseMatrix","concat"],(e=>{var{typed:r,matrix:t,equalScalar:n,DenseMatrix:i,concat:a}=e,o=Bo({typed:r}),s=ps({typed:r,DenseMatrix:i}),u=Za({typed:r,DenseMatrix:i}),c=go({typed:r,matrix:t,concat:a});return r(Zc,Vc({typed:r,equalScalar:n}),c({elop:n,SS:s,DS:o,Ss:u}))})),Vc=ur(Zc,["typed","equalScalar"],(e=>{var{typed:r,equalScalar:t}=e;return r(Zc,{"any, any":function(e,r){return null===e?null===r:null===r?null===e:void 0===e?void 0===r:void 0===r?void 0===e:t(e,r)}})})),Wc="equalText",Yc=ur(Wc,["typed","compareText","isZero"],(e=>{var{typed:r,compareText:t,isZero:n}=e;return r(Wc,{"any, any":function(e,r){return n(t(e,r))}})})),Jc="smaller",Xc=ur(Jc,["typed","config","matrix","DenseMatrix","concat"],(e=>{var{typed:r,config:t,matrix:n,DenseMatrix:i,concat:a}=e,o=Bo({typed:r}),s=ps({typed:r,DenseMatrix:i}),u=Za({typed:r,DenseMatrix:i}),c=go({typed:r,matrix:n,concat:a}),l=la({typed:r});return r(Jc,Qc({typed:r,config:t}),{"boolean, boolean":(e,r)=>e<r,"BigNumber, BigNumber":function(e,r){return e.lt(r)&&!ca(e,r,t.epsilon)},"Fraction, Fraction":(e,r)=>-1===e.compare(r),"Complex, Complex":function(e,r){throw new TypeError("No ordering relation is defined for complex numbers")}},l,c({SS:s,DS:o,Ss:u}))})),Qc=ur(Jc,["typed","config"],(e=>{var{typed:r,config:t}=e;return r(Jc,{"number, number":function(e,r){return e<r&&!Ne(e,r,t.epsilon)}})})),Kc="smallerEq",el=ur(Kc,["typed","config","matrix","DenseMatrix","concat"],(e=>{var{typed:r,config:t,matrix:n,DenseMatrix:i,concat:a}=e,o=Bo({typed:r}),s=ps({typed:r,DenseMatrix:i}),u=Za({typed:r,DenseMatrix:i}),c=go({typed:r,matrix:n,concat:a}),l=la({typed:r});return r(Kc,rl({typed:r,config:t}),{"boolean, boolean":(e,r)=>e<=r,"BigNumber, BigNumber":function(e,r){return e.lte(r)||ca(e,r,t.epsilon)},"Fraction, Fraction":(e,r)=>1!==e.compare(r),"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},l,c({SS:s,DS:o,Ss:u}))})),rl=ur(Kc,["typed","config"],(e=>{var{typed:r,config:t}=e;return r(Kc,{"number, number":function(e,r){return e<=r||Ne(e,r,t.epsilon)}})})),tl="larger",nl=ur(tl,["typed","config","matrix","DenseMatrix","concat"],(e=>{var{typed:r,config:t,matrix:n,DenseMatrix:i,concat:a}=e,o=Bo({typed:r}),s=ps({typed:r,DenseMatrix:i}),u=Za({typed:r,DenseMatrix:i}),c=go({typed:r,matrix:n,concat:a}),l=la({typed:r});return r(tl,il({typed:r,config:t}),{"boolean, boolean":(e,r)=>e>r,"BigNumber, BigNumber":function(e,r){return e.gt(r)&&!ca(e,r,t.epsilon)},"Fraction, Fraction":(e,r)=>1===e.compare(r),"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},l,c({SS:s,DS:o,Ss:u}))})),il=ur(tl,["typed","config"],(e=>{var{typed:r,config:t}=e;return r(tl,{"number, number":function(e,r){return e>r&&!Ne(e,r,t.epsilon)}})})),al="largerEq",ol=ur(al,["typed","config","matrix","DenseMatrix","concat"],(e=>{var{typed:r,config:t,matrix:n,DenseMatrix:i,concat:a}=e,o=Bo({typed:r}),s=ps({typed:r,DenseMatrix:i}),u=Za({typed:r,DenseMatrix:i}),c=go({typed:r,matrix:n,concat:a}),l=la({typed:r});return r(al,sl({typed:r,config:t}),{"boolean, boolean":(e,r)=>e>=r,"BigNumber, BigNumber":function(e,r){return e.gte(r)||ca(e,r,t.epsilon)},"Fraction, Fraction":(e,r)=>-1!==e.compare(r),"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},l,c({SS:s,DS:o,Ss:u}))})),sl=ur(al,["typed","config"],(e=>{var{typed:r,config:t}=e;return r(al,{"number, number":function(e,r){return e>=r||Ne(e,r,t.epsilon)}})})),ul="deepEqual",cl=ur(ul,["typed","equal"],(e=>{var{typed:r,equal:t}=e;return r(ul,{"any, any":function(e,r){return n(e.valueOf(),r.valueOf())}});function n(e,r){if(Array.isArray(e)){if(Array.isArray(r)){var i=e.length;if(i!==r.length)return!1;for(var a=0;a<i;a++)if(!n(e[a],r[a]))return!1;return!0}return!1}return!Array.isArray(r)&&t(e,r)}})),ll="unequal",fl=ur(ll,["typed","config","equalScalar","matrix","DenseMatrix","concat"],(e=>{var{typed:r,config:t,equalScalar:n,matrix:i,DenseMatrix:a,concat:o}=e,s=Bo({typed:r}),u=ps({typed:r,DenseMatrix:a}),c=Za({typed:r,DenseMatrix:a}),l=go({typed:r,matrix:i,concat:o});return r(ll,pl({typed:r,equalScalar:n}),l({elop:function(e,r){return!n(e,r)},SS:u,DS:s,Ss:c}))})),pl=ur(ll,["typed","equalScalar"],(e=>{var{typed:r,equalScalar:t}=e;return r(ll,{"any, any":function(e,r){return null===e?null!==r:null===r?null!==e:void 0===e?void 0!==r:void 0===r?void 0!==e:!t(e,r)}})})),ml="partitionSelect",dl=ur(ml,["typed","isNumeric","isNaN","compare"],(e=>{var{typed:r,isNumeric:t,isNaN:n,compare:i}=e,a=i,o=(e,r)=>-i(e,r);return r(ml,{"Array | Matrix, number":function(e,r){return s(e,r,a)},"Array | Matrix, number, string":function(e,r,t){if("asc"===t)return s(e,r,a);if("desc"===t)return s(e,r,o);throw new Error('Compare string must be "asc" or "desc"')},"Array | Matrix, number, function":s});function s(e,r,t){if(!se(r)||r<0)throw new Error("k must be a non-negative integer");if(p(e)){if(e.size().length>1)throw new Error("Only one dimensional matrices supported");return u(e.valueOf(),r,t)}if(Array.isArray(e))return u(e,r,t)}function u(e,r,i){if(r>=e.length)throw new Error("k out of bounds");for(var a=0;a<e.length;a++)if(t(e[a])&&n(e[a]))return e[a];for(var o=0,s=e.length-1;o<s;){for(var u=o,c=s,l=e[Math.floor(Math.random()*(s-o+1))+o];u<c;)if(i(e[u],l)>=0){var f=e[c];e[c]=e[u],e[u]=f,--c}else++u;i(e[u],l)>0&&--u,r<=u?s=u:o=u+1}return e[r]}})),hl="sort",gl=ur(hl,["typed","matrix","compare","compareNatural"],(e=>{var{typed:r,matrix:t,compare:n,compareNatural:i}=e,a=n,o=(e,r)=>-n(e,r);return r(hl,{Array:function(e){return u(e),e.sort(a)},Matrix:function(e){return c(e),t(e.toArray().sort(a),e.storage())},"Array, function":function(e,r){return u(e),e.sort(r)},"Matrix, function":function(e,r){return c(e),t(e.toArray().sort(r),e.storage())},"Array, string":function(e,r){return u(e),e.sort(s(r))},"Matrix, string":function(e,r){return c(e),t(e.toArray().sort(s(r)),e.storage())}});function s(e){if("asc"===e)return a;if("desc"===e)return o;if("natural"===e)return i;throw new Error('String "asc", "desc", or "natural" expected')}function u(e){if(1!==Ue(e).length)throw new Error("One dimensional array expected")}function c(e){if(1!==e.size().length)throw new Error("One dimensional matrix expected")}})),yl=ur("max",["typed","config","numeric","larger"],(e=>{var{typed:r,config:t,numeric:n,larger:i}=e;return r("max",{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(e,r){return Bn(e,r.valueOf(),a)},"...":function(e){if(Sn(e))throw new TypeError("Scalar values expected in function max");return o(e)}});function a(e,r){try{return i(e,r)?e:r}catch(e){throw Lu(e,"max",r)}}function o(e){var r;if(Mn(e,(function(e){try{isNaN(e)&&"number"==typeof e?r=NaN:(void 0===r||i(e,r))&&(r=e)}catch(r){throw Lu(r,"max",e)}})),void 0===r)throw new Error("Cannot calculate max of an empty array");return"string"==typeof r&&(r=n(r,t.number)),r}})),vl=ur("min",["typed","config","numeric","smaller"],(e=>{var{typed:r,config:t,numeric:n,smaller:i}=e;return r("min",{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(e,r){return Bn(e,r.valueOf(),a)},"...":function(e){if(Sn(e))throw new TypeError("Scalar values expected in function min");return o(e)}});function a(e,r){try{return i(e,r)?e:r}catch(e){throw Lu(e,"min",r)}}function o(e){var r;if(Mn(e,(function(e){try{isNaN(e)&&"number"==typeof e?r=NaN:(void 0===r||i(e,r))&&(r=e)}catch(r){throw Lu(r,"min",e)}})),void 0===r)throw new Error("Cannot calculate min of an empty array");return"string"==typeof r&&(r=n(r,t.number)),r}})),xl=ur("ImmutableDenseMatrix",["smaller","DenseMatrix"],(e=>{var{smaller:r,DenseMatrix:t}=e;function n(e,r){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");if(r&&!l(r))throw new Error("Invalid datatype: "+r);if(p(e)||f(e)){var i=new t(e,r);this._data=i._data,this._size=i._size,this._datatype=i._datatype,this._min=null,this._max=null}else if(e&&f(e.data)&&f(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 ("+Z(e)+")");this._data=[],this._size=[0],this._datatype=r,this._min=null,this._max=null}}return n.prototype=new t,n.prototype.type="ImmutableDenseMatrix",n.prototype.isImmutableDenseMatrix=!0,n.prototype.subset=function(e){switch(arguments.length){case 1:var r=t.prototype.subset.call(this,e);return p(r)?new n({data:r._data,size:r._size,datatype:r._datatype}):r;case 2:case 3:throw new Error("Cannot invoke set subset on an Immutable Matrix instance");default:throw new SyntaxError("Wrong number of arguments")}},n.prototype.set=function(){throw new Error("Cannot invoke set on an Immutable Matrix instance")},n.prototype.resize=function(){throw new Error("Cannot invoke resize on an Immutable Matrix instance")},n.prototype.reshape=function(){throw new Error("Cannot invoke reshape on an Immutable Matrix instance")},n.prototype.clone=function(){return new n({data:G(this._data),size:G(this._size),datatype:this._datatype})},n.prototype.toJSON=function(){return{mathjs:"ImmutableDenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},n.fromJSON=function(e){return new n(e)},n.prototype.swapRows=function(){throw new Error("Cannot invoke swapRows on an Immutable Matrix instance")},n.prototype.min=function(){if(null===this._min){var e=null;this.forEach((function(t){(null===e||r(t,e))&&(e=t)})),this._min=null!==e?e:void 0}return this._min},n.prototype.max=function(){if(null===this._max){var e=null;this.forEach((function(t){(null===e||r(e,t))&&(e=t)})),this._max=null!==e?e:void 0}return this._max},n}),{isClass:!0}),bl=ur("Index",["ImmutableDenseMatrix"],(e=>{var{ImmutableDenseMatrix:r}=e;function t(e){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");this._dimensions=[],this._isScalar=!0;for(var r=0,i=arguments.length;r<i;r++){var a=arguments[r];if(g(a))this._dimensions.push(a),this._isScalar=!1;else if(Array.isArray(a)||p(a)){var o=n(a.valueOf());this._dimensions.push(o);var s=o.size();1===s.length&&1===s[0]||(this._isScalar=!1)}else if("number"==typeof a)this._dimensions.push(n([a]));else{if("string"!=typeof a)throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range");this._dimensions.push(a)}}}function n(e){for(var t=0,n=e.length;t<n;t++)if("number"!=typeof e[t]||!se(e[t]))throw new TypeError("Index parameters must be positive integer numbers");return new r(e)}return t.prototype.type="Index",t.prototype.isIndex=!0,t.prototype.clone=function(){var e=new t;return e._dimensions=G(this._dimensions),e._isScalar=this._isScalar,e},t.create=function(e){var r=new t;return t.apply(r,e),r},t.prototype.size=function(){for(var e=[],r=0,t=this._dimensions.length;r<t;r++){var n=this._dimensions[r];e[r]="string"==typeof n?1:n.size()[0]}return e},t.prototype.max=function(){for(var e=[],r=0,t=this._dimensions.length;r<t;r++){var n=this._dimensions[r];e[r]="string"==typeof n?n:n.max()}return e},t.prototype.min=function(){for(var e=[],r=0,t=this._dimensions.length;r<t;r++){var n=this._dimensions[r];e[r]="string"==typeof n?n:n.min()}return e},t.prototype.forEach=function(e){for(var r=0,t=this._dimensions.length;r<t;r++)e(this._dimensions[r],r,this)},t.prototype.dimension=function(e){return this._dimensions[e]||null},t.prototype.isObjectProperty=function(){return 1===this._dimensions.length&&"string"==typeof this._dimensions[0]},t.prototype.getObjectProperty=function(){return this.isObjectProperty()?this._dimensions[0]:null},t.prototype.isScalar=function(){return this._isScalar},t.prototype.toArray=function(){for(var e=[],r=0,t=this._dimensions.length;r<t;r++){var n=this._dimensions[r];e.push("string"==typeof n?n:n.toArray())}return e},t.prototype.valueOf=t.prototype.toArray,t.prototype.toString=function(){for(var e=[],r=0,t=this._dimensions.length;r<t;r++){var n=this._dimensions[r];"string"==typeof n?e.push(JSON.stringify(n)):e.push(n.toString())}return"["+e.join(", ")+"]"},t.prototype.toJSON=function(){return{mathjs:"Index",dimensions:this._dimensions}},t.fromJSON=function(e){return t.create(e.dimensions)},t}),{isClass:!0}),wl=ur("FibonacciHeap",["smaller","larger"],(e=>{var{smaller:r,larger:t}=e,n=1/Math.log((1+Math.sqrt(5))/2);function i(){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");this._minimum=null,this._size=0}function a(e,r,t){r.left.right=r.right,r.right.left=r.left,t.degree--,t.child===r&&(t.child=r.right),0===t.degree&&(t.child=null),r.left=e,r.right=e.right,e.right=r,r.right.left=r,r.parent=null,r.mark=!1}function o(e,r){var t=r.parent;t&&(r.mark?(a(e,r,t),o(t)):r.mark=!0)}i.prototype.type="FibonacciHeap",i.prototype.isFibonacciHeap=!0,i.prototype.insert=function(e,t){var n={key:e,value:t,degree:0};if(this._minimum){var i=this._minimum;n.left=i,n.right=i.right,i.right=n,n.right.left=n,r(e,i.key)&&(this._minimum=n)}else n.left=n,n.right=n,this._minimum=n;return this._size++,n},i.prototype.size=function(){return this._size},i.prototype.clear=function(){this._minimum=null,this._size=0},i.prototype.isEmpty=function(){return 0===this._size},i.prototype.extractMinimum=function(){var e=this._minimum;if(null===e)return e;for(var i=this._minimum,a=e.degree,o=e.child;a>0;){var u=o.right;o.left.right=o.right,o.right.left=o.left,o.left=i,o.right=i.right,i.right=o,o.right.left=o,o.parent=null,o=u,a--}return e.left.right=e.right,e.right.left=e.left,i=e===e.right?null:function(e,i){var a,o=Math.floor(Math.log(i)*n)+1,u=new Array(o),c=0,l=e;if(l)for(c++,l=l.right;l!==e;)c++,l=l.right;for(;c>0;){for(var f=l.degree,p=l.right;a=u[f];){if(t(l.key,a.key)){var m=a;a=l,l=m}s(a,l),u[f]=null,f++}u[f]=l,l=p,c--}e=null;for(var d=0;d<o;d++)(a=u[d])&&(e?(a.left.right=a.right,a.right.left=a.left,a.left=e,a.right=e.right,e.right=a,a.right.left=a,r(a.key,e.key)&&(e=a)):e=a);return e}(i=e.right,this._size),this._size--,this._minimum=i,e},i.prototype.remove=function(e){this._minimum=function(e,t,n){t.key=n;var i=t.parent;i&&r(t.key,i.key)&&(a(e,t,i),o(e,i));r(t.key,e.key)&&(e=t);return e}(this._minimum,e,-1),this.extractMinimum()};var s=function(e,r){e.left.right=e.right,e.right.left=e.left,e.parent=r,r.child?(e.left=r.child,e.right=r.child.right,r.child.right=e,e.right.left=e):(r.child=e,e.right=e,e.left=e),r.degree++,e.mark=!1};return i}),{isClass:!0}),Nl=ur("Spa",["addScalar","equalScalar","FibonacciHeap"],(e=>{var{addScalar:r,equalScalar:t,FibonacciHeap:n}=e;function i(){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");this._values=[],this._heap=new n}return i.prototype.type="Spa",i.prototype.isSpa=!0,i.prototype.set=function(e,r){if(this._values[e])this._values[e].value=r;else{var t=this._heap.insert(e,r);this._values[e]=t}},i.prototype.get=function(e){var r=this._values[e];return r?r.value:0},i.prototype.accumulate=function(e,t){var n=this._values[e];n?n.value=r(n.value,t):(n=this._heap.insert(e,t),this._values[e]=n)},i.prototype.forEach=function(e,r,n){var i=this._heap,a=this._values,o=[],s=i.extractMinimum();for(s&&o.push(s);s&&s.key<=r;)s.key>=e&&(t(s.value,0)||n(s.key,s.value,this)),(s=i.extractMinimum())&&o.push(s);for(var u=0;u<o.length;u++){var c=o[u];a[(s=i.insert(c.key,c.value)).key]=s}},i.prototype.swap=function(e,r){var t=this._values[e],n=this._values[r];if(!t&&n)t=this._heap.insert(e,n.value),this._heap.remove(n),this._values[e]=t,this._values[r]=void 0;else if(t&&!n)n=this._heap.insert(r,t.value),this._heap.remove(t),this._values[r]=n,this._values[e]=void 0;else if(t&&n){var i=t.value;t.value=n.value,n.value=i}},i}),{isClass:!0}),Dl=wn((function(e){return new e(1).exp()}),{hasher:Sl}),El=wn((function(e){return new e(1).plus(new e(5).sqrt()).div(2)}),{hasher:Sl}),Al=wn((function(e){return e.acos(-1)}),{hasher:Sl}),Cl=wn((function(e){return Al(e).times(2)}),{hasher:Sl});function Sl(e){return e[0].precision}function Ml(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function Fl(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?Ml(Object(t),!0).forEach((function(r){(0,Tu.Z)(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Ml(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}var Bl=ur("Unit",["?on","config","addScalar","subtract","multiplyScalar","divideScalar","pow","abs","fix","round","equal","isNumeric","format","number","Complex","BigNumber","Fraction"],(e=>{var r,t,i,{on:a,config:o,addScalar:u,subtract:l,multiplyScalar:f,divideScalar:p,pow:m,abs:d,fix:h,round:g,equal:y,isNumeric:v,format:x,number:b,Complex:w,BigNumber:N,Fraction:D}=e,E=b;function A(e,r){if(!(this instanceof A))throw new Error("Constructor must be called with the new operator");if(null!=e&&!v(e)&&!s(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===r)this.units=[],this.dimensions=I.map((e=>0));else if("string"==typeof r){var t=A.parse(r);this.units=t.units,this.dimensions=t.dimensions}else{if(!c(r)||null!==r.value)throw new TypeError("Second parameter in Unit constructor must be a string or valueless Unit");this.fixPrefix=r.fixPrefix,this.skipAutomaticSimplification=r.skipAutomaticSimplification,this.dimensions=r.dimensions.slice(0),this.units=r.units.map((e=>(0,n.Z)({},e)))}this.value=this._normalize(e)}function C(){for(;" "===i||"\t"===i;)M()}function S(e){return e>="0"&&e<="9"}function M(){t++,i=r.charAt(t)}function F(e){t=e,i=r.charAt(t)}function B(){var e="",r=t;if("+"===i?M():"-"===i&&(e+=i,M()),!function(e){return e>="0"&&e<="9"||"."===e}(i))return F(r),null;if("."===i){if(e+=i,M(),!S(i))return F(r),null}else{for(;S(i);)e+=i,M();"."===i&&(e+=i,M())}for(;S(i);)e+=i,M();if("E"===i||"e"===i){var n="",a=t;if(n+=i,M(),"+"!==i&&"-"!==i||(n+=i,M()),!S(i))return F(a),e;for(e+=n;S(i);)e+=i,M()}return e}function T(){for(var e="";S(i)||A.isValidAlpha(i);)e+=i,M();var r=e.charAt(0);return A.isValidAlpha(r)?e:null}function O(e){return i===e?(M(),e):null}Object.defineProperty(A,"name",{value:"Unit"}),A.prototype.constructor=A,A.prototype.type="Unit",A.prototype.isUnit=!0,A.parse=function(e,n){if(n=n||{},t=-1,i="","string"!=typeof(r=e))throw new TypeError("Invalid argument in Unit.parse, string expected");var a=new A;a.units=[];var s=1,u=!1;M(),C();var c=B(),l=null;if(c){if("BigNumber"===o.number)l=new N(c);else if("Fraction"===o.number)try{l=new D(c)}catch(e){l=parseFloat(c)}else l=parseFloat(c);C(),O("*")?(s=1,u=!0):O("/")&&(s=-1,u=!0)}for(var f=[],p=1;;){for(C();"("===i;)f.push(s),p*=s,s=1,M(),C();var m=void 0;if(!i)break;var d=i;if(null===(m=T()))throw new SyntaxError('Unexpected "'+d+'" in "'+r+'" at index '+t.toString());var h=_(m);if(null===h)throw new SyntaxError('Unit "'+m+'" not found.');var g=s*p;if(C(),O("^")){C();var y=B();if(null===y)throw new SyntaxError('In "'+e+'", "^" must be followed by a floating-point number');g*=y}a.units.push({unit:h.unit,prefix:h.prefix,power:g});for(var v=0;v<I.length;v++)a.dimensions[v]+=(h.unit.dimensions[v]||0)*g;for(C();")"===i;){if(0===f.length)throw new SyntaxError('Unmatched ")" in "'+r+'" at index '+t.toString());p/=f.pop(),M(),C()}if(u=!1,O("*")?(s=1,u=!0):O("/")?(s=-1,u=!0):s=1,h.unit.base){var x=h.unit.base.key;H.auto[x]={unit:h.unit,prefix:h.prefix}}}if(C(),i)throw new SyntaxError('Could not parse: "'+e+'"');if(u)throw new SyntaxError('Trailing characters: "'+e+'"');if(0!==f.length)throw new SyntaxError('Unmatched "(" in "'+r+'"');if(0===a.units.length&&!n.allowNoUnits)throw new SyntaxError('"'+e+'" contains no units');return a.value=void 0!==l?a._normalize(l):null,a},A.prototype.clone=function(){var e=new A;e.fixPrefix=this.fixPrefix,e.skipAutomaticSimplification=this.skipAutomaticSimplification,e.value=G(this.value),e.dimensions=this.dimensions.slice(0),e.units=[];for(var r=0;r<this.units.length;r++)for(var t in e.units[r]={},this.units[r])Y(this.units[r],t)&&(e.units[r][t]=this.units[r][t]);return e},A.prototype.valueType=function(){return Z(this.value)},A.prototype._isDerived=function(){return 0!==this.units.length&&(this.units.length>1||Math.abs(this.units[0].power-1)>1e-15)},A.prototype._normalize=function(e){if(null==e||0===this.units.length)return e;for(var r=e,t=A._getNumberConverter(Z(e)),n=0;n<this.units.length;n++){var i=t(this.units[n].unit.value),a=t(this.units[n].prefix.value),o=t(this.units[n].power);r=f(r,m(f(i,a),o))}return r},A.prototype._denormalize=function(e,r){if(null==e||0===this.units.length)return e;for(var t=e,n=A._getNumberConverter(Z(e)),i=0;i<this.units.length;i++){var a=n(this.units[i].unit.value),o=n(this.units[i].prefix.value),s=n(this.units[i].power);t=p(t,m(f(a,o),s))}return t};var _=wn((e=>{if(Y(U,e)){var r=U[e];return{unit:r,prefix:r.prefixes[""]}}for(var t in U)if(Y(U,t)&&Oe(e,t)){var n=U[t],i=e.length-t.length,a=e.substring(0,i),o=Y(n.prefixes,a)?n.prefixes[a]:void 0;if(void 0!==o)return{unit:n,prefix:o}}return null}),{hasher:e=>e[0],limit:100});function z(e){return e.equalBase(k.NONE)&&null!==e.value&&!o.predictable?e.value:e}A.isValuelessUnit=function(e){return null!==_(e)},A.prototype.hasBase=function(e){if("string"==typeof e&&(e=k[e]),!e)return!1;for(var r=0;r<I.length;r++)if(Math.abs((this.dimensions[r]||0)-(e.dimensions[r]||0))>1e-12)return!1;return!0},A.prototype.equalBase=function(e){for(var r=0;r<I.length;r++)if(Math.abs((this.dimensions[r]||0)-(e.dimensions[r]||0))>1e-12)return!1;return!0},A.prototype.equals=function(e){return this.equalBase(e)&&y(this.value,e.value)},A.prototype.multiply=function(e){for(var r=this.clone(),t=c(e)?e:new A(e),n=0;n<I.length;n++)r.dimensions[n]=(this.dimensions[n]||0)+(t.dimensions[n]||0);for(var i=0;i<t.units.length;i++){var a=Fl({},t.units[i]);r.units.push(a)}if(null!==this.value||null!==t.value){var o=null===this.value?this._normalize(1):this.value,s=null===t.value?t._normalize(1):t.value;r.value=f(o,s)}else r.value=null;return c(e)&&(r.skipAutomaticSimplification=!1),z(r)},A.prototype.divideInto=function(e){return new A(e).divide(this)},A.prototype.divide=function(e){for(var r=this.clone(),t=c(e)?e:new A(e),n=0;n<I.length;n++)r.dimensions[n]=(this.dimensions[n]||0)-(t.dimensions[n]||0);for(var i=0;i<t.units.length;i++){var a=Fl(Fl({},t.units[i]),{},{power:-t.units[i].power});r.units.push(a)}if(null!==this.value||null!==t.value){var o=null===this.value?this._normalize(1):this.value,s=null===t.value?t._normalize(1):t.value;r.value=p(o,s)}else r.value=null;return c(e)&&(r.skipAutomaticSimplification=!1),z(r)},A.prototype.pow=function(e){for(var r=this.clone(),t=0;t<I.length;t++)r.dimensions[t]=(this.dimensions[t]||0)*e;for(var n=0;n<r.units.length;n++)r.units[n].power*=e;return null!==r.value?r.value=m(r.value,e):r.value=null,r.skipAutomaticSimplification=!1,z(r)},A.prototype.abs=function(){var e=this.clone();if(null!==e.value)if(e._isDerived()||0===e.units[0].unit.offset)e.value=d(e.value);else{var r=e._numberConverter(),t=r(e.units[0].unit.value),n=r(e.units[0].unit.offset),i=f(t,n);e.value=l(d(u(e.value,i)),i)}for(var a in e.units)"VA"!==e.units[a].unit.name&&"VAR"!==e.units[a].unit.name||(e.units[a].unit=U.W);return e},A.prototype.to=function(e){var r,t=null===this.value?this._normalize(1):this.value;if("string"==typeof e)r=A.parse(e);else{if(!c(e))throw new Error("String or Unit expected as parameter");r=e.clone()}if(!this.equalBase(r))throw new Error("Units do not match ('".concat(r.toString(),"' != '").concat(this.toString(),"')"));if(null!==r.value)throw new Error("Cannot convert to a unit with a value");if(null===this.value||this._isDerived()||this.units[0].unit.offset===r.units[0].unit.offset)r.value=G(t);else{var n=A._getNumberConverter(Z(t)),i=this.units[0].unit.value,a=this.units[0].unit.offset,o=f(i,a),s=r.units[0].unit.value,p=r.units[0].unit.offset,m=f(s,p);r.value=u(t,n(l(o,m)))}return r.fixPrefix=!0,r.skipAutomaticSimplification=!0,r},A.prototype.toNumber=function(e){return E(this.toNumeric(e))},A.prototype.toNumeric=function(e){var r;return(r=e?this.to(e):this.clone())._isDerived()||0===r.units.length?r._denormalize(r.value):r._denormalize(r.value,r.units[0].prefix.value)},A.prototype.toString=function(){return this.format()},A.prototype.toJSON=function(){return{mathjs:"Unit",value:this._denormalize(this.value),unit:this.formatUnits(),fixPrefix:this.fixPrefix}},A.fromJSON=function(e){var r=new A(e.value,e.unit);return r.fixPrefix=e.fixPrefix||!1,r},A.prototype.valueOf=A.prototype.toString,A.prototype.simplify=function(){var e,r,t=this.clone(),n=[];for(var i in $)if(Y($,i)&&t.hasBase(k[i])){e=i;break}if("NONE"===e)t.units=[];else if(e&&Y($,e)&&(r=$[e]),r)t.units=[{unit:r.unit,prefix:r.prefix,power:1}];else{for(var a=!1,o=0;o<I.length;o++){var s=I[o];Math.abs(t.dimensions[o]||0)>1e-12&&(Y($,s)?n.push({unit:$[s].unit,prefix:$[s].prefix,power:t.dimensions[o]||0}):a=!0)}n.length<t.units.length&&!a&&(t.units=n)}return t},A.prototype.toSI=function(){for(var e=this.clone(),r=[],t=0;t<I.length;t++){var n=I[t];if(Math.abs(e.dimensions[t]||0)>1e-12){if(!Y(H.si,n))throw new Error("Cannot express custom unit "+n+" in SI units");r.push({unit:H.si[n].unit,prefix:H.si[n].prefix,power:e.dimensions[t]||0})}}return e.units=r,e.fixPrefix=!0,e.skipAutomaticSimplification=!0,e},A.prototype.formatUnits=function(){for(var e="",r="",t=0,n=0,i=0;i<this.units.length;i++)this.units[i].power>0?(t++,e+=" "+this.units[i].prefix.name+this.units[i].unit.name,Math.abs(this.units[i].power-1)>1e-15&&(e+="^"+this.units[i].power)):this.units[i].power<0&&n++;if(n>0)for(var a=0;a<this.units.length;a++)this.units[a].power<0&&(t>0?(r+=" "+this.units[a].prefix.name+this.units[a].unit.name,Math.abs(this.units[a].power+1)>1e-15&&(r+="^"+-this.units[a].power)):(r+=" "+this.units[a].prefix.name+this.units[a].unit.name,r+="^"+this.units[a].power));e=e.substr(1),r=r.substr(1),t>1&&n>0&&(e="("+e+")"),n>1&&t>0&&(r="("+r+")");var o=e;return t>0&&n>0&&(o+=" / "),o+=r},A.prototype.format=function(e){var r=this.skipAutomaticSimplification||null===this.value?this.clone():this.simplify(),t=!1;for(var n in void 0!==r.value&&null!==r.value&&s(r.value)&&(t=Math.abs(r.value.re)<1e-14),r.units)Y(r.units,n)&&r.units[n].unit&&("VA"===r.units[n].unit.name&&t?r.units[n].unit=U.VAR:"VAR"!==r.units[n].unit.name||t||(r.units[n].unit=U.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),a=null!==r.value?x(i,e||{}):"",o=r.formatUnits();return r.value&&s(r.value)&&(a="("+a+")"),o.length>0&&a.length>0&&(a+=" "),a+=o},A.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(Math.abs(this.units[0].power-Math.round(this.units[0].power))>=1e-14)throw new Error("Can only compute the best prefix for single units with integer powers, like kg, s^2, N^-1, and so forth!");var e=null!==this.value?d(this.value):0,r=d(this.units[0].unit.value),t=this.units[0].prefix;if(0===e)return t;var n=this.units[0].power,i=Math.log(e/Math.pow(t.value*r,n))/Math.LN10-1.2;if(i>-2.200001&&i<1.800001)return t;i=Math.abs(i);var a=this.units[0].unit.prefixes;for(var o in a)if(Y(a,o)){var s=a[o];if(s.scientific){var u=Math.abs(Math.log(e/Math.pow(s.value*r,n))/Math.LN10-1.2);(u<i||u===i&&s.name.length<t.name.length)&&(t=s,i=u)}}return t},A.prototype.splitUnit=function(e){for(var r=this.clone(),t=[],n=0;n<e.length&&(r=r.to(e[n]),n!==e.length-1);n++){var i=r.toNumeric(),a=g(i),o=new A(y(a,i)?a:h(r.toNumeric()),e[n].toString());t.push(o),r=l(r,o)}for(var s=0,c=0;c<t.length;c++)s=u(s,t[c].value);return y(s,this.value)&&(r.value=0),t.push(r),t};var q={NONE:{"":{name:"",value:1,scientific:!0}},SHORT:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:10,scientific:!1},h:{name:"h",value:100,scientific:!1},k:{name:"k",value:1e3,scientific:!0},M:{name:"M",value:1e6,scientific:!0},G:{name:"G",value:1e9,scientific:!0},T:{name:"T",value:1e12,scientific:!0},P:{name:"P",value:1e15,scientific:!0},E:{name:"E",value:1e18,scientific:!0},Z:{name:"Z",value:1e21,scientific:!0},Y:{name:"Y",value:1e24,scientific:!0},d:{name:"d",value:.1,scientific:!1},c:{name:"c",value:.01,scientific:!1},m:{name:"m",value:.001,scientific:!0},u:{name:"u",value:1e-6,scientific:!0},n:{name:"n",value:1e-9,scientific:!0},p:{name:"p",value:1e-12,scientific:!0},f:{name:"f",value:1e-15,scientific:!0},a:{name:"a",value:1e-18,scientific:!0},z:{name:"z",value:1e-21,scientific:!0},y:{name:"y",value:1e-24,scientific:!0}},LONG:{"":{name:"",value:1,scientific:!0},deca:{name:"deca",value:10,scientific:!1},hecto:{name:"hecto",value:100,scientific:!1},kilo:{name:"kilo",value:1e3,scientific:!0},mega:{name:"mega",value:1e6,scientific:!0},giga:{name:"giga",value:1e9,scientific:!0},tera:{name:"tera",value:1e12,scientific:!0},peta:{name:"peta",value:1e15,scientific:!0},exa:{name:"exa",value:1e18,scientific:!0},zetta:{name:"zetta",value:1e21,scientific:!0},yotta:{name:"yotta",value:1e24,scientific:!0},deci:{name:"deci",value:.1,scientific:!1},centi:{name:"centi",value:.01,scientific:!1},milli:{name:"milli",value:.001,scientific:!0},micro:{name:"micro",value:1e-6,scientific:!0},nano:{name:"nano",value:1e-9,scientific:!0},pico:{name:"pico",value:1e-12,scientific:!0},femto:{name:"femto",value:1e-15,scientific:!0},atto:{name:"atto",value:1e-18,scientific:!0},zepto:{name:"zepto",value:1e-21,scientific:!0},yocto:{name:"yocto",value:1e-24,scientific:!0}},SQUARED:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:100,scientific:!1},h:{name:"h",value:1e4,scientific:!1},k:{name:"k",value:1e6,scientific:!0},M:{name:"M",value:1e12,scientific:!0},G:{name:"G",value:1e18,scientific:!0},T:{name:"T",value:1e24,scientific:!0},P:{name:"P",value:1e30,scientific:!0},E:{name:"E",value:1e36,scientific:!0},Z:{name:"Z",value:1e42,scientific:!0},Y:{name:"Y",value:1e48,scientific:!0},d:{name:"d",value:.01,scientific:!1},c:{name:"c",value:1e-4,scientific:!1},m:{name:"m",value:1e-6,scientific:!0},u:{name:"u",value:1e-12,scientific:!0},n:{name:"n",value:1e-18,scientific:!0},p:{name:"p",value:1e-24,scientific:!0},f:{name:"f",value:1e-30,scientific:!0},a:{name:"a",value:1e-36,scientific:!0},z:{name:"z",value:1e-42,scientific:!0},y:{name:"y",value:1e-48,scientific:!0}},CUBIC:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:1e3,scientific:!1},h:{name:"h",value:1e6,scientific:!1},k:{name:"k",value:1e9,scientific:!0},M:{name:"M",value:1e18,scientific:!0},G:{name:"G",value:1e27,scientific:!0},T:{name:"T",value:1e36,scientific:!0},P:{name:"P",value:1e45,scientific:!0},E:{name:"E",value:1e54,scientific:!0},Z:{name:"Z",value:1e63,scientific:!0},Y:{name:"Y",value:1e72,scientific:!0},d:{name:"d",value:.001,scientific:!1},c:{name:"c",value:1e-6,scientific:!1},m:{name:"m",value:1e-9,scientific:!0},u:{name:"u",value:1e-18,scientific:!0},n:{name:"n",value:1e-27,scientific:!0},p:{name:"p",value:1e-36,scientific:!0},f:{name:"f",value:1e-45,scientific:!0},a:{name:"a",value:1e-54,scientific:!0},z:{name:"z",value:1e-63,scientific:!0},y:{name:"y",value:1e-72,scientific:!0}},BINARY_SHORT_SI:{"":{name:"",value:1,scientific:!0},k:{name:"k",value:1e3,scientific:!0},M:{name:"M",value:1e6,scientific:!0},G:{name:"G",value:1e9,scientific:!0},T:{name:"T",value:1e12,scientific:!0},P:{name:"P",value:1e15,scientific:!0},E:{name:"E",value:1e18,scientific:!0},Z:{name:"Z",value:1e21,scientific:!0},Y:{name:"Y",value:1e24,scientific:!0}},BINARY_SHORT_IEC:{"":{name:"",value:1,scientific:!0},Ki:{name:"Ki",value:1024,scientific:!0},Mi:{name:"Mi",value:Math.pow(1024,2),scientific:!0},Gi:{name:"Gi",value:Math.pow(1024,3),scientific:!0},Ti:{name:"Ti",value:Math.pow(1024,4),scientific:!0},Pi:{name:"Pi",value:Math.pow(1024,5),scientific:!0},Ei:{name:"Ei",value:Math.pow(1024,6),scientific:!0},Zi:{name:"Zi",value:Math.pow(1024,7),scientific:!0},Yi:{name:"Yi",value:Math.pow(1024,8),scientific:!0}},BINARY_LONG_SI:{"":{name:"",value:1,scientific:!0},kilo:{name:"kilo",value:1e3,scientific:!0},mega:{name:"mega",value:1e6,scientific:!0},giga:{name:"giga",value:1e9,scientific:!0},tera:{name:"tera",value:1e12,scientific:!0},peta:{name:"peta",value:1e15,scientific:!0},exa:{name:"exa",value:1e18,scientific:!0},zetta:{name:"zetta",value:1e21,scientific:!0},yotta:{name:"yotta",value:1e24,scientific:!0}},BINARY_LONG_IEC:{"":{name:"",value:1,scientific:!0},kibi:{name:"kibi",value:1024,scientific:!0},mebi:{name:"mebi",value:Math.pow(1024,2),scientific:!0},gibi:{name:"gibi",value:Math.pow(1024,3),scientific:!0},tebi:{name:"tebi",value:Math.pow(1024,4),scientific:!0},pebi:{name:"pebi",value:Math.pow(1024,5),scientific:!0},exi:{name:"exi",value:Math.pow(1024,6),scientific:!0},zebi:{name:"zebi",value:Math.pow(1024,7),scientific:!0},yobi:{name:"yobi",value:Math.pow(1024,8),scientific:!0}},BTU:{"":{name:"",value:1,scientific:!0},MM:{name:"MM",value:1e6,scientific:!0}}};q.SHORTLONG=(0,n.Z)({},q.SHORT,q.LONG),q.BINARY_SHORT=(0,n.Z)({},q.BINARY_SHORT_SI,q.BINARY_SHORT_IEC),q.BINARY_LONG=(0,n.Z)({},q.BINARY_LONG_SI,q.BINARY_LONG_IEC);var I=["MASS","LENGTH","TIME","CURRENT","TEMPERATURE","LUMINOUS_INTENSITY","AMOUNT_OF_SUBSTANCE","ANGLE","BIT"],k={NONE:{dimensions:[0,0,0,0,0,0,0,0,0]},MASS:{dimensions:[1,0,0,0,0,0,0,0,0]},LENGTH:{dimensions:[0,1,0,0,0,0,0,0,0]},TIME:{dimensions:[0,0,1,0,0,0,0,0,0]},CURRENT:{dimensions:[0,0,0,1,0,0,0,0,0]},TEMPERATURE:{dimensions:[0,0,0,0,1,0,0,0,0]},LUMINOUS_INTENSITY:{dimensions:[0,0,0,0,0,1,0,0,0]},AMOUNT_OF_SUBSTANCE:{dimensions:[0,0,0,0,0,0,1,0,0]},FORCE:{dimensions:[1,1,-2,0,0,0,0,0,0]},SURFACE:{dimensions:[0,2,0,0,0,0,0,0,0]},VOLUME:{dimensions:[0,3,0,0,0,0,0,0,0]},ENERGY:{dimensions:[1,2,-2,0,0,0,0,0,0]},POWER:{dimensions:[1,2,-3,0,0,0,0,0,0]},PRESSURE:{dimensions:[1,-1,-2,0,0,0,0,0,0]},ELECTRIC_CHARGE:{dimensions:[0,0,1,1,0,0,0,0,0]},ELECTRIC_CAPACITANCE:{dimensions:[-1,-2,4,2,0,0,0,0,0]},ELECTRIC_POTENTIAL:{dimensions:[1,2,-3,-1,0,0,0,0,0]},ELECTRIC_RESISTANCE:{dimensions:[1,2,-3,-2,0,0,0,0,0]},ELECTRIC_INDUCTANCE:{dimensions:[1,2,-2,-2,0,0,0,0,0]},ELECTRIC_CONDUCTANCE:{dimensions:[-1,-2,3,2,0,0,0,0,0]},MAGNETIC_FLUX:{dimensions:[1,2,-2,-1,0,0,0,0,0]},MAGNETIC_FLUX_DENSITY:{dimensions:[1,0,-2,-1,0,0,0,0,0]},FREQUENCY:{dimensions:[0,0,-1,0,0,0,0,0,0]},ANGLE:{dimensions:[0,0,0,0,0,0,0,1,0]},BIT:{dimensions:[0,0,0,0,0,0,0,0,1]}};for(var R in k)Y(k,R)&&(k[R].key=R);var P={name:"",base:{},value:1,offset:0,dimensions:I.map((e=>0))},U={meter:{name:"meter",base:k.LENGTH,prefixes:q.LONG,value:1,offset:0},inch:{name:"inch",base:k.LENGTH,prefixes:q.NONE,value:.0254,offset:0},foot:{name:"foot",base:k.LENGTH,prefixes:q.NONE,value:.3048,offset:0},yard:{name:"yard",base:k.LENGTH,prefixes:q.NONE,value:.9144,offset:0},mile:{name:"mile",base:k.LENGTH,prefixes:q.NONE,value:1609.344,offset:0},link:{name:"link",base:k.LENGTH,prefixes:q.NONE,value:.201168,offset:0},rod:{name:"rod",base:k.LENGTH,prefixes:q.NONE,value:5.0292,offset:0},chain:{name:"chain",base:k.LENGTH,prefixes:q.NONE,value:20.1168,offset:0},angstrom:{name:"angstrom",base:k.LENGTH,prefixes:q.NONE,value:1e-10,offset:0},m:{name:"m",base:k.LENGTH,prefixes:q.SHORT,value:1,offset:0},in:{name:"in",base:k.LENGTH,prefixes:q.NONE,value:.0254,offset:0},ft:{name:"ft",base:k.LENGTH,prefixes:q.NONE,value:.3048,offset:0},yd:{name:"yd",base:k.LENGTH,prefixes:q.NONE,value:.9144,offset:0},mi:{name:"mi",base:k.LENGTH,prefixes:q.NONE,value:1609.344,offset:0},li:{name:"li",base:k.LENGTH,prefixes:q.NONE,value:.201168,offset:0},rd:{name:"rd",base:k.LENGTH,prefixes:q.NONE,value:5.02921,offset:0},ch:{name:"ch",base:k.LENGTH,prefixes:q.NONE,value:20.1168,offset:0},mil:{name:"mil",base:k.LENGTH,prefixes:q.NONE,value:254e-7,offset:0},m2:{name:"m2",base:k.SURFACE,prefixes:q.SQUARED,value:1,offset:0},sqin:{name:"sqin",base:k.SURFACE,prefixes:q.NONE,value:64516e-8,offset:0},sqft:{name:"sqft",base:k.SURFACE,prefixes:q.NONE,value:.09290304,offset:0},sqyd:{name:"sqyd",base:k.SURFACE,prefixes:q.NONE,value:.83612736,offset:0},sqmi:{name:"sqmi",base:k.SURFACE,prefixes:q.NONE,value:2589988.110336,offset:0},sqrd:{name:"sqrd",base:k.SURFACE,prefixes:q.NONE,value:25.29295,offset:0},sqch:{name:"sqch",base:k.SURFACE,prefixes:q.NONE,value:404.6873,offset:0},sqmil:{name:"sqmil",base:k.SURFACE,prefixes:q.NONE,value:6.4516e-10,offset:0},acre:{name:"acre",base:k.SURFACE,prefixes:q.NONE,value:4046.86,offset:0},hectare:{name:"hectare",base:k.SURFACE,prefixes:q.NONE,value:1e4,offset:0},m3:{name:"m3",base:k.VOLUME,prefixes:q.CUBIC,value:1,offset:0},L:{name:"L",base:k.VOLUME,prefixes:q.SHORT,value:.001,offset:0},l:{name:"l",base:k.VOLUME,prefixes:q.SHORT,value:.001,offset:0},litre:{name:"litre",base:k.VOLUME,prefixes:q.LONG,value:.001,offset:0},cuin:{name:"cuin",base:k.VOLUME,prefixes:q.NONE,value:16387064e-12,offset:0},cuft:{name:"cuft",base:k.VOLUME,prefixes:q.NONE,value:.028316846592,offset:0},cuyd:{name:"cuyd",base:k.VOLUME,prefixes:q.NONE,value:.764554857984,offset:0},teaspoon:{name:"teaspoon",base:k.VOLUME,prefixes:q.NONE,value:5e-6,offset:0},tablespoon:{name:"tablespoon",base:k.VOLUME,prefixes:q.NONE,value:15e-6,offset:0},drop:{name:"drop",base:k.VOLUME,prefixes:q.NONE,value:5e-8,offset:0},gtt:{name:"gtt",base:k.VOLUME,prefixes:q.NONE,value:5e-8,offset:0},minim:{name:"minim",base:k.VOLUME,prefixes:q.NONE,value:6.161152e-8,offset:0},fluiddram:{name:"fluiddram",base:k.VOLUME,prefixes:q.NONE,value:36966911e-13,offset:0},fluidounce:{name:"fluidounce",base:k.VOLUME,prefixes:q.NONE,value:2957353e-11,offset:0},gill:{name:"gill",base:k.VOLUME,prefixes:q.NONE,value:.0001182941,offset:0},cc:{name:"cc",base:k.VOLUME,prefixes:q.NONE,value:1e-6,offset:0},cup:{name:"cup",base:k.VOLUME,prefixes:q.NONE,value:.0002365882,offset:0},pint:{name:"pint",base:k.VOLUME,prefixes:q.NONE,value:.0004731765,offset:0},quart:{name:"quart",base:k.VOLUME,prefixes:q.NONE,value:.0009463529,offset:0},gallon:{name:"gallon",base:k.VOLUME,prefixes:q.NONE,value:.003785412,offset:0},beerbarrel:{name:"beerbarrel",base:k.VOLUME,prefixes:q.NONE,value:.1173478,offset:0},oilbarrel:{name:"oilbarrel",base:k.VOLUME,prefixes:q.NONE,value:.1589873,offset:0},hogshead:{name:"hogshead",base:k.VOLUME,prefixes:q.NONE,value:.238481,offset:0},fldr:{name:"fldr",base:k.VOLUME,prefixes:q.NONE,value:36966911e-13,offset:0},floz:{name:"floz",base:k.VOLUME,prefixes:q.NONE,value:2957353e-11,offset:0},gi:{name:"gi",base:k.VOLUME,prefixes:q.NONE,value:.0001182941,offset:0},cp:{name:"cp",base:k.VOLUME,prefixes:q.NONE,value:.0002365882,offset:0},pt:{name:"pt",base:k.VOLUME,prefixes:q.NONE,value:.0004731765,offset:0},qt:{name:"qt",base:k.VOLUME,prefixes:q.NONE,value:.0009463529,offset:0},gal:{name:"gal",base:k.VOLUME,prefixes:q.NONE,value:.003785412,offset:0},bbl:{name:"bbl",base:k.VOLUME,prefixes:q.NONE,value:.1173478,offset:0},obl:{name:"obl",base:k.VOLUME,prefixes:q.NONE,value:.1589873,offset:0},g:{name:"g",base:k.MASS,prefixes:q.SHORT,value:.001,offset:0},gram:{name:"gram",base:k.MASS,prefixes:q.LONG,value:.001,offset:0},ton:{name:"ton",base:k.MASS,prefixes:q.SHORT,value:907.18474,offset:0},t:{name:"t",base:k.MASS,prefixes:q.SHORT,value:1e3,offset:0},tonne:{name:"tonne",base:k.MASS,prefixes:q.LONG,value:1e3,offset:0},grain:{name:"grain",base:k.MASS,prefixes:q.NONE,value:6479891e-11,offset:0},dram:{name:"dram",base:k.MASS,prefixes:q.NONE,value:.0017718451953125,offset:0},ounce:{name:"ounce",base:k.MASS,prefixes:q.NONE,value:.028349523125,offset:0},poundmass:{name:"poundmass",base:k.MASS,prefixes:q.NONE,value:.45359237,offset:0},hundredweight:{name:"hundredweight",base:k.MASS,prefixes:q.NONE,value:45.359237,offset:0},stick:{name:"stick",base:k.MASS,prefixes:q.NONE,value:.115,offset:0},stone:{name:"stone",base:k.MASS,prefixes:q.NONE,value:6.35029318,offset:0},gr:{name:"gr",base:k.MASS,prefixes:q.NONE,value:6479891e-11,offset:0},dr:{name:"dr",base:k.MASS,prefixes:q.NONE,value:.0017718451953125,offset:0},oz:{name:"oz",base:k.MASS,prefixes:q.NONE,value:.028349523125,offset:0},lbm:{name:"lbm",base:k.MASS,prefixes:q.NONE,value:.45359237,offset:0},cwt:{name:"cwt",base:k.MASS,prefixes:q.NONE,value:45.359237,offset:0},s:{name:"s",base:k.TIME,prefixes:q.SHORT,value:1,offset:0},min:{name:"min",base:k.TIME,prefixes:q.NONE,value:60,offset:0},h:{name:"h",base:k.TIME,prefixes:q.NONE,value:3600,offset:0},second:{name:"second",base:k.TIME,prefixes:q.LONG,value:1,offset:0},sec:{name:"sec",base:k.TIME,prefixes:q.LONG,value:1,offset:0},minute:{name:"minute",base:k.TIME,prefixes:q.NONE,value:60,offset:0},hour:{name:"hour",base:k.TIME,prefixes:q.NONE,value:3600,offset:0},day:{name:"day",base:k.TIME,prefixes:q.NONE,value:86400,offset:0},week:{name:"week",base:k.TIME,prefixes:q.NONE,value:604800,offset:0},month:{name:"month",base:k.TIME,prefixes:q.NONE,value:2629800,offset:0},year:{name:"year",base:k.TIME,prefixes:q.NONE,value:31557600,offset:0},decade:{name:"decade",base:k.TIME,prefixes:q.NONE,value:315576e3,offset:0},century:{name:"century",base:k.TIME,prefixes:q.NONE,value:315576e4,offset:0},millennium:{name:"millennium",base:k.TIME,prefixes:q.NONE,value:315576e5,offset:0},hertz:{name:"Hertz",base:k.FREQUENCY,prefixes:q.LONG,value:1,offset:0,reciprocal:!0},Hz:{name:"Hz",base:k.FREQUENCY,prefixes:q.SHORT,value:1,offset:0,reciprocal:!0},rad:{name:"rad",base:k.ANGLE,prefixes:q.SHORT,value:1,offset:0},radian:{name:"radian",base:k.ANGLE,prefixes:q.LONG,value:1,offset:0},deg:{name:"deg",base:k.ANGLE,prefixes:q.SHORT,value:null,offset:0},degree:{name:"degree",base:k.ANGLE,prefixes:q.LONG,value:null,offset:0},grad:{name:"grad",base:k.ANGLE,prefixes:q.SHORT,value:null,offset:0},gradian:{name:"gradian",base:k.ANGLE,prefixes:q.LONG,value:null,offset:0},cycle:{name:"cycle",base:k.ANGLE,prefixes:q.NONE,value:null,offset:0},arcsec:{name:"arcsec",base:k.ANGLE,prefixes:q.NONE,value:null,offset:0},arcmin:{name:"arcmin",base:k.ANGLE,prefixes:q.NONE,value:null,offset:0},A:{name:"A",base:k.CURRENT,prefixes:q.SHORT,value:1,offset:0},ampere:{name:"ampere",base:k.CURRENT,prefixes:q.LONG,value:1,offset:0},K:{name:"K",base:k.TEMPERATURE,prefixes:q.SHORT,value:1,offset:0},degC:{name:"degC",base:k.TEMPERATURE,prefixes:q.SHORT,value:1,offset:273.15},degF:{name:"degF",base:k.TEMPERATURE,prefixes:q.SHORT,value:new D(5,9),offset:459.67},degR:{name:"degR",base:k.TEMPERATURE,prefixes:q.SHORT,value:new D(5,9),offset:0},kelvin:{name:"kelvin",base:k.TEMPERATURE,prefixes:q.LONG,value:1,offset:0},celsius:{name:"celsius",base:k.TEMPERATURE,prefixes:q.LONG,value:1,offset:273.15},fahrenheit:{name:"fahrenheit",base:k.TEMPERATURE,prefixes:q.LONG,value:new D(5,9),offset:459.67},rankine:{name:"rankine",base:k.TEMPERATURE,prefixes:q.LONG,value:new D(5,9),offset:0},mol:{name:"mol",base:k.AMOUNT_OF_SUBSTANCE,prefixes:q.SHORT,value:1,offset:0},mole:{name:"mole",base:k.AMOUNT_OF_SUBSTANCE,prefixes:q.LONG,value:1,offset:0},cd:{name:"cd",base:k.LUMINOUS_INTENSITY,prefixes:q.SHORT,value:1,offset:0},candela:{name:"candela",base:k.LUMINOUS_INTENSITY,prefixes:q.LONG,value:1,offset:0},N:{name:"N",base:k.FORCE,prefixes:q.SHORT,value:1,offset:0},newton:{name:"newton",base:k.FORCE,prefixes:q.LONG,value:1,offset:0},dyn:{name:"dyn",base:k.FORCE,prefixes:q.SHORT,value:1e-5,offset:0},dyne:{name:"dyne",base:k.FORCE,prefixes:q.LONG,value:1e-5,offset:0},lbf:{name:"lbf",base:k.FORCE,prefixes:q.NONE,value:4.4482216152605,offset:0},poundforce:{name:"poundforce",base:k.FORCE,prefixes:q.NONE,value:4.4482216152605,offset:0},kip:{name:"kip",base:k.FORCE,prefixes:q.LONG,value:4448.2216,offset:0},kilogramforce:{name:"kilogramforce",base:k.FORCE,prefixes:q.NONE,value:9.80665,offset:0},J:{name:"J",base:k.ENERGY,prefixes:q.SHORT,value:1,offset:0},joule:{name:"joule",base:k.ENERGY,prefixes:q.SHORT,value:1,offset:0},erg:{name:"erg",base:k.ENERGY,prefixes:q.NONE,value:1e-7,offset:0},Wh:{name:"Wh",base:k.ENERGY,prefixes:q.SHORT,value:3600,offset:0},BTU:{name:"BTU",base:k.ENERGY,prefixes:q.BTU,value:1055.05585262,offset:0},eV:{name:"eV",base:k.ENERGY,prefixes:q.SHORT,value:1602176565e-28,offset:0},electronvolt:{name:"electronvolt",base:k.ENERGY,prefixes:q.LONG,value:1602176565e-28,offset:0},W:{name:"W",base:k.POWER,prefixes:q.SHORT,value:1,offset:0},watt:{name:"watt",base:k.POWER,prefixes:q.LONG,value:1,offset:0},hp:{name:"hp",base:k.POWER,prefixes:q.NONE,value:745.6998715386,offset:0},VAR:{name:"VAR",base:k.POWER,prefixes:q.SHORT,value:w.I,offset:0},VA:{name:"VA",base:k.POWER,prefixes:q.SHORT,value:1,offset:0},Pa:{name:"Pa",base:k.PRESSURE,prefixes:q.SHORT,value:1,offset:0},psi:{name:"psi",base:k.PRESSURE,prefixes:q.NONE,value:6894.75729276459,offset:0},atm:{name:"atm",base:k.PRESSURE,prefixes:q.NONE,value:101325,offset:0},bar:{name:"bar",base:k.PRESSURE,prefixes:q.SHORTLONG,value:1e5,offset:0},torr:{name:"torr",base:k.PRESSURE,prefixes:q.NONE,value:133.322,offset:0},mmHg:{name:"mmHg",base:k.PRESSURE,prefixes:q.NONE,value:133.322,offset:0},mmH2O:{name:"mmH2O",base:k.PRESSURE,prefixes:q.NONE,value:9.80665,offset:0},cmH2O:{name:"cmH2O",base:k.PRESSURE,prefixes:q.NONE,value:98.0665,offset:0},coulomb:{name:"coulomb",base:k.ELECTRIC_CHARGE,prefixes:q.LONG,value:1,offset:0},C:{name:"C",base:k.ELECTRIC_CHARGE,prefixes:q.SHORT,value:1,offset:0},farad:{name:"farad",base:k.ELECTRIC_CAPACITANCE,prefixes:q.LONG,value:1,offset:0},F:{name:"F",base:k.ELECTRIC_CAPACITANCE,prefixes:q.SHORT,value:1,offset:0},volt:{name:"volt",base:k.ELECTRIC_POTENTIAL,prefixes:q.LONG,value:1,offset:0},V:{name:"V",base:k.ELECTRIC_POTENTIAL,prefixes:q.SHORT,value:1,offset:0},ohm:{name:"ohm",base:k.ELECTRIC_RESISTANCE,prefixes:q.SHORTLONG,value:1,offset:0},henry:{name:"henry",base:k.ELECTRIC_INDUCTANCE,prefixes:q.LONG,value:1,offset:0},H:{name:"H",base:k.ELECTRIC_INDUCTANCE,prefixes:q.SHORT,value:1,offset:0},siemens:{name:"siemens",base:k.ELECTRIC_CONDUCTANCE,prefixes:q.LONG,value:1,offset:0},S:{name:"S",base:k.ELECTRIC_CONDUCTANCE,prefixes:q.SHORT,value:1,offset:0},weber:{name:"weber",base:k.MAGNETIC_FLUX,prefixes:q.LONG,value:1,offset:0},Wb:{name:"Wb",base:k.MAGNETIC_FLUX,prefixes:q.SHORT,value:1,offset:0},tesla:{name:"tesla",base:k.MAGNETIC_FLUX_DENSITY,prefixes:q.LONG,value:1,offset:0},T:{name:"T",base:k.MAGNETIC_FLUX_DENSITY,prefixes:q.SHORT,value:1,offset:0},b:{name:"b",base:k.BIT,prefixes:q.BINARY_SHORT,value:1,offset:0},bits:{name:"bits",base:k.BIT,prefixes:q.BINARY_LONG,value:1,offset:0},B:{name:"B",base:k.BIT,prefixes:q.BINARY_SHORT,value:8,offset:0},bytes:{name:"bytes",base:k.BIT,prefixes:q.BINARY_LONG,value:8,offset:0}},j={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 L(e){if("BigNumber"===e.number){var r=Al(N);U.rad.value=new N(1),U.deg.value=r.div(180),U.grad.value=r.div(200),U.cycle.value=r.times(2),U.arcsec.value=r.div(648e3),U.arcmin.value=r.div(10800)}else U.rad.value=1,U.deg.value=Math.PI/180,U.grad.value=Math.PI/200,U.cycle.value=2*Math.PI,U.arcsec.value=Math.PI/648e3,U.arcmin.value=Math.PI/10800;U.radian.value=U.rad.value,U.degree.value=U.deg.value,U.gradian.value=U.grad.value}L(o),a&&a("config",(function(e,r){e.number!==r.number&&L(e)}));var H={si:{NONE:{unit:P,prefix:q.NONE[""]},LENGTH:{unit:U.m,prefix:q.SHORT[""]},MASS:{unit:U.g,prefix:q.SHORT.k},TIME:{unit:U.s,prefix:q.SHORT[""]},CURRENT:{unit:U.A,prefix:q.SHORT[""]},TEMPERATURE:{unit:U.K,prefix:q.SHORT[""]},LUMINOUS_INTENSITY:{unit:U.cd,prefix:q.SHORT[""]},AMOUNT_OF_SUBSTANCE:{unit:U.mol,prefix:q.SHORT[""]},ANGLE:{unit:U.rad,prefix:q.SHORT[""]},BIT:{unit:U.bits,prefix:q.SHORT[""]},FORCE:{unit:U.N,prefix:q.SHORT[""]},ENERGY:{unit:U.J,prefix:q.SHORT[""]},POWER:{unit:U.W,prefix:q.SHORT[""]},PRESSURE:{unit:U.Pa,prefix:q.SHORT[""]},ELECTRIC_CHARGE:{unit:U.C,prefix:q.SHORT[""]},ELECTRIC_CAPACITANCE:{unit:U.F,prefix:q.SHORT[""]},ELECTRIC_POTENTIAL:{unit:U.V,prefix:q.SHORT[""]},ELECTRIC_RESISTANCE:{unit:U.ohm,prefix:q.SHORT[""]},ELECTRIC_INDUCTANCE:{unit:U.H,prefix:q.SHORT[""]},ELECTRIC_CONDUCTANCE:{unit:U.S,prefix:q.SHORT[""]},MAGNETIC_FLUX:{unit:U.Wb,prefix:q.SHORT[""]},MAGNETIC_FLUX_DENSITY:{unit:U.T,prefix:q.SHORT[""]},FREQUENCY:{unit:U.Hz,prefix:q.SHORT[""]}}};H.cgs=JSON.parse(JSON.stringify(H.si)),H.cgs.LENGTH={unit:U.m,prefix:q.SHORT.c},H.cgs.MASS={unit:U.g,prefix:q.SHORT[""]},H.cgs.FORCE={unit:U.dyn,prefix:q.SHORT[""]},H.cgs.ENERGY={unit:U.erg,prefix:q.NONE[""]},H.us=JSON.parse(JSON.stringify(H.si)),H.us.LENGTH={unit:U.ft,prefix:q.NONE[""]},H.us.MASS={unit:U.lbm,prefix:q.NONE[""]},H.us.TEMPERATURE={unit:U.degF,prefix:q.NONE[""]},H.us.FORCE={unit:U.lbf,prefix:q.NONE[""]},H.us.ENERGY={unit:U.BTU,prefix:q.BTU[""]},H.us.POWER={unit:U.hp,prefix:q.NONE[""]},H.us.PRESSURE={unit:U.psi,prefix:q.NONE[""]},H.auto=JSON.parse(JSON.stringify(H.si));var $=H.auto;for(var V in A.setUnitSystem=function(e){if(!Y(H,e))throw new Error("Unit system "+e+" does not exist. Choices are: "+Object.keys(H).join(", "));$=H[e]},A.getUnitSystem=function(){for(var e in H)if(Y(H,e)&&H[e]===$)return e},A.typeConverters={BigNumber:function(e){return null!=e&&e.isFraction?new N(e.n).div(e.d).times(e.s):new N(e+"")},Fraction:function(e){return new D(e)},Complex:function(e){return e},number:function(e){return null!=e&&e.isFraction?b(e):e}},A.prototype._numberConverter=function(){var e=A.typeConverters[this.valueType()];if(e)return e;throw new TypeError('Unsupported Unit value type "'+this.valueType()+'"')},A._getNumberConverter=function(e){if(!A.typeConverters[e])throw new TypeError('Unsupported type "'+e+'"');return A.typeConverters[e]},U)if(Y(U,V)){var W=U[V];W.dimensions=W.base.dimensions}for(var J in j)if(Y(j,J)){var X=U[j[J]],Q={};for(var K in X)Y(X,K)&&(Q[K]=X[K]);Q.name=J,U[J]=Q}return A.isValidAlpha=function(e){return/^[a-zA-Z]$/.test(e)},A.createUnit=function(e,r){if("object"!=typeof e)throw new TypeError("createUnit expects first parameter to be of type 'Object'");if(r&&r.override)for(var t in e)if(Y(e,t)&&A.deleteUnit(t),e[t].aliases)for(var n=0;n<e[t].aliases.length;n++)A.deleteUnit(e[t].aliases[n]);var i;for(var a in e)Y(e,a)&&(i=A.createUnitSingle(a,e[a]));return i},A.createUnitSingle=function(e,r){if(null==r&&(r={}),"string"!=typeof e)throw new TypeError("createUnitSingle expects first parameter to be of type 'string'");if(Y(U,e))throw new Error('Cannot create unit "'+e+'": a unit with that name already exists');!function(e){for(var r=0;r<e.length;r++){if(i=e.charAt(r),0===r&&!A.isValidAlpha(i))throw new Error('Invalid unit name (must begin with alpha character): "'+e+'"');if(r>0&&!A.isValidAlpha(i)&&!S(i))throw new Error('Invalid unit name (only alphanumeric characters are allowed): "'+e+'"')}}(e);var t,n,a,o=null,s=[],u=0;if(r&&"Unit"===r.type)o=r.clone();else if("string"==typeof r)""!==r&&(t=r);else{if("object"!=typeof r)throw new TypeError('Cannot create unit "'+e+'" from "'+r.toString()+'": expecting "string" or "Unit" or "Object"');t=r.definition,n=r.prefixes,u=r.offset,a=r.baseName,r.aliases&&(s=r.aliases.valueOf())}if(s)for(var c=0;c<s.length;c++)if(Y(U,s[c]))throw new Error('Cannot create alias "'+s[c]+'": a unit with that name already exists');if(t&&"string"==typeof t&&!o)try{o=A.parse(t,{allowNoUnits:!0})}catch(r){throw r.message='Could not create unit "'+e+'" from "'+t+'": '+r.message,r}else t&&"Unit"===t.type&&(o=t.clone());s=s||[],u=u||0,n=n&&n.toUpperCase&&q[n.toUpperCase()]||q.NONE;var l={};if(o){l={name:e,value:o.value,dimensions:o.dimensions.slice(0),prefixes:n,offset:u};var f=!1;for(var p in k)if(Y(k,p)){for(var m=!0,d=0;d<I.length;d++)if(Math.abs((l.dimensions[d]||0)-(k[p].dimensions[d]||0))>1e-12){m=!1;break}if(m){f=!0,l.base=k[p];break}}if(!f){a=a||e+"_STUFF";var h={dimensions:o.dimensions.slice(0)};h.key=a,k[a]=h,$[a]={unit:l,prefix:q.NONE[""]},l.base=k[a]}}else{if(a=a||e+"_STUFF",I.indexOf(a)>=0)throw new Error('Cannot create new base unit "'+e+'": a base unit with that name already exists (and cannot be overridden)');for(var g in I.push(a),k)Y(k,g)&&(k[g].dimensions[I.length-1]=0);for(var y={dimensions:[]},v=0;v<I.length;v++)y.dimensions[v]=0;y.dimensions[I.length-1]=1,y.key=a,k[a]=y,l={name:e,value:1,dimensions:k[a].dimensions.slice(0),prefixes:n,offset:u,base:k[a]},$[a]={unit:l,prefix:q.NONE[""]}}A.UNITS[e]=l;for(var x=0;x<s.length;x++){var b=s[x],w={};for(var N in l)Y(l,N)&&(w[N]=l[N]);w.name=b,A.UNITS[b]=w}return delete _.cache,new A(null,e)},A.deleteUnit=function(e){delete A.UNITS[e]},A.PREFIXES=q,A.BASE_DIMENSIONS=I,A.BASE_UNITS=k,A.UNIT_SYSTEMS=H,A.UNITS=U,A}),{isClass:!0}),Tl="unit",Ol=ur(Tl,["typed","Unit"],(e=>{var{typed:r,Unit:t}=e;return r(Tl,{Unit:function(e){return e.clone()},string:function(e){return t.isValuelessUnit(e)?new t(null,e):t.parse(e,{allowNoUnits:!0})},"number | BigNumber | Fraction | Complex, string | Unit":function(e,r){return new t(e,r)},"number | BigNumber | Fraction":function(e){return new t(e)},"Array | Matrix":r.referToSelf((e=>r=>Fn(r,e)))})})),_l="sparse",zl=ur(_l,["typed","SparseMatrix"],(e=>{var{typed:r,SparseMatrix:t}=e;return r(_l,{"":function(){return new t([])},string:function(e){return new t([],e)},"Array | Matrix":function(e){return new t(e)},"Array | Matrix, string":function(e,r){return new t(e,r)}})})),ql="createUnit",Il=ur(ql,["typed","Unit"],(e=>{var{typed:r,Unit:t}=e;return r(ql,{"Object, Object":function(e,r){return t.createUnit(e,r)},Object:function(e){return t.createUnit(e,{})},"string, Unit | string | Object, Object":function(e,r,n){var i={};return i[e]=r,t.createUnit(i,n)},"string, Unit | string | Object":function(e,r){var n={};return n[e]=r,t.createUnit(n,{})},string:function(e){var r={};return r[e]={},t.createUnit(r,{})}})})),kl="acos",Rl=ur(kl,["typed","config","Complex"],(e=>{var{typed:r,config:t,Complex:n}=e;return r(kl,{number:function(e){return e>=-1&&e<=1||t.predictable?Math.acos(e):new n(e,0).acos()},Complex:function(e){return e.acos()},BigNumber:function(e){return e.acos()}})})),Pl="acosh",Ul=ur(Pl,["typed","config","Complex"],(e=>{var{typed:r,config:t,Complex:n}=e;return r(Pl,{number:function(e){return e>=1||t.predictable?Mi(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()}})})),jl="acot",Ll=ur(jl,["typed","BigNumber"],(e=>{var{typed:r,BigNumber:t}=e;return r(jl,{number:Fi,Complex:function(e){return e.acot()},BigNumber:function(e){return new t(1).div(e).atan()}})})),Hl="acoth",$l=ur(Hl,["typed","config","Complex","BigNumber"],(e=>{var{typed:r,config:t,Complex:n,BigNumber:i}=e;return r(Hl,{number:function(e){return e>=1||e<=-1||t.predictable?Bi(e):new n(e,0).acoth()},Complex:function(e){return e.acoth()},BigNumber:function(e){return new i(1).div(e).atanh()}})})),Zl="acsc",Gl=ur(Zl,["typed","config","Complex","BigNumber"],(e=>{var{typed:r,config:t,Complex:n,BigNumber:i}=e;return r(Zl,{number:function(e){return e<=-1||e>=1||t.predictable?Ti(e):new n(e,0).acsc()},Complex:function(e){return e.acsc()},BigNumber:function(e){return new i(1).div(e).asin()}})})),Vl="acsch",Wl=ur(Vl,["typed","BigNumber"],(e=>{var{typed:r,BigNumber:t}=e;return r(Vl,{number:Oi,Complex:function(e){return e.acsch()},BigNumber:function(e){return new t(1).div(e).asinh()}})})),Yl="asec",Jl=ur(Yl,["typed","config","Complex","BigNumber"],(e=>{var{typed:r,config:t,Complex:n,BigNumber:i}=e;return r(Yl,{number:function(e){return e<=-1||e>=1||t.predictable?_i(e):new n(e,0).asec()},Complex:function(e){return e.asec()},BigNumber:function(e){return new i(1).div(e).acos()}})})),Xl="asech",Ql=ur(Xl,["typed","config","Complex","BigNumber"],(e=>{var{typed:r,config:t,Complex:n,BigNumber:i}=e;return r(Xl,{number:function(e){if(e<=1&&e>=-1||t.predictable){var r=1/e;if(r>0||t.predictable)return zi(e);var i=Math.sqrt(r*r-1);return new n(Math.log(i-r),Math.PI)}return new n(e,0).asech()},Complex:function(e){return e.asech()},BigNumber:function(e){return new i(1).div(e).acosh()}})})),Kl="asin",ef=ur(Kl,["typed","config","Complex"],(e=>{var{typed:r,config:t,Complex:n}=e;return r(Kl,{number:function(e){return e>=-1&&e<=1||t.predictable?Math.asin(e):new n(e,0).asin()},Complex:function(e){return e.asin()},BigNumber:function(e){return e.asin()}})})),rf=ur("asinh",["typed"],(e=>{var{typed:r}=e;return r("asinh",{number:qi,Complex:function(e){return e.asinh()},BigNumber:function(e){return e.asinh()}})})),tf=ur("atan",["typed"],(e=>{var{typed:r}=e;return r("atan",{number:function(e){return Math.atan(e)},Complex:function(e){return e.atan()},BigNumber:function(e){return e.atan()}})})),nf="atan2",af=ur(nf,["typed","matrix","equalScalar","BigNumber","DenseMatrix","concat"],(e=>{var{typed:r,matrix:t,equalScalar:n,BigNumber:i,DenseMatrix:a,concat:o}=e,s=Do({typed:r,equalScalar:n}),u=Bo({typed:r}),c=Yo({typed:r,equalScalar:n}),l=$a({typed:r,equalScalar:n}),f=Za({typed:r,DenseMatrix:a}),p=go({typed:r,matrix:t,concat:o});return r(nf,{"number, number":Math.atan2,"BigNumber, BigNumber":(e,r)=>i.atan2(e,r)},p({scalar:"number | BigNumber",SS:c,DS:u,SD:s,Ss:l,sS:f}))})),of="atanh",sf=ur(of,["typed","config","Complex"],(e=>{var{typed:r,config:t,Complex:n}=e;return r(of,{number:function(e){return e<=1&&e>=-1||t.predictable?Ii(e):new n(e,0).atanh()},Complex:function(e){return e.atanh()},BigNumber:function(e){return e.atanh()}})})),uf=ur("trigUnit",["typed"],(e=>{var{typed:r}=e;return{Unit:r.referToSelf((e=>t=>{if(!t.hasBase(t.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cot is no angle");return r.find(e,t.valueType())(t.value)}))}})),cf=ur("cos",["typed"],(e=>{var{typed:r}=e,t=uf({typed:r});return r("cos",{number:Math.cos,"Complex | BigNumber":e=>e.cos()},t)})),lf="cosh",ff=ur(lf,["typed"],(e=>{var{typed:r}=e;return r(lf,{number:Ce,"Complex | BigNumber":e=>e.cosh()})})),pf=ur("cot",["typed","BigNumber"],(e=>{var{typed:r,BigNumber:t}=e;return r("cot",{number:ki,Complex:e=>e.cot(),BigNumber:e=>new t(1).div(e.tan())},uf({typed:r}))})),mf="coth",df=ur(mf,["typed","BigNumber"],(e=>{var{typed:r,BigNumber:t}=e;return r(mf,{number:Ri,Complex:e=>e.coth(),BigNumber:e=>new t(1).div(e.tanh())})})),hf=ur("csc",["typed","BigNumber"],(e=>{var{typed:r,BigNumber:t}=e;return r("csc",{number:Pi,Complex:e=>e.csc(),BigNumber:e=>new t(1).div(e.sin())},uf({typed:r}))})),gf="csch",yf=ur(gf,["typed","BigNumber"],(e=>{var{typed:r,BigNumber:t}=e;return r(gf,{number:Ui,Complex:e=>e.csch(),BigNumber:e=>new t(1).div(e.sinh())})})),vf=ur("sec",["typed","BigNumber"],(e=>{var{typed:r,BigNumber:t}=e;return r("sec",{number:ji,Complex:e=>e.sec(),BigNumber:e=>new t(1).div(e.cos())},uf({typed:r}))})),xf="sech",bf=ur(xf,["typed","BigNumber"],(e=>{var{typed:r,BigNumber:t}=e;return r(xf,{number:Li,Complex:e=>e.sech(),BigNumber:e=>new t(1).div(e.cosh())})})),wf=ur("sin",["typed"],(e=>{var{typed:r}=e,t=uf({typed:r});return r("sin",{number:Math.sin,"Complex | BigNumber":e=>e.sin()},t)})),Nf="sinh",Df=ur(Nf,["typed"],(e=>{var{typed:r}=e;return r(Nf,{number:Hi,"Complex | BigNumber":e=>e.sinh()})})),Ef=ur("tan",["typed"],(e=>{var{typed:r}=e,t=uf({typed:r});return r("tan",{number:Math.tan,"Complex | BigNumber":e=>e.tan()},t)})),Af=ur("tanh",["typed"],(e=>{var{typed:r}=e;return r("tanh",{number:Me,"Complex | BigNumber":e=>e.tanh()})})),Cf="setCartesian",Sf=ur(Cf,["typed","size","subset","compareNatural","Index","DenseMatrix"],(e=>{var{typed:r,size:t,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=e;return r(Cf,{"Array | Matrix, Array | Matrix":function(e,r){var s=[];if(0!==n(t(e),new a(0))&&0!==n(t(r),new a(0))){var u=Ke(Array.isArray(e)?e:e.toArray()).sort(i),c=Ke(Array.isArray(r)?r:r.toArray()).sort(i);s=[];for(var l=0;l<u.length;l++)for(var f=0;f<c.length;f++)s.push([u[l],c[f]])}return Array.isArray(e)&&Array.isArray(r)?s:new o(s)}})})),Mf="setDifference",Ff=ur(Mf,["typed","size","subset","compareNatural","Index","DenseMatrix"],(e=>{var{typed:r,size:t,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=e;return r(Mf,{"Array | Matrix, Array | Matrix":function(e,r){var s;if(0===n(t(e),new a(0)))s=[];else{if(0===n(t(r),new a(0)))return Ke(e.toArray());var u,c=ar(Ke(Array.isArray(e)?e:e.toArray()).sort(i)),l=ar(Ke(Array.isArray(r)?r:r.toArray()).sort(i));s=[];for(var f=0;f<c.length;f++){u=!1;for(var p=0;p<l.length;p++)if(0===i(c[f].value,l[p].value)&&c[f].identifier===l[p].identifier){u=!0;break}u||s.push(c[f])}}return Array.isArray(e)&&Array.isArray(r)?or(s):new o(or(s))}})})),Bf="setDistinct",Tf=ur(Bf,["typed","size","subset","compareNatural","Index","DenseMatrix"],(e=>{var{typed:r,size:t,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=e;return r(Bf,{"Array | Matrix":function(e){var r;if(0===n(t(e),new a(0)))r=[];else{var s=Ke(Array.isArray(e)?e:e.toArray()).sort(i);(r=[]).push(s[0]);for(var u=1;u<s.length;u++)0!==i(s[u],s[u-1])&&r.push(s[u])}return Array.isArray(e)?r:new o(r)}})})),Of="setIntersect",_f=ur(Of,["typed","size","subset","compareNatural","Index","DenseMatrix"],(e=>{var{typed:r,size:t,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=e;return r(Of,{"Array | Matrix, Array | Matrix":function(e,r){var s;if(0===n(t(e),new a(0))||0===n(t(r),new a(0)))s=[];else{var u=ar(Ke(Array.isArray(e)?e:e.toArray()).sort(i)),c=ar(Ke(Array.isArray(r)?r:r.toArray()).sort(i));s=[];for(var l=0;l<u.length;l++)for(var f=0;f<c.length;f++)if(0===i(u[l].value,c[f].value)&&u[l].identifier===c[f].identifier){s.push(u[l]);break}}return Array.isArray(e)&&Array.isArray(r)?or(s):new o(or(s))}})})),zf="setIsSubset",qf=ur(zf,["typed","size","subset","compareNatural","Index"],(e=>{var{typed:r,size:t,subset:n,compareNatural:i,Index:a}=e;return r(zf,{"Array | Matrix, Array | Matrix":function(e,r){if(0===n(t(e),new a(0)))return!0;if(0===n(t(r),new a(0)))return!1;for(var o,s=ar(Ke(Array.isArray(e)?e:e.toArray()).sort(i)),u=ar(Ke(Array.isArray(r)?r:r.toArray()).sort(i)),c=0;c<s.length;c++){o=!1;for(var l=0;l<u.length;l++)if(0===i(s[c].value,u[l].value)&&s[c].identifier===u[l].identifier){o=!0;break}if(!1===o)return!1}return!0}})})),If="setMultiplicity",kf=ur(If,["typed","size","subset","compareNatural","Index"],(e=>{var{typed:r,size:t,subset:n,compareNatural:i,Index:a}=e;return r(If,{"number | BigNumber | Fraction | Complex, Array | Matrix":function(e,r){if(0===n(t(r),new a(0)))return 0;for(var o=Ke(Array.isArray(r)?r:r.toArray()),s=0,u=0;u<o.length;u++)0===i(o[u],e)&&s++;return s}})})),Rf="setPowerset",Pf=ur(Rf,["typed","size","subset","compareNatural","Index"],(e=>{var{typed:r,size:t,subset:n,compareNatural:i,Index:a}=e;return r(Rf,{"Array | Matrix":function(e){if(0===n(t(e),new a(0)))return[];for(var r=Ke(Array.isArray(e)?e:e.toArray()).sort(i),s=[],u=0;u.toString(2).length<=r.length;)s.push(o(r,u.toString(2).split("").reverse())),u++;return function(e){for(var r=[],t=e.length-1;t>0;t--)for(var n=0;n<t;n++)e[n].length>e[n+1].length&&(r=e[n],e[n]=e[n+1],e[n+1]=r);return e}(s)}});function o(e,r){for(var t=[],n=0;n<r.length;n++)"1"===r[n]&&t.push(e[n]);return t}})),Uf="setSize",jf=ur(Uf,["typed","compareNatural"],(e=>{var{typed:r,compareNatural:t}=e;return r(Uf,{"Array | Matrix":function(e){return Array.isArray(e)?Ke(e).length:Ke(e.toArray()).length},"Array | Matrix, boolean":function(e,r){if(!1===r||0===e.length)return Array.isArray(e)?Ke(e).length:Ke(e.toArray()).length;for(var n=Ke(Array.isArray(e)?e:e.toArray()).sort(t),i=1,a=1;a<n.length;a++)0!==t(n[a],n[a-1])&&i++;return i}})})),Lf="setSymDifference",Hf=ur(Lf,["typed","size","concat","subset","setDifference","Index"],(e=>{var{typed:r,size:t,concat:n,subset:i,setDifference:a,Index:o}=e;return r(Lf,{"Array | Matrix, Array | Matrix":function(e,r){if(0===i(t(e),new o(0)))return Ke(r);if(0===i(t(r),new o(0)))return Ke(e);var s=Ke(e),u=Ke(r);return n(a(s,u),a(u,s))}})})),$f="setUnion",Zf=ur($f,["typed","size","concat","subset","setIntersect","setSymDifference","Index"],(e=>{var{typed:r,size:t,concat:n,subset:i,setIntersect:a,setSymDifference:o,Index:s}=e;return r($f,{"Array | Matrix, Array | Matrix":function(e,r){if(0===i(t(e),new s(0)))return Ke(r);if(0===i(t(r),new s(0)))return Ke(e);var u=Ke(e),c=Ke(r);return n(o(u,c),a(u,c))}})})),Gf=ur("add",["typed","matrix","addScalar","equalScalar","DenseMatrix","SparseMatrix","concat"],(e=>{var{typed:r,matrix:t,addScalar:n,equalScalar:i,DenseMatrix:a,SparseMatrix:o,concat:s}=e,u=lo({typed:r}),c=fo({typed:r,equalScalar:i}),l=po({typed:r,DenseMatrix:a}),f=go({typed:r,matrix:t,concat:s});return r("add",{"any, any":n,"any, any, ...any":r.referToSelf((e=>(r,t,n)=>{for(var i=e(r,t),a=0;a<n.length;a++)i=e(i,n[a]);return i}))},f({elop:n,DS:u,SS:c,Ss:l}))})),Vf="hypot",Wf=ur(Vf,["typed","abs","addScalar","divideScalar","multiplyScalar","sqrt","smaller","isPositive"],(e=>{var{typed:r,abs:t,addScalar:n,divideScalar:i,multiplyScalar:a,sqrt:o,smaller:u,isPositive:c}=e;return r(Vf,{"... number | BigNumber":l,Array:l,Matrix:e=>l(Ke(e.toArray()))});function l(e){for(var r=0,l=0,f=0;f<e.length;f++){if(s(e[f]))throw new TypeError("Unexpected type of argument to hypot");var p=t(e[f]);u(l,p)?(r=a(r,a(i(l,p),i(l,p))),r=n(r,1),l=p):r=n(r,c(p)?a(i(p,l),i(p,l)):p)}return a(l,o(r))}})),Yf="norm",Jf=ur(Yf,["typed","abs","add","pow","conj","sqrt","multiply","equalScalar","larger","smaller","matrix","ctranspose","eigs"],(e=>{var{typed:r,abs:t,add:n,pow:i,conj:a,sqrt:o,multiply:s,equalScalar:u,larger:c,smaller:l,matrix:f,ctranspose:p,eigs:m}=e;return r(Yf,{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 g(f(e),2)},Matrix:function(e){return g(e,2)},"Array, number | BigNumber | string":function(e,r){return g(f(e),r)},"Matrix, number | BigNumber | string":function(e,r){return g(e,r)}});function d(e,r){if(r===Number.POSITIVE_INFINITY||"inf"===r)return function(e){var r=0;return e.forEach((function(e){var n=t(e);c(n,r)&&(r=n)}),!0),r}(e);if(r===Number.NEGATIVE_INFINITY||"-inf"===r)return function(e){var r;return e.forEach((function(e){var n=t(e);r&&!l(n,r)||(r=n)}),!0),r||0}(e);if("fro"===r)return g(e,2);if("number"==typeof r&&!isNaN(r)){if(!u(r,0)){var a=0;return e.forEach((function(e){a=n(i(t(e),r),a)}),!0),i(a,1/r)}return Number.POSITIVE_INFINITY}throw new Error("Unsupported parameter value")}function h(e,r){if(1===r)return function(e){var r=[],i=0;return e.forEach((function(e,a){var o=a[1],s=n(r[o]||0,t(e));c(s,i)&&(i=s),r[o]=s}),!0),i}(e);if(r===Number.POSITIVE_INFINITY||"inf"===r)return function(e){var r=[],i=0;return e.forEach((function(e,a){var o=a[0],s=n(r[o]||0,t(e));c(s,i)&&(i=s),r[o]=s}),!0),i}(e);if("fro"===r)return function(e){var r=0;return e.forEach((function(e,t){r=n(r,s(e,a(e)))})),t(o(r))}(e);if(2===r)return function(e){var r=e.size();if(r[0]!==r[1])throw new RangeError("Invalid matrix dimensions");var n=p(e),i=s(n,e),a=m(i).values.toArray(),u=a[a.length-1];return t(o(u))}(e);throw new Error("Unsupported parameter value "+r)}function g(e,r){var t=e.size();if(1===t.length)return d(e,r);if(2===t.length){if(t[0]&&t[1])return h(e,r);throw new RangeError("Invalid matrix dimensions")}}})),Xf=ur("dot",["typed","addScalar","multiplyScalar","conj","size"],(e=>{var{typed:r,addScalar:t,multiplyScalar:n,conj:i,size:a}=e;return r("dot",{"Array | DenseMatrix, Array | DenseMatrix":function(e,a){var u=o(e,a),c=p(e)?e._data:e,l=p(e)?e._datatype:void 0,f=p(a)?a._data:a,m=p(a)?a._datatype:void 0,d=2===s(e).length,h=2===s(a).length,g=t,y=n;if(l&&m&&l===m&&"string"==typeof l){var v=l;g=r.find(t,[v,v]),y=r.find(n,[v,v])}if(!d&&!h){for(var x=y(i(c[0]),f[0]),b=1;b<u;b++)x=g(x,y(i(c[b]),f[b]));return x}if(!d&&h){for(var w=y(i(c[0]),f[0][0]),N=1;N<u;N++)w=g(w,y(i(c[N]),f[N][0]));return w}if(d&&!h){for(var D=y(i(c[0][0]),f[0]),E=1;E<u;E++)D=g(D,y(i(c[E][0]),f[E]));return D}if(d&&h){for(var A=y(i(c[0][0]),f[0][0]),C=1;C<u;C++)A=g(A,y(i(c[C][0]),f[C][0]));return A}},"SparseMatrix, SparseMatrix":function(e,r){o(e,r);var i=e._index,a=e._values,s=r._index,u=r._values,c=0,l=t,f=n,p=0,m=0;for(;p<i.length&&m<s.length;){var d=i[p],h=s[m];d<h?p++:d>h?m++:d===h&&(c=l(c,f(a[p],u[m])),p++,m++)}return c}});function o(e,r){var t,n,i=s(e),a=s(r);if(1===i.length)t=i[0];else{if(2!==i.length||1!==i[1])throw new RangeError("Expected a column vector, instead got a matrix of size ("+i.join(", ")+")");t=i[0]}if(1===a.length)n=a[0];else{if(2!==a.length||1!==a[1])throw new RangeError("Expected a column vector, instead got a matrix of size ("+a.join(", ")+")");n=a[0]}if(t!==n)throw new RangeError("Vectors must have equal length ("+t+" != "+n+")");if(0===t)throw new RangeError("Cannot calculate the dot product of empty vectors");return t}function s(e){return p(e)?e.size():a(e)}})),Qf=ur("trace",["typed","matrix","add"],(e=>{var{typed:r,matrix:t,add:n}=e;return r("trace",{Array:function(e){return i(t(e))},SparseMatrix:function(e){var r=e._values,t=e._index,i=e._ptr,a=e._size,o=a[0],s=a[1];if(o===s){var u=0;if(r.length>0)for(var c=0;c<s;c++)for(var l=i[c],f=i[c+1],p=l;p<f;p++){var m=t[p];if(m===c){u=n(u,r[p]);break}if(m>c)break}return u}throw new RangeError("Matrix must be square (size: "+_e(a)+")")},DenseMatrix:i,any:G});function i(e){var r=e._size,t=e._data;switch(r.length){case 1:if(1===r[0])return G(t[0]);throw new RangeError("Matrix must be square (size: "+_e(r)+")");case 2:var i=r[0];if(i===r[1]){for(var a=0,o=0;o<i;o++)a=n(a,t[o][o]);return a}throw new RangeError("Matrix must be square (size: "+_e(r)+")");default:throw new RangeError("Matrix must be two dimensional (size: "+_e(r)+")")}}})),Kf="index",ep=ur(Kf,["typed","Index"],(e=>{var{typed:r,Index:t}=e;return r(Kf,{"...number | string | BigNumber | Range | Array | Matrix":function(e){var r=e.map((function(e){return o(e)?e.toNumber():Array.isArray(e)||p(e)?e.map((function(e){return o(e)?e.toNumber():e})):e})),n=new t;return t.apply(n,r),n}})})),rp=new Set(["end"]),tp=ur("Node",["mathWithTransform"],(e=>{var{mathWithTransform:r}=e;return class{get type(){return"Node"}get isNode(){return!0}evaluate(e){return this.compile().evaluate(e)}compile(){var e=this._compile(r,{}),t={};return{evaluate:function(r){var n=xr(r);return function(e){for(var r of[...rp])if(e.has(r))throw new Error('Scope contains an illegal symbol, "'+r+'" is a reserved keyword')}(n),e(n,t,null)}}}_compile(e,r){throw new Error("Method _compile must be implemented by type "+this.type)}forEach(e){throw new Error("Cannot run forEach on a Node interface")}map(e){throw new Error("Cannot run map on a Node interface")}_ifNode(e){if(!k(e))throw new TypeError("Callback function must return a Node");return e}traverse(e){e(this,null,null),function e(r,t){r.forEach((function(r,n,i){t(r,n,i),e(r,t)}))}(this,e)}transform(e){return function r(t,n,i){var a=e(t,n,i);return a!==t?a:t.map(r)}(this,null,null)}filter(e){var r=[];return this.traverse((function(t,n,i){e(t,n,i)&&r.push(t)})),r}clone(){throw new Error("Cannot clone a Node interface")}cloneDeep(){return this.map((function(e){return e.cloneDeep()}))}equals(e){return!!e&&(this.type===e.type&&W(this,e))}toString(e){var r=this._getCustomString(e);return void 0!==r?r:this._toString(e)}toJSON(){throw new Error("Cannot serialize object: toJSON not implemented by "+this.type)}toHTML(e){var r=this._getCustomString(e);return void 0!==r?r:this.toHTML(e)}_toString(){throw new Error("_toString not implemented for "+this.type)}toTex(e){var r=this._getCustomString(e);return void 0!==r?r:this._toTex(e)}_toTex(e){throw new Error("_toTex not implemented for "+this.type)}_getCustomString(e){if(e&&"object"==typeof e)switch(typeof e.handler){case"object":case"undefined":return;case"function":return e.handler(this,e);default:throw new TypeError("Object or function expected as callback")}}getIdentifier(){return this.type}getContent(){return this}}}),{isClass:!0,isNode:!0});function np(e){return e&&e.isIndexError?new Pe(e.index+1,e.min+1,void 0!==e.max?e.max+1:void 0):e}function ip(e){var{subset:r}=e;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"==typeof e){if(!t.isObjectProperty())throw new TypeError("Cannot apply a numeric index as object property");return lr(e,t.getObjectProperty())}throw new TypeError("Cannot apply index: unsupported type of object")}catch(e){throw np(e)}}}var ap="AccessorNode",op=ur(ap,["subset","Node"],(e=>{var{subset:r,Node:t}=e,n=ip({subset:r});function i(e){return!(S(e)||M(e)||O(e)||q(e)||R(e)||U(e)||H(e))}class a extends t{constructor(e,r){if(super(),!k(e))throw new TypeError('Node expected for parameter "object"');if(!I(r))throw new TypeError('IndexNode expected for parameter "index"');this.object=e,this.index=r}get name(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}get type(){return ap}get isAccessorNode(){return!0}_compile(e,r){var t=this.object._compile(e,r),i=this.index._compile(e,r);if(this.index.isObjectProperty()){var a=this.index.getObjectProperty();return function(e,r,n){return lr(t(e,r,n),a)}}return function(e,r,a){var o=t(e,r,a),s=i(e,r,o);return n(o,s)}}forEach(e){e(this.object,"object",this),e(this.index,"index",this)}map(e){return new a(this._ifNode(e(this.object,"object",this)),this._ifNode(e(this.index,"index",this)))}clone(){return new a(this.object,this.index)}_toString(e){var r=this.object.toString(e);return i(this.object)&&(r="("+r+")"),r+this.index.toString(e)}toHTML(e){var r=this.object.toHTML(e);return i(this.object)&&(r='<span class="math-parenthesis math-round-parenthesis">(</span>'+r+'<span class="math-parenthesis math-round-parenthesis">)</span>'),r+this.index.toHTML(e)}_toTex(e){var r=this.object.toTex(e);return i(this.object)&&(r="\\left(' + object + '\\right)"),r+this.index.toTex(e)}toJSON(){return{mathjs:ap,object:this.object,index:this.index}}static fromJSON(e){return new a(e.object,e.index)}}return(0,Tu.Z)(a,"name",ap),a}),{isClass:!0,isNode:!0}),sp="ArrayNode",up=ur(sp,["Node"],(e=>{var{Node:r}=e;class t extends r{constructor(e){if(super(),this.items=e||[],!Array.isArray(this.items)||!this.items.every(k))throw new TypeError("Array containing Nodes expected")}get type(){return sp}get isArrayNode(){return!0}_compile(e,r){var t=er(this.items,(function(t){return t._compile(e,r)}));if("Array"!==e.config.matrix){var n=e.matrix;return function(e,r,i){return n(er(t,(function(t){return t(e,r,i)})))}}return function(e,r,n){return er(t,(function(t){return t(e,r,n)}))}}forEach(e){for(var r=0;r<this.items.length;r++){e(this.items[r],"items["+r+"]",this)}}map(e){for(var r=[],n=0;n<this.items.length;n++)r[n]=this._ifNode(e(this.items[n],"items["+n+"]",this));return new t(r)}clone(){return new t(this.items.slice(0))}_toString(e){return"["+this.items.map((function(r){return r.toString(e)})).join(", ")+"]"}toJSON(){return{mathjs:sp,items:this.items}}static fromJSON(e){return new t(e.items)}toHTML(e){return'<span class="math-parenthesis math-square-parenthesis">[</span>'+this.items.map((function(r){return r.toHTML(e)})).join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-square-parenthesis">]</span>'}_toTex(e){return function r(t,n){var i=t.some(M)&&!t.every(M),a=n||i,o=a?"&":"\\\\",s=t.map((function(t){return t.items?r(t.items,!n):t.toTex(e)})).join(o);return i||!a||a&&!n?"\\begin{bmatrix}"+s+"\\end{bmatrix}":s}(this.items,!1)}}return(0,Tu.Z)(t,"name",sp),t}),{isClass:!0,isNode:!0});var cp=[{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 lp(e,r){if(!r||"auto"!==r)return e;for(var t=e;U(t);)t=t.content;return t}function fp(e,r,t,n){var i=e;"keep"!==r&&(i=e.getContent());for(var a=i.getIdentifier(),o=null,s=0;s<cp.length;s++)if(a in cp[s]){o=s;break}if("OperatorNode:multiply"===a&&i.implicit&&"show"!==t){var u=lp(i.args[0],r);O(u)&&n&&"OperatorNode:divide"===n.getIdentifier()&&_(lp(n.args[0],r))||"OperatorNode:divide"===u.getIdentifier()&&_(lp(u.args[0],r))&&O(lp(u.args[1]))||(o+=1)}return o}function pp(e,r){var t=e;"keep"!==r&&(t=e.getContent());var n=t.getIdentifier(),i=fp(t,r);if(null===i)return null;var a=cp[i][n];if(Y(a,"associativity")){if("left"===a.associativity)return"left";if("right"===a.associativity)return"right";throw Error("'"+n+"' has the invalid associativity '"+a.associativity+"'.")}return null}function mp(e,r,t){var n="keep"!==t?e.getContent():e,i="keep"!==t?e.getContent():r,a=n.getIdentifier(),o=i.getIdentifier(),s=fp(n,t);if(null===s)return null;var u=cp[s][a];if(Y(u,"associativeWith")&&u.associativeWith instanceof Array){for(var c=0;c<u.associativeWith.length;c++)if(u.associativeWith[c]===o)return!0;return!1}return null}var dp="AssignmentNode",hp=ur(dp,["subset","?matrix","Node"],(e=>{var{subset:r,matrix:t,Node:n}=e,i=ip({subset:r}),a=function(e){var{subset:r,matrix:t}=e;return function(e,n,i){try{if(Array.isArray(e))return t(e).subset(n,i).valueOf();if(e&&"function"==typeof e.subset)return e.subset(n,i);if("string"==typeof e)return r(e,n,i);if("object"==typeof e){if(!n.isObjectProperty())throw TypeError("Cannot apply a numeric index as object property");return fr(e,n.getObjectProperty(),i),e}throw new TypeError("Cannot apply index: unsupported type of object")}catch(e){throw np(e)}}}({subset:r,matrix:t});function o(e,r,t){r||(r="keep");var n=fp(e,r,t),i=fp(e.value,r,t);return"all"===r||null!==i&&i<=n}class s extends n{constructor(e,r,t){if(super(),this.object=e,this.index=t?r:null,this.value=t||r,!H(e)&&!S(e))throw new TypeError('SymbolNode or AccessorNode expected as "object"');if(H(e)&&"end"===e.name)throw new Error('Cannot assign to symbol "end"');if(this.index&&!I(this.index))throw new TypeError('IndexNode expected as "index"');if(!k(this.value))throw new TypeError('Node expected as "value"')}get name(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}get type(){return dp}get isAssignmentNode(){return!0}_compile(e,r){var t=this.object._compile(e,r),n=this.index?this.index._compile(e,r):null,o=this.value._compile(e,r),s=this.object.name;if(this.index){if(this.index.isObjectProperty()){var u=this.index.getObjectProperty();return function(e,r,n){var i=t(e,r,n),a=o(e,r,n);return fr(i,u,a),a}}if(H(this.object))return function(e,r,i){var u=t(e,r,i),c=o(e,r,i),l=n(e,r,u);return e.set(s,a(u,l,c)),c};var c=this.object.object._compile(e,r);if(this.object.index.isObjectProperty()){var l=this.object.index.getObjectProperty();return function(e,r,t){var i=c(e,r,t),s=lr(i,l),u=n(e,r,s),f=o(e,r,t);return fr(i,l,a(s,u,f)),f}}var f=this.object.index._compile(e,r);return function(e,r,t){var s=c(e,r,t),u=f(e,r,s),l=i(s,u),p=n(e,r,l),m=o(e,r,t);return a(s,u,a(l,p,m)),m}}if(!H(this.object))throw new TypeError("SymbolNode expected as object");return function(e,r,t){var n=o(e,r,t);return e.set(s,n),n}}forEach(e){e(this.object,"object",this),this.index&&e(this.index,"index",this),e(this.value,"value",this)}map(e){var r=this._ifNode(e(this.object,"object",this)),t=this.index?this._ifNode(e(this.index,"index",this)):null,n=this._ifNode(e(this.value,"value",this));return new s(r,t,n)}clone(){return new s(this.object,this.index,this.value)}_toString(e){var r=this.object.toString(e),t=this.index?this.index.toString(e):"",n=this.value.toString(e);return o(this,e&&e.parenthesis,e&&e.implicit)&&(n="("+n+")"),r+t+" = "+n}toJSON(){return{mathjs:dp,object:this.object,index:this.index,value:this.value}}static fromJSON(e){return new s(e.object,e.index,e.value)}toHTML(e){var r=this.object.toHTML(e),t=this.index?this.index.toHTML(e):"",n=this.value.toHTML(e);return o(this,e&&e.parenthesis,e&&e.implicit)&&(n='<span class="math-paranthesis math-round-parenthesis">(</span>'+n+'<span class="math-paranthesis math-round-parenthesis">)</span>'),r+t+'<span class="math-operator math-assignment-operator math-variable-assignment-operator math-binary-operator">=</span>'+n}_toTex(e){var r=this.object.toTex(e),t=this.index?this.index.toTex(e):"",n=this.value.toTex(e);return o(this,e&&e.parenthesis,e&&e.implicit)&&(n="\\left(".concat(n,"\\right)")),r+t+":="+n}}return(0,Tu.Z)(s,"name",dp),s}),{isClass:!0,isNode:!0}),gp="BlockNode",yp=ur(gp,["ResultSet","Node"],(e=>{var{ResultSet:r,Node:t}=e;class n extends t{constructor(e){if(super(),!Array.isArray(e))throw new Error("Array expected");this.blocks=e.map((function(e){var r=e&&e.node,t=!e||void 0===e.visible||e.visible;if(!k(r))throw new TypeError('Property "node" must be a Node');if("boolean"!=typeof t)throw new TypeError('Property "visible" must be a boolean');return{node:r,visible:t}}))}get type(){return gp}get isBlockNode(){return!0}_compile(e,t){var n=er(this.blocks,(function(r){return{evaluate:r.node._compile(e,t),visible:r.visible}}));return function(e,t,i){var a=[];return rr(n,(function(r){var n=r.evaluate(e,t,i);r.visible&&a.push(n)})),new r(a)}}forEach(e){for(var r=0;r<this.blocks.length;r++)e(this.blocks[r].node,"blocks["+r+"].node",this)}map(e){for(var r=[],t=0;t<this.blocks.length;t++){var i=this.blocks[t],a=this._ifNode(e(i.node,"blocks["+t+"].node",this));r[t]={node:a,visible:i.visible}}return new n(r)}clone(){var e=this.blocks.map((function(e){return{node:e.node,visible:e.visible}}));return new n(e)}_toString(e){return this.blocks.map((function(r){return r.node.toString(e)+(r.visible?"":";")})).join("\n")}toJSON(){return{mathjs:gp,blocks:this.blocks}}static fromJSON(e){return new n(e.blocks)}toHTML(e){return this.blocks.map((function(r){return r.node.toHTML(e)+(r.visible?"":'<span class="math-separator">;</span>')})).join('<span class="math-separator"><br /></span>')}_toTex(e){return this.blocks.map((function(r){return r.node.toTex(e)+(r.visible?"":";")})).join("\\;\\;\n")}}return(0,Tu.Z)(n,"name",gp),n}),{isClass:!0,isNode:!0}),vp="ConditionalNode",xp=ur(vp,["Node"],(e=>{var{Node:r}=e;class t extends r{constructor(e,r,t){if(super(),!k(e))throw new TypeError("Parameter condition must be a Node");if(!k(r))throw new TypeError("Parameter trueExpr must be a Node");if(!k(t))throw new TypeError("Parameter falseExpr must be a Node");this.condition=e,this.trueExpr=r,this.falseExpr=t}get type(){return vp}get isConditionalNode(){return!0}_compile(e,r){var t=this.condition._compile(e,r),n=this.trueExpr._compile(e,r),i=this.falseExpr._compile(e,r);return function(e,r,a){return function(e){if("number"==typeof e||"boolean"==typeof e||"string"==typeof e)return!!e;if(e){if(o(e))return!e.isZero();if(s(e))return!(!e.re&&!e.im);if(c(e))return!!e.value}if(null==e)return!1;throw new TypeError('Unsupported type of condition "'+Z(e)+'"')}(t(e,r,a))?n(e,r,a):i(e,r,a)}}forEach(e){e(this.condition,"condition",this),e(this.trueExpr,"trueExpr",this),e(this.falseExpr,"falseExpr",this)}map(e){return new t(this._ifNode(e(this.condition,"condition",this)),this._ifNode(e(this.trueExpr,"trueExpr",this)),this._ifNode(e(this.falseExpr,"falseExpr",this)))}clone(){return new t(this.condition,this.trueExpr,this.falseExpr)}_toString(e){var r=e&&e.parenthesis?e.parenthesis:"keep",t=fp(this,r,e&&e.implicit),n=this.condition.toString(e),i=fp(this.condition,r,e&&e.implicit);("all"===r||"OperatorNode"===this.condition.type||null!==i&&i<=t)&&(n="("+n+")");var a=this.trueExpr.toString(e),o=fp(this.trueExpr,r,e&&e.implicit);("all"===r||"OperatorNode"===this.trueExpr.type||null!==o&&o<=t)&&(a="("+a+")");var s=this.falseExpr.toString(e),u=fp(this.falseExpr,r,e&&e.implicit);return("all"===r||"OperatorNode"===this.falseExpr.type||null!==u&&u<=t)&&(s="("+s+")"),n+" ? "+a+" : "+s}toJSON(){return{mathjs:vp,condition:this.condition,trueExpr:this.trueExpr,falseExpr:this.falseExpr}}static fromJSON(e){return new t(e.condition,e.trueExpr,e.falseExpr)}toHTML(e){var r=e&&e.parenthesis?e.parenthesis:"keep",t=fp(this,r,e&&e.implicit),n=this.condition.toHTML(e),i=fp(this.condition,r,e&&e.implicit);("all"===r||"OperatorNode"===this.condition.type||null!==i&&i<=t)&&(n='<span class="math-parenthesis math-round-parenthesis">(</span>'+n+'<span class="math-parenthesis math-round-parenthesis">)</span>');var a=this.trueExpr.toHTML(e),o=fp(this.trueExpr,r,e&&e.implicit);("all"===r||"OperatorNode"===this.trueExpr.type||null!==o&&o<=t)&&(a='<span class="math-parenthesis math-round-parenthesis">(</span>'+a+'<span class="math-parenthesis math-round-parenthesis">)</span>');var s=this.falseExpr.toHTML(e),u=fp(this.falseExpr,r,e&&e.implicit);return("all"===r||"OperatorNode"===this.falseExpr.type||null!==u&&u<=t)&&(s='<span class="math-parenthesis math-round-parenthesis">(</span>'+s+'<span class="math-parenthesis math-round-parenthesis">)</span>'),n+'<span class="math-operator math-conditional-operator">?</span>'+a+'<span class="math-operator math-conditional-operator">:</span>'+s}_toTex(e){return"\\begin{cases} {"+this.trueExpr.toTex(e)+"}, &\\quad{\\text{if }\\;"+this.condition.toTex(e)+"}\\\\{"+this.falseExpr.toTex(e)+"}, &\\quad{\\text{otherwise}}\\end{cases}"}}return(0,Tu.Z)(t,"name",vp),t}),{isClass:!0,isNode:!0}),bp=t(93907),wp={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{?}"},Np={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"},Dp={abs:{1:"\\left|${args[0]}\\right|"},add:{2:"\\left(${args[0]}".concat(Np.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(Np.dotDivide,"${args[1]}\\right)")},dotMultiply:{2:"\\left(${args[0]}".concat(Np.dotMultiply,"${args[1]}\\right)")},dotPow:{2:"\\left(${args[0]}".concat(Np.dotPow,"${args[1]}\\right)")},exp:{1:"\\exp\\left(${args[0]}\\right)"},expm1:"\\left(e".concat(Np.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(Np.mod,"${args[1]}\\right)")},multiply:{2:"\\left(${args[0]}".concat(Np.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(Np.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(Np.subtract,"${args[1]}\\right)")},unaryMinus:{1:"".concat(Np.unaryMinus,"\\left(${args[0]}\\right)")},unaryPlus:{1:"".concat(Np.unaryPlus,"\\left(${args[0]}\\right)")},bitAnd:{2:"\\left(${args[0]}".concat(Np.bitAnd,"${args[1]}\\right)")},bitNot:{1:Np.bitNot+"\\left(${args[0]}\\right)"},bitOr:{2:"\\left(${args[0]}".concat(Np.bitOr,"${args[1]}\\right)")},bitXor:{2:"\\left(${args[0]}".concat(Np.bitXor,"${args[1]}\\right)")},leftShift:{2:"\\left(${args[0]}".concat(Np.leftShift,"${args[1]}\\right)")},rightArithShift:{2:"\\left(${args[0]}".concat(Np.rightArithShift,"${args[1]}\\right)")},rightLogShift:{2:"\\left(${args[0]}".concat(Np.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(Np.and,"${args[1]}\\right)")},not:{1:Np.not+"\\left(${args[0]}\\right)"},or:{2:"\\left(${args[0]}".concat(Np.or,"${args[1]}\\right)")},xor:{2:"\\left(${args[0]}".concat(Np.xor,"${args[1]}\\right)")},cross:{2:"\\left(${args[0]}\\right)\\times\\left(${args[1]}\\right)"},ctranspose:{1:"\\left(${args[0]}\\right)".concat(Np.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(Np.pow,"{\\frac{1}{2}}")},trace:{1:"\\mathrm{tr}\\left(${args[0]}\\right)"},transpose:{1:"\\left(${args[0]}\\right)".concat(Np.transpose)},combinations:{2:"\\binom{${args[0]}}{${args[1]}}"},combinationsWithRep:{2:"\\left(\\!\\!{\\binom{${args[0]}}{${args[1]}}}\\!\\!\\right)"},factorial:{1:"\\left(${args[0]}\\right)".concat(Np.factorial)},gamma:{1:"\\Gamma\\left(${args[0]}\\right)"},lgamma:{1:"\\ln\\Gamma\\left(${args[0]}\\right)"},equal:{2:"\\left(${args[0]}".concat(Np.equal,"${args[1]}\\right)")},larger:{2:"\\left(${args[0]}".concat(Np.larger,"${args[1]}\\right)")},largerEq:{2:"\\left(${args[0]}".concat(Np.largerEq,"${args[1]}\\right)")},smaller:{2:"\\left(${args[0]}".concat(Np.smaller,"${args[1]}\\right)")},smallerEq:{2:"\\left(${args[0]}".concat(Np.smallerEq,"${args[1]}\\right)")},unequal:{2:"\\left(${args[0]}".concat(Np.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(Np.to,"${args[1]}\\right)")},numeric:function(e,r){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(wp.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)"}},Ep={deg:"^\\circ"};function Ap(e){return bp(e,{preserveFormatting:!0})}function Cp(e,r){return(r=void 0!==r&&r)?Y(Ep,e)?Ep[e]:"\\mathrm{"+Ap(e)+"}":Y(wp,e)?wp[e]:Ap(e)}var Sp="ConstantNode",Mp=ur(Sp,["Node"],(e=>{var{Node:r}=e;class t extends r{constructor(e){super(),this.value=e}get type(){return Sp}get isConstantNode(){return!0}_compile(e,r){var t=this.value;return function(){return t}}forEach(e){}map(e){return this.clone()}clone(){return new t(this.value)}_toString(e){return _e(this.value,e)}toHTML(e){var r=this._toString(e);switch(Z(this.value)){case"number":case"BigNumber":case"Fraction":return'<span class="math-number">'+r+"</span>";case"string":return'<span class="math-string">'+r+"</span>";case"boolean":return'<span class="math-boolean">'+r+"</span>";case"null":return'<span class="math-null-symbol">'+r+"</span>";case"undefined":return'<span class="math-undefined">'+r+"</span>";default:return'<span class="math-symbol">'+r+"</span>"}}toJSON(){return{mathjs:Sp,value:this.value}}static fromJSON(e){return new t(e.value)}_toTex(e){var r=this._toString(e);switch(Z(this.value)){case"string":return"\\mathtt{"+Ap(r)+"}";case"number":case"BigNumber":if(!isFinite(this.value))return this.value.valueOf()<0?"-\\infty":"\\infty";var t=r.toLowerCase().indexOf("e");return-1!==t?r.substring(0,t)+"\\cdot10^{"+r.substring(t+1)+"}":r;case"Fraction":return this.value.toLatex();default:return r}}}return(0,Tu.Z)(t,"name",Sp),t}),{isClass:!0,isNode:!0}),Fp="FunctionAssignmentNode",Bp=ur(Fp,["typed","Node"],(e=>{var{typed:r,Node:t}=e;function n(e,r,t){var n=fp(e,r,t),i=fp(e.expr,r,t);return"all"===r||null!==i&&i<=n}class i extends t{constructor(e,r,t){if(super(),"string"!=typeof e)throw new TypeError('String expected for parameter "name"');if(!Array.isArray(r))throw new TypeError('Array containing strings or objects expected for parameter "params"');if(!k(t))throw new TypeError('Node expected for parameter "expr"');if(rp.has(e))throw new Error('Illegal function name, "'+e+'" is a reserved keyword');var n=new Set;for(var i of r){var a="string"==typeof i?i:i.name;if(n.has(a))throw new Error('Duplicate parameter name "'.concat(a,'"'));n.add(a)}this.name=e,this.params=r.map((function(e){return e&&e.name||e})),this.types=r.map((function(e){return e&&e.type||"any"})),this.expr=t}get type(){return Fp}get isFunctionAssignmentNode(){return!0}_compile(e,t){var n=Object.create(t);rr(this.params,(function(e){n[e]=!0}));var i=this.expr._compile(e,n),a=this.name,o=this.params,s=ir(this.types,","),u=a+"("+ir(this.params,", ")+")";return function(e,t,n){var c={};c[s]=function(){for(var r=Object.create(t),a=0;a<o.length;a++)r[o[a]]=arguments[a];return i(e,r,n)};var l=r(a,c);return l.syntax=u,e.set(a,l),l}}forEach(e){e(this.expr,"expr",this)}map(e){var r=this._ifNode(e(this.expr,"expr",this));return new i(this.name,this.params.slice(0),r)}clone(){return new i(this.name,this.params.slice(0),this.expr)}_toString(e){var r=e&&e.parenthesis?e.parenthesis:"keep",t=this.expr.toString(e);return n(this,r,e&&e.implicit)&&(t="("+t+")"),this.name+"("+this.params.join(", ")+") = "+t}toJSON(){var e=this.types;return{mathjs:Fp,name:this.name,params:this.params.map((function(r,t){return{name:r,type:e[t]}})),expr:this.expr}}static fromJSON(e){return new i(e.name,e.params,e.expr)}toHTML(e){for(var r=e&&e.parenthesis?e.parenthesis:"keep",t=[],i=0;i<this.params.length;i++)t.push('<span class="math-symbol math-parameter">'+qe(this.params[i])+"</span>");var a=this.expr.toHTML(e);return n(this,r,e&&e.implicit)&&(a='<span class="math-parenthesis math-round-parenthesis">(</span>'+a+'<span class="math-parenthesis math-round-parenthesis">)</span>'),'<span class="math-function">'+qe(this.name)+'</span><span class="math-parenthesis math-round-parenthesis">(</span>'+t.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-round-parenthesis">)</span><span class="math-operator math-assignment-operator math-variable-assignment-operator math-binary-operator">=</span>'+a}_toTex(e){var r=e&&e.parenthesis?e.parenthesis:"keep",t=this.expr.toTex(e);return n(this,r,e&&e.implicit)&&(t="\\left(".concat(t,"\\right)")),"\\mathrm{"+this.name+"}\\left("+this.params.map(Cp).join(",")+"\\right):="+t}}return(0,Tu.Z)(i,"name",Fp),i}),{isClass:!0,isNode:!0}),Tp="IndexNode",Op=ur(Tp,["Node","size"],(e=>{var{Node:r,size:t}=e;class n extends r{constructor(e,r){if(super(),this.dimensions=e,this.dotNotation=r||!1,!Array.isArray(e)||!e.every(k))throw new TypeError('Array containing Nodes expected for parameter "dimensions"');if(this.dotNotation&&!this.isObjectProperty())throw new Error("dotNotation only applicable for object properties")}get type(){return Tp}get isIndexNode(){return!0}_compile(e,r){var n=er(this.dimensions,(function(n,i){if(n.filter((e=>e.isSymbolNode&&"end"===e.name)).length>0){var a=Object.create(r);a.end=!0;var o=n._compile(e,a);return function(e,r,n){if(!p(n)&&!f(n)&&!l(n))throw new TypeError('Cannot resolve "end": context must be a Matrix, Array, or string but is '+Z(n));var a=t(n).valueOf(),s=Object.create(r);return s.end=a[i],o(e,s,n)}}return n._compile(e,r)})),i=lr(e,"index");return function(e,r,t){var a=er(n,(function(n){return n(e,r,t)}));return i(...a)}}forEach(e){for(var r=0;r<this.dimensions.length;r++)e(this.dimensions[r],"dimensions["+r+"]",this)}map(e){for(var r=[],t=0;t<this.dimensions.length;t++)r[t]=this._ifNode(e(this.dimensions[t],"dimensions["+t+"]",this));return new n(r,this.dotNotation)}clone(){return new n(this.dimensions.slice(0),this.dotNotation)}isObjectProperty(){return 1===this.dimensions.length&&O(this.dimensions[0])&&"string"==typeof this.dimensions[0].value}getObjectProperty(){return this.isObjectProperty()?this.dimensions[0].value:null}_toString(e){return this.dotNotation?"."+this.getObjectProperty():"["+this.dimensions.join(", ")+"]"}toJSON(){return{mathjs:Tp,dimensions:this.dimensions,dotNotation:this.dotNotation}}static fromJSON(e){return new n(e.dimensions,e.dotNotation)}toHTML(e){for(var r=[],t=0;t<this.dimensions.length;t++)r[t]=this.dimensions[t].toHTML();return this.dotNotation?'<span class="math-operator math-accessor-operator">.</span><span class="math-symbol math-property">'+qe(this.getObjectProperty())+"</span>":'<span class="math-parenthesis math-square-parenthesis">[</span>'+r.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-square-parenthesis">]</span>'}_toTex(e){var r=this.dimensions.map((function(r){return r.toTex(e)}));return this.dotNotation?"."+this.getObjectProperty():"_{"+r.join(",")+"}"}}return(0,Tu.Z)(n,"name",Tp),n}),{isClass:!0,isNode:!0}),_p="ObjectNode",zp=ur(_p,["Node"],(e=>{var{Node:r}=e;class t extends r{constructor(e){if(super(),this.properties=e||{},e&&("object"!=typeof e||!Object.keys(e).every((function(r){return k(e[r])}))))throw new TypeError("Object containing Nodes expected")}get type(){return _p}get isObjectNode(){return!0}_compile(e,r){var t={};for(var n in this.properties)if(Y(this.properties,n)){var i=ze(n),a=JSON.parse(i),o=lr(this.properties,n);t[a]=o._compile(e,r)}return function(e,r,n){var i={};for(var a in t)Y(t,a)&&(i[a]=t[a](e,r,n));return i}}forEach(e){for(var r in this.properties)Y(this.properties,r)&&e(this.properties[r],"properties["+ze(r)+"]",this)}map(e){var r={};for(var n in this.properties)Y(this.properties,n)&&(r[n]=this._ifNode(e(this.properties[n],"properties["+ze(n)+"]",this)));return new t(r)}clone(){var e={};for(var r in this.properties)Y(this.properties,r)&&(e[r]=this.properties[r]);return new t(e)}_toString(e){var r=[];for(var t in this.properties)Y(this.properties,t)&&r.push(ze(t)+": "+this.properties[t].toString(e));return"{"+r.join(", ")+"}"}toJSON(){return{mathjs:_p,properties:this.properties}}static fromJSON(e){return new t(e.properties)}toHTML(e){var r=[];for(var t in this.properties)Y(this.properties,t)&&r.push('<span class="math-symbol math-property">'+qe(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>'}_toTex(e){var r=[];for(var t in this.properties)Y(this.properties,t)&&r.push("\\mathbf{"+t+":} & "+this.properties[t].toTex(e)+"\\\\");return"\\left\\{\\begin{array}{ll}"+r.join("\n")+"\\end{array}\\right\\}"}}return(0,Tu.Z)(t,"name",_p),t}),{isClass:!0,isNode:!0}),qp="OperatorNode",Ip=ur(qp,["Node"],(e=>{var{Node:r}=e;function t(e,r){var n=e;if("auto"===r)for(;U(n);)n=n.content;return!!O(n)||!!P(n)&&t(n.args[0],r)}function n(e,r,n,i,a){var o,s=fp(e,r,n),u=pp(e,r);if("all"===r||i.length>2&&"OperatorNode:add"!==e.getIdentifier()&&"OperatorNode:multiply"!==e.getIdentifier())return i.map((function(e){switch(e.getContent().type){case"ArrayNode":case"ConstantNode":case"SymbolNode":case"ParenthesisNode":return!1;default:return!0}}));switch(i.length){case 0:o=[];break;case 1:var c=fp(i[0],r,n,e);if(a&&null!==c){var l,f;if("keep"===r?(l=i[0].getIdentifier(),f=e.getIdentifier()):(l=i[0].getContent().getIdentifier(),f=e.getContent().getIdentifier()),!1===cp[s][f].latexLeftParens){o=[!1];break}if(!1===cp[c][l].latexParens){o=[!1];break}}if(null===c){o=[!1];break}if(c<=s){o=[!0];break}o=[!1];break;case 2:var p,m,d=fp(i[0],r,n,e),h=mp(e,i[0],r);p=null!==d&&(d===s&&"right"===u&&!h||d<s);var g,y,v,x=fp(i[1],r,n,e),b=mp(e,i[1],r);if(m=null!==x&&(x===s&&"left"===u&&!b||x<s),a)"keep"===r?(g=e.getIdentifier(),y=e.args[0].getIdentifier(),v=e.args[1].getIdentifier()):(g=e.getContent().getIdentifier(),y=e.args[0].getContent().getIdentifier(),v=e.args[1].getContent().getIdentifier()),null!==d&&(!1===cp[s][g].latexLeftParens&&(p=!1),!1===cp[d][y].latexParens&&(p=!1)),null!==x&&(!1===cp[s][g].latexRightParens&&(m=!1),!1===cp[x][v].latexParens&&(m=!1));o=[p,m];break;default:"OperatorNode:add"!==e.getIdentifier()&&"OperatorNode:multiply"!==e.getIdentifier()||(o=i.map((function(t){var i=fp(t,r,n,e),a=mp(e,t,r),o=pp(t,r);return null!==i&&(s===i&&u===o&&!a||i<s)})))}if(i.length>=2&&"OperatorNode:multiply"===e.getIdentifier()&&e.implicit&&"all"!==r&&"hide"===n)for(var w=1;w<o.length;++w)!t(i[w],r)||o[w-1]||"keep"===r&&U(i[w-1])||(o[w]=!0);return o}class i extends r{constructor(e,r,t,n,i){if(super(),"string"!=typeof e)throw new TypeError('string expected for parameter "op"');if("string"!=typeof r)throw new TypeError('string expected for parameter "fn"');if(!Array.isArray(t)||!t.every(k))throw new TypeError('Array containing Nodes expected for parameter "args"');this.implicit=!0===n,this.isPercentage=!0===i,this.op=e,this.fn=r,this.args=t||[]}get type(){return qp}get isOperatorNode(){return!0}_compile(e,r){if("string"!=typeof this.fn||!mr(e,this.fn))throw e[this.fn]?new Error('No access to function "'+this.fn+'"'):new Error("Function "+this.fn+' missing in provided namespace "math"');var t=lr(e,this.fn),n=er(this.args,(function(t){return t._compile(e,r)}));if(1===n.length){var i=n[0];return function(e,r,n){return t(i(e,r,n))}}if(2===n.length){var a=n[0],o=n[1];return function(e,r,n){return t(a(e,r,n),o(e,r,n))}}return function(e,r,i){return t.apply(null,er(n,(function(t){return t(e,r,i)})))}}forEach(e){for(var r=0;r<this.args.length;r++)e(this.args[r],"args["+r+"]",this)}map(e){for(var r=[],t=0;t<this.args.length;t++)r[t]=this._ifNode(e(this.args[t],"args["+t+"]",this));return new i(this.op,this.fn,r,this.implicit,this.isPercentage)}clone(){return new i(this.op,this.fn,this.args.slice(0),this.implicit,this.isPercentage)}isUnary(){return 1===this.args.length}isBinary(){return 2===this.args.length}_toString(e){var r=e&&e.parenthesis?e.parenthesis:"keep",t=e&&e.implicit?e.implicit:"hide",i=this.args,a=n(this,r,t,i,!1);if(1===i.length){var o=pp(this,r),s=i[0].toString(e);a[0]&&(s="("+s+")");var u=/[a-zA-Z]+/.test(this.op);return"right"===o?this.op+(u?" ":"")+s:"left"===o?s+(u?" ":"")+this.op:s+this.op}if(2===i.length){var c=i[0].toString(e),l=i[1].toString(e);return a[0]&&(c="("+c+")"),a[1]&&(l="("+l+")"),this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===t?c+" "+l:c+" "+this.op+" "+l}if(i.length>2&&("OperatorNode:add"===this.getIdentifier()||"OperatorNode:multiply"===this.getIdentifier())){var f=i.map((function(r,t){return r=r.toString(e),a[t]&&(r="("+r+")"),r}));return this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===t?f.join(" "):f.join(" "+this.op+" ")}return this.fn+"("+this.args.join(", ")+")"}toJSON(){return{mathjs:qp,op:this.op,fn:this.fn,args:this.args,implicit:this.implicit,isPercentage:this.isPercentage}}static fromJSON(e){return new i(e.op,e.fn,e.args,e.implicit,e.isPercentage)}toHTML(e){var r=e&&e.parenthesis?e.parenthesis:"keep",t=e&&e.implicit?e.implicit:"hide",i=this.args,a=n(this,r,t,i,!1);if(1===i.length){var o=pp(this,r),s=i[0].toHTML(e);return a[0]&&(s='<span class="math-parenthesis math-round-parenthesis">(</span>'+s+'<span class="math-parenthesis math-round-parenthesis">)</span>'),"right"===o?'<span class="math-operator math-unary-operator math-lefthand-unary-operator">'+qe(this.op)+"</span>"+s:s+'<span class="math-operator math-unary-operator math-righthand-unary-operator">'+qe(this.op)+"</span>"}if(2===i.length){var u=i[0].toHTML(e),c=i[1].toHTML(e);return a[0]&&(u='<span class="math-parenthesis math-round-parenthesis">(</span>'+u+'<span class="math-parenthesis math-round-parenthesis">)</span>'),a[1]&&(c='<span class="math-parenthesis math-round-parenthesis">(</span>'+c+'<span class="math-parenthesis math-round-parenthesis">)</span>'),this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===t?u+'<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>'+c:u+'<span class="math-operator math-binary-operator math-explicit-binary-operator">'+qe(this.op)+"</span>"+c}var l=i.map((function(r,t){return r=r.toHTML(e),a[t]&&(r='<span class="math-parenthesis math-round-parenthesis">(</span>'+r+'<span class="math-parenthesis math-round-parenthesis">)</span>'),r}));return i.length>2&&("OperatorNode:add"===this.getIdentifier()||"OperatorNode:multiply"===this.getIdentifier())?this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===t?l.join('<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>'):l.join('<span class="math-operator math-binary-operator math-explicit-binary-operator">'+qe(this.op)+"</span>"):'<span class="math-function">'+qe(this.fn)+'</span><span class="math-paranthesis math-round-parenthesis">(</span>'+l.join('<span class="math-separator">,</span>')+'<span class="math-paranthesis math-round-parenthesis">)</span>'}_toTex(e){var r=e&&e.parenthesis?e.parenthesis:"keep",t=e&&e.implicit?e.implicit:"hide",i=this.args,a=n(this,r,t,i,!0),o=Np[this.fn];if(o=void 0===o?this.op:o,1===i.length){var s=pp(this,r),u=i[0].toTex(e);return a[0]&&(u="\\left(".concat(u,"\\right)")),"right"===s?o+u:u+o}if(2===i.length){var c=i[0],l=c.toTex(e);a[0]&&(l="\\left(".concat(l,"\\right)"));var f,p=i[1].toTex(e);switch(a[1]&&(p="\\left(".concat(p,"\\right)")),f="keep"===r?c.getIdentifier():c.getContent().getIdentifier(),this.getIdentifier()){case"OperatorNode:divide":return o+"{"+l+"}{"+p+"}";case"OperatorNode:pow":switch(l="{"+l+"}",p="{"+p+"}",f){case"ConditionalNode":case"OperatorNode:divide":l="\\left(".concat(l,"\\right)")}break;case"OperatorNode:multiply":if(this.implicit&&"hide"===t)return l+"~"+p}return l+o+p}if(i.length>2&&("OperatorNode:add"===this.getIdentifier()||"OperatorNode:multiply"===this.getIdentifier())){var m=i.map((function(r,t){return r=r.toTex(e),a[t]&&(r="\\left(".concat(r,"\\right)")),r}));return"OperatorNode:multiply"===this.getIdentifier()&&this.implicit&&"hide"===t?m.join("~"):m.join(o)}return"\\mathrm{"+this.fn+"}\\left("+i.map((function(r){return r.toTex(e)})).join(",")+"\\right)"}getIdentifier(){return this.type+":"+this.fn}}return(0,Tu.Z)(i,"name",qp),i}),{isClass:!0,isNode:!0}),kp="ParenthesisNode",Rp=ur(kp,["Node"],(e=>{var{Node:r}=e;class t extends r{constructor(e){if(super(),!k(e))throw new TypeError('Node expected for parameter "content"');this.content=e}get type(){return kp}get isParenthesisNode(){return!0}_compile(e,r){return this.content._compile(e,r)}getContent(){return this.content.getContent()}forEach(e){e(this.content,"content",this)}map(e){var r=e(this.content,"content",this);return new t(r)}clone(){return new t(this.content)}_toString(e){return!e||e&&!e.parenthesis||e&&"keep"===e.parenthesis?"("+this.content.toString(e)+")":this.content.toString(e)}toJSON(){return{mathjs:kp,content:this.content}}static fromJSON(e){return new t(e.content)}toHTML(e){return!e||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)}_toTex(e){return!e||e&&!e.parenthesis||e&&"keep"===e.parenthesis?"\\left(".concat(this.content.toTex(e),"\\right)"):this.content.toTex(e)}}return(0,Tu.Z)(t,"name",kp),t}),{isClass:!0,isNode:!0}),Pp="RangeNode",Up=ur(Pp,["Node"],(e=>{var{Node:r}=e;function t(e,r,t){var n=fp(e,r,t),i={},a=fp(e.start,r,t);if(i.start=null!==a&&a<=n||"all"===r,e.step){var o=fp(e.step,r,t);i.step=null!==o&&o<=n||"all"===r}var s=fp(e.end,r,t);return i.end=null!==s&&s<=n||"all"===r,i}class n extends r{constructor(e,r,t){if(super(),!k(e))throw new TypeError("Node expected");if(!k(r))throw new TypeError("Node expected");if(t&&!k(t))throw new TypeError("Node expected");if(arguments.length>3)throw new Error("Too many arguments");this.start=e,this.end=r,this.step=t||null}get type(){return Pp}get isRangeNode(){return!0}needsEnd(){return this.filter((function(e){return H(e)&&"end"===e.name})).length>0}_compile(e,r){var t=e.range,n=this.start._compile(e,r),i=this.end._compile(e,r);if(this.step){var a=this.step._compile(e,r);return function(e,r,o){return t(n(e,r,o),i(e,r,o),a(e,r,o))}}return function(e,r,a){return t(n(e,r,a),i(e,r,a))}}forEach(e){e(this.start,"start",this),e(this.end,"end",this),this.step&&e(this.step,"step",this)}map(e){return new n(this._ifNode(e(this.start,"start",this)),this._ifNode(e(this.end,"end",this)),this.step&&this._ifNode(e(this.step,"step",this)))}clone(){return new n(this.start,this.end,this.step&&this.step)}_toString(e){var r,n=t(this,e&&e.parenthesis?e.parenthesis:"keep",e&&e.implicit),i=this.start.toString(e);if(n.start&&(i="("+i+")"),r=i,this.step){var a=this.step.toString(e);n.step&&(a="("+a+")"),r+=":"+a}var o=this.end.toString(e);return n.end&&(o="("+o+")"),r+=":"+o}toJSON(){return{mathjs:Pp,start:this.start,end:this.end,step:this.step}}static fromJSON(e){return new n(e.start,e.end,e.step)}toHTML(e){var r,n=t(this,e&&e.parenthesis?e.parenthesis:"keep",e&&e.implicit),i=this.start.toHTML(e);if(n.start&&(i='<span class="math-parenthesis math-round-parenthesis">(</span>'+i+'<span class="math-parenthesis math-round-parenthesis">)</span>'),r=i,this.step){var a=this.step.toHTML(e);n.step&&(a='<span class="math-parenthesis math-round-parenthesis">(</span>'+a+'<span class="math-parenthesis math-round-parenthesis">)</span>'),r+='<span class="math-operator math-range-operator">:</span>'+a}var o=this.end.toHTML(e);return n.end&&(o='<span class="math-parenthesis math-round-parenthesis">(</span>'+o+'<span class="math-parenthesis math-round-parenthesis">)</span>'),r+='<span class="math-operator math-range-operator">:</span>'+o}_toTex(e){var r=t(this,e&&e.parenthesis?e.parenthesis:"keep",e&&e.implicit),n=this.start.toTex(e);if(r.start&&(n="\\left(".concat(n,"\\right)")),this.step){var i=this.step.toTex(e);r.step&&(i="\\left(".concat(i,"\\right)")),n+=":"+i}var a=this.end.toTex(e);return r.end&&(a="\\left(".concat(a,"\\right)")),n+=":"+a}}return(0,Tu.Z)(n,"name",Pp),n}),{isClass:!0,isNode:!0}),jp="RelationalNode",Lp=ur(jp,["Node"],(e=>{var{Node:r}=e,t={equal:"==",unequal:"!=",smaller:"<",larger:">",smallerEq:"<=",largerEq:">="};class n extends r{constructor(e,r){if(super(),!Array.isArray(e))throw new TypeError("Parameter conditionals must be an array");if(!Array.isArray(r))throw new TypeError("Parameter params must be an array");if(e.length!==r.length-1)throw new TypeError("Parameter params must contain exactly one more element than parameter conditionals");this.conditionals=e,this.params=r}get type(){return jp}get isRelationalNode(){return!0}_compile(e,r){var t=this,n=this.params.map((t=>t._compile(e,r)));return function(r,i,a){for(var o,s=n[0](r,i,a),u=0;u<t.conditionals.length;u++){if(o=s,s=n[u+1](r,i,a),!lr(e,t.conditionals[u])(o,s))return!1}return!0}}forEach(e){this.params.forEach(((r,t)=>e(r,"params["+t+"]",this)),this)}map(e){return new n(this.conditionals.slice(),this.params.map(((r,t)=>this._ifNode(e(r,"params["+t+"]",this))),this))}clone(){return new n(this.conditionals,this.params)}_toString(e){for(var r=e&&e.parenthesis?e.parenthesis:"keep",n=fp(this,r,e&&e.implicit),i=this.params.map((function(t,i){var a=fp(t,r,e&&e.implicit);return"all"===r||null!==a&&a<=n?"("+t.toString(e)+")":t.toString(e)})),a=i[0],o=0;o<this.conditionals.length;o++)a+=" "+t[this.conditionals[o]],a+=" "+i[o+1];return a}toJSON(){return{mathjs:jp,conditionals:this.conditionals,params:this.params}}static fromJSON(e){return new n(e.conditionals,e.params)}toHTML(e){for(var r=e&&e.parenthesis?e.parenthesis:"keep",n=fp(this,r,e&&e.implicit),i=this.params.map((function(t,i){var a=fp(t,r,e&&e.implicit);return"all"===r||null!==a&&a<=n?'<span class="math-parenthesis math-round-parenthesis">(</span>'+t.toHTML(e)+'<span class="math-parenthesis math-round-parenthesis">)</span>':t.toHTML(e)})),a=i[0],o=0;o<this.conditionals.length;o++)a+='<span class="math-operator math-binary-operator math-explicit-binary-operator">'+qe(t[this.conditionals[o]])+"</span>"+i[o+1];return a}_toTex(e){for(var r=e&&e.parenthesis?e.parenthesis:"keep",t=fp(this,r,e&&e.implicit),n=this.params.map((function(n,i){var a=fp(n,r,e&&e.implicit);return"all"===r||null!==a&&a<=t?"\\left("+n.toTex(e)+"\right)":n.toTex(e)})),i=n[0],a=0;a<this.conditionals.length;a++)i+=Np[this.conditionals[a]]+n[a+1];return i}}return(0,Tu.Z)(n,"name",jp),n}),{isClass:!0,isNode:!0}),Hp=ur("SymbolNode",["math","?Unit","Node"],(e=>{var{math:r,Unit:t,Node:n}=e;function i(e){return!!t&&t.isValuelessUnit(e)}class a extends n{constructor(e){if(super(),"string"!=typeof e)throw new TypeError('String expected for parameter "name"');this.name=e}get type(){return"SymbolNode"}get isSymbolNode(){return!0}_compile(e,r){var n=this.name;if(!0===r[n])return function(e,r,t){return lr(r,n)};if(n in e)return function(r,t,i){return r.has(n)?r.get(n):lr(e,n)};var o=i(n);return function(e,r,i){return e.has(n)?e.get(n):o?new t(null,n):a.onUndefinedSymbol(n)}}forEach(e){}map(e){return this.clone()}static onUndefinedSymbol(e){throw new Error("Undefined symbol "+e)}clone(){return new a(this.name)}_toString(e){return this.name}toHTML(e){var r=qe(this.name);return"true"===r||"false"===r?'<span class="math-symbol math-boolean">'+r+"</span>":"i"===r?'<span class="math-symbol math-imaginary-symbol">'+r+"</span>":"Infinity"===r?'<span class="math-symbol math-infinity-symbol">'+r+"</span>":"NaN"===r?'<span class="math-symbol math-nan-symbol">'+r+"</span>":"null"===r?'<span class="math-symbol math-null-symbol">'+r+"</span>":"undefined"===r?'<span class="math-symbol math-undefined-symbol">'+r+"</span>":'<span class="math-symbol">'+r+"</span>"}toJSON(){return{mathjs:"SymbolNode",name:this.name}}static fromJSON(e){return new a(e.name)}_toTex(e){var t=!1;void 0===r[this.name]&&i(this.name)&&(t=!0);var n=Cp(this.name,t);return"\\"===n[0]?n:" "+n}}return a}),{isClass:!0,isNode:!0});function $p(e){for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++)t[n-1]=arguments[n];return"function"==typeof e.createSubScope?wr(e.createSubScope(),...t):wr(vr(),e,...t)}var Zp="FunctionNode",Gp=ur(Zp,["math","Node","SymbolNode"],(e=>{var{math:r,Node:t,SymbolNode:n}=e,i=e=>_e(e,{truncate:78});function a(e,r,t){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 s=r[n[1]];if(!s)throw new ReferenceError("Template: Property "+n[1]+" does not exist.");if(void 0===n[2])switch(typeof s){case"string":i+=s;break;case"object":if(k(s))i+=s.toTex(t);else{if(!Array.isArray(s))throw new TypeError("Template: "+n[1]+" has to be a Node, String or array of Nodes");i+=s.map((function(e,r){if(k(e))return e.toTex(t);throw new TypeError("Template: "+n[1]+"["+r+"] 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(!k(s[n[2]]&&s[n[2]]))throw new TypeError("Template: "+n[1]+"["+n[2]+"] is not a Node.");i+=s[n[2]].toTex(t)}}return i+=e.slice(o)}class o extends t{constructor(e,r){if(super(),"string"==typeof e&&(e=new n(e)),!k(e))throw new TypeError('Node expected as parameter "fn"');if(!Array.isArray(r)||!r.every(k))throw new TypeError('Array containing Nodes expected for parameter "args"');this.fn=e,this.args=r||[]}get name(){return this.fn.name||""}get type(){return Zp}get isFunctionNode(){return!0}_compile(e,r){var t=this.args.map((t=>t._compile(e,r)));if(!H(this.fn)){if(S(this.fn)&&I(this.fn.index)&&this.fn.index.isObjectProperty()){var n=this.fn.object._compile(e,r),a=this.fn.index.getObjectProperty(),s=this.args;return function(r,i,o){var u=n(r,i,o),c=function(e,r){if(!mr(e,r))throw new Error('No access to method "'+r+'"');return e[r]}(u,a);if(null!=c&&c.rawArgs)return c(s,e,$p(r,i),r);var l=t.map((e=>e(r,i,o)));return c.apply(u,l)}}var u=this.fn.toString(),c=this.fn._compile(e,r),l=this.args;return function(r,n,a){var o=c(r,n,a);if("function"!=typeof o)throw new TypeError("Expression '".concat(u,"' did not evaluate to a function; value is:")+"\n ".concat(i(o)));if(o.rawArgs)return o(l,e,$p(r,n),r);var s=t.map((e=>e(r,n,a)));return o.apply(o,s)}}var f=this.fn.name;if(r[f]){var p=this.args;return function(r,n,a){var o=lr(n,f);if("function"!=typeof o)throw new TypeError("Argument '".concat(f,"' was not a function; received: ").concat(i(o)));if(o.rawArgs)return o(p,e,$p(r,n),r);var s=t.map((e=>e(r,n,a)));return o.apply(o,s)}}var m=f in e?lr(e,f):void 0,d="function"==typeof m&&!0===m.rawArgs,h=r=>{var t;if(r.has(f))t=r.get(f);else{if(!(f in e))return o.onUndefinedFunction(f);t=lr(e,f)}if("function"==typeof t)return t;throw new TypeError("'".concat(f,"' is not a function; its value is:\n ").concat(i(t)))};if(d){var g=this.args;return function(r,t,n){return h(r)(g,e,$p(r,t),r)}}switch(t.length){case 0:return function(e,r,t){return h(e)()};case 1:return function(e,r,n){return h(e)((0,t[0])(e,r,n))};case 2:return function(e,r,n){var i=h(e),a=t[0],o=t[1];return i(a(e,r,n),o(e,r,n))};default:return function(e,r,n){return h(e)(...t.map((t=>t(e,r,n))))}}}forEach(e){e(this.fn,"fn",this);for(var r=0;r<this.args.length;r++)e(this.args[r],"args["+r+"]",this)}map(e){for(var r=this._ifNode(e(this.fn,"fn",this)),t=[],n=0;n<this.args.length;n++)t[n]=this._ifNode(e(this.args[n],"args["+n+"]",this));return new o(r,t)}clone(){return new o(this.fn,this.args.slice(0))}toString(e){var r,t=this.fn.toString(e);return e&&"object"==typeof e.handler&&Y(e.handler,t)&&(r=e.handler[t](this,e)),void 0!==r?r:super.toString(e)}_toString(e){var r=this.args.map((function(r){return r.toString(e)}));return(z(this.fn)?"("+this.fn.toString(e)+")":this.fn.toString(e))+"("+r.join(", ")+")"}toJSON(){return{mathjs:Zp,fn:this.fn,args:this.args}}toHTML(e){var r=this.args.map((function(r){return r.toHTML(e)}));return'<span class="math-function">'+qe(this.fn)+'</span><span class="math-paranthesis math-round-parenthesis">(</span>'+r.join('<span class="math-separator">,</span>')+'<span class="math-paranthesis math-round-parenthesis">)</span>'}toTex(e){var r;return e&&"object"==typeof e.handler&&Y(e.handler,this.name)&&(r=e.handler[this.name](this,e)),void 0!==r?r:super.toTex(e)}_toTex(e){var t,n,i=this.args.map((function(r){return r.toTex(e)}));switch(Dp[this.name]&&(t=Dp[this.name]),!r[this.name]||"function"!=typeof r[this.name].toTex&&"object"!=typeof r[this.name].toTex&&"string"!=typeof r[this.name].toTex||(t=r[this.name].toTex),typeof t){case"function":n=t(this,e);break;case"string":n=a(t,this,e);break;case"object":switch(typeof t[i.length]){case"function":n=t[i.length](this,e);break;case"string":n=a(t[i.length],this,e)}}return void 0!==n?n:a("\\mathrm{${name}}\\left(${args}\\right)",this,e)}getIdentifier(){return this.type+":"+this.name}}return(0,Tu.Z)(o,"name",Zp),(0,Tu.Z)(o,"onUndefinedFunction",(function(e){throw new Error("Undefined function "+e)})),(0,Tu.Z)(o,"fromJSON",(function(e){return new o(e.fn,e.args)})),o}),{isClass:!0,isNode:!0}),Vp="parse",Wp=ur(Vp,["typed","numeric","config","AccessorNode","ArrayNode","AssignmentNode","BlockNode","ConditionalNode","ConstantNode","FunctionAssignmentNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","RangeNode","RelationalNode","SymbolNode"],(e=>{var{typed:r,numeric:t,config:i,AccessorNode:a,ArrayNode:o,AssignmentNode:s,BlockNode:u,ConditionalNode:c,ConstantNode:l,FunctionAssignmentNode:f,FunctionNode:p,IndexNode:m,ObjectNode:d,OperatorNode:h,ParenthesisNode:g,RangeNode:y,RelationalNode:v,SymbolNode:x}=e,b=r(Vp,{string:function(e){return j(e,{})},"Array | Matrix":function(e){return w(e,{})},"string, Object":function(e,r){return j(e,void 0!==r.nodes?r.nodes:{})},"Array | Matrix, Object":w});function w(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=void 0!==r.nodes?r.nodes:{};return Fn(e,(function(e){if("string"!=typeof e)throw new TypeError("String expected");return j(e,t)}))}var N={NULL:0,DELIMITER:1,NUMBER:2,SYMBOL:3,UNKNOWN:4},D={",":!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},E={mod:!0,to:!0,in:!0,and:!0,xor:!0,or:!0,not:!0},A={true:!0,false:!1,null:null,undefined:void 0},C=["NaN","Infinity"];function M(e,r){return e.expression.substr(e.index,r)}function F(e){return M(e,1)}function B(e){e.index++}function T(e){return e.expression.charAt(e.index-1)}function z(e){return e.expression.charAt(e.index+1)}function I(e){for(e.tokenType=N.NULL,e.token="",e.comment="";;){if("#"===F(e))for(;"\n"!==F(e)&&""!==F(e);)e.comment+=F(e),B(e);if(!b.isWhitespace(F(e),e.nestingLevel))break;B(e)}if(""!==F(e)){if("\n"===F(e)&&!e.nestingLevel)return e.tokenType=N.DELIMITER,e.token=F(e),void B(e);var r=F(e),t=M(e,2),n=M(e,3);if(3===n.length&&D[n])return e.tokenType=N.DELIMITER,e.token=n,B(e),B(e),void B(e);if(2===t.length&&D[t])return e.tokenType=N.DELIMITER,e.token=t,B(e),void B(e);if(D[r])return e.tokenType=N.DELIMITER,e.token=r,void B(e);if(b.isDigitDot(r)){e.tokenType=N.NUMBER;var i=M(e,2);if("0b"===i||"0o"===i||"0x"===i){for(e.token+=F(e),B(e),e.token+=F(e),B(e);b.isHexDigit(F(e));)e.token+=F(e),B(e);if("."===F(e))for(e.token+=".",B(e);b.isHexDigit(F(e));)e.token+=F(e),B(e);else if("i"===F(e))for(e.token+="i",B(e);b.isDigit(F(e));)e.token+=F(e),B(e);return}if("."===F(e)){if(e.token+=F(e),B(e),!b.isDigit(F(e)))return void(e.tokenType=N.DELIMITER)}else{for(;b.isDigit(F(e));)e.token+=F(e),B(e);b.isDecimalMark(F(e),z(e))&&(e.token+=F(e),B(e))}for(;b.isDigit(F(e));)e.token+=F(e),B(e);if("E"===F(e)||"e"===F(e))if(b.isDigit(z(e))||"-"===z(e)||"+"===z(e)){if(e.token+=F(e),B(e),"+"!==F(e)&&"-"!==F(e)||(e.token+=F(e),B(e)),!b.isDigit(F(e)))throw fe(e,'Digit expected, got "'+F(e)+'"');for(;b.isDigit(F(e));)e.token+=F(e),B(e);if(b.isDecimalMark(F(e),z(e)))throw fe(e,'Digit expected, got "'+F(e)+'"')}else if("."===z(e))throw B(e),fe(e,'Digit expected, got "'+F(e)+'"')}else{if(!b.isAlpha(F(e),T(e),z(e))){for(e.tokenType=N.UNKNOWN;""!==F(e);)e.token+=F(e),B(e);throw fe(e,'Syntax error in part "'+e.token+'"')}for(;b.isAlpha(F(e),T(e),z(e))||b.isDigit(F(e));)e.token+=F(e),B(e);Y(E,e.token)?e.tokenType=N.DELIMITER:e.tokenType=N.SYMBOL}}else e.tokenType=N.DELIMITER}function k(e){do{I(e)}while("\n"===e.token)}function R(e){e.nestingLevel++}function U(e){e.nestingLevel--}function j(e,r){var t={extraNodes:{},expression:"",comment:"",index:0,token:"",tokenType:N.NULL,nestingLevel:0,conditionalLevel:null};(0,n.Z)(t,{expression:e,extraNodes:r}),I(t);var i=function(e){var r,t,n=[];""!==e.token&&"\n"!==e.token&&";"!==e.token&&(r=L(e),e.comment&&(r.comment=e.comment));for(;"\n"===e.token||";"===e.token;)0===n.length&&r&&(t=";"!==e.token,n.push({node:r,visible:t})),I(e),"\n"!==e.token&&";"!==e.token&&""!==e.token&&(r=L(e),e.comment&&(r.comment=e.comment),t=";"!==e.token,n.push({node:r,visible:t}));return n.length>0?new u(n):(r||(r=new l(void 0),e.comment&&(r.comment=e.comment)),r)}(t);if(""!==t.token)throw t.tokenType===N.DELIMITER?pe(t,"Unexpected operator "+t.token):fe(t,'Unexpected part "'+t.token+'"');return i}function L(e){var r,t,n,i,a=function(e){var r=function(e){var r=$(e);for(;"or"===e.token;)k(e),r=new h("or","or",[r,$(e)]);return r}(e);for(;"?"===e.token;){var t=e.conditionalLevel;e.conditionalLevel=e.nestingLevel,k(e);var n=r,i=L(e);if(":"!==e.token)throw fe(e,"False part of conditional expression expected");e.conditionalLevel=null,k(e);var a=L(e);r=new c(n,i,a),e.conditionalLevel=t}return r}(e);if("="===e.token){if(H(a))return r=a.name,k(e),n=L(e),new s(new x(r),n);if(S(a))return k(e),n=L(e),new s(a.object,a.index,n);if(q(a)&&H(a.fn)&&(i=!0,t=[],r=a.name,a.args.forEach((function(e,r){H(e)?t[r]=e.name:i=!1})),i))return k(e),n=L(e),new f(r,t,n);throw fe(e,"Invalid left hand side of assignment operator =")}return a}function $(e){for(var r=Z(e);"xor"===e.token;)k(e),r=new h("xor","xor",[r,Z(e)]);return r}function Z(e){for(var r=G(e);"and"===e.token;)k(e),r=new h("and","and",[r,G(e)]);return r}function G(e){for(var r=V(e);"|"===e.token;)k(e),r=new h("|","bitOr",[r,V(e)]);return r}function V(e){for(var r=W(e);"^|"===e.token;)k(e),r=new h("^|","bitXor",[r,W(e)]);return r}function W(e){for(var r=J(e);"&"===e.token;)k(e),r=new h("&","bitAnd",[r,J(e)]);return r}function J(e){for(var r=[X(e)],t=[],n={"==":"equal","!=":"unequal","<":"smaller",">":"larger","<=":"smallerEq",">=":"largerEq"};Y(n,e.token);){var i={name:e.token,fn:n[e.token]};t.push(i),k(e),r.push(X(e))}return 1===r.length?r[0]:2===r.length?new h(t[0].name,t[0].fn,r):new v(t.map((e=>e.fn)),r)}function X(e){var r,t,n,i;r=Q(e);for(var a={"<<":"leftShift",">>":"rightArithShift",">>>":"rightLogShift"};Y(a,e.token);)n=a[t=e.token],k(e),i=[r,Q(e)],r=new h(t,n,i);return r}function Q(e){var r,t,n,i;r=K(e);for(var a={to:"to",in:"to"};Y(a,e.token);)n=a[t=e.token],k(e),"in"===t&&""===e.token?r=new h("*","multiply",[r,new x("in")],!0):(i=[r,K(e)],r=new h(t,n,i));return r}function K(e){var r,t=[];if(r=":"===e.token?new l(1):ee(e),":"===e.token&&e.conditionalLevel!==e.nestingLevel){for(t.push(r);":"===e.token&&t.length<3;)k(e),")"===e.token||"]"===e.token||","===e.token||""===e.token?t.push(new x("end")):t.push(ee(e));r=3===t.length?new y(t[0],t[2],t[1]):new y(t[0],t[1])}return r}function ee(e){var r,t,n,i;r=re(e);for(var a={"+":"add","-":"subtract"};Y(a,e.token);){n=a[t=e.token],k(e);var o=re(e);i=o.isPercentage?[r,new h("*","multiply",[r,o])]:[r,o],r=new h(t,n,i)}return r}function re(e){var r,t,n,i;t=r=te(e);for(var a={"*":"multiply",".*":"dotMultiply","/":"divide","./":"dotDivide"};Y(a,e.token);)i=a[n=e.token],k(e),t=te(e),r=new h(n,i,[r,t]);return r}function te(e){var r,t;for(t=r=ne(e);e.tokenType===N.SYMBOL||"in"===e.token&&O(r)||!(e.tokenType!==N.NUMBER||O(t)||P(t)&&"!"!==t.op)||"("===e.token;)t=ne(e),r=new h("*","multiply",[r,t],!0);return r}function ne(e){for(var r=ie(e),t=r,i=[];"/"===e.token&&_(t);){if(i.push((0,n.Z)({},e)),k(e),e.tokenType!==N.NUMBER){(0,n.Z)(e,i.pop());break}if(i.push((0,n.Z)({},e)),k(e),e.tokenType!==N.SYMBOL&&"("!==e.token){i.pop(),(0,n.Z)(e,i.pop());break}(0,n.Z)(e,i.pop()),i.pop(),t=ie(e),r=new h("/","divide",[r,t])}return r}function ie(e){var r,t,n,i;r=ae(e);for(var a={"%":"mod",mod:"mod"};Y(a,e.token);)n=a[t=e.token],k(e),"%"===t&&e.tokenType===N.DELIMITER&&"("!==e.token?r=new h("/","divide",[r,new l(100)],!1,!0):(i=[r,ae(e)],r=new h(t,n,i));return r}function ae(e){var r,n,a,s={"-":"unaryMinus","+":"unaryPlus","~":"bitNot",not:"not"};return Y(s,e.token)?(a=s[e.token],r=e.token,k(e),n=[ae(e)],new h(r,a,n)):function(e){var r,n,a,s;r=function(e){var r,n,a;r=function(e){var r=[];if(e.tokenType===N.SYMBOL&&Y(e.extraNodes,e.token)){var n=e.extraNodes[e.token];if(I(e),"("===e.token){if(r=[],R(e),I(e),")"!==e.token)for(r.push(L(e));","===e.token;)I(e),r.push(L(e));if(")"!==e.token)throw fe(e,"Parenthesis ) expected");U(e),I(e)}return new n(r)}return function(e){var r;if(e.tokenType===N.SYMBOL||e.tokenType===N.DELIMITER&&e.token in E)return r=e.token,I(e),oe(e,Y(A,r)?new l(A[r]):-1!==C.indexOf(r)?new l(t(r,"number")):new x(r));return function(e){var r;if('"'===e.token)return r=se(e),oe(e,new l(r));return function(e){var r;if("'"===e.token)return r=ue(e),oe(e,new l(r));return function(e){var r,n,a,s;if("["===e.token){if(R(e),I(e),"]"!==e.token){var u=ce(e);if(";"===e.token){for(a=1,n=[u];";"===e.token;)I(e),n[a]=ce(e),a++;if("]"!==e.token)throw fe(e,"End of matrix ] expected");U(e),I(e),s=n[0].items.length;for(var c=1;c<a;c++)if(n[c].items.length!==s)throw pe(e,"Column dimensions mismatch ("+n[c].items.length+" !== "+s+")");r=new o(n)}else{if("]"!==e.token)throw fe(e,"End of matrix ] expected");U(e),I(e),r=u}}else U(e),I(e),r=new o([]);return oe(e,r)}return function(e){if("{"===e.token){var r;R(e);var n={};do{if(I(e),"}"!==e.token){if('"'===e.token)r=se(e);else if("'"===e.token)r=ue(e);else{if(!(e.tokenType===N.SYMBOL||e.tokenType===N.DELIMITER&&e.token in E))throw fe(e,"Symbol or string expected as object key");r=e.token,I(e)}if(":"!==e.token)throw fe(e,"Colon : expected after object key");I(e),n[r]=L(e)}}while(","===e.token);if("}"!==e.token)throw fe(e,"Comma , or bracket } expected after object value");U(e),I(e);var a=new d(n);return a=oe(e,a)}return function(e){var r;if(e.tokenType===N.NUMBER)return r=e.token,I(e),new l(t(r,i.number));return function(e){var r;if("("===e.token){if(R(e),I(e),r=L(e),")"!==e.token)throw fe(e,"Parenthesis ) expected");return U(e),I(e),r=oe(e,r=new g(r))}return function(e){throw""===e.token?fe(e,"Unexpected end of expression"):fe(e,"Value expected")}(e)}(e)}(e)}(e)}(e)}(e)}(e)}(e)}(e);var s={"!":"factorial","'":"ctranspose"};for(;Y(s,e.token);)a=s[n=e.token],I(e),r=oe(e,r=new h(n,a,[r]));return r}(e),("^"===e.token||".^"===e.token)&&(a="^"===(n=e.token)?"pow":"dotPow",k(e),s=[r,ae(e)],r=new h(n,a,s));return r}(e)}function oe(e,r,t){for(var n;!("("!==e.token&&"["!==e.token&&"."!==e.token||t&&-1===t.indexOf(e.token));)if(n=[],"("===e.token){if(!H(r)&&!S(r))return r;if(R(e),I(e),")"!==e.token)for(n.push(L(e));","===e.token;)I(e),n.push(L(e));if(")"!==e.token)throw fe(e,"Parenthesis ) expected");U(e),I(e),r=new p(r,n)}else if("["===e.token){if(R(e),I(e),"]"!==e.token)for(n.push(L(e));","===e.token;)I(e),n.push(L(e));if("]"!==e.token)throw fe(e,"Parenthesis ] expected");U(e),I(e),r=new a(r,new m(n))}else{if(I(e),e.tokenType!==N.SYMBOL)throw fe(e,"Property name expected after dot");n.push(new l(e.token)),I(e);r=new a(r,new m(n,!0))}return r}function se(e){for(var r="";""!==F(e)&&'"'!==F(e);)"\\"===F(e)&&(r+=F(e),B(e)),r+=F(e),B(e);if(I(e),'"'!==e.token)throw fe(e,'End of string " expected');return I(e),JSON.parse('"'+r+'"')}function ue(e){for(var r="";""!==F(e)&&"'"!==F(e);)"\\"===F(e)&&(r+=F(e),B(e)),r+=F(e),B(e);if(I(e),"'"!==e.token)throw fe(e,"End of string ' expected");return I(e),JSON.parse('"'+r+'"')}function ce(e){for(var r=[L(e)],t=1;","===e.token;)I(e),r[t]=L(e),t++;return new o(r)}function le(e){return e.index-e.token.length+1}function fe(e,r){var t=le(e),n=new SyntaxError(r+" (char "+t+")");return n.char=t,n}function pe(e,r){var t=le(e),n=new SyntaxError(r+" (char "+t+")");return n.char=t,n}return b.isAlpha=function(e,r,t){return b.isValidLatinOrGreek(e)||b.isValidMathSymbol(e,t)||b.isValidMathSymbol(r,e)},b.isValidLatinOrGreek=function(e){return/^[a-zA-Z_$\u00C0-\u02AF\u0370-\u03FF\u2100-\u214F]$/.test(e)},b.isValidMathSymbol=function(e,r){return/^[\uD835]$/.test(e)&&/^[\uDC00-\uDFFF]$/.test(r)&&/^[^\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(r)},b.isWhitespace=function(e,r){return" "===e||"\t"===e||"\n"===e&&r>0},b.isDecimalMark=function(e,r){return"."===e&&"/"!==r&&"*"!==r&&"^"!==r},b.isDigitDot=function(e){return e>="0"&&e<="9"||"."===e},b.isDigit=function(e){return e>="0"&&e<="9"},b.isHexDigit=function(e){return e>="0"&&e<="9"||e>="a"&&e<="f"||e>="A"&&e<="F"},r.addConversion({from:"string",to:"Node",convert:b}),b})),Yp="compile",Jp=ur(Yp,["typed","parse"],(e=>{var{typed:r,parse:t}=e;return r(Yp,{string:function(e){return t(e).compile()},"Array | Matrix":function(e){return Fn(e,(function(e){return t(e).compile()}))}})})),Xp="evaluate",Qp=ur(Xp,["typed","parse"],(e=>{var{typed:r,parse:t}=e;return r(Xp,{string:function(e){var r=vr();return t(e).compile().evaluate(r)},"string, Map | Object":function(e,r){return t(e).compile().evaluate(r)},"Array | Matrix":function(e){var r=vr();return Fn(e,(function(e){return t(e).compile().evaluate(r)}))},"Array | Matrix, Map | Object":function(e,r){return Fn(e,(function(e){return t(e).compile().evaluate(r)}))}})})),Kp=ur("Parser",["evaluate"],(e=>{var{evaluate:r}=e;function t(){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");Object.defineProperty(this,"scope",{value:vr(),writable:!1})}return t.prototype.type="Parser",t.prototype.isParser=!0,t.prototype.evaluate=function(e){return r(e,this.scope)},t.prototype.get=function(e){if(this.scope.has(e))return this.scope.get(e)},t.prototype.getAll=function(){return function(e){if(e instanceof yr)return e.wrappedObject;var r={};for(var t of e.keys())fr(r,t,e.get(t));return r}(this.scope)},t.prototype.getAllAsMap=function(){return this.scope},t.prototype.set=function(e,r){return this.scope.set(e,r),r},t.prototype.remove=function(e){this.scope.delete(e)},t.prototype.clear=function(){this.scope.clear()},t}),{isClass:!0}),em="parser",rm=ur(em,["typed","Parser"],(e=>{var{typed:r,Parser:t}=e;return r(em,{"":function(){return new t}})})),tm=ur("lup",["typed","matrix","abs","addScalar","divideScalar","multiplyScalar","subtract","larger","equalScalar","unaryMinus","DenseMatrix","SparseMatrix","Spa"],(e=>{var{typed:r,matrix:t,abs:n,addScalar:i,divideScalar:a,multiplyScalar:o,subtract:s,larger:u,equalScalar:c,unaryMinus:l,DenseMatrix:f,SparseMatrix:p,Spa:m}=e;return r("lup",{DenseMatrix:function(e){return d(e)},SparseMatrix:function(e){return h(e)},Array:function(e){var r=d(t(e));return{L:r.L.valueOf(),U:r.U.valueOf(),p:r.p}}});function d(e){var r,t,l,p=e._size[0],m=e._size[1],d=Math.min(p,m),h=G(e._data),g=[],y=[p,d],v=[],x=[d,m],b=[];for(r=0;r<p;r++)b[r]=r;for(t=0;t<m;t++){if(t>0)for(r=0;r<p;r++){var w=Math.min(r,t),N=0;for(l=0;l<w;l++)N=i(N,o(h[r][l],h[l][t]));h[r][t]=s(h[r][t],N)}var D=t,E=0,A=0;for(r=t;r<p;r++){var C=h[r][t],S=n(C);u(S,E)&&(D=r,E=S,A=C)}if(t!==D&&(b[t]=[b[D],b[D]=b[t]][0],f._swapRows(t,D,h)),t<p)for(r=t+1;r<p;r++){var M=h[r][t];c(M,0)||(h[r][t]=a(h[r][t],A))}}for(t=0;t<m;t++)for(r=0;r<p;r++)0===t&&(r<m&&(v[r]=[]),g[r]=[]),r<t?(r<m&&(v[r][t]=h[r][t]),t<p&&(g[r][t]=0)):r!==t?(r<m&&(v[r][t]=0),t<p&&(g[r][t]=h[r][t])):(r<m&&(v[r][t]=h[r][t]),t<p&&(g[r][t]=1));var F=new f({data:g,size:y}),B=new f({data:v,size:x}),T=[];for(r=0,d=b.length;r<d;r++)T[b[r]]=r;return{L:F,U:B,p:T,toString:function(){return"L: "+this.L.toString()+"\nU: "+this.U.toString()+"\nP: "+this.p}}}function h(e){var r,t,i,s=e._size[0],f=e._size[1],d=Math.min(s,f),h=e._values,g=e._index,y=e._ptr,v=[],x=[],b=[],w=[s,d],N=[],D=[],E=[],A=[d,f],C=[],S=[];for(r=0;r<s;r++)C[r]=r,S[r]=r;var M=function(){var e=new m;t<s&&(b.push(v.length),v.push(1),x.push(t)),E.push(N.length);var f=y[t],d=y[t+1];for(i=f;i<d;i++)r=g[i],e.set(C[r],h[i]);t>0&&e.forEach(0,t-1,(function(r,t){p._forEachRow(r,v,x,b,(function(n,i){n>r&&e.accumulate(n,l(o(i,t)))}))}));var M,F,B,T,O=t,_=e.get(t),z=n(_);e.forEach(t+1,s-1,(function(e,r){var t=n(r);u(t,z)&&(O=e,z=t,_=r)})),t!==O&&(p._swapRows(t,O,w[1],v,x,b),p._swapRows(t,O,A[1],N,D,E),e.swap(t,O),F=O,B=S[M=t],T=S[F],C[B]=F,C[T]=M,S[M]=T,S[F]=B),e.forEach(0,s-1,(function(e,r){e<=t?(N.push(r),D.push(e)):(r=a(r,_),c(r,0)||(v.push(r),x.push(e)))}))};for(t=0;t<f;t++)M();return E.push(N.length),b.push(v.length),{L:new p({values:v,index:x,ptr:b,size:w}),U:new p({values:N,index:D,ptr:E,size:A}),p:C,toString:function(){return"L: "+this.L.toString()+"\nU: "+this.U.toString()+"\nP: "+this.p}}}})),nm=ur("qr",["typed","matrix","zeros","identity","isZero","equal","sign","sqrt","conj","unaryMinus","addScalar","divideScalar","multiplyScalar","subtract","complex"],(e=>{var{typed:r,matrix:t,zeros:i,identity:a,isZero:o,equal:s,sign:u,sqrt:c,conj:l,unaryMinus:f,addScalar:p,divideScalar:m,multiplyScalar:d,subtract:h,complex:g}=e;return(0,n.Z)(r("qr",{DenseMatrix:function(e){return v(e)},SparseMatrix:function(e){return function(e){throw new Error("qr not implemented for sparse matrices yet")}()},Array:function(e){var r=v(t(e));return{Q:r.Q.valueOf(),R:r.R.valueOf()}}}),{_denseQRimpl:y});function y(e){var r,t,n,g=e._size[0],y=e._size[1],v=a([g],"dense"),x=v._data,b=e.clone(),w=b._data,N=i([g],"");for(n=0;n<Math.min(y,g);++n){var D=w[n][n],E=f(s(D,0)?1:u(D)),A=l(E),C=0;for(r=n;r<g;r++)C=p(C,d(w[r][n],l(w[r][n])));var S=d(E,c(C));if(!o(S)){var M=h(D,S);for(N[n]=1,r=n+1;r<g;r++)N[r]=m(w[r][n],M);var F=f(l(m(M,S))),B=void 0;for(t=n;t<y;t++){for(B=0,r=n;r<g;r++)B=p(B,d(l(N[r]),w[r][t]));for(B=d(B,F),r=n;r<g;r++)w[r][t]=d(h(w[r][t],d(N[r],B)),A)}for(r=0;r<g;r++){for(B=0,t=n;t<g;t++)B=p(B,d(x[r][t],N[t]));for(B=d(B,F),t=n;t<g;++t)x[r][t]=m(h(x[r][t],d(B,l(N[t]))),A)}}}return{Q:v,R:b,toString:function(){return"Q: "+this.Q.toString()+"\nR: "+this.R.toString()}}}function v(e){var r=y(e),t=r.R._data;if(e._data.length>0)for(var n="Complex"===t[0][0].type?g(0):0,i=0;i<t.length;++i)for(var a=0;a<i&&a<(t[0]||[]).length;++a)t[i][a]=n;return r}}));function im(e,r,t,n,i,a,o){var s=0;for(t[o]=e;s>=0;){var u=t[o+s],c=t[n+u];-1===c?(s--,a[r++]=u):(t[n+u]=t[i+c],t[o+ ++s]=c)}return r}function am(e){return-e-2}var om=ur("csAmd",["add","multiply","transpose"],(e=>{var{add:r,multiply:t,transpose:n}=e;return function(e,o){if(!o||e<=0||e>3)return null;var s=o._size,u=s[0],c=s[1],l=0,f=Math.max(16,10*Math.sqrt(c)),p=function(e,i,a,o,s){var u=n(i);if(1===e&&o===a)return r(i,u);if(2===e){for(var c=u._index,l=u._ptr,f=0,p=0;p<a;p++){var m=l[p];if(l[p]=f,!(l[p+1]-m>s))for(var d=l[p+1];m<d;m++)c[f++]=c[m]}return l[a]=f,i=n(u),t(u,i)}return t(u,i)}(e,o,u,c,f=Math.min(c-2,f));!function(e,r,t){for(var n=e._values,i=e._index,a=e._ptr,o=e._size[1],s=0,u=0;u<o;u++){var c=a[u];for(a[u]=s;c<a[u+1];c++)r(i[c],u,n?n[c]:1,t)&&(i[s]=i[c],n&&(n[s]=n[c]),s++)}a[o]=s,i.splice(s,i.length-s),n&&n.splice(s,n.length-s)}(p,a,null);for(var m,d,h,g,y,v,x,b,w,N,D,E,A,C,S,M,F=p._index,B=p._ptr,T=B[c],O=[],_=[],z=c+1,q=2*(c+1),I=3*(c+1),k=4*(c+1),R=5*(c+1),P=6*(c+1),U=7*(c+1),j=O,L=function(e,r,t,n,a,o,s,u,c,l,f,p){for(var m=0;m<e;m++)t[n+m]=r[m+1]-r[m];t[n+e]=0;for(var d=0;d<=e;d++)t[a+d]=-1,o[d]=-1,t[s+d]=-1,t[u+d]=-1,t[c+d]=1,t[l+d]=1,t[f+d]=0,t[p+d]=t[n+d];var h=i(0,0,t,l,e);return t[f+e]=-2,r[e]=-1,t[l+e]=0,h}(c,B,_,0,I,j,q,U,z,P,k,R),H=function(e,r,t,n,i,a,o,s,u,c,l){for(var f=0,p=0;p<e;p++){var m=t[n+p];if(0===m)t[i+p]=-2,f++,r[p]=-1,t[a+p]=0;else if(m>o)t[s+p]=0,t[i+p]=-1,f++,r[p]=am(e),t[s+e]++;else{var d=t[u+m];-1!==d&&(c[d]=p),t[l+p]=t[u+m],t[u+m]=p}}return f}(c,B,_,R,k,P,f,z,I,j,q),$=0;H<c;){for(h=-1;$<c&&-1===(h=_[I+$]);$++);-1!==_[q+h]&&(j[_[q+h]]=-1),_[I+$]=_[q+h];var Z=_[k+h],G=_[z+h];H+=G;var V=0;_[z+h]=-G;var W=B[h],Y=0===Z?W:T,J=Y;for(g=1;g<=Z+1;g++){for(g>Z?(v=h,x=W,b=_[0+h]-Z):(x=B[v=F[W++]],b=_[0+v]),y=1;y<=b;y++)(w=_[z+(m=F[x++])])<=0||(V+=w,_[z+m]=-w,F[J++]=m,-1!==_[q+m]&&(j[_[q+m]]=j[m]),-1!==j[m]?_[q+j[m]]=_[q+m]:_[I+_[R+m]]=_[q+m]);v!==h&&(B[v]=am(h),_[P+v]=0)}for(0!==Z&&(T=J),_[R+h]=V,B[h]=Y,_[0+h]=J-Y,_[k+h]=-2,L=i(L,l,_,P,c),N=Y;N<J;N++)if(!((D=_[k+(m=F[N])])<=0)){var X=L-(w=-_[z+m]);for(W=B[m],E=B[m]+D-1;W<=E;W++)_[P+(v=F[W])]>=L?_[P+v]-=w:0!==_[P+v]&&(_[P+v]=_[R+v]+X)}for(N=Y;N<J;N++){for(A=(E=B[m=F[N]])+_[k+m]-1,C=E,S=0,M=0,W=E;W<=A;W++)if(0!==_[P+(v=F[W])]){var Q=_[P+v]-L;Q>0?(M+=Q,F[C++]=v,S+=v):(B[v]=am(h),_[P+v]=0)}_[k+m]=C-E+1;var K=C,ee=E+_[0+m];for(W=A+1;W<ee;W++){var re=_[z+(d=F[W])];re<=0||(M+=re,F[C++]=d,S+=d)}0===M?(B[m]=am(h),V-=w=-_[z+m],G+=w,H+=w,_[z+m]=0,_[k+m]=-1):(_[R+m]=Math.min(_[R+m],M),F[C]=F[K],F[K]=F[E],F[E]=h,_[0+m]=C-E+1,S=(S<0?-S:S)%c,_[q+m]=_[U+S],_[U+S]=m,j[m]=S)}for(_[R+h]=V,L=i(L+(l=Math.max(l,V)),l,_,P,c),N=Y;N<J;N++)if(!(_[z+(m=F[N])]>=0))for(m=_[U+(S=j[m])],_[U+S]=-1;-1!==m&&-1!==_[q+m];m=_[q+m],L++){for(b=_[0+m],D=_[k+m],W=B[m]+1;W<=B[m]+b-1;W++)_[P+F[W]]=L;var te=m;for(d=_[q+m];-1!==d;){var ne=_[0+d]===b&&_[k+d]===D;for(W=B[d]+1;ne&&W<=B[d]+b-1;W++)_[P+F[W]]!==L&&(ne=0);ne?(B[d]=am(m),_[z+m]+=_[z+d],_[z+d]=0,_[k+d]=-1,d=_[q+d],_[q+te]=d):(te=d,d=_[q+d])}}for(W=Y,N=Y;N<J;N++)(w=-_[z+(m=F[N])])<=0||(_[z+m]=w,M=_[R+m]+V-w,-1!==_[I+(M=Math.min(M,c-H-w))]&&(j[_[I+M]]=m),_[q+m]=_[I+M],j[m]=-1,_[I+M]=m,$=Math.min($,M),_[R+m]=M,F[W++]=m);_[z+h]=G,0==(_[0+h]=W-Y)&&(B[h]=-1,_[P+h]=0),0!==Z&&(T=W)}for(m=0;m<c;m++)B[m]=am(B[m]);for(d=0;d<=c;d++)_[I+d]=-1;for(d=c;d>=0;d--)_[z+d]>0||(_[q+d]=_[I+B[d]],_[I+B[d]]=d);for(v=c;v>=0;v--)_[z+v]<=0||-1!==B[v]&&(_[q+v]=_[I+B[v]],_[I+B[v]]=v);for(h=0,m=0;m<=c;m++)-1===B[m]&&(h=im(m,h,_,I,q,O,P));return O.splice(O.length-1,1),O};function i(e,r,t,n,i){if(e<2||e+r<0){for(var a=0;a<i;a++)0!==t[n+a]&&(t[n+a]=1);e=2}return e}function a(e,r){return e!==r}}));function sm(e,r,t,n,i,a,o){var s,u,c,l=0;if(e<=r||t[n+r]<=t[i+e])return-1;t[i+e]=t[n+r];var f=t[a+e];if(t[a+e]=r,-1===f)l=1,c=e;else{for(l=2,c=f;c!==t[o+c];c=t[o+c]);for(s=f;s!==c;s=u)u=t[o+s],t[o+s]=c}return{jleaf:l,q:c}}var um=ur("csCounts",["transpose"],(e=>{var{transpose:r}=e;return function(e,t,n,i){if(!e||!t||!n)return null;var a,o,s,u,c,l,f,p=e._size,m=p[0],d=p[1],h=4*d+(i?d+m+1:0),g=[],y=d,v=2*d,x=3*d,b=4*d,w=5*d+1;for(s=0;s<h;s++)g[s]=-1;var N=[],D=r(e),E=D._index,A=D._ptr;for(s=0;s<d;s++)for(N[o=n[s]]=-1===g[x+o]?1:0;-1!==o&&-1===g[x+o];o=t[o])g[x+o]=s;if(i){for(s=0;s<d;s++)g[n[s]]=s;for(a=0;a<m;a++){for(s=d,l=A[a],f=A[a+1],c=l;c<f;c++)s=Math.min(s,g[E[c]]);g[w+a]=g[b+s],g[b+s]=a}}for(a=0;a<d;a++)g[0+a]=a;for(s=0;s<d;s++){for(-1!==t[o=n[s]]&&N[t[o]]--,u=i?g[b+s]:o;-1!==u;u=i?g[w+u]:-1)for(c=A[u];c<A[u+1];c++){var C=sm(a=E[c],o,g,x,y,v,0);C.jleaf>=1&&N[o]++,2===C.jleaf&&N[C.q]--}-1!==t[o]&&(g[0+o]=t[o])}for(o=0;o<d;o++)-1!==t[o]&&(N[t[o]]+=N[o]);return N}})),cm=ur("csSqr",["add","multiply","transpose"],(e=>{var{add:r,multiply:t,transpose:n}=e,i=om({add:r,multiply:t,transpose:n}),a=um({transpose:n});return function(e,r,t){var n,o=r._ptr,s=r._size[1],u={};if(u.q=i(e,r),e&&!u.q)return null;if(t){var c=e?function(e,r,t,n){for(var i=e._values,a=e._index,o=e._ptr,s=e._size,u=e._datatype,c=s[0],l=s[1],f=n&&e._values?[]:null,p=[],m=[],d=0,h=0;h<l;h++){m[h]=d;for(var g=t?t[h]:h,y=o[g],v=o[g+1],x=y;x<v;x++){var b=r?r[a[x]]:a[x];p[d]=b,f&&(f[d]=i[x]),d++}}return m[l]=d,e.createSparseMatrix({values:f,index:p,ptr:m,size:[c,l],datatype:u})}(r,null,u.q,0):r;u.parent=function(e,r){if(!e)return null;var t,n,i=e._index,a=e._ptr,o=e._size,s=o[0],u=o[1],c=[],l=[],f=u;if(r)for(t=0;t<s;t++)l[f+t]=-1;for(var p=0;p<u;p++){c[p]=-1,l[0+p]=-1;for(var m=a[p],d=a[p+1],h=m;h<d;h++){var g=i[h];for(t=r?l[f+g]:g;-1!==t&&t<p;t=n)n=l[0+t],l[0+t]=p,-1===n&&(c[t]=p);r&&(l[f+g]=p)}}return c}(c,1);var l=function(e,r){if(!e)return null;var t,n=0,i=[],a=[],o=r,s=2*r;for(t=0;t<r;t++)a[0+t]=-1;for(t=r-1;t>=0;t--)-1!==e[t]&&(a[o+t]=a[0+e[t]],a[0+e[t]]=t);for(t=0;t<r;t++)-1===e[t]&&(n=im(t,n,a,0,o,i,s));return i}(u.parent,s);if(u.cp=a(c,u.parent,l,1),c&&u.parent&&u.cp&&function(e,r){var t=e._ptr,n=e._index,i=e._size,a=i[0],o=i[1];r.pinv=[],r.leftmost=[];var s,u,c,l,f,p=r.parent,m=r.pinv,d=r.leftmost,h=[],g=0,y=a,v=a+o,x=a+2*o;for(u=0;u<o;u++)h[y+u]=-1,h[v+u]=-1,h[x+u]=0;for(s=0;s<a;s++)d[s]=-1;for(u=o-1;u>=0;u--)for(l=t[u],f=t[u+1],c=l;c<f;c++)d[n[c]]=u;for(s=a-1;s>=0;s--)m[s]=-1,-1!==(u=d[s])&&(0==h[x+u]++&&(h[v+u]=s),h[g+s]=h[y+u],h[y+u]=s);for(r.lnz=0,r.m2=a,u=0;u<o;u++)if(s=h[y+u],r.lnz++,s<0&&(s=r.m2++),m[s]=u,!(--x[u]<=0)){r.lnz+=h[x+u];var b=p[u];-1!==b&&(0===h[x+b]&&(h[v+b]=h[v+u]),h[g+h[v+u]]=h[y+b],h[y+b]=h[g+s],h[x+b]+=h[x+u])}for(s=0;s<a;s++)m[s]<0&&(m[s]=u++);return!0}(c,u))for(u.unz=0,n=0;n<s;n++)u.unz+=u.cp[n]}else u.unz=4*o[s]+s,u.lnz=u.unz;return u}}));function lm(e,r){return e[r]<0}function fm(e,r){e[r]=am(e[r])}function pm(e){return e<0?am(e):e}function mm(e,r,t,n,i){var a,o,s,u=r._index,c=r._ptr,l=r._size[1],f=0;for(n[0]=e;f>=0;){e=n[f];var p=i?i[e]:e;lm(c,e)||(fm(c,e),n[l+f]=p<0?0:pm(c[p]));var m=1;for(o=n[l+f],s=p<0?0:pm(c[p+1]);o<s;o++)if(!lm(c,a=u[o])){n[l+f]=o,n[++f]=a,m=0;break}m&&(f--,n[--t]=e)}return t}var dm=ur("csSpsolve",["divideScalar","multiply","subtract"],(e=>{var{divideScalar:r,multiply:t,subtract:n}=e;return function(e,i,a,o,s,u,c){var l,f,p,m,d=e._values,h=e._index,g=e._ptr,y=e._size[1],v=i._values,x=i._index,b=i._ptr,w=function(e,r,t,n,i){var a,o,s,u=e._ptr,c=e._size,l=r._index,f=r._ptr,p=c[1],m=p;for(o=f[t],s=f[t+1],a=o;a<s;a++){var d=l[a];lm(u,d)||(m=mm(d,e,m,n,i))}for(a=m;a<p;a++)fm(u,n[a]);return m}(e,i,a,o,u);for(l=w;l<y;l++)s[o[l]]=0;for(f=b[a],p=b[a+1],l=f;l<p;l++)s[x[l]]=v[l];for(var N=w;N<y;N++){var D=o[N],E=u?u[D]:D;if(!(E<0))for(f=g[E],p=g[E+1],s[D]=r(s[D],d[c?f:p-1]),l=c?f+1:f,m=c?p:p-1;l<m;l++){var A=h[l];s[A]=n(s[A],t(d[l],s[D]))}}return w}})),hm=ur("csLu",["abs","divideScalar","multiply","subtract","larger","largerEq","SparseMatrix"],(e=>{var{abs:r,divideScalar:t,multiply:n,subtract:i,larger:a,largerEq:o,SparseMatrix:s}=e,u=dm({divideScalar:t,multiply:n,subtract:i});return function(e,i,c){if(!e)return null;var l,f=e._size[1],p=100,m=100;i&&(l=i.q,p=i.lnz||p,m=i.unz||m);var d,h,g=[],y=[],v=[],x=new s({values:g,index:y,ptr:v,size:[f,f]}),b=[],w=[],N=[],D=new s({values:b,index:w,ptr:N,size:[f,f]}),E=[],A=[],C=[];for(d=0;d<f;d++)A[d]=0,E[d]=-1,v[d+1]=0;p=0,m=0;for(var S=0;S<f;S++){v[S]=p,N[S]=m;var M=l?l[S]:S,F=u(x,e,M,C,A,E,1),B=-1,T=-1;for(h=F;h<f;h++)if(E[d=C[h]]<0){var O=r(A[d]);a(O,T)&&(T=O,B=d)}else w[m]=E[d],b[m++]=A[d];if(-1===B||T<=0)return null;E[M]<0&&o(r(A[M]),n(T,c))&&(B=M);var _=A[B];for(w[m]=S,b[m++]=_,E[B]=S,y[p]=B,g[p++]=1,h=F;h<f;h++)E[d=C[h]]<0&&(y[p]=d,g[p++]=t(A[d],_)),A[d]=0}for(v[f]=p,N[f]=m,h=0;h<p;h++)y[h]=E[y[h]];return g.splice(p,g.length-p),y.splice(p,y.length-p),b.splice(m,b.length-m),w.splice(m,w.length-m),{L:x,U:D,pinv:E}}})),gm=ur("slu",["typed","abs","add","multiply","transpose","divideScalar","subtract","larger","largerEq","SparseMatrix"],(e=>{var{typed:r,abs:t,add:n,multiply:i,transpose:a,divideScalar:o,subtract:s,larger:u,largerEq:c,SparseMatrix:l}=e,f=cm({add:n,multiply:i,transpose:a}),p=hm({abs:t,divideScalar:o,multiply:i,subtract:s,larger:u,largerEq:c,SparseMatrix:l});return r("slu",{"SparseMatrix, number, number":function(e,r,t){if(!se(r)||r<0||r>3)throw new Error("Symbolic Ordering and Analysis order must be an integer number in the interval [0, 3]");if(t<0||t>1)throw new Error("Partial pivoting threshold must be a number from 0 to 1");var n=f(r,e,!1),i=p(e,n,t);return{L:i.L,U:i.U,p:i.pinv,q:n.q,toString:function(){return"L: "+this.L.toString()+"\nU: "+this.U.toString()+"\np: "+this.p.toString()+(this.q?"\nq: "+this.q.toString():"")+"\n"}}}})}));function ym(e,r){var t,n=r.length,i=[];if(e)for(t=0;t<n;t++)i[e[t]]=r[t];else for(t=0;t<n;t++)i[t]=r[t];return i}var vm="lusolve",xm=["typed","matrix","lup","slu","usolve","lsolve","DenseMatrix"],bm=ur(vm,xm,(e=>{var{typed:r,matrix:t,lup:n,slu:i,usolve:a,lsolve:o,DenseMatrix:s}=e,u=vc({DenseMatrix:s});return r(vm,{"Array, Array | Matrix":function(e,r){e=t(e);var i=n(e);return l(i.L,i.U,i.p,null,r).valueOf()},"DenseMatrix, Array | Matrix":function(e,r){var t=n(e);return l(t.L,t.U,t.p,null,r)},"SparseMatrix, Array | Matrix":function(e,r){var t=n(e);return l(t.L,t.U,t.p,null,r)},"SparseMatrix, Array | Matrix, number, number":function(e,r,t,n){var a=i(e,t,n);return l(a.L,a.U,a.p,a.q,r)},"Object, Array | Matrix":function(e,r){return l(e.L,e.U,e.p,e.q,r)}});function c(e){if(p(e))return e;if(f(e))return t(e);throw new TypeError("Invalid Matrix LU decomposition")}function l(e,r,t,n,i){e=c(e),r=c(r),t&&((i=u(e,i,!0))._data=ym(t,i._data));var s=o(e,i),l=a(r,s);return n&&(l._data=ym(n,l._data)),l}})),wm="polynomialRoot",Nm=["typed","isZero","equalScalar","add","subtract","multiply","divide","sqrt","unaryMinus","cbrt","typeOf","im","re"],Dm=ur(wm,Nm,(e=>{var{typed:r,isZero:t,equalScalar:n,add:i,subtract:a,multiply:o,divide:s,sqrt:u,unaryMinus:c,cbrt:l,typeOf:f,im:p,re:m}=e;return r(wm,{"number|Complex, ...number|Complex":(e,r)=>{for(var d=[e,...r];d.length>0&&t(d[d.length-1]);)d.pop();if(d.length<2)throw new RangeError("Polynomial [".concat(e,", ").concat(r,"] must have a non-zero non-constant coefficient"));switch(d.length){case 2:return[c(s(d[0],d[1]))];case 3:var[h,g,y]=d,v=o(2,y),x=o(g,g),b=o(4,y,h);if(n(x,b))return[s(c(g),v)];var w=u(a(x,b));return[s(a(w,g),v),s(a(c(w),g),v)];case 4:var[N,D,E,A]=d,C=c(o(3,A)),S=o(E,E),M=o(3,A,D),F=i(o(2,E,E,E),o(27,A,A,N)),B=o(9,A,E,D);if(n(S,M)&&n(F,B))return[s(E,C)];var T,O=a(S,M),_=a(F,B),z=i(o(18,A,E,D,N),o(E,E,D,D)),q=i(o(4,E,E,E,N),o(4,A,D,D,D),o(27,A,A,N,N));if(n(z,q))return[s(a(o(4,A,E,D),i(o(9,A,A,N),o(E,E,E))),o(A,O)),s(a(o(9,A,N),o(E,D)),o(2,O))];T=n(S,M)?_:s(i(_,u(a(o(_,_),o(4,O,O,O)))),2);return l(T,!0).toArray().map((e=>s(i(E,e,s(O,e)),C))).map((e=>"Complex"===f(e)&&n(m(e),m(e)+p(e))?m(e):e));default:throw new RangeError("only implemented for cubic or lower-order polynomials, not ".concat(d))}}})})),Em=["parse"],Am=ur("Help",Em,(e=>{var{parse:r}=e;function t(e){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");if(!e)throw new Error('Argument "doc" missing');this.doc=e}return t.prototype.type="Help",t.prototype.isHelp=!0,t.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 n={},i=0;i<e.examples.length;i++){var a=e.examples[i];t+=" "+a+"\n";var o=void 0;try{o=r(a).compile().evaluate(n)}catch(e){o=e}void 0===o||b(o)||(t+=" "+_e(o,{precision:14})+"\n")}t+="\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},t.prototype.toJSON=function(){var e=G(this.doc);return e.mathjs="Help",e},t.fromJSON=function(e){var r={};return Object.keys(e).filter((e=>"mathjs"!==e)).forEach((t=>{r[t]=e[t]})),new t(r)},t.prototype.valueOf=t.prototype.toString,t}),{isClass:!0}),Cm=["?on","math","typed"],Sm=ur("Chain",Cm,(e=>{var{on:r,math:t,typed:n}=e;function i(e){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");$(e)?this.value=e.value:this.value=e}function a(e,r){var t,n,a,s,u;t=i.prototype,n=e,a=function(){var e=r();if("function"==typeof e)return o(e)},u=!0,Object.defineProperty(t,n,{get:function(){return u&&(s=a(),u=!1),s},set:function(e){s=e,u=!1},configurable:!0,enumerable:!0})}function o(e){return function(){if(0===arguments.length)return new i(e(this.value));for(var r=[this.value],t=0;t<arguments.length;t++)r[t+1]=arguments[t];if(n.isTypedFunction(e)){var a=n.resolve(e,r);if(1===a.params.length)throw new Error("chain function "+e.name+" cannot match rest parameter between chain value and additional arguments.");return new i(a.implementation.apply(e,r))}return new i(e.apply(e,r))}}i.prototype.type="Chain",i.prototype.isChain=!0,i.prototype.done=function(){return this.value},i.prototype.valueOf=function(){return this.value},i.prototype.toString=function(){return _e(this.value)},i.prototype.toJSON=function(){return{mathjs:"Chain",value:this.value}},i.fromJSON=function(e){return new i(e.value)},i.createProxy=function(e,r){if("string"==typeof e)u=e,"function"==typeof(c=r)&&(i.prototype[u]=o(c));else{var t=function(r){Y(e,r)&&void 0===s[r]&&a(r,(()=>e[r]))};for(var n in e)t(n)}var u,c};var s={expression:!0,docs:!0,type:!0,classes:!0,json:!0,error:!0,isChain:!0};return i.createProxy(t),r&&r("import",(function(e,r,t){t||a(e,r)})),i}),{isClass:!0}),Mm={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"]},Fm={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"]},Bm={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:["[1, 2, 3]","A = [1, 2, 3; 4, 5, 6]","A[1, :]","A[1, 2] = 50","A[1:2, 1:2] = ones(2, 2)"],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:Mm,E:Mm,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:Fm,PI:Fm,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)"],description:"round a value towards the nearest integer.If x is complex, both real and imaginary part are rounded towards the nearest integer. When n is specified, the value is rounded to n decimals.",examples:["round(3.2)","round(3.8)","round(-4.2)","round(-4.8)","round(pi, 3)","round(123.45678, 2)"],seealso:["ceil","floor","fix"]},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 MoorePenrose 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 eigenvectors of a real symmetric matrix",examples:["eigs([[5, 2.3], [2.3, 1]])"],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:[]},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"]},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: $0, $1, $2", [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"]}},Tm="help",Om=ur(Tm,["typed","mathWithTransform","Help"],(e=>{var{typed:r,mathWithTransform:t,Help:n}=e;return r(Tm,{any:function(e){var r,i=e;if("string"!=typeof e)for(r in t)if(Y(t,r)&&e===t[r]){i=r;break}var a=lr(Bm,i);if(!a){var o="function"==typeof i?i.name:i;throw new Error('No documentation found on "'+o+'"')}return new n(a)}})})),_m="chain",zm=ur(_m,["typed","Chain"],(e=>{var{typed:r,Chain:t}=e;return r(_m,{"":function(){return new t},any:function(e){return new t(e)}})})),qm=ur("det",["typed","matrix","subtract","multiply","divideScalar","isZero","unaryMinus"],(e=>{var{typed:r,matrix:t,subtract:n,multiply:i,divideScalar:a,isZero:o,unaryMinus:s}=e;return r("det",{any:function(e){return G(e)},"Array | Matrix":function(e){var r;switch((r=p(e)?e.size():Array.isArray(e)?(e=t(e)).size():[]).length){case 0:return G(e);case 1:if(1===r[0])return G(e.valueOf()[0]);if(0===r[0])return 1;throw new RangeError("Matrix must be square (size: "+_e(r)+")");case 2:var u=r[0],c=r[1];if(u===c)return function(e,r,t){if(1===r)return G(e[0][0]);if(2===r)return n(i(e[0][0],e[1][1]),i(e[1][0],e[0][1]));for(var u=!1,c=new Array(r).fill(0).map(((e,r)=>r)),l=0;l<r;l++){var f=c[l];if(o(e[f][l])){var p=void 0;for(p=l+1;p<r;p++)if(!o(e[c[p]][l])){f=c[p],c[p]=c[l],c[l]=f,u=!u;break}if(p===r)return e[f][l]}for(var m=e[f][l],d=0===l?1:e[c[l-1]][l-1],h=l+1;h<r;h++)for(var g=c[h],y=l+1;y<r;y++)e[g][y]=a(n(i(e[g][y],m),i(e[g][l],e[f][y])),d)}var v=e[c[r-1]][r-1];return u?s(v):v}(e.clone().valueOf(),u);if(0===c)return 1;throw new RangeError("Matrix must be square (size: "+_e(r)+")");default:throw new RangeError("Matrix must be two dimensional (size: "+_e(r)+")")}}})})),Im=ur("inv",["typed","matrix","divideScalar","addScalar","multiply","unaryMinus","det","identity","abs"],(e=>{var{typed:r,matrix:t,divideScalar:n,addScalar:i,multiply:a,unaryMinus:o,det:s,identity:u,abs:c}=e;return r("inv",{"Array | Matrix":function(e){var r=p(e)?e.size():Ue(e);switch(r.length){case 1:if(1===r[0])return p(e)?t([n(1,e.valueOf()[0])]):[n(1,e[0])];throw new RangeError("Matrix must be square (size: "+_e(r)+")");case 2:var i=r[0],a=r[1];if(i===a)return p(e)?t(l(e.valueOf(),i,a),e.storage()):l(e,i,a);throw new RangeError("Matrix must be square (size: "+_e(r)+")");default:throw new RangeError("Matrix must be two dimensional (size: "+_e(r)+")")}},any:function(e){return n(1,e)}});function l(e,r,t){var l,f,p,m,d;if(1===r){if(0===(m=e[0][0]))throw Error("Cannot calculate inverse, determinant is zero");return[[n(1,m)]]}if(2===r){var h=s(e);if(0===h)throw Error("Cannot calculate inverse, determinant is zero");return[[n(e[1][1],h),n(o(e[0][1]),h)],[n(o(e[1][0]),h),n(e[0][0],h)]]}var g=e.concat();for(l=0;l<r;l++)g[l]=g[l].concat();for(var y=u(r).valueOf(),v=0;v<t;v++){var x=c(g[v][v]),b=v;for(l=v+1;l<r;)c(g[l][v])>x&&(x=c(g[l][v]),b=l),l++;if(0===x)throw Error("Cannot calculate inverse, determinant is zero");(l=b)!==v&&(d=g[v],g[v]=g[l],g[l]=d,d=y[v],y[v]=y[l],y[l]=d);var w=g[v],N=y[v];for(l=0;l<r;l++){var D=g[l],E=y[l];if(l!==v){if(0!==D[v]){for(p=n(o(D[v]),w[v]),f=v;f<t;f++)D[f]=i(D[f],a(p,w[f]));for(f=0;f<t;f++)E[f]=i(E[f],a(p,N[f]))}}else{for(p=w[v],f=v;f<t;f++)D[f]=n(D[f],p);for(f=0;f<t;f++)E[f]=n(E[f],p)}}}return y}})),km="pinv",Rm=ur(km,["typed","matrix","inv","deepEqual","equal","dotDivide","dot","ctranspose","divideScalar","multiply","add","Complex"],(e=>{var{typed:r,matrix:t,inv:n,deepEqual:i,equal:a,dotDivide:o,dot:s,ctranspose:u,divideScalar:c,multiply:l,add:f,Complex:m}=e;return r(km,{"Array | Matrix":function(e){var r=p(e)?e.size():Ue(e);switch(r.length){case 1:return g(e)?u(e):1===r[0]?n(e):o(u(e),s(e,e));case 2:if(g(e))return u(e);var i=r[0],a=r[1];if(i===a)try{return n(e)}catch(e){if(!(e instanceof Error&&e.message.match(/Cannot calculate inverse, determinant is zero/)))throw e}return p(e)?t(d(e.valueOf(),i,a),e.storage()):d(e,i,a);default:throw new RangeError("Matrix must be two dimensional (size: "+_e(r)+")")}},any:function(e){return a(e,0)?G(e):c(1,e)}});function d(e,r,t){var{C:i,F:a}=function(e,r,t){var n=function(e,r,t){for(var n=G(e),i=0,a=0;a<r;a++){if(t<=i)return n;for(var s=a;h(n[s][i]);)if(r===++s&&(s=a,t===++i))return n;[n[s],n[a]]=[n[a],n[s]];for(var u=n[a][i],c=0;c<t;c++)n[a][c]=o(n[a][c],u);for(var p=0;p<r;p++)if(p!==a){u=n[p][i];for(var m=0;m<t;m++)n[p][m]=f(n[p][m],l(-1,l(u,n[a][m])))}i++}return n}(e,r,t),i=e.map(((e,t)=>e.filter(((e,t)=>t<r&&!h(s(n[t],n[t])))))),a=n.filter(((e,r)=>!h(s(n[r],n[r]))));return{C:i,F:a}}(e,r,t),c=l(n(l(u(i),i)),u(i)),p=l(u(a),n(l(a,u(a))));return l(p,c)}function h(e){return a(f(e,m(1,1)),f(0,m(1,1)))}function g(e){return i(f(e,m(1,1)),f(l(e,0),m(1,1)))}}));function Pm(e){var{addScalar:r,subtract:t,flatten:n,multiply:i,multiplyScalar:a,divideScalar:o,sqrt:s,abs:u,bignumber:c,diag:l,inv:f,qr:p,usolve:m,usolveAll:d,equal:h,complex:g,larger:y,smaller:v,matrixFromColumns:x,dot:b}=e;function w(e,n,i,o){var u=r(e,o),c=t(a(e,o),a(n,i)),l=a(u,.5),f=a(s(t(a(u,u),a(4,c))),.5);return[r(l,f),t(l,f)]}function N(e,r,n,i,a,o,s,l){var f="BigNumber"===l,p="Complex"===l,m=f?c(0):p?g(0):0,d=f?c(1):p?g(1):1;if(v(u(n),s))return[[d,m],[m,d]];if(y(u(t(a,o)),s))return[[t(a,i),t(o,i)],[n,n]];var h=t(e,a),x=t(r,a),b=t(n,a),w=t(i,a);return v(u(x),s)?[[h,d],[b,m]]:[[x,m],[w,d]]}function D(e,r){for(var t=0;t<e.length;t++)e[t].push(...Array(r-e[t].length).fill(0));for(var n=e.length;n<r;n++)e.push(Array(r).fill(0)),e[n][n]=1;return e}function E(e,r,t){for(var n=0;n<e.length;n++)if(t(e[n],r))return n;return-1}function A(e,r,t,n,i){for(var a,o="BigNumber"===i?c(1e3):1e3,s=0;a=C(r,t,i),a=m(e,a),!y(M(a),o);)if(++s>=5)return null;for(s=0;;){var u=m(e,a);if(v(M(S(a,[u])),n))break;if(++s>=10)return null;a=F(u)}return a}function C(e,r,t){var n="BigNumber"===t,i="Complex"===t,a=Array(e).fill(0).map((e=>2*Math.random()-1));return n&&(a=a.map((e=>c(e)))),i&&(a=a.map((e=>g(e)))),F(a=S(a,r),t)}function S(e,r){for(var n of r)e=t(e,i(o(b(n,e),b(n,n)),n));return e}function M(e){return u(s(b(e,e)))}function F(e,r){var t="Complex"===r,n="BigNumber"===r?c(1):t?g(1):1;return i(o(n,M(e)),e)}return function(e,s,m,b,C){void 0===C&&(C=!0);var S=function(e,t,n,i,s){var f,p="BigNumber"===i,m="Complex"===i,d=p?c(0):0,x=p?c(1):m?g(1):1,b=p?c(1):1,w=p?c(10):2,N=a(w,w);s&&(f=Array(t).fill(x));var D=!1;for(;!D;){D=!0;for(var E=0;E<t;E++){for(var A=d,C=d,S=0;S<t;S++)if(E!==S){var M=u(e[E][S]);A=r(A,M),C=r(C,M)}if(!h(A,0)&&!h(C,0)){for(var F=b,B=A,T=o(C,w),O=a(C,w);v(B,T);)B=a(B,N),F=a(F,w);for(;y(B,O);)B=o(B,N),F=o(F,w);if(v(o(r(B,C),F),a(r(A,C),.95))){D=!1;for(var _=o(1,F),z=0;z<t;z++)E!==z&&(e[E][z]=a(e[E][z],F),e[z][E]=a(e[z][E],_));s&&(f[E]=a(f[E],F))}}}}return l(f)}(e,s,0,b,C);!function(e,n,i,s,l,f){var p="BigNumber"===s,m="Complex"===s,d=p?c(0):m?g(0):0;p&&(i=c(i));for(var h=0;h<n-2;h++){for(var y=0,x=d,b=h+1;b<n;b++){var w=e[b][h];v(u(x),u(w))&&(x=w,y=b)}if(!v(u(x),i)){if(y!==h+1){var N=e[y];e[y]=e[h+1],e[h+1]=N;for(var D=0;D<n;D++){var E=e[D][y];e[D][y]=e[D][h+1],e[D][h+1]=E}if(l){var A=f[y];f[y]=f[h+1],f[h+1]=A}}for(var C=h+2;C<n;C++){var S=o(e[C][h],x);if(0!==S){for(var M=0;M<n;M++)e[C][M]=t(e[C][M],a(S,e[h+1][M]));for(var F=0;F<n;F++)e[F][h+1]=r(e[F][h+1],a(S,e[F][C]));if(l)for(var B=0;B<n;B++)f[C][B]=t(f[C][B],a(S,f[h+1][B]))}}}}}(e,s,m,b,C,S);var M,{values:F,C:B}=function(e,n,a,o,s){var f="BigNumber"===o,m="Complex"===o,d=f?c(1):m?g(1):1;f&&(a=c(a));var h=G(e),y=[],x=n,b=[],E=s?l(Array(n).fill(d)):void 0,A=s?l(Array(x).fill(d)):void 0,C=0;for(;C<=100;){C+=1;for(var S=0,M=0;M<x;M++)h[M][M]=t(h[M][M],S);var{Q:F,R:B}=p(h);h=i(B,F);for(var T=0;T<x;T++)h[T][T]=r(h[T][T],S);if(s&&(A=i(A,F)),1===x||v(u(h[x-1][x-2]),a)){C=0,y.push(h[x-1][x-1]),s&&(b.unshift([[1]]),D(A,n),E=i(E,A),x>1&&(A=l(Array(x-1).fill(d)))),x-=1,h.pop();for(var O=0;O<x;O++)h[O].pop()}else if(2===x||v(u(h[x-2][x-3]),a)){C=0;var _=w(h[x-2][x-2],h[x-2][x-1],h[x-1][x-2],h[x-1][x-1]);y.push(..._),s&&(b.unshift(N(h[x-2][x-2],h[x-2][x-1],h[x-1][x-2],h[x-1][x-1],_[0],_[1],a,o)),D(A,n),E=i(E,A),x>2&&(A=l(Array(x-2).fill(d)))),x-=2,h.pop(),h.pop();for(var z=0;z<x;z++)h[z].pop(),h[z].pop()}if(0===x)break}if(y.sort(((e,r)=>+t(u(e),u(r)))),C>100){var q=Error("The eigenvalues failed to converge. Only found these eigenvalues: "+y.join(", "));throw q.values=y,q.vectors=[],q}var I=s?i(E,function(e,r){for(var t=[],n=0;n<r;n++)t[n]=Array(r).fill(0);var i=0;for(var a of e){for(var o=a.length,s=0;s<o;s++)for(var u=0;u<o;u++)t[i+s][i+u]=a[s][u];i+=o}return t}(b,n)):void 0;return{values:y,C:I}}(e,s,m,b,C);return C&&(M=function(e,r,a,o,s,u,p){var m=f(a),y=i(m,e,a),v="BigNumber"===p,x="Complex"===p,b=v?c(0):x?g(0):0,w=v?c(1):x?g(1):1,N=[],D=[];for(var C of s){var S=E(N,C,h);-1===S?(N.push(C),D.push(1)):D[S]+=1}for(var M=[],F=N.length,B=Array(r).fill(b),T=l(Array(r).fill(w)),O=[],_=function(){var e=N[z],s=t(y,i(e,T)),c=d(s,B);for(c.shift();c.length<D[z];){var l=A(s,r,c,u,p);if(null==l){O.push(e);break}c.push(l)}var m=i(f(o),a);c=c.map((e=>i(m,e))),M.push(...c.map((e=>n(e))))},z=0;z<F;z++)_();if(0!==O.length){var q=new Error("Failed to find eigenvectors for the following eigenvalues: "+O.join(", "));throw q.values=s,q.vectors=M,q}return M}(e,s,B,S,F,m,b),M=x(...M)),{values:F,vectors:M}}}function Um(e){var{config:r,addScalar:t,subtract:n,abs:i,atan:a,cos:o,sin:s,multiplyScalar:u,inv:c,bignumber:l,multiply:f,add:p}=e;function m(e,t,n){var i=t-e;return Math.abs(i)<=r.epsilon?Math.PI/4:.5*Math.atan(2*n/(t-e))}function d(e,t,o){var s=n(t,e);return i(s)<=r.epsilon?l(-1).acos().div(4):u(.5,a(f(2,o,c(s))))}function h(e,r,t,n){for(var i=e.length,a=Math.cos(r),o=Math.sin(r),s=N(i,0),u=N(i,0),c=0;c<i;c++)s[c]=a*e[c][t]-o*e[c][n],u[c]=o*e[c][t]+a*e[c][n];for(var l=0;l<i;l++)e[l][t]=s[l],e[l][n]=u[l];return e}function g(e,r,i,a){for(var c=e.length,f=o(r),p=s(r),m=N(c,l(0)),d=N(c,l(0)),h=0;h<c;h++)m[h]=n(u(f,e[h][i]),u(p,e[h][a])),d[h]=t(u(p,e[h][i]),u(f,e[h][a]));for(var g=0;g<c;g++)e[g][i]=m[g],e[g][a]=d[g];return e}function y(e,r,i,a){for(var c=e.length,m=l(o(r)),d=l(s(r)),h=u(m,m),g=u(d,d),y=N(c,l(0)),v=N(c,l(0)),x=f(l(2),m,d,e[i][a]),b=t(n(u(h,e[i][i]),x),u(g,e[a][a])),w=p(u(g,e[i][i]),x,u(h,e[a][a])),D=0;D<c;D++)y[D]=n(u(m,e[i][D]),u(d,e[a][D])),v[D]=t(u(d,e[i][D]),u(m,e[a][D]));e[i][i]=b,e[a][a]=w,e[i][a]=l(0),e[a][i]=l(0);for(var E=0;E<c;E++)E!==i&&E!==a&&(e[i][E]=y[E],e[E][i]=y[E],e[a][E]=v[E],e[E][a]=v[E]);return e}function v(e,r,t,n){for(var i=e.length,a=Math.cos(r),o=Math.sin(r),s=a*a,u=o*o,c=N(i,0),l=N(i,0),f=s*e[t][t]-2*a*o*e[t][n]+u*e[n][n],p=u*e[t][t]+2*a*o*e[t][n]+s*e[n][n],m=0;m<i;m++)c[m]=a*e[t][m]-o*e[n][m],l[m]=o*e[t][m]+a*e[n][m];e[t][t]=f,e[n][n]=p,e[t][n]=0,e[n][t]=0;for(var d=0;d<i;d++)d!==t&&d!==n&&(e[t][d]=c[d],e[d][t]=c[d],e[n][d]=l[d],e[d][n]=l[d]);return e}function x(e){for(var r=e.length,t=0,n=[0,1],i=0;i<r;i++)for(var a=i+1;a<r;a++)Math.abs(t)<Math.abs(e[i][a])&&(t=Math.abs(e[i][a]),n=[i,a]);return[n,t]}function b(e){for(var r=e.length,t=0,n=[0,1],a=0;a<r;a++)for(var o=a+1;o<r;o++)i(t)<i(e[a][o])&&(t=i(e[a][o]),n=[a,o]);return[n,t]}function w(e,r){for(var t=e.length,n=Array(t),a=Array(t),o=0;o<t;o++)a[o]=Array(t);for(var s=0;s<t;s++){for(var u=0,c=e[0],l=0;l<e.length;l++)i(e[l])<i(c)&&(c=e[u=l]);n[s]=e.splice(u,1)[0];for(var f=0;f<t;f++)a[f][s]=r[f][u],r[f].splice(u,1)}return{values:n,vectors:a}}function N(e,r){for(var t=new Array(e),n=0;n<e;n++)t[n]=r;return t}return function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:r.epsilon,a=arguments.length>3?arguments[3]:void 0;if("number"===a)return function(e,r){for(var t,n=e.length,i=Math.abs(r/n),a=new Array(n),o=0;o<n;o++)a[o]=N(n,0),a[o][o]=1;var s=x(e);for(;Math.abs(s[1])>=Math.abs(i);){var u=s[0][0],c=s[0][1];e=v(e,t=m(e[u][u],e[c][c],e[u][c]),u,c),a=h(a,t,u,c),s=x(e)}for(var l=N(n,0),f=0;f<n;f++)l[f]=e[f][f];return w(G(l),G(a))}(e,n);if("BigNumber"===a)return function(e,r){for(var t,n=e.length,a=i(r/n),o=new Array(n),s=0;s<n;s++)o[s]=N(n,0),o[s][s]=1;var u=b(e);for(;i(u[1])>=i(a);){var c=u[0][0],l=u[0][1];e=y(e,t=d(e[c][c],e[l][l],e[c][l]),c,l),o=g(o,t,c,l),u=b(e)}for(var f=N(n,0),p=0;p<n;p++)f[p]=e[p][p];return w(G(f),G(o))}(e,n);throw TypeError("Unsupported data type: "+a)}}var jm=ur("eigs",["config","typed","matrix","addScalar","equal","subtract","abs","atan","cos","sin","multiplyScalar","divideScalar","inv","bignumber","multiply","add","larger","column","flatten","number","complex","sqrt","diag","qr","usolve","usolveAll","im","re","smaller","matrixFromColumns","dot"],(e=>{var{config:r,typed:t,matrix:n,addScalar:i,subtract:c,equal:l,abs:f,atan:p,cos:m,sin:d,multiplyScalar:h,divideScalar:g,inv:y,bignumber:v,multiply:x,add:b,larger:w,column:N,flatten:D,number:E,complex:A,sqrt:C,diag:S,qr:M,usolve:F,usolveAll:B,im:T,re:O,smaller:_,matrixFromColumns:z,dot:q}=e,I=Um({config:r,addScalar:i,subtract:c,column:N,flatten:D,equal:l,abs:f,atan:p,cos:m,sin:d,multiplyScalar:h,inv:y,bignumber:v,complex:A,multiply:x,add:b}),k=Pm({config:r,addScalar:i,subtract:c,multiply:x,multiplyScalar:h,flatten:D,divideScalar:g,sqrt:C,abs:f,bignumber:v,diag:S,qr:M,inv:y,usolve:F,usolveAll:B,equal:l,complex:A,larger:w,smaller:_,matrixFromColumns:z,dot:q});return t("eigs",{Array:function(e){return R(n(e))},"Array, number|BigNumber":function(e,r){return R(n(e),r)},Matrix:function(e){var{values:r,vectors:t}=R(e);return{values:n(r),vectors:n(t)}},"Matrix, number|BigNumber":function(e,r){var{values:t,vectors:i}=R(e,r);return{values:n(t),vectors:n(i)}}});function R(e,t){void 0===t&&(t=r.epsilon);var n=e.size();if(2!==n.length||n[0]!==n[1])throw new RangeError("Matrix must be square (size: "+_e(n)+")");var i=e.toArray(),a=n[0];if(function(e,r,t){for(var n=0;n<r;n++)for(var i=0;i<r;i++)if(w(v(f(T(e[n][i]))),t))return!1;return!0}(i,a,t)&&(function(e,r){for(var t=0;t<r;t++)for(var n=0;n<r;n++)e[t][n]=O(e[t][n])}(i,a),function(e,r,t){for(var n=0;n<r;n++)for(var i=n;i<r;i++)if(w(v(f(c(e[n][i],e[i][n]))),t))return!1;return!0}(i,a,t))){var o=P(e,i,a);return I(i,a,t,o)}var s=P(e,i,a);return k(i,a,t,s)}function P(e,r,t){var n=e.datatype();if("number"===n||"BigNumber"===n||"Complex"===n)return n;for(var i=!1,c=!1,l=!1,f=0;f<t;f++)for(var p=0;p<t;p++){var m=r[f][p];if(a(m)||u(m))i=!0;else if(o(m))c=!0;else{if(!s(m))throw TypeError("Unsupported type in Matrix: "+Z(m));l=!0}}if(c&&l&&console.warn("Complex BigNumbers not supported, this operation will lose precission."),l){for(var d=0;d<t;d++)for(var h=0;h<t;h++)r[d][h]=A(r[d][h]);return"Complex"}if(c){for(var g=0;g<t;g++)for(var y=0;y<t;y++)r[g][y]=v(r[g][y]);return"BigNumber"}if(i){for(var x=0;x<t;x++)for(var b=0;b<t;b++)r[x][b]=E(r[x][b]);return"number"}throw TypeError("Matrix contains unsupported types only.")}})),Lm="expm",Hm=ur(Lm,["typed","abs","add","identity","inv","multiply"],(e=>{var{typed:r,abs:t,add:n,identity:i,inv:a,multiply:o}=e;return r(Lm,{Matrix:function(e){var r=e.size();if(2!==r.length||r[0]!==r[1])throw new RangeError("Matrix must be square (size: "+_e(r)+")");for(var u=r[0],c=function(e){for(var r=e.size()[0],n=0,i=0;i<r;i++){for(var a=0,o=0;o<r;o++)a+=t(e.get([i,o]));n=Math.max(a,n)}return n}(e),l=function(e,r){for(var t=30,n=0;n<t;n++)for(var i=0;i<=n;i++){var a=n-i;if(s(e,i,a)<r)return{q:i,j:a}}throw new Error("Could not find acceptable parameters to compute the matrix exponential (try increasing maxSearchSize in expm.js)")}(c,1e-15),f=l.q,p=l.j,m=o(e,Math.pow(2,-p)),d=i(u),g=i(u),y=1,v=m,x=-1,b=1;b<=f;b++)b>1&&(v=o(v,m),x=-x),d=n(d,o(y=y*(f-b+1)/((2*f-b+1)*b),v)),g=n(g,o(y*x,v));for(var w=o(a(g),d),N=0;N<p;N++)w=o(w,w);return h(e)?e.createSparseMatrix(w):w}});function s(e,r,t){for(var n=1,i=2;i<=r;i++)n*=i;for(var a=n,o=r+1;o<=2*r;o++)a*=o;var s=a*(2*r+1);return 8*Math.pow(e/Math.pow(2,t),2*r)*n*n/(a*s)}})),$m="sqrtm",Zm=ur($m,["typed","abs","add","multiply","map","sqrt","subtract","inv","size","max","identity"],(e=>{var{typed:r,abs:t,add:n,multiply:i,map:a,sqrt:o,subtract:s,inv:u,size:c,max:l,identity:f}=e,m=1e-6;function d(e){var r,a=0,o=e,p=f(c(e));do{var d=o;if(o=i(.5,n(d,u(p))),p=i(.5,n(p,u(d))),(r=l(t(s(o,d))))>m&&++a>1e3)throw new Error("computing square root of matrix: iterative method could not converge")}while(r>m);return o}return r($m,{"Array | Matrix":function(e){var r=p(e)?e.size():Ue(e);switch(r.length){case 1:if(1===r[0])return a(e,o);throw new RangeError("Matrix must be square (size: "+_e(r)+")");case 2:if(r[0]===r[1])return d(e);throw new RangeError("Matrix must be square (size: "+_e(r)+")");default:throw new RangeError("Matrix must be at most two dimensional (size: "+_e(r)+")")}}})})),Gm="sylvester",Vm=ur(Gm,["typed","schur","matrixFromColumns","matrix","multiply","range","concat","transpose","index","subset","add","subtract","identity","lusolve","abs"],(e=>{var{typed:r,schur:t,matrixFromColumns:n,matrix:i,multiply:a,range:o,concat:s,transpose:u,index:c,subset:l,add:f,subtract:p,identity:m,lusolve:d,abs:h}=e;return r(Gm,{"Matrix, Matrix, Matrix":g,"Array, Matrix, Matrix":function(e,r,t){return g(i(e),r,t)},"Array, Array, Matrix":function(e,r,t){return g(i(e),i(r),t)},"Array, Matrix, Array":function(e,r,t){return g(i(e),r,i(t))},"Matrix, Array, Matrix":function(e,r,t){return g(e,i(r),t)},"Matrix, Array, Array":function(e,r,t){return g(e,i(r),i(t))},"Matrix, Matrix, Array":function(e,r,t){return g(e,r,i(t))},"Array, Array, Array":function(e,r,t){return g(i(e),i(r),i(t)).toArray()}});function g(e,r,g){for(var y=r.size()[0],v=e.size()[0],x=t(e),b=x.T,w=x.U,N=t(a(-1,r)),D=N.T,E=N.U,A=a(a(u(w),g),E),C=o(0,v),S=[],M=(e,r)=>s(e,r,1),F=(e,r)=>s(e,r,0),B=0;B<y;B++)if(B<y-1&&h(l(D,c(B+1,B)))>1e-5){for(var T=F(l(A,c(C,B)),l(A,c(C,B+1))),O=0;O<B;O++)T=f(T,F(a(S[O],l(D,c(O,B))),a(S[O],l(D,c(O,B+1)))));var _=a(m(v),a(-1,l(D,c(B,B)))),z=a(m(v),a(-1,l(D,c(B+1,B)))),q=a(m(v),a(-1,l(D,c(B,B+1)))),I=a(m(v),a(-1,l(D,c(B+1,B+1)))),k=F(M(f(b,_),z),M(q,f(b,I))),R=d(k,T);S[B]=R.subset(c(o(0,v),0)),S[B+1]=R.subset(c(o(v,2*v),0)),B++}else{for(var P=l(A,c(C,B)),U=0;U<B;U++)P=f(P,a(S[U],l(D,c(U,B))));var j=l(D,c(B,B)),L=p(b,a(j,m(v)));S[B]=d(L,P)}var H=i(n(...S));return a(w,a(H,u(E)))}})),Wm="schur",Ym=ur(Wm,["typed","matrix","identity","multiply","qr","norm","subtract"],(e=>{var{typed:r,matrix:t,identity:n,multiply:i,qr:a,norm:o,subtract:s}=e;return r(Wm,{Array:function(e){var r=u(t(e));return{U:r.U.valueOf(),T:r.T.valueOf()}},Matrix:function(e){return u(e)}});function u(e){var r,t=e.size()[0],u=e,c=n(t),l=0;do{r=u;var f=a(u),p=f.Q,m=f.R;if(u=i(m,p),c=i(c,p),l++>100)break}while(o(s(u,r))>1e-4);return{U:c,T:u}}})),Jm="lyap",Xm=ur(Jm,["typed","matrix","sylvester","multiply","transpose"],(e=>{var{typed:r,matrix:t,sylvester:n,multiply:i,transpose:a}=e;return r(Jm,{"Matrix, Matrix":function(e,r){return n(e,a(e),i(-1,r))},"Array, Matrix":function(e,r){return n(t(e),a(t(e)),i(-1,r))},"Matrix, Array":function(e,r){return n(e,a(t(e)),t(i(-1,r)))},"Array, Array":function(e,r){return n(t(e),a(t(e)),t(i(-1,r))).toArray()}})})),Qm=ur("divide",["typed","matrix","multiply","equalScalar","divideScalar","inv"],(e=>{var{typed:r,matrix:t,multiply:n,equalScalar:i,divideScalar:a,inv:o}=e,s=$a({typed:r,equalScalar:i}),u=Ga({typed:r});return r("divide",V({"Array | Matrix, Array | Matrix":function(e,r){return n(e,o(r))},"DenseMatrix, any":function(e,r){return u(e,r,a,!1)},"SparseMatrix, any":function(e,r){return s(e,r,a,!1)},"Array, any":function(e,r){return u(t(e),r,a,!1).valueOf()},"any, Array | Matrix":function(e,r){return n(e,o(r))}},a.signatures))})),Km="distance",ed=ur(Km,["typed","addScalar","subtract","divideScalar","multiplyScalar","deepEqual","sqrt","abs"],(e=>{var{typed:r,addScalar:t,subtract:n,multiplyScalar:i,divideScalar:a,deepEqual:s,sqrt:u,abs:c}=e;return r(Km,{"Array, Array, Array":function(e,r,t){if(2===e.length&&2===r.length&&2===t.length){if(!f(e))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!f(r))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!f(t))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(s(r,t))throw new TypeError("LinePoint1 should not be same with LinePoint2");var a=n(t[1],r[1]),o=n(r[0],t[0]),u=n(i(t[0],r[1]),i(r[0],t[1]));return g(e[0],e[1],a,o,u)}throw new TypeError("Invalid Arguments: Try again")},"Object, Object, Object":function(e,r,t){if(2===Object.keys(e).length&&2===Object.keys(r).length&&2===Object.keys(t).length){if(!f(e))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!f(r))throw new TypeError("Values of lineOnePtX and lineOnePtY should be numbers or BigNumbers");if(!f(t))throw new TypeError("Values of lineTwoPtX and lineTwoPtY should be numbers or BigNumbers");if(s(h(r),h(t)))throw new TypeError("LinePoint1 should not be same with LinePoint2");if("pointX"in e&&"pointY"in e&&"lineOnePtX"in r&&"lineOnePtY"in r&&"lineTwoPtX"in t&&"lineTwoPtY"in t){var a=n(t.lineTwoPtY,r.lineOnePtY),o=n(r.lineOnePtX,t.lineTwoPtX),u=n(i(t.lineTwoPtX,r.lineOnePtY),i(r.lineOnePtX,t.lineTwoPtY));return g(e.pointX,e.pointY,a,o,u)}throw new TypeError("Key names do not match")}throw new TypeError("Invalid Arguments: Try again")},"Array, Array":function(e,r){if(2===e.length&&3===r.length){if(!f(e))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!p(r))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");return g(e[0],e[1],r[0],r[1],r[2])}if(3===e.length&&6===r.length){if(!p(e))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!d(r))throw new TypeError("Array with 6 numbers or BigNumbers expected for second argument");return y(e[0],e[1],e[2],r[0],r[1],r[2],r[3],r[4],r[5])}if(e.length===r.length&&e.length>0){if(!m(e))throw new TypeError("All values of an array should be numbers or BigNumbers");if(!m(r))throw new TypeError("All values of an array should be numbers or BigNumbers");return v(e,r)}throw new TypeError("Invalid Arguments: Try again")},"Object, Object":function(e,r){if(2===Object.keys(e).length&&3===Object.keys(r).length){if(!f(e))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!p(r))throw new TypeError("Values of xCoeffLine, yCoeffLine and constant should be numbers or BigNumbers");if("pointX"in e&&"pointY"in e&&"xCoeffLine"in r&&"yCoeffLine"in r&&"constant"in r)return g(e.pointX,e.pointY,r.xCoeffLine,r.yCoeffLine,r.constant);throw new TypeError("Key names do not match")}if(3===Object.keys(e).length&&6===Object.keys(r).length){if(!p(e))throw new TypeError("Values of pointX, pointY and pointZ should be numbers or BigNumbers");if(!d(r))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 r&&"y0"in r&&"z0"in r&&"a"in r&&"b"in r&&"c"in r)return y(e.pointX,e.pointY,e.pointZ,r.x0,r.y0,r.z0,r.a,r.b,r.c);throw new TypeError("Key names do not match")}if(2===Object.keys(e).length&&2===Object.keys(r).length){if(!f(e))throw new TypeError("Values of pointOneX and pointOneY should be numbers or BigNumbers");if(!f(r))throw new TypeError("Values of pointTwoX and pointTwoY should be numbers or BigNumbers");if("pointOneX"in e&&"pointOneY"in e&&"pointTwoX"in r&&"pointTwoY"in r)return v([e.pointOneX,e.pointOneY],[r.pointTwoX,r.pointTwoY]);throw new TypeError("Key names do not match")}if(3===Object.keys(e).length&&3===Object.keys(r).length){if(!p(e))throw new TypeError("Values of pointOneX, pointOneY and pointOneZ should be numbers or BigNumbers");if(!p(r))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 r&&"pointTwoY"in r&&"pointTwoZ"in r)return v([e.pointOneX,e.pointOneY,e.pointOneZ],[r.pointTwoX,r.pointTwoY,r.pointTwoZ]);throw new TypeError("Key names do not match")}throw new TypeError("Invalid Arguments: Try again")},Array:function(e){if(!function(e){if(2===e[0].length&&l(e[0][0])&&l(e[0][1])){if(e.some((e=>2!==e.length||!l(e[0])||!l(e[1]))))return!1}else{if(!(3===e[0].length&&l(e[0][0])&&l(e[0][1])&&l(e[0][2])))return!1;if(e.some((e=>3!==e.length||!l(e[0])||!l(e[1])||!l(e[2]))))return!1}return!0}(e))throw new TypeError("Incorrect array format entered for pairwise distance calculation");return function(e){for(var r=[],t=[],n=[],i=0;i<e.length-1;i++)for(var a=i+1;a<e.length;a++)2===e[0].length?(t=[e[i][0],e[i][1]],n=[e[a][0],e[a][1]]):3===e[0].length&&(t=[e[i][0],e[i][1],e[i][2]],n=[e[a][0],e[a][1],e[a][2]]),r.push(v(t,n));return r}(e)}});function l(e){return"number"==typeof e||o(e)}function f(e){return e.constructor!==Array&&(e=h(e)),l(e[0])&&l(e[1])}function p(e){return e.constructor!==Array&&(e=h(e)),l(e[0])&&l(e[1])&&l(e[2])}function m(e){return Array.isArray(e)||(e=h(e)),e.every(l)}function d(e){return e.constructor!==Array&&(e=h(e)),l(e[0])&&l(e[1])&&l(e[2])&&l(e[3])&&l(e[4])&&l(e[5])}function h(e){for(var r=Object.keys(e),t=[],n=0;n<r.length;n++)t.push(e[r[n]]);return t}function g(e,r,n,o,s){var l=c(t(t(i(n,e),i(o,r)),s)),f=u(t(i(n,n),i(o,o)));return a(l,f)}function y(e,r,o,s,c,l,f,p,m){var d=[n(i(n(c,r),m),i(n(l,o),p)),n(i(n(l,o),f),i(n(s,e),m)),n(i(n(s,e),p),i(n(c,r),f))];d=u(t(t(i(d[0],d[0]),i(d[1],d[1])),i(d[2],d[2])));var h=u(t(t(i(f,f),i(p,p)),i(m,m)));return a(d,h)}function v(e,r){for(var a=e.length,o=0,s=0,c=0;c<a;c++)s=n(e[c],r[c]),o=t(i(s,s),o);return u(o)}})),rd=ur("intersect",["typed","config","abs","add","addScalar","matrix","multiply","multiplyScalar","divideScalar","subtract","smaller","equalScalar","flatten","isZero","isNumeric"],(e=>{var{typed:r,config:t,abs:n,add:i,addScalar:a,matrix:o,multiply:s,multiplyScalar:u,divideScalar:c,subtract:l,smaller:f,equalScalar:p,flatten:m,isZero:d,isNumeric:h}=e;return r("intersect",{"Array, Array, Array":g,"Array, Array, Array, Array":y,"Matrix, Matrix, Matrix":function(e,r,t){var n=g(e.valueOf(),r.valueOf(),t.valueOf());return null===n?null:o(n)},"Matrix, Matrix, Matrix, Matrix":function(e,r,t,n){var i=y(e.valueOf(),r.valueOf(),t.valueOf(),n.valueOf());return null===i?null:o(i)}});function g(e,r,t){if(e=v(e),r=v(r),t=v(t),!b(e))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!b(r))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!function(e){return 4===e.length&&h(e[0])&&h(e[1])&&h(e[2])&&h(e[3])}(t))throw new TypeError("Array with 4 numbers expected as third argument");return function(e,r,t,n,i,o,s,f,p,m){var d=u(e,s),h=u(n,s),g=u(r,f),y=u(i,f),v=u(t,p),x=u(o,p),b=l(l(l(m,d),g),v),w=l(l(l(a(a(h,y),x),d),g),v),N=c(b,w),D=a(e,u(N,l(n,e))),E=a(r,u(N,l(i,r))),A=a(t,u(N,l(o,t)));return[D,E,A]}(e[0],e[1],e[2],r[0],r[1],r[2],t[0],t[1],t[2],t[3])}function y(e,r,o,m){if(e=v(e),r=v(r),o=v(o),m=v(m),2===e.length){if(!x(e))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!x(r))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!x(o))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(!x(m))throw new TypeError("Array with 2 numbers or BigNumbers expected for fourth argument");return function(e,r,o,p){var m=e,h=o,g=l(m,r),y=l(h,p),v=l(u(g[0],y[1]),u(y[0],g[1]));if(d(v))return null;if(f(n(v),t.epsilon))return null;var x=u(y[0],m[1]),b=u(y[1],m[0]),w=u(y[0],h[1]),N=u(y[1],h[0]),D=c(a(l(l(x,b),w),N),v);return i(s(g,D),m)}(e,r,o,m)}if(3===e.length){if(!b(e))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!b(r))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!b(o))throw new TypeError("Array with 3 numbers or BigNumbers expected for third argument");if(!b(m))throw new TypeError("Array with 3 numbers or BigNumbers expected for fourth argument");return function(e,r,t,n,i,o,s,f,m,h,g,y){var v=w(e,s,h,s,r,f,g,f,t,m,y,m),x=w(h,s,n,e,g,f,i,r,y,m,o,t),b=w(e,s,n,e,r,f,i,r,t,m,o,t),N=w(h,s,h,s,g,f,g,f,y,m,y,m),D=w(n,e,n,e,i,r,i,r,o,t,o,t),E=l(u(v,x),u(b,N)),A=l(u(D,N),u(x,x));if(d(A))return null;var C=c(E,A),S=c(a(v,u(C,x)),N),M=a(e,u(C,l(n,e))),F=a(r,u(C,l(i,r))),B=a(t,u(C,l(o,t))),T=a(s,u(S,l(h,s))),O=a(f,u(S,l(g,f))),_=a(m,u(S,l(y,m)));return p(M,T)&&p(F,O)&&p(B,_)?[M,F,B]:null}(e[0],e[1],e[2],r[0],r[1],r[2],o[0],o[1],o[2],m[0],m[1],m[2])}throw new TypeError("Arrays with two or thee dimensional points expected")}function v(e){return 1===e.length?e[0]:e.length>1&&Array.isArray(e[0])&&e.every((e=>Array.isArray(e)&&1===e.length))?m(e):e}function x(e){return 2===e.length&&h(e[0])&&h(e[1])}function b(e){return 3===e.length&&h(e[0])&&h(e[1])&&h(e[2])}function w(e,r,t,n,i,o,s,c,f,p,m,d){var h=u(l(e,r),l(t,n)),g=u(l(i,o),l(s,c)),y=u(l(f,p),l(m,d));return a(a(h,g),y)}})),td=ur("sum",["typed","config","add","numeric"],(e=>{var{typed:r,config:t,add:n,numeric:i}=e;return r("sum",{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(e,r){try{return Bn(e,r,n)}catch(e){throw Lu(e,"sum")}},"...":function(e){if(Sn(e))throw new TypeError("Scalar values expected in function sum");return a(e)}});function a(e){var r;return Mn(e,(function(e){try{r=void 0===r?e:n(r,e)}catch(r){throw Lu(r,"sum",e)}})),void 0===r&&(r=i(0,t.number)),"string"==typeof r&&(r=i(r,t.number)),r}})),nd="cumsum",id=ur(nd,["typed","add","unaryPlus"],(e=>{var{typed:r,add:t,unaryPlus:n}=e;return r(nd,{Array:i,Matrix:function(e){return e.create(i(e.valueOf()))},"Array, number | BigNumber":o,"Matrix, number | BigNumber":function(e,r){return e.create(o(e.valueOf(),r))},"...":function(e){if(Sn(e))throw new TypeError("All values expected to be scalar in function cumsum");return i(e)}});function i(e){try{return a(e)}catch(e){throw Lu(e,nd)}}function a(e){if(0===e.length)return[];for(var r=[n(e[0])],i=1;i<e.length;++i)r.push(t(r[i-1],e[i]));return r}function o(e,r){var t=Ue(e);if(r<0||r>=t.length)throw new Pe(r,t.length);try{return s(e,r)}catch(e){throw Lu(e,nd)}}function s(e,r){var t,n,i;if(r<=0){var o=e[0][0];if(Array.isArray(o)){for(i=Cn(e),n=[],t=0;t<i.length;t++)n[t]=s(i[t],r-1);return n}return a(e)}for(n=[],t=0;t<e.length;t++)n[t]=s(e[t],r-1);return n}})),ad="mean",od=ur(ad,["typed","add","divide"],(e=>{var{typed:r,add:t,divide:n}=e;return r(ad,{"Array | Matrix":i,"Array | Matrix, number | BigNumber":function(e,r){try{var i=Bn(e,r,t),a=Array.isArray(e)?Ue(e):e.size();return n(i,a[r])}catch(e){throw Lu(e,"mean")}},"...":function(e){if(Sn(e))throw new TypeError("Scalar values expected in function mean");return i(e)}});function i(e){var r,i=0;if(Mn(e,(function(e){try{r=void 0===r?e:t(r,e),i++}catch(r){throw Lu(r,"mean",e)}})),0===i)throw new Error("Cannot calculate the mean of an empty array");return n(r,i)}})),sd="median",ud=ur(sd,["typed","add","divide","compare","partitionSelect"],(e=>{var{typed:r,add:t,divide:n,compare:i,partitionSelect:a}=e;function o(e){try{var r=(e=Ke(e.valueOf())).length;if(0===r)throw new Error("Cannot calculate median of an empty array");if(r%2==0){for(var t=r/2-1,n=a(e,t+1),o=e[t],c=0;c<t;++c)i(e[c],o)>0&&(o=e[c]);return u(o,n)}var l=a(e,(r-1)/2);return s(l)}catch(e){throw Lu(e,"median")}}var s=r({"number | BigNumber | Complex | Unit":function(e){return e}}),u=r({"number | BigNumber | Complex | Unit, number | BigNumber | Complex | Unit":function(e,r){return n(t(e,r),2)}});return r(sd,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(e,r){throw new Error("median(A, dim) is not yet supported")},"...":function(e){if(Sn(e))throw new TypeError("Scalar values expected in function median");return o(e)}})})),cd=ur("mad",["typed","abs","map","median","subtract"],(e=>{var{typed:r,abs:t,map:n,median:i,subtract:a}=e;return r("mad",{"Array | Matrix":o,"...":function(e){return o(e)}});function o(e){if(0===(e=Ke(e.valueOf())).length)throw new Error("Cannot calculate median absolute deviation (mad) of an empty array");try{var r=i(e);return i(n(e,(function(e){return t(a(e,r))})))}catch(e){throw e instanceof TypeError&&-1!==e.message.indexOf("median")?new TypeError(e.message.replace("median","mad")):Lu(e,"mad")}}})),ld="unbiased",fd="variance",pd=ur(fd,["typed","add","subtract","multiply","divide","apply","isNaN"],(e=>{var{typed:r,add:t,subtract:n,multiply:i,divide:a,apply:s,isNaN:u}=e;return r(fd,{"Array | Matrix":function(e){return c(e,ld)},"Array | Matrix, string":c,"Array | Matrix, number | BigNumber":function(e,r){return l(e,r,ld)},"Array | Matrix, number | BigNumber, string":l,"...":function(e){return c(e,ld)}});function c(e,r){var s,c=0;if(0===e.length)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");if(Mn(e,(function(e){try{s=void 0===s?e:t(s,e),c++}catch(r){throw Lu(r,"variance",e)}})),0===c)throw new Error("Cannot calculate variance of an empty array");var l=a(s,c);if(s=void 0,Mn(e,(function(e){var r=n(e,l);s=void 0===s?i(r,r):t(s,i(r,r))})),u(s))return s;switch(r){case"uncorrected":return a(s,c);case"biased":return a(s,c+1);case"unbiased":var f=o(s)?s.mul(0):0;return 1===c?f:a(s,c-1);default:throw new Error('Unknown normalization "'+r+'". Choose "unbiased" (default), "uncorrected", or "biased".')}}function l(e,r,t){try{if(0===e.length)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");return s(e,r,(e=>c(e,t)))}catch(e){throw Lu(e,"variance")}}})),md=ur("quantileSeq",["typed","add","multiply","partitionSelect","compare"],(e=>{var{typed:r,add:t,multiply:n,partitionSelect:i,compare:s}=e;function u(e,r,o){var u=Ke(e),l=u.length;if(0===l)throw new Error("Cannot calculate quantile of an empty sequence");if(a(r)){var f=r*(l-1),p=f%1;if(0===p){var m=o?u[f]:i(u,f);return c(m),m}var d,h,g=Math.floor(f);if(o)d=u[g],h=u[g+1];else{h=i(u,g+1),d=u[g];for(var y=0;y<g;++y)s(u[y],d)>0&&(d=u[y])}return c(d),c(h),t(n(d,1-p),n(h,p))}var v=r.times(l-1);if(v.isInteger()){v=v.toNumber();var x=o?u[v]:i(u,v);return c(x),x}var b,w,N=v.floor(),D=v.minus(N),E=N.toNumber();if(o)b=u[E],w=u[E+1];else{w=i(u,E+1),b=u[E];for(var A=0;A<E;++A)s(u[A],b)>0&&(b=u[A])}c(b),c(w);var C=new D.constructor(1);return t(n(b,C.minus(D)),n(w,D))}var c=r({"number | BigNumber | Unit":function(e){return e}});return function(e,r,t){var n,i,s;if(arguments.length<2||arguments.length>3)throw new SyntaxError("Function quantileSeq requires two or three parameters");if(m(e)){if("boolean"==typeof(t=t||!1)){if(i=e.valueOf(),a(r)){if(r<0)throw new Error("N/prob must be non-negative");if(r<=1)return u(i,r,t);if(r>1){if(!se(r))throw new Error("N must be a positive integer");var c=r+1;n=new Array(r);for(var l=0;l<r;)n[l]=u(i,++l/c,t);return n}}if(o(r)){var f=r.constructor;if(r.isNegative())throw new Error("N/prob must be non-negative");if(s=new f(1),r.lte(s))return new f(u(i,r,t));if(r.gt(s)){if(!r.isInteger())throw new Error("N must be a positive integer");var p=r.toNumber();if(p>4294967295)throw new Error("N must be less than or equal to 2^32-1, as that is the maximum length of an Array");var d=new f(p+1);n=new Array(p);for(var h=0;h<p;)n[h]=new f(u(i,new f(++h).div(d),t));return n}}if(m(r)){var g=r.valueOf();n=new Array(g.length);for(var y=0;y<n.length;++y){var v=g[y];if(a(v)){if(v<0||v>1)throw new Error("Probability must be between 0 and 1, inclusive")}else{if(!o(v))throw new TypeError("Unexpected type of argument in function quantileSeq");if(s=new v.constructor(1),v.isNegative()||v.gt(s))throw new Error("Probability must be between 0 and 1, inclusive")}n[y]=u(i,v,t)}return n}throw new TypeError("Unexpected type of argument in function quantileSeq")}throw new TypeError("Unexpected type of argument in function quantileSeq")}throw new TypeError("Unexpected type of argument in function quantileSeq")}})),dd=ur("std",["typed","map","sqrt","variance"],(e=>{var{typed:r,map:t,sqrt:n,variance:i}=e;return r("std",{"Array | Matrix":a,"Array | Matrix, string":a,"Array | Matrix, number | BigNumber":a,"Array | Matrix, number | BigNumber, string":a,"...":function(e){return a(e)}});function a(e,r){if(0===e.length)throw new SyntaxError("Function std requires one or more parameters (0 provided)");try{var a=i.apply(null,arguments);return m(a)?t(a,n):n(a)}catch(e){throw e instanceof TypeError&&-1!==e.message.indexOf(" variance")?new TypeError(e.message.replace(" variance"," std")):e}}})),hd="combinations",gd=ur(hd,["typed"],(e=>{var{typed:r}=e;return r(hd,{"number, number":pi,"BigNumber, BigNumber":function(e,r){var t,n,i=e.constructor,a=e.minus(r),o=new i(1);if(!yd(e)||!yd(r))throw new TypeError("Positive integer value expected in function combinations");if(r.gt(e))throw new TypeError("k must be less than n in function combinations");if(t=o,r.lt(a))for(n=o;n.lte(a);n=n.plus(o))t=t.times(r.plus(n)).dividedBy(n);else for(n=o;n.lte(r);n=n.plus(o))t=t.times(a.plus(n)).dividedBy(n);return t}})}));function yd(e){return e.isInteger()&&e.gte(0)}var vd="combinationsWithRep",xd=ur(vd,["typed"],(e=>{var{typed:r}=e;return r(vd,{"number, number":function(e,r){if(!se(e)||e<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(!se(r)||r<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 r<e-1?fi(e,e+r-1)/fi(1,r):fi(r+1,e+r-1)/fi(1,e-1)},"BigNumber, BigNumber":function(e,r){var t,n,i=new(0,e.constructor)(1),a=e.minus(i);if(!bd(e)||!bd(r))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(t=i,r.lt(a))for(n=i;n.lte(a);n=n.plus(i))t=t.times(r.plus(n)).dividedBy(n);else for(n=i;n.lte(r);n=n.plus(i))t=t.times(a.plus(n)).dividedBy(n);return t}})}));function bd(e){return e.isInteger()&&e.gte(0)}var wd="gamma",Nd=ur(wd,["typed","config","multiplyScalar","pow","BigNumber","Complex"],(e=>{var{typed:r,config:t,multiplyScalar:n,pow:i,BigNumber:a,Complex:o}=e;return r(wd,{number:wi,Complex:function e(r){if(0===r.im)return wi(r.re);if(r.re<.5){var t=new o(1-r.re,-r.im),n=new o(Math.PI*r.re,Math.PI*r.im);return new o(Math.PI).div(n.sin()).div(e(t))}r=new o(r.re-1,r.im);for(var i=new o(Di[0],0),a=1;a<Di.length;++a){var s=new o(Di[a],0);i=i.add(s.div(r.add(a)))}var u=new o(r.re+Ni+.5,r.im),c=Math.sqrt(2*Math.PI),l=u.pow(r.add(.5)),f=u.neg().exp();return i.mul(c).mul(l).mul(f)},BigNumber:function(e){if(e.isInteger())return e.isNegative()||e.isZero()?new a(1/0):s(e.minus(1));if(!e.isFinite())return new a(e.isNegative()?NaN:1/0);throw new Error("Integer BigNumber expected")}});function s(e){if(e<8)return new a([1,1,2,6,24,120,720,5040][e]);var r=t.precision+(0|Math.log(e.toNumber())),n=a.clone({precision:r});if(e%2==1)return e.times(s(new a(e-1)));for(var i=e,o=new n(e),u=e.toNumber();i>2;)u+=i-=2,o=o.times(u);return new a(o.toPrecision(a.precision))}})),Dd="lgamma",Ed=ur(Dd,["Complex","typed"],(e=>{var{Complex:r,typed:t}=e,n=7,i=[-.029550653594771242,.00641025641025641,-.0019175269175269176,.0008417508417508417,-.0005952380952380953,.0007936507936507937,-.002777777777777778,.08333333333333333];return t(Dd,{number:Ci,Complex:function e(t){if(t.isNaN())return new r(NaN,NaN);if(0===t.im)return new r(Ci(t.re),0);if(t.re>=n||Math.abs(t.im)>=7)return a(t);if(t.re<=.1){var i=(c=6.283185307179586,l=t.im,((c>0||!(c<0)&&1/c==1/0)^(l>0||!(l<0)&&1/l==1/0)?-c:c)*Math.floor(.5*t.re+.25)),s=t.mul(Math.PI).sin().log(),u=e(new r(1-t.re,-t.im));return new r(1.1447298858494002,i).sub(s).sub(u)}return t.im>=0?o(t):o(t.conjugate()).conjugate();var c,l},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(Ei),n=new r(1,0).div(e),a=n.div(e),o=i[0],s=i[1],u=2*a.re,c=a.re*a.re+a.im*a.im,l=2;l<8;l++){var f=s;s=-c*o+i[l],o=u*o+f}var p=n.mul(a.mul(o).add(s));return t.add(p)}function o(e){var t=0,i=0,o=e;for(e=e.add(1);e.re<=n;){var s=(o=o.mul(e)).im<0?1:0;0!==s&&0===i&&t++,i=s,e=e.add(1)}return a(e).sub(o.log()).sub(new r(0,2*t*Math.PI*1))}})),Ad="factorial",Cd=ur(Ad,["typed","gamma"],(e=>{var{typed:r,gamma:t}=e;return r(Ad,{number:function(e){if(e<0)throw new Error("Value must be non-negative");return t(e+1)},BigNumber:function(e){if(e.isNegative())throw new Error("Value must be non-negative");return t(e.plus(1))},"Array | Matrix":r.referToSelf((e=>r=>Fn(r,e)))})})),Sd="kldivergence",Md=ur(Sd,["typed","matrix","divide","sum","multiply","map","dotDivide","log","isNumeric"],(e=>{var{typed:r,matrix:t,divide:n,sum:i,multiply:a,map:o,dotDivide:s,log:u,isNumeric:c}=e;return r(Sd,{"Array, Array":function(e,r){return l(t(e),t(r))},"Matrix, Array":function(e,r){return l(e,t(r))},"Array, Matrix":function(e,r){return l(t(e),r)},"Matrix, Matrix":function(e,r){return l(e,r)}});function l(e,r){var t=r.size().length,l=e.size().length;if(t>1)throw new Error("first object must be one dimensional");if(l>1)throw new Error("second object must be one dimensional");if(t!==l)throw new Error("Length of two vectors must be equal");if(0===i(e))throw new Error("Sum of elements in first object must be non zero");if(0===i(r))throw new Error("Sum of elements in second object must be non zero");var f=n(e,i(e)),p=n(r,i(r)),m=i(a(f,o(s(f,p),(e=>u(e)))));return c(m)?m:Number.NaN}})),Fd="multinomial",Bd=ur(Fd,["typed","add","divide","multiply","factorial","isInteger","isPositive"],(e=>{var{typed:r,add:t,divide:n,multiply:i,factorial:a,isInteger:o,isPositive:s}=e;return r(Fd,{"Array | Matrix":function(e){var r=0,u=1;return Mn(e,(function(e){if(!o(e)||!s(e))throw new TypeError("Positive integer value expected in function multinomial");r=t(r,e),u=i(u,a(e))})),n(a(r),u)}})})),Td="permutations",Od=ur(Td,["typed","factorial"],(e=>{var{typed:r,factorial:t}=e;return r(Td,{"number | BigNumber":t,"number, number":function(e,r){if(!se(e)||e<0)throw new TypeError("Positive integer value expected in function permutations");if(!se(r)||r<0)throw new TypeError("Positive integer value expected in function permutations");if(r>e)throw new TypeError("second argument k must be less than or equal to first argument n");return fi(e-r+1,e)},"BigNumber, BigNumber":function(e,r){var t,n;if(!_d(e)||!_d(r))throw new TypeError("Positive integer value expected in function permutations");if(r.gt(e))throw new TypeError("second argument k must be less than or equal to first argument n");for(t=e.mul(0).add(1),n=e.minus(r).plus(1);n.lte(e);n=n.plus(1))t=t.times(n);return t}})}));function _d(e){return e.isInteger()&&e.gte(0)}var zd=t(53775),qd=zd(Date.now());function Id(e){var r,t;return r=null===(t=e)?qd:zd(String(t)),function(){return r()}}var kd="pickRandom",Rd=ur(kd,["typed","config","?on"],(e=>{var{typed:r,config:t,on:n}=e,i=Id(t.randomSeed);return n&&n("config",(function(e,r){e.randomSeed!==r.randomSeed&&(i=Id(e.randomSeed))})),r(kd,{"Array | Matrix":function(e){return o(e,{})},"Array | Matrix, Object":function(e,r){return o(e,r)},"Array | Matrix, number":function(e,r){return o(e,{number:r})},"Array | Matrix, Array | Matrix":function(e,r){return o(e,{weights:r})},"Array | Matrix, Array | Matrix, number":function(e,r,t){return o(e,{number:t,weights:r})},"Array | Matrix, number, Array | Matrix":function(e,r,t){return o(e,{number:r,weights:t})}});function o(e,r){var{number:t,weights:n,elementWise:o=!0}=r,s=void 0===t;s&&(t=1);var u=p(e)?e.create:p(n)?n.create:null;e=e.valueOf(),n&&(n=n.valueOf()),!0===o&&(e=Ke(e),n=Ke(n));var c=0;if(void 0!==n){if(n.length!==e.length)throw new Error("Weights must have the same length as possibles");for(var l=0,f=n.length;l<f;l++){if(!a(n[l])||n[l]<0)throw new Error("Weights must be an array of positive numbers");c+=n[l]}}for(var m,d=e.length,h=[];h.length<t;){if(void 0===n)m=e[Math.floor(i()*d)];else for(var g=i()*c,y=0,v=e.length;y<v;y++)if((g-=n[y])<0){m=e[y];break}h.push(m)}return s?h[0]:u?u(h):h}}));function Pd(e,r){var t=[];if((e=e.slice(0)).length>1)for(var n=0,i=e.shift();n<i;n++)t.push(Pd(e,r));else for(var a=0,o=e.shift();a<o;a++)t.push(r());return t}var Ud="random",jd=ur(Ud,["typed","config","?on"],(e=>{var{typed:r,config:t,on:n}=e,i=Id(t.randomSeed);return n&&n("config",(function(e,r){e.randomSeed!==r.randomSeed&&(i=Id(e.randomSeed))})),r(Ud,{"":()=>o(0,1),number:e=>o(0,e),"number, number":(e,r)=>o(e,r),"Array | Matrix":e=>a(e,0,1),"Array | Matrix, number":(e,r)=>a(e,0,r),"Array | Matrix, number, number":(e,r,t)=>a(e,r,t)});function a(e,r,t){var n=Pd(e.valueOf(),(()=>o(r,t)));return p(e)?e.create(n):n}function o(e,r){return e+i()*(r-e)}})),Ld="randomInt",Hd=ur(Ld,["typed","config","?on"],(e=>{var{typed:r,config:t,on:n}=e,i=Id(t.randomSeed);return n&&n("config",(function(e,r){e.randomSeed!==r.randomSeed&&(i=Id(e.randomSeed))})),r(Ld,{"":()=>o(0,1),number:e=>o(0,e),"number, number":(e,r)=>o(e,r),"Array | Matrix":e=>a(e,0,1),"Array | Matrix, number":(e,r)=>a(e,0,r),"Array | Matrix, number, number":(e,r,t)=>a(e,r,t)});function a(e,r,t){var n=Pd(e.valueOf(),(()=>o(r,t)));return p(e)?e.create(n):n}function o(e,r){return Math.floor(e+i()*(r-e))}})),$d="stirlingS2",Zd=ur($d,["typed","addScalar","subtract","multiplyScalar","divideScalar","pow","factorial","combinations","isNegative","isInteger","number","?bignumber","larger"],(e=>{var{typed:r,addScalar:t,subtract:n,multiplyScalar:i,divideScalar:o,pow:s,factorial:u,combinations:c,isNegative:l,isInteger:f,number:p,bignumber:m,larger:d}=e,h=[],g=[];return r($d,{"number | BigNumber, number | BigNumber":function(e,r){if(!f(e)||l(e)||!f(r)||l(r))throw new TypeError("Non-negative integer value expected in function stirlingS2");if(d(r,e))throw new TypeError("k must be less than or equal to n in function stirlingS2");var n=!(a(e)&&a(r)),o=n?g:h,s=n?m:p,u=p(e),c=p(r);if(o[u]&&o[u].length>c)return o[u][c];for(var y=0;y<=u;++y)if(o[y]||(o[y]=[s(0===y?1:0)]),0!==y)for(var v=o[y],x=o[y-1],b=v.length;b<=y&&b<=c;++b)v[b]=b===y?1:t(i(s(b),x[b]),x[b-1]);return o[u][c]}})})),Gd="bellNumbers",Vd=ur(Gd,["typed","addScalar","isNegative","isInteger","stirlingS2"],(e=>{var{typed:r,addScalar:t,isNegative:n,isInteger:i,stirlingS2:a}=e;return r(Gd,{"number | BigNumber":function(e){if(!i(e)||n(e))throw new TypeError("Non-negative integer value expected in function bellNumbers");for(var r=0,o=0;o<=e;o++)r=t(r,a(e,o));return r}})})),Wd="catalan",Yd=ur(Wd,["typed","addScalar","divideScalar","multiplyScalar","combinations","isNegative","isInteger"],(e=>{var{typed:r,addScalar:t,divideScalar:n,multiplyScalar:i,combinations:a,isNegative:o,isInteger:s}=e;return r(Wd,{"number | BigNumber":function(e){if(!s(e)||o(e))throw new TypeError("Non-negative integer value expected in function catalan");return n(a(i(e,2),e),t(e,1))}})})),Jd="composition",Xd=ur(Jd,["typed","addScalar","combinations","isNegative","isPositive","isInteger","larger"],(e=>{var{typed:r,addScalar:t,combinations:n,isPositive:i,isNegative:a,isInteger:o,larger:s}=e;return r(Jd,{"number | BigNumber, number | BigNumber":function(e,r){if(!(o(e)&&i(e)&&o(r)&&i(r)))throw new TypeError("Positive integer value expected in function composition");if(s(r,e))throw new TypeError("k must be less than or equal to n in function composition");return n(t(e,-1),t(r,-1))}})})),Qd="leafCount",Kd=ur(Qd,["parse","typed"],(e=>{var{parse:r,typed:t}=e;function n(e){var r=0;return e.forEach((e=>{r+=n(e)})),r||1}return t(Qd,{Node:function(e){return n(e)}})}));function eh(e){return O(e)||P(e)&&e.isUnary()&&O(e.args[0])}function rh(e){return!!O(e)||(!(!q(e)&&!P(e)||!e.args.every(rh))||!(!U(e)||!rh(e.content)))}function th(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function nh(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?th(Object(t),!0).forEach((function(r){(0,Tu.Z)(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):th(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}var ih=ur("simplifyUtil",["FunctionNode","OperatorNode","SymbolNode"],(e=>{var{FunctionNode:r,OperatorNode:t,SymbolNode:n}=e,i=!0,a=!1,o="defaultF",s={add:{trivial:i,total:i,commutative:i,associative:i},unaryPlus:{trivial:i,total:i,commutative:i,associative:i},subtract:{trivial:a,total:i,commutative:a,associative:a},multiply:{trivial:i,total:i,commutative:i,associative:i},divide:{trivial:a,total:i,commutative:a,associative:a},paren:{trivial:i,total:i,commutative:i,associative:a},defaultF:{trivial:a,total:i,commutative:a,associative:a}};function u(e,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:s,n=o;if("string"==typeof e?n=e:P(e)?n=e.fn.toString():q(e)?n=e.name:U(e)&&(n="paren"),Y(t,n)){var i=t[n];if(Y(i,r))return i[r];if(Y(s,n))return s[n][r]}if(Y(t,o)){var a=t[o];return Y(a,r)?a[r]:s[o][r]}if(Y(s,n)){var u=s[n];if(Y(u,r))return u[r]}return s[o][r]}function c(e){return u(e,"associative",arguments.length>1&&void 0!==arguments[1]?arguments[1]:s)}function l(e,r){var t,n=[];return c(e,r)?(t=e.op,function e(r){for(var i=0;i<r.args.length;i++){var a=r.args[i];P(a)&&t===a.op?e(a):n.push(a)}}(e),n):e.args}function f(e){return P(e)?function(r){try{return new t(e.op,e.fn,r,e.implicit)}catch(e){return console.error(e),[]}}:function(t){return new r(new n(e.name),t)}}return{createMakeNodeFunction:f,hasProperty:u,isCommutative:function(e){return u(e,"commutative",arguments.length>1&&void 0!==arguments[1]?arguments[1]:s)},isAssociative:c,mergeContext:function(e,r){var t=nh({},e);for(var n in r)Y(e,n)?t[n]=nh(nh({},r[n]),e[n]):t[n]=r[n];return t},flatten:function e(r,t){if(!r.args||0===r.args.length)return r;r.args=l(r,t);for(var n=0;n<r.args.length;n++)e(r.args[n],t)},allChildren:l,unflattenr:function e(r,t){if(r.args&&0!==r.args.length){for(var n=f(r),i=r.args.length,a=0;a<i;a++)e(r.args[a],t);if(i>2&&c(r,t)){for(var o=r.args.pop();r.args.length>0;)o=n([r.args.pop(),o]);r.args=o.args}}},unflattenl:function e(r,t){if(r.args&&0!==r.args.length){for(var n=f(r),i=r.args.length,a=0;a<i;a++)e(r.args[a],t);if(i>2&&c(r,t)){for(var o=r.args.shift();r.args.length>0;)o=n([o,r.args.shift()]);r.args=o.args}}},defaultContext:s,realContext:{divide:{total:a},log:{total:a}},positiveContext:{subtract:{total:a},abs:{trivial:i},log:{total:i}}}})),ah=ur("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"],(e=>{var{config:r,typed:t,parse:n,add:i,subtract:a,multiply:o,divide:s,pow:u,isZero:c,equal:l,resolve:f,simplifyConstant:p,simplifyCore:m,fraction:d,bignumber:h,mathWithTransform:g,matrix:y,AccessorNode:v,ArrayNode:x,ConstantNode:b,FunctionNode:w,IndexNode:N,ObjectNode:D,OperatorNode:E,ParenthesisNode:A,SymbolNode:C}=e,{hasProperty:S,isCommutative:M,isAssociative:F,mergeContext:B,flatten:T,unflattenr:_,unflattenl:z,createMakeNodeFunction:q,defaultContext:I,realContext:k,positiveContext:R}=ih({FunctionNode:w,OperatorNode:E,SymbolNode:C});t.addConversion({from:"Object",to:"Map",convert:xr});var P=t("simplify",{Node:V,"Node, Map":(e,r)=>V(e,!1,r),"Node, Map, Object":(e,r,t)=>V(e,!1,r,t),"Node, Array":V,"Node, Array, Map":V,"Node, Array, Map, Object":V});function j(e){return e.transform((function(e,r,t){return U(e)?j(e.content):e}))}t.removeConversion({from:"Object",to:"Map",convert:xr}),P.defaultContext=I,P.realContext=k,P.positiveContext=R;var L={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};function $(e,r){var t={};if(e.s){var i=e.s.split("->");if(2!==i.length)throw SyntaxError("Could not parse rule: "+e.s);t.l=i[0],t.r=i[1]}else t.l=e.l,t.r=e.r;for(var a of(t.l=j(n(t.l)),t.r=j(n(t.r)),["imposeContext","repeat","assuming"]))a in e&&(t[a]=e[a]);if(e.evaluate&&(t.evaluate=n(e.evaluate)),F(t.l,r)){var o,s=!M(t.l,r);s&&(o=G());var u=q(t.l),c=G();t.expanded={},t.expanded.l=u([t.l,c]),T(t.expanded.l,r),_(t.expanded.l,r),t.expanded.r=u([t.r,c]),s&&(t.expandedNC1={},t.expandedNC1.l=u([o,t.l]),t.expandedNC1.r=u([o,t.r]),t.expandedNC2={},t.expandedNC2.l=u([o,t.expanded.l]),t.expandedNC2.r=u([o,t.expanded.r]))}return t}P.rules=[m,{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}}},p,{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}}},p,{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 Z=0;function G(){return new C("_p"+Z++)}function V(e,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:vr(),n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=n.consoleDebug;r=function(e,r){for(var t=[],n=0;n<e.length;n++){var i=e[n],a=void 0,o=typeof i;switch(o){case"string":i={s:i};case"object":a=$(i,r);break;case"function":a=i;break;default:throw TypeError("Unsupported type of rule: "+o)}t.push(a)}return t}(r||P.rules,n.context);for(var a=f(e,t),o={},s=(a=j(a)).toString({parenthesis:"all"});!o[s];){o[s]=!0,Z=0;var u=s;i&&console.log("Working on: ",s);for(var c=0;c<r.length;c++){var l="";if("function"==typeof r[c]?(a=r[c](a,n),i&&(l=r[c].name)):(T(a,n.context),a=J(a,r[c],n.context),i&&(l="".concat(r[c].l.toString()," -> ").concat(r[c].r.toString()))),i){var p=a.toString({parenthesis:"all"});p!==u&&(console.log("Applying",l,"produced",p),u=p)}z(a,n.context)}s=a.toString({parenthesis:"all"})}return a}function W(e,r,t){var n=e;if(e)for(var i=0;i<e.length;++i){var a=J(e[i],r,t);a!==e[i]&&(n===e&&(n=e.slice()),n[i]=a)}return n}function J(e,r,t){if(r.assuming)for(var n in r.assuming)for(var i in r.assuming[n])if(S(n,i,t)!==r.assuming[n][i])return e;var a=B(r.imposeContext,t),o=e;if(o instanceof E||o instanceof w){var s=W(o.args,r,t);s!==o.args&&((o=o.clone()).args=s)}else if(o instanceof A){if(o.content){var u=J(o.content,r,t);u!==o.content&&(o=new A(u))}}else if(o instanceof x){var c=W(o.items,r,t);c!==o.items&&(o=new x(c))}else if(o instanceof v){var l=o.object;o.object&&(l=J(o.object,r,t));var f=o.index;o.index&&(f=J(o.index,r,t)),l===o.object&&f===o.index||(o=new v(l,f))}else if(o instanceof N){var p=W(o.dimensions,r,t);p!==o.dimensions&&(o=new N(p))}else if(o instanceof D){var m=!1,d={};for(var h in o.properties)d[h]=J(o.properties[h],r,t),d[h]!==o.properties[h]&&(m=!0);m&&(o=new D(d))}var g=r.r,y=K(r.l,o,a)[0];if(!y&&r.expanded&&(g=r.expanded.r,y=K(r.expanded.l,o,a)[0]),!y&&r.expandedNC1&&(g=r.expandedNC1.r,(y=K(r.expandedNC1.l,o,a)[0])||(g=r.expandedNC2.r,y=K(r.expandedNC2.l,o,a)[0])),y){var b=o.implicit;o=g.clone(),b&&"implicit"in g&&(o.implicit=!0),o=o.transform((function(e){return e.isSymbolNode&&Y(y.placeholders,e.name)?y.placeholders[e.name].clone():e}))}return r.repeat&&o!==e&&(o=J(o,r,t)),o}function X(e,r){var t={placeholders:{}};if(!e.placeholders&&!r.placeholders)return t;if(!e.placeholders)return r;if(!r.placeholders)return e;for(var n in e.placeholders)if(Y(e.placeholders,n)&&(t.placeholders[n]=e.placeholders[n],Y(r.placeholders,n)&&!ee(e.placeholders[n],r.placeholders[n])))return null;for(var i in r.placeholders)Y(r.placeholders,i)&&(t.placeholders[i]=r.placeholders[i]);return t}function Q(e,r){var t,n=[];if(0===e.length||0===r.length)return n;for(var i=0;i<e.length;i++)for(var a=0;a<r.length;a++)(t=X(e[i],r[a]))&&n.push(t);return n}function K(e,r,t,n){var i=[{placeholders:{}}];if(e instanceof E&&r instanceof E||e instanceof w&&r instanceof w){if(e instanceof E){if(e.op!==r.op||e.fn!==r.fn)return[]}else if(e instanceof w&&e.name!==r.name)return[];if(!(1===r.args.length&&1===e.args.length||!F(r,t)&&r.args.length===e.args.length||n)){if(r.args.length>=2&&2===e.args.length){for(var a=function(e,r){var t,n,i=[],a=q(e);if(M(e,r))for(var o=0;o<e.args.length;o++)(n=e.args.slice(0)).splice(o,1),t=1===n.length?n[0]:a(n),i.push(a([e.args[o],t]));else for(var s=1;s<e.args.length;s++){var u=e.args[0];s>1&&(u=a(e.args.slice(0,s))),t=1===(n=e.args.slice(s)).length?n[0]:a(n),i.push(a([u,t]))}return i}(r,t),o=[],s=0;s<a.length;s++){var u=K(e,a[s],t,!0);o=o.concat(u)}return o}if(e.args.length>2)throw Error("Unexpected non-binary associative function: "+e.toString());return[]}for(var c=[],f=0;f<e.args.length;f++){var p=K(e.args[f],r.args[f],t);if(0===p.length)break;c.push(p)}if(c.length!==e.args.length){if(!M(r,t)||1===e.args.length)return[];if(e.args.length>2)throw new Error("permuting >2 commutative non-associative rule arguments not yet implemented");var m=K(e.args[0],r.args[1],t);if(0===m.length)return[];var d=K(e.args[1],r.args[0],t);if(0===d.length)return[];c=[m,d]}i=function(e){if(0===e.length)return e;for(var r=e.reduce(Q),t=[],n={},i=0;i<r.length;i++){var a=JSON.stringify(r[i]);n[a]||(n[a]=!0,t.push(r[i]))}return t}(c)}else if(e instanceof C){if(0===e.name.length)throw new Error("Symbol in rule has 0 length...!?");if(L[e.name]){if(e.name!==r.name)return[]}else switch(e.name[1]>="a"&&e.name[1]<="z"?e.name.substring(0,2):e.name[0]){case"n":case"_p":i[0].placeholders[e.name]=r;break;case"c":case"cl":if(!O(r))return[];i[0].placeholders[e.name]=r;break;case"v":if(O(r))return[];i[0].placeholders[e.name]=r;break;case"vl":if(!H(r))return[];i[0].placeholders[e.name]=r;break;case"cd":if(!eh(r))return[];i[0].placeholders[e.name]=r;break;case"vd":if(eh(r))return[];i[0].placeholders[e.name]=r;break;case"ce":if(!rh(r))return[];i[0].placeholders[e.name]=r;break;case"ve":if(rh(r))return[];i[0].placeholders[e.name]=r;break;default:throw new Error("Invalid symbol in rule: "+e.name)}}else{if(!(e instanceof b))return[];if(!l(e.value,r.value))return[]}return i}function ee(e,r){if(e instanceof b&&r instanceof b){if(!l(e.value,r.value))return!1}else if(e instanceof C&&r instanceof C){if(e.name!==r.name)return!1}else{if(!(e instanceof E&&r instanceof E||e instanceof w&&r instanceof w))return!1;if(e instanceof E){if(e.op!==r.op||e.fn!==r.fn)return!1}else if(e instanceof w&&e.name!==r.name)return!1;if(e.args.length!==r.args.length)return!1;for(var t=0;t<e.args.length;t++)if(!ee(e.args[t],r.args[t]))return!1}return!0}return P})),oh=ur("simplifyConstant",["typed","config","mathWithTransform","matrix","?fraction","?bignumber","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","SymbolNode"],(e=>{var{typed:r,config:t,mathWithTransform:n,matrix:i,fraction:a,bignumber:o,AccessorNode:s,ArrayNode:c,ConstantNode:l,FunctionNode:f,IndexNode:m,ObjectNode:d,OperatorNode:h,SymbolNode:g}=e,{isCommutative:y,isAssociative:v,allChildren:x,createMakeNodeFunction:b}=ih({FunctionNode:f,OperatorNode:h,SymbolNode:g}),w=r("simplifyConstant",{Node:e=>A(T(e,{})),"Node, Object":function(e,r){return A(T(e,r))}});function N(e){return u(e)?e.valueOf():e instanceof Array?e.map(N):p(e)?i(N(e.valueOf())):e}function D(e,r,t){try{return n[e].apply(null,r)}catch(i){return r=r.map(N),S(n[e].apply(null,r),t)}}var E=r({Fraction:function(e){var r,t=e.s*e.n;r=t<0?new h("-","unaryMinus",[new l(-t)]):new l(t);if(1===e.d)return r;return new h("/","divide",[r,new l(e.d)])},number:function(e){return e<0?F(new l(-e)):new l(e)},BigNumber:function(e){return e<0?F(new l(-e)):new l(e)},Complex:function(e){throw new Error("Cannot convert Complex number to Node")},string:function(e){return new l(e)},Matrix:function(e){return new c(e.valueOf().map((e=>E(e))))}});function A(e){return k(e)?e:E(e)}function C(e,r){if(r&&!1!==r.exactFractions&&isFinite(e)&&a){var t=a(e),n=r&&"number"==typeof r.fractionsLimit?r.fractionsLimit:1/0;if(t.valueOf()===e&&t.n<n&&t.d<n)return t}return e}var S=r({"string, Object":function(e,r){return"BigNumber"===t.number?(void 0===o&&Ks(),o(e)):"Fraction"===t.number?(void 0===a&&eu(),a(e)):C(parseFloat(e),r)},"Fraction, Object":function(e,r){return e},"BigNumber, Object":function(e,r){return e},"number, Object":function(e,r){return C(e,r)},"Complex, Object":function(e,r){return 0!==e.im?e:C(e.re,r)},"Matrix, Object":function(e,r){return i(C(e.valueOf()))},"Array, Object":function(e,r){return e.map(C)}});function F(e){return new h("-","unaryMinus",[e])}function B(e,r,t,n){var i=r.shift(),a=r.reduce(((r,i)=>{if(!k(i)){var a=r.pop();if(k(a))return[a,i];try{return r.push(D(e,[a,i],n)),r}catch(e){r.push(a)}}r.push(A(r.pop()));var o=1===r.length?r[0]:t(r);return[t([o,A(i)])]}),[i]);return 1===a.length?a[0]:t([a[0],E(a[1])])}function T(e,r){switch(e.type){case"SymbolNode":return e;case"ConstantNode":switch(typeof e.value){case"number":return S(e.value,r);case"string":return e.value;default:if(!isNaN(e.value))return S(e.value,r)}return e;case"FunctionNode":if(n[e.name]&&n[e.name].rawArgs)return e;if(-1===["add","multiply"].indexOf(e.name)){var t=e.args.map((e=>T(e,r)));if(!t.some(k))try{return D(e.name,t,r)}catch(e){}if("size"===e.name&&1===t.length&&M(t[0])){for(var a=[],o=t[0];M(o);)a.push(o.items.length),o=o.items[0];return i(a)}return new f(e.name,t.map(A))}case"OperatorNode":var u,h,g=e.fn.toString(),N=b(e);if(P(e)&&e.isUnary())h=k((u=[T(e.args[0],r)])[0])?N(u):D(g,u,r);else if(v(e,r.context))if(u=(u=x(e,r.context)).map((e=>T(e,r))),y(g,r.context)){for(var E=[],C=[],F=0;F<u.length;F++)k(u[F])?C.push(u[F]):E.push(u[F]);E.length>1?(h=B(g,E,N,r),C.unshift(h),h=B(g,C,N,r)):h=B(g,u,N,r)}else h=B(g,u,N,r);else u=e.args.map((e=>T(e,r))),h=B(g,u,N,r);return h;case"ParenthesisNode":return T(e.content,r);case"AccessorNode":return function(e,r,t){if(!I(r))return new s(A(e),A(r));if(M(e)||p(e)){for(var n=Array.from(r.dimensions);n.length>0;)if(O(n[0])&&"string"!=typeof n[0].value){var a=S(n.shift().value,t);M(e)?e=e.items[a-1]:(e=e.valueOf()[a-1])instanceof Array&&(e=i(e))}else{if(!(n.length>1&&O(n[1])&&"string"!=typeof n[1].value))break;var o=S(n[1].value,t),u=[],f=M(e)?e.items:e.valueOf();for(var d of f)if(M(d))u.push(d.items[o-1]);else{if(!p(e))break;u.push(d[o-1])}if(u.length!==f.length)break;e=M(e)?new c(u):i(u),n.splice(1,1)}return n.length===r.dimensions.length?new s(A(e),r):n.length>0?(r=new m(n),new s(A(e),r)):e}if(R(e)&&1===r.dimensions.length&&O(r.dimensions[0])){var h=r.dimensions[0].value;return h in e.properties?e.properties[h]:new l}return new s(A(e),r)}(T(e.object,r),T(e.index,r),r);case"ArrayNode":var _=e.items.map((e=>T(e,r)));return _.some(k)?new c(_.map(A)):i(_);case"IndexNode":return new m(e.dimensions.map((e=>w(e,r))));case"ObjectNode":var z={};for(var q in e.properties)z[q]=w(e.properties[q],r);return new d(z);default:throw new Error("Unimplemented node type in simplifyConstant: ".concat(e.type))}}return w})),sh="simplifyCore",uh=ur(sh,["typed","parse","equal","isZero","add","subtract","multiply","divide","pow","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],(e=>{var{typed:r,parse:t,equal:n,isZero:i,add:a,subtract:o,multiply:s,divide:u,pow:c,AccessorNode:l,ArrayNode:f,ConstantNode:p,FunctionNode:m,IndexNode:d,ObjectNode:h,OperatorNode:g,ParenthesisNode:y,SymbolNode:v}=e,x=new p(0),b=new p(1),w=new p(!0),N=new p(!1);function D(e){return P(e)&&["and","not","or"].includes(e.op)}var{hasProperty:E,isCommutative:A}=ih({FunctionNode:m,OperatorNode:g,SymbolNode:v});function C(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=r?r.context:void 0;if(E(e,"trivial",t)){if(q(e)&&1===e.args.length)return C(e.args[0],r);var a=!1,o=0;if(e.forEach((e=>{1===++o&&(a=C(e,r))})),1===o)return a}var s=e;if(q(s)){var u=function(e){var r="OperatorNode:"+e;for(var t of cp)if(r in t)return t[r].op;return null}(s.name);if(!u)return new m(C(s.fn),s.args.map((e=>C(e,r))));if(s.args.length>2&&E(s,"associative",t))for(;s.args.length>2;){var c=s.args.pop(),p=s.args.pop();s.args.push(new g(u,s.name,[c,p]))}s=new g(u,s.name,s.args)}if(P(s)&&s.isUnary()){var y=C(s.args[0],r);if("~"===s.op&&P(y)&&y.isUnary()&&"~"===y.op)return y.args[0];if("not"===s.op&&P(y)&&y.isUnary()&&"not"===y.op&&D(y.args[0]))return y.args[0];var v=!0;if("-"===s.op&&P(y)&&(y.isBinary()&&"subtract"===y.fn&&(s=new g("-","subtract",[y.args[1],y.args[0]]),v=!1),y.isUnary()&&"-"===y.op))return y.args[0];if(v)return new g(s.op,s.fn,[y])}if(P(s)&&s.isBinary()){var F=C(s.args[0],r),B=C(s.args[1],r);if("+"===s.op){if(O(F)&&i(F.value))return B;if(O(B)&&i(B.value))return F;P(B)&&B.isUnary()&&"-"===B.op&&(B=B.args[0],s=new g("-","subtract",[F,B]))}if("-"===s.op)return P(B)&&B.isUnary()&&"-"===B.op?C(new g("+","add",[F,B.args[0]]),r):O(F)&&i(F.value)?C(new g("-","unaryMinus",[B])):O(B)&&i(B.value)?F:new g(s.op,s.fn,[F,B]);if("*"===s.op){if(O(F)){if(i(F.value))return x;if(n(F.value,1))return B}if(O(B)){if(i(B.value))return x;if(n(B.value,1))return F;if(A(s,t))return new g(s.op,s.fn,[B,F],s.implicit)}return new g(s.op,s.fn,[F,B],s.implicit)}if("/"===s.op)return O(F)&&i(F.value)?x:O(B)&&n(B.value,1)?F:new g(s.op,s.fn,[F,B]);if("^"===s.op&&O(B)){if(i(B.value))return b;if(n(B.value,1))return F}if("and"===s.op){if(O(F)){if(!F.value)return N;if(D(B))return B}if(O(B)){if(!B.value)return N;if(D(F))return F}}if("or"===s.op){if(O(F)){if(F.value)return w;if(D(B))return B}if(O(B)){if(B.value)return w;if(D(F))return F}}return new g(s.op,s.fn,[F,B])}if(P(s))return new g(s.op,s.fn,s.args.map((e=>C(e,r))));if(M(s))return new f(s.items.map((e=>C(e,r))));if(S(s))return new l(C(s.object,r),C(s.index,r));if(I(s))return new d(s.dimensions.map((e=>C(e,r))));if(R(s)){var T={};for(var _ in s.properties)T[_]=C(s.properties[_],r);return new h(T)}return s}return r(sh,{Node:C,"Node,Object":C})})),ch=ur("resolve",["typed","parse","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode"],(e=>{var{typed:r,parse:t,ConstantNode:n,FunctionNode:i,OperatorNode:a,ParenthesisNode:o}=e;function s(e,r){var u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Set;if(!r)return e;if(H(e)){if(u.has(e.name)){var c=Array.from(u).join(", ");throw new ReferenceError("recursive loop of variable definitions among {".concat(c,"}"))}var l=r.get(e.name);if(k(l)){var f=new Set(u);return f.add(e.name),s(l,r,f)}return"number"==typeof l?t(String(l)):void 0!==l?new n(l):e}if(P(e)){var p=e.args.map((function(e){return s(e,r,u)}));return new a(e.op,e.fn,p,e.implicit)}if(U(e))return new o(s(e.content,r,u));if(q(e)){var m=e.args.map((function(e){return s(e,r,u)}));return new i(e.name,m)}return e.map((e=>s(e,r,u)))}return r("resolve",{Node:s,"Node, Map | null | undefined":s,"Node, Object":(e,r)=>s(e,xr(r)),"Array | Matrix":r.referToSelf((e=>r=>r.map((r=>e(r))))),"Array | Matrix, null | undefined":r.referToSelf((e=>r=>r.map((r=>e(r))))),"Array, Object":r.referTo("Array,Map",(e=>(r,t)=>e(r,xr(t)))),"Matrix, Object":r.referTo("Matrix,Map",(e=>(r,t)=>e(r,xr(t)))),"Array | Matrix, Map":r.referToSelf((e=>(r,t)=>r.map((r=>e(r,t)))))})})),lh="symbolicEqual",fh=ur(lh,["parse","simplify","typed","OperatorNode"],(e=>{var{parse:r,simplify:t,typed:n,OperatorNode:i}=e;function a(e,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=new i("-","subtract",[e,r]),o=t(a,{},n);return O(o)&&!o.value}return n(lh,{"Node, Node":a,"Node, Node, Object":a})})),ph="derivative",mh=ur(ph,["typed","config","parse","simplify","equal","isZero","numeric","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode","SymbolNode"],(e=>{var{typed:r,config:t,parse:n,simplify:i,equal:a,isZero:o,numeric:s,ConstantNode:u,FunctionNode:c,OperatorNode:l,ParenthesisNode:f,SymbolNode:p}=e;function m(e,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{simplify:!0},n={};g(n,e,r.name);var a=y(e,n);return t.simplify?i(a):a}r.addConversion({from:"identifier",to:"SymbolNode",convert:n});var d=r(ph,{"Node, SymbolNode":m,"Node, SymbolNode, Object":m});r.removeConversion({from:"identifier",to:"SymbolNode",convert:n}),d._simplify=!0,d.toTex=function(e){return h.apply(null,e.args)};var h=r("_derivTex",{"Node, SymbolNode":function(e,r){return O(e)&&"string"===Z(e.value)?h(n(e.value).toString(),r.toString(),1):h(e.toTex(),r.toString(),1)},"Node, ConstantNode":function(e,r){if("string"===Z(r.value))return h(e,n(r.value));throw new Error("The second parameter to 'derivative' is a non-string constant")},"Node, SymbolNode, ConstantNode":function(e,r,t){return h(e.toString(),r.name,t.value)},"string, string, number":function(e,r,t){return(1===t?"{d\\over d"+r+"}":"{d^{"+t+"}\\over d"+r+"^{"+t+"}}")+"\\left[".concat(e,"\\right]")}}),g=r("constTag",{"Object, ConstantNode, string":function(e,r){return e[r]=!0,!0},"Object, SymbolNode, string":function(e,r,t){return r.name!==t&&(e[r]=!0,!0)},"Object, ParenthesisNode, string":function(e,r,t){return g(e,r.content,t)},"Object, FunctionAssignmentNode, string":function(e,r,t){return-1===r.params.indexOf(t)?(e[r]=!0,!0):g(e,r.expr,t)},"Object, FunctionNode | OperatorNode, string":function(e,r,t){if(r.args.length>0){for(var n=g(e,r.args[0],t),i=1;i<r.args.length;++i)n=g(e,r.args[i],t)&&n;if(n)return e[r]=!0,!0}return!1}}),y=r("_derivative",{"ConstantNode, Object":function(e){return v(0)},"SymbolNode, Object":function(e,r){return void 0!==r[e]?v(0):v(1)},"ParenthesisNode, Object":function(e,r){return new f(y(e.content,r))},"FunctionAssignmentNode, Object":function(e,r){return void 0!==r[e]?v(0):y(e.expr,r)},"FunctionNode, Object":function(e,r){if(1!==e.args.length&&function(e){if(("log"===e.name||"nthRoot"===e.name||"pow"===e.name)&&2===e.args.length)return;for(var r=0;r<e.args.length;++r)e.args[r]=v(0);throw e.compile().evaluate(),new Error("Expected TypeError, but none found")}(e),void 0!==r[e])return v(0);var t,n,i,a,o=e.args[0],s=!1,u=!1;switch(e.name){case"cbrt":s=!0,n=new l("*","multiply",[v(3),new l("^","pow",[o,new l("/","divide",[v(2),v(3)])])]);break;case"sqrt":case"nthRoot":if(1===e.args.length)s=!0,n=new l("*","multiply",[v(2),new c("sqrt",[o])]);else if(2===e.args.length)return r[t=new l("/","divide",[v(1),e.args[1]])]=r[e.args[1]],y(new l("^","pow",[o,t]),r);break;case"log10":t=v(10);case"log":if(t||1!==e.args.length){if(1===e.args.length&&t||2===e.args.length&&void 0!==r[e.args[1]])n=new l("*","multiply",[o.clone(),new c("log",[t||e.args[1]])]),s=!0;else if(2===e.args.length)return y(new l("/","divide",[new c("log",[o]),new c("log",[e.args[1]])]),r)}else n=o.clone(),s=!0;break;case"pow":return r[t]=r[e.args[1]],y(new l("^","pow",[o,e.args[1]]),r);case"exp":n=new c("exp",[o.clone()]);break;case"sin":n=new c("cos",[o.clone()]);break;case"cos":n=new l("-","unaryMinus",[new c("sin",[o.clone()])]);break;case"tan":n=new l("^","pow",[new c("sec",[o.clone()]),v(2)]);break;case"sec":n=new l("*","multiply",[e,new c("tan",[o.clone()])]);break;case"csc":u=!0,n=new l("*","multiply",[e,new c("cot",[o.clone()])]);break;case"cot":u=!0,n=new l("^","pow",[new c("csc",[o.clone()]),v(2)]);break;case"asin":s=!0,n=new c("sqrt",[new l("-","subtract",[v(1),new l("^","pow",[o.clone(),v(2)])])]);break;case"acos":s=!0,u=!0,n=new c("sqrt",[new l("-","subtract",[v(1),new l("^","pow",[o.clone(),v(2)])])]);break;case"atan":s=!0,n=new l("+","add",[new l("^","pow",[o.clone(),v(2)]),v(1)]);break;case"asec":s=!0,n=new l("*","multiply",[new c("abs",[o.clone()]),new c("sqrt",[new l("-","subtract",[new l("^","pow",[o.clone(),v(2)]),v(1)])])]);break;case"acsc":s=!0,u=!0,n=new l("*","multiply",[new c("abs",[o.clone()]),new c("sqrt",[new l("-","subtract",[new l("^","pow",[o.clone(),v(2)]),v(1)])])]);break;case"acot":s=!0,u=!0,n=new l("+","add",[new l("^","pow",[o.clone(),v(2)]),v(1)]);break;case"sinh":n=new c("cosh",[o.clone()]);break;case"cosh":n=new c("sinh",[o.clone()]);break;case"tanh":n=new l("^","pow",[new c("sech",[o.clone()]),v(2)]);break;case"sech":u=!0,n=new l("*","multiply",[e,new c("tanh",[o.clone()])]);break;case"csch":u=!0,n=new l("*","multiply",[e,new c("coth",[o.clone()])]);break;case"coth":u=!0,n=new l("^","pow",[new c("csch",[o.clone()]),v(2)]);break;case"asinh":s=!0,n=new c("sqrt",[new l("+","add",[new l("^","pow",[o.clone(),v(2)]),v(1)])]);break;case"acosh":s=!0,n=new c("sqrt",[new l("-","subtract",[new l("^","pow",[o.clone(),v(2)]),v(1)])]);break;case"atanh":s=!0,n=new l("-","subtract",[v(1),new l("^","pow",[o.clone(),v(2)])]);break;case"asech":s=!0,u=!0,n=new l("*","multiply",[o.clone(),new c("sqrt",[new l("-","subtract",[v(1),new l("^","pow",[o.clone(),v(2)])])])]);break;case"acsch":s=!0,u=!0,n=new l("*","multiply",[new c("abs",[o.clone()]),new c("sqrt",[new l("+","add",[new l("^","pow",[o.clone(),v(2)]),v(1)])])]);break;case"acoth":s=!0,u=!0,n=new l("-","subtract",[v(1),new l("^","pow",[o.clone(),v(2)])]);break;case"abs":n=new l("/","divide",[new c(new p("abs"),[o.clone()]),o.clone()]);break;default:throw new Error('Function "'+e.name+'" is not supported by derivative, or a wrong number of arguments is passed')}s?(i="/",a="divide"):(i="*",a="multiply");var f=y(o,r);return u&&(f=new l("-","unaryMinus",[f])),new l(i,a,[f,n])},"OperatorNode, Object":function(e,r){if(void 0!==r[e])return v(0);if("+"===e.op)return new l(e.op,e.fn,e.args.map((function(e){return y(e,r)})));if("-"===e.op){if(e.isUnary())return new l(e.op,e.fn,[y(e.args[0],r)]);if(e.isBinary())return new l(e.op,e.fn,[y(e.args[0],r),y(e.args[1],r)])}if("*"===e.op){var t=e.args.filter((function(e){return void 0!==r[e]}));if(t.length>0){var n=e.args.filter((function(e){return void 0===r[e]})),i=1===n.length?n[0]:new l("*","multiply",n),s=t.concat(y(i,r));return new l("*","multiply",s)}return new l("+","add",e.args.map((function(t){return new l("*","multiply",e.args.map((function(e){return e===t?y(e,r):e.clone()})))})))}if("/"===e.op&&e.isBinary()){var u=e.args[0],f=e.args[1];return void 0!==r[f]?new l("/","divide",[y(u,r),f]):void 0!==r[u]?new l("*","multiply",[new l("-","unaryMinus",[u]),new l("/","divide",[y(f,r),new l("^","pow",[f.clone(),v(2)])])]):new l("/","divide",[new l("-","subtract",[new l("*","multiply",[y(u,r),f.clone()]),new l("*","multiply",[u.clone(),y(f,r)])]),new l("^","pow",[f.clone(),v(2)])])}if("^"===e.op&&e.isBinary()){var p=e.args[0],m=e.args[1];if(void 0!==r[p])return O(p)&&(o(p.value)||a(p.value,1))?v(0):new l("*","multiply",[e,new l("*","multiply",[new c("log",[p.clone()]),y(m.clone(),r)])]);if(void 0!==r[m]){if(O(m)){if(o(m.value))return v(0);if(a(m.value,1))return y(p,r)}var d=new l("^","pow",[p.clone(),new l("-","subtract",[m,v(1)])]);return new l("*","multiply",[m.clone(),new l("*","multiply",[y(p,r),d])])}return new l("*","multiply",[new l("^","pow",[p.clone(),m.clone()]),new l("+","add",[new l("*","multiply",[y(p,r),new l("/","divide",[m.clone(),p.clone()])]),new l("*","multiply",[y(m,r),new c("log",[p.clone()])])])])}throw new Error('Operator "'+e.op+'" is not supported by derivative, or a wrong number of arguments is passed')}});function v(e,r){return new u(s(e,r||t.number))}return d})),dh="rationalize",hh=ur(dh,["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"],(e=>{var{config:r,typed:t,equal:n,isZero:i,add:a,subtract:o,multiply:s,divide:u,pow:c,parse:l,simplifyConstant:f,simplifyCore:p,simplify:m,fraction:d,bignumber:h,mathWithTransform:g,matrix:y,AccessorNode:v,ArrayNode:x,ConstantNode:b,FunctionNode:w,IndexNode:N,ObjectNode:D,OperatorNode:E,SymbolNode:A,ParenthesisNode:C}=e;function S(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=function(){var e=[p,{l:"n+n",r:"2*n"},{l:"n+-n",r:"0"},f,{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"}],r=[{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)"}],t=[{l:"(n1/n2 + n3/n4)",r:"((n1*n4 + n3*n2)/(n2*n4))"},{l:"(n1/n2 + n3)",r:"((n1 + n3*n2)/n2)"},{l:"(n1 + n2/n3)",r:"((n1*n3 + n2)/n3)"}],n=[{l:"(n1/(n2/n3))",r:"((n1*n3)/n2)"},{l:"(n1/n2/n3)",r:"(n1/(n2*n3))"}],i={};return i.firstRules=e.concat(r,n),i.distrDivRules=t,i.sucDivRules=n,i.firstRulesAgain=e.concat(r),i.finalRules=[p,{l:"n*-n",r:"-n^2"},{l:"n*n",r:"n^2"},f,{l:"n*-n^n1",r:"-n^(n1+1)"},{l:"n*n^n1",r:"n^(n1+1)"},{l:"n^n1*-n^n2",r:"-n^(n1+n2)"},{l:"n^n1*n^n2",r:"n^(n1+n2)"},{l:"n^n1*-n",r:"-n^(n1+1)"},{l:"n^n1*n",r:"n^(n1+1)"},{l:"n^n1/-n",r:"-n^(n1-1)"},{l:"n^n1/n",r:"n^(n1-1)"},{l:"n/-n^n1",r:"-n^(1-n1)"},{l:"n/n^n1",r:"n^(1-n1)"},{l:"n^n1/-n^n2",r:"n^(n1-n2)"},{l:"n^n1/n^n2",r:"n^(n1-n2)"},{l:"n1+(-n2*n3)",r:"n1-n2*n3"},{l:"v*(-c)",r:"-c*v"},{l:"n1+-n2",r:"n1-n2"},{l:"v*c",r:"c*v"},{l:"(n1^n2)^n3",r:"(n1^(n2*n3))"}],i}(),i=function(e,r,t,n){var i=[],a=m(e,n,r,{exactFractions:!1}),o="+-*"+((t=!!t)?"/":"");u(a);var s={};return s.expression=a,s.variables=i,s;function u(e){var r=e.type;if("FunctionNode"===r)throw new Error("There is an unsolved function call");if("OperatorNode"===r)if("^"===e.op){if("ConstantNode"!==e.args[1].type||!se(parseFloat(e.args[1].value)))throw new Error("There is a non-integer exponent");u(e.args[0])}else{if(-1===o.indexOf(e.op))throw new Error("Operator "+e.op+" invalid in polynomial expression");for(var t=0;t<e.args.length;t++)u(e.args[t])}else if("SymbolNode"===r){var n=e.name;-1===i.indexOf(n)&&i.push(n)}else if("ParenthesisNode"===r)u(e.content);else if("ConstantNode"!==r)throw new Error("type "+r+" is not allowed in polynomial expression")}}(e,r,!0,n.firstRules),a=i.variables.length,o={exactFractions:!1},s={exactFractions:!0};if(e=i.expression,a>=1){var u,c;e=M(e);var l,d=!0,h=!1;for(e=m(e,n.firstRules,{},o);c=d?n.distrDivRules:n.sucDivRules,d=!d,(l=(e=m(e,c,{},s)).toString())!==u;)h=!0,u=l;h&&(e=m(e,n.firstRulesAgain,{},o)),e=m(e,n.finalRules,{},o)}var g=[],y={};return"OperatorNode"===e.type&&e.isBinary()&&"/"===e.op?(1===a&&(e.args[0]=F(e.args[0],g),e.args[1]=F(e.args[1])),t&&(y.numerator=e.args[0],y.denominator=e.args[1])):(1===a&&(e=F(e,g)),t&&(y.numerator=e,y.denominator=null)),t?(y.coefficients=g,y.variables=i.variables,y.expression=e,y):e}return t(dh,{Node:S,"Node, boolean":(e,r)=>S(e,{},r),"Node, Object":S,"Node, Object, boolean":S});function M(e,r,t){var n=e.type,i=arguments.length>1;if("OperatorNode"===n&&e.isBinary()){var a,o=!1;if("^"===e.op&&("ParenthesisNode"!==e.args[0].type&&"OperatorNode"!==e.args[0].type||"ConstantNode"!==e.args[1].type||(o=(a=parseFloat(e.args[1].value))>=2&&se(a))),o){if(a>2){var s=e.args[0],u=new E("^","pow",[e.args[0].cloneDeep(),new b(a-1)]);e=new E("*","multiply",[s,u])}else e=new E("*","multiply",[e.args[0],e.args[0].cloneDeep()]);i&&("content"===t?r.content=e:r.args[t]=e)}}if("ParenthesisNode"===n)M(e.content,e,"content");else if("ConstantNode"!==n&&"SymbolNode"!==n)for(var c=0;c<e.args.length;c++)M(e.args[c],e,c);if(!i)return e}function F(e,r){void 0===r&&(r=[]),r[0]=0;var t={cte:1,oper:"+",fire:""},n=0,i="";!function e(t,a,o){var s=t.type;if("FunctionNode"===s)throw new Error("There is an unsolved function call");if("OperatorNode"===s){if(-1==="+-*^".indexOf(t.op))throw new Error("Operator "+t.op+" invalid");if(null!==a){if(("unaryMinus"===t.fn||"pow"===t.fn)&&"add"!==a.fn&&"subtract"!==a.fn&&"multiply"!==a.fn)throw new Error("Invalid "+t.op+" placing");if(("subtract"===t.fn||"add"===t.fn||"multiply"===t.fn)&&"add"!==a.fn&&"subtract"!==a.fn)throw new Error("Invalid "+t.op+" placing");if(("subtract"===t.fn||"add"===t.fn||"unaryMinus"===t.fn)&&0!==o.noFil)throw new Error("Invalid "+t.op+" placing")}"^"!==t.op&&"*"!==t.op||(o.fire=t.op);for(var u=0;u<t.args.length;u++)"unaryMinus"===t.fn&&(o.oper="-"),"+"!==t.op&&"subtract"!==t.fn||(o.fire="",o.cte=1,o.oper=0===u?"+":t.op),o.noFil=u,e(t.args[u],t,o)}else if("SymbolNode"===s){if(t.name!==i&&""!==i)throw new Error("There is more than one variable");if(i=t.name,null===a)return void(r[1]=1);if("^"===a.op&&0!==o.noFil)throw new Error("In power the variable should be the first parameter");if("*"===a.op&&1!==o.noFil)throw new Error("In multiply the variable should be the second parameter");""!==o.fire&&"*"!==o.fire||(n<1&&(r[1]=0),r[1]+=o.cte*("+"===o.oper?1:-1),n=Math.max(1,n))}else{if("ConstantNode"!==s)throw new Error("Type "+s+" is not allowed");var c=parseFloat(t.value);if(null===a)return void(r[0]=c);if("^"===a.op){if(1!==o.noFil)throw new Error("Constant cannot be powered");if(!se(c)||c<=0)throw new Error("Non-integer exponent is not allowed");for(var l=n+1;l<c;l++)r[l]=0;return c>n&&(r[c]=0),r[c]+=o.cte*("+"===o.oper?1:-1),void(n=Math.max(c,n))}o.cte=c,""===o.fire&&(r[0]+=o.cte*("+"===o.oper?1:-1))}}(e,null,t);for(var a,o=!0,s=n=r.length-1;s>=0;s--)if(0!==r[s]){var u=new b(o?r[s]:Math.abs(r[s])),c=r[s]<0?"-":"+";if(s>0){var l=new A(i);if(s>1){var f=new b(s);l=new E("^","pow",[l,f])}u=-1===r[s]&&o?new E("-","unaryMinus",[l]):1===Math.abs(r[s])?l:new E("*","multiply",[u,l])}a=o?u:"+"===c?new E("+","add",[a,u]):new E("-","subtract",[a,u]),o=!1}return o?new b(0):a}})),gh="zpk2tf",yh=ur(gh,["typed","add","multiply","Complex","number"],(e=>{var{typed:r,add:t,multiply:n,Complex:i,number:a}=e;return r(gh,{"Array,Array,number":function(e,r,t){return o(e,r,t)},"Array,Array":function(e,r){return o(e,r,1)},"Matrix,Matrix,number":function(e,r,t){return o(e.valueOf(),r.valueOf(),t)},"Matrix,Matrix":function(e,r){return o(e.valueOf(),r.valueOf(),1)}});function o(e,r,t){e.some((e=>"BigNumber"===e.type))&&(e=e.map((e=>a(e)))),r.some((e=>"BigNumber"===e.type))&&(r=r.map((e=>a(e))));for(var o=[i(1,0)],u=[i(1,0)],c=0;c<e.length;c++){var l=e[c];"number"==typeof l&&(l=i(l,0)),o=s(o,[i(1,0),i(-l.re,-l.im)])}for(var f=0;f<r.length;f++){var p=r[f];"number"==typeof p&&(p=i(p,0)),u=s(u,[i(1,0),i(-p.re,-p.im)])}for(var m=0;m<o.length;m++)o[m]=n(o[m],t);return[o,u]}function s(e,r){for(var a=[],o=0;o<e.length+r.length-1;o++){a[o]=i(0,0);for(var s=0;s<e.length;s++)o-s>=0&&o-s<r.length&&(a[o]=t(a[o],n(e[s],r[o-s])))}return a}})),vh="freqz",xh=ur(vh,["typed","add","multiply","Complex","divide","matrix"],(e=>{var{typed:r,add:t,multiply:n,Complex:i,divide:a,matrix:o}=e;return r(vh,{"Array, Array":function(e,r){return s(e,r,u(512))},"Array, Array, Array":function(e,r,t){return s(e,r,t)},"Array, Array, number":function(e,r,t){if(t<0)throw new Error("w must be a positive number");return s(e,r,u(t))},"Matrix, Matrix":function(e,r){var t=u(512),{w:n,h:i}=s(e.valueOf(),r.valueOf(),t);return{w:o(n),h:o(i)}},"Matrix, Matrix, Matrix":function(e,r,t){var{h:n}=s(e.valueOf(),r.valueOf(),t.valueOf());return{h:o(n),w:o(t)}},"Matrix, Matrix, number":function(e,r,t){if(t<0)throw new Error("w must be a positive number");var n=u(t),{h:i}=s(e.valueOf(),r.valueOf(),n);return{h:o(i),w:o(n)}}});function s(e,r,o){for(var s=[],u=[],c=0;c<o.length;c++){for(var l=i(0,0),f=i(0,0),p=0;p<e.length;p++)l=t(l,n(e[p],i(Math.cos(-p*o[c]),Math.sin(-p*o[c]))));for(var m=0;m<r.length;m++)f=t(f,n(r[m],i(Math.cos(-m*o[c]),Math.sin(-m*o[c]))));s.push(l),u.push(f)}for(var d=[],h=0;h<s.length;h++)d.push(a(s[h],u[h]));return{h:d,w:o}}function u(e){for(var r=[],t=0;t<e;t++)r.push(t/e*Math.PI);return r}})),bh=ur("reviver",["classes"],(e=>{var{classes:r}=e;return function(e,t){var n=r[t&&t.mathjs];return n&&"function"==typeof n.fromJSON?n.fromJSON(t):t}})),wh=ur("replacer",[],(()=>function(e,r){return"number"!=typeof r||isFinite(r)&&!isNaN(r)?r:{mathjs:"number",value:String(r)}})),Nh=ur("true",[],(()=>!0)),Dh=ur("false",[],(()=>!1)),Eh=ur("null",[],(()=>null)),Ah=Ph("Infinity",["config","?BigNumber"],(e=>{var{config:r,BigNumber:t}=e;return"BigNumber"===r.number?new t(1/0):1/0})),Ch=Ph("NaN",["config","?BigNumber"],(e=>{var{config:r,BigNumber:t}=e;return"BigNumber"===r.number?new t(NaN):NaN})),Sh=Ph("pi",["config","?BigNumber"],(e=>{var{config:r,BigNumber:t}=e;return"BigNumber"===r.number?Al(t):mi})),Mh=Ph("tau",["config","?BigNumber"],(e=>{var{config:r,BigNumber:t}=e;return"BigNumber"===r.number?Cl(t):di})),Fh=Ph("e",["config","?BigNumber"],(e=>{var{config:r,BigNumber:t}=e;return"BigNumber"===r.number?Dl(t):hi})),Bh=Ph("phi",["config","?BigNumber"],(e=>{var{config:r,BigNumber:t}=e;return"BigNumber"===r.number?El(t):1.618033988749895})),Th=Ph("LN2",["config","?BigNumber"],(e=>{var{config:r,BigNumber:t}=e;return"BigNumber"===r.number?new t(2).ln():Math.LN2})),Oh=Ph("LN10",["config","?BigNumber"],(e=>{var{config:r,BigNumber:t}=e;return"BigNumber"===r.number?new t(10).ln():Math.LN10})),_h=Ph("LOG2E",["config","?BigNumber"],(e=>{var{config:r,BigNumber:t}=e;return"BigNumber"===r.number?new t(1).div(new t(2).ln()):Math.LOG2E})),zh=Ph("LOG10E",["config","?BigNumber"],(e=>{var{config:r,BigNumber:t}=e;return"BigNumber"===r.number?new t(1).div(new t(10).ln()):Math.LOG10E})),qh=Ph("SQRT1_2",["config","?BigNumber"],(e=>{var{config:r,BigNumber:t}=e;return"BigNumber"===r.number?new t("0.5").sqrt():Math.SQRT1_2})),Ih=Ph("SQRT2",["config","?BigNumber"],(e=>{var{config:r,BigNumber:t}=e;return"BigNumber"===r.number?new t(2).sqrt():Math.SQRT2})),kh=Ph("i",["Complex"],(e=>{var{Complex:r}=e;return r.I})),Rh=ur("version",[],(()=>"11.9.1"));function Ph(e,r,t){return ur(e,r,t,{recreateOnConfigChange:!0})}var Uh=Ig("speedOfLight","299792458","m s^-1"),jh=Ig("gravitationConstant","6.67430e-11","m^3 kg^-1 s^-2"),Lh=Ig("planckConstant","6.62607015e-34","J s"),Hh=Ig("reducedPlanckConstant","1.0545718176461565e-34","J s"),$h=Ig("magneticConstant","1.25663706212e-6","N A^-2"),Zh=Ig("electricConstant","8.8541878128e-12","F m^-1"),Gh=Ig("vacuumImpedance","376.730313667","ohm"),Vh=Ig("coulomb","8.987551792261171e9","N m^2 C^-2"),Wh=Ig("elementaryCharge","1.602176634e-19","C"),Yh=Ig("bohrMagneton","9.2740100783e-24","J T^-1"),Jh=Ig("conductanceQuantum","7.748091729863649e-5","S"),Xh=Ig("inverseConductanceQuantum","12906.403729652257","ohm"),Qh=Ig("magneticFluxQuantum","2.0678338484619295e-15","Wb"),Kh=Ig("nuclearMagneton","5.0507837461e-27","J T^-1"),eg=Ig("klitzing","25812.807459304513","ohm"),rg=Ig("bohrRadius","5.29177210903e-11","m"),tg=Ig("classicalElectronRadius","2.8179403262e-15","m"),ng=Ig("electronMass","9.1093837015e-31","kg"),ig=Ig("fermiCoupling","1.1663787e-5","GeV^-2"),ag=kg("fineStructure",.0072973525693),og=Ig("hartreeEnergy","4.3597447222071e-18","J"),sg=Ig("protonMass","1.67262192369e-27","kg"),ug=Ig("deuteronMass","3.3435830926e-27","kg"),cg=Ig("neutronMass","1.6749271613e-27","kg"),lg=Ig("quantumOfCirculation","3.6369475516e-4","m^2 s^-1"),fg=Ig("rydberg","10973731.568160","m^-1"),pg=Ig("thomsonCrossSection","6.6524587321e-29","m^2"),mg=kg("weakMixingAngle",.2229),dg=kg("efimovFactor",22.7),hg=Ig("atomicMass","1.66053906660e-27","kg"),gg=Ig("avogadro","6.02214076e23","mol^-1"),yg=Ig("boltzmann","1.380649e-23","J K^-1"),vg=Ig("faraday","96485.33212331001","C mol^-1"),xg=Ig("firstRadiation","3.7417718521927573e-16","W m^2"),bg=Ig("loschmidt","2.686780111798444e25","m^-3"),wg=Ig("gasConstant","8.31446261815324","J K^-1 mol^-1"),Ng=Ig("molarPlanckConstant","3.990312712893431e-10","J s mol^-1"),Dg=Ig("molarVolume","0.022413969545014137","m^3 mol^-1"),Eg=kg("sackurTetrode",-1.16487052358),Ag=Ig("secondRadiation","0.014387768775039337","m K"),Cg=Ig("stefanBoltzmann","5.67037441918443e-8","W m^-2 K^-4"),Sg=Ig("wienDisplacement","2.897771955e-3","m K"),Mg=Ig("molarMass","0.99999999965e-3","kg mol^-1"),Fg=Ig("molarMassC12","11.9999999958e-3","kg mol^-1"),Bg=Ig("gravity","9.80665","m s^-2"),Tg=Ig("planckLength","1.616255e-35","m"),Og=Ig("planckMass","2.176435e-8","kg"),_g=Ig("planckTime","5.391245e-44","s"),zg=Ig("planckCharge","1.87554603778e-18","C"),qg=Ig("planckTemperature","1.416785e+32","K");function Ig(e,r,t){return ur(e,["config","Unit","BigNumber"],(e=>{var{config:n,Unit:i,BigNumber:a}=e,o=new i("BigNumber"===n.number?new a(r):parseFloat(r),t);return o.fixPrefix=!0,o}))}function kg(e,r){return ur(e,["config","BigNumber"],(e=>{var{config:t,BigNumber:n}=e;return"BigNumber"===t.number?new n(r):r}))}var Rg=ur("apply",["typed","isInteger"],(e=>{var{typed:r,isInteger:t}=e,n=Ra({typed:r,isInteger:t});return r("apply",{"...any":function(e){var r=e[1];a(r)?e[1]=r-1:o(r)&&(e[1]=r.minus(1));try{return n.apply(null,e)}catch(e){throw np(e)}}})}),{isTransformFunction:!0}),Pg=ur("column",["typed","Index","matrix","range"],(e=>{var{typed:r,Index:t,matrix:n,range:i}=e,o=Ss({typed:r,Index:t,matrix:n,range:i});return r("column",{"...any":function(e){var r=e.length-1,t=e[r];a(t)&&(e[r]=t-1);try{return o.apply(null,e)}catch(e){throw np(e)}}})}),{isTransformFunction:!0});function Ug(e,r,t){var n=e.filter((function(e){return H(e)&&!(e.name in r)&&!t.has(e.name)}))[0];if(!n)throw new Error('No undefined variable found in inline expression "'+e+'"');var i=n.name,a=$p(t),o=e.compile();return function(e){return a.set(i,e),o.evaluate(a)}}var jg=ur("filter",["typed"],(e=>{var{typed:r}=e;function t(e,r,t){var i,a;return e[0]&&(i=e[0].compile().evaluate(t)),e[1]&&(a=H(e[1])||z(e[1])?e[1].compile().evaluate(t):Ug(e[1],r,t)),n(i,a)}t.rawArgs=!0;var n=r("filter",{"Array, function":Lg,"Matrix, function":function(e,r){return e.create(Lg(e.toArray(),r))},"Array, RegExp":nr,"Matrix, RegExp":function(e,r){return e.create(nr(e.toArray(),r))}});return t}),{isTransformFunction:!0});function Lg(e,r){return tr(e,(function(e,t,n){return zs(r,e,[t+1],n,"filter")}))}var Hg=ur("forEach",["typed"],(e=>{var{typed:r}=e;function t(e,r,t){var i,a;return e[0]&&(i=e[0].compile().evaluate(t)),e[1]&&(a=H(e[1])||z(e[1])?e[1].compile().evaluate(t):Ug(e[1],r,t)),n(i,a)}t.rawArgs=!0;var n=r("forEach",{"Array | Matrix, function":function(e,r){!function t(n,i){if(!Array.isArray(n))return zs(r,n,i,e,"forEach");rr(n,(function(e,r){t(e,i.concat(r+1))}))}(e.valueOf(),[])}});return t}),{isTransformFunction:!0}),$g=ur("index",["Index"],(e=>{var{Index:r}=e;return function(){for(var e=[],t=0,n=arguments.length;t<n;t++){var i=arguments[t];if(g(i))i.start--,i.end-=i.step>0?0:2;else if(i&&!0===i.isSet)i=i.map((function(e){return e-1}));else if(f(i)||p(i))i=i.map((function(e){return e-1}));else if(a(i))i--;else if(o(i))i=i.toNumber()-1;else if("string"!=typeof i)throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range");e[t]=i}var s=new r;return r.apply(s,e),s}}),{isTransformFunction:!0}),Zg=ur("map",["typed"],(e=>{var{typed:r}=e;function t(e,r,t){var i,a;return e[0]&&(i=e[0].compile().evaluate(t)),e[1]&&(a=H(e[1])||z(e[1])?e[1].compile().evaluate(t):Ug(e[1],r,t)),n(i,a)}t.rawArgs=!0;var n=r("map",{"Array, function":function(e,r){return Gg(e,r,e)},"Matrix, function":function(e,r){return e.create(Gg(e.valueOf(),r,e))}});return t}),{isTransformFunction:!0});function Gg(e,r,t){return function e(n,i){return Array.isArray(n)?er(n,(function(r,t){return e(r,i.concat(t+1))})):zs(r,n,i,t,"map")}(e,[])}function Vg(e){if(2===e.length&&m(e[0])){var r=(e=e.slice())[1];a(r)?e[1]=r-1:o(r)&&(e[1]=r.minus(1))}return e}var Wg=["typed","config","numeric","larger"],Yg=ur("max",Wg,(e=>{var{typed:r,config:t,numeric:n,larger:i}=e,a=yl({typed:r,config:t,numeric:n,larger:i});return r("max",{"...any":function(e){e=Vg(e);try{return a.apply(null,e)}catch(e){throw np(e)}}})}),{isTransformFunction:!0}),Jg=["typed","add","divide"],Xg=ur("mean",Jg,(e=>{var{typed:r,add:t,divide:n}=e,i=od({typed:r,add:t,divide:n});return r("mean",{"...any":function(e){e=Vg(e);try{return i.apply(null,e)}catch(e){throw np(e)}}})}),{isTransformFunction:!0}),Qg=["typed","config","numeric","smaller"],Kg=ur("min",Qg,(e=>{var{typed:r,config:t,numeric:n,smaller:i}=e,a=vl({typed:r,config:t,numeric:n,smaller:i});return r("min",{"...any":function(e){e=Vg(e);try{return a.apply(null,e)}catch(e){throw np(e)}}})}),{isTransformFunction:!0}),ey=["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],ry=ur("range",ey,(e=>{var{typed:r,config:t,matrix:n,bignumber:i,smaller:a,smallerEq:o,larger:s,largerEq:u,add:c,isPositive:l}=e,f=nu({typed:r,config:t,matrix:n,bignumber:i,smaller:a,smallerEq:o,larger:s,largerEq:u,add:c,isPositive:l});return r("range",{"...any":function(e){return"boolean"!=typeof e[e.length-1]&&e.push(!0),f.apply(null,e)}})}),{isTransformFunction:!0}),ty=["typed","Index","matrix","range"],ny=ur("row",ty,(e=>{var{typed:r,Index:t,matrix:n,range:i}=e,o=fu({typed:r,Index:t,matrix:n,range:i});return r("row",{"...any":function(e){var r=e.length-1,t=e[r];a(t)&&(e[r]=t-1);try{return o.apply(null,e)}catch(e){throw np(e)}}})}),{isTransformFunction:!0}),iy=["typed","matrix"],ay=ur("subset",iy,(e=>{var{typed:r,matrix:t}=e,n=yu({typed:r,matrix:t});return r("subset",{"...any":function(e){try{return n.apply(null,e)}catch(e){throw np(e)}}})}),{isTransformFunction:!0}),oy=["typed","matrix","isInteger"],sy=ur("concat",oy,(e=>{var{typed:r,matrix:t,isInteger:n}=e,i=Es({typed:r,matrix:t,isInteger:n});return r("concat",{"...any":function(e){var r=e.length-1,t=e[r];a(t)?e[r]=t-1:o(t)&&(e[r]=t.minus(1));try{return i.apply(null,e)}catch(e){throw np(e)}}})}),{isTransformFunction:!0}),uy="diff",cy=["typed","matrix","subtract","number","bignumber"],ly=ur(uy,cy,(e=>{var{typed:r,matrix:t,subtract:n,number:i,bignumber:a}=e,o=Xs({typed:r,matrix:t,subtract:n,number:i,bignumber:a});return r(uy,{"...any":function(e){e=Vg(e);try{return o.apply(null,e)}catch(e){throw np(e)}}})}),{isTransformFunction:!0}),fy=["typed","map","sqrt","variance"],py=ur("std",fy,(e=>{var{typed:r,map:t,sqrt:n,variance:i}=e,a=dd({typed:r,map:t,sqrt:n,variance:i});return r("std",{"...any":function(e){e=Vg(e);try{return a.apply(null,e)}catch(e){throw np(e)}}})}),{isTransformFunction:!0}),my=["typed","config","add","numeric"],dy=ur("sum",my,(e=>{var{typed:r,config:t,add:n,numeric:i}=e,a=td({typed:r,config:t,add:n,numeric:i});return r("sum",{"...any":function(e){e=Vg(e);try{return a.apply(null,e)}catch(e){throw np(e)}}})}),{isTransformFunction:!0}),hy="cumsum",gy=["typed","add","unaryPlus"],yy=ur(hy,gy,(e=>{var{typed:r,add:t,unaryPlus:n}=e,i=id({typed:r,add:t,unaryPlus:n});return r(hy,{"...any":function(e){if(2===e.length&&m(e[0])){var r=e[1];a(r)?e[1]=r-1:o(r)&&(e[1]=r.minus(1))}try{return i.apply(null,e)}catch(e){throw np(e)}}})}),{isTransformFunction:!0}),vy="variance",xy=["typed","add","subtract","multiply","divide","apply","isNaN"],by=ur(vy,xy,(e=>{var{typed:r,add:t,subtract:n,multiply:i,divide:a,apply:o,isNaN:s}=e,u=pd({typed:r,add:t,subtract:n,multiply:i,divide:a,apply:o,isNaN:s});return r(vy,{"...any":function(e){e=Vg(e);try{return u.apply(null,e)}catch(e){throw np(e)}}})}),{isTransformFunction:!0}),wy=mn({config:Q}),Ny=hn({}),Dy=Fh({BigNumber:wy,config:Q}),Ey=Dh({}),Ay=ag({BigNumber:wy,config:Q}),Cy=yn({}),Sy=kh({Complex:Ny}),My=Ah({BigNumber:wy,config:Q}),Fy=Oh({BigNumber:wy,config:Q}),By=zh({BigNumber:wy,config:Q}),Ty=xn({}),Oy=Ch({BigNumber:wy,config:Q}),_y=Eh({}),zy=Bh({BigNumber:wy,config:Q}),qy=vn({}),Iy=Fr({}),ky=qh({BigNumber:wy,config:Q}),Ry=Eg({BigNumber:wy,config:Q}),Py=Mh({BigNumber:wy,config:Q}),Uy=Nh({}),jy=Rh({}),Ly=Dn({Matrix:Ty}),Hy=dg({BigNumber:wy,config:Q}),$y=Th({BigNumber:wy,config:Q}),Zy=Sh({BigNumber:wy,config:Q}),Gy=wh({}),Vy=Ih({BigNumber:wy,config:Q}),Wy=Dr({BigNumber:wy,Complex:Ny,DenseMatrix:Ly,Fraction:Cy}),Yy=qa({BigNumber:wy,config:Q,typed:Wy}),Jy=mg({BigNumber:wy,config:Q}),Xy=Ia({typed:Wy}),Qy=Rl({Complex:Ny,config:Q,typed:Wy}),Ky=Ll({BigNumber:wy,typed:Wy}),ev=Gl({BigNumber:wy,Complex:Ny,config:Q,typed:Wy}),rv=ja({typed:Wy}),tv=hs({typed:Wy}),nv=Ql({BigNumber:wy,Complex:Ny,config:Q,typed:Wy}),iv=rf({typed:Wy}),av=tf({typed:Wy}),ov=sf({Complex:Ny,config:Q,typed:Wy}),sv=xa({BigNumber:wy,typed:Wy}),uv=cs({typed:Wy}),cv=va({typed:Wy}),lv=An({typed:Wy}),fv=gd({typed:Wy}),pv=ba({Complex:Ny,typed:Wy}),mv=ys({typed:Wy}),dv=ff({typed:Wy}),hv=df({BigNumber:wy,typed:Wy}),gv=hf({BigNumber:wy,typed:Wy}),yv=Qa({typed:Wy}),vv=pa({config:Q,typed:Wy}),xv=zu({typed:Wy}),bv=Ka({typed:Wy}),wv=ro({Complex:Ny,typed:Wy}),Nv=qs({typed:Wy}),Dv=Us({typed:Wy}),Ev=Gu({typed:Wy}),Av=Hs({typed:Wy}),Cv=Yu({format:Ev,typed:Wy}),Sv=vs({typed:Wy}),Mv=zn({typed:Wy}),Fv=Ji({typed:Wy}),Bv=ta({typed:Wy}),Tv=ia({typed:Wy}),Ov=_h({BigNumber:wy,config:Q}),_v=Ed({Complex:Ny,typed:Wy}),zv=So({Complex:Ny,config:Q,typed:Wy}),qv=Fo({Complex:Ny,config:Q,typed:Wy}),Iv=Ws({typed:Wy}),kv=_o({typed:Wy}),Rv=bs({typed:Wy}),Pv=da({typed:Wy}),Uv=Wu({format:Ev,typed:Wy}),jv=Rd({config:Q,typed:Wy}),Lv=Xu({typed:Wy}),Hv=jd({config:Q,typed:Wy}),$v=xs({typed:Wy}),Zv=vf({BigNumber:wy,typed:Wy}),Gv=Po({BigNumber:wy,Fraction:Cy,complex:pv,typed:Wy}),Vv=wf({typed:Wy}),Wv=ma({Matrix:Ty,equalScalar:vv,typed:Wy}),Yv=Ta({typed:Wy}),Jv=Lo({typed:Wy}),Xv=ga({typed:Wy}),Qv=Ef({typed:Wy}),Kv=ua({typed:Wy}),ex=Ul({Complex:Ny,config:Q,typed:Wy}),rx=Wl({BigNumber:wy,typed:Wy}),tx=Ra({isInteger:Mv,typed:Wy}),nx=Jl({BigNumber:wy,Complex:Ny,config:Q,typed:Wy}),ix=Vu({format:Ev,typed:Wy}),ax=xd({typed:Wy}),ox=cf({typed:Wy}),sx=yf({BigNumber:wy,typed:Wy}),ux=oa({typed:Wy}),cx=rc({typed:Wy}),lx=Hd({config:Q,typed:Wy}),fx=bf({BigNumber:wy,typed:Wy}),px=Df({typed:Wy}),mx=zl({SparseMatrix:Wv,typed:Wy}),dx=Uo({Complex:Ny,config:Q,typed:Wy}),hx=Af({typed:Wy}),gx=_a({typed:Wy}),yx=$l({BigNumber:wy,Complex:Ny,config:Q,typed:Wy}),vx=pf({BigNumber:wy,typed:Wy}),xx=wa({Fraction:Cy,typed:Wy}),bx=Qi({typed:Wy}),wx=Da({DenseMatrix:Ly,Matrix:Ty,SparseMatrix:Wv,typed:Wy}),Nx=Aa({isZero:Tv,matrix:wx,typed:Wy}),Dx=ju({isNaN:ux,isNumeric:bx,typed:Wy}),Ex=tc({bignumber:sv,fraction:xx,number:Pv}),Ax=$u({config:Q,multiplyScalar:kv,numeric:Ex,typed:Wy}),Cx=au({isInteger:Mv,matrix:wx,typed:Wy}),Sx=mu({matrix:wx,config:Q,typed:Wy}),Mx=hu({matrix:wx,typed:Wy}),Fx=yu({matrix:wx,typed:Wy}),Bx=Du({matrix:wx,typed:Wy}),Tx=Go({BigNumber:wy,config:Q,matrix:wx,typed:Wy}),Ox=Su({BigNumber:wy,config:Q,matrix:wx,typed:Wy}),_x=ef({Complex:Ny,config:Q,typed:Wy}),zx=Ha({BigNumber:wy,Complex:Ny,Fraction:Cy,config:Q,isNegative:Fv,matrix:wx,typed:Wy,unaryMinus:gx}),qx=Es({isInteger:Mv,matrix:wx,typed:Wy}),Ix=Fs({prod:Ax,size:Sx,typed:Wy}),kx=Au({conj:mv,transpose:Bx,typed:Wy}),Rx=_s({DenseMatrix:Ly,SparseMatrix:Wv,matrix:wx,typed:Wy}),Px=ic({numeric:Ex,typed:Wy}),Ux=yc({DenseMatrix:Ly,concat:qx,divideScalar:Px,equalScalar:vv,matrix:wx,typed:Wy}),jx=Gc({DenseMatrix:Ly,concat:qx,equalScalar:vv,matrix:wx,typed:Wy}),Lx=Rs({matrix:wx,typed:Wy}),Hx=No({BigNumber:wy,DenseMatrix:Ly,concat:qx,equalScalar:vv,matrix:wx,typed:Wy}),$x=ea({isNumeric:bx,typed:Wy}),Zx=Zs({BigNumber:wy,DenseMatrix:Ly,SparseMatrix:Wv,config:Q,matrix:wx,typed:Wy}),Gx=Vs({matrix:wx,multiplyScalar:kv,typed:Wy}),Vx=ol({DenseMatrix:Ly,concat:qx,config:Q,matrix:wx,typed:Wy}),Wx=Bc({DenseMatrix:Ly,concat:qx,equalScalar:vv,matrix:wx,typed:Wy,zeros:Ox}),Yx=Fa({flatten:Lx,matrix:wx,size:Sx,typed:Wy}),Jx=Oo({DenseMatrix:Ly,concat:qx,equalScalar:vv,matrix:wx,typed:Wy}),Xx=ko({BigNumber:wy,concat:qx,equalScalar:vv,matrix:wx,typed:Wy}),Qx=Qs({BigNumber:wy,config:Q,matrix:wx,typed:Wy}),Kx=ou({config:Q,matrix:wx}),eb=Oc({DenseMatrix:Ly,concat:qx,equalScalar:vv,matrix:wx,typed:Wy,zeros:Ox}),rb=uc({BigNumber:wy,DenseMatrix:Ly,equalScalar:vv,matrix:wx,typed:Wy,zeros:Ox}),tb=Xc({DenseMatrix:Ly,concat:qx,config:Q,matrix:wx,typed:Wy}),nb=Ku({concat:qx,matrix:wx,typed:Wy}),ib=fl({DenseMatrix:Ly,concat:qx,config:Q,equalScalar:vv,matrix:wx,typed:Wy}),ab=Ns({DenseMatrix:Ly,concat:qx,matrix:wx,typed:Wy}),ob=Gf({DenseMatrix:Ly,SparseMatrix:Wv,addScalar:rv,concat:qx,equalScalar:vv,matrix:wx,typed:Wy}),sb=ss({concat:qx,equalScalar:vv,matrix:wx,typed:Wy}),ub=ds({DenseMatrix:Ly,concat:qx,matrix:wx,typed:Wy}),cb=Yd({addScalar:rv,combinations:fv,divideScalar:Px,isInteger:Mv,isNegative:Fv,multiplyScalar:kv,typed:Wy}),lb=kc({BigNumber:wy,DenseMatrix:Ly,Fraction:Cy,concat:qx,config:Q,equalScalar:vv,matrix:wx,typed:Wy}),fb=$c({concat:qx,matrix:wx,typed:Wy}),pb=id({add:ob,typed:Wy,unaryPlus:Yy}),mb=cl({equal:jx,typed:Wy}),db=Xf({addScalar:rv,conj:mv,multiplyScalar:kv,size:Sx,typed:Wy}),hb=Yc({compareText:fb,isZero:Tv,typed:Wy}),gb=co({DenseMatrix:Ly,config:Q,equalScalar:vv,matrix:wx,round:rb,typed:Wy,zeros:Ox}),yb=Wf({abs:Xy,addScalar:rv,divideScalar:Px,isPositive:Bv,multiplyScalar:kv,smaller:tb,sqrt:dx,typed:Wy}),vb=xl({DenseMatrix:Ly,smaller:tb}),xb=bl({ImmutableDenseMatrix:vb}),bb=Wo({BigNumber:wy,add:ob,config:Q,equal:jx,isInteger:Mv,mod:Jx,smaller:tb,typed:Wy,xgcd:Tx}),wb=nl({DenseMatrix:Ly,concat:qx,config:Q,matrix:wx,typed:Wy}),Nb=cc({Complex:Ny,config:Q,divideScalar:Px,typed:Wy}),Db=Sa({flatten:Lx,matrix:wx,size:Sx,typed:Wy}),Eb=vl({config:Q,numeric:Ex,smaller:tb,typed:Wy}),Ab=qo({addScalar:rv,dot:db,equalScalar:vv,matrix:wx,multiplyScalar:kv,typed:Wy}),Cb=mc({Complex:Ny,config:Q,divideScalar:Px,typed:Wy}),Sb=ws({DenseMatrix:Ly,concat:qx,equalScalar:vv,matrix:wx,typed:Wy}),Mb=dl({compare:lb,isNaN:ux,isNumeric:bx,typed:Wy}),Fb=md({add:ob,compare:lb,multiply:Ab,partitionSelect:Mb,typed:Wy}),Bb=zc({DenseMatrix:Ly,concat:qx,equalScalar:vv,matrix:wx,typed:Wy,zeros:Ox}),Tb=el({DenseMatrix:Ly,concat:qx,config:Q,matrix:wx,typed:Wy}),Ob=$o({DenseMatrix:Ly,addScalar:rv,concat:qx,equalScalar:vv,matrix:wx,typed:Wy,unaryMinus:gx}),_b=Qf({add:ob,matrix:wx,typed:Wy}),zb=Nc({DenseMatrix:Ly,divideScalar:Px,equalScalar:vv,matrix:wx,multiplyScalar:kv,subtract:Ob,typed:Wy}),qb=yh({Complex:Ny,add:ob,multiply:Ab,number:Pv,typed:Wy}),Ib=qc({concat:qx,equalScalar:vv,matrix:wx,not:Rv,typed:Wy,zeros:Ox}),kb=fs({DenseMatrix:Ly,concat:qx,equalScalar:vv,matrix:wx,typed:Wy}),Rb=Ja({DenseMatrix:Ly,config:Q,equalScalar:vv,matrix:wx,round:rb,typed:Wy,zeros:Ox}),Pb=jc({compare:lb,typed:Wy}),Ub=Xd({addScalar:rv,combinations:fv,isInteger:Mv,isNegative:Fv,isPositive:Bv,larger:wb,typed:Wy}),jb=Ts({matrix:wx,multiply:Ab,subtract:Ob,typed:Wy}),Lb=qm({divideScalar:Px,isZero:Tv,matrix:wx,multiply:Ab,subtract:Ob,typed:Wy,unaryMinus:gx}),Hb=Xs({matrix:wx,number:Pv,subtract:Ob,typed:Wy}),$b=ed({abs:Xy,addScalar:rv,deepEqual:mb,divideScalar:Px,multiplyScalar:kv,sqrt:dx,subtract:Ob,typed:Wy}),Zb=Xo({concat:qx,equalScalar:vv,matrix:wx,multiplyScalar:kv,typed:Wy}),Gb=wl({larger:wb,smaller:tb}),Vb=ao({Complex:Ny,DenseMatrix:Ly,ceil:Rb,equalScalar:vv,floor:gb,matrix:wx,typed:Wy,zeros:Ox}),Wb=ep({Index:xb,typed:Wy}),Yb=rd({abs:Xy,add:ob,addScalar:rv,config:Q,divideScalar:Px,equalScalar:vv,flatten:Lx,isNumeric:bx,isZero:Tv,matrix:wx,multiply:Ab,multiplyScalar:kv,smaller:tb,subtract:Ob,typed:Wy}),Jb=Ao({concat:qx,equalScalar:vv,matrix:wx,typed:Wy}),Xb=fc({Complex:Ny,config:Q,divideScalar:Px,log:Nb,typed:Wy}),Qb=bc({DenseMatrix:Ly,divideScalar:Px,equalScalar:vv,matrix:wx,multiplyScalar:kv,subtract:Ob,typed:Wy}),Kb=yl({config:Q,larger:wb,numeric:Ex,typed:Wy}),ew=nm({addScalar:rv,complex:pv,conj:mv,divideScalar:Px,equal:jx,identity:Zx,isZero:Tv,matrix:wx,multiplyScalar:kv,sign:Gv,sqrt:dx,subtract:Ob,typed:Wy,unaryMinus:gx,zeros:Ox}),rw=nu({bignumber:sv,matrix:wx,add:ob,config:Q,isPositive:Bv,larger:wb,largerEq:Vx,smaller:tb,smallerEq:Tb,typed:Wy}),tw=fu({Index:xb,matrix:wx,range:rw,typed:Wy}),nw=Sf({DenseMatrix:Ly,Index:xb,compareNatural:Pb,size:Sx,subset:Fx,typed:Wy}),iw=Tf({DenseMatrix:Ly,Index:xb,compareNatural:Pb,size:Sx,subset:Fx,typed:Wy}),aw=qf({Index:xb,compareNatural:Pb,size:Sx,subset:Fx,typed:Wy}),ow=Pf({Index:xb,compareNatural:Pb,size:Sx,subset:Fx,typed:Wy}),sw=gm({SparseMatrix:Wv,abs:Xy,add:ob,divideScalar:Px,larger:wb,largerEq:Vx,multiply:Ab,subtract:Ob,transpose:Bx,typed:Wy}),uw=gl({compare:lb,compareNatural:Pb,matrix:wx,typed:Wy}),cw=td({add:ob,config:Q,numeric:Ex,typed:Wy}),lw=Cc({DenseMatrix:Ly,divideScalar:Px,equalScalar:vv,matrix:wx,multiplyScalar:kv,subtract:Ob,typed:Wy}),fw=af({BigNumber:wy,DenseMatrix:Ly,concat:qx,equalScalar:vv,matrix:wx,typed:Wy}),pw=Ss({Index:xb,matrix:wx,range:rw,typed:Wy}),mw=Ec({DenseMatrix:Ly,divideScalar:Px,equalScalar:vv,matrix:wx,multiplyScalar:kv,subtract:Ob,typed:Wy}),dw=Ff({DenseMatrix:Ly,Index:xb,compareNatural:Pb,size:Sx,subset:Fx,typed:Wy}),hw=kf({Index:xb,compareNatural:Pb,size:Sx,subset:Fx,typed:Wy}),gw=Hf({Index:xb,concat:qx,setDifference:dw,size:Sx,subset:Fx,typed:Wy}),yw=Nl({FibonacciHeap:Gb,addScalar:rv,equalScalar:vv}),vw=Im({abs:Xy,addScalar:rv,det:Lb,divideScalar:Px,identity:Zx,matrix:wx,multiply:Ab,typed:Wy,unaryMinus:gx}),xw=tm({DenseMatrix:Ly,Spa:yw,SparseMatrix:Wv,abs:Xy,addScalar:rv,divideScalar:Px,equalScalar:vv,larger:wb,matrix:wx,multiplyScalar:kv,subtract:Ob,typed:Wy,unaryMinus:gx}),bw=Rm({Complex:Ny,add:ob,ctranspose:kx,deepEqual:mb,divideScalar:Px,dot:db,dotDivide:Ux,equal:jx,inv:vw,matrix:wx,multiply:Ab,typed:Wy}),ww=ac({Complex:Ny,config:Q,fraction:xx,identity:Zx,inv:vw,matrix:wx,multiply:Ab,number:Pv,typed:Wy}),Nw=_f({DenseMatrix:Ly,Index:xb,compareNatural:Pb,size:Sx,subset:Fx,typed:Wy}),Dw=Zf({Index:xb,concat:qx,setIntersect:Nw,setSymDifference:gw,size:Sx,subset:Fx,typed:Wy}),Ew=Zm({abs:Xy,add:ob,identity:Zx,inv:vw,map:Iv,max:Kb,multiply:Ab,size:Sx,sqrt:dx,subtract:Ob,typed:Wy}),Aw=Bl({BigNumber:wy,Complex:Ny,Fraction:Cy,abs:Xy,addScalar:rv,config:Q,divideScalar:Px,equal:jx,fix:Vb,format:Ev,isNumeric:bx,multiplyScalar:kv,number:Pv,pow:ww,round:rb,subtract:Ob}),Cw=Gh({BigNumber:wy,Unit:Aw,config:Q}),Sw=Sg({BigNumber:wy,Unit:Aw,config:Q}),Mw=hg({BigNumber:wy,Unit:Aw,config:Q}),Fw=Yh({BigNumber:wy,Unit:Aw,config:Q}),Bw=yg({BigNumber:wy,Unit:Aw,config:Q}),Tw=Jh({BigNumber:wy,Unit:Aw,config:Q}),Ow=Il({Unit:Aw,typed:Wy}),_w=ug({BigNumber:wy,Unit:Aw,config:Q}),zw=hc({DenseMatrix:Ly,concat:qx,equalScalar:vv,matrix:wx,pow:ww,typed:Wy}),qw=Zh({BigNumber:wy,Unit:Aw,config:Q}),Iw=Wh({BigNumber:wy,Unit:Aw,config:Q}),kw=Hm({abs:Xy,add:ob,identity:Zx,inv:vw,multiply:Ab,typed:Wy}),Rw=vg({BigNumber:wy,Unit:Aw,config:Q}),Pw=Mu({addScalar:rv,ceil:Rb,conj:mv,divideScalar:Px,dotDivide:Ux,exp:bv,i:Sy,log2:qv,matrix:wx,multiplyScalar:kv,pow:ww,tau:Py,typed:Wy}),Uw=Nd({BigNumber:wy,Complex:Ny,config:Q,multiplyScalar:kv,pow:ww,typed:Wy}),jw=jh({BigNumber:wy,Unit:Aw,config:Q}),Lw=og({BigNumber:wy,Unit:Aw,config:Q}),Hw=Bu({conj:mv,dotDivide:Ux,fft:Pw,typed:Wy}),$w=eg({BigNumber:wy,Unit:Aw,config:Q}),Zw=bg({BigNumber:wy,Unit:Aw,config:Q}),Gw=$h({BigNumber:wy,Unit:Aw,config:Q}),Vw=Mg({BigNumber:wy,Unit:Aw,config:Q}),Ww=Ng({BigNumber:wy,Unit:Aw,config:Q}),Yw=cg({BigNumber:wy,Unit:Aw,config:Q}),Jw=Kh({BigNumber:wy,Unit:Aw,config:Q}),Xw=zg({BigNumber:wy,Unit:Aw,config:Q}),Qw=Tg({BigNumber:wy,Unit:Aw,config:Q}),Kw=qg({BigNumber:wy,Unit:Aw,config:Q}),eN=sg({BigNumber:wy,Unit:Aw,config:Q}),rN=Hh({BigNumber:wy,Unit:Aw,config:Q}),tN=fg({BigNumber:wy,Unit:Aw,config:Q}),nN=Ag({BigNumber:wy,Unit:Aw,config:Q}),iN=Uh({BigNumber:wy,Unit:Aw,config:Q}),aN=Cg({BigNumber:wy,Unit:Aw,config:Q}),oN=pg({BigNumber:wy,Unit:Aw,config:Q}),sN=gg({BigNumber:wy,Unit:Aw,config:Q}),uN=rg({BigNumber:wy,Unit:Aw,config:Q}),cN=Vh({BigNumber:wy,Unit:Aw,config:Q}),lN=Qm({divideScalar:Px,equalScalar:vv,inv:vw,matrix:wx,multiply:Ab,typed:Wy}),fN=ng({BigNumber:wy,Unit:Aw,config:Q}),pN=Cd({gamma:Uw,typed:Wy}),mN=xg({BigNumber:wy,Unit:Aw,config:Q}),dN=Bg({BigNumber:wy,Unit:Aw,config:Q}),hN=Xh({BigNumber:wy,Unit:Aw,config:Q}),gN=bm({DenseMatrix:Ly,lsolve:Qb,lup:xw,matrix:wx,slu:sw,typed:Wy,usolve:zb}),yN=Qh({BigNumber:wy,Unit:Aw,config:Q}),vN=Fg({BigNumber:wy,Unit:Aw,config:Q}),xN=Bd({add:ob,divide:lN,factorial:pN,isInteger:Mv,isPositive:Bv,multiply:Ab,typed:Wy}),bN=Od({factorial:pN,typed:Wy}),wN=Og({BigNumber:wy,Unit:Aw,config:Q}),NN=Dm({add:ob,cbrt:zx,divide:lN,equalScalar:vv,im:Sv,isZero:Tv,multiply:Ab,re:$v,sqrt:dx,subtract:Ob,typeOf:Kv,typed:Wy,unaryMinus:gx}),DN=jf({compareNatural:Pb,typed:Wy}),EN=_u({abs:Xy,add:ob,bignumber:sv,divide:lN,isNegative:Fv,isPositive:Bv,larger:wb,map:Iv,matrix:wx,max:Kb,multiply:Ab,smaller:tb,subtract:Ob,typed:Wy,unaryMinus:gx}),AN=Zd({bignumber:sv,addScalar:rv,combinations:fv,divideScalar:Px,factorial:pN,isInteger:Mv,isNegative:Fv,larger:wb,multiplyScalar:kv,number:Pv,pow:ww,subtract:Ob,typed:Wy}),CN=Ol({Unit:Aw,typed:Wy}),SN=Vd({addScalar:rv,isInteger:Mv,isNegative:Fv,stirlingS2:AN,typed:Wy}),MN=jm({abs:Xy,add:ob,addScalar:rv,atan:av,bignumber:sv,column:pw,complex:pv,config:Q,cos:ox,diag:Rx,divideScalar:Px,dot:db,equal:jx,flatten:Lx,im:Sv,inv:vw,larger:wb,matrix:wx,matrixFromColumns:Yx,multiply:Ab,multiplyScalar:kv,number:Pv,qr:ew,re:$v,sin:Vv,smaller:tb,sqrt:dx,subtract:Ob,typed:Wy,usolve:zb,usolveAll:lw}),FN=ig({BigNumber:wy,Unit:Aw,config:Q}),BN=wg({BigNumber:wy,Unit:Aw,config:Q}),TN=od({add:ob,divide:lN,typed:Wy}),ON=Dg({BigNumber:wy,Unit:Aw,config:Q}),_N=Lh({BigNumber:wy,Unit:Aw,config:Q}),zN=lg({BigNumber:wy,Unit:Aw,config:Q}),qN=pd({add:ob,apply:tx,divide:lN,isNaN:ux,multiply:Ab,subtract:Ob,typed:Wy}),IN=tg({BigNumber:wy,Unit:Aw,config:Q}),kN=ud({add:ob,compare:lb,divide:lN,partitionSelect:Mb,typed:Wy}),RN=Md({divide:lN,dotDivide:Ux,isNumeric:bx,log:Nb,map:Iv,matrix:wx,multiply:Ab,sum:cw,typed:Wy}),PN=cd({abs:Xy,map:Iv,median:kN,subtract:Ob,typed:Wy}),UN=dd({map:Iv,sqrt:dx,typed:Wy,variance:qN}),jN=xh({Complex:Ny,add:ob,divide:lN,matrix:wx,multiply:Ab,typed:Wy}),LN=Jf({abs:Xy,add:ob,conj:mv,ctranspose:kx,eigs:MN,equalScalar:vv,larger:wb,matrix:wx,multiply:Ab,pow:ww,smaller:tb,sqrt:dx,typed:Wy}),HN=lu({BigNumber:wy,DenseMatrix:Ly,SparseMatrix:Wv,addScalar:rv,config:Q,cos:ox,matrix:wx,multiplyScalar:kv,norm:LN,sin:Vv,typed:Wy,unaryMinus:gx}),$N=_g({BigNumber:wy,Unit:Aw,config:Q}),ZN=Ym({identity:Zx,matrix:wx,multiply:Ab,norm:LN,qr:ew,subtract:Ob,typed:Wy}),GN=uu({multiply:Ab,rotationMatrix:HN,typed:Wy}),VN=Vm({abs:Xy,add:ob,concat:qx,identity:Zx,index:Wb,lusolve:gN,matrix:wx,matrixFromColumns:Yx,multiply:Ab,range:rw,schur:ZN,subset:Fx,subtract:Ob,transpose:Bx,typed:Wy}),WN=Xm({matrix:wx,multiply:Ab,sylvester:VN,transpose:Bx,typed:Wy}),YN={},JN={},XN={},QN=tp({mathWithTransform:JN}),KN=zp({Node:QN}),eD=Ip({Node:QN}),rD=Rp({Node:QN}),tD=Lp({Node:QN}),nD=up({Node:QN}),iD=yp({Node:QN,ResultSet:Iy}),aD=xp({Node:QN}),oD=Mp({Node:QN}),sD=Up({Node:QN}),uD=bh({classes:XN}),cD=Sm({math:YN,typed:Wy}),lD=Bp({Node:QN,typed:Wy}),fD=zm({Chain:cD,typed:Wy}),pD=op({Node:QN,subset:Fx}),mD=Op({Node:QN,size:Sx}),dD=hp({matrix:wx,Node:QN,subset:Fx}),hD=Hp({Unit:Aw,Node:QN,math:YN}),gD=Gp({Node:QN,SymbolNode:hD,math:YN}),yD=Wp({AccessorNode:pD,ArrayNode:nD,AssignmentNode:dD,BlockNode:iD,ConditionalNode:aD,ConstantNode:oD,FunctionAssignmentNode:lD,FunctionNode:gD,IndexNode:mD,ObjectNode:KN,OperatorNode:eD,ParenthesisNode:rD,RangeNode:sD,RelationalNode:tD,SymbolNode:hD,config:Q,numeric:Ex,typed:Wy}),vD=ch({ConstantNode:oD,FunctionNode:gD,OperatorNode:eD,ParenthesisNode:rD,parse:yD,typed:Wy}),xD=oh({bignumber:sv,fraction:xx,AccessorNode:pD,ArrayNode:nD,ConstantNode:oD,FunctionNode:gD,IndexNode:mD,ObjectNode:KN,OperatorNode:eD,SymbolNode:hD,config:Q,mathWithTransform:JN,matrix:wx,typed:Wy}),bD=Jp({parse:yD,typed:Wy}),wD=Am({parse:yD}),ND=Kd({parse:yD,typed:Wy}),DD=uh({AccessorNode:pD,ArrayNode:nD,ConstantNode:oD,FunctionNode:gD,IndexNode:mD,ObjectNode:KN,OperatorNode:eD,ParenthesisNode:rD,SymbolNode:hD,add:ob,divide:lN,equal:jx,isZero:Tv,multiply:Ab,parse:yD,pow:ww,subtract:Ob,typed:Wy}),ED=Qp({parse:yD,typed:Wy}),AD=Om({Help:wD,mathWithTransform:JN,typed:Wy}),CD=Kp({evaluate:ED}),SD=ah({bignumber:sv,fraction:xx,AccessorNode:pD,ArrayNode:nD,ConstantNode:oD,FunctionNode:gD,IndexNode:mD,ObjectNode:KN,OperatorNode:eD,ParenthesisNode:rD,SymbolNode:hD,add:ob,config:Q,divide:lN,equal:jx,isZero:Tv,mathWithTransform:JN,matrix:wx,multiply:Ab,parse:yD,pow:ww,resolve:vD,simplifyConstant:xD,simplifyCore:DD,subtract:Ob,typed:Wy}),MD=fh({OperatorNode:eD,parse:yD,simplify:SD,typed:Wy}),FD=mh({ConstantNode:oD,FunctionNode:gD,OperatorNode:eD,ParenthesisNode:rD,SymbolNode:hD,config:Q,equal:jx,isZero:Tv,numeric:Ex,parse:yD,simplify:SD,typed:Wy}),BD=rm({Parser:CD,typed:Wy}),TD=hh({bignumber:sv,fraction:xx,AccessorNode:pD,ArrayNode:nD,ConstantNode:oD,FunctionNode:gD,IndexNode:mD,ObjectNode:KN,OperatorNode:eD,ParenthesisNode:rD,SymbolNode:hD,add:ob,config:Q,divide:lN,equal:jx,isZero:Tv,mathWithTransform:JN,matrix:wx,multiply:Ab,parse:yD,pow:ww,simplify:SD,simplifyConstant:xD,simplifyCore:DD,subtract:Ob,typed:Wy});(0,n.Z)(YN,{e:Dy,false:Ey,fineStructure:Ay,i:Sy,Infinity:My,LN10:Fy,LOG10E:By,NaN:Oy,null:_y,phi:zy,SQRT1_2:ky,sackurTetrode:Ry,tau:Py,true:Uy,E:Dy,version:jy,efimovFactor:Hy,LN2:$y,pi:Zy,replacer:Gy,reviver:uD,SQRT2:Vy,typed:Wy,unaryPlus:Yy,PI:Zy,weakMixingAngle:Jy,abs:Xy,acos:Qy,acot:Ky,acsc:ev,addScalar:rv,arg:tv,asech:nv,asinh:iv,atan:av,atanh:ov,bignumber:sv,bitNot:uv,boolean:cv,clone:lv,combinations:fv,complex:pv,conj:mv,cosh:dv,coth:hv,csc:gv,cube:yv,equalScalar:vv,erf:xv,exp:bv,expm1:wv,filter:Nv,forEach:Dv,format:Ev,getMatrixDataType:Av,hex:Cv,im:Sv,isInteger:Mv,isNegative:Fv,isPositive:Bv,isZero:Tv,LOG2E:Ov,lgamma:_v,log10:zv,log2:qv,map:Iv,multiplyScalar:kv,not:Rv,number:Pv,oct:Uv,pickRandom:jv,print:Lv,random:Hv,re:$v,sec:Zv,sign:Gv,sin:Vv,splitUnit:Yv,square:Jv,string:Xv,tan:Qv,typeOf:Kv,acosh:ex,acsch:rx,apply:tx,asec:nx,bin:ix,chain:fD,combinationsWithRep:ax,cos:ox,csch:sx,isNaN:ux,isPrime:cx,randomInt:lx,sech:fx,sinh:px,sparse:mx,sqrt:dx,tanh:hx,unaryMinus:gx,acoth:yx,cot:vx,fraction:xx,isNumeric:bx,matrix:wx,matrixFromFunction:Nx,mode:Dx,numeric:Ex,prod:Ax,reshape:Cx,size:Sx,squeeze:Mx,subset:Fx,transpose:Bx,xgcd:Tx,zeros:Ox,asin:_x,cbrt:zx,concat:qx,count:Ix,ctranspose:kx,diag:Rx,divideScalar:Px,dotDivide:Ux,equal:jx,flatten:Lx,gcd:Hx,hasNumericValue:$x,identity:Zx,kron:Gx,largerEq:Vx,leftShift:Wx,matrixFromColumns:Yx,mod:Jx,nthRoot:Xx,ones:Qx,resize:Kx,rightArithShift:eb,round:rb,smaller:tb,to:nb,unequal:ib,xor:ab,add:ob,bitAnd:sb,bitXor:ub,catalan:cb,compare:lb,compareText:fb,cumsum:pb,deepEqual:mb,dot:db,equalText:hb,floor:gb,hypot:yb,invmod:bb,larger:wb,log:Nb,matrixFromRows:Db,min:Eb,multiply:Ab,nthRoots:Cb,or:Sb,partitionSelect:Mb,quantileSeq:Fb,rightLogShift:Bb,smallerEq:Tb,subtract:Ob,trace:_b,usolve:zb,zpk2tf:qb,and:Ib,bitOr:kb,ceil:Rb,compareNatural:Pb,composition:Ub,cross:jb,det:Lb,diff:Hb,distance:$b,dotMultiply:Zb,fix:Vb,index:Wb,intersect:Yb,lcm:Jb,log1p:Xb,lsolve:Qb,max:Kb,qr:ew,range:rw,row:tw,setCartesian:nw,setDistinct:iw,setIsSubset:aw,setPowerset:ow,slu:sw,sort:uw,sum:cw,usolveAll:lw,atan2:fw,column:pw,lsolveAll:mw,setDifference:dw,setMultiplicity:hw,setSymDifference:gw,inv:vw,lup:xw,pinv:bw,pow:ww,setIntersect:Nw,setUnion:Dw,sqrtm:Ew,vacuumImpedance:Cw,wienDisplacement:Sw,atomicMass:Mw,bohrMagneton:Fw,boltzmann:Bw,conductanceQuantum:Tw,createUnit:Ow,deuteronMass:_w,dotPow:zw,electricConstant:qw,elementaryCharge:Iw,expm:kw,faraday:Rw,fft:Pw,gamma:Uw,gravitationConstant:jw,hartreeEnergy:Lw,ifft:Hw,klitzing:$w,loschmidt:Zw,magneticConstant:Gw,molarMass:Vw,molarPlanckConstant:Ww,neutronMass:Yw,nuclearMagneton:Jw,planckCharge:Xw,planckLength:Qw,planckTemperature:Kw,protonMass:eN,reducedPlanckConstant:rN,rydberg:tN,secondRadiation:nN,speedOfLight:iN,stefanBoltzmann:aN,thomsonCrossSection:oN,avogadro:sN,bohrRadius:uN,coulomb:cN,divide:lN,electronMass:fN,factorial:pN,firstRadiation:mN,gravity:dN,inverseConductanceQuantum:hN,lusolve:gN,magneticFluxQuantum:yN,molarMassC12:vN,multinomial:xN,parse:yD,permutations:bN,planckMass:wN,polynomialRoot:NN,resolve:vD,setSize:DN,simplifyConstant:xD,solveODE:EN,stirlingS2:AN,unit:CN,bellNumbers:SN,compile:bD,eigs:MN,fermiCoupling:FN,gasConstant:BN,leafCount:ND,mean:TN,molarVolume:ON,planckConstant:_N,quantumOfCirculation:zN,simplifyCore:DD,variance:qN,classicalElectronRadius:IN,evaluate:ED,help:AD,median:kN,simplify:SD,symbolicEqual:MD,derivative:FD,kldivergence:RN,mad:PN,parser:BD,rationalize:TD,std:UN,freqz:jN,norm:LN,rotationMatrix:HN,planckTime:$N,schur:ZN,rotate:GN,sylvester:VN,lyap:WN,config:Q}),(0,n.Z)(JN,YN,{filter:jg({typed:Wy}),forEach:Hg({typed:Wy}),map:Zg({typed:Wy}),apply:Rg({isInteger:Mv,typed:Wy}),subset:ay({matrix:wx,typed:Wy}),concat:sy({isInteger:Mv,matrix:wx,typed:Wy}),max:Yg({config:Q,larger:wb,numeric:Ex,typed:Wy}),sum:dy({add:ob,config:Q,numeric:Ex,typed:Wy}),min:Kg({config:Q,numeric:Ex,smaller:tb,typed:Wy}),cumsum:yy({add:ob,typed:Wy,unaryPlus:Yy}),diff:ly({bignumber:sv,matrix:wx,number:Pv,subtract:Ob,typed:Wy}),index:$g({Index:xb}),range:ry({bignumber:sv,matrix:wx,add:ob,config:Q,isPositive:Bv,larger:wb,largerEq:Vx,smaller:tb,smallerEq:Tb,typed:Wy}),row:ny({Index:xb,matrix:wx,range:rw,typed:Wy}),column:Pg({Index:xb,matrix:wx,range:rw,typed:Wy}),mean:Xg({add:ob,divide:lN,typed:Wy}),variance:by({add:ob,apply:tx,divide:lN,isNaN:ux,multiply:Ab,subtract:Ob,typed:Wy}),std:py({map:Iv,sqrt:dx,typed:Wy,variance:qN})}),(0,n.Z)(XN,{BigNumber:wy,Complex:Ny,Fraction:Cy,Matrix:Ty,Node:QN,ObjectNode:KN,OperatorNode:eD,ParenthesisNode:rD,Range:qy,RelationalNode:tD,ResultSet:Iy,ArrayNode:nD,BlockNode:iD,ConditionalNode:aD,ConstantNode:oD,DenseMatrix:Ly,RangeNode:sD,Chain:cD,FunctionAssignmentNode:lD,SparseMatrix:Wv,AccessorNode:pD,IndexNode:mD,AssignmentNode:dD,ImmutableDenseMatrix:vb,Index:xb,FibonacciHeap:Gb,Spa:yw,Unit:Aw,SymbolNode:hD,FunctionNode:gD,Help:wD,Parser:CD}),cD.createProxy(YN);t(89757)}}]);
//# sourceMappingURL=220.bundle.d0b0df6e3678c751fa3c.js.map