/* Mbn v1.50 / 31.03.2020 | https://mirkl.es/n/lib | Copyright (c) 2016-2020 Mikołaj Błajek | https://mirkl.es/n/LICENSE */
var Mbn=function(){var K={invalid_argument:"invalid argument: %v%",invalid_format:"invalid format: %v%",limit_exceeded:"value exceeded %v% digits limit",calc:{undefined:"undefined: %v%",unexpected:"unexpected: %v%"},cmp:{negative_diff:"negative maximal difference: %v%"},def:{undefined:"undefined constant: %v%",already_set:"constant already set: %v% = %w%",invalid_name:"invalid name for constant: %v%"},div:{zero_divisor:"division by zero"},extend:{invalid_precision:"invalid precision (non-negative integer): %v%",
invalid_separator:"invalid separator (dot, comma): %v%",invalid_truncation:"invalid truncation (bool): %v%",invalid_evaluating:"invalid evaluating (bool, null): %v%",invalid_formatting:"invalid formatting (bool): %v%",invalid_limit:"invalid digit limit (positive int): %v%"},fact:{invalid_value:"factorial of invalid value (non-negative integer): %v%"},format:{_:"extend"},pow:{unsupported_exponent:"only integer exponents supported: %v%"},reduce:{invalid_function:"invalid function name: %v%",no_array:"no array given",
invalid_argument_count:"two arguments can be used only with two-argument functions",different_lengths:"arrays have different lengths: %v%, %w%",different_keys:"arrays have different keys: [%v%], [%w%]"},split:{invalid_part_count:"only positive integer number of parts supported: %v%",zero_part_sum:"cannot split value when sum of parts is zero"},sqrt:{negative_value:"square root of negative value: %v%"}},B={}.hasOwnProperty,E=null,F=function(p,k){if(p instanceof Array){var h=[];if(void 0===k||!0===
k)for(var w=0;w
k||!isFinite(k)||Math.round(k)!==k))throw new p(v+"invalid_precision",k);if(h.hasOwnProperty("MbnS")&&(y=h.MbnS,"."!==y&&","!==y))throw new p(v+"invalid_separator",
y);if(h.hasOwnProperty("MbnT")&&(w=h.MbnT,!0!==w&&!1!==w))throw new p(v+"invalid_truncation",w);if(h.hasOwnProperty("MbnE")&&(r=h.MbnE,!0!==r&&!1!==r&&null!==r))throw new p(v+"invalid_evaluating",r);if(h.hasOwnProperty("MbnF")&&(q=h.MbnF,!0!==q&&!1!==q))throw new p(v+"invalid_formatting",q);if(h.hasOwnProperty("MbnL")&&(u=h.MbnL,"number"!==typeof u||0>=u||!isFinite(u)||Math.round(u)!==u))throw new p(v+"invalid_limit",u);return{MbnV:"1.50",MbnP:k,MbnS:y,MbnT:w,MbnE:r,MbnF:q,MbnL:u}},J=function(h){"object"!==
typeof h&&(h=void 0!==h?{MbnP:h}:{});h=N(h,2,".",!1,null,!1,1E3,"extend.");var k=h.MbnP,y=h.MbnS,w=h.MbnT,r=h.MbnE,q=h.MbnF,u=h.MbnL,v=function(a){for(var e=a._d,b=e.length-1,d=b,c,f;0<=d;){for(c=e[d];0>c;)c+=10,e[d-1]--;f=c%10;c=(c-f)/10;e[d]=f;0!==c?0!==d?e[--d]+=c:(e.unshift(c),b++):d--}for(;b>k&&0===e[0];)e.shift(),b--;for(;bu)throw new p("limit_exceeded",u);},t=function(a,e,b){return!0===b?(a._d=e._d,a._s=e._s,
a):e},x=function(a){var e=a._d,b=e.length;2>b&&(e.unshift(0),b++);5<=e.pop()&&e[b-2]++;v(a)},E=/^\s*(=)?[\s=]*([-+])?\s*((?:[\s\S]*\S)?)/,D=function(a,e,b,d,c){var n=a,l=a._d.length-k;if(el&&(g._d=g._d.slice(n-e-l));n=g}g=n._d.slice(0,l);if(c){var p=g.length;for(c=0;3*ck&&!d)for(c=0;ca._s?"-":"")+g.join("");0b&&(b=-b,this._s=-1);var d=Math.floor(b);b-=d;do{var c=d%10;d-=c;d/=10;this._d.unshift(c)}while(0=m)z<=g+k&&this._d.push(m);else if(z===n&&1!==l||-16===m&&z>q&&z+1a._s?1:-1;if(0===this._s)return 0;b=a._d.length;var d=this._d.length-b;if(0!==d)return 0a._d[d]?this._s:-this._s;return 0}if(-1===b._s)throw new p("cmp.negative_diff",
b);return 0>=this.sub(a).abs().cmp(b)?0:this.cmp(a)};f.prototype.add=function(a,e){a instanceof f||(a=new f(a));var b=new f(a);if(0!==this._s)if(0===a._s)b.set(this);else if(a._s===this._s){var d=this._d.length-a._d.length;0>d?(a=this,d=-d):b.set(this);for(var c=0;c=d&&(b._d[c]+=a._d[c-d]);v(b)}else b._s=-b._s,b.sub(this,!0),b._s=-b._s;return t(this,b,e)};f.prototype.sub=function(a,e){a instanceof f||(a=new f(a));var b=new f(a);if(0===this._s)b._s=-b._s;else if(0===a._s)b.set(this);
else if(a._s===this._s){var d=this._d.length-a._d.length,c=this.cmp(a)*this._s;if(0===c)b=new f(0);else{-1===c?(a=this,d=-d):b.set(this);for(var n=0;n=d&&(b._d[n]-=a._d[n-d]);b._s=c*this._s;v(b)}}else b._s=-b._s,b.add(this,!0);return t(this,b,e)};f.prototype.mul=function(a,e){a instanceof f||(a=new f(a));var b=new f(a);b._d=[];for(var d=0;d=q;if(h===q)for(g=0;gd[g];break}if(r)for(n[c]++,h-=q,g=q-1;0<=g;g--)b[g+
h]=n)throw new p("split.invalid_part_count",n);if(0===c._s)throw new p("split.zero_part_sum");a=new f(this);d=[];d.length=n;for(b=0;b=this.cmp(a)?this:a),e)};f.prototype.max=function(a,e){return t(this,new f(0<=this.cmp(a)?this:a),e)};f.prototype.sqrt=function(a){var e=this.mul(100),b=new f(e),d=new f(e),c=new f(2);if(-1===d._s)throw new p("sqrt.negative_value",this);if(1===d._s){do b.set(d),d.add(e.div(d),!0).div(c,!0);while(!b.eq(d))}x(d);return t(this,d,a)};f.prototype.sgn=function(a){return t(this,new f(this._s),a)};f.prototype.pow=function(a,e){var b=new f(a);if(!b.isInt())throw new p("pow.unsupported_exponent",
b);var d=b._s;b._s*=b._s;b=b.toNumber();var c=new f(1),n=new f(this);-1===d&&-1===n.abs().cmp(c)&&(n.invm(!0),d=-d);var l=0,g=0;for(c=new f(c);!n.isInt();)n._d.push(0),v(n),l++;for(;;){1===b%2&&(c.mul(n,!0),g+=l);b=Math.floor(b/2);if(0===b)break;n.mul(n,!0);l*=2}1<=g&&(1