a-calc 3.0.0-beta.20260124.2 → 3.0.0-beta.20260124.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cjs/index.js CHANGED
@@ -7,4 +7,4 @@ var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",i=r.toS
7
7
  * https://github.com/MikeMcl/decimal.js
8
8
  * Copyright (c) 2025 Michael Mclaughlin <M8ch88l@gmail.com>
9
9
  * MIT Licence
10
- */var EXP_LIMIT=9e15,MAX_DIGITS=1e9,NUMERALS="0123456789abcdef",LN10="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",PI="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",DEFAULTS={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-EXP_LIMIT,maxE:EXP_LIMIT,crypto:!1},inexact,quadrant,external=!0,decimalError="[DecimalError] ",invalidArgument=decimalError+"Invalid argument: ",precisionLimitExceeded=decimalError+"Precision limit exceeded",cryptoUnavailable=decimalError+"crypto unavailable",tag="[object Decimal]",mathfloor=Math.floor,mathpow=Math.pow,isBinary=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,isHex=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,isOctal=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,isDecimal=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,BASE=1e7,LOG_BASE=7,MAX_SAFE_INTEGER=9007199254740991,LN10_PRECISION=LN10.length-1,PI_PRECISION=PI.length-1,P={toStringTag:tag};function digitsToString(e){var t,r,n,i=e.length-1,a="",o=e[0];if(i>0){for(a+=o,t=1;t<i;t++)n=e[t]+"",(r=LOG_BASE-n.length)&&(a+=getZeroString(r)),a+=n;o=e[t],(r=LOG_BASE-(n=o+"").length)&&(a+=getZeroString(r))}else if(0===o)return"0";for(;o%10==0;)o/=10;return a+o}function checkInt32(e,t,r){if(e!==~~e||e<t||e>r)throw Error(invalidArgument+e)}function checkRoundingDigits(e,t,r,n){var i,a,o,s;for(a=e[0];a>=10;a/=10)--t;return--t<0?(t+=LOG_BASE,i=0):(i=Math.ceil((t+1)/LOG_BASE),t%=LOG_BASE),a=mathpow(10,LOG_BASE-t),s=e[i]%a|0,null==n?t<3?(0==t?s=s/100|0:1==t&&(s=s/10|0),o=r<4&&99999==s||r>3&&49999==s||5e4==s||0==s):o=(r<4&&s+1==a||r>3&&s+1==a/2)&&(e[i+1]/a/100|0)==mathpow(10,t-2)-1||(s==a/2||0==s)&&!(e[i+1]/a/100|0):t<4?(0==t?s=s/1e3|0:1==t?s=s/100|0:2==t&&(s=s/10|0),o=(n||r<4)&&9999==s||!n&&r>3&&4999==s):o=((n||r<4)&&s+1==a||!n&&r>3&&s+1==a/2)&&(e[i+1]/a/1e3|0)==mathpow(10,t-3)-1,o}function convertBase(e,t,r){for(var n,i,a=[0],o=0,s=e.length;o<s;){for(i=a.length;i--;)a[i]*=t;for(a[0]+=NUMERALS.indexOf(e.charAt(o++)),n=0;n<a.length;n++)a[n]>r-1&&(void 0===a[n+1]&&(a[n+1]=0),a[n+1]+=a[n]/r|0,a[n]%=r)}return a.reverse()}function cosine(e,t){var r,n,i;if(t.isZero())return t;(n=t.d.length)<32?i=(1/tinyPow(4,r=Math.ceil(n/3))).toString():(r=16,i="2.3283064365386962890625e-10"),e.precision+=r,t=taylorSeries(e,1,t.times(i),new e(1));for(var a=r;a--;){var o=t.times(t);t=o.times(o).minus(o).times(8).plus(1)}return e.precision-=r,t}P.absoluteValue=P.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),finalise(e)},P.ceil=function(){return finalise(new this.constructor(this),this.e+1,2)},P.clampedTo=P.clamp=function(e,t){var r=this,n=r.constructor;if(e=new n(e),t=new n(t),!e.s||!t.s)return new n(NaN);if(e.gt(t))throw Error(invalidArgument+t);return r.cmp(e)<0?e:r.cmp(t)>0?t:new n(r)},P.comparedTo=P.cmp=function(e){var t,r,n,i,a=this,o=a.d,s=(e=new a.constructor(e)).d,_=a.s,u=e.s;if(!o||!s)return _&&u?_!==u?_:o===s?0:!o^_<0?1:-1:NaN;if(!o[0]||!s[0])return o[0]?_:s[0]?-u:0;if(_!==u)return _;if(a.e!==e.e)return a.e>e.e^_<0?1:-1;for(t=0,r=(n=o.length)<(i=s.length)?n:i;t<r;++t)if(o[t]!==s[t])return o[t]>s[t]^_<0?1:-1;return n===i?0:n>i^_<0?1:-1},P.cosine=P.cos=function(){var e,t,r=this,n=r.constructor;return r.d?r.d[0]?(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+LOG_BASE,n.rounding=1,r=cosine(n,toLessThanHalfPi(n,r)),n.precision=e,n.rounding=t,finalise(2==quadrant||3==quadrant?r.neg():r,e,t,!0)):new n(1):new n(NaN)},P.cubeRoot=P.cbrt=function(){var e,t,r,n,i,a,o,s,_,u,c=this,l=c.constructor;if(!c.isFinite()||c.isZero())return new l(c);for(external=!1,(a=c.s*mathpow(c.s*c,1/3))&&Math.abs(a)!=1/0?n=new l(a.toString()):(r=digitsToString(c.d),(a=((e=c.e)-r.length+1)%3)&&(r+=1==a||-2==a?"0":"00"),a=mathpow(r,1/3),e=mathfloor((e+1)/3)-(e%3==(e<0?-1:2)),(n=new l(r=a==1/0?"5e"+e:(r=a.toExponential()).slice(0,r.indexOf("e")+1)+e)).s=c.s),o=(e=l.precision)+3;;)if(u=(_=(s=n).times(s).times(s)).plus(c),n=divide(u.plus(c).times(s),u.plus(_),o+2,1),digitsToString(s.d).slice(0,o)===(r=digitsToString(n.d)).slice(0,o)){if("9999"!=(r=r.slice(o-3,o+1))&&(i||"4999"!=r)){+r&&(+r.slice(1)||"5"!=r.charAt(0))||(finalise(n,e+1,1),t=!n.times(n).times(n).eq(c));break}if(!i&&(finalise(s,e+1,0),s.times(s).times(s).eq(c))){n=s;break}o+=4,i=1}return external=!0,finalise(n,e,l.rounding,t)},P.decimalPlaces=P.dp=function(){var e,t=this.d,r=NaN;if(t){if(r=((e=t.length-1)-mathfloor(this.e/LOG_BASE))*LOG_BASE,e=t[e])for(;e%10==0;e/=10)r--;r<0&&(r=0)}return r},P.dividedBy=P.div=function(e){return divide(this,new this.constructor(e))},P.dividedToIntegerBy=P.divToInt=function(e){var t=this.constructor;return finalise(divide(this,new t(e),0,1,1),t.precision,t.rounding)},P.equals=P.eq=function(e){return 0===this.cmp(e)},P.floor=function(){return finalise(new this.constructor(this),this.e+1,3)},P.greaterThan=P.gt=function(e){return this.cmp(e)>0},P.greaterThanOrEqualTo=P.gte=function(e){var t=this.cmp(e);return 1==t||0===t},P.hyperbolicCosine=P.cosh=function(){var e,t,r,n,i,a=this,o=a.constructor,s=new o(1);if(!a.isFinite())return new o(a.s?1/0:NaN);if(a.isZero())return s;r=o.precision,n=o.rounding,o.precision=r+Math.max(a.e,a.sd())+4,o.rounding=1,(i=a.d.length)<32?t=(1/tinyPow(4,e=Math.ceil(i/3))).toString():(e=16,t="2.3283064365386962890625e-10"),a=taylorSeries(o,1,a.times(t),new o(1),!0);for(var _,u=e,c=new o(8);u--;)_=a.times(a),a=s.minus(_.times(c.minus(_.times(c))));return finalise(a,o.precision=r,o.rounding=n,!0)},P.hyperbolicSine=P.sinh=function(){var e,t,r,n,i=this,a=i.constructor;if(!i.isFinite()||i.isZero())return new a(i);if(t=a.precision,r=a.rounding,a.precision=t+Math.max(i.e,i.sd())+4,a.rounding=1,(n=i.d.length)<3)i=taylorSeries(a,2,i,i,!0);else{e=(e=1.4*Math.sqrt(n))>16?16:0|e,i=taylorSeries(a,2,i=i.times(1/tinyPow(5,e)),i,!0);for(var o,s=new a(5),_=new a(16),u=new a(20);e--;)o=i.times(i),i=i.times(s.plus(o.times(_.times(o).plus(u))))}return a.precision=t,a.rounding=r,finalise(i,t,r,!0)},P.hyperbolicTangent=P.tanh=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+7,n.rounding=1,divide(r.sinh(),r.cosh(),n.precision=e,n.rounding=t)):new n(r.s)},P.inverseCosine=P.acos=function(){var e=this,t=e.constructor,r=e.abs().cmp(1),n=t.precision,i=t.rounding;return-1!==r?0===r?e.isNeg()?getPi(t,n,i):new t(0):new t(NaN):e.isZero()?getPi(t,n+4,i).times(.5):(t.precision=n+6,t.rounding=1,e=new t(1).minus(e).div(e.plus(1)).sqrt().atan(),t.precision=n,t.rounding=i,e.times(2))},P.inverseHyperbolicCosine=P.acosh=function(){var e,t,r=this,n=r.constructor;return r.lte(1)?new n(r.eq(1)?0:NaN):r.isFinite()?(e=n.precision,t=n.rounding,n.precision=e+Math.max(Math.abs(r.e),r.sd())+4,n.rounding=1,external=!1,r=r.times(r).minus(1).sqrt().plus(r),external=!0,n.precision=e,n.rounding=t,r.ln()):new n(r)},P.inverseHyperbolicSine=P.asinh=function(){var e,t,r=this,n=r.constructor;return!r.isFinite()||r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+2*Math.max(Math.abs(r.e),r.sd())+6,n.rounding=1,external=!1,r=r.times(r).plus(1).sqrt().plus(r),external=!0,n.precision=e,n.rounding=t,r.ln())},P.inverseHyperbolicTangent=P.atanh=function(){var e,t,r,n,i=this,a=i.constructor;return i.isFinite()?i.e>=0?new a(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=a.precision,t=a.rounding,n=i.sd(),Math.max(n,e)<2*-i.e-1?finalise(new a(i),e,t,!0):(a.precision=r=n-i.e,i=divide(i.plus(1),new a(1).minus(i),r+e,1),a.precision=e+4,a.rounding=1,i=i.ln(),a.precision=e,a.rounding=t,i.times(.5))):new a(NaN)},P.inverseSine=P.asin=function(){var e,t,r,n,i=this,a=i.constructor;return i.isZero()?new a(i):(t=i.abs().cmp(1),r=a.precision,n=a.rounding,-1!==t?0===t?((e=getPi(a,r+4,n).times(.5)).s=i.s,e):new a(NaN):(a.precision=r+6,a.rounding=1,i=i.div(new a(1).minus(i.times(i)).sqrt().plus(1)).atan(),a.precision=r,a.rounding=n,i.times(2)))},P.inverseTangent=P.atan=function(){var e,t,r,n,i,a,o,s,_,u=this,c=u.constructor,l=c.precision,p=c.rounding;if(u.isFinite()){if(u.isZero())return new c(u);if(u.abs().eq(1)&&l+4<=PI_PRECISION)return(o=getPi(c,l+4,p).times(.25)).s=u.s,o}else{if(!u.s)return new c(NaN);if(l+4<=PI_PRECISION)return(o=getPi(c,l+4,p).times(.5)).s=u.s,o}for(c.precision=s=l+10,c.rounding=1,e=r=Math.min(28,s/LOG_BASE+2|0);e;--e)u=u.div(u.times(u).plus(1).sqrt().plus(1));for(external=!1,t=Math.ceil(s/LOG_BASE),n=1,_=u.times(u),o=new c(u),i=u;-1!==e;)if(i=i.times(_),a=o.minus(i.div(n+=2)),i=i.times(_),void 0!==(o=a.plus(i.div(n+=2))).d[t])for(e=t;o.d[e]===a.d[e]&&e--;);return r&&(o=o.times(2<<r-1)),external=!0,finalise(o,c.precision=l,c.rounding=p,!0)},P.isFinite=function(){return!!this.d},P.isInteger=P.isInt=function(){return!!this.d&&mathfloor(this.e/LOG_BASE)>this.d.length-2},P.isNaN=function(){return!this.s},P.isNegative=P.isNeg=function(){return this.s<0},P.isPositive=P.isPos=function(){return this.s>0},P.isZero=function(){return!!this.d&&0===this.d[0]},P.lessThan=P.lt=function(e){return this.cmp(e)<0},P.lessThanOrEqualTo=P.lte=function(e){return this.cmp(e)<1},P.logarithm=P.log=function(e){var t,r,n,i,a,o,s,_,u=this,c=u.constructor,l=c.precision,p=c.rounding;if(null==e)e=new c(10),t=!0;else{if(r=(e=new c(e)).d,e.s<0||!r||!r[0]||e.eq(1))return new c(NaN);t=e.eq(10)}if(r=u.d,u.s<0||!r||!r[0]||u.eq(1))return new c(r&&!r[0]?-1/0:1!=u.s?NaN:r?0:1/0);if(t)if(r.length>1)a=!0;else{for(i=r[0];i%10==0;)i/=10;a=1!==i}if(external=!1,o=naturalLogarithm(u,s=l+5),n=t?getLn10(c,s+10):naturalLogarithm(e,s),checkRoundingDigits((_=divide(o,n,s,1)).d,i=l,p))do{if(o=naturalLogarithm(u,s+=10),n=t?getLn10(c,s+10):naturalLogarithm(e,s),_=divide(o,n,s,1),!a){+digitsToString(_.d).slice(i+1,i+15)+1==1e14&&(_=finalise(_,l+1,0));break}}while(checkRoundingDigits(_.d,i+=10,p));return external=!0,finalise(_,l,p)},P.minus=P.sub=function(e){var t,r,n,i,a,o,s,_,u,c,l,p,d=this,f=d.constructor;if(e=new f(e),!d.d||!e.d)return d.s&&e.s?d.d?e.s=-e.s:e=new f(e.d||d.s!==e.s?d:NaN):e=new f(NaN),e;if(d.s!=e.s)return e.s=-e.s,d.plus(e);if(u=d.d,p=e.d,s=f.precision,_=f.rounding,!u[0]||!p[0]){if(p[0])e.s=-e.s;else{if(!u[0])return new f(3===_?-0:0);e=new f(d)}return external?finalise(e,s,_):e}if(r=mathfloor(e.e/LOG_BASE),c=mathfloor(d.e/LOG_BASE),u=u.slice(),a=c-r){for((l=a<0)?(t=u,a=-a,o=p.length):(t=p,r=c,o=u.length),a>(n=Math.max(Math.ceil(s/LOG_BASE),o)+2)&&(a=n,t.length=1),t.reverse(),n=a;n--;)t.push(0);t.reverse()}else{for((l=(n=u.length)<(o=p.length))&&(o=n),n=0;n<o;n++)if(u[n]!=p[n]){l=u[n]<p[n];break}a=0}for(l&&(t=u,u=p,p=t,e.s=-e.s),o=u.length,n=p.length-o;n>0;--n)u[o++]=0;for(n=p.length;n>a;){if(u[--n]<p[n]){for(i=n;i&&0===u[--i];)u[i]=BASE-1;--u[i],u[n]+=BASE}u[n]-=p[n]}for(;0===u[--o];)u.pop();for(;0===u[0];u.shift())--r;return u[0]?(e.d=u,e.e=getBase10Exponent(u,r),external?finalise(e,s,_):e):new f(3===_?-0:0)},P.modulo=P.mod=function(e){var t,r=this,n=r.constructor;return e=new n(e),!r.d||!e.s||e.d&&!e.d[0]?new n(NaN):!e.d||r.d&&!r.d[0]?finalise(new n(r),n.precision,n.rounding):(external=!1,9==n.modulo?(t=divide(r,e.abs(),0,3,1)).s*=e.s:t=divide(r,e,0,n.modulo,1),t=t.times(e),external=!0,r.minus(t))},P.naturalExponential=P.exp=function(){return naturalExponential(this)},P.naturalLogarithm=P.ln=function(){return naturalLogarithm(this)},P.negated=P.neg=function(){var e=new this.constructor(this);return e.s=-e.s,finalise(e)},P.plus=P.add=function(e){var t,r,n,i,a,o,s,_,u,c,l=this,p=l.constructor;if(e=new p(e),!l.d||!e.d)return l.s&&e.s?l.d||(e=new p(e.d||l.s===e.s?l:NaN)):e=new p(NaN),e;if(l.s!=e.s)return e.s=-e.s,l.minus(e);if(u=l.d,c=e.d,s=p.precision,_=p.rounding,!u[0]||!c[0])return c[0]||(e=new p(l)),external?finalise(e,s,_):e;if(a=mathfloor(l.e/LOG_BASE),n=mathfloor(e.e/LOG_BASE),u=u.slice(),i=a-n){for(i<0?(r=u,i=-i,o=c.length):(r=c,n=a,o=u.length),i>(o=(a=Math.ceil(s/LOG_BASE))>o?a+1:o+1)&&(i=o,r.length=1),r.reverse();i--;)r.push(0);r.reverse()}for((o=u.length)-(i=c.length)<0&&(i=o,r=c,c=u,u=r),t=0;i;)t=(u[--i]=u[i]+c[i]+t)/BASE|0,u[i]%=BASE;for(t&&(u.unshift(t),++n),o=u.length;0==u[--o];)u.pop();return e.d=u,e.e=getBase10Exponent(u,n),external?finalise(e,s,_):e},P.precision=P.sd=function(e){var t,r=this;if(void 0!==e&&e!==!!e&&1!==e&&0!==e)throw Error(invalidArgument+e);return r.d?(t=getPrecision(r.d),e&&r.e+1>t&&(t=r.e+1)):t=NaN,t},P.round=function(){var e=this,t=e.constructor;return finalise(new t(e),e.e+1,t.rounding)},P.sine=P.sin=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+LOG_BASE,n.rounding=1,r=sine(n,toLessThanHalfPi(n,r)),n.precision=e,n.rounding=t,finalise(quadrant>2?r.neg():r,e,t,!0)):new n(NaN)},P.squareRoot=P.sqrt=function(){var e,t,r,n,i,a,o=this,s=o.d,_=o.e,u=o.s,c=o.constructor;if(1!==u||!s||!s[0])return new c(!u||u<0&&(!s||s[0])?NaN:s?o:1/0);for(external=!1,0==(u=Math.sqrt(+o))||u==1/0?(((t=digitsToString(s)).length+_)%2==0&&(t+="0"),u=Math.sqrt(t),_=mathfloor((_+1)/2)-(_<0||_%2),n=new c(t=u==1/0?"5e"+_:(t=u.toExponential()).slice(0,t.indexOf("e")+1)+_)):n=new c(u.toString()),r=(_=c.precision)+3;;)if(n=(a=n).plus(divide(o,a,r+2,1)).times(.5),digitsToString(a.d).slice(0,r)===(t=digitsToString(n.d)).slice(0,r)){if("9999"!=(t=t.slice(r-3,r+1))&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(finalise(n,_+1,1),e=!n.times(n).eq(o));break}if(!i&&(finalise(a,_+1,0),a.times(a).eq(o))){n=a;break}r+=4,i=1}return external=!0,finalise(n,_,c.rounding,e)},P.tangent=P.tan=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+10,n.rounding=1,(r=r.sin()).s=1,r=divide(r,new n(1).minus(r.times(r)).sqrt(),e+10,0),n.precision=e,n.rounding=t,finalise(2==quadrant||4==quadrant?r.neg():r,e,t,!0)):new n(NaN)},P.times=P.mul=function(e){var t,r,n,i,a,o,s,_,u,c=this,l=c.constructor,p=c.d,d=(e=new l(e)).d;if(e.s*=c.s,!(p&&p[0]&&d&&d[0]))return new l(!e.s||p&&!p[0]&&!d||d&&!d[0]&&!p?NaN:p&&d?0*e.s:e.s/0);for(r=mathfloor(c.e/LOG_BASE)+mathfloor(e.e/LOG_BASE),(_=p.length)<(u=d.length)&&(a=p,p=d,d=a,o=_,_=u,u=o),a=[],n=o=_+u;n--;)a.push(0);for(n=u;--n>=0;){for(t=0,i=_+n;i>n;)s=a[i]+d[n]*p[i-n-1]+t,a[i--]=s%BASE|0,t=s/BASE|0;a[i]=(a[i]+t)%BASE|0}for(;!a[--o];)a.pop();return t?++r:a.shift(),e.d=a,e.e=getBase10Exponent(a,r),external?finalise(e,l.precision,l.rounding):e},P.toBinary=function(e,t){return toStringBinary(this,2,e,t)},P.toDecimalPlaces=P.toDP=function(e,t){var r=this,n=r.constructor;return r=new n(r),void 0===e?r:(checkInt32(e,0,MAX_DIGITS),void 0===t?t=n.rounding:checkInt32(t,0,8),finalise(r,e+r.e+1,t))},P.toExponential=function(e,t){var r,n=this,i=n.constructor;return void 0===e?r=finiteToString(n,!0):(checkInt32(e,0,MAX_DIGITS),void 0===t?t=i.rounding:checkInt32(t,0,8),r=finiteToString(n=finalise(new i(n),e+1,t),!0,e+1)),n.isNeg()&&!n.isZero()?"-"+r:r},P.toFixed=function(e,t){var r,n,i=this,a=i.constructor;return void 0===e?r=finiteToString(i):(checkInt32(e,0,MAX_DIGITS),void 0===t?t=a.rounding:checkInt32(t,0,8),r=finiteToString(n=finalise(new a(i),e+i.e+1,t),!1,e+n.e+1)),i.isNeg()&&!i.isZero()?"-"+r:r},P.toFraction=function(e){var t,r,n,i,a,o,s,_,u,c,l,p,d=this,f=d.d,g=d.constructor;if(!f)return new g(d);if(u=r=new g(1),n=_=new g(0),o=(a=(t=new g(n)).e=getPrecision(f)-d.e-1)%LOG_BASE,t.d[0]=mathpow(10,o<0?LOG_BASE+o:o),null==e)e=a>0?t:u;else{if(!(s=new g(e)).isInt()||s.lt(u))throw Error(invalidArgument+s);e=s.gt(t)?a>0?t:u:s}for(external=!1,s=new g(digitsToString(f)),c=g.precision,g.precision=a=f.length*LOG_BASE*2;l=divide(s,t,0,1,1),1!=(i=r.plus(l.times(n))).cmp(e);)r=n,n=i,i=u,u=_.plus(l.times(i)),_=i,i=t,t=s.minus(l.times(i)),s=i;return i=divide(e.minus(r),n,0,1,1),_=_.plus(i.times(u)),r=r.plus(i.times(n)),_.s=u.s=d.s,p=divide(u,n,a,1).minus(d).abs().cmp(divide(_,r,a,1).minus(d).abs())<1?[u,n]:[_,r],g.precision=c,external=!0,p},P.toHexadecimal=P.toHex=function(e,t){return toStringBinary(this,16,e,t)},P.toNearest=function(e,t){var r=this,n=r.constructor;if(r=new n(r),null==e){if(!r.d)return r;e=new n(1),t=n.rounding}else{if(e=new n(e),void 0===t?t=n.rounding:checkInt32(t,0,8),!r.d)return e.s?r:e;if(!e.d)return e.s&&(e.s=r.s),e}return e.d[0]?(external=!1,r=divide(r,e,0,t,1).times(e),external=!0,finalise(r)):(e.s=r.s,r=e),r},P.toNumber=function(){return+this},P.toOctal=function(e,t){return toStringBinary(this,8,e,t)},P.toPower=P.pow=function(e){var t,r,n,i,a,o,s=this,_=s.constructor,u=+(e=new _(e));if(!(s.d&&e.d&&s.d[0]&&e.d[0]))return new _(mathpow(+s,u));if((s=new _(s)).eq(1))return s;if(n=_.precision,a=_.rounding,e.eq(1))return finalise(s,n,a);if((t=mathfloor(e.e/LOG_BASE))>=e.d.length-1&&(r=u<0?-u:u)<=MAX_SAFE_INTEGER)return i=intPow(_,s,r,n),e.s<0?new _(1).div(i):finalise(i,n,a);if((o=s.s)<0){if(t<e.d.length-1)return new _(NaN);if(1&e.d[t]||(o=1),0==s.e&&1==s.d[0]&&1==s.d.length)return s.s=o,s}return(t=0!=(r=mathpow(+s,u))&&isFinite(r)?new _(r+"").e:mathfloor(u*(Math.log("0."+digitsToString(s.d))/Math.LN10+s.e+1)))>_.maxE+1||t<_.minE-1?new _(t>0?o/0:0):(external=!1,_.rounding=s.s=1,r=Math.min(12,(t+"").length),(i=naturalExponential(e.times(naturalLogarithm(s,n+r)),n)).d&&checkRoundingDigits((i=finalise(i,n+5,1)).d,n,a)&&(t=n+10,+digitsToString((i=finalise(naturalExponential(e.times(naturalLogarithm(s,t+r)),t),t+5,1)).d).slice(n+1,n+15)+1==1e14&&(i=finalise(i,n+1,0))),i.s=o,external=!0,_.rounding=a,finalise(i,n,a))},P.toPrecision=function(e,t){var r,n=this,i=n.constructor;return void 0===e?r=finiteToString(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(checkInt32(e,1,MAX_DIGITS),void 0===t?t=i.rounding:checkInt32(t,0,8),r=finiteToString(n=finalise(new i(n),e,t),e<=n.e||n.e<=i.toExpNeg,e)),n.isNeg()&&!n.isZero()?"-"+r:r},P.toSignificantDigits=P.toSD=function(e,t){var r=this.constructor;return void 0===e?(e=r.precision,t=r.rounding):(checkInt32(e,1,MAX_DIGITS),void 0===t?t=r.rounding:checkInt32(t,0,8)),finalise(new r(this),e,t)},P.toString=function(){var e=this,t=e.constructor,r=finiteToString(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?"-"+r:r},P.truncated=P.trunc=function(){return finalise(new this.constructor(this),this.e+1,1)},P.valueOf=P.toJSON=function(){var e=this,t=e.constructor,r=finiteToString(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?"-"+r:r};var divide=function(){function e(e,t,r){var n,i=0,a=e.length;for(e=e.slice();a--;)n=e[a]*t+i,e[a]=n%r|0,i=n/r|0;return i&&e.unshift(i),e}function t(e,t,r,n){var i,a;if(r!=n)a=r>n?1:-1;else for(i=a=0;i<r;i++)if(e[i]!=t[i]){a=e[i]>t[i]?1:-1;break}return a}function r(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=e[r]<t[r]?1:0,e[r]=i*n+e[r]-t[r];for(;!e[0]&&e.length>1;)e.shift()}return function(n,i,a,o,s,_){var u,c,l,p,d,f,g,m,v,h,w,b,y,x,S,E,A,T,D,N,k=n.constructor,O=n.s==i.s?1:-1,P=n.d,M=i.d;if(!(P&&P[0]&&M&&M[0]))return new k(n.s&&i.s&&(P?!M||P[0]!=M[0]:M)?P&&0==P[0]||!M?0*O:O/0:NaN);for(_?(d=1,c=n.e-i.e):(_=BASE,d=LOG_BASE,c=mathfloor(n.e/d)-mathfloor(i.e/d)),D=M.length,A=P.length,h=(v=new k(O)).d=[],l=0;M[l]==(P[l]||0);l++);if(M[l]>(P[l]||0)&&c--,null==a?(x=a=k.precision,o=k.rounding):x=s?a+(n.e-i.e)+1:a,x<0)h.push(1),f=!0;else{if(x=x/d+2|0,l=0,1==D){for(p=0,M=M[0],x++;(l<A||p)&&x--;l++)S=p*_+(P[l]||0),h[l]=S/M|0,p=S%M|0;f=p||l<A}else{for((p=_/(M[0]+1)|0)>1&&(M=e(M,p,_),P=e(P,p,_),D=M.length,A=P.length),E=D,b=(w=P.slice(0,D)).length;b<D;)w[b++]=0;(N=M.slice()).unshift(0),T=M[0],M[1]>=_/2&&++T;do{p=0,(u=t(M,w,D,b))<0?(y=w[0],D!=b&&(y=y*_+(w[1]||0)),(p=y/T|0)>1?(p>=_&&(p=_-1),1==(u=t(g=e(M,p,_),w,m=g.length,b=w.length))&&(p--,r(g,D<m?N:M,m,_))):(0==p&&(u=p=1),g=M.slice()),(m=g.length)<b&&g.unshift(0),r(w,g,b,_),-1==u&&(u=t(M,w,D,b=w.length))<1&&(p++,r(w,D<b?N:M,b,_)),b=w.length):0===u&&(p++,w=[0]),h[l++]=p,u&&w[0]?w[b++]=P[E]||0:(w=[P[E]],b=1)}while((E++<A||void 0!==w[0])&&x--);f=void 0!==w[0]}h[0]||h.shift()}if(1==d)v.e=c,inexact=f;else{for(l=1,p=h[0];p>=10;p/=10)l++;v.e=l+c*d-1,finalise(v,s?a+v.e+1:a,o,f)}return v}}();function finalise(e,t,r,n){var i,a,o,s,_,u,c,l,p,d=e.constructor;e:if(null!=t){if(!(l=e.d))return e;for(i=1,s=l[0];s>=10;s/=10)i++;if((a=t-i)<0)a+=LOG_BASE,o=t,_=(c=l[p=0])/mathpow(10,i-o-1)%10|0;else if((p=Math.ceil((a+1)/LOG_BASE))>=(s=l.length)){if(!n)break e;for(;s++<=p;)l.push(0);c=_=0,i=1,o=(a%=LOG_BASE)-LOG_BASE+1}else{for(c=s=l[p],i=1;s>=10;s/=10)i++;_=(o=(a%=LOG_BASE)-LOG_BASE+i)<0?0:c/mathpow(10,i-o-1)%10|0}if(n=n||t<0||void 0!==l[p+1]||(o<0?c:c%mathpow(10,i-o-1)),u=r<4?(_||n)&&(0==r||r==(e.s<0?3:2)):_>5||5==_&&(4==r||n||6==r&&(a>0?o>0?c/mathpow(10,i-o):0:l[p-1])%10&1||r==(e.s<0?8:7)),t<1||!l[0])return l.length=0,u?(t-=e.e+1,l[0]=mathpow(10,(LOG_BASE-t%LOG_BASE)%LOG_BASE),e.e=-t||0):l[0]=e.e=0,e;if(0==a?(l.length=p,s=1,p--):(l.length=p+1,s=mathpow(10,LOG_BASE-a),l[p]=o>0?(c/mathpow(10,i-o)%mathpow(10,o)|0)*s:0),u)for(;;){if(0==p){for(a=1,o=l[0];o>=10;o/=10)a++;for(o=l[0]+=s,s=1;o>=10;o/=10)s++;a!=s&&(e.e++,l[0]==BASE&&(l[0]=1));break}if(l[p]+=s,l[p]!=BASE)break;l[p--]=0,s=1}for(a=l.length;0===l[--a];)l.pop()}return external&&(e.e>d.maxE?(e.d=null,e.e=NaN):e.e<d.minE&&(e.e=0,e.d=[0])),e}function finiteToString(e,t,r){if(!e.isFinite())return nonFiniteToString(e);var n,i=e.e,a=digitsToString(e.d),o=a.length;return t?(r&&(n=r-o)>0?a=a.charAt(0)+"."+a.slice(1)+getZeroString(n):o>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(e.e<0?"e":"e+")+e.e):i<0?(a="0."+getZeroString(-i-1)+a,r&&(n=r-o)>0&&(a+=getZeroString(n))):i>=o?(a+=getZeroString(i+1-o),r&&(n=r-i-1)>0&&(a=a+"."+getZeroString(n))):((n=i+1)<o&&(a=a.slice(0,n)+"."+a.slice(n)),r&&(n=r-o)>0&&(i+1===o&&(a+="."),a+=getZeroString(n))),a}function getBase10Exponent(e,t){var r=e[0];for(t*=LOG_BASE;r>=10;r/=10)t++;return t}function getLn10(e,t,r){if(t>LN10_PRECISION)throw external=!0,r&&(e.precision=r),Error(precisionLimitExceeded);return finalise(new e(LN10),t,1,!0)}function getPi(e,t,r){if(t>PI_PRECISION)throw Error(precisionLimitExceeded);return finalise(new e(PI),t,r,!0)}function getPrecision(e){var t=e.length-1,r=t*LOG_BASE+1;if(t=e[t]){for(;t%10==0;t/=10)r--;for(t=e[0];t>=10;t/=10)r++}return r}function getZeroString(e){for(var t="";e--;)t+="0";return t}function intPow(e,t,r,n){var i,a=new e(1),o=Math.ceil(n/LOG_BASE+4);for(external=!1;;){if(r%2&&truncate((a=a.times(t)).d,o)&&(i=!0),0===(r=mathfloor(r/2))){r=a.d.length-1,i&&0===a.d[r]&&++a.d[r];break}truncate((t=t.times(t)).d,o)}return external=!0,a}function isOdd(e){return 1&e.d[e.d.length-1]}function maxOrMin(e,t,r){for(var n,i,a=new e(t[0]),o=0;++o<t.length;){if(!(i=new e(t[o])).s){a=i;break}((n=a.cmp(i))===r||0===n&&a.s===r)&&(a=i)}return a}function naturalExponential(e,t){var r,n,i,a,o,s,_,u=0,c=0,l=0,p=e.constructor,d=p.rounding,f=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==t?(external=!1,_=f):_=t,s=new p(.03125);e.e>-2;)e=e.times(s),l+=5;for(_+=n=Math.log(mathpow(2,l))/Math.LN10*2+5|0,r=a=o=new p(1),p.precision=_;;){if(a=finalise(a.times(e),_,1),r=r.times(++c),digitsToString((s=o.plus(divide(a,r,_,1))).d).slice(0,_)===digitsToString(o.d).slice(0,_)){for(i=l;i--;)o=finalise(o.times(o),_,1);if(null!=t)return p.precision=f,o;if(!(u<3&&checkRoundingDigits(o.d,_-n,d,u)))return finalise(o,p.precision=f,d,external=!0);p.precision=_+=10,r=a=s=new p(1),c=0,u++}o=s}}function naturalLogarithm(e,t){var r,n,i,a,o,s,_,u,c,l,p,d=1,f=e,g=f.d,m=f.constructor,v=m.rounding,h=m.precision;if(f.s<0||!g||!g[0]||!f.e&&1==g[0]&&1==g.length)return new m(g&&!g[0]?-1/0:1!=f.s?NaN:g?0:f);if(null==t?(external=!1,c=h):c=t,m.precision=c+=10,n=(r=digitsToString(g)).charAt(0),!(Math.abs(a=f.e)<15e14))return u=getLn10(m,c+2,h).times(a+""),f=naturalLogarithm(new m(n+"."+r.slice(1)),c-10).plus(u),m.precision=h,null==t?finalise(f,h,v,external=!0):f;for(;n<7&&1!=n||1==n&&r.charAt(1)>3;)n=(r=digitsToString((f=f.times(e)).d)).charAt(0),d++;for(a=f.e,n>1?(f=new m("0."+r),a++):f=new m(n+"."+r.slice(1)),l=f,_=o=f=divide(f.minus(1),f.plus(1),c,1),p=finalise(f.times(f),c,1),i=3;;){if(o=finalise(o.times(p),c,1),digitsToString((u=_.plus(divide(o,new m(i),c,1))).d).slice(0,c)===digitsToString(_.d).slice(0,c)){if(_=_.times(2),0!==a&&(_=_.plus(getLn10(m,c+2,h).times(a+""))),_=divide(_,new m(d),c,1),null!=t)return m.precision=h,_;if(!checkRoundingDigits(_.d,c-10,v,s))return finalise(_,m.precision=h,v,external=!0);m.precision=c+=10,u=o=f=divide(l.minus(1),l.plus(1),c,1),p=finalise(f.times(f),c,1),i=s=1}_=u,i+=2}}function nonFiniteToString(e){return String(e.s*e.s/0)}function parseDecimal(e,t){var r,n,i;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),n=0;48===t.charCodeAt(n);n++);for(i=t.length;48===t.charCodeAt(i-1);--i);if(t=t.slice(n,i)){if(i-=n,e.e=r=r-n-1,e.d=[],n=(r+1)%LOG_BASE,r<0&&(n+=LOG_BASE),n<i){for(n&&e.d.push(+t.slice(0,n)),i-=LOG_BASE;n<i;)e.d.push(+t.slice(n,n+=LOG_BASE));t=t.slice(n),n=LOG_BASE-t.length}else n-=i;for(;n--;)t+="0";e.d.push(+t),external&&(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 parseOther(e,t){var r,n,i,a,o,s,_,u,c;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),isDecimal.test(t))return parseDecimal(e,t)}else if("Infinity"===t||"NaN"===t)return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(isHex.test(t))r=16,t=t.toLowerCase();else if(isBinary.test(t))r=2;else{if(!isOctal.test(t))throw Error(invalidArgument+t);r=8}for((a=t.search(/p/i))>0?(_=+t.slice(a+1),t=t.substring(2,a)):t=t.slice(2),o=(a=t.indexOf("."))>=0,n=e.constructor,o&&(a=(s=(t=t.replace(".","")).length)-a,i=intPow(n,new n(r),a,2*a)),a=c=(u=convertBase(t,r,BASE)).length-1;0===u[a];--a)u.pop();return a<0?new n(0*e.s):(e.e=getBase10Exponent(u,c),e.d=u,external=!1,o&&(e=divide(e,i,4*s)),_&&(e=e.times(Math.abs(_)<54?mathpow(2,_):Decimal.pow(2,_))),external=!0,e)}function sine(e,t){var r,n=t.d.length;if(n<3)return t.isZero()?t:taylorSeries(e,2,t,t);r=(r=1.4*Math.sqrt(n))>16?16:0|r,t=taylorSeries(e,2,t=t.times(1/tinyPow(5,r)),t);for(var i,a=new e(5),o=new e(16),s=new e(20);r--;)i=t.times(t),t=t.times(a.plus(i.times(o.times(i).minus(s))));return t}function taylorSeries(e,t,r,n,i){var a,o,s,_,u=e.precision,c=Math.ceil(u/LOG_BASE);for(external=!1,_=r.times(r),s=new e(n);;){if(o=divide(s.times(_),new e(t++*t++),u,1),s=i?n.plus(o):n.minus(o),n=divide(o.times(_),new e(t++*t++),u,1),void 0!==(o=s.plus(n)).d[c]){for(a=c;o.d[a]===s.d[a]&&a--;);if(-1==a)break}a=s,s=n,n=o,o=a}return external=!0,o.d.length=c+1,o}function tinyPow(e,t){for(var r=e;--t;)r*=e;return r}function toLessThanHalfPi(e,t){var r,n=t.s<0,i=getPi(e,e.precision,1),a=i.times(.5);if((t=t.abs()).lte(a))return quadrant=n?4:1,t;if((r=t.divToInt(i)).isZero())quadrant=n?3:2;else{if((t=t.minus(r.times(i))).lte(a))return quadrant=isOdd(r)?n?2:3:n?4:1,t;quadrant=isOdd(r)?n?1:4:n?3:2}return t.minus(i).abs()}function toStringBinary(e,t,r,n){var i,a,o,s,_,u,c,l,p,d=e.constructor,f=void 0!==r;if(f?(checkInt32(r,1,MAX_DIGITS),void 0===n?n=d.rounding:checkInt32(n,0,8)):(r=d.precision,n=d.rounding),e.isFinite()){for(f?(i=2,16==t?r=4*r-3:8==t&&(r=3*r-2)):i=t,(o=(c=finiteToString(e)).indexOf("."))>=0&&(c=c.replace(".",""),(p=new d(1)).e=c.length-o,p.d=convertBase(finiteToString(p),10,i),p.e=p.d.length),a=_=(l=convertBase(c,10,i)).length;0==l[--_];)l.pop();if(l[0]){if(o<0?a--:((e=new d(e)).d=l,e.e=a,l=(e=divide(e,p,r,n,0,i)).d,a=e.e,u=inexact),o=l[r],s=i/2,u=u||void 0!==l[r+1],u=n<4?(void 0!==o||u)&&(0===n||n===(e.s<0?3:2)):o>s||o===s&&(4===n||u||6===n&&1&l[r-1]||n===(e.s<0?8:7)),l.length=r,u)for(;++l[--r]>i-1;)l[r]=0,r||(++a,l.unshift(1));for(_=l.length;!l[_-1];--_);for(o=0,c="";o<_;o++)c+=NUMERALS.charAt(l[o]);if(f){if(_>1)if(16==t||8==t){for(o=16==t?4:3,--_;_%o;_++)c+="0";for(_=(l=convertBase(c,i,t)).length;!l[_-1];--_);for(o=1,c="1.";o<_;o++)c+=NUMERALS.charAt(l[o])}else c=c.charAt(0)+"."+c.slice(1);c=c+(a<0?"p":"p+")+a}else if(a<0){for(;++a;)c="0"+c;c="0."+c}else if(++a>_)for(a-=_;a--;)c+="0";else a<_&&(c=c.slice(0,a)+"."+c.slice(a))}else c=f?"0p+0":"0";c=(16==t?"0x":2==t?"0b":8==t?"0o":"")+c}else c=nonFiniteToString(e);return e.s<0?"-"+c:c}function truncate(e,t){if(e.length>t)return e.length=t,!0}function abs$1(e){return new this(e).abs()}function acos(e){return new this(e).acos()}function acosh(e){return new this(e).acosh()}function add$1(e,t){return new this(e).plus(t)}function asin(e){return new this(e).asin()}function asinh(e){return new this(e).asinh()}function atan(e){return new this(e).atan()}function atanh(e){return new this(e).atanh()}function atan2(e,t){e=new this(e),t=new this(t);var r,n=this.precision,i=this.rounding,a=n+4;return e.s&&t.s?e.d||t.d?!t.d||e.isZero()?(r=t.s<0?getPi(this,n,i):new this(0)).s=e.s:!e.d||t.isZero()?(r=getPi(this,a,1).times(.5)).s=e.s:t.s<0?(this.precision=a,this.rounding=1,r=this.atan(divide(e,t,a,1)),t=getPi(this,a,1),this.precision=n,this.rounding=i,r=e.s<0?r.minus(t):r.plus(t)):r=this.atan(divide(e,t,a,1)):(r=getPi(this,a,1).times(t.s>0?.25:.75)).s=e.s:r=new this(NaN),r}function cbrt(e){return new this(e).cbrt()}function ceil(e){return finalise(e=new this(e),e.e+1,2)}function clamp(e,t,r){return new this(e).clamp(t,r)}function config(e){if(!e||"object"!==_typeof(e))throw Error(decimalError+"Object expected");var t,r,n,i=!0===e.defaults,a=["precision",1,MAX_DIGITS,"rounding",0,8,"toExpNeg",-EXP_LIMIT,0,"toExpPos",0,EXP_LIMIT,"maxE",0,EXP_LIMIT,"minE",-EXP_LIMIT,0,"modulo",0,9];for(t=0;t<a.length;t+=3)if(r=a[t],i&&(this[r]=DEFAULTS[r]),void 0!==(n=e[r])){if(!(mathfloor(n)===n&&n>=a[t+1]&&n<=a[t+2]))throw Error(invalidArgument+r+": "+n);this[r]=n}if(r="crypto",i&&(this[r]=DEFAULTS[r]),void 0!==(n=e[r])){if(!0!==n&&!1!==n&&0!==n&&1!==n)throw Error(invalidArgument+r+": "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw Error(cryptoUnavailable);this[r]=!0}else this[r]=!1}return this}function cos(e){return new this(e).cos()}function cosh(e){return new this(e).cosh()}function clone(e){var t,r,n;function i(e){var t,r,n,a=this;if(!(a instanceof i))return new i(e);if(a.constructor=i,isDecimalInstance(e))return a.s=e.s,void(external?!e.d||e.e>i.maxE?(a.e=NaN,a.d=null):e.e<i.minE?(a.e=0,a.d=[0]):(a.e=e.e,a.d=e.d.slice()):(a.e=e.e,a.d=e.d?e.d.slice():e.d));if("number"===(n=_typeof(e))){if(0===e)return a.s=1/e<0?-1:1,a.e=0,void(a.d=[0]);if(e<0?(e=-e,a.s=-1):a.s=1,e===~~e&&e<1e7){for(t=0,r=e;r>=10;r/=10)t++;return void(external?t>i.maxE?(a.e=NaN,a.d=null):t<i.minE?(a.e=0,a.d=[0]):(a.e=t,a.d=[e]):(a.e=t,a.d=[e]))}return 0*e!=0?(e||(a.s=NaN),a.e=NaN,void(a.d=null)):parseDecimal(a,e.toString())}if("string"===n)return 45===(r=e.charCodeAt(0))?(e=e.slice(1),a.s=-1):(43===r&&(e=e.slice(1)),a.s=1),isDecimal.test(e)?parseDecimal(a,e):parseOther(a,e);if("bigint"===n)return e<0?(e=-e,a.s=-1):a.s=1,parseDecimal(a,e.toString());throw Error(invalidArgument+e)}if(i.prototype=P,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.EUCLID=9,i.config=i.set=config,i.clone=clone,i.isDecimal=isDecimalInstance,i.abs=abs$1,i.acos=acos,i.acosh=acosh,i.add=add$1,i.asin=asin,i.asinh=asinh,i.atan=atan,i.atanh=atanh,i.atan2=atan2,i.cbrt=cbrt,i.ceil=ceil,i.clamp=clamp,i.cos=cos,i.cosh=cosh,i.div=div$1,i.exp=exp$1,i.floor=floor,i.hypot=hypot,i.ln=ln$1,i.log=log,i.log10=log10,i.log2=log2,i.max=max,i.min=min,i.mod=mod$1,i.mul=mul$1,i.pow=pow$1,i.random=random,i.round=round,i.sign=sign,i.sin=sin,i.sinh=sinh,i.sqrt=sqrt$1,i.sub=sub$1,i.sum=sum,i.tan=tan,i.tanh=tanh,i.trunc=trunc,void 0===e&&(e={}),e&&!0!==e.defaults)for(n=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],t=0;t<n.length;)e.hasOwnProperty(r=n[t++])||(e[r]=this[r]);return i.config(e),i}function div$1(e,t){return new this(e).div(t)}function exp$1(e){return new this(e).exp()}function floor(e){return finalise(e=new this(e),e.e+1,3)}function hypot(){var e,t,r=new this(0);for(external=!1,e=0;e<arguments.length;)if((t=new this(arguments[e++])).d)r.d&&(r=r.plus(t.times(t)));else{if(t.s)return external=!0,new this(1/0);r=t}return external=!0,r.sqrt()}function isDecimalInstance(e){return e instanceof Decimal||e&&e.toStringTag===tag||!1}function ln$1(e){return new this(e).ln()}function log(e,t){return new this(e).log(t)}function log2(e){return new this(e).log(2)}function log10(e){return new this(e).log(10)}function max(){return maxOrMin(this,arguments,-1)}function min(){return maxOrMin(this,arguments,1)}function mod$1(e,t){return new this(e).mod(t)}function mul$1(e,t){return new this(e).mul(t)}function pow$1(e,t){return new this(e).pow(t)}function random(e){var t,r,n,i,a=0,o=new this(1),s=[];if(void 0===e?e=this.precision:checkInt32(e,1,MAX_DIGITS),n=Math.ceil(e/LOG_BASE),this.crypto)if(crypto.getRandomValues)for(t=crypto.getRandomValues(new Uint32Array(n));a<n;)(i=t[a])>=429e7?t[a]=crypto.getRandomValues(new Uint32Array(1))[0]:s[a++]=i%1e7;else{if(!crypto.randomBytes)throw Error(cryptoUnavailable);for(t=crypto.randomBytes(n*=4);a<n;)(i=t[a]+(t[a+1]<<8)+(t[a+2]<<16)+((127&t[a+3])<<24))>=214e7?crypto.randomBytes(4).copy(t,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%=LOG_BASE,n&&e&&(i=mathpow(10,LOG_BASE-e),s[a]=(n/i|0)*i);0===s[a];a--)s.pop();if(a<0)r=0,s=[0];else{for(r=-1;0===s[0];r-=LOG_BASE)s.shift();for(n=1,i=s[0];i>=10;i/=10)n++;n<LOG_BASE&&(r-=LOG_BASE-n)}return o.e=r,o.d=s,o}function round(e){return finalise(e=new this(e),e.e+1,this.rounding)}function sign(e){return(e=new this(e)).d?e.d[0]?e.s:0*e.s:e.s||NaN}function sin(e){return new this(e).sin()}function sinh(e){return new this(e).sinh()}function sqrt$1(e){return new this(e).sqrt()}function sub$1(e,t){return new this(e).sub(t)}function sum(){var e=0,t=arguments,r=new this(t[e]);for(external=!1;r.s&&++e<t.length;)r=r.plus(t[e]);return external=!0,finalise(r,this.precision,this.rounding)}function tan(e){return new this(e).tan()}function tanh(e){return new this(e).tanh()}function trunc(e){return finalise(e=new this(e),e.e+1,1)}P[Symbol.for("nodejs.util.inspect.custom")]=P.toString,P[Symbol.toStringTag]="Decimal";var Decimal=P.constructor=clone(DEFAULTS);LN10=new Decimal(LN10),PI=new Decimal(PI);var fmt_group_parsed_cache=new Map;function parse_all_fmt_groups(){fmt_group_parsed_cache.clear();var e=get_config("_fmt_groups")||{};for(var t in e){var r=e[t];if("string"==typeof r)try{var n=fmt_tokenizer(r,null);fmt_group_parsed_cache.set(t,n)}catch(e){console.warn('Failed to parse format group "'.concat(t,'":'),e)}}}function merge_tokens(e){if(!e||0===e.length)return[];var t={mantissa:["number","var"],round:["round"],thousands:["comma","thousands"],sign:["plus"],percent:["percent"],scientific:["scientific"],fraction:["fraction"],volume:["volume"],integer_padding:["integer_padding"],range_clamp:["range_clamp"],unit:["unit_after","unit_before","unit_middle","unit_hide","unit_default"]},r={};for(var n in t){var i,a=_createForOfIteratorHelper(t[n]);try{for(a.s();!(i=a.n()).done;){r[i.value]=n}}catch(e){a.e(e)}finally{a.f()}}for(var o=new Map,s=[],_=0;_<e.length;_++){var u=e[_],c=u.type;if("symbol"!==c)if(s.length>0&&("number"===c||"var"===c))o.set("mantissa",[].concat(_toConsumableArray(s),[u])),s=[];else{if(s.length>0){var l,p=_createForOfIteratorHelper(s);try{for(p.s();!(l=p.n()).done;){var d=l.value,f="symbol_".concat(o.size);o.set(f,d)}}catch(e){p.e(e)}finally{p.f()}s=[]}var g=r[c];if(g)o.set(g,u);else{var m="".concat(c,"_").concat(o.size);o.set(m,u)}}else s.push(u)}if(s.length>0){var v,h=_createForOfIteratorHelper(s);try{for(h.s();!(v=h.n()).done;){var w=v.value,b="symbol_".concat(o.size);o.set(b,w)}}catch(e){h.e(e)}finally{h.f()}}var y,x=[],S=_createForOfIteratorHelper(o.values());try{for(S.s();!(y=S.n()).done;){var E=y.value;Array.isArray(E)?x.push.apply(x,_toConsumableArray(E)):x.push(E)}}catch(e){S.e(e)}finally{S.f()}return x}function expand_fmt_groups(e,t){if(!e||0===e.length)return e;if(!e.some(function(e){return e.type===state_fmt_group}))return e;for(var r=[],n=e.has_var||!1,i=0;i<e.length;i++){var a=e[i];if(a.type===state_fmt_group){var o=a.group_name;if(o){var s=fmt_group_parsed_cache.get(o);s?(r.push.apply(r,_toConsumableArray(s)),s.has_var&&(n=!0)):"undefined"!=typeof console&&console.warn&&console.warn('Format group "'.concat(o,'" not found, ignoring.'))}}else r.push(a)}var _=merge_tokens(r);return n&&(_.has_var=!0),_}on_config_change("_fmt_groups",function(){parse_all_fmt_groups()}),parse_all_fmt_groups();var DEFAULT_COMPACT_UNITS=["","K","M","B","T"],DEFAULT_THOUSANDS_CONFIG={sep:",",point:".",grouping:[3],min_len:0,point_group:!1,fn:null},THOUSANDS_PRESETS={default:{sep:",",point:".",grouping:[3],min_len:0,point_group:!1,fn:null},us:{sep:",",point:".",grouping:[3]},eu:{sep:".",point:",",grouping:[3]},swiss:{sep:"'",point:".",grouping:[3]},space:{sep:" ",point:".",grouping:[3]},indian:{sep:",",point:".",grouping:[3,2]},cn4:{sep:",",point:".",grouping:[4]}};function get_thousands_preset(e){if(!e)return null;var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{})._thousands||{};if(t[e])return _objectSpread2(_objectSpread2({},DEFAULT_THOUSANDS_CONFIG),t[e]);var r=get_config("_thousands")||{};return r[e]?_objectSpread2(_objectSpread2({},DEFAULT_THOUSANDS_CONFIG),r[e]):THOUSANDS_PRESETS[e]?_objectSpread2(_objectSpread2({},DEFAULT_THOUSANDS_CONFIG),THOUSANDS_PRESETS[e]):null}function extract_unit_thousands(e){if(!e)return{};var t={};for(var r in e){var n=e[r];if("object"===_typeof(n))for(var i in n._thousands&&!t[r]&&(t[r]=n._thousands),n)if(!i.startsWith("_")){var a=n[i];"object"===_typeof(a)&&a._thousands&&!t[i]&&(t[i]=a._thousands)}}return t}function get_unit_thousands_map(e){var t=extract_unit_thousands(get_unit_mapping(e));return e._unit_thousands_map?_objectSpread2(_objectSpread2({},t),e._unit_thousands_map):t}function extract_unit_compacts(e){if(!e)return{};var t={};for(var r in e){var n=e[r];if("object"===_typeof(n))for(var i in n._compact&&!t[r]&&(t[r]=n._compact),n)if(!i.startsWith("_")){var a=n[i];"object"===_typeof(a)&&a._compact&&!t[r]&&(t[r]=a._compact)}}return t}function get_unit_compact_map(){var e=extract_unit_compacts(get_config("_unit_convert_out")),t=get_config("_unit_compact_map");return t?_objectSpread2(_objectSpread2({},e),t):e}function format_thousands(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=_objectSpread2(_objectSpread2({},DEFAULT_THOUSANDS_CONFIG),t);if(r.fn&&"function"==typeof r.fn){var n=e.startsWith("-"),i=e.startsWith("+"),a="",o=e;(n||i)&&(a=e[0],o=e.slice(1));var s=o.split("."),_={int_part:s[0],dec_part:s[1]||null,sign:a,options:r._options||{}};return r.fn(e,_)}var u=e.replace(/^[+-]/,"").split(".")[0].length;if(r.min_len>0&&u<r.min_len)return"."!==r.point?e.replace(".",r.point):e;var c=e.startsWith("-"),l=e.startsWith("+"),p="",d=e;(c||l)&&(p=e[0],d=e.slice(1));var f=d.split("."),g=f[0],m=f[1];g=apply_grouping(g,r.grouping,r.sep),m&&r.point_group&&(m=apply_grouping_decimal(m,r.grouping,r.sep));var v=p+g;return void 0!==m?v+=r.point+m:r.point,v}function apply_grouping(e,t,r){if(!e||0===e.length)return e;for(var n=[],i=e,a=0;i.length>0;){var o=t[Math.min(a,t.length-1)];if(i.length<=o){n.unshift(i);break}n.unshift(i.slice(-o)),i=i.slice(0,-o),a++}return n.join(r)}function apply_grouping_decimal(e,t,r){if(!e||0===e.length)return e;for(var n=[],i=e,a=0;i.length>0;){var o=t[Math.min(a,t.length-1)];if(i.length<=o){n.push(i);break}n.push(i.slice(0,o)),i=i.slice(o),a++}return n.join(r)}var BUILTIN_PRESETS={default:{units:["","K","M","B","T"],step:1e3},cn:{units:["","千","百万","十亿","万亿"],step:1e3},wan:{units:["","万","亿","万亿"],step:1e4},storage:{units:["B","KB","MB","GB","TB"],step:1024},indian:{units:["","K","L","Cr"],step:[1e3,100,100]}};function get_unit_mapping(e){return e._unit_convert_out&&Object.keys(e._unit_convert_out).length>0?e._unit_convert_out:null}function extract_unit_positions(e){if(!e)return{};var t={};for(var r in e){var n=e[r];if("object"===_typeof(n))for(var i in n._position&&!t[r]&&(t[r]=n._position),n)if("_position"!==i){var a=n[i];"object"===_typeof(a)&&a._position&&!t[i]&&(t[i]=a._position)}}return t}function get_unit_position_map(e){var t=extract_unit_positions(get_unit_mapping(e));return e._unit_position_map?_objectSpread2(_objectSpread2({},t),e._unit_position_map):t}function find_conversion_rule(e,t,r,n){if(!r||!e)return null;var i=r[e];if(!i)return null;if(t){var a=i[t];return void 0!==a?{rule:a,input_unit:t}:null}if(n){var o,s=_createForOfIteratorHelper(Array.isArray(n)?n:[n]);try{for(s.s();!(o=s.n()).done;){var _=o.value;if(void 0!==i[_])return{rule:i[_],input_unit:_}}}catch(e){s.e(e)}finally{s.f()}}var u=Object.keys(i).filter(function(e){return!e.startsWith("_")});return 1===u.length?{rule:i[u[0]],input_unit:u[0]}:null}function apply_conversion_rule(e,t,r,n){if(null==t)return e;var i=new Decimal(e);return"number"==typeof t?i.times(t).toFixed():"function"==typeof t?String(t(Number(e),r,n)):"object"===_typeof(t)?t.fn&&"function"==typeof t.fn?String(t.fn(Number(e),r,n)):(void 0!==t.mul?i=i.times(t.mul):void 0!==t.div?i=i.div(t.div):void 0!==t.add?i=i.plus(t.add):void 0!==t.sub&&(i=i.minus(t.sub)),i.toFixed()):e}function get_unit_info_from_tokens(e){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(!e)return null;var n,i=_createForOfIteratorHelper(e);try{for(i.s();!(n=i.n()).done;){var a=n.value;if("unit_after"===a.type||"unit_before"===a.type||"unit_middle"===a.type){var o=a.unit;if(a.use_default&&!o&&!(o=r)){var s=get_config("_unit_default_out");o=Array.isArray(s)?s[0]:s}return{output_unit:o,input_unit:a.input_unit,position:"unit_after"===a.type?"after":"unit_before"===a.type?"before":"middle",show_unit:!0,keep_recognized:a.use_default}}if("unit_hide"===a.type)return{output_unit:a.unit,input_unit:a.input_unit,position:null,show_unit:!1};if("unit_default"===a.type){var _=t[a.unit]||get_config("_unit_default_position")||"after";return{output_unit:a.unit,input_unit:a.input_unit,position:_,show_unit:!0}}if("to-number-string"===a.type)return a.output_unit?{output_unit:a.output_unit,input_unit:a.input_unit,position:null,show_unit:!1}:{output_unit:null,input_unit:null,position:null,show_unit:!1,no_conversion:!0}}}catch(e){i.e(e)}finally{i.f()}return null}function apply_unit(e,t,r,n){if(!t)return e;var i=e.startsWith("-"),a=e.startsWith("+"),o="",s=e;switch((i||a)&&(o=e[0],s=e.slice(1)),r){case"after":default:return o+s+t;case"before":return t+o+s;case"middle":return o?o+t+s:t+s}}function format_compact(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=r._compact_preset,i=r._current_unit,a=DEFAULT_COMPACT_UNITS,o=1e3,s=null;if(r._compact_units||r._compact_step)a=r._compact_units&&r._compact_units.length>0?r._compact_units:DEFAULT_COMPACT_UNITS,o=r._compact_step||1e3;else if(n){var _=(get_config("_compact")||{})[n]||BUILTIN_PRESETS[n];_&&("function"==typeof _?s=_:Array.isArray(_)?(a=_,o=1e3):(a=_.units||a,o=void 0!==_.step?_.step:o))}else if(i){var u=get_unit_compact_map(),c=!1;if(u&&u[i]){var l=u[i],p=(get_config("_compact")||{})[l]||BUILTIN_PRESETS[l];p&&(c=!0,"function"==typeof p?s=p:Array.isArray(p)?(a=p,o=1e3):(a=p.units||a,o=void 0!==p.step?p.step:o))}if(!c){var d=get_config("_compact_default");if(d){var f=(get_config("_compact")||{})[d]||BUILTIN_PRESETS[d];f&&("function"==typeof f?s=f:Array.isArray(f)?(a=f,o=1e3):(a=f.units||a,o=void 0!==f.step?f.step:o))}}}else{var g=get_config("_compact_default");if(g){var m=(get_config("_compact")||{})[g]||BUILTIN_PRESETS[g];m&&("function"==typeof m?s=m:Array.isArray(m)?(a=m,o=1e3):(a=m.units||a,o=void 0!==m.step?m.step:o))}}if(s){var v=s(e,{decimals:t,options:r,current_unit:i});return"object"===_typeof(v)&&null!==v?{sign:v.sign||"",number:v.number||"0",unit:v.unit||"",formatted:v.formatted||(v.sign||"")+(v.number||"0")+(v.unit||"")}:"string"==typeof v?{sign:"",number:v,unit:"",formatted:v}:{sign:"",number:e,unit:"",formatted:e}}var h=e.startsWith("-"),w=e.startsWith("+"),b="",y=e;(h||w)&&(b=e[0],y=e.slice(1));for(var x=new Decimal(y),S=0,E=Array.isArray(o);S<a.length-1;){var A=E?o[S]||o[o.length-1]:o;if(!x.gte(A))break;x=x.div(A),S++}var T=x.toFixed(t,Decimal.ROUND_DOWN);return T.includes(".")&&(T=T.replace(/\.?0+$/,"")),{sign:b,number:T,unit:a[S],formatted:b+T+a[S]}}function pad_integer(e,t){if(t<=0)return e;var r=e.startsWith("-"),n=e.startsWith("+"),i="",a=e;(r||n)&&(i=e[0],a=e.slice(1));var o=a.split("."),s=o[0],_=o[1];s.length<t&&(s="0".repeat(t-s.length)+s);var u=i+s;return void 0!==_&&(u+="."+_),u}function format(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t=expand_fmt_groups(t,r._fill_data||r);var n="";if("undefined"===(n=Decimal.isDecimal(e)?e.toFixed():"string"==typeof e?e:e.toString())||"NaN"===n)return[void 0,{}];var i=get_unit_mapping(r),a=get_unit_position_map(r),o=r._recognized_unit||null,s=get_unit_info_from_tokens(t,r,a,o),_=null,u=null,c=!1,l=!1;if(s){var p=s.output_unit,d=s.input_unit,f=s.position,g=s.show_unit,m=s.no_conversion,v=s.keep_recognized;if(!m&&i){var h=v&&o?o:p||o||get_config("_unit_default_out");if(h){var w=find_conversion_rule(h,d||o||null,i,get_config("_unit_default_in"));w&&(n=apply_conversion_rule(n,w.rule,w.input_unit,h),_=h,l=!0)}}g?(v&&o?_=o:_||(_=p||o),u=f,c=!0,l=!0):m&&(l=!0)}else o&&(_=o,u=a[o]||get_config("_unit_default_position")||"after",c=!0,l=!0);var b={mantissa:null,mantissa_type:null,mantissa_min:null,mantissa_max:null,thousands:!1,thousands_preset:null,sign:!1,round:"~-",scientific:!1,fraction:!1,percent:!1,to_number:!1,to_number_string:!1,integer_padding:null,compact:!1,compact_preset:null,unit_format:null,unit_value:null,unit_input:null,range_clamp_min:null,range_clamp_max:null},y=[],x=[];t.forEach(function(e,t){"symbol"===e.type?y.push({value:e.value,index:t}):"number"!==e.type&&"var"!==e.type||x.push({value:"var"===e.type?e.real_value:e.value,index:t})});var S=y.find(function(e){return">="===e.value||">"===e.value}),E=y.find(function(e){return"<="===e.value||"<"===e.value});if(S&&E)for(var A=function(){var e=y[T],t=x.find(function(t){return t.index>e.index});t&&(">="===e.value||">"===e.value?b.mantissa_min=+t.value:"<="!==e.value&&"<"!==e.value||(b.mantissa_max=+t.value))},T=0;T<y.length;T++)A();if(t.forEach(function(e){var t=e.type;if("symbol"===t){if(![">=","<=","=","<",">"].includes(e.value))throw new Error("错误的格式化参数:",e.value);S&&E||(b.mantissa_type=e.value)}else if("to-number"===t)b.to_number=!0;else if("to-number-string"===t)b.to_number_string=!0;else if("comma"===t)b.thousands=!0;else if("number"===t)S&&E||(b.mantissa=e.value);else if("var"===t)S&&E||(b.mantissa=e.real_value);else if("plus"===t)b.sign=!0;else if("round"===t)b.round=e.value;else if("fraction"===t)b.fraction=!0;else if("scientific"===t)b.scientific=!0;else if("percent"===t)b.percent=!0;else if("integer_padding"===t)b.integer_padding=void 0!==e.real_value?+e.real_value:+e.value;else if("compact"===t)b.compact=!0,e.preset&&(b.compact_preset=e.preset);else if("unit_after"===t)b.unit_format="after",b.unit_value=e.unit,b.unit_input=e.input_unit;else if("unit_before"===t)b.unit_format="before",b.unit_value=e.unit,b.unit_input=e.input_unit;else if("unit_middle"===t)b.unit_format="middle",b.unit_value=e.unit,b.unit_input=e.input_unit;else if("unit_hide"===t)b.unit_format=null,b.unit_value=e.unit,b.unit_input=e.input_unit;else if("unit_default"===t){var r=get_config("_unit_default_position")||"after";b.unit_format=r,b.unit_value=e.unit,b.unit_input=e.input_unit}else if("thousands"===t)b.thousands=!0,b.thousands_preset=e.preset;else{if("range_clamp"!==t)throw new Error("错误的fmt Token");b.range_clamp_min=e.min,b.range_clamp_max=e.max}}),null!==b.range_clamp_min||null!==b.range_clamp_max){var D=new Decimal(n);if(null!==b.range_clamp_min){var N=new Decimal(b.range_clamp_min);D.lt(N)&&(D=N)}if(null!==b.range_clamp_max){var k=new Decimal(b.range_clamp_max);D.gt(k)&&(D=k)}n=D.toFixed()}if(b.to_number){var O=parse_mantissa(n,b.mantissa_type,b.mantissa,b.round);return b.integer_padding&&(O=pad_integer(O,b.integer_padding)),[+O,b]}if(b.scientific){var P=new Decimal(n).toExponential();return[b.sign&&!P.startsWith("-")?"+"+P:P,b]}if(b.fraction){var M=new Decimal(n).toFraction(),I=M[0].toString()+"/"+M[1].toString();return[b.sign&&!I.startsWith("-")?"+"+I:I,b]}if(b.compact){var L=format_compact(n,null!==b.mantissa?+b.mantissa:2,_objectSpread2(_objectSpread2({},r),{},{_compact_preset:b.compact_preset,_current_unit:_})),W=L.sign,C=L.unit;n=L.number,b._compact_formatted=!0,b._compact_sign=W,b._compact_unit_suffix=C}if(b.percent&&(n=new Decimal(n).times(100).toFixed()),null!==b.mantissa_min&&null!==b.mantissa_max){var j=n.includes(".")?n.split(".")[1].length:0;j<b.mantissa_min?n=parse_mantissa(n,">=",b.mantissa_min,b.round):j>b.mantissa_max?n=parse_mantissa(n,"<=",b.mantissa_max,b.round):n.includes(".")&&(n=n.replace(/0*$/,"").replace(/\.$/,""))}else null===b.mantissa?n.includes(".")&&(n=n.replace(/0*$/,"")):n=parse_mantissa(n,b.mantissa_type,b.mantissa,b.round);if(b.integer_padding&&(n=pad_integer(n,b.integer_padding)),b.thousands){var F=null;if(b.thousands_preset)F=get_thousands_preset(b.thousands_preset,r);else if(_){var q=get_unit_thousands_map(r)[_];q&&(F=get_thousands_preset(q,r))}if(!F){var R=get_config("_thousands_default");R&&(F=get_thousands_preset(R,r))}F?(F._options=r,n=format_thousands(n,F)):n=parse_thousands(n)}return b._compact_formatted&&(b.sign&&!b._compact_sign&&(n="+"+n),n=b._compact_sign+n+b._compact_unit_suffix),b.sign&&!b._compact_formatted&&(b.to_number=!1,n.startsWith("-")||(n="+"+n)),b.percent&&(n+="%"),c&&_&&u&&(n=apply_unit(n,_,u,b.sign)),b.unit_handled=l,[n,b]}var _calc$1=null;function register_calc(e){_calc$1=e}function get_calc$1(){if(!_calc$1)throw new Error("calc function not registered");return _calc$1}function calc_wrap(e,t){var r=get_calc$1(),n={_error:"-"};return["string","number"].includes(_typeof(e))?void 0===t?/[a-zA-Z$_]/.test(e.toString())?function(t){return Array.isArray(t)?t.unshift(n):t=_objectSpread2(_objectSpread2({},n),t),r(e,t)}:r(e):(Array.isArray(t)?t.unshift(n):t=_objectSpread2(_objectSpread2({},n),t),r(e,t)):(Array.isArray(e)?e.unshift(n):e=_objectSpread2(_objectSpread2({},n),e),function(t){return r(t,e)})}function check_version(){return _check_version.apply(this,arguments)}function _check_version(){return _check_version=_asyncToGenerator(_regenerator().m(function _callee(){var res,code,versions,last_version,larr,varr,script,url;return _regenerator().w(function(_context){for(;;)switch(_context.n){case 0:if("undefined"==typeof process||"node"!==process.release.name){_context.n=4;break}if(!(parseInt(process.versions.node)>=17)){_context.n=3;break}return _context.n=1,promise_queue([fetch("https://cdn.jsdelivr.net/npm/a-calc@latest/a-calc.versions.js"),fetch("https://unpkg.com/a-calc@latest/a-calc.versions.js")]);case 1:return res=_context.v,_context.n=2,res.text();case 2:code=_context.v,versions=eval(code),last_version=versions.at(-1),larr=last_version.match(/(\d+)\.(\d+)\.(\d+)/),larr.shift(),larr=larr.map(function(e){return parseInt(e)}),varr=version.match(/(\d+)\.(\d+)\.(\d+)/),varr.shift(),varr=varr.map(function(e){return parseInt(e)}),(larr[0]>varr[0]||larr[0]===varr[0]&&larr[1]>varr[1]||larr[0]===varr[0]&&larr[1]===varr[1]&&larr[2]>varr[2])&&console.warn("a-calc has a new version:",last_version);case 3:_context.n=6;break;case 4:return script=document.createElement("script"),script.onload=function(){var e=a_calc_versions;if(Array.isArray(e)){var t=e.at(-1),r=t.match(/(\d+)\.(\d+)\.(\d+)/);r.shift(),r=r.map(function(e){return parseInt(e)});var n=version.match(/(\d+)\.(\d+)\.(\d+)/);n.shift(),n=n.map(function(e){return parseInt(e)}),(r[0]>n[0]||r[0]===n[0]&&r[1]>n[1]||r[0]===n[0]&&r[1]===n[1]&&r[2]>n[2])&&console.log("%c↑↑↑ a-calc has a new version: %s ↑↑↑","color: #67C23A;",t)}},_context.n=5,test_urls(["https://cdn.jsdelivr.net/npm/a-calc@latest/a-calc.versions.js","https://unpkg.com/a-calc@latest/a-calc.versions.js"]);case 5:url=_context.v,url?(script.src=url,document.body.appendChild(script)):script=null;case 6:return _context.a(2)}},_callee)})),_check_version.apply(this,arguments)}var operator=new Set(["+","-","*","/","%","**","//"]);function detect_fallback_var(e,t){if("("!==e[t])return null;for(var r=0,n=!1,i=[],a="",o=t;o<e.length;){var s=e[o];if("("===s){if(0===r){r++,o++;continue}r++,a+=s}else if(")"===s){if(0===--r)return n?(i.push(a.trim()),{paths:i,end_index:o}):null;a+=s}else"|"===s&&1===r?(n=!0,i.push(a.trim()),a=""):a+=s;o++}return null}function push_token(e,t,r){if(Number.isNaN(Number(t)))if("-"===t||"+"===t)e.push({type:"operator",value:t});else if(operator.has(t))e.push({type:"operator",value:t});else if(r._unit&&/^[+-]?\d/.test(t)){var n,i=split_unit_num(t),a=i.num,o=i.unit;if(void 0===o)e.push({type:"number",value:a,real_value:a,has_unit:!1});else r.has_unit=!0,null!==(n=r.unit_str)&&void 0!==n||(r.unit_str=o),e.push({type:"number",value:a,real_value:a,has_unit:!0,unit:o})}else if(var_first_char_set.has(t[0])){r.has_var=!0;var s=get_real_value(r.fill_data,t);if(r._unit){var _,u=split_unit_num(s),c=u.num,l=u.unit;if(void 0===l)e.push({type:"var",value:t,real_value:c,has_unit:!1});else r.has_unit=!0,null!==(_=r.unit_str)&&void 0!==_||(r.unit_str=l),e.push({type:"var",value:t,real_value:c,has_unit:!0,unit:l})}else e.push({type:"var",value:t,real_value:s,has_unit:!1})}else{if(!/^[+-]?\d/.test(t))throw new Error("无法识别的标识符:".concat(t));var p=t.indexOf("e");-1!==p&&/^\d+$/.test(t.slice(p+1))&&e.push({type:"number",value:t,real_value:t,has_unit:!1})}else e.push({type:"number",value:t,real_value:t,has_unit:!1})}function tokenizer_space(e,t,r,n){for(var i,a=0,o=0,s=e.length,_=[],u={has_var:!1,has_unit:!1,unit_str:void 0,_unit:r,fill_data:t};o<s;){if(" "===(i=e[o]))o>a&&push_token(_,e.slice(a,o),u),a=o+1;else if("("===i){var c=detect_fallback_var(e,o);if(c){o>a&&push_token(_,e.slice(a,o),u),u.has_var=!0;var l=get_fallback_value(t,c.paths,n),p=l.value,d=l.path;if(r){var f,g=split_unit_num(p),m=g.num,v=g.unit;if(void 0!==v)u.has_unit=!0,null!==(f=u.unit_str)&&void 0!==f||(u.unit_str=v),_.push({type:state_fallback_var,value:c.paths,real_value:m,matched_path:d,has_unit:!0,unit:v});else _.push({type:state_fallback_var,value:c.paths,real_value:m,matched_path:d,has_unit:!1})}else _.push({type:state_fallback_var,value:c.paths,real_value:p,matched_path:d,has_unit:!1});a=o=c.end_index+1;continue}_.push({type:state_bracket,value:"("}),a=o+1}else")"===i&&(o>a&&push_token(_,e.slice(a,o),u),_.push({type:state_bracket,value:")"}),a=o+1);o++}return o>a&&push_token(_,e.slice(a,o),u),_.has_var=u.has_var,_.has_unit=u.has_unit,_.unit=u.unit_str,_}function to_decimal(e){return e instanceof Decimal?e:new Decimal("boolean"==typeof e?e?1:0:e)}function is_decimal(e){return e instanceof Decimal}function compute(e,t,r){if(void 0===e||void 0===t)throw new Error("无效的操作数对:v1:".concat(e,", v2:").concat(t));var n=to_decimal(e),i=to_decimal(t);switch(r){case"+":return n.plus(i);case"-":return n.minus(i);case"*":return n.times(i);case"/":return n.div(i);case"%":return n.mod(i);case"**":return n.pow(i);case"//":return n.divToInt(i);default:throw new Error("未知的运算符: ".concat(r))}}function compare(e,t,r){if(void 0===e||void 0===t)throw new Error("无效的操作数对:v1:".concat(e,", v2:").concat(t));var n=to_decimal(e),i=to_decimal(t);switch(r){case">":return n.gt(i);case"<":return n.lt(i);case">=":return n.gte(i);case"<=":return n.lte(i);case"==":return n.eq(i);case"!=":return!n.eq(i);default:throw new Error("未知的比较运算符: ".concat(r))}}function logical(e,t,r){var n=function(e){return"boolean"==typeof e?e:e instanceof Decimal?!e.isZero():"number"==typeof e?0!==e:"string"==typeof e?""!==e&&"0"!==e:Boolean(e)},i=n(e);switch(r){case"&&":return!!i&&n(t);case"||":return!!i||n(t);default:throw new Error("未知的逻辑运算符: ".concat(r))}}function logical_not(e){var t;return!("boolean"==typeof(t=e)?t:t instanceof Decimal?!t.isZero():"number"==typeof t?0!==t:"string"==typeof t?""!==t&&"0"!==t:Boolean(t))}function _to_rad(e){return"rad"===get_config("_angle_unit")?e:new Decimal(e).times(Decimal.acos(-1)).div(180)}function _to_deg(e){return"rad"===get_config("_angle_unit")?e:new Decimal(e).times(180).div(Decimal.acos(-1))}var _SIN_TABLE={0:new Decimal(0),30:new Decimal("0.5"),45:new Decimal(2).sqrt().div(2),60:new Decimal(3).sqrt().div(2),90:new Decimal(1),180:new Decimal(0),270:new Decimal(-1),360:new Decimal(0)},_COS_TABLE={0:new Decimal(1),30:new Decimal(3).sqrt().div(2),45:new Decimal(2).sqrt().div(2),60:new Decimal("0.5"),90:new Decimal(0),180:new Decimal(-1),270:new Decimal(0),360:new Decimal(1)},_TAN_TABLE={0:new Decimal(0),30:new Decimal(3).sqrt().div(3),45:new Decimal(1),60:new Decimal(3).sqrt(),180:new Decimal(0),360:new Decimal(0)};function _normalize_angle(e){var t=new Decimal(e).mod(360);return t.isNegative()?t.plus(360):t}var _builtin_functions={sin:function(e){if("deg"===get_config("_angle_unit")){var t=_normalize_angle(e).toNumber();if(void 0!==_SIN_TABLE[t])return _SIN_TABLE[t];if(t>180){var r=_SIN_TABLE[360-t];if(void 0!==r)return r.negated()}if(t>90&&t<=180){var n=_SIN_TABLE[180-t];if(void 0!==n)return n}}var i=_to_rad(e);return Decimal.sin(i)},cos:function(e){if("deg"===get_config("_angle_unit")){var t=_normalize_angle(e).toNumber();if(void 0!==_COS_TABLE[t])return _COS_TABLE[t];if(t>180){var r=_COS_TABLE[360-t];if(void 0!==r)return r}if(t>90&&t<=180){var n=_COS_TABLE[180-t];if(void 0!==n)return n.negated()}}var i=_to_rad(e);return Decimal.cos(i)},tan:function(e){if("deg"===get_config("_angle_unit")){var t=_normalize_angle(e).toNumber();if(90===t||270===t)throw new Error("tan() undefined at 90° and 270°");if(void 0!==_TAN_TABLE[t])return _TAN_TABLE[t]}var r=_to_rad(e);return Decimal.tan(r)},asin:function(e){return _to_deg(Decimal.asin(e))},acos:function(e){return _to_deg(Decimal.acos(e))},atan:function(e){return _to_deg(Decimal.atan(e))},atan2:function(e,t){return _to_deg(Decimal.atan2(e,t))},sinh:function(e){return Decimal.sinh(e)},cosh:function(e){return Decimal.cosh(e)},tanh:function(e){return Decimal.tanh(e)},asinh:function(e){return Decimal.asinh(e)},acosh:function(e){return Decimal.acosh(e)},atanh:function(e){return Decimal.atanh(e)},exp:function(e){return Decimal.exp(e)},log:function(e){return Decimal.ln(e)},ln:function(e){return Decimal.ln(e)},log10:function(e){return Decimal.log10(e)},log2:function(e){return Decimal.log2(e)},sqrt:function(e){return new Decimal(e).sqrt()},cbrt:function(e){return new Decimal(e).cbrt()},pow:function(e,t){return new Decimal(e).pow(t)},floor:function(e){return new Decimal(e).floor()},ceil:function(e){return new Decimal(e).ceil()},round:function(e){return new Decimal(e).round()},trunc:function(e){return new Decimal(e).trunc()},abs:function(e){return new Decimal(e).abs()},sign:function(e){return new Decimal(e).isPositive()?new Decimal(1):new Decimal(e).isNegative()?new Decimal(-1):new Decimal(0)},max:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(0===t.length)throw new Error("max() requires at least one argument");return t.reduce(function(e,t){var r=new Decimal(t);return r.gt(e)?r:e},new Decimal(t[0]))},min:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(0===t.length)throw new Error("min() requires at least one argument");return t.reduce(function(e,t){var r=new Decimal(t);return r.lt(e)?r:e},new Decimal(t[0]))},clamp:function(e,t,r){var n=new Decimal(e),i=new Decimal(t),a=new Decimal(r);return n.lt(i)?i:n.gt(a)?a:n},random:function(){return new Decimal(Math.random())},pi:function(){return Decimal.acos(-1)},e:function(){return Decimal.exp(1)},if:function(e,t,r){var n;return("boolean"==typeof(n=e)?n:n instanceof Decimal?!n.isZero():"number"==typeof n?0!==n:Boolean(n))?t:r}};function get_function(e,t){if(t){var r,n=_createForOfIteratorHelper(Array.isArray(t)?t:[t]);try{for(n.s();!(r=n.n()).done;){var i=r.value;if(i&&"function"==typeof i[e])return i[e]}}catch(e){n.e(e)}finally{n.f()}}var a=get_config("_builtin_functions");return a&&a[e]?a[e]:null}function is_comparison_op(e){return comparison_operators.has(e)}function is_logical_op(e){return logical_operators.has(e)}function is_arithmetic_op(e){return["+","-","*","/","%","**","//"].includes(e)}function get_precedence(e){var t;return null!==(t=operator_precedence[e])&&void 0!==t?t:-1}function execute_op(e,t,r){if(is_comparison_op(r))return compare(e,t,r);if(is_logical_op(r))return logical(e,t,r);if(is_arithmetic_op(r))return compute(e,t,r);throw new Error("未知的运算符: ".concat(r))}function eval_tokens(e){if(1===e.length){var t=e[0];if("number"===t.type||"var"===t.type||"fallback_var"===t.type)return new Decimal(t.real_value);if("boolean"===t.type)return t.value;if("string"===t.type)return t.value;if("function"===t.type){var r=t.value,n=t.fn||get_function(r,e._fill_data);if(!n)throw new Error("未知的函数: ".concat(r));var i=t.args.map(function(t){var r=tokenizer(t,e._fill_data,e._unit,e._options);return r._fill_data=e._fill_data,r._unit=e._unit,r._options=e._options,eval_tokens(r)});return n.apply(void 0,_toConsumableArray(i))}throw new Error("错误的表达式:".concat(t.value))}for(var a,o=[],s=[],_={active:!1,lastValue:null},u=0,c=e.length;u<c;u++)if("number"!==(a=e[u]).type&&"var"!==a.type&&"fallback_var"!==a.type)if("boolean"!==a.type)if("string"!==a.type)if("function"!==a.type)if("logical_not"!==a.type)if("ternary_question"!==a.type&&"?"!==a.value)if("ternary_colon"!==a.type&&":"!==a.value)if("operator"!==a.type&&"comparison"!==a.type&&"logical"!==a.type)if("("!==a.value)if(")"!==a.value)"function_result"!==a.type||s.push(a.value);else for(;o.length>0;){var l=o.pop();if("("===l){if(o.length>0&&("-"===o[o.length-1]||"+"===o[o.length-1])){var p=o[o.length-1],d=o.length>1?o[o.length-2]:null;if(null===d&&1===s.length||"("===d&&1===s.length||["+","-","*","/","%","**","//","?",":"].includes(d))if("-"===p){o.pop();var f=s.pop();is_decimal(f)?s.push(f.negated()):"number"==typeof f?s.push(-f):"boolean"==typeof f?s.push(!f):s.push(new Decimal(f).negated())}else"+"===p&&o.pop()}else{var g=s[s.length-2];if("-"===g){var m=s.pop();s.pop(),is_decimal(m)?s.push(m.negated()):"number"==typeof m?s.push(-m):"boolean"==typeof m?s.push(!m):s.push(new Decimal(m).negated())}else if("+"===g){var v=s.pop();s.pop(),s.push(v)}}break}if("!"===l){var h=s.pop();s.push(logical_not(h))}else if(":"===l&&o.length>0&&"?"===o[o.length-1]){var w=s.pop();o.pop();var b=s.pop(),y=s.pop(),x=void 0;x="boolean"==typeof y?y:is_decimal(y)?!y.isZero():Boolean(y),s.push(x?b:w)}else{if("?"===l){o.push("?");break}var S=s.pop(),E=s.pop();s.push(execute_op(E,S,l))}}else o.push("(");else{var A=a.value,T=get_precedence(A);if(is_comparison_op(A)&&_.active)for(;o.length>0;){var D=o[o.length-1];if("("===D||"?"===D)break;if(get_precedence(D)<T)break;if(is_comparison_op(D)){o.pop();var N=s.pop(),k=compare(s.pop(),N,D);_.lastValue=N,k?s.push(N):(s.push(!1),_.active=!1);break}o.pop();var O=s.pop(),P=s.pop();s.push(execute_op(P,O,D))}is_comparison_op(A)?_.active=!0:_.active=!1;var M=o[o.length-1];if("("===M){o.push(A);continue}if(!o.length){o.push(A);continue}if("**"===A){o.push(A);continue}for(;o.length>0&&"("!==(M=o[o.length-1])&&"?"!==M;){var I=get_precedence(M);if(I<T)break;if(I===T&&"**"===A)break;if("!"!==M&&s.length<2)break;if(o.pop(),"!"===M){var L=s.pop();s.push(logical_not(L))}else{var W=s.pop(),C=s.pop();void 0!==C||"-"!==M&&"+"!==M?s.push(execute_op(C,W,M)):"-"===M?is_decimal(W)?s.push(W.negated()):"number"==typeof W?s.push(-W):s.push(new Decimal(W).negated()):s.push(W)}}o.push(A)}else{for(;o.length>0;){var j=o[o.length-1];if("?"===j)break;if("("===j)break;o.pop();var F=s.pop(),q=s.pop();s.push(execute_op(q,F,j))}o.push(":")}else{for(;o.length>0;){var R=o[o.length-1];if("("===R||"?"===R)break;if(get_precedence(R)<=get_precedence("?"))break;o.pop();var V=s.pop(),B=s.pop();s.push(execute_op(B,V,R))}o.push("?")}else o.push("!");else{var $=a.value,G=a.fn||get_function($,e._fill_data);if(!G)throw new Error("未知的函数: ".concat($));var U=a.args.map(function(t){var r=tokenizer(t,e._fill_data,e._unit,e._options);return r._fill_data=e._fill_data,r._unit=e._unit,r._options=e._options,eval_tokens(r)}),z=G.apply(void 0,_toConsumableArray(U));s.push(z)}else s.push(a.value);else s.push(a.value);else s.push(a.real_value);for(;o.length>0;){var H=o.pop();if("!"===H){var Z=s.pop();s.push(logical_not(Z))}else if(":"===H&&o.length>0&&"?"===o[o.length-1]){var X=s.pop();o.pop();var K=s.pop(),J=s.pop(),Y=void 0;Y="boolean"==typeof J?J:is_decimal(J)?!J.isZero():Boolean(J),s.push(Y?K:X)}else{if("?"===H)continue;var Q=s.pop(),ee=s.pop();void 0!==ee||"-"!==H&&"+"!==H?s.push(execute_op(ee,Q,H)):"-"===H?is_decimal(Q)?s.push(Q.negated()):"number"==typeof Q?s.push(-Q):s.push(new Decimal(Q).negated()):s.push(Q)}}if(1!==s.length)throw new Error("可能出现了错误的计算式");return e.has_var||(e.calc_result=s[0]),s[0]}set_config({_builtin_functions:_builtin_functions});var _calc=null;function register_calc_for_sum(e){_calc=e}function get_calc(){if(!_calc)throw new Error("calc function not registered for calc_sum");return _calc}function internal_format$1(e,t){if(!t)return e;var r=fmt_tokenizer(t,null);return _slicedToArray(format(new Decimal(e),r,{}),1)[0]}function calc_sum(e,t){var r=get_calc(),n={_error:"-"},i=e.split("|"),a=i[0];if(0===t.length)return r(e,n);for(var o=new Decimal(0),s=0;s<t.length;s++){var _=r(a,_objectSpread2(_objectSpread2({},n),t[s]));if(_===n._error)return n._error;o=o.plus(_)}var u=2===i.length?i[1].trim():void 0;return internal_format$1(o.toFixed(),u)}function _d_add(e,t){return new Decimal(e).plus(t).toFixed()}function _d_sub(e,t){return new Decimal(e).minus(t).toFixed()}function _d_mul(e,t){return new Decimal(e).times(t).toFixed()}function _d_div(e,t){var r=new Decimal(t);if(r.isZero()){var n=get_config("_error");if(void 0!==n)return n;throw new Error("Division by zero")}return new Decimal(e).div(r).toFixed()}function _d_mod(e,t){var r=new Decimal(t);if(r.isZero()){var n=get_config("_error");if(void 0!==n)return n;throw new Error("Modulo by zero")}return new Decimal(e).mod(r).toFixed()}function _d_pow(e,t){return new Decimal(e).pow(t).toFixed()}function _d_idiv(e,t){var r=new Decimal(t);if(r.isZero()){var n=get_config("_error");if(void 0!==n)return n;throw new Error("Division by zero")}return new Decimal(e).divToInt(r).toFixed()}function _d_abs(e){return new Decimal(e).abs().toFixed()}function _d_neg(e){return new Decimal(e).neg().toFixed()}function _d_sqrt(e){return new Decimal(e).sqrt().toFixed()}function _d_cbrt(e){return new Decimal(e).cbrt().toFixed()}function _d_exp(e){return new Decimal(e).exp().toFixed()}function _d_ln(e){return new Decimal(e).ln().toFixed()}function _d_log(e,t){return new Decimal(e).log(t).toFixed()}function _d_log2(e){return new Decimal(e).log(2).toFixed()}function _d_log10(e){return new Decimal(e).log(10).toFixed()}function _d_sin(e){return new Decimal(e).sin().toFixed()}function _d_cos(e){return new Decimal(e).cos().toFixed()}function _d_tan(e){return new Decimal(e).tan().toFixed()}function _d_asin(e){return new Decimal(e).asin().toFixed()}function _d_acos(e){return new Decimal(e).acos().toFixed()}function _d_atan(e){return new Decimal(e).atan().toFixed()}function _d_sinh(e){return new Decimal(e).sinh().toFixed()}function _d_cosh(e){return new Decimal(e).cosh().toFixed()}function _d_tanh(e){return new Decimal(e).tanh().toFixed()}function _d_asinh(e){return new Decimal(e).asinh().toFixed()}function _d_acosh(e){return new Decimal(e).acosh().toFixed()}function _d_atanh(e){return new Decimal(e).atanh().toFixed()}function _d_floor(e){return new Decimal(e).floor().toFixed()}function _d_ceil(e){return new Decimal(e).ceil().toFixed()}function _d_trunc(e){return new Decimal(e).trunc().toFixed()}function _d_round(e){return new Decimal(e).round().toFixed()}function _d_max(e,t){return Decimal.max(e,t).toFixed()}function _d_min(e,t){return Decimal.min(e,t).toFixed()}function _d_compare(e,t){return new Decimal(e).cmp(t)}function _d_eq(e,t){return new Decimal(e).eq(t)}function _d_lt(e,t){return new Decimal(e).lt(t)}function _d_gt(e,t){return new Decimal(e).gt(t)}function _d_lte(e,t){return new Decimal(e).lte(t)}function _d_gte(e,t){return new Decimal(e).gte(t)}var decimal_ops={add:_d_add,sub:_d_sub,mul:_d_mul,div:_d_div,mod:_d_mod,pow:_d_pow,idiv:_d_idiv,abs:_d_abs,neg:_d_neg,sqrt:_d_sqrt,cbrt:_d_cbrt,exp:_d_exp,ln:_d_ln,log:_d_log,log2:_d_log2,log10:_d_log10,sin:_d_sin,cos:_d_cos,tan:_d_tan,asin:_d_asin,acos:_d_acos,atan:_d_atan,sinh:_d_sinh,cosh:_d_cosh,tanh:_d_tanh,asinh:_d_asinh,acosh:_d_acosh,atanh:_d_atanh,floor:_d_floor,ceil:_d_ceil,trunc:_d_trunc,round:_d_round,max:_d_max,min:_d_min,compare:_d_compare,eq:_d_eq,lt:_d_lt,gt:_d_gt,lte:_d_lte,gte:_d_gte},dadd=_d_add,dsub=_d_sub,dmul=_d_mul,ddiv=_d_div,dmod=_d_mod,dpow=_d_pow,didiv=_d_idiv,dabs=_d_abs,dneg=_d_neg,dsqrt=_d_sqrt,dcbrt=_d_cbrt,dexp=_d_exp,dln=_d_ln,dlog=_d_log,dlog2=_d_log2,dlog10=_d_log10,dsin=_d_sin,dcos=_d_cos,dtan=_d_tan,dasin=_d_asin,dacos=_d_acos,datan=_d_atan,dsinh=_d_sinh,dcosh=_d_cosh,dtanh=_d_tanh,dasinh=_d_asinh,dacosh=_d_acosh,datanh=_d_atanh,dfloor=_d_floor,dceil=_d_ceil,dtrunc=_d_trunc,dround=_d_round,dmax=_d_max,dmin=_d_min,dcompare=_d_compare,deq=_d_eq,dlt=_d_lt,dgt=_d_gt,dlte=_d_lte,dgte=_d_gte;function bigint_pow10(e){if(e<=0)return 1n;for(var t=1n,r=0;r<e;r++)t*=10n;return t}function to_fixed_point(e){var t=String(e);if(t.includes("e")||t.includes("E"))return to_fixed_point_from_scientific(t);var r=t.startsWith("-"),n=_slicedToArray((r?t.slice(1):t).split("."),2),i=n[0],a=void 0===i?"0":i,o=n[1],s=void 0===o?"":o,_=s.length,u=(a+s).replace(/^0+/,"")||"0";return{value:BigInt(r?"-"+u:u),scale:_}}function to_fixed_point_from_scientific(e){var t=_slicedToArray(e.toLowerCase().split("e"),2),r=t[0],n=t[1],i=parseInt(n,10),a=to_fixed_point(r),o=a.value,s=a.scale-i;return s<0?{value:o*bigint_pow10(-s),scale:0}:{value:o,scale:s}}function from_fixed_point(e,t){var r=e<0n,n=(r?-e:e).toString();if(t<=0)return(r?"-":"")+n+"0".repeat(-t);for(;n.length<=t;)n="0"+n;var i=n.slice(0,-t),a=n.slice(-t).replace(/0+$/,""),o=a?"".concat(i,".").concat(a):i;return r?"-"+o:o}function normalize(e,t){if(0n===e)return{value:0n,scale:0};for(;t>0&&e%10n==0n;)e/=10n,t--;return{value:e,scale:t}}function align_scale(e,t,r,n){return t>n?{a_val:e,b_val:r*=bigint_pow10(t-n),scale:t}:n>t?{a_val:e*=bigint_pow10(n-t),b_val:r,scale:n}:{a_val:e,b_val:r,scale:t}}function _add(e,t){var r="string"==typeof e?to_fixed_point(e):e,n="string"==typeof t?to_fixed_point(t):t,i=align_scale(r.value,r.scale,n.value,n.scale);return normalize(i.a_val+i.b_val,i.scale)}function _minus(e,t){var r="string"==typeof e?to_fixed_point(e):e,n="string"==typeof t?to_fixed_point(t):t,i=align_scale(r.value,r.scale,n.value,n.scale);return normalize(i.a_val-i.b_val,i.scale)}function _mul(e,t){var r="string"==typeof e?to_fixed_point(e):e,n="string"==typeof t?to_fixed_point(t):t;return normalize(r.value*n.value,r.scale+n.scale)}function _div(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:20,n="string"==typeof e?to_fixed_point(e):e,i="string"==typeof t?to_fixed_point(t):t;if(0n===i.value)throw new Error("Division by zero");var a=bigint_pow10(r);return normalize(n.value*a/i.value,n.scale-i.scale+r)}function _mod(e,t){var r="string"==typeof e?to_fixed_point(e):e,n="string"==typeof t?to_fixed_point(t):t;if(0n===n.value)throw new Error("Modulo by zero");var i=align_scale(r.value,r.scale,n.value,n.scale);return normalize(i.a_val%i.b_val,i.scale)}function _pow(e,t){var r="string"==typeof e?to_fixed_point(e):e,n="bigint"==typeof t?t:BigInt(Math.floor(Number(t)));if(n<0n)return _div({value:1n,scale:0},_pow(r,-n));if(0n===n)return{value:1n,scale:0};if(1n===n)return r;for(var i={value:1n,scale:0},a=r,o=n;o>0n;)o%2n==1n&&(i=_mul(i,a)),a=_mul(a,a),o/=2n;return normalize(i.value,i.scale)}function _compare(e,t){var r="string"==typeof e?to_fixed_point(e):e,n="string"==typeof t?to_fixed_point(t):t,i=align_scale(r.value,r.scale,n.value,n.scale),a=i.a_val,o=i.b_val;return a<o?-1:a>o?1:0}function _eq(e,t){return 0===_compare(e,t)}function _lt(e,t){return _compare(e,t)<0}function _gt(e,t){return _compare(e,t)>0}function _lte(e,t){return _compare(e,t)<=0}function _gte(e,t){return _compare(e,t)>=0}function _abs(e){var t="string"==typeof e?to_fixed_point(e):e;return{value:t.value<0n?-t.value:t.value,scale:t.scale}}function _neg(e){var t="string"==typeof e?to_fixed_point(e):e;return{value:-t.value,scale:t.scale}}function _floor(e){var t="string"==typeof e?to_fixed_point(e):e;if(t.scale<=0)return{value:t.value*bigint_pow10(-t.scale),scale:0};var r=bigint_pow10(t.scale),n=t.value/r;return t.value<0n&&t.value%r!==0n&&(n-=1n),{value:n,scale:0}}function _ceil(e){var t="string"==typeof e?to_fixed_point(e):e;if(t.scale<=0)return{value:t.value*bigint_pow10(-t.scale),scale:0};var r=bigint_pow10(t.scale),n=t.value/r;return t.value>0n&&t.value%r!==0n&&(n+=1n),{value:n,scale:0}}function _trunc(e){var t="string"==typeof e?to_fixed_point(e):e;if(t.scale<=0)return{value:t.value*bigint_pow10(-t.scale),scale:0};var r=bigint_pow10(t.scale);return{value:t.value/r,scale:0}}function _round(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r="string"==typeof e?to_fixed_point(e):e,n=t;if(r.scale<=n){var i=n-r.scale;return{value:r.value*bigint_pow10(i),scale:n}}var a=bigint_pow10(r.scale-n),o=a/2n,s=r.value/a,_=r.value%a;return r.value>=0n?_>=o&&(s+=1n):-_>=o&&(s-=1n),normalize(s,n)}function _max(e,t){return _gt(e,t)?"string"==typeof e?to_fixed_point(e):e:"string"==typeof t?to_fixed_point(t):t}function _min(e,t){return _lt(e,t)?"string"==typeof e?to_fixed_point(e):e:"string"==typeof t?to_fixed_point(t):t}function _b_add(e,t){var r=_add(e,t);return from_fixed_point(r.value,r.scale)}function _b_sub(e,t){var r=_minus(e,t);return from_fixed_point(r.value,r.scale)}function _b_mul(e,t){var r=_mul(e,t);return from_fixed_point(r.value,r.scale)}function _b_div(e,t){if(0n===to_fixed_point(t).value){var r=get_config("_error");if(void 0!==r)return r;throw new Error("Division by zero")}var n=_div(e,t,get_config("_div_precision")||20);return from_fixed_point(n.value,n.scale)}function _b_mod(e,t){if(0n===to_fixed_point(t).value){var r=get_config("_error");if(void 0!==r)return r;throw new Error("Modulo by zero")}var n=_mod(e,t);return from_fixed_point(n.value,n.scale)}function _b_pow(e,t){var r=Number(t);if(!Number.isInteger(r))return _d_pow(e,t);var n=_pow(e,r);return from_fixed_point(n.value,n.scale)}function _b_idiv(e,t){if(0n===to_fixed_point(t).value){var r=get_config("_error");if(void 0!==r)return r;throw new Error("Division by zero")}var n=_div(e,t,get_config("_div_precision")||20),i=_trunc({value:n.value,scale:n.scale});return from_fixed_point(i.value,i.scale)}function _b_abs(e){var t=_abs(e);return from_fixed_point(t.value,t.scale)}function _b_neg(e){var t=_neg(e);return from_fixed_point(t.value,t.scale)}function _b_floor(e){var t=_floor(e);return from_fixed_point(t.value,t.scale)}function _b_ceil(e){var t=_ceil(e);return from_fixed_point(t.value,t.scale)}function _b_trunc(e){var t=_trunc(e);return from_fixed_point(t.value,t.scale)}function _b_round(e){var t=_round(e,0);return from_fixed_point(t.value,t.scale)}function _b_max(e,t){var r=_max(e,t);return from_fixed_point(r.value,r.scale)}function _b_min(e,t){var r=_min(e,t);return from_fixed_point(r.value,r.scale)}function _b_compare(e,t){return _compare(e,t)}function _b_eq(e,t){return _eq(e,t)}function _b_lt(e,t){return _lt(e,t)}function _b_gt(e,t){return _gt(e,t)}function _b_lte(e,t){return _lte(e,t)}function _b_gte(e,t){return _gte(e,t)}var bigint_ops={add:_b_add,sub:_b_sub,mul:_b_mul,div:_b_div,mod:_b_mod,pow:_b_pow,idiv:_b_idiv,abs:_b_abs,neg:_b_neg,floor:_b_floor,ceil:_b_ceil,trunc:_b_trunc,round:_b_round,max:_b_max,min:_b_min,compare:_b_compare,eq:_b_eq,lt:_b_lt,gt:_b_gt,lte:_b_lte,gte:_b_gte,sqrt:_d_sqrt,cbrt:_d_cbrt,exp:_d_exp,ln:_d_ln,log:_d_log,log2:_d_log2,log10:_d_log10,sin:_d_sin,cos:_d_cos,tan:_d_tan,asin:_d_asin,acos:_d_acos,atan:_d_atan,sinh:_d_sinh,cosh:_d_cosh,tanh:_d_tanh,asinh:_d_asinh,acosh:_d_acosh,atanh:_d_atanh},badd=_b_add,bsub=_b_sub,bmul=_b_mul,bdiv=_b_div,bmod=_b_mod,bpow=_b_pow,bidiv=_b_idiv,babs=_b_abs,bneg=_b_neg,bfloor=_b_floor,bceil=_b_ceil,btrunc=_b_trunc,bround=_b_round,bmax=_b_max,bmin=_b_min,bcompare=_b_compare,beq=_b_eq,blt=_b_lt,bgt=_b_gt,blte=_b_lte,bgte=_b_gte,bsqrt=_d_sqrt,bcbrt=_d_cbrt,bexp=_d_exp,bln=_d_ln,blog=_d_log,blog2=_d_log2,blog10=_d_log10,bsin=_d_sin,bcos=_d_cos,btan=_d_tan,basin=_d_asin,bacos=_d_acos,batan=_d_atan,bsinh=_d_sinh,bcosh=_d_cosh,btanh=_d_tanh,basinh=_d_asinh,bacosh=_d_acosh,batanh=_d_atanh,wasm_module=null,wasm_loaded=!1,wasm_loading=!1,wasm_load_callbacks=[],_calc_fallback=null;function register_calc_fallback(e){_calc_fallback=e}function load_wasm(e){return _load_wasm.apply(this,arguments)}function _load_wasm(){return(_load_wasm=_asyncToGenerator(_regenerator().m(function e(t){var r,n,i,a;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:if(!wasm_loaded){e.n=1;break}return e.a(2,wasm_module);case 1:if(!wasm_loading){e.n=2;break}return e.a(2,new Promise(function(e,t){wasm_load_callbacks.push({resolve:e,reject:t})}));case 2:return wasm_loading=!0,e.p=3,e.n=4,Promise.resolve().then(function(){return wasm_calc});case 4:if(r=e.v,n="undefined"!=typeof window,i="undefined"!=typeof process&&process.versions&&process.versions.node,!n){e.n=8;break}if(!t){e.n=6;break}return e.n=5,r.default(t);case 5:e.n=7;break;case 6:return e.n=7,r.default();case 7:case 9:case 16:e.n=18;break;case 8:if(!i){e.n=10;break}return e.n=9,init_wasm_node(r);case 10:if("function"!=typeof globalThis.fetch){e.n=17;break}if(e.p=11,!t){e.n=13;break}return e.n=12,r.default(t);case 12:e.n=14;break;case 13:return e.n=14,r.default();case 14:e.n=16;break;case 15:return e.p=15,e.v,e.n=16,init_wasm_node(r);case 17:throw new Error("Unsupported environment for WASM loading");case 18:return wasm_module=r,wasm_loaded=!0,update_wasm_ops(),wasm_load_callbacks.forEach(function(e){return e.resolve(r)}),wasm_load_callbacks=[],e.a(2,r);case 19:throw e.p=19,a=e.v,wasm_loading=!1,wasm_load_callbacks.forEach(function(e){return e.reject(a)}),wasm_load_callbacks=[],console.warn("WASM module failed to load, using Decimal fallback:",a),a;case 20:return e.a(2)}},e,null,[[11,15],[3,19]])}))).apply(this,arguments)}function init_wasm_node(e){return _init_wasm_node.apply(this,arguments)}function _init_wasm_node(){return(_init_wasm_node=_asyncToGenerator(_regenerator().m(function e(t){var r,n,i,a,o,s,_,u,c,l,p,d,f,g,m,v;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.n=1,import("fs");case 1:return r=e.v,n=r.readFileSync,e.n=2,import("url");case 2:return i=e.v,a=i.fileURLToPath,e.n=3,import("path");case 3:o=e.v,s=o.dirname,_=o.join,u=a("undefined"==typeof document?require("url").pathToFileURL(__filename).href:_documentCurrentScript&&"SCRIPT"===_documentCurrentScript.tagName.toUpperCase()&&_documentCurrentScript.src||new URL("index.js",document.baseURI).href),c=s(u),l=[_(c,"../../wasm-calc/pkg/wasm_calc_bg.wasm"),_(c,"../wasm-calc/pkg/wasm_calc_bg.wasm"),_(c,"../../wasm-calc/pkg/wasm_calc_bg.wasm")],p=null,d=null,f=0,g=l;case 4:if(!(f<g.length)){e.n=8;break}return m=g[f],e.p=5,p=n(m),e.a(3,8);case 6:e.p=6,v=e.v,d=v;case 7:f++,e.n=4;break;case 8:if(p){e.n=9;break}throw d||new Error("WASM file not found");case 9:t.initSync({module:p});case 10:return e.a(2)}},e,null,[[5,6]])}))).apply(this,arguments)}function is_wasm_loaded(){return wasm_loaded}var wasm_ops={add:_d_add,sub:_d_sub,mul:_d_mul,div:_d_div,mod:_d_mod,pow:_d_pow,idiv:_d_idiv,abs:_d_abs,neg:_d_neg,sqrt:_d_sqrt,exp:_d_exp,ln:_d_ln,log10:_d_log10,sin:_d_sin,cos:_d_cos,tan:_d_tan,floor:_d_floor,ceil:_d_ceil,trunc:_d_trunc,round:_d_round,max:_d_max,min:_d_min,compare:_d_compare,eq:_d_eq,lt:_d_lt,gt:_d_gt,lte:_d_lte,gte:_d_gte,cbrt:_d_cbrt,log:_d_log,log2:_d_log2,asin:_d_asin,acos:_d_acos,atan:_d_atan,sinh:_d_sinh,cosh:_d_cosh,tanh:_d_tanh,asinh:_d_asinh,acosh:_d_acosh,atanh:_d_atanh};function trigger_wcalc_load(){wasm_loading||wasm_loaded||load_wasm().catch(function(){})}var _wcalc_impl=function(e){return trigger_wcalc_load(),_calc_fallback(e)};function wcalc(e){return _wcalc_impl(e)}function update_wasm_ops(){wasm_ops.add=function(e,t){return wasm_module.str_plus(String(e),String(t))},wasm_ops.sub=function(e,t){return wasm_module.str_sub(String(e),String(t))},wasm_ops.mul=function(e,t){return wasm_module.str_mul(String(e),String(t))},wasm_ops.div=function(e,t){var r=wasm_module.str_div(String(e),String(t));if("NaN"===r){var n=get_config("_error");if(void 0!==n)return n;throw new Error("Division by zero")}return r},wasm_ops.mod=function(e,t){var r=wasm_module.str_mod(String(e),String(t));if("NaN"===r){var n=get_config("_error");if(void 0!==n)return n;throw new Error("Modulo by zero")}return r},wasm_ops.pow=function(e,t){var r=wasm_module.str_powd(String(e),String(t));return"NaN"===r||"Overflow"===r?_d_pow(e,t):r},wasm_ops.idiv=function(e,t){var r=wasm_module.str_div(String(e),String(t));if("NaN"===r){var n=get_config("_error");if(void 0!==n)return n;throw new Error("Division by zero")}return wasm_module.str_trunc(r)},wasm_ops.abs=function(e){return wasm_module.str_abs(String(e))},wasm_ops.neg=function(e){return wasm_module.str_neg(String(e))},wasm_ops.sqrt=function(e){var t=wasm_module.str_sqrt(String(e));return"NaN"===t?_d_sqrt(e):t},wasm_ops.exp=function(e){return wasm_module.str_exp(String(e))},wasm_ops.ln=function(e){var t=wasm_module.str_ln(String(e));return"NaN"===t?_d_ln(e):t},wasm_ops.log10=function(e){var t=wasm_module.str_log10(String(e));return"NaN"===t?_d_log10(e):t},wasm_ops.sin=function(e){return wasm_module.str_sin(String(e))},wasm_ops.cos=function(e){return wasm_module.str_cos(String(e))},wasm_ops.tan=function(e){return wasm_module.str_tan(String(e))},wasm_ops.floor=function(e){return wasm_module.str_floor(String(e))},wasm_ops.ceil=function(e){return wasm_module.str_ceil(String(e))},wasm_ops.trunc=function(e){return wasm_module.str_trunc(String(e))},wasm_ops.round=function(e){return wasm_module.str_round(String(e))},wasm_ops.max=function(e,t){return wasm_module.str_max(String(e),String(t))},wasm_ops.min=function(e,t){return wasm_module.str_min(String(e),String(t))},wasm_ops.compare=function(e,t){return wasm_module.str_compare(String(e),String(t))},wasm_ops.eq=function(e,t){return wasm_module.str_eq(String(e),String(t))},wasm_ops.lt=function(e,t){return wasm_module.str_lt(String(e),String(t))},wasm_ops.gt=function(e,t){return wasm_module.str_gt(String(e),String(t))},wasm_ops.lte=function(e,t){return wasm_module.str_lte(String(e),String(t))},wasm_ops.gte=function(e,t){return wasm_module.str_gte(String(e),String(t))},_wcalc_impl=function(e){var t=wasm_module.eval_expr(String(e));if(t.startsWith("Error:")){var r=get_config("_error");if(void 0!==r)return r;throw new Error(t)}return t},update_wasm_raw_functions()}function trigger_wasm_load(){wasm_loading||wasm_loaded||load_wasm().catch(function(){})}exports.wadd=function(e,t){return trigger_wasm_load(),_d_add(e,t)},exports.wsub=function(e,t){return trigger_wasm_load(),_d_sub(e,t)},exports.wmul=function(e,t){return trigger_wasm_load(),_d_mul(e,t)},exports.wdiv=function(e,t){return trigger_wasm_load(),_d_div(e,t)},exports.wmod=function(e,t){return trigger_wasm_load(),_d_mod(e,t)},exports.wpow=function(e,t){return trigger_wasm_load(),_d_pow(e,t)},exports.widiv=function(e,t){return trigger_wasm_load(),_d_idiv(e,t)},exports.wabs=function(e){return trigger_wasm_load(),_d_abs(e)},exports.wneg=function(e){return trigger_wasm_load(),_d_neg(e)},exports.wsqrt=function(e){return trigger_wasm_load(),_d_sqrt(e)};var wcbrt=function(e){return trigger_wasm_load(),_d_cbrt(e)};exports.wexp=function(e){return trigger_wasm_load(),_d_exp(e)},exports.wln=function(e){return trigger_wasm_load(),_d_ln(e)};var wlog=function(e,t){return trigger_wasm_load(),_d_log(e,t)},wlog2=function(e){return trigger_wasm_load(),_d_log2(e)};exports.wlog10=function(e){return trigger_wasm_load(),_d_log10(e)},exports.wsin=function(e){return trigger_wasm_load(),_d_sin(e)},exports.wcos=function(e){return trigger_wasm_load(),_d_cos(e)},exports.wtan=function(e){return trigger_wasm_load(),_d_tan(e)};var wasin=function(e){return trigger_wasm_load(),_d_asin(e)},wacos=function(e){return trigger_wasm_load(),_d_acos(e)},watan=function(e){return trigger_wasm_load(),_d_atan(e)},wsinh=function(e){return trigger_wasm_load(),_d_sinh(e)},wcosh=function(e){return trigger_wasm_load(),_d_cosh(e)},wtanh=function(e){return trigger_wasm_load(),_d_tanh(e)},wasinh=function(e){return trigger_wasm_load(),_d_asinh(e)},wacosh=function(e){return trigger_wasm_load(),_d_acosh(e)},watanh=function(e){return trigger_wasm_load(),_d_atanh(e)};function update_wasm_raw_functions(){exports.wadd=function(e,t){return wasm_module.str_plus(String(e),String(t))},exports.wsub=function(e,t){return wasm_module.str_sub(String(e),String(t))},exports.wmul=function(e,t){return wasm_module.str_mul(String(e),String(t))},exports.wdiv=function(e,t){var r=wasm_module.str_div(String(e),String(t));if("NaN"===r){var n=get_config("_error");if(void 0!==n)return n;throw new Error("Division by zero")}return r},exports.wmod=function(e,t){var r=wasm_module.str_mod(String(e),String(t));if("NaN"===r){var n=get_config("_error");if(void 0!==n)return n;throw new Error("Modulo by zero")}return r},exports.wpow=function(e,t){var r=wasm_module.str_powd(String(e),String(t));return"NaN"===r||"Overflow"===r?_d_pow(e,t):r},exports.widiv=function(e,t){var r=wasm_module.str_div(String(e),String(t));if("NaN"===r){var n=get_config("_error");if(void 0!==n)return n;throw new Error("Division by zero")}return wasm_module.str_trunc(r)},exports.wabs=function(e){return wasm_module.str_abs(String(e))},exports.wneg=function(e){return wasm_module.str_neg(String(e))},exports.wsqrt=function(e){var t=wasm_module.str_sqrt(String(e));return"NaN"===t?_d_sqrt(e):t},exports.wexp=function(e){return wasm_module.str_exp(String(e))},exports.wln=function(e){var t=wasm_module.str_ln(String(e));return"NaN"===t?_d_ln(e):t},exports.wlog10=function(e){var t=wasm_module.str_log10(String(e));return"NaN"===t?_d_log10(e):t},exports.wsin=function(e){return wasm_module.str_sin(String(e))},exports.wcos=function(e){return wasm_module.str_cos(String(e))},exports.wtan=function(e){return wasm_module.str_tan(String(e))},exports.wfloor=function(e){return wasm_module.str_floor(String(e))},exports.wceil=function(e){return wasm_module.str_ceil(String(e))},exports.wtrunc=function(e){return wasm_module.str_trunc(String(e))},exports.wround=function(e){return wasm_module.str_round(String(e))},exports.wmax=function(e,t){return wasm_module.str_max(String(e),String(t))},exports.wmin=function(e,t){return wasm_module.str_min(String(e),String(t))},exports.wcompare=function(e,t){return wasm_module.str_compare(String(e),String(t))},exports.weq=function(e,t){return wasm_module.str_eq(String(e),String(t))},exports.wlt=function(e,t){return wasm_module.str_lt(String(e),String(t))},exports.wgt=function(e,t){return wasm_module.str_gt(String(e),String(t))},exports.wlte=function(e,t){return wasm_module.str_lte(String(e),String(t))},exports.wgte=function(e,t){return wasm_module.str_gte(String(e),String(t))}}exports.wfloor=function(e){return trigger_wasm_load(),_d_floor(e)},exports.wceil=function(e){return trigger_wasm_load(),_d_ceil(e)},exports.wtrunc=function(e){return trigger_wasm_load(),_d_trunc(e)},exports.wround=function(e){return trigger_wasm_load(),_d_round(e)},exports.wmax=function(e,t){return trigger_wasm_load(),_d_max(e,t)},exports.wmin=function(e,t){return trigger_wasm_load(),_d_min(e,t)},exports.wcompare=function(e,t){return trigger_wasm_load(),_d_compare(e,t)},exports.weq=function(e,t){return trigger_wasm_load(),_d_eq(e,t)},exports.wlt=function(e,t){return trigger_wasm_load(),_d_lt(e,t)},exports.wgt=function(e,t){return trigger_wasm_load(),_d_gt(e,t)},exports.wlte=function(e,t){return trigger_wasm_load(),_d_lte(e,t)},exports.wgte=function(e,t){return trigger_wasm_load(),_d_gte(e,t)};var modes={decimal:decimal_ops,bigint:bigint_ops,wasm:wasm_ops},ops=_objectSpread2({},decimal_ops);function set_compute_mode(e){return modes[e]?(Object.assign(ops,modes[e]),"wasm"!==e||is_wasm_loaded()||load_wasm().catch(function(e){console.warn("Failed to load WASM module, using Decimal fallback:",e.message)}),!0):(console.warn("Unknown compute mode: ".concat(e,", available modes: ").concat(Object.keys(modes).join(", "))),!1)}function is_error_value(e){var t=get_config("_error");return void 0!==t&&e===t}function add(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=t.length>0&&"string"===t[t.length-1]?"string":"number",i="string"===n?t.slice(0,-1):t;if(0===i.length)return"number"===n?0:"0";for(var a=String(i[0]),o=1;o<i.length;o++)a=ops.add(a,String(i[o]));return"number"===n?Number(a):a}function sub(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=t.length>0&&"string"===t[t.length-1]?"string":"number",i="string"===n?t.slice(0,-1):t;if(0===i.length)return"number"===n?0:"0";if(1===i.length){var a=ops.neg(ops.neg(String(i[0])));return"number"===n?Number(a):a}for(var o=String(i[0]),s=1;s<i.length;s++)o=ops.sub(o,String(i[s]));return"number"===n?Number(o):o}function mul(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=t.length>0&&"string"===t[t.length-1]?"string":"number",i="string"===n?t.slice(0,-1):t;if(0===i.length)return"number"===n?1:"1";for(var a=String(i[0]),o=1;o<i.length;o++)a=ops.mul(a,String(i[o]));return"number"===n?Number(a):a}function div(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=t.length>0&&"string"===t[t.length-1]?"string":"number",i="string"===n?t.slice(0,-1):t;if(0===i.length)return"number"===n?1:"1";if(1===i.length){var a=String(i[0]);return"number"===n?Number(a):a}for(var o=String(i[0]),s=1;s<i.length;s++)if(is_error_value(o=ops.div(o,String(i[s]))))return o;return"number"===n?Number(o):o}function mod(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=t.length>0&&"string"===t[t.length-1]?"string":"number",i="string"===n?t.slice(0,-1):t;if(0===i.length)return"number"===n?0:"0";if(1===i.length){var a=String(i[0]);return"number"===n?Number(a):a}for(var o=String(i[0]),s=1;s<i.length;s++)if(is_error_value(o=ops.mod(o,String(i[s]))))return o;return"number"===n?Number(o):o}function pow(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=t.length>0&&"string"===t[t.length-1]?"string":"number",i="string"===n?t.slice(0,-1):t;if(0===i.length)return"number"===n?1:"1";if(1===i.length){var a=String(i[0]);return"number"===n?Number(a):a}for(var o=String(i[i.length-1]),s=i.length-2;s>=0;s--)o=ops.pow(String(i[s]),o);return"number"===n?Number(o):o}function idiv(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=t.length>0&&"string"===t[t.length-1]?"string":"number",i="string"===n?t.slice(0,-1):t;if(0===i.length)return"number"===n?0:"0";if(1===i.length){var a=String(i[0]);return"number"===n?Number(a):a}for(var o=String(i[0]),s=1;s<i.length;s++)if(is_error_value(o=ops.idiv(o,String(i[s]))))return o;return"number"===n?Number(o):o}function abs(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"number",r=ops.abs(String(e));return"number"===t?Number(r):r}function neg(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"number",r=ops.neg(String(e));return"number"===t?Number(r):r}function sqrt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"number",r=ops.sqrt(String(e));return"number"===t?Number(r):r}function ln(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"number",r=ops.ln(String(e));return"number"===t?Number(r):r}function exp(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"number",r=ops.exp(String(e));return"number"===t?Number(r):r}function internal_format(e,t){if(!t)return e;var r=fmt_tokenizer(t,null);return _slicedToArray(format(new Decimal(e),r,{}),1)[0]}function resolve_value(e){if("function"==typeof e){var t=e();return is_error_value(t),t}return e}function create_chain(e){var t=String(e),r=is_error_value(e),n=function(e){return r?t:e?internal_format(t,e):t};return n.add=function(){if(r)return n;for(var e=arguments.length,i=new Array(e),a=0;a<e;a++)i[a]=arguments[a];for(var o=0,s=i;o<s.length;o++){var _=resolve_value(s[o]);if(is_error_value(t=add(t,_,"string")))return r=!0,n}return n},n.sub=function(){if(r)return n;for(var e=arguments.length,i=new Array(e),a=0;a<e;a++)i[a]=arguments[a];for(var o=0,s=i;o<s.length;o++){var _=resolve_value(s[o]);if(is_error_value(t=sub(t,_,"string")))return r=!0,n}return n},n.mul=function(){if(r)return n;for(var e=arguments.length,i=new Array(e),a=0;a<e;a++)i[a]=arguments[a];for(var o=0,s=i;o<s.length;o++){var _=resolve_value(s[o]);if(is_error_value(t=mul(t,_,"string")))return r=!0,n}return n},n.div=function(){if(r)return n;for(var e=arguments.length,i=new Array(e),a=0;a<e;a++)i[a]=arguments[a];for(var o=0,s=i;o<s.length;o++){var _=resolve_value(s[o]);if(is_error_value(t=div(t,_,"string")))return r=!0,n}return n},n.mod=function(){if(r)return n;for(var e=arguments.length,i=new Array(e),a=0;a<e;a++)i[a]=arguments[a];for(var o=0,s=i;o<s.length;o++){var _=resolve_value(s[o]);if(is_error_value(t=mod(t,_,"string")))return r=!0,n}return n},n.pow=function(){if(r)return n;for(var e=arguments.length,i=new Array(e),a=0;a<e;a++)i[a]=arguments[a];for(var o=0,s=i;o<s.length;o++){var _=resolve_value(s[o]);if(is_error_value(t=pow(t,_,"string")))return r=!0,n}return n},n.idiv=function(){if(r)return n;for(var e=arguments.length,i=new Array(e),a=0;a<e;a++)i[a]=arguments[a];for(var o=0,s=i;o<s.length;o++){var _=resolve_value(s[o]);if(is_error_value(t=idiv(t,_,"string")))return r=!0,n}return n},n}function cadd(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(0===t.length)return create_chain(0);for(var n="0",i=0,a=t;i<a.length;i++){var o=resolve_value(a[i]);if(is_error_value(o))return create_chain(o);if(is_error_value(n=add(n,o,"string")))return create_chain(n)}return create_chain(n)}function csub(e){if(void 0===e)return create_chain(0);for(var t=String(resolve_value(e)),r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];for(var a=0,o=n;a<o.length;a++){if(is_error_value(t=sub(t,resolve_value(o[a]),"string")))return create_chain(t)}return create_chain(t)}function cmul(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(0===t.length)return create_chain(1);for(var n="1",i=0,a=t;i<a.length;i++){var o=resolve_value(a[i]);if(is_error_value(o))return create_chain(o);if(is_error_value(n=mul(n,o,"string")))return create_chain(n)}return create_chain(n)}function cdiv(e){if(void 0===e)return create_chain(1);for(var t=String(resolve_value(e)),r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];for(var a=0,o=n;a<o.length;a++){if(is_error_value(t=div(t,resolve_value(o[a]),"string")))return create_chain(t)}return create_chain(t)}function cmod(e){if(void 0===e)return create_chain(0);for(var t=String(resolve_value(e)),r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];for(var a=0,o=n;a<o.length;a++){if(is_error_value(t=mod(t,resolve_value(o[a]),"string")))return create_chain(t)}return create_chain(t)}function cpow(e){if(void 0===e)return create_chain(1);for(var t=String(resolve_value(e)),r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];for(var a=0,o=n;a<o.length;a++){if(is_error_value(t=pow(t,resolve_value(o[a]),"string")))return create_chain(t)}return create_chain(t)}function cidiv(e){if(void 0===e)return create_chain(0);for(var t=String(resolve_value(e)),r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];for(var a=0,o=n;a<o.length;a++){if(is_error_value(t=idiv(t,resolve_value(o[a]),"string")))return create_chain(t)}return create_chain(t)}function print_debug_info(e){var t=[],r=50,n="─".repeat(r);t.push("┌".concat(n,"┐")),t.push("│ [a-calc debug]".concat(" ".repeat(35),"│")),t.push("├".concat(n,"┤"));var i="│ 表达式: ".concat(e.expression);t.push(i+" ".repeat(Math.max(0,52-i.length))+"│"),t.push("│".concat(" ".repeat(r),"│")),t.push("│ 变量:".concat(" ".repeat(45),"│"));for(var a=0,o=Object.entries(e.variables);a<o.length;a++){var s=_slicedToArray(o[a],2),_=s[0],u=s[1],c="│ ".concat(_," = ").concat(u);t.push(c+" ".repeat(Math.max(0,52-c.length))+"│")}if(t.push("│".concat(" ".repeat(r),"│")),t.push("│ 步骤:".concat(" ".repeat(45),"│")),e.steps.forEach(function(e,r){var n="│ ".concat(r+1,". ").concat(e.expression);t.push(n+" ".repeat(Math.max(0,52-n.length))+"│");var i="│ → ".concat(e.substituted," = ").concat(e.result);t.push(i+" ".repeat(Math.max(0,52-i.length))+"│")}),t.push("│".concat(" ".repeat(r),"│")),e.format){var l="│ 格式化: | ".concat(e.format);t.push(l+" ".repeat(Math.max(0,52-l.length))+"│"),t.push("│".concat(" ".repeat(r),"│"))}var p='│ 结果: "'.concat(e.result,'"');t.push(p+" ".repeat(Math.max(0,52-p.length))+"│"),t.push("└".concat(n,"┘")),console.log(t.join("\n"))}function calc(e,t){var r,n=get_config(),i=t?Array.isArray(t)?t:_objectSpread2(_objectSpread2({},n),t):n,a=null!==(r=find_value(i,"_error"))&&void 0!==r?r:get_config("_error"),o=find_value(i,"_debug"),s=find_value(i,"_on_debug"),_=null;o&&(_={expression:e,variables:{},steps:[],format:null,result:null});try{var u,c,l,p=parse_args(e,i),d=p._unit;p._angle_unit&&set_config({_angle_unit:p._angle_unit});var f={_empty_values:p._empty_values,_empty_check:p._empty_check};if(o&&p.fill_data){var g=function(e){if(Array.isArray(e))e.forEach(function(e){return g(e)});else if(e&&"object"===_typeof(e))for(var t=0,r=Object.entries(e);t<r.length;t++){var n=_slicedToArray(r[t],2),i=n[0],a=n[1];i.startsWith("_")||"function"==typeof a||(_.variables[i]=a)}};g(p.fill_data)}var m=tokenizer(p.expr,p.fill_data,d,f);if(m._fill_data=p.fill_data,m._unit=d,m._options=f,o){var v=m.map(function(e){return void 0!==e.real_value&&e.real_value!==e.value?e.real_value:e.value}).join(" ");_.steps.push({expression:p.expr,substituted:v,result:"..."})}var h=eval_tokens(m);if(o&&_.steps.length>0&&(_.steps[_.steps.length-1].result=String(h)),"boolean"==typeof h)return o&&(_.result=h,get_config("_debug_console")&&print_debug_info(_),s&&s(_)),h;if("string"==typeof h&&!is_decimal(h))return o&&(_.result=h,get_config("_debug_console")&&print_debug_info(_),s&&s(_)),h;var w,b,y,x=is_decimal(h)?h:new Decimal(h);b=""===p.fmt_expr||void 0===p.fmt_expr?void 0:fmt_tokenizer(p.fmt_expr,p.fill_data);var S=get_config("_fmt_parsed");if(S&&S.has_var)y=fmt_tokenizer(get_config("_fmt"),p.fill_data);else y=S;if(void 0===b?void 0!==y&&(b=y):void 0!==y&&(b=[].concat(_toConsumableArray(y),_toConsumableArray(b))),o&&(p.fmt_expr||get_config("_fmt"))&&(_.format=p.fmt_expr||get_config("_fmt")),void 0===b)x=x.toFixed();else{var E=_slicedToArray(format(x,b,{_compact_units:p._compact_units,_compact_step:p._compact_step,_unit_convert_out:get_config("_unit_convert_out"),_unit_default_in:get_config("_unit_default_in"),_unit_default_out:get_config("_unit_default_out"),_unit_default_position:get_config("_unit_default_position"),_unit_position_map:get_config("_unit_position_map"),_thousands:p._thousands,_unit_thousands_map:get_config("_unit_thousands_map"),_recognized_unit:m.has_unit?m.unit:null}),2);x=E[0],w=E[1]}if("Infinity"===x||"NaN"===x||void 0===x)throw new Error("计算错误可能是非法的计算式");return!m.has_unit||null!==(u=w)&&void 0!==u&&u.to_number||null!==(c=w)&&void 0!==c&&c.to_number_string||null!==(l=w)&&void 0!==l&&l.unit_handled||(x+=m.unit),o&&(_.result=x,get_config("_debug_console")&&print_debug_info(_),s&&s(_)),x}catch(e){if(o&&(_.result=null!=a?a:e.message,_.error=e.message,get_config("_debug_console")&&print_debug_info(_),s&&s(_)),void 0===a)throw e;return a}}function calc_space(e,t){var r,n=get_config(),i=t?Array.isArray(t)?t:_objectSpread2(_objectSpread2({},n),t):n,a=null!==(r=find_value(i,"_error"))&&void 0!==r?r:get_config("_error"),o=find_value(i,"_debug"),s=find_value(i,"_on_debug"),_=null;o&&(_={expression:e,variables:{},steps:[],format:null,result:null});try{var u,c,l,p=parse_args(e,i),d=p._unit;p._angle_unit&&set_config({_angle_unit:p._angle_unit});var f={_empty_values:p._empty_values,_empty_check:p._empty_check};if(o&&p.fill_data){var g=function(e){if(Array.isArray(e))e.forEach(function(e){return g(e)});else if(e&&"object"===_typeof(e))for(var t=0,r=Object.entries(e);t<r.length;t++){var n=_slicedToArray(r[t],2),i=n[0],a=n[1];i.startsWith("_")||"function"==typeof a||(_.variables[i]=a)}};g(p.fill_data)}var m=tokenizer_space(p.expr,p.fill_data,d,f);if(m._fill_data=p.fill_data,m._unit=d,m._options=f,o){var v=m.map(function(e){return void 0!==e.real_value&&e.real_value!==e.value?e.real_value:e.value}).join(" ");_.steps.push({expression:p.expr,substituted:v,result:"..."})}var h=eval_tokens(m);if(o&&_.steps.length>0&&(_.steps[_.steps.length-1].result=String(h)),"boolean"==typeof h)return o&&(_.result=h,get_config("_debug_console")&&print_debug_info(_),s&&s(_)),h;if("string"==typeof h&&!is_decimal(h))return o&&(_.result=h,get_config("_debug_console")&&print_debug_info(_),s&&s(_)),h;var w,b,y,x=is_decimal(h)?h:new Decimal(h);b=""===p.fmt_expr||void 0===p.fmt_expr?void 0:fmt_tokenizer_space(p.fmt_expr,p.fill_data);var S=get_config("_fmt_parsed");if(S&&S.has_var)y=fmt_tokenizer_space(get_config("_fmt"),p.fill_data);else y=S;if(void 0===b?void 0!==y&&(b=y):void 0!==y&&(b=[].concat(_toConsumableArray(y),_toConsumableArray(b))),o&&(p.fmt_expr||get_config("_fmt"))&&(_.format=p.fmt_expr||get_config("_fmt")),void 0===b)x=x.toFixed();else{var E=_slicedToArray(format(x,b,{_compact_units:p._compact_units,_compact_step:p._compact_step,_unit_convert_out:get_config("_unit_convert_out"),_unit_default_in:get_config("_unit_default_in"),_unit_default_out:get_config("_unit_default_out"),_unit_default_position:get_config("_unit_default_position"),_unit_position_map:get_config("_unit_position_map"),_thousands:p._thousands,_unit_thousands_map:get_config("_unit_thousands_map"),_recognized_unit:m.has_unit?m.unit:null}),2);x=E[0],w=E[1]}if("Infinity"===x||"NaN"===x||void 0===x)throw new Error("计算错误可能是非法的计算式");return!m.has_unit||null!==(u=w)&&void 0!==u&&u.to_number||null!==(c=w)&&void 0!==c&&c.to_number_string||null!==(l=w)&&void 0!==l&&l.unit_handled||(x+=m.unit),o&&(_.result=x,get_config("_debug_console")&&print_debug_info(_),s&&s(_)),x}catch(e){if(o&&(_.result=null!=a?a:e.message,_.error=e.message,get_config("_debug_console")&&print_debug_info(_),s&&s(_)),void 0===a)throw e;return a}}function fmt(e,t,r){return calc(t?"".concat(e," | ").concat(t):"".concat(e),r)}function check_update(){check_version().catch(function(){})}function print_version(){console.log("%ca-calc:%c ".concat(version," %c=> %curl:%c https://www.npmjs.com/package/a-calc"),"color: #fff;background: #67C23A;padding: 2px 5px;border-radius:4px;font-size: 14px;","color: #67C23A;font-size:14px;","color: #67C23A;font-size:14px;","background: #67C23A;font-size:14px; padding: 2px 5px; border-radius: 4px; color: #fff;","font-size:14px;")}on_config_change("_compute_mode",function(e){set_compute_mode(e)}),Decimal.set({precision:50,rounding:Decimal.ROUND_HALF_UP,toExpNeg:-50,toExpPos:50}),register_calc_fallback(calc),register_calc(calc),register_calc_for_sum(calc);var calc_util={check_update:check_update,print_version:print_version,close_important_push:close_important_push,open_important_push:open_important_push},wasm;function radd(){return ops.add.apply(ops,arguments)}function rsub(){return ops.sub.apply(ops,arguments)}function rmul(){return ops.mul.apply(ops,arguments)}function rdiv(){return ops.div.apply(ops,arguments)}function rmod(){return ops.mod.apply(ops,arguments)}function rpow(){return ops.pow.apply(ops,arguments)}function ridiv(){return ops.idiv.apply(ops,arguments)}function rabs(){return ops.abs.apply(ops,arguments)}function rneg(){return ops.neg.apply(ops,arguments)}function rsqrt(){return ops.sqrt.apply(ops,arguments)}function rln(){return ops.ln.apply(ops,arguments)}function rexp(){return ops.exp.apply(ops,arguments)}function rsin(){return ops.sin.apply(ops,arguments)}function rcos(){return ops.cos.apply(ops,arguments)}function rtan(){return ops.tan.apply(ops,arguments)}function rasin(){return ops.asin.apply(ops,arguments)}function racos(){return ops.acos.apply(ops,arguments)}function ratan(){return ops.atan.apply(ops,arguments)}function rsinh(){return ops.sinh.apply(ops,arguments)}function rcosh(){return ops.cosh.apply(ops,arguments)}function rtanh(){return ops.tanh.apply(ops,arguments)}function rasinh(){return ops.asinh.apply(ops,arguments)}function racosh(){return ops.acosh.apply(ops,arguments)}function ratanh(){return ops.atanh.apply(ops,arguments)}function rfloor(){return ops.floor.apply(ops,arguments)}function rceil(){return ops.ceil.apply(ops,arguments)}function rtrunc(){return ops.trunc.apply(ops,arguments)}function rround(){return ops.round.apply(ops,arguments)}function rmax(){return ops.max.apply(ops,arguments)}function rmin(){return ops.min.apply(ops,arguments)}function rcompare(){return ops.compare.apply(ops,arguments)}function req(){return ops.eq.apply(ops,arguments)}function rlt(){return ops.lt.apply(ops,arguments)}function rgt(){return ops.gt.apply(ops,arguments)}function rlte(){return ops.lte.apply(ops,arguments)}function rgte(){return ops.gte.apply(ops,arguments)}function rlog(){return ops.log.apply(ops,arguments)}function rlog2(){return ops.log2.apply(ops,arguments)}function rlog10(){return ops.log10.apply(ops,arguments)}function rcbrt(){return ops.cbrt.apply(ops,arguments)}var cachedDataViewMemory0=null;function getDataViewMemory0(){return(null===cachedDataViewMemory0||!0===cachedDataViewMemory0.buffer.detached||void 0===cachedDataViewMemory0.buffer.detached&&cachedDataViewMemory0.buffer!==wasm.memory.buffer)&&(cachedDataViewMemory0=new DataView(wasm.memory.buffer)),cachedDataViewMemory0}function getStringFromWasm0(e,t){return decodeText(e>>>=0,t)}var cachedUint8ArrayMemory0=null;function getUint8ArrayMemory0(){return null!==cachedUint8ArrayMemory0&&0!==cachedUint8ArrayMemory0.byteLength||(cachedUint8ArrayMemory0=new Uint8Array(wasm.memory.buffer)),cachedUint8ArrayMemory0}function passStringToWasm0(e,t,r){if(void 0===r){var n=cachedTextEncoder.encode(e),i=t(n.length,1)>>>0;return getUint8ArrayMemory0().subarray(i,i+n.length).set(n),WASM_VECTOR_LEN=n.length,i}for(var a=e.length,o=t(a,1)>>>0,s=getUint8ArrayMemory0(),_=0;_<a;_++){var u=e.charCodeAt(_);if(u>127)break;s[o+_]=u}if(_!==a){0!==_&&(e=e.slice(_)),o=r(o,a,a=_+3*e.length,1)>>>0;var c=getUint8ArrayMemory0().subarray(o+_,o+a);o=r(o,a,_+=cachedTextEncoder.encodeInto(e,c).written,1)>>>0}return WASM_VECTOR_LEN=_,o}var cachedTextDecoder=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});cachedTextDecoder.decode();var MAX_SAFARI_DECODE_BYTES=2146435072,numBytesDecoded=0;function decodeText(e,t){return(numBytesDecoded+=t)>=MAX_SAFARI_DECODE_BYTES&&((cachedTextDecoder=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0})).decode(),numBytesDecoded=t),cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(e,e+t))}var cachedTextEncoder=new TextEncoder;"encodeInto"in cachedTextEncoder||(cachedTextEncoder.encodeInto=function(e,t){var r=cachedTextEncoder.encode(e);return t.set(r),{read:e.length,written:r.length}});var WASM_VECTOR_LEN=0;function eval_expr(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.eval_expr(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function eval_expr_safe(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.eval_expr_safe(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_abs(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_abs(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_ceil(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_ceil(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_compare(e,t){var r=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),n=WASM_VECTOR_LEN,i=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;return wasm.str_compare(r,n,i,a)}function str_cos(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_cos(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_div(e,t){var r,n;try{var i=wasm.__wbindgen_add_to_stack_pointer(-16),a=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),o=WASM_VECTOR_LEN,s=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),_=WASM_VECTOR_LEN;wasm.str_div(i,a,o,s,_);var u=getDataViewMemory0().getInt32(i+0,!0),c=getDataViewMemory0().getInt32(i+4,!0);return r=u,n=c,getStringFromWasm0(u,c)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(r,n,1)}}function str_eq(e,t){var r=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),n=WASM_VECTOR_LEN,i=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;return 0!==wasm.str_eq(r,n,i,a)}function str_exp(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_exp(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_floor(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_floor(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_fract(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_fract(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_gt(e,t){var r=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),n=WASM_VECTOR_LEN,i=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;return 0!==wasm.str_gt(r,n,i,a)}function str_gte(e,t){var r=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),n=WASM_VECTOR_LEN,i=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;return 0!==wasm.str_gte(r,n,i,a)}function str_is_integer(e){var t=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),r=WASM_VECTOR_LEN;return 0!==wasm.str_is_integer(t,r)}function str_is_negative(e){var t=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),r=WASM_VECTOR_LEN;return 0!==wasm.str_is_negative(t,r)}function str_is_positive(e){var t=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),r=WASM_VECTOR_LEN;return 0!==wasm.str_is_positive(t,r)}function str_is_zero(e){var t=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),r=WASM_VECTOR_LEN;return 0!==wasm.str_is_zero(t,r)}function str_ln(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_ln(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_log10(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_log10(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_lt(e,t){var r=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),n=WASM_VECTOR_LEN,i=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;return 0!==wasm.str_lt(r,n,i,a)}function str_lte(e,t){var r=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),n=WASM_VECTOR_LEN,i=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;return 0!==wasm.str_lte(r,n,i,a)}function str_max(e,t){var r,n;try{var i=wasm.__wbindgen_add_to_stack_pointer(-16),a=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),o=WASM_VECTOR_LEN,s=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),_=WASM_VECTOR_LEN;wasm.str_max(i,a,o,s,_);var u=getDataViewMemory0().getInt32(i+0,!0),c=getDataViewMemory0().getInt32(i+4,!0);return r=u,n=c,getStringFromWasm0(u,c)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(r,n,1)}}function str_min(e,t){var r,n;try{var i=wasm.__wbindgen_add_to_stack_pointer(-16),a=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),o=WASM_VECTOR_LEN,s=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),_=WASM_VECTOR_LEN;wasm.str_min(i,a,o,s,_);var u=getDataViewMemory0().getInt32(i+0,!0),c=getDataViewMemory0().getInt32(i+4,!0);return r=u,n=c,getStringFromWasm0(u,c)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(r,n,1)}}function str_mod(e,t){var r,n;try{var i=wasm.__wbindgen_add_to_stack_pointer(-16),a=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),o=WASM_VECTOR_LEN,s=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),_=WASM_VECTOR_LEN;wasm.str_mod(i,a,o,s,_);var u=getDataViewMemory0().getInt32(i+0,!0),c=getDataViewMemory0().getInt32(i+4,!0);return r=u,n=c,getStringFromWasm0(u,c)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(r,n,1)}}function str_mul(e,t){var r,n;try{var i=wasm.__wbindgen_add_to_stack_pointer(-16),a=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),o=WASM_VECTOR_LEN,s=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),_=WASM_VECTOR_LEN;wasm.str_mul(i,a,o,s,_);var u=getDataViewMemory0().getInt32(i+0,!0),c=getDataViewMemory0().getInt32(i+4,!0);return r=u,n=c,getStringFromWasm0(u,c)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(r,n,1)}}function str_neg(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_neg(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_normalize(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_normalize(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_plus(e,t){var r,n;try{var i=wasm.__wbindgen_add_to_stack_pointer(-16),a=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),o=WASM_VECTOR_LEN,s=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),_=WASM_VECTOR_LEN;wasm.str_plus(i,a,o,s,_);var u=getDataViewMemory0().getInt32(i+0,!0),c=getDataViewMemory0().getInt32(i+4,!0);return r=u,n=c,getStringFromWasm0(u,c)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(r,n,1)}}function str_pow(e,t){var r,n;try{var i=wasm.__wbindgen_add_to_stack_pointer(-16),a=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),o=WASM_VECTOR_LEN;wasm.str_pow(i,a,o,t);var s=getDataViewMemory0().getInt32(i+0,!0),_=getDataViewMemory0().getInt32(i+4,!0);return r=s,n=_,getStringFromWasm0(s,_)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(r,n,1)}}function str_powd(e,t){var r,n;try{var i=wasm.__wbindgen_add_to_stack_pointer(-16),a=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),o=WASM_VECTOR_LEN,s=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),_=WASM_VECTOR_LEN;wasm.str_powd(i,a,o,s,_);var u=getDataViewMemory0().getInt32(i+0,!0),c=getDataViewMemory0().getInt32(i+4,!0);return r=u,n=c,getStringFromWasm0(u,c)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(r,n,1)}}function str_round(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_round(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_round_dp(e,t){var r,n;try{var i=wasm.__wbindgen_add_to_stack_pointer(-16),a=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),o=WASM_VECTOR_LEN;wasm.str_round_dp(i,a,o,t);var s=getDataViewMemory0().getInt32(i+0,!0),_=getDataViewMemory0().getInt32(i+4,!0);return r=s,n=_,getStringFromWasm0(s,_)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(r,n,1)}}function str_round_dp_bankers(e,t){var r,n;try{var i=wasm.__wbindgen_add_to_stack_pointer(-16),a=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),o=WASM_VECTOR_LEN;wasm.str_round_dp_bankers(i,a,o,t);var s=getDataViewMemory0().getInt32(i+0,!0),_=getDataViewMemory0().getInt32(i+4,!0);return r=s,n=_,getStringFromWasm0(s,_)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(r,n,1)}}function str_scale(e){var t=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),r=WASM_VECTOR_LEN;return wasm.str_scale(t,r)>>>0}function str_sign(e){var t=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),r=WASM_VECTOR_LEN;return wasm.str_sign(t,r)}function str_sin(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_sin(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_sqrt(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_sqrt(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_sub(e,t){var r,n;try{var i=wasm.__wbindgen_add_to_stack_pointer(-16),a=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),o=WASM_VECTOR_LEN,s=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),_=WASM_VECTOR_LEN;wasm.str_sub(i,a,o,s,_);var u=getDataViewMemory0().getInt32(i+0,!0),c=getDataViewMemory0().getInt32(i+4,!0);return r=u,n=c,getStringFromWasm0(u,c)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(r,n,1)}}function str_tan(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_tan(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_trunc(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_trunc(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}var EXPECTED_RESPONSE_TYPES=new Set(["basic","cors","default"]);function __wbg_load(e,t){return _wbg_load.apply(this,arguments)}function _wbg_load(){return(_wbg_load=_asyncToGenerator(_regenerator().m(function e(t,r){var n,i,a;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:if(!("function"==typeof Response&&t instanceof Response)){e.n=8;break}if("function"!=typeof WebAssembly.instantiateStreaming){e.n=5;break}return e.p=1,e.n=2,WebAssembly.instantiateStreaming(t,r);case 2:case 7:return e.a(2,e.v);case 3:if(e.p=3,a=e.v,!(t.ok&&EXPECTED_RESPONSE_TYPES.has(t.type))||"application/wasm"===t.headers.get("Content-Type")){e.n=4;break}console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",a),e.n=5;break;case 4:throw a;case 5:return e.n=6,t.arrayBuffer();case 6:return n=e.v,e.n=7,WebAssembly.instantiate(n,r);case 8:return e.n=9,WebAssembly.instantiate(t,r);case 9:if(!((i=e.v)instanceof WebAssembly.Instance)){e.n=10;break}return e.a(2,{instance:i,module:t});case 10:return e.a(2,i);case 11:return e.a(2)}},e,null,[[1,3]])}))).apply(this,arguments)}function __wbg_get_imports(){var e={wbg:{}};return e}function __wbg_finalize_init(e,t){return wasm=e.exports,__wbg_init.__wbindgen_wasm_module=t,cachedDataViewMemory0=null,cachedUint8ArrayMemory0=null,wasm}function initSync(e){if(void 0!==wasm)return wasm;void 0!==e&&(Object.getPrototypeOf(e)===Object.prototype?e=e.module:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));var t=__wbg_get_imports();return e instanceof WebAssembly.Module||(e=new WebAssembly.Module(e)),__wbg_finalize_init(new WebAssembly.Instance(e,t),e)}function __wbg_init(e){return _wbg_init.apply(this,arguments)}function _wbg_init(){return(_wbg_init=_asyncToGenerator(_regenerator().m(function e(t){var r,n,i,a,o;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:if(void 0===wasm){e.n=1;break}return e.a(2,wasm);case 1:return void 0!==t&&(Object.getPrototypeOf(t)===Object.prototype?t=t.module_or_path:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),void 0===t&&(t=new URL("wasm_calc_bg.wasm","undefined"==typeof document?require("url").pathToFileURL(__filename).href:_documentCurrentScript&&"SCRIPT"===_documentCurrentScript.tagName.toUpperCase()&&_documentCurrentScript.src||new URL("index.js",document.baseURI).href)),r=__wbg_get_imports(),("string"==typeof t||"function"==typeof Request&&t instanceof Request||"function"==typeof URL&&t instanceof URL)&&(t=fetch(t)),o=__wbg_load,e.n=2,t;case 2:return e.n=3,o(e.v,r);case 3:return n=e.v,i=n.instance,a=n.module,e.a(2,__wbg_finalize_init(i,a))}},e)}))).apply(this,arguments)}var wasm_calc=Object.freeze({__proto__:null,default:__wbg_init,eval_expr:eval_expr,eval_expr_safe:eval_expr_safe,initSync:initSync,str_abs:str_abs,str_ceil:str_ceil,str_compare:str_compare,str_cos:str_cos,str_div:str_div,str_eq:str_eq,str_exp:str_exp,str_floor:str_floor,str_fract:str_fract,str_gt:str_gt,str_gte:str_gte,str_is_integer:str_is_integer,str_is_negative:str_is_negative,str_is_positive:str_is_positive,str_is_zero:str_is_zero,str_ln:str_ln,str_log10:str_log10,str_lt:str_lt,str_lte:str_lte,str_max:str_max,str_min:str_min,str_mod:str_mod,str_mul:str_mul,str_neg:str_neg,str_normalize:str_normalize,str_plus:str_plus,str_pow:str_pow,str_powd:str_powd,str_round:str_round,str_round_dp:str_round_dp,str_round_dp_bankers:str_round_dp_bankers,str_scale:str_scale,str_sign:str_sign,str_sin:str_sin,str_sqrt:str_sqrt,str_sub:str_sub,str_tan:str_tan,str_trunc:str_trunc});exports.abs=abs,exports.add=add,exports.babs=babs,exports.bacos=bacos,exports.bacosh=bacosh,exports.badd=badd,exports.basin=basin,exports.basinh=basinh,exports.batan=batan,exports.batanh=batanh,exports.bcbrt=bcbrt,exports.bceil=bceil,exports.bcompare=bcompare,exports.bcos=bcos,exports.bcosh=bcosh,exports.bdiv=bdiv,exports.beq=beq,exports.bexp=bexp,exports.bfloor=bfloor,exports.bgt=bgt,exports.bgte=bgte,exports.bidiv=bidiv,exports.bln=bln,exports.blog=blog,exports.blog10=blog10,exports.blog2=blog2,exports.blt=blt,exports.blte=blte,exports.bmax=bmax,exports.bmin=bmin,exports.bmod=bmod,exports.bmul=bmul,exports.bneg=bneg,exports.bpow=bpow,exports.bround=bround,exports.bsin=bsin,exports.bsinh=bsinh,exports.bsqrt=bsqrt,exports.bsub=bsub,exports.btan=btan,exports.btanh=btanh,exports.btrunc=btrunc,exports.cadd=cadd,exports.calc=calc,exports.calc_space=calc_space,exports.calc_sum=calc_sum,exports.calc_util=calc_util,exports.calc_wrap=calc_wrap,exports.cdiv=cdiv,exports.cidiv=cidiv,exports.cmod=cmod,exports.cmul=cmul,exports.cpow=cpow,exports.csub=csub,exports.dabs=dabs,exports.dacos=dacos,exports.dacosh=dacosh,exports.dadd=dadd,exports.dasin=dasin,exports.dasinh=dasinh,exports.datan=datan,exports.datanh=datanh,exports.dcbrt=dcbrt,exports.dceil=dceil,exports.dcompare=dcompare,exports.dcos=dcos,exports.dcosh=dcosh,exports.ddiv=ddiv,exports.deq=deq,exports.dexp=dexp,exports.dfloor=dfloor,exports.dgt=dgt,exports.dgte=dgte,exports.didiv=didiv,exports.div=div,exports.dln=dln,exports.dlog=dlog,exports.dlog10=dlog10,exports.dlog2=dlog2,exports.dlt=dlt,exports.dlte=dlte,exports.dmax=dmax,exports.dmin=dmin,exports.dmod=dmod,exports.dmul=dmul,exports.dneg=dneg,exports.dpow=dpow,exports.dround=dround,exports.dsin=dsin,exports.dsinh=dsinh,exports.dsqrt=dsqrt,exports.dsub=dsub,exports.dtan=dtan,exports.dtanh=dtanh,exports.dtrunc=dtrunc,exports.exp=exp,exports.fmt=fmt,exports.get_config=get_config,exports.idiv=idiv,exports.is_wasm_loaded=is_wasm_loaded,exports.ln=ln,exports.load_wasm=load_wasm,exports.mod=mod,exports.mul=mul,exports.neg=neg,exports.parse_thousands=parse_thousands,exports.pow=pow,exports.rabs=rabs,exports.racos=racos,exports.racosh=racosh,exports.radd=radd,exports.rasin=rasin,exports.rasinh=rasinh,exports.ratan=ratan,exports.ratanh=ratanh,exports.rcbrt=rcbrt,exports.rceil=rceil,exports.rcompare=rcompare,exports.rcos=rcos,exports.rcosh=rcosh,exports.rdiv=rdiv,exports.req=req,exports.reset_config=reset_config,exports.rexp=rexp,exports.rfloor=rfloor,exports.rgt=rgt,exports.rgte=rgte,exports.ridiv=ridiv,exports.rln=rln,exports.rlog=rlog,exports.rlog10=rlog10,exports.rlog2=rlog2,exports.rlt=rlt,exports.rlte=rlte,exports.rmax=rmax,exports.rmin=rmin,exports.rmod=rmod,exports.rmul=rmul,exports.rneg=rneg,exports.rpow=rpow,exports.rround=rround,exports.rsin=rsin,exports.rsinh=rsinh,exports.rsqrt=rsqrt,exports.rsub=rsub,exports.rtan=rtan,exports.rtanh=rtanh,exports.rtrunc=rtrunc,exports.set_config=set_config,exports.sqrt=sqrt,exports.sub=sub,exports.version=version,exports.wacos=wacos,exports.wacosh=wacosh,exports.wasin=wasin,exports.wasinh=wasinh,exports.watan=watan,exports.watanh=watanh,exports.wcalc=wcalc,exports.wcbrt=wcbrt,exports.wcosh=wcosh,exports.wlog=wlog,exports.wlog2=wlog2,exports.wsinh=wsinh,exports.wtanh=wtanh;
10
+ */var EXP_LIMIT=9e15,MAX_DIGITS=1e9,NUMERALS="0123456789abcdef",LN10="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",PI="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",DEFAULTS={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-EXP_LIMIT,maxE:EXP_LIMIT,crypto:!1},inexact,quadrant,external=!0,decimalError="[DecimalError] ",invalidArgument=decimalError+"Invalid argument: ",precisionLimitExceeded=decimalError+"Precision limit exceeded",cryptoUnavailable=decimalError+"crypto unavailable",tag="[object Decimal]",mathfloor=Math.floor,mathpow=Math.pow,isBinary=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,isHex=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,isOctal=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,isDecimal=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,BASE=1e7,LOG_BASE=7,MAX_SAFE_INTEGER=9007199254740991,LN10_PRECISION=LN10.length-1,PI_PRECISION=PI.length-1,P={toStringTag:tag};function digitsToString(e){var t,r,n,i=e.length-1,a="",o=e[0];if(i>0){for(a+=o,t=1;t<i;t++)n=e[t]+"",(r=LOG_BASE-n.length)&&(a+=getZeroString(r)),a+=n;o=e[t],(r=LOG_BASE-(n=o+"").length)&&(a+=getZeroString(r))}else if(0===o)return"0";for(;o%10==0;)o/=10;return a+o}function checkInt32(e,t,r){if(e!==~~e||e<t||e>r)throw Error(invalidArgument+e)}function checkRoundingDigits(e,t,r,n){var i,a,o,s;for(a=e[0];a>=10;a/=10)--t;return--t<0?(t+=LOG_BASE,i=0):(i=Math.ceil((t+1)/LOG_BASE),t%=LOG_BASE),a=mathpow(10,LOG_BASE-t),s=e[i]%a|0,null==n?t<3?(0==t?s=s/100|0:1==t&&(s=s/10|0),o=r<4&&99999==s||r>3&&49999==s||5e4==s||0==s):o=(r<4&&s+1==a||r>3&&s+1==a/2)&&(e[i+1]/a/100|0)==mathpow(10,t-2)-1||(s==a/2||0==s)&&!(e[i+1]/a/100|0):t<4?(0==t?s=s/1e3|0:1==t?s=s/100|0:2==t&&(s=s/10|0),o=(n||r<4)&&9999==s||!n&&r>3&&4999==s):o=((n||r<4)&&s+1==a||!n&&r>3&&s+1==a/2)&&(e[i+1]/a/1e3|0)==mathpow(10,t-3)-1,o}function convertBase(e,t,r){for(var n,i,a=[0],o=0,s=e.length;o<s;){for(i=a.length;i--;)a[i]*=t;for(a[0]+=NUMERALS.indexOf(e.charAt(o++)),n=0;n<a.length;n++)a[n]>r-1&&(void 0===a[n+1]&&(a[n+1]=0),a[n+1]+=a[n]/r|0,a[n]%=r)}return a.reverse()}function cosine(e,t){var r,n,i;if(t.isZero())return t;(n=t.d.length)<32?i=(1/tinyPow(4,r=Math.ceil(n/3))).toString():(r=16,i="2.3283064365386962890625e-10"),e.precision+=r,t=taylorSeries(e,1,t.times(i),new e(1));for(var a=r;a--;){var o=t.times(t);t=o.times(o).minus(o).times(8).plus(1)}return e.precision-=r,t}P.absoluteValue=P.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),finalise(e)},P.ceil=function(){return finalise(new this.constructor(this),this.e+1,2)},P.clampedTo=P.clamp=function(e,t){var r=this,n=r.constructor;if(e=new n(e),t=new n(t),!e.s||!t.s)return new n(NaN);if(e.gt(t))throw Error(invalidArgument+t);return r.cmp(e)<0?e:r.cmp(t)>0?t:new n(r)},P.comparedTo=P.cmp=function(e){var t,r,n,i,a=this,o=a.d,s=(e=new a.constructor(e)).d,_=a.s,u=e.s;if(!o||!s)return _&&u?_!==u?_:o===s?0:!o^_<0?1:-1:NaN;if(!o[0]||!s[0])return o[0]?_:s[0]?-u:0;if(_!==u)return _;if(a.e!==e.e)return a.e>e.e^_<0?1:-1;for(t=0,r=(n=o.length)<(i=s.length)?n:i;t<r;++t)if(o[t]!==s[t])return o[t]>s[t]^_<0?1:-1;return n===i?0:n>i^_<0?1:-1},P.cosine=P.cos=function(){var e,t,r=this,n=r.constructor;return r.d?r.d[0]?(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+LOG_BASE,n.rounding=1,r=cosine(n,toLessThanHalfPi(n,r)),n.precision=e,n.rounding=t,finalise(2==quadrant||3==quadrant?r.neg():r,e,t,!0)):new n(1):new n(NaN)},P.cubeRoot=P.cbrt=function(){var e,t,r,n,i,a,o,s,_,u,c=this,l=c.constructor;if(!c.isFinite()||c.isZero())return new l(c);for(external=!1,(a=c.s*mathpow(c.s*c,1/3))&&Math.abs(a)!=1/0?n=new l(a.toString()):(r=digitsToString(c.d),(a=((e=c.e)-r.length+1)%3)&&(r+=1==a||-2==a?"0":"00"),a=mathpow(r,1/3),e=mathfloor((e+1)/3)-(e%3==(e<0?-1:2)),(n=new l(r=a==1/0?"5e"+e:(r=a.toExponential()).slice(0,r.indexOf("e")+1)+e)).s=c.s),o=(e=l.precision)+3;;)if(u=(_=(s=n).times(s).times(s)).plus(c),n=divide(u.plus(c).times(s),u.plus(_),o+2,1),digitsToString(s.d).slice(0,o)===(r=digitsToString(n.d)).slice(0,o)){if("9999"!=(r=r.slice(o-3,o+1))&&(i||"4999"!=r)){+r&&(+r.slice(1)||"5"!=r.charAt(0))||(finalise(n,e+1,1),t=!n.times(n).times(n).eq(c));break}if(!i&&(finalise(s,e+1,0),s.times(s).times(s).eq(c))){n=s;break}o+=4,i=1}return external=!0,finalise(n,e,l.rounding,t)},P.decimalPlaces=P.dp=function(){var e,t=this.d,r=NaN;if(t){if(r=((e=t.length-1)-mathfloor(this.e/LOG_BASE))*LOG_BASE,e=t[e])for(;e%10==0;e/=10)r--;r<0&&(r=0)}return r},P.dividedBy=P.div=function(e){return divide(this,new this.constructor(e))},P.dividedToIntegerBy=P.divToInt=function(e){var t=this.constructor;return finalise(divide(this,new t(e),0,1,1),t.precision,t.rounding)},P.equals=P.eq=function(e){return 0===this.cmp(e)},P.floor=function(){return finalise(new this.constructor(this),this.e+1,3)},P.greaterThan=P.gt=function(e){return this.cmp(e)>0},P.greaterThanOrEqualTo=P.gte=function(e){var t=this.cmp(e);return 1==t||0===t},P.hyperbolicCosine=P.cosh=function(){var e,t,r,n,i,a=this,o=a.constructor,s=new o(1);if(!a.isFinite())return new o(a.s?1/0:NaN);if(a.isZero())return s;r=o.precision,n=o.rounding,o.precision=r+Math.max(a.e,a.sd())+4,o.rounding=1,(i=a.d.length)<32?t=(1/tinyPow(4,e=Math.ceil(i/3))).toString():(e=16,t="2.3283064365386962890625e-10"),a=taylorSeries(o,1,a.times(t),new o(1),!0);for(var _,u=e,c=new o(8);u--;)_=a.times(a),a=s.minus(_.times(c.minus(_.times(c))));return finalise(a,o.precision=r,o.rounding=n,!0)},P.hyperbolicSine=P.sinh=function(){var e,t,r,n,i=this,a=i.constructor;if(!i.isFinite()||i.isZero())return new a(i);if(t=a.precision,r=a.rounding,a.precision=t+Math.max(i.e,i.sd())+4,a.rounding=1,(n=i.d.length)<3)i=taylorSeries(a,2,i,i,!0);else{e=(e=1.4*Math.sqrt(n))>16?16:0|e,i=taylorSeries(a,2,i=i.times(1/tinyPow(5,e)),i,!0);for(var o,s=new a(5),_=new a(16),u=new a(20);e--;)o=i.times(i),i=i.times(s.plus(o.times(_.times(o).plus(u))))}return a.precision=t,a.rounding=r,finalise(i,t,r,!0)},P.hyperbolicTangent=P.tanh=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+7,n.rounding=1,divide(r.sinh(),r.cosh(),n.precision=e,n.rounding=t)):new n(r.s)},P.inverseCosine=P.acos=function(){var e=this,t=e.constructor,r=e.abs().cmp(1),n=t.precision,i=t.rounding;return-1!==r?0===r?e.isNeg()?getPi(t,n,i):new t(0):new t(NaN):e.isZero()?getPi(t,n+4,i).times(.5):(t.precision=n+6,t.rounding=1,e=new t(1).minus(e).div(e.plus(1)).sqrt().atan(),t.precision=n,t.rounding=i,e.times(2))},P.inverseHyperbolicCosine=P.acosh=function(){var e,t,r=this,n=r.constructor;return r.lte(1)?new n(r.eq(1)?0:NaN):r.isFinite()?(e=n.precision,t=n.rounding,n.precision=e+Math.max(Math.abs(r.e),r.sd())+4,n.rounding=1,external=!1,r=r.times(r).minus(1).sqrt().plus(r),external=!0,n.precision=e,n.rounding=t,r.ln()):new n(r)},P.inverseHyperbolicSine=P.asinh=function(){var e,t,r=this,n=r.constructor;return!r.isFinite()||r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+2*Math.max(Math.abs(r.e),r.sd())+6,n.rounding=1,external=!1,r=r.times(r).plus(1).sqrt().plus(r),external=!0,n.precision=e,n.rounding=t,r.ln())},P.inverseHyperbolicTangent=P.atanh=function(){var e,t,r,n,i=this,a=i.constructor;return i.isFinite()?i.e>=0?new a(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=a.precision,t=a.rounding,n=i.sd(),Math.max(n,e)<2*-i.e-1?finalise(new a(i),e,t,!0):(a.precision=r=n-i.e,i=divide(i.plus(1),new a(1).minus(i),r+e,1),a.precision=e+4,a.rounding=1,i=i.ln(),a.precision=e,a.rounding=t,i.times(.5))):new a(NaN)},P.inverseSine=P.asin=function(){var e,t,r,n,i=this,a=i.constructor;return i.isZero()?new a(i):(t=i.abs().cmp(1),r=a.precision,n=a.rounding,-1!==t?0===t?((e=getPi(a,r+4,n).times(.5)).s=i.s,e):new a(NaN):(a.precision=r+6,a.rounding=1,i=i.div(new a(1).minus(i.times(i)).sqrt().plus(1)).atan(),a.precision=r,a.rounding=n,i.times(2)))},P.inverseTangent=P.atan=function(){var e,t,r,n,i,a,o,s,_,u=this,c=u.constructor,l=c.precision,p=c.rounding;if(u.isFinite()){if(u.isZero())return new c(u);if(u.abs().eq(1)&&l+4<=PI_PRECISION)return(o=getPi(c,l+4,p).times(.25)).s=u.s,o}else{if(!u.s)return new c(NaN);if(l+4<=PI_PRECISION)return(o=getPi(c,l+4,p).times(.5)).s=u.s,o}for(c.precision=s=l+10,c.rounding=1,e=r=Math.min(28,s/LOG_BASE+2|0);e;--e)u=u.div(u.times(u).plus(1).sqrt().plus(1));for(external=!1,t=Math.ceil(s/LOG_BASE),n=1,_=u.times(u),o=new c(u),i=u;-1!==e;)if(i=i.times(_),a=o.minus(i.div(n+=2)),i=i.times(_),void 0!==(o=a.plus(i.div(n+=2))).d[t])for(e=t;o.d[e]===a.d[e]&&e--;);return r&&(o=o.times(2<<r-1)),external=!0,finalise(o,c.precision=l,c.rounding=p,!0)},P.isFinite=function(){return!!this.d},P.isInteger=P.isInt=function(){return!!this.d&&mathfloor(this.e/LOG_BASE)>this.d.length-2},P.isNaN=function(){return!this.s},P.isNegative=P.isNeg=function(){return this.s<0},P.isPositive=P.isPos=function(){return this.s>0},P.isZero=function(){return!!this.d&&0===this.d[0]},P.lessThan=P.lt=function(e){return this.cmp(e)<0},P.lessThanOrEqualTo=P.lte=function(e){return this.cmp(e)<1},P.logarithm=P.log=function(e){var t,r,n,i,a,o,s,_,u=this,c=u.constructor,l=c.precision,p=c.rounding;if(null==e)e=new c(10),t=!0;else{if(r=(e=new c(e)).d,e.s<0||!r||!r[0]||e.eq(1))return new c(NaN);t=e.eq(10)}if(r=u.d,u.s<0||!r||!r[0]||u.eq(1))return new c(r&&!r[0]?-1/0:1!=u.s?NaN:r?0:1/0);if(t)if(r.length>1)a=!0;else{for(i=r[0];i%10==0;)i/=10;a=1!==i}if(external=!1,o=naturalLogarithm(u,s=l+5),n=t?getLn10(c,s+10):naturalLogarithm(e,s),checkRoundingDigits((_=divide(o,n,s,1)).d,i=l,p))do{if(o=naturalLogarithm(u,s+=10),n=t?getLn10(c,s+10):naturalLogarithm(e,s),_=divide(o,n,s,1),!a){+digitsToString(_.d).slice(i+1,i+15)+1==1e14&&(_=finalise(_,l+1,0));break}}while(checkRoundingDigits(_.d,i+=10,p));return external=!0,finalise(_,l,p)},P.minus=P.sub=function(e){var t,r,n,i,a,o,s,_,u,c,l,p,d=this,f=d.constructor;if(e=new f(e),!d.d||!e.d)return d.s&&e.s?d.d?e.s=-e.s:e=new f(e.d||d.s!==e.s?d:NaN):e=new f(NaN),e;if(d.s!=e.s)return e.s=-e.s,d.plus(e);if(u=d.d,p=e.d,s=f.precision,_=f.rounding,!u[0]||!p[0]){if(p[0])e.s=-e.s;else{if(!u[0])return new f(3===_?-0:0);e=new f(d)}return external?finalise(e,s,_):e}if(r=mathfloor(e.e/LOG_BASE),c=mathfloor(d.e/LOG_BASE),u=u.slice(),a=c-r){for((l=a<0)?(t=u,a=-a,o=p.length):(t=p,r=c,o=u.length),a>(n=Math.max(Math.ceil(s/LOG_BASE),o)+2)&&(a=n,t.length=1),t.reverse(),n=a;n--;)t.push(0);t.reverse()}else{for((l=(n=u.length)<(o=p.length))&&(o=n),n=0;n<o;n++)if(u[n]!=p[n]){l=u[n]<p[n];break}a=0}for(l&&(t=u,u=p,p=t,e.s=-e.s),o=u.length,n=p.length-o;n>0;--n)u[o++]=0;for(n=p.length;n>a;){if(u[--n]<p[n]){for(i=n;i&&0===u[--i];)u[i]=BASE-1;--u[i],u[n]+=BASE}u[n]-=p[n]}for(;0===u[--o];)u.pop();for(;0===u[0];u.shift())--r;return u[0]?(e.d=u,e.e=getBase10Exponent(u,r),external?finalise(e,s,_):e):new f(3===_?-0:0)},P.modulo=P.mod=function(e){var t,r=this,n=r.constructor;return e=new n(e),!r.d||!e.s||e.d&&!e.d[0]?new n(NaN):!e.d||r.d&&!r.d[0]?finalise(new n(r),n.precision,n.rounding):(external=!1,9==n.modulo?(t=divide(r,e.abs(),0,3,1)).s*=e.s:t=divide(r,e,0,n.modulo,1),t=t.times(e),external=!0,r.minus(t))},P.naturalExponential=P.exp=function(){return naturalExponential(this)},P.naturalLogarithm=P.ln=function(){return naturalLogarithm(this)},P.negated=P.neg=function(){var e=new this.constructor(this);return e.s=-e.s,finalise(e)},P.plus=P.add=function(e){var t,r,n,i,a,o,s,_,u,c,l=this,p=l.constructor;if(e=new p(e),!l.d||!e.d)return l.s&&e.s?l.d||(e=new p(e.d||l.s===e.s?l:NaN)):e=new p(NaN),e;if(l.s!=e.s)return e.s=-e.s,l.minus(e);if(u=l.d,c=e.d,s=p.precision,_=p.rounding,!u[0]||!c[0])return c[0]||(e=new p(l)),external?finalise(e,s,_):e;if(a=mathfloor(l.e/LOG_BASE),n=mathfloor(e.e/LOG_BASE),u=u.slice(),i=a-n){for(i<0?(r=u,i=-i,o=c.length):(r=c,n=a,o=u.length),i>(o=(a=Math.ceil(s/LOG_BASE))>o?a+1:o+1)&&(i=o,r.length=1),r.reverse();i--;)r.push(0);r.reverse()}for((o=u.length)-(i=c.length)<0&&(i=o,r=c,c=u,u=r),t=0;i;)t=(u[--i]=u[i]+c[i]+t)/BASE|0,u[i]%=BASE;for(t&&(u.unshift(t),++n),o=u.length;0==u[--o];)u.pop();return e.d=u,e.e=getBase10Exponent(u,n),external?finalise(e,s,_):e},P.precision=P.sd=function(e){var t,r=this;if(void 0!==e&&e!==!!e&&1!==e&&0!==e)throw Error(invalidArgument+e);return r.d?(t=getPrecision(r.d),e&&r.e+1>t&&(t=r.e+1)):t=NaN,t},P.round=function(){var e=this,t=e.constructor;return finalise(new t(e),e.e+1,t.rounding)},P.sine=P.sin=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+LOG_BASE,n.rounding=1,r=sine(n,toLessThanHalfPi(n,r)),n.precision=e,n.rounding=t,finalise(quadrant>2?r.neg():r,e,t,!0)):new n(NaN)},P.squareRoot=P.sqrt=function(){var e,t,r,n,i,a,o=this,s=o.d,_=o.e,u=o.s,c=o.constructor;if(1!==u||!s||!s[0])return new c(!u||u<0&&(!s||s[0])?NaN:s?o:1/0);for(external=!1,0==(u=Math.sqrt(+o))||u==1/0?(((t=digitsToString(s)).length+_)%2==0&&(t+="0"),u=Math.sqrt(t),_=mathfloor((_+1)/2)-(_<0||_%2),n=new c(t=u==1/0?"5e"+_:(t=u.toExponential()).slice(0,t.indexOf("e")+1)+_)):n=new c(u.toString()),r=(_=c.precision)+3;;)if(n=(a=n).plus(divide(o,a,r+2,1)).times(.5),digitsToString(a.d).slice(0,r)===(t=digitsToString(n.d)).slice(0,r)){if("9999"!=(t=t.slice(r-3,r+1))&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(finalise(n,_+1,1),e=!n.times(n).eq(o));break}if(!i&&(finalise(a,_+1,0),a.times(a).eq(o))){n=a;break}r+=4,i=1}return external=!0,finalise(n,_,c.rounding,e)},P.tangent=P.tan=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+10,n.rounding=1,(r=r.sin()).s=1,r=divide(r,new n(1).minus(r.times(r)).sqrt(),e+10,0),n.precision=e,n.rounding=t,finalise(2==quadrant||4==quadrant?r.neg():r,e,t,!0)):new n(NaN)},P.times=P.mul=function(e){var t,r,n,i,a,o,s,_,u,c=this,l=c.constructor,p=c.d,d=(e=new l(e)).d;if(e.s*=c.s,!(p&&p[0]&&d&&d[0]))return new l(!e.s||p&&!p[0]&&!d||d&&!d[0]&&!p?NaN:p&&d?0*e.s:e.s/0);for(r=mathfloor(c.e/LOG_BASE)+mathfloor(e.e/LOG_BASE),(_=p.length)<(u=d.length)&&(a=p,p=d,d=a,o=_,_=u,u=o),a=[],n=o=_+u;n--;)a.push(0);for(n=u;--n>=0;){for(t=0,i=_+n;i>n;)s=a[i]+d[n]*p[i-n-1]+t,a[i--]=s%BASE|0,t=s/BASE|0;a[i]=(a[i]+t)%BASE|0}for(;!a[--o];)a.pop();return t?++r:a.shift(),e.d=a,e.e=getBase10Exponent(a,r),external?finalise(e,l.precision,l.rounding):e},P.toBinary=function(e,t){return toStringBinary(this,2,e,t)},P.toDecimalPlaces=P.toDP=function(e,t){var r=this,n=r.constructor;return r=new n(r),void 0===e?r:(checkInt32(e,0,MAX_DIGITS),void 0===t?t=n.rounding:checkInt32(t,0,8),finalise(r,e+r.e+1,t))},P.toExponential=function(e,t){var r,n=this,i=n.constructor;return void 0===e?r=finiteToString(n,!0):(checkInt32(e,0,MAX_DIGITS),void 0===t?t=i.rounding:checkInt32(t,0,8),r=finiteToString(n=finalise(new i(n),e+1,t),!0,e+1)),n.isNeg()&&!n.isZero()?"-"+r:r},P.toFixed=function(e,t){var r,n,i=this,a=i.constructor;return void 0===e?r=finiteToString(i):(checkInt32(e,0,MAX_DIGITS),void 0===t?t=a.rounding:checkInt32(t,0,8),r=finiteToString(n=finalise(new a(i),e+i.e+1,t),!1,e+n.e+1)),i.isNeg()&&!i.isZero()?"-"+r:r},P.toFraction=function(e){var t,r,n,i,a,o,s,_,u,c,l,p,d=this,f=d.d,g=d.constructor;if(!f)return new g(d);if(u=r=new g(1),n=_=new g(0),o=(a=(t=new g(n)).e=getPrecision(f)-d.e-1)%LOG_BASE,t.d[0]=mathpow(10,o<0?LOG_BASE+o:o),null==e)e=a>0?t:u;else{if(!(s=new g(e)).isInt()||s.lt(u))throw Error(invalidArgument+s);e=s.gt(t)?a>0?t:u:s}for(external=!1,s=new g(digitsToString(f)),c=g.precision,g.precision=a=f.length*LOG_BASE*2;l=divide(s,t,0,1,1),1!=(i=r.plus(l.times(n))).cmp(e);)r=n,n=i,i=u,u=_.plus(l.times(i)),_=i,i=t,t=s.minus(l.times(i)),s=i;return i=divide(e.minus(r),n,0,1,1),_=_.plus(i.times(u)),r=r.plus(i.times(n)),_.s=u.s=d.s,p=divide(u,n,a,1).minus(d).abs().cmp(divide(_,r,a,1).minus(d).abs())<1?[u,n]:[_,r],g.precision=c,external=!0,p},P.toHexadecimal=P.toHex=function(e,t){return toStringBinary(this,16,e,t)},P.toNearest=function(e,t){var r=this,n=r.constructor;if(r=new n(r),null==e){if(!r.d)return r;e=new n(1),t=n.rounding}else{if(e=new n(e),void 0===t?t=n.rounding:checkInt32(t,0,8),!r.d)return e.s?r:e;if(!e.d)return e.s&&(e.s=r.s),e}return e.d[0]?(external=!1,r=divide(r,e,0,t,1).times(e),external=!0,finalise(r)):(e.s=r.s,r=e),r},P.toNumber=function(){return+this},P.toOctal=function(e,t){return toStringBinary(this,8,e,t)},P.toPower=P.pow=function(e){var t,r,n,i,a,o,s=this,_=s.constructor,u=+(e=new _(e));if(!(s.d&&e.d&&s.d[0]&&e.d[0]))return new _(mathpow(+s,u));if((s=new _(s)).eq(1))return s;if(n=_.precision,a=_.rounding,e.eq(1))return finalise(s,n,a);if((t=mathfloor(e.e/LOG_BASE))>=e.d.length-1&&(r=u<0?-u:u)<=MAX_SAFE_INTEGER)return i=intPow(_,s,r,n),e.s<0?new _(1).div(i):finalise(i,n,a);if((o=s.s)<0){if(t<e.d.length-1)return new _(NaN);if(1&e.d[t]||(o=1),0==s.e&&1==s.d[0]&&1==s.d.length)return s.s=o,s}return(t=0!=(r=mathpow(+s,u))&&isFinite(r)?new _(r+"").e:mathfloor(u*(Math.log("0."+digitsToString(s.d))/Math.LN10+s.e+1)))>_.maxE+1||t<_.minE-1?new _(t>0?o/0:0):(external=!1,_.rounding=s.s=1,r=Math.min(12,(t+"").length),(i=naturalExponential(e.times(naturalLogarithm(s,n+r)),n)).d&&checkRoundingDigits((i=finalise(i,n+5,1)).d,n,a)&&(t=n+10,+digitsToString((i=finalise(naturalExponential(e.times(naturalLogarithm(s,t+r)),t),t+5,1)).d).slice(n+1,n+15)+1==1e14&&(i=finalise(i,n+1,0))),i.s=o,external=!0,_.rounding=a,finalise(i,n,a))},P.toPrecision=function(e,t){var r,n=this,i=n.constructor;return void 0===e?r=finiteToString(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(checkInt32(e,1,MAX_DIGITS),void 0===t?t=i.rounding:checkInt32(t,0,8),r=finiteToString(n=finalise(new i(n),e,t),e<=n.e||n.e<=i.toExpNeg,e)),n.isNeg()&&!n.isZero()?"-"+r:r},P.toSignificantDigits=P.toSD=function(e,t){var r=this.constructor;return void 0===e?(e=r.precision,t=r.rounding):(checkInt32(e,1,MAX_DIGITS),void 0===t?t=r.rounding:checkInt32(t,0,8)),finalise(new r(this),e,t)},P.toString=function(){var e=this,t=e.constructor,r=finiteToString(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?"-"+r:r},P.truncated=P.trunc=function(){return finalise(new this.constructor(this),this.e+1,1)},P.valueOf=P.toJSON=function(){var e=this,t=e.constructor,r=finiteToString(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?"-"+r:r};var divide=function(){function e(e,t,r){var n,i=0,a=e.length;for(e=e.slice();a--;)n=e[a]*t+i,e[a]=n%r|0,i=n/r|0;return i&&e.unshift(i),e}function t(e,t,r,n){var i,a;if(r!=n)a=r>n?1:-1;else for(i=a=0;i<r;i++)if(e[i]!=t[i]){a=e[i]>t[i]?1:-1;break}return a}function r(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=e[r]<t[r]?1:0,e[r]=i*n+e[r]-t[r];for(;!e[0]&&e.length>1;)e.shift()}return function(n,i,a,o,s,_){var u,c,l,p,d,f,g,m,v,h,w,b,y,x,S,E,A,T,D,N,k=n.constructor,O=n.s==i.s?1:-1,P=n.d,M=i.d;if(!(P&&P[0]&&M&&M[0]))return new k(n.s&&i.s&&(P?!M||P[0]!=M[0]:M)?P&&0==P[0]||!M?0*O:O/0:NaN);for(_?(d=1,c=n.e-i.e):(_=BASE,d=LOG_BASE,c=mathfloor(n.e/d)-mathfloor(i.e/d)),D=M.length,A=P.length,h=(v=new k(O)).d=[],l=0;M[l]==(P[l]||0);l++);if(M[l]>(P[l]||0)&&c--,null==a?(x=a=k.precision,o=k.rounding):x=s?a+(n.e-i.e)+1:a,x<0)h.push(1),f=!0;else{if(x=x/d+2|0,l=0,1==D){for(p=0,M=M[0],x++;(l<A||p)&&x--;l++)S=p*_+(P[l]||0),h[l]=S/M|0,p=S%M|0;f=p||l<A}else{for((p=_/(M[0]+1)|0)>1&&(M=e(M,p,_),P=e(P,p,_),D=M.length,A=P.length),E=D,b=(w=P.slice(0,D)).length;b<D;)w[b++]=0;(N=M.slice()).unshift(0),T=M[0],M[1]>=_/2&&++T;do{p=0,(u=t(M,w,D,b))<0?(y=w[0],D!=b&&(y=y*_+(w[1]||0)),(p=y/T|0)>1?(p>=_&&(p=_-1),1==(u=t(g=e(M,p,_),w,m=g.length,b=w.length))&&(p--,r(g,D<m?N:M,m,_))):(0==p&&(u=p=1),g=M.slice()),(m=g.length)<b&&g.unshift(0),r(w,g,b,_),-1==u&&(u=t(M,w,D,b=w.length))<1&&(p++,r(w,D<b?N:M,b,_)),b=w.length):0===u&&(p++,w=[0]),h[l++]=p,u&&w[0]?w[b++]=P[E]||0:(w=[P[E]],b=1)}while((E++<A||void 0!==w[0])&&x--);f=void 0!==w[0]}h[0]||h.shift()}if(1==d)v.e=c,inexact=f;else{for(l=1,p=h[0];p>=10;p/=10)l++;v.e=l+c*d-1,finalise(v,s?a+v.e+1:a,o,f)}return v}}();function finalise(e,t,r,n){var i,a,o,s,_,u,c,l,p,d=e.constructor;e:if(null!=t){if(!(l=e.d))return e;for(i=1,s=l[0];s>=10;s/=10)i++;if((a=t-i)<0)a+=LOG_BASE,o=t,_=(c=l[p=0])/mathpow(10,i-o-1)%10|0;else if((p=Math.ceil((a+1)/LOG_BASE))>=(s=l.length)){if(!n)break e;for(;s++<=p;)l.push(0);c=_=0,i=1,o=(a%=LOG_BASE)-LOG_BASE+1}else{for(c=s=l[p],i=1;s>=10;s/=10)i++;_=(o=(a%=LOG_BASE)-LOG_BASE+i)<0?0:c/mathpow(10,i-o-1)%10|0}if(n=n||t<0||void 0!==l[p+1]||(o<0?c:c%mathpow(10,i-o-1)),u=r<4?(_||n)&&(0==r||r==(e.s<0?3:2)):_>5||5==_&&(4==r||n||6==r&&(a>0?o>0?c/mathpow(10,i-o):0:l[p-1])%10&1||r==(e.s<0?8:7)),t<1||!l[0])return l.length=0,u?(t-=e.e+1,l[0]=mathpow(10,(LOG_BASE-t%LOG_BASE)%LOG_BASE),e.e=-t||0):l[0]=e.e=0,e;if(0==a?(l.length=p,s=1,p--):(l.length=p+1,s=mathpow(10,LOG_BASE-a),l[p]=o>0?(c/mathpow(10,i-o)%mathpow(10,o)|0)*s:0),u)for(;;){if(0==p){for(a=1,o=l[0];o>=10;o/=10)a++;for(o=l[0]+=s,s=1;o>=10;o/=10)s++;a!=s&&(e.e++,l[0]==BASE&&(l[0]=1));break}if(l[p]+=s,l[p]!=BASE)break;l[p--]=0,s=1}for(a=l.length;0===l[--a];)l.pop()}return external&&(e.e>d.maxE?(e.d=null,e.e=NaN):e.e<d.minE&&(e.e=0,e.d=[0])),e}function finiteToString(e,t,r){if(!e.isFinite())return nonFiniteToString(e);var n,i=e.e,a=digitsToString(e.d),o=a.length;return t?(r&&(n=r-o)>0?a=a.charAt(0)+"."+a.slice(1)+getZeroString(n):o>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(e.e<0?"e":"e+")+e.e):i<0?(a="0."+getZeroString(-i-1)+a,r&&(n=r-o)>0&&(a+=getZeroString(n))):i>=o?(a+=getZeroString(i+1-o),r&&(n=r-i-1)>0&&(a=a+"."+getZeroString(n))):((n=i+1)<o&&(a=a.slice(0,n)+"."+a.slice(n)),r&&(n=r-o)>0&&(i+1===o&&(a+="."),a+=getZeroString(n))),a}function getBase10Exponent(e,t){var r=e[0];for(t*=LOG_BASE;r>=10;r/=10)t++;return t}function getLn10(e,t,r){if(t>LN10_PRECISION)throw external=!0,r&&(e.precision=r),Error(precisionLimitExceeded);return finalise(new e(LN10),t,1,!0)}function getPi(e,t,r){if(t>PI_PRECISION)throw Error(precisionLimitExceeded);return finalise(new e(PI),t,r,!0)}function getPrecision(e){var t=e.length-1,r=t*LOG_BASE+1;if(t=e[t]){for(;t%10==0;t/=10)r--;for(t=e[0];t>=10;t/=10)r++}return r}function getZeroString(e){for(var t="";e--;)t+="0";return t}function intPow(e,t,r,n){var i,a=new e(1),o=Math.ceil(n/LOG_BASE+4);for(external=!1;;){if(r%2&&truncate((a=a.times(t)).d,o)&&(i=!0),0===(r=mathfloor(r/2))){r=a.d.length-1,i&&0===a.d[r]&&++a.d[r];break}truncate((t=t.times(t)).d,o)}return external=!0,a}function isOdd(e){return 1&e.d[e.d.length-1]}function maxOrMin(e,t,r){for(var n,i,a=new e(t[0]),o=0;++o<t.length;){if(!(i=new e(t[o])).s){a=i;break}((n=a.cmp(i))===r||0===n&&a.s===r)&&(a=i)}return a}function naturalExponential(e,t){var r,n,i,a,o,s,_,u=0,c=0,l=0,p=e.constructor,d=p.rounding,f=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==t?(external=!1,_=f):_=t,s=new p(.03125);e.e>-2;)e=e.times(s),l+=5;for(_+=n=Math.log(mathpow(2,l))/Math.LN10*2+5|0,r=a=o=new p(1),p.precision=_;;){if(a=finalise(a.times(e),_,1),r=r.times(++c),digitsToString((s=o.plus(divide(a,r,_,1))).d).slice(0,_)===digitsToString(o.d).slice(0,_)){for(i=l;i--;)o=finalise(o.times(o),_,1);if(null!=t)return p.precision=f,o;if(!(u<3&&checkRoundingDigits(o.d,_-n,d,u)))return finalise(o,p.precision=f,d,external=!0);p.precision=_+=10,r=a=s=new p(1),c=0,u++}o=s}}function naturalLogarithm(e,t){var r,n,i,a,o,s,_,u,c,l,p,d=1,f=e,g=f.d,m=f.constructor,v=m.rounding,h=m.precision;if(f.s<0||!g||!g[0]||!f.e&&1==g[0]&&1==g.length)return new m(g&&!g[0]?-1/0:1!=f.s?NaN:g?0:f);if(null==t?(external=!1,c=h):c=t,m.precision=c+=10,n=(r=digitsToString(g)).charAt(0),!(Math.abs(a=f.e)<15e14))return u=getLn10(m,c+2,h).times(a+""),f=naturalLogarithm(new m(n+"."+r.slice(1)),c-10).plus(u),m.precision=h,null==t?finalise(f,h,v,external=!0):f;for(;n<7&&1!=n||1==n&&r.charAt(1)>3;)n=(r=digitsToString((f=f.times(e)).d)).charAt(0),d++;for(a=f.e,n>1?(f=new m("0."+r),a++):f=new m(n+"."+r.slice(1)),l=f,_=o=f=divide(f.minus(1),f.plus(1),c,1),p=finalise(f.times(f),c,1),i=3;;){if(o=finalise(o.times(p),c,1),digitsToString((u=_.plus(divide(o,new m(i),c,1))).d).slice(0,c)===digitsToString(_.d).slice(0,c)){if(_=_.times(2),0!==a&&(_=_.plus(getLn10(m,c+2,h).times(a+""))),_=divide(_,new m(d),c,1),null!=t)return m.precision=h,_;if(!checkRoundingDigits(_.d,c-10,v,s))return finalise(_,m.precision=h,v,external=!0);m.precision=c+=10,u=o=f=divide(l.minus(1),l.plus(1),c,1),p=finalise(f.times(f),c,1),i=s=1}_=u,i+=2}}function nonFiniteToString(e){return String(e.s*e.s/0)}function parseDecimal(e,t){var r,n,i;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),n=0;48===t.charCodeAt(n);n++);for(i=t.length;48===t.charCodeAt(i-1);--i);if(t=t.slice(n,i)){if(i-=n,e.e=r=r-n-1,e.d=[],n=(r+1)%LOG_BASE,r<0&&(n+=LOG_BASE),n<i){for(n&&e.d.push(+t.slice(0,n)),i-=LOG_BASE;n<i;)e.d.push(+t.slice(n,n+=LOG_BASE));t=t.slice(n),n=LOG_BASE-t.length}else n-=i;for(;n--;)t+="0";e.d.push(+t),external&&(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 parseOther(e,t){var r,n,i,a,o,s,_,u,c;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),isDecimal.test(t))return parseDecimal(e,t)}else if("Infinity"===t||"NaN"===t)return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(isHex.test(t))r=16,t=t.toLowerCase();else if(isBinary.test(t))r=2;else{if(!isOctal.test(t))throw Error(invalidArgument+t);r=8}for((a=t.search(/p/i))>0?(_=+t.slice(a+1),t=t.substring(2,a)):t=t.slice(2),o=(a=t.indexOf("."))>=0,n=e.constructor,o&&(a=(s=(t=t.replace(".","")).length)-a,i=intPow(n,new n(r),a,2*a)),a=c=(u=convertBase(t,r,BASE)).length-1;0===u[a];--a)u.pop();return a<0?new n(0*e.s):(e.e=getBase10Exponent(u,c),e.d=u,external=!1,o&&(e=divide(e,i,4*s)),_&&(e=e.times(Math.abs(_)<54?mathpow(2,_):Decimal.pow(2,_))),external=!0,e)}function sine(e,t){var r,n=t.d.length;if(n<3)return t.isZero()?t:taylorSeries(e,2,t,t);r=(r=1.4*Math.sqrt(n))>16?16:0|r,t=taylorSeries(e,2,t=t.times(1/tinyPow(5,r)),t);for(var i,a=new e(5),o=new e(16),s=new e(20);r--;)i=t.times(t),t=t.times(a.plus(i.times(o.times(i).minus(s))));return t}function taylorSeries(e,t,r,n,i){var a,o,s,_,u=e.precision,c=Math.ceil(u/LOG_BASE);for(external=!1,_=r.times(r),s=new e(n);;){if(o=divide(s.times(_),new e(t++*t++),u,1),s=i?n.plus(o):n.minus(o),n=divide(o.times(_),new e(t++*t++),u,1),void 0!==(o=s.plus(n)).d[c]){for(a=c;o.d[a]===s.d[a]&&a--;);if(-1==a)break}a=s,s=n,n=o,o=a}return external=!0,o.d.length=c+1,o}function tinyPow(e,t){for(var r=e;--t;)r*=e;return r}function toLessThanHalfPi(e,t){var r,n=t.s<0,i=getPi(e,e.precision,1),a=i.times(.5);if((t=t.abs()).lte(a))return quadrant=n?4:1,t;if((r=t.divToInt(i)).isZero())quadrant=n?3:2;else{if((t=t.minus(r.times(i))).lte(a))return quadrant=isOdd(r)?n?2:3:n?4:1,t;quadrant=isOdd(r)?n?1:4:n?3:2}return t.minus(i).abs()}function toStringBinary(e,t,r,n){var i,a,o,s,_,u,c,l,p,d=e.constructor,f=void 0!==r;if(f?(checkInt32(r,1,MAX_DIGITS),void 0===n?n=d.rounding:checkInt32(n,0,8)):(r=d.precision,n=d.rounding),e.isFinite()){for(f?(i=2,16==t?r=4*r-3:8==t&&(r=3*r-2)):i=t,(o=(c=finiteToString(e)).indexOf("."))>=0&&(c=c.replace(".",""),(p=new d(1)).e=c.length-o,p.d=convertBase(finiteToString(p),10,i),p.e=p.d.length),a=_=(l=convertBase(c,10,i)).length;0==l[--_];)l.pop();if(l[0]){if(o<0?a--:((e=new d(e)).d=l,e.e=a,l=(e=divide(e,p,r,n,0,i)).d,a=e.e,u=inexact),o=l[r],s=i/2,u=u||void 0!==l[r+1],u=n<4?(void 0!==o||u)&&(0===n||n===(e.s<0?3:2)):o>s||o===s&&(4===n||u||6===n&&1&l[r-1]||n===(e.s<0?8:7)),l.length=r,u)for(;++l[--r]>i-1;)l[r]=0,r||(++a,l.unshift(1));for(_=l.length;!l[_-1];--_);for(o=0,c="";o<_;o++)c+=NUMERALS.charAt(l[o]);if(f){if(_>1)if(16==t||8==t){for(o=16==t?4:3,--_;_%o;_++)c+="0";for(_=(l=convertBase(c,i,t)).length;!l[_-1];--_);for(o=1,c="1.";o<_;o++)c+=NUMERALS.charAt(l[o])}else c=c.charAt(0)+"."+c.slice(1);c=c+(a<0?"p":"p+")+a}else if(a<0){for(;++a;)c="0"+c;c="0."+c}else if(++a>_)for(a-=_;a--;)c+="0";else a<_&&(c=c.slice(0,a)+"."+c.slice(a))}else c=f?"0p+0":"0";c=(16==t?"0x":2==t?"0b":8==t?"0o":"")+c}else c=nonFiniteToString(e);return e.s<0?"-"+c:c}function truncate(e,t){if(e.length>t)return e.length=t,!0}function abs$1(e){return new this(e).abs()}function acos(e){return new this(e).acos()}function acosh(e){return new this(e).acosh()}function add$1(e,t){return new this(e).plus(t)}function asin(e){return new this(e).asin()}function asinh(e){return new this(e).asinh()}function atan(e){return new this(e).atan()}function atanh(e){return new this(e).atanh()}function atan2(e,t){e=new this(e),t=new this(t);var r,n=this.precision,i=this.rounding,a=n+4;return e.s&&t.s?e.d||t.d?!t.d||e.isZero()?(r=t.s<0?getPi(this,n,i):new this(0)).s=e.s:!e.d||t.isZero()?(r=getPi(this,a,1).times(.5)).s=e.s:t.s<0?(this.precision=a,this.rounding=1,r=this.atan(divide(e,t,a,1)),t=getPi(this,a,1),this.precision=n,this.rounding=i,r=e.s<0?r.minus(t):r.plus(t)):r=this.atan(divide(e,t,a,1)):(r=getPi(this,a,1).times(t.s>0?.25:.75)).s=e.s:r=new this(NaN),r}function cbrt(e){return new this(e).cbrt()}function ceil(e){return finalise(e=new this(e),e.e+1,2)}function clamp(e,t,r){return new this(e).clamp(t,r)}function config(e){if(!e||"object"!==_typeof(e))throw Error(decimalError+"Object expected");var t,r,n,i=!0===e.defaults,a=["precision",1,MAX_DIGITS,"rounding",0,8,"toExpNeg",-EXP_LIMIT,0,"toExpPos",0,EXP_LIMIT,"maxE",0,EXP_LIMIT,"minE",-EXP_LIMIT,0,"modulo",0,9];for(t=0;t<a.length;t+=3)if(r=a[t],i&&(this[r]=DEFAULTS[r]),void 0!==(n=e[r])){if(!(mathfloor(n)===n&&n>=a[t+1]&&n<=a[t+2]))throw Error(invalidArgument+r+": "+n);this[r]=n}if(r="crypto",i&&(this[r]=DEFAULTS[r]),void 0!==(n=e[r])){if(!0!==n&&!1!==n&&0!==n&&1!==n)throw Error(invalidArgument+r+": "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw Error(cryptoUnavailable);this[r]=!0}else this[r]=!1}return this}function cos(e){return new this(e).cos()}function cosh(e){return new this(e).cosh()}function clone(e){var t,r,n;function i(e){var t,r,n,a=this;if(!(a instanceof i))return new i(e);if(a.constructor=i,isDecimalInstance(e))return a.s=e.s,void(external?!e.d||e.e>i.maxE?(a.e=NaN,a.d=null):e.e<i.minE?(a.e=0,a.d=[0]):(a.e=e.e,a.d=e.d.slice()):(a.e=e.e,a.d=e.d?e.d.slice():e.d));if("number"===(n=_typeof(e))){if(0===e)return a.s=1/e<0?-1:1,a.e=0,void(a.d=[0]);if(e<0?(e=-e,a.s=-1):a.s=1,e===~~e&&e<1e7){for(t=0,r=e;r>=10;r/=10)t++;return void(external?t>i.maxE?(a.e=NaN,a.d=null):t<i.minE?(a.e=0,a.d=[0]):(a.e=t,a.d=[e]):(a.e=t,a.d=[e]))}return 0*e!=0?(e||(a.s=NaN),a.e=NaN,void(a.d=null)):parseDecimal(a,e.toString())}if("string"===n)return 45===(r=e.charCodeAt(0))?(e=e.slice(1),a.s=-1):(43===r&&(e=e.slice(1)),a.s=1),isDecimal.test(e)?parseDecimal(a,e):parseOther(a,e);if("bigint"===n)return e<0?(e=-e,a.s=-1):a.s=1,parseDecimal(a,e.toString());throw Error(invalidArgument+e)}if(i.prototype=P,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.EUCLID=9,i.config=i.set=config,i.clone=clone,i.isDecimal=isDecimalInstance,i.abs=abs$1,i.acos=acos,i.acosh=acosh,i.add=add$1,i.asin=asin,i.asinh=asinh,i.atan=atan,i.atanh=atanh,i.atan2=atan2,i.cbrt=cbrt,i.ceil=ceil,i.clamp=clamp,i.cos=cos,i.cosh=cosh,i.div=div$1,i.exp=exp$1,i.floor=floor,i.hypot=hypot,i.ln=ln$1,i.log=log,i.log10=log10,i.log2=log2,i.max=max,i.min=min,i.mod=mod$1,i.mul=mul$1,i.pow=pow$1,i.random=random,i.round=round,i.sign=sign,i.sin=sin,i.sinh=sinh,i.sqrt=sqrt$1,i.sub=sub$1,i.sum=sum,i.tan=tan,i.tanh=tanh,i.trunc=trunc,void 0===e&&(e={}),e&&!0!==e.defaults)for(n=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],t=0;t<n.length;)e.hasOwnProperty(r=n[t++])||(e[r]=this[r]);return i.config(e),i}function div$1(e,t){return new this(e).div(t)}function exp$1(e){return new this(e).exp()}function floor(e){return finalise(e=new this(e),e.e+1,3)}function hypot(){var e,t,r=new this(0);for(external=!1,e=0;e<arguments.length;)if((t=new this(arguments[e++])).d)r.d&&(r=r.plus(t.times(t)));else{if(t.s)return external=!0,new this(1/0);r=t}return external=!0,r.sqrt()}function isDecimalInstance(e){return e instanceof Decimal||e&&e.toStringTag===tag||!1}function ln$1(e){return new this(e).ln()}function log(e,t){return new this(e).log(t)}function log2(e){return new this(e).log(2)}function log10(e){return new this(e).log(10)}function max(){return maxOrMin(this,arguments,-1)}function min(){return maxOrMin(this,arguments,1)}function mod$1(e,t){return new this(e).mod(t)}function mul$1(e,t){return new this(e).mul(t)}function pow$1(e,t){return new this(e).pow(t)}function random(e){var t,r,n,i,a=0,o=new this(1),s=[];if(void 0===e?e=this.precision:checkInt32(e,1,MAX_DIGITS),n=Math.ceil(e/LOG_BASE),this.crypto)if(crypto.getRandomValues)for(t=crypto.getRandomValues(new Uint32Array(n));a<n;)(i=t[a])>=429e7?t[a]=crypto.getRandomValues(new Uint32Array(1))[0]:s[a++]=i%1e7;else{if(!crypto.randomBytes)throw Error(cryptoUnavailable);for(t=crypto.randomBytes(n*=4);a<n;)(i=t[a]+(t[a+1]<<8)+(t[a+2]<<16)+((127&t[a+3])<<24))>=214e7?crypto.randomBytes(4).copy(t,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%=LOG_BASE,n&&e&&(i=mathpow(10,LOG_BASE-e),s[a]=(n/i|0)*i);0===s[a];a--)s.pop();if(a<0)r=0,s=[0];else{for(r=-1;0===s[0];r-=LOG_BASE)s.shift();for(n=1,i=s[0];i>=10;i/=10)n++;n<LOG_BASE&&(r-=LOG_BASE-n)}return o.e=r,o.d=s,o}function round(e){return finalise(e=new this(e),e.e+1,this.rounding)}function sign(e){return(e=new this(e)).d?e.d[0]?e.s:0*e.s:e.s||NaN}function sin(e){return new this(e).sin()}function sinh(e){return new this(e).sinh()}function sqrt$1(e){return new this(e).sqrt()}function sub$1(e,t){return new this(e).sub(t)}function sum(){var e=0,t=arguments,r=new this(t[e]);for(external=!1;r.s&&++e<t.length;)r=r.plus(t[e]);return external=!0,finalise(r,this.precision,this.rounding)}function tan(e){return new this(e).tan()}function tanh(e){return new this(e).tanh()}function trunc(e){return finalise(e=new this(e),e.e+1,1)}P[Symbol.for("nodejs.util.inspect.custom")]=P.toString,P[Symbol.toStringTag]="Decimal";var Decimal=P.constructor=clone(DEFAULTS);LN10=new Decimal(LN10),PI=new Decimal(PI);var fmt_group_parsed_cache=new Map;function parse_all_fmt_groups(){fmt_group_parsed_cache.clear();var e=get_config("_fmt_groups")||{};for(var t in e){var r=e[t];if("string"==typeof r)try{var n=fmt_tokenizer(r,null);fmt_group_parsed_cache.set(t,n)}catch(e){console.warn('Failed to parse format group "'.concat(t,'":'),e)}}}function merge_tokens(e){if(!e||0===e.length)return[];var t={mantissa:["number","var"],round:["round"],thousands:["comma","thousands"],sign:["plus"],percent:["percent"],scientific:["scientific"],fraction:["fraction"],volume:["volume"],integer_padding:["integer_padding"],range_clamp:["range_clamp"],unit:["unit_after","unit_before","unit_middle","unit_hide","unit_default"]},r={};for(var n in t){var i,a=_createForOfIteratorHelper(t[n]);try{for(a.s();!(i=a.n()).done;){r[i.value]=n}}catch(e){a.e(e)}finally{a.f()}}for(var o=new Map,s=[],_=0;_<e.length;_++){var u=e[_],c=u.type;if("symbol"!==c)if(s.length>0&&("number"===c||"var"===c))o.set("mantissa",[].concat(_toConsumableArray(s),[u])),s=[];else{if(s.length>0){var l,p=_createForOfIteratorHelper(s);try{for(p.s();!(l=p.n()).done;){var d=l.value,f="symbol_".concat(o.size);o.set(f,d)}}catch(e){p.e(e)}finally{p.f()}s=[]}var g=r[c];if(g)o.set(g,u);else{var m="".concat(c,"_").concat(o.size);o.set(m,u)}}else s.push(u)}if(s.length>0){var v,h=_createForOfIteratorHelper(s);try{for(h.s();!(v=h.n()).done;){var w=v.value,b="symbol_".concat(o.size);o.set(b,w)}}catch(e){h.e(e)}finally{h.f()}}var y,x=[],S=_createForOfIteratorHelper(o.values());try{for(S.s();!(y=S.n()).done;){var E=y.value;Array.isArray(E)?x.push.apply(x,_toConsumableArray(E)):x.push(E)}}catch(e){S.e(e)}finally{S.f()}return x}function expand_fmt_groups(e,t){if(!e||0===e.length)return e;if(!e.some(function(e){return e.type===state_fmt_group}))return e;for(var r=[],n=e.has_var||!1,i=0;i<e.length;i++){var a=e[i];if(a.type===state_fmt_group){var o=a.group_name;if(o){var s=fmt_group_parsed_cache.get(o);s?(r.push.apply(r,_toConsumableArray(s)),s.has_var&&(n=!0)):"undefined"!=typeof console&&console.warn&&console.warn('Format group "'.concat(o,'" not found, ignoring.'))}}else r.push(a)}var _=merge_tokens(r);return n&&(_.has_var=!0),_}on_config_change("_fmt_groups",function(){parse_all_fmt_groups()}),parse_all_fmt_groups();var DEFAULT_COMPACT_UNITS=["","K","M","B","T"],DEFAULT_THOUSANDS_CONFIG={sep:",",point:".",grouping:[3],min_len:0,point_group:!1,fn:null},THOUSANDS_PRESETS={us:{sep:",",point:".",grouping:[3]},eu:{sep:".",point:",",grouping:[3]},swiss:{sep:"'",point:".",grouping:[3]},space:{sep:" ",point:".",grouping:[3]},fr:{sep:" ",point:",",grouping:[3]},indian:{sep:",",point:".",grouping:[3,2]},wan:{sep:",",point:".",grouping:[4]}};function get_thousands_preset(e){if(!e)return null;var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{})._thousands||{};if(t[e])return _objectSpread2(_objectSpread2({},DEFAULT_THOUSANDS_CONFIG),t[e]);var r=get_config("_thousands")||{};return r[e]?_objectSpread2(_objectSpread2({},DEFAULT_THOUSANDS_CONFIG),r[e]):THOUSANDS_PRESETS[e]?_objectSpread2(_objectSpread2({},DEFAULT_THOUSANDS_CONFIG),THOUSANDS_PRESETS[e]):null}function extract_unit_thousands(e){if(!e)return{};var t={};for(var r in e){var n=e[r];if("object"===_typeof(n))for(var i in n._thousands&&!t[r]&&(t[r]=n._thousands),n)if(!i.startsWith("_")){var a=n[i];"object"===_typeof(a)&&a._thousands&&!t[i]&&(t[i]=a._thousands)}}return t}function get_unit_thousands_map(e){var t=extract_unit_thousands(get_unit_mapping(e));return e._unit_thousands_map?_objectSpread2(_objectSpread2({},t),e._unit_thousands_map):t}function extract_unit_compacts(e){if(!e)return{};var t={};for(var r in e){var n=e[r];if("object"===_typeof(n))for(var i in n._compact&&!t[r]&&(t[r]=n._compact),n)if(!i.startsWith("_")){var a=n[i];"object"===_typeof(a)&&a._compact&&!t[r]&&(t[r]=a._compact)}}return t}function get_unit_compact_map(){var e=extract_unit_compacts(get_config("_unit_convert_out")),t=get_config("_unit_compact_map");return t?_objectSpread2(_objectSpread2({},e),t):e}function format_thousands(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=_objectSpread2(_objectSpread2({},DEFAULT_THOUSANDS_CONFIG),t);if(r.fn&&"function"==typeof r.fn){var n=e.startsWith("-"),i=e.startsWith("+"),a="",o=e;(n||i)&&(a=e[0],o=e.slice(1));var s=o.split("."),_={int_part:s[0],dec_part:s[1]||null,sign:a,options:r._options||{}};return r.fn(e,_)}var u=e.replace(/^[+-]/,"").split(".")[0].length;if(r.min_len>0&&u<r.min_len)return"."!==r.point?e.replace(".",r.point):e;var c=e.startsWith("-"),l=e.startsWith("+"),p="",d=e;(c||l)&&(p=e[0],d=e.slice(1));var f=d.split("."),g=f[0],m=f[1];g=apply_grouping(g,r.grouping,r.sep),m&&r.point_group&&(m=apply_grouping_decimal(m,r.grouping,r.sep));var v=p+g;return void 0!==m?v+=r.point+m:r.point,v}function apply_grouping(e,t,r){if(!e||0===e.length)return e;for(var n=[],i=e,a=0;i.length>0;){var o=t[Math.min(a,t.length-1)];if(i.length<=o){n.unshift(i);break}n.unshift(i.slice(-o)),i=i.slice(0,-o),a++}return n.join(r)}function apply_grouping_decimal(e,t,r){if(!e||0===e.length)return e;for(var n=[],i=e,a=0;i.length>0;){var o=t[Math.min(a,t.length-1)];if(i.length<=o){n.push(i);break}n.push(i.slice(0,o)),i=i.slice(o),a++}return n.join(r)}var BUILTIN_PRESETS={default:{units:["","K","M","B","T"],step:1e3},cn:{units:["","千","百万","十亿","万亿"],step:1e3},wan:{units:["","万","亿","万亿"],step:1e4},storage:{units:["B","KB","MB","GB","TB"],step:1024},indian:{units:["","K","L","Cr"],step:[1e3,100,100]}};function get_unit_mapping(e){return e._unit_convert_out&&Object.keys(e._unit_convert_out).length>0?e._unit_convert_out:null}function extract_unit_positions(e){if(!e)return{};var t={};for(var r in e){var n=e[r];if("object"===_typeof(n))for(var i in n._position&&!t[r]&&(t[r]=n._position),n)if("_position"!==i){var a=n[i];"object"===_typeof(a)&&a._position&&!t[i]&&(t[i]=a._position)}}return t}function get_unit_position_map(e){var t=extract_unit_positions(get_unit_mapping(e));return e._unit_position_map?_objectSpread2(_objectSpread2({},t),e._unit_position_map):t}function find_conversion_rule(e,t,r,n){if(!r||!e)return null;var i=r[e];if(!i)return null;if(t){var a=i[t];return void 0!==a?{rule:a,input_unit:t}:null}if(n){var o,s=_createForOfIteratorHelper(Array.isArray(n)?n:[n]);try{for(s.s();!(o=s.n()).done;){var _=o.value;if(void 0!==i[_])return{rule:i[_],input_unit:_}}}catch(e){s.e(e)}finally{s.f()}}var u=Object.keys(i).filter(function(e){return!e.startsWith("_")});return 1===u.length?{rule:i[u[0]],input_unit:u[0]}:null}function apply_conversion_rule(e,t,r,n){if(null==t)return e;var i=new Decimal(e);return"number"==typeof t?i.times(t).toFixed():"function"==typeof t?String(t(Number(e),r,n)):"object"===_typeof(t)?t.fn&&"function"==typeof t.fn?String(t.fn(Number(e),r,n)):(void 0!==t.mul?i=i.times(t.mul):void 0!==t.div?i=i.div(t.div):void 0!==t.add?i=i.plus(t.add):void 0!==t.sub&&(i=i.minus(t.sub)),i.toFixed()):e}function get_unit_info_from_tokens(e){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(!e)return null;var n,i=_createForOfIteratorHelper(e);try{for(i.s();!(n=i.n()).done;){var a=n.value;if("unit_after"===a.type||"unit_before"===a.type||"unit_middle"===a.type){var o=a.unit;if(a.use_default&&!o&&!(o=r)){var s=get_config("_unit_default_out");o=Array.isArray(s)?s[0]:s}return{output_unit:o,input_unit:a.input_unit,position:"unit_after"===a.type?"after":"unit_before"===a.type?"before":"middle",show_unit:!0,keep_recognized:a.use_default}}if("unit_hide"===a.type)return{output_unit:a.unit,input_unit:a.input_unit,position:null,show_unit:!1};if("unit_default"===a.type){var _=t[a.unit]||get_config("_unit_default_position")||"after";return{output_unit:a.unit,input_unit:a.input_unit,position:_,show_unit:!0}}if("to-number-string"===a.type)return a.output_unit?{output_unit:a.output_unit,input_unit:a.input_unit,position:null,show_unit:!1}:{output_unit:null,input_unit:null,position:null,show_unit:!1,no_conversion:!0}}}catch(e){i.e(e)}finally{i.f()}return null}function apply_unit(e,t,r,n){if(!t)return e;var i=e.startsWith("-"),a=e.startsWith("+"),o="",s=e;switch((i||a)&&(o=e[0],s=e.slice(1)),r){case"after":default:return o+s+t;case"before":return t+o+s;case"middle":return o?o+t+s:t+s}}function format_compact(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=r._compact_preset,i=r._current_unit,a=DEFAULT_COMPACT_UNITS,o=1e3,s=null;if(r._compact_units||r._compact_step)a=r._compact_units&&r._compact_units.length>0?r._compact_units:DEFAULT_COMPACT_UNITS,o=r._compact_step||1e3;else if(n){var _=(get_config("_compact")||{})[n]||BUILTIN_PRESETS[n];_&&("function"==typeof _?s=_:Array.isArray(_)?(a=_,o=1e3):(a=_.units||a,o=void 0!==_.step?_.step:o))}else if(i){var u=get_unit_compact_map(),c=!1;if(u&&u[i]){var l=u[i],p=(get_config("_compact")||{})[l]||BUILTIN_PRESETS[l];p&&(c=!0,"function"==typeof p?s=p:Array.isArray(p)?(a=p,o=1e3):(a=p.units||a,o=void 0!==p.step?p.step:o))}if(!c){var d=get_config("_compact_default");if(d){var f=(get_config("_compact")||{})[d]||BUILTIN_PRESETS[d];f&&("function"==typeof f?s=f:Array.isArray(f)?(a=f,o=1e3):(a=f.units||a,o=void 0!==f.step?f.step:o))}}}else{var g=get_config("_compact_default");if(g){var m=(get_config("_compact")||{})[g]||BUILTIN_PRESETS[g];m&&("function"==typeof m?s=m:Array.isArray(m)?(a=m,o=1e3):(a=m.units||a,o=void 0!==m.step?m.step:o))}}if(s){var v=s(e,{decimals:t,options:r,current_unit:i});return"object"===_typeof(v)&&null!==v?{sign:v.sign||"",number:v.number||"0",unit:v.unit||"",formatted:v.formatted||(v.sign||"")+(v.number||"0")+(v.unit||"")}:"string"==typeof v?{sign:"",number:v,unit:"",formatted:v}:{sign:"",number:e,unit:"",formatted:e}}var h=e.startsWith("-"),w=e.startsWith("+"),b="",y=e;(h||w)&&(b=e[0],y=e.slice(1));for(var x=new Decimal(y),S=0,E=Array.isArray(o);S<a.length-1;){var A=E?o[S]||o[o.length-1]:o;if(!x.gte(A))break;x=x.div(A),S++}var T=x.toFixed(t,Decimal.ROUND_DOWN);return T.includes(".")&&(T=T.replace(/\.?0+$/,"")),{sign:b,number:T,unit:a[S],formatted:b+T+a[S]}}function pad_integer(e,t){if(t<=0)return e;var r=e.startsWith("-"),n=e.startsWith("+"),i="",a=e;(r||n)&&(i=e[0],a=e.slice(1));var o=a.split("."),s=o[0],_=o[1];s.length<t&&(s="0".repeat(t-s.length)+s);var u=i+s;return void 0!==_&&(u+="."+_),u}function format(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t=expand_fmt_groups(t,r._fill_data||r);var n="";if("undefined"===(n=Decimal.isDecimal(e)?e.toFixed():"string"==typeof e?e:e.toString())||"NaN"===n)return[void 0,{}];var i=get_unit_mapping(r),a=get_unit_position_map(r),o=r._recognized_unit||null,s=get_unit_info_from_tokens(t,r,a,o),_=null,u=null,c=!1,l=!1;if(s){var p=s.output_unit,d=s.input_unit,f=s.position,g=s.show_unit,m=s.no_conversion,v=s.keep_recognized;if(!m&&i){var h=v&&o?o:p||o||get_config("_unit_default_out");if(h){var w=find_conversion_rule(h,d||o||null,i,get_config("_unit_default_in"));w&&(n=apply_conversion_rule(n,w.rule,w.input_unit,h),_=h,l=!0)}}g?(v&&o?_=o:_||(_=p||o),u=f,c=!0,l=!0):m&&(l=!0)}else o&&(_=o,u=a[o]||get_config("_unit_default_position")||"after",c=!0,l=!0);var b={mantissa:null,mantissa_type:null,mantissa_min:null,mantissa_max:null,thousands:!1,thousands_preset:null,sign:!1,round:"~-",scientific:!1,fraction:!1,percent:!1,to_number:!1,to_number_string:!1,integer_padding:null,compact:!1,compact_preset:null,unit_format:null,unit_value:null,unit_input:null,range_clamp_min:null,range_clamp_max:null},y=[],x=[];t.forEach(function(e,t){"symbol"===e.type?y.push({value:e.value,index:t}):"number"!==e.type&&"var"!==e.type||x.push({value:"var"===e.type?e.real_value:e.value,index:t})});var S=y.find(function(e){return">="===e.value||">"===e.value}),E=y.find(function(e){return"<="===e.value||"<"===e.value});if(S&&E)for(var A=function(){var e=y[T],t=x.find(function(t){return t.index>e.index});t&&(">="===e.value||">"===e.value?b.mantissa_min=+t.value:"<="!==e.value&&"<"!==e.value||(b.mantissa_max=+t.value))},T=0;T<y.length;T++)A();if(t.forEach(function(e){var t=e.type;if("symbol"===t){if(![">=","<=","=","<",">"].includes(e.value))throw new Error("错误的格式化参数:",e.value);S&&E||(b.mantissa_type=e.value)}else if("to-number"===t)b.to_number=!0;else if("to-number-string"===t)b.to_number_string=!0;else if("comma"===t)b.thousands=!0;else if("number"===t)S&&E||(b.mantissa=e.value);else if("var"===t)S&&E||(b.mantissa=e.real_value);else if("plus"===t)b.sign=!0;else if("round"===t)b.round=e.value;else if("fraction"===t)b.fraction=!0;else if("scientific"===t)b.scientific=!0;else if("percent"===t)b.percent=!0;else if("integer_padding"===t)b.integer_padding=void 0!==e.real_value?+e.real_value:+e.value;else if("compact"===t)b.compact=!0,e.preset&&(b.compact_preset=e.preset);else if("unit_after"===t)b.unit_format="after",b.unit_value=e.unit,b.unit_input=e.input_unit;else if("unit_before"===t)b.unit_format="before",b.unit_value=e.unit,b.unit_input=e.input_unit;else if("unit_middle"===t)b.unit_format="middle",b.unit_value=e.unit,b.unit_input=e.input_unit;else if("unit_hide"===t)b.unit_format=null,b.unit_value=e.unit,b.unit_input=e.input_unit;else if("unit_default"===t){var r=get_config("_unit_default_position")||"after";b.unit_format=r,b.unit_value=e.unit,b.unit_input=e.input_unit}else if("thousands"===t)b.thousands=!0,b.thousands_preset=e.preset;else{if("range_clamp"!==t)throw new Error("错误的fmt Token");b.range_clamp_min=e.min,b.range_clamp_max=e.max}}),null!==b.range_clamp_min||null!==b.range_clamp_max){var D=new Decimal(n);if(null!==b.range_clamp_min){var N=new Decimal(b.range_clamp_min);D.lt(N)&&(D=N)}if(null!==b.range_clamp_max){var k=new Decimal(b.range_clamp_max);D.gt(k)&&(D=k)}n=D.toFixed()}if(b.to_number){var O=parse_mantissa(n,b.mantissa_type,b.mantissa,b.round);return b.integer_padding&&(O=pad_integer(O,b.integer_padding)),[+O,b]}if(b.scientific){var P=new Decimal(n).toExponential();return[b.sign&&!P.startsWith("-")?"+"+P:P,b]}if(b.fraction){var M=new Decimal(n).toFraction(),I=M[0].toString()+"/"+M[1].toString();return[b.sign&&!I.startsWith("-")?"+"+I:I,b]}if(b.compact){var L=format_compact(n,null!==b.mantissa?+b.mantissa:2,_objectSpread2(_objectSpread2({},r),{},{_compact_preset:b.compact_preset,_current_unit:_})),W=L.sign,C=L.unit;n=L.number,b._compact_formatted=!0,b._compact_sign=W,b._compact_unit_suffix=C}if(b.percent&&(n=new Decimal(n).times(100).toFixed()),null!==b.mantissa_min&&null!==b.mantissa_max){var j=n.includes(".")?n.split(".")[1].length:0;j<b.mantissa_min?n=parse_mantissa(n,">=",b.mantissa_min,b.round):j>b.mantissa_max?n=parse_mantissa(n,"<=",b.mantissa_max,b.round):n.includes(".")&&(n=n.replace(/0*$/,"").replace(/\.$/,""))}else null===b.mantissa?n.includes(".")&&(n=n.replace(/0*$/,"")):n=parse_mantissa(n,b.mantissa_type,b.mantissa,b.round);if(b.integer_padding&&(n=pad_integer(n,b.integer_padding)),b.thousands){var F=null;if(b.thousands_preset)F=get_thousands_preset(b.thousands_preset,r);else if(_){var q=get_unit_thousands_map(r)[_];q&&(F=get_thousands_preset(q,r))}if(!F){var R=get_config("_thousands_default");R&&(F=get_thousands_preset(R,r))}F?(F._options=r,n=format_thousands(n,F)):n=parse_thousands(n)}return b._compact_formatted&&(b.sign&&!b._compact_sign&&(n="+"+n),n=b._compact_sign+n+b._compact_unit_suffix),b.sign&&!b._compact_formatted&&(b.to_number=!1,n.startsWith("-")||(n="+"+n)),b.percent&&(n+="%"),c&&_&&u&&(n=apply_unit(n,_,u,b.sign)),b.unit_handled=l,[n,b]}var _calc$1=null;function register_calc(e){_calc$1=e}function get_calc$1(){if(!_calc$1)throw new Error("calc function not registered");return _calc$1}function calc_wrap(e,t){var r=get_calc$1(),n={_error:"-"};return["string","number"].includes(_typeof(e))?void 0===t?/[a-zA-Z$_]/.test(e.toString())?function(t){return Array.isArray(t)?t.unshift(n):t=_objectSpread2(_objectSpread2({},n),t),r(e,t)}:r(e):(Array.isArray(t)?t.unshift(n):t=_objectSpread2(_objectSpread2({},n),t),r(e,t)):(Array.isArray(e)?e.unshift(n):e=_objectSpread2(_objectSpread2({},n),e),function(t){return r(t,e)})}function check_version(){return _check_version.apply(this,arguments)}function _check_version(){return _check_version=_asyncToGenerator(_regenerator().m(function _callee(){var res,code,versions,last_version,larr,varr,script,url;return _regenerator().w(function(_context){for(;;)switch(_context.n){case 0:if("undefined"==typeof process||"node"!==process.release.name){_context.n=4;break}if(!(parseInt(process.versions.node)>=17)){_context.n=3;break}return _context.n=1,promise_queue([fetch("https://cdn.jsdelivr.net/npm/a-calc@latest/a-calc.versions.js"),fetch("https://unpkg.com/a-calc@latest/a-calc.versions.js")]);case 1:return res=_context.v,_context.n=2,res.text();case 2:code=_context.v,versions=eval(code),last_version=versions.at(-1),larr=last_version.match(/(\d+)\.(\d+)\.(\d+)/),larr.shift(),larr=larr.map(function(e){return parseInt(e)}),varr=version.match(/(\d+)\.(\d+)\.(\d+)/),varr.shift(),varr=varr.map(function(e){return parseInt(e)}),(larr[0]>varr[0]||larr[0]===varr[0]&&larr[1]>varr[1]||larr[0]===varr[0]&&larr[1]===varr[1]&&larr[2]>varr[2])&&console.warn("a-calc has a new version:",last_version);case 3:_context.n=6;break;case 4:return script=document.createElement("script"),script.onload=function(){var e=a_calc_versions;if(Array.isArray(e)){var t=e.at(-1),r=t.match(/(\d+)\.(\d+)\.(\d+)/);r.shift(),r=r.map(function(e){return parseInt(e)});var n=version.match(/(\d+)\.(\d+)\.(\d+)/);n.shift(),n=n.map(function(e){return parseInt(e)}),(r[0]>n[0]||r[0]===n[0]&&r[1]>n[1]||r[0]===n[0]&&r[1]===n[1]&&r[2]>n[2])&&console.log("%c↑↑↑ a-calc has a new version: %s ↑↑↑","color: #67C23A;",t)}},_context.n=5,test_urls(["https://cdn.jsdelivr.net/npm/a-calc@latest/a-calc.versions.js","https://unpkg.com/a-calc@latest/a-calc.versions.js"]);case 5:url=_context.v,url?(script.src=url,document.body.appendChild(script)):script=null;case 6:return _context.a(2)}},_callee)})),_check_version.apply(this,arguments)}var operator=new Set(["+","-","*","/","%","**","//"]);function detect_fallback_var(e,t){if("("!==e[t])return null;for(var r=0,n=!1,i=[],a="",o=t;o<e.length;){var s=e[o];if("("===s){if(0===r){r++,o++;continue}r++,a+=s}else if(")"===s){if(0===--r)return n?(i.push(a.trim()),{paths:i,end_index:o}):null;a+=s}else"|"===s&&1===r?(n=!0,i.push(a.trim()),a=""):a+=s;o++}return null}function push_token(e,t,r){if(Number.isNaN(Number(t)))if("-"===t||"+"===t)e.push({type:"operator",value:t});else if(operator.has(t))e.push({type:"operator",value:t});else if(r._unit&&/^[+-]?\d/.test(t)){var n,i=split_unit_num(t),a=i.num,o=i.unit;if(void 0===o)e.push({type:"number",value:a,real_value:a,has_unit:!1});else r.has_unit=!0,null!==(n=r.unit_str)&&void 0!==n||(r.unit_str=o),e.push({type:"number",value:a,real_value:a,has_unit:!0,unit:o})}else if(var_first_char_set.has(t[0])){r.has_var=!0;var s=get_real_value(r.fill_data,t);if(r._unit){var _,u=split_unit_num(s),c=u.num,l=u.unit;if(void 0===l)e.push({type:"var",value:t,real_value:c,has_unit:!1});else r.has_unit=!0,null!==(_=r.unit_str)&&void 0!==_||(r.unit_str=l),e.push({type:"var",value:t,real_value:c,has_unit:!0,unit:l})}else e.push({type:"var",value:t,real_value:s,has_unit:!1})}else{if(!/^[+-]?\d/.test(t))throw new Error("无法识别的标识符:".concat(t));var p=t.indexOf("e");-1!==p&&/^\d+$/.test(t.slice(p+1))&&e.push({type:"number",value:t,real_value:t,has_unit:!1})}else e.push({type:"number",value:t,real_value:t,has_unit:!1})}function tokenizer_space(e,t,r,n){for(var i,a=0,o=0,s=e.length,_=[],u={has_var:!1,has_unit:!1,unit_str:void 0,_unit:r,fill_data:t};o<s;){if(" "===(i=e[o]))o>a&&push_token(_,e.slice(a,o),u),a=o+1;else if("("===i){var c=detect_fallback_var(e,o);if(c){o>a&&push_token(_,e.slice(a,o),u),u.has_var=!0;var l=get_fallback_value(t,c.paths,n),p=l.value,d=l.path;if(r){var f,g=split_unit_num(p),m=g.num,v=g.unit;if(void 0!==v)u.has_unit=!0,null!==(f=u.unit_str)&&void 0!==f||(u.unit_str=v),_.push({type:state_fallback_var,value:c.paths,real_value:m,matched_path:d,has_unit:!0,unit:v});else _.push({type:state_fallback_var,value:c.paths,real_value:m,matched_path:d,has_unit:!1})}else _.push({type:state_fallback_var,value:c.paths,real_value:p,matched_path:d,has_unit:!1});a=o=c.end_index+1;continue}_.push({type:state_bracket,value:"("}),a=o+1}else")"===i&&(o>a&&push_token(_,e.slice(a,o),u),_.push({type:state_bracket,value:")"}),a=o+1);o++}return o>a&&push_token(_,e.slice(a,o),u),_.has_var=u.has_var,_.has_unit=u.has_unit,_.unit=u.unit_str,_}function to_decimal(e){return e instanceof Decimal?e:new Decimal("boolean"==typeof e?e?1:0:e)}function is_decimal(e){return e instanceof Decimal}function compute(e,t,r){if(void 0===e||void 0===t)throw new Error("无效的操作数对:v1:".concat(e,", v2:").concat(t));var n=to_decimal(e),i=to_decimal(t);switch(r){case"+":return n.plus(i);case"-":return n.minus(i);case"*":return n.times(i);case"/":return n.div(i);case"%":return n.mod(i);case"**":return n.pow(i);case"//":return n.divToInt(i);default:throw new Error("未知的运算符: ".concat(r))}}function compare(e,t,r){if(void 0===e||void 0===t)throw new Error("无效的操作数对:v1:".concat(e,", v2:").concat(t));var n=to_decimal(e),i=to_decimal(t);switch(r){case">":return n.gt(i);case"<":return n.lt(i);case">=":return n.gte(i);case"<=":return n.lte(i);case"==":return n.eq(i);case"!=":return!n.eq(i);default:throw new Error("未知的比较运算符: ".concat(r))}}function logical(e,t,r){var n=function(e){return"boolean"==typeof e?e:e instanceof Decimal?!e.isZero():"number"==typeof e?0!==e:"string"==typeof e?""!==e&&"0"!==e:Boolean(e)},i=n(e);switch(r){case"&&":return!!i&&n(t);case"||":return!!i||n(t);default:throw new Error("未知的逻辑运算符: ".concat(r))}}function logical_not(e){var t;return!("boolean"==typeof(t=e)?t:t instanceof Decimal?!t.isZero():"number"==typeof t?0!==t:"string"==typeof t?""!==t&&"0"!==t:Boolean(t))}function _to_rad(e){return"rad"===get_config("_angle_unit")?e:new Decimal(e).times(Decimal.acos(-1)).div(180)}function _to_deg(e){return"rad"===get_config("_angle_unit")?e:new Decimal(e).times(180).div(Decimal.acos(-1))}var _SIN_TABLE={0:new Decimal(0),30:new Decimal("0.5"),45:new Decimal(2).sqrt().div(2),60:new Decimal(3).sqrt().div(2),90:new Decimal(1),180:new Decimal(0),270:new Decimal(-1),360:new Decimal(0)},_COS_TABLE={0:new Decimal(1),30:new Decimal(3).sqrt().div(2),45:new Decimal(2).sqrt().div(2),60:new Decimal("0.5"),90:new Decimal(0),180:new Decimal(-1),270:new Decimal(0),360:new Decimal(1)},_TAN_TABLE={0:new Decimal(0),30:new Decimal(3).sqrt().div(3),45:new Decimal(1),60:new Decimal(3).sqrt(),180:new Decimal(0),360:new Decimal(0)};function _normalize_angle(e){var t=new Decimal(e).mod(360);return t.isNegative()?t.plus(360):t}var _builtin_functions={sin:function(e){if("deg"===get_config("_angle_unit")){var t=_normalize_angle(e).toNumber();if(void 0!==_SIN_TABLE[t])return _SIN_TABLE[t];if(t>180){var r=_SIN_TABLE[360-t];if(void 0!==r)return r.negated()}if(t>90&&t<=180){var n=_SIN_TABLE[180-t];if(void 0!==n)return n}}var i=_to_rad(e);return Decimal.sin(i)},cos:function(e){if("deg"===get_config("_angle_unit")){var t=_normalize_angle(e).toNumber();if(void 0!==_COS_TABLE[t])return _COS_TABLE[t];if(t>180){var r=_COS_TABLE[360-t];if(void 0!==r)return r}if(t>90&&t<=180){var n=_COS_TABLE[180-t];if(void 0!==n)return n.negated()}}var i=_to_rad(e);return Decimal.cos(i)},tan:function(e){if("deg"===get_config("_angle_unit")){var t=_normalize_angle(e).toNumber();if(90===t||270===t)throw new Error("tan() undefined at 90° and 270°");if(void 0!==_TAN_TABLE[t])return _TAN_TABLE[t]}var r=_to_rad(e);return Decimal.tan(r)},asin:function(e){return _to_deg(Decimal.asin(e))},acos:function(e){return _to_deg(Decimal.acos(e))},atan:function(e){return _to_deg(Decimal.atan(e))},atan2:function(e,t){return _to_deg(Decimal.atan2(e,t))},sinh:function(e){return Decimal.sinh(e)},cosh:function(e){return Decimal.cosh(e)},tanh:function(e){return Decimal.tanh(e)},asinh:function(e){return Decimal.asinh(e)},acosh:function(e){return Decimal.acosh(e)},atanh:function(e){return Decimal.atanh(e)},exp:function(e){return Decimal.exp(e)},log:function(e){return Decimal.ln(e)},ln:function(e){return Decimal.ln(e)},log10:function(e){return Decimal.log10(e)},log2:function(e){return Decimal.log2(e)},sqrt:function(e){return new Decimal(e).sqrt()},cbrt:function(e){return new Decimal(e).cbrt()},pow:function(e,t){return new Decimal(e).pow(t)},floor:function(e){return new Decimal(e).floor()},ceil:function(e){return new Decimal(e).ceil()},round:function(e){return new Decimal(e).round()},trunc:function(e){return new Decimal(e).trunc()},abs:function(e){return new Decimal(e).abs()},sign:function(e){return new Decimal(e).isPositive()?new Decimal(1):new Decimal(e).isNegative()?new Decimal(-1):new Decimal(0)},max:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(0===t.length)throw new Error("max() requires at least one argument");return t.reduce(function(e,t){var r=new Decimal(t);return r.gt(e)?r:e},new Decimal(t[0]))},min:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(0===t.length)throw new Error("min() requires at least one argument");return t.reduce(function(e,t){var r=new Decimal(t);return r.lt(e)?r:e},new Decimal(t[0]))},clamp:function(e,t,r){var n=new Decimal(e),i=new Decimal(t),a=new Decimal(r);return n.lt(i)?i:n.gt(a)?a:n},random:function(){return new Decimal(Math.random())},pi:function(){return Decimal.acos(-1)},e:function(){return Decimal.exp(1)},if:function(e,t,r){var n;return("boolean"==typeof(n=e)?n:n instanceof Decimal?!n.isZero():"number"==typeof n?0!==n:Boolean(n))?t:r}};function get_function(e,t){if(t){var r,n=_createForOfIteratorHelper(Array.isArray(t)?t:[t]);try{for(n.s();!(r=n.n()).done;){var i=r.value;if(i&&"function"==typeof i[e])return i[e]}}catch(e){n.e(e)}finally{n.f()}}var a=get_config("_builtin_functions");return a&&a[e]?a[e]:null}function is_comparison_op(e){return comparison_operators.has(e)}function is_logical_op(e){return logical_operators.has(e)}function is_arithmetic_op(e){return["+","-","*","/","%","**","//"].includes(e)}function get_precedence(e){var t;return null!==(t=operator_precedence[e])&&void 0!==t?t:-1}function execute_op(e,t,r){if(is_comparison_op(r))return compare(e,t,r);if(is_logical_op(r))return logical(e,t,r);if(is_arithmetic_op(r))return compute(e,t,r);throw new Error("未知的运算符: ".concat(r))}function eval_tokens(e){if(1===e.length){var t=e[0];if("number"===t.type||"var"===t.type||"fallback_var"===t.type)return new Decimal(t.real_value);if("boolean"===t.type)return t.value;if("string"===t.type)return t.value;if("function"===t.type){var r=t.value,n=t.fn||get_function(r,e._fill_data);if(!n)throw new Error("未知的函数: ".concat(r));var i=t.args.map(function(t){var r=tokenizer(t,e._fill_data,e._unit,e._options);return r._fill_data=e._fill_data,r._unit=e._unit,r._options=e._options,eval_tokens(r)});return n.apply(void 0,_toConsumableArray(i))}throw new Error("错误的表达式:".concat(t.value))}for(var a,o=[],s=[],_={active:!1,lastValue:null},u=0,c=e.length;u<c;u++)if("number"!==(a=e[u]).type&&"var"!==a.type&&"fallback_var"!==a.type)if("boolean"!==a.type)if("string"!==a.type)if("function"!==a.type)if("logical_not"!==a.type)if("ternary_question"!==a.type&&"?"!==a.value)if("ternary_colon"!==a.type&&":"!==a.value)if("operator"!==a.type&&"comparison"!==a.type&&"logical"!==a.type)if("("!==a.value)if(")"!==a.value)"function_result"!==a.type||s.push(a.value);else for(;o.length>0;){var l=o.pop();if("("===l){if(o.length>0&&("-"===o[o.length-1]||"+"===o[o.length-1])){var p=o[o.length-1],d=o.length>1?o[o.length-2]:null;if(null===d&&1===s.length||"("===d&&1===s.length||["+","-","*","/","%","**","//","?",":"].includes(d))if("-"===p){o.pop();var f=s.pop();is_decimal(f)?s.push(f.negated()):"number"==typeof f?s.push(-f):"boolean"==typeof f?s.push(!f):s.push(new Decimal(f).negated())}else"+"===p&&o.pop()}else{var g=s[s.length-2];if("-"===g){var m=s.pop();s.pop(),is_decimal(m)?s.push(m.negated()):"number"==typeof m?s.push(-m):"boolean"==typeof m?s.push(!m):s.push(new Decimal(m).negated())}else if("+"===g){var v=s.pop();s.pop(),s.push(v)}}break}if("!"===l){var h=s.pop();s.push(logical_not(h))}else if(":"===l&&o.length>0&&"?"===o[o.length-1]){var w=s.pop();o.pop();var b=s.pop(),y=s.pop(),x=void 0;x="boolean"==typeof y?y:is_decimal(y)?!y.isZero():Boolean(y),s.push(x?b:w)}else{if("?"===l){o.push("?");break}var S=s.pop(),E=s.pop();s.push(execute_op(E,S,l))}}else o.push("(");else{var A=a.value,T=get_precedence(A);if(is_comparison_op(A)&&_.active)for(;o.length>0;){var D=o[o.length-1];if("("===D||"?"===D)break;if(get_precedence(D)<T)break;if(is_comparison_op(D)){o.pop();var N=s.pop(),k=compare(s.pop(),N,D);_.lastValue=N,k?s.push(N):(s.push(!1),_.active=!1);break}o.pop();var O=s.pop(),P=s.pop();s.push(execute_op(P,O,D))}is_comparison_op(A)?_.active=!0:_.active=!1;var M=o[o.length-1];if("("===M){o.push(A);continue}if(!o.length){o.push(A);continue}if("**"===A){o.push(A);continue}for(;o.length>0&&"("!==(M=o[o.length-1])&&"?"!==M;){var I=get_precedence(M);if(I<T)break;if(I===T&&"**"===A)break;if("!"!==M&&s.length<2)break;if(o.pop(),"!"===M){var L=s.pop();s.push(logical_not(L))}else{var W=s.pop(),C=s.pop();void 0!==C||"-"!==M&&"+"!==M?s.push(execute_op(C,W,M)):"-"===M?is_decimal(W)?s.push(W.negated()):"number"==typeof W?s.push(-W):s.push(new Decimal(W).negated()):s.push(W)}}o.push(A)}else{for(;o.length>0;){var j=o[o.length-1];if("?"===j)break;if("("===j)break;o.pop();var F=s.pop(),q=s.pop();s.push(execute_op(q,F,j))}o.push(":")}else{for(;o.length>0;){var R=o[o.length-1];if("("===R||"?"===R)break;if(get_precedence(R)<=get_precedence("?"))break;o.pop();var V=s.pop(),B=s.pop();s.push(execute_op(B,V,R))}o.push("?")}else o.push("!");else{var $=a.value,G=a.fn||get_function($,e._fill_data);if(!G)throw new Error("未知的函数: ".concat($));var U=a.args.map(function(t){var r=tokenizer(t,e._fill_data,e._unit,e._options);return r._fill_data=e._fill_data,r._unit=e._unit,r._options=e._options,eval_tokens(r)}),z=G.apply(void 0,_toConsumableArray(U));s.push(z)}else s.push(a.value);else s.push(a.value);else s.push(a.real_value);for(;o.length>0;){var H=o.pop();if("!"===H){var Z=s.pop();s.push(logical_not(Z))}else if(":"===H&&o.length>0&&"?"===o[o.length-1]){var X=s.pop();o.pop();var K=s.pop(),J=s.pop(),Y=void 0;Y="boolean"==typeof J?J:is_decimal(J)?!J.isZero():Boolean(J),s.push(Y?K:X)}else{if("?"===H)continue;var Q=s.pop(),ee=s.pop();void 0!==ee||"-"!==H&&"+"!==H?s.push(execute_op(ee,Q,H)):"-"===H?is_decimal(Q)?s.push(Q.negated()):"number"==typeof Q?s.push(-Q):s.push(new Decimal(Q).negated()):s.push(Q)}}if(1!==s.length)throw new Error("可能出现了错误的计算式");return e.has_var||(e.calc_result=s[0]),s[0]}set_config({_builtin_functions:_builtin_functions});var _calc=null;function register_calc_for_sum(e){_calc=e}function get_calc(){if(!_calc)throw new Error("calc function not registered for calc_sum");return _calc}function internal_format$1(e,t){if(!t)return e;var r=fmt_tokenizer(t,null);return _slicedToArray(format(new Decimal(e),r,{}),1)[0]}function calc_sum(e,t){var r=get_calc(),n={_error:"-"},i=e.split("|"),a=i[0];if(0===t.length)return r(e,n);for(var o=new Decimal(0),s=0;s<t.length;s++){var _=r(a,_objectSpread2(_objectSpread2({},n),t[s]));if(_===n._error)return n._error;o=o.plus(_)}var u=2===i.length?i[1].trim():void 0;return internal_format$1(o.toFixed(),u)}function _d_add(e,t){return new Decimal(e).plus(t).toFixed()}function _d_sub(e,t){return new Decimal(e).minus(t).toFixed()}function _d_mul(e,t){return new Decimal(e).times(t).toFixed()}function _d_div(e,t){var r=new Decimal(t);if(r.isZero()){var n=get_config("_error");if(void 0!==n)return n;throw new Error("Division by zero")}return new Decimal(e).div(r).toFixed()}function _d_mod(e,t){var r=new Decimal(t);if(r.isZero()){var n=get_config("_error");if(void 0!==n)return n;throw new Error("Modulo by zero")}return new Decimal(e).mod(r).toFixed()}function _d_pow(e,t){return new Decimal(e).pow(t).toFixed()}function _d_idiv(e,t){var r=new Decimal(t);if(r.isZero()){var n=get_config("_error");if(void 0!==n)return n;throw new Error("Division by zero")}return new Decimal(e).divToInt(r).toFixed()}function _d_abs(e){return new Decimal(e).abs().toFixed()}function _d_neg(e){return new Decimal(e).neg().toFixed()}function _d_sqrt(e){return new Decimal(e).sqrt().toFixed()}function _d_cbrt(e){return new Decimal(e).cbrt().toFixed()}function _d_exp(e){return new Decimal(e).exp().toFixed()}function _d_ln(e){return new Decimal(e).ln().toFixed()}function _d_log(e,t){return new Decimal(e).log(t).toFixed()}function _d_log2(e){return new Decimal(e).log(2).toFixed()}function _d_log10(e){return new Decimal(e).log(10).toFixed()}function _d_sin(e){return new Decimal(e).sin().toFixed()}function _d_cos(e){return new Decimal(e).cos().toFixed()}function _d_tan(e){return new Decimal(e).tan().toFixed()}function _d_asin(e){return new Decimal(e).asin().toFixed()}function _d_acos(e){return new Decimal(e).acos().toFixed()}function _d_atan(e){return new Decimal(e).atan().toFixed()}function _d_sinh(e){return new Decimal(e).sinh().toFixed()}function _d_cosh(e){return new Decimal(e).cosh().toFixed()}function _d_tanh(e){return new Decimal(e).tanh().toFixed()}function _d_asinh(e){return new Decimal(e).asinh().toFixed()}function _d_acosh(e){return new Decimal(e).acosh().toFixed()}function _d_atanh(e){return new Decimal(e).atanh().toFixed()}function _d_floor(e){return new Decimal(e).floor().toFixed()}function _d_ceil(e){return new Decimal(e).ceil().toFixed()}function _d_trunc(e){return new Decimal(e).trunc().toFixed()}function _d_round(e){return new Decimal(e).round().toFixed()}function _d_max(e,t){return Decimal.max(e,t).toFixed()}function _d_min(e,t){return Decimal.min(e,t).toFixed()}function _d_compare(e,t){return new Decimal(e).cmp(t)}function _d_eq(e,t){return new Decimal(e).eq(t)}function _d_lt(e,t){return new Decimal(e).lt(t)}function _d_gt(e,t){return new Decimal(e).gt(t)}function _d_lte(e,t){return new Decimal(e).lte(t)}function _d_gte(e,t){return new Decimal(e).gte(t)}var decimal_ops={add:_d_add,sub:_d_sub,mul:_d_mul,div:_d_div,mod:_d_mod,pow:_d_pow,idiv:_d_idiv,abs:_d_abs,neg:_d_neg,sqrt:_d_sqrt,cbrt:_d_cbrt,exp:_d_exp,ln:_d_ln,log:_d_log,log2:_d_log2,log10:_d_log10,sin:_d_sin,cos:_d_cos,tan:_d_tan,asin:_d_asin,acos:_d_acos,atan:_d_atan,sinh:_d_sinh,cosh:_d_cosh,tanh:_d_tanh,asinh:_d_asinh,acosh:_d_acosh,atanh:_d_atanh,floor:_d_floor,ceil:_d_ceil,trunc:_d_trunc,round:_d_round,max:_d_max,min:_d_min,compare:_d_compare,eq:_d_eq,lt:_d_lt,gt:_d_gt,lte:_d_lte,gte:_d_gte},dadd=_d_add,dsub=_d_sub,dmul=_d_mul,ddiv=_d_div,dmod=_d_mod,dpow=_d_pow,didiv=_d_idiv,dabs=_d_abs,dneg=_d_neg,dsqrt=_d_sqrt,dcbrt=_d_cbrt,dexp=_d_exp,dln=_d_ln,dlog=_d_log,dlog2=_d_log2,dlog10=_d_log10,dsin=_d_sin,dcos=_d_cos,dtan=_d_tan,dasin=_d_asin,dacos=_d_acos,datan=_d_atan,dsinh=_d_sinh,dcosh=_d_cosh,dtanh=_d_tanh,dasinh=_d_asinh,dacosh=_d_acosh,datanh=_d_atanh,dfloor=_d_floor,dceil=_d_ceil,dtrunc=_d_trunc,dround=_d_round,dmax=_d_max,dmin=_d_min,dcompare=_d_compare,deq=_d_eq,dlt=_d_lt,dgt=_d_gt,dlte=_d_lte,dgte=_d_gte;function bigint_pow10(e){if(e<=0)return 1n;for(var t=1n,r=0;r<e;r++)t*=10n;return t}function to_fixed_point(e){var t=String(e);if(t.includes("e")||t.includes("E"))return to_fixed_point_from_scientific(t);var r=t.startsWith("-"),n=_slicedToArray((r?t.slice(1):t).split("."),2),i=n[0],a=void 0===i?"0":i,o=n[1],s=void 0===o?"":o,_=s.length,u=(a+s).replace(/^0+/,"")||"0";return{value:BigInt(r?"-"+u:u),scale:_}}function to_fixed_point_from_scientific(e){var t=_slicedToArray(e.toLowerCase().split("e"),2),r=t[0],n=t[1],i=parseInt(n,10),a=to_fixed_point(r),o=a.value,s=a.scale-i;return s<0?{value:o*bigint_pow10(-s),scale:0}:{value:o,scale:s}}function from_fixed_point(e,t){var r=e<0n,n=(r?-e:e).toString();if(t<=0)return(r?"-":"")+n+"0".repeat(-t);for(;n.length<=t;)n="0"+n;var i=n.slice(0,-t),a=n.slice(-t).replace(/0+$/,""),o=a?"".concat(i,".").concat(a):i;return r?"-"+o:o}function normalize(e,t){if(0n===e)return{value:0n,scale:0};for(;t>0&&e%10n==0n;)e/=10n,t--;return{value:e,scale:t}}function align_scale(e,t,r,n){return t>n?{a_val:e,b_val:r*=bigint_pow10(t-n),scale:t}:n>t?{a_val:e*=bigint_pow10(n-t),b_val:r,scale:n}:{a_val:e,b_val:r,scale:t}}function _add(e,t){var r="string"==typeof e?to_fixed_point(e):e,n="string"==typeof t?to_fixed_point(t):t,i=align_scale(r.value,r.scale,n.value,n.scale);return normalize(i.a_val+i.b_val,i.scale)}function _minus(e,t){var r="string"==typeof e?to_fixed_point(e):e,n="string"==typeof t?to_fixed_point(t):t,i=align_scale(r.value,r.scale,n.value,n.scale);return normalize(i.a_val-i.b_val,i.scale)}function _mul(e,t){var r="string"==typeof e?to_fixed_point(e):e,n="string"==typeof t?to_fixed_point(t):t;return normalize(r.value*n.value,r.scale+n.scale)}function _div(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:20,n="string"==typeof e?to_fixed_point(e):e,i="string"==typeof t?to_fixed_point(t):t;if(0n===i.value)throw new Error("Division by zero");var a=bigint_pow10(r);return normalize(n.value*a/i.value,n.scale-i.scale+r)}function _mod(e,t){var r="string"==typeof e?to_fixed_point(e):e,n="string"==typeof t?to_fixed_point(t):t;if(0n===n.value)throw new Error("Modulo by zero");var i=align_scale(r.value,r.scale,n.value,n.scale);return normalize(i.a_val%i.b_val,i.scale)}function _pow(e,t){var r="string"==typeof e?to_fixed_point(e):e,n="bigint"==typeof t?t:BigInt(Math.floor(Number(t)));if(n<0n)return _div({value:1n,scale:0},_pow(r,-n));if(0n===n)return{value:1n,scale:0};if(1n===n)return r;for(var i={value:1n,scale:0},a=r,o=n;o>0n;)o%2n==1n&&(i=_mul(i,a)),a=_mul(a,a),o/=2n;return normalize(i.value,i.scale)}function _compare(e,t){var r="string"==typeof e?to_fixed_point(e):e,n="string"==typeof t?to_fixed_point(t):t,i=align_scale(r.value,r.scale,n.value,n.scale),a=i.a_val,o=i.b_val;return a<o?-1:a>o?1:0}function _eq(e,t){return 0===_compare(e,t)}function _lt(e,t){return _compare(e,t)<0}function _gt(e,t){return _compare(e,t)>0}function _lte(e,t){return _compare(e,t)<=0}function _gte(e,t){return _compare(e,t)>=0}function _abs(e){var t="string"==typeof e?to_fixed_point(e):e;return{value:t.value<0n?-t.value:t.value,scale:t.scale}}function _neg(e){var t="string"==typeof e?to_fixed_point(e):e;return{value:-t.value,scale:t.scale}}function _floor(e){var t="string"==typeof e?to_fixed_point(e):e;if(t.scale<=0)return{value:t.value*bigint_pow10(-t.scale),scale:0};var r=bigint_pow10(t.scale),n=t.value/r;return t.value<0n&&t.value%r!==0n&&(n-=1n),{value:n,scale:0}}function _ceil(e){var t="string"==typeof e?to_fixed_point(e):e;if(t.scale<=0)return{value:t.value*bigint_pow10(-t.scale),scale:0};var r=bigint_pow10(t.scale),n=t.value/r;return t.value>0n&&t.value%r!==0n&&(n+=1n),{value:n,scale:0}}function _trunc(e){var t="string"==typeof e?to_fixed_point(e):e;if(t.scale<=0)return{value:t.value*bigint_pow10(-t.scale),scale:0};var r=bigint_pow10(t.scale);return{value:t.value/r,scale:0}}function _round(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r="string"==typeof e?to_fixed_point(e):e,n=t;if(r.scale<=n){var i=n-r.scale;return{value:r.value*bigint_pow10(i),scale:n}}var a=bigint_pow10(r.scale-n),o=a/2n,s=r.value/a,_=r.value%a;return r.value>=0n?_>=o&&(s+=1n):-_>=o&&(s-=1n),normalize(s,n)}function _max(e,t){return _gt(e,t)?"string"==typeof e?to_fixed_point(e):e:"string"==typeof t?to_fixed_point(t):t}function _min(e,t){return _lt(e,t)?"string"==typeof e?to_fixed_point(e):e:"string"==typeof t?to_fixed_point(t):t}function _b_add(e,t){var r=_add(e,t);return from_fixed_point(r.value,r.scale)}function _b_sub(e,t){var r=_minus(e,t);return from_fixed_point(r.value,r.scale)}function _b_mul(e,t){var r=_mul(e,t);return from_fixed_point(r.value,r.scale)}function _b_div(e,t){if(0n===to_fixed_point(t).value){var r=get_config("_error");if(void 0!==r)return r;throw new Error("Division by zero")}var n=_div(e,t,get_config("_div_precision")||20);return from_fixed_point(n.value,n.scale)}function _b_mod(e,t){if(0n===to_fixed_point(t).value){var r=get_config("_error");if(void 0!==r)return r;throw new Error("Modulo by zero")}var n=_mod(e,t);return from_fixed_point(n.value,n.scale)}function _b_pow(e,t){var r=Number(t);if(!Number.isInteger(r))return _d_pow(e,t);var n=_pow(e,r);return from_fixed_point(n.value,n.scale)}function _b_idiv(e,t){if(0n===to_fixed_point(t).value){var r=get_config("_error");if(void 0!==r)return r;throw new Error("Division by zero")}var n=_div(e,t,get_config("_div_precision")||20),i=_trunc({value:n.value,scale:n.scale});return from_fixed_point(i.value,i.scale)}function _b_abs(e){var t=_abs(e);return from_fixed_point(t.value,t.scale)}function _b_neg(e){var t=_neg(e);return from_fixed_point(t.value,t.scale)}function _b_floor(e){var t=_floor(e);return from_fixed_point(t.value,t.scale)}function _b_ceil(e){var t=_ceil(e);return from_fixed_point(t.value,t.scale)}function _b_trunc(e){var t=_trunc(e);return from_fixed_point(t.value,t.scale)}function _b_round(e){var t=_round(e,0);return from_fixed_point(t.value,t.scale)}function _b_max(e,t){var r=_max(e,t);return from_fixed_point(r.value,r.scale)}function _b_min(e,t){var r=_min(e,t);return from_fixed_point(r.value,r.scale)}function _b_compare(e,t){return _compare(e,t)}function _b_eq(e,t){return _eq(e,t)}function _b_lt(e,t){return _lt(e,t)}function _b_gt(e,t){return _gt(e,t)}function _b_lte(e,t){return _lte(e,t)}function _b_gte(e,t){return _gte(e,t)}var bigint_ops={add:_b_add,sub:_b_sub,mul:_b_mul,div:_b_div,mod:_b_mod,pow:_b_pow,idiv:_b_idiv,abs:_b_abs,neg:_b_neg,floor:_b_floor,ceil:_b_ceil,trunc:_b_trunc,round:_b_round,max:_b_max,min:_b_min,compare:_b_compare,eq:_b_eq,lt:_b_lt,gt:_b_gt,lte:_b_lte,gte:_b_gte,sqrt:_d_sqrt,cbrt:_d_cbrt,exp:_d_exp,ln:_d_ln,log:_d_log,log2:_d_log2,log10:_d_log10,sin:_d_sin,cos:_d_cos,tan:_d_tan,asin:_d_asin,acos:_d_acos,atan:_d_atan,sinh:_d_sinh,cosh:_d_cosh,tanh:_d_tanh,asinh:_d_asinh,acosh:_d_acosh,atanh:_d_atanh},badd=_b_add,bsub=_b_sub,bmul=_b_mul,bdiv=_b_div,bmod=_b_mod,bpow=_b_pow,bidiv=_b_idiv,babs=_b_abs,bneg=_b_neg,bfloor=_b_floor,bceil=_b_ceil,btrunc=_b_trunc,bround=_b_round,bmax=_b_max,bmin=_b_min,bcompare=_b_compare,beq=_b_eq,blt=_b_lt,bgt=_b_gt,blte=_b_lte,bgte=_b_gte,bsqrt=_d_sqrt,bcbrt=_d_cbrt,bexp=_d_exp,bln=_d_ln,blog=_d_log,blog2=_d_log2,blog10=_d_log10,bsin=_d_sin,bcos=_d_cos,btan=_d_tan,basin=_d_asin,bacos=_d_acos,batan=_d_atan,bsinh=_d_sinh,bcosh=_d_cosh,btanh=_d_tanh,basinh=_d_asinh,bacosh=_d_acosh,batanh=_d_atanh,wasm_module=null,wasm_loaded=!1,wasm_loading=!1,wasm_load_callbacks=[],_calc_fallback=null;function register_calc_fallback(e){_calc_fallback=e}function load_wasm(e){return _load_wasm.apply(this,arguments)}function _load_wasm(){return(_load_wasm=_asyncToGenerator(_regenerator().m(function e(t){var r,n,i,a;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:if(!wasm_loaded){e.n=1;break}return e.a(2,wasm_module);case 1:if(!wasm_loading){e.n=2;break}return e.a(2,new Promise(function(e,t){wasm_load_callbacks.push({resolve:e,reject:t})}));case 2:return wasm_loading=!0,e.p=3,e.n=4,Promise.resolve().then(function(){return wasm_calc});case 4:if(r=e.v,n="undefined"!=typeof window,i="undefined"!=typeof process&&process.versions&&process.versions.node,!n){e.n=8;break}if(!t){e.n=6;break}return e.n=5,r.default(t);case 5:e.n=7;break;case 6:return e.n=7,r.default();case 7:case 9:case 16:e.n=18;break;case 8:if(!i){e.n=10;break}return e.n=9,init_wasm_node(r);case 10:if("function"!=typeof globalThis.fetch){e.n=17;break}if(e.p=11,!t){e.n=13;break}return e.n=12,r.default(t);case 12:e.n=14;break;case 13:return e.n=14,r.default();case 14:e.n=16;break;case 15:return e.p=15,e.v,e.n=16,init_wasm_node(r);case 17:throw new Error("Unsupported environment for WASM loading");case 18:return wasm_module=r,wasm_loaded=!0,update_wasm_ops(),wasm_load_callbacks.forEach(function(e){return e.resolve(r)}),wasm_load_callbacks=[],e.a(2,r);case 19:throw e.p=19,a=e.v,wasm_loading=!1,wasm_load_callbacks.forEach(function(e){return e.reject(a)}),wasm_load_callbacks=[],console.warn("WASM module failed to load, using Decimal fallback:",a),a;case 20:return e.a(2)}},e,null,[[11,15],[3,19]])}))).apply(this,arguments)}function init_wasm_node(e){return _init_wasm_node.apply(this,arguments)}function _init_wasm_node(){return(_init_wasm_node=_asyncToGenerator(_regenerator().m(function e(t){var r,n,i,a,o,s,_,u,c,l,p,d,f,g,m,v;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.n=1,import("fs");case 1:return r=e.v,n=r.readFileSync,e.n=2,import("url");case 2:return i=e.v,a=i.fileURLToPath,e.n=3,import("path");case 3:o=e.v,s=o.dirname,_=o.join,u=a("undefined"==typeof document?require("url").pathToFileURL(__filename).href:_documentCurrentScript&&"SCRIPT"===_documentCurrentScript.tagName.toUpperCase()&&_documentCurrentScript.src||new URL("index.js",document.baseURI).href),c=s(u),l=[_(c,"../../wasm-calc/pkg/wasm_calc_bg.wasm"),_(c,"../wasm-calc/pkg/wasm_calc_bg.wasm"),_(c,"../../wasm-calc/pkg/wasm_calc_bg.wasm")],p=null,d=null,f=0,g=l;case 4:if(!(f<g.length)){e.n=8;break}return m=g[f],e.p=5,p=n(m),e.a(3,8);case 6:e.p=6,v=e.v,d=v;case 7:f++,e.n=4;break;case 8:if(p){e.n=9;break}throw d||new Error("WASM file not found");case 9:t.initSync({module:p});case 10:return e.a(2)}},e,null,[[5,6]])}))).apply(this,arguments)}function is_wasm_loaded(){return wasm_loaded}var wasm_ops={add:_d_add,sub:_d_sub,mul:_d_mul,div:_d_div,mod:_d_mod,pow:_d_pow,idiv:_d_idiv,abs:_d_abs,neg:_d_neg,sqrt:_d_sqrt,exp:_d_exp,ln:_d_ln,log10:_d_log10,sin:_d_sin,cos:_d_cos,tan:_d_tan,floor:_d_floor,ceil:_d_ceil,trunc:_d_trunc,round:_d_round,max:_d_max,min:_d_min,compare:_d_compare,eq:_d_eq,lt:_d_lt,gt:_d_gt,lte:_d_lte,gte:_d_gte,cbrt:_d_cbrt,log:_d_log,log2:_d_log2,asin:_d_asin,acos:_d_acos,atan:_d_atan,sinh:_d_sinh,cosh:_d_cosh,tanh:_d_tanh,asinh:_d_asinh,acosh:_d_acosh,atanh:_d_atanh};function trigger_wcalc_load(){wasm_loading||wasm_loaded||load_wasm().catch(function(){})}var _wcalc_impl=function(e){return trigger_wcalc_load(),_calc_fallback(e)};function wcalc(e){return _wcalc_impl(e)}function update_wasm_ops(){wasm_ops.add=function(e,t){return wasm_module.str_plus(String(e),String(t))},wasm_ops.sub=function(e,t){return wasm_module.str_sub(String(e),String(t))},wasm_ops.mul=function(e,t){return wasm_module.str_mul(String(e),String(t))},wasm_ops.div=function(e,t){var r=wasm_module.str_div(String(e),String(t));if("NaN"===r){var n=get_config("_error");if(void 0!==n)return n;throw new Error("Division by zero")}return r},wasm_ops.mod=function(e,t){var r=wasm_module.str_mod(String(e),String(t));if("NaN"===r){var n=get_config("_error");if(void 0!==n)return n;throw new Error("Modulo by zero")}return r},wasm_ops.pow=function(e,t){var r=wasm_module.str_powd(String(e),String(t));return"NaN"===r||"Overflow"===r?_d_pow(e,t):r},wasm_ops.idiv=function(e,t){var r=wasm_module.str_div(String(e),String(t));if("NaN"===r){var n=get_config("_error");if(void 0!==n)return n;throw new Error("Division by zero")}return wasm_module.str_trunc(r)},wasm_ops.abs=function(e){return wasm_module.str_abs(String(e))},wasm_ops.neg=function(e){return wasm_module.str_neg(String(e))},wasm_ops.sqrt=function(e){var t=wasm_module.str_sqrt(String(e));return"NaN"===t?_d_sqrt(e):t},wasm_ops.exp=function(e){return wasm_module.str_exp(String(e))},wasm_ops.ln=function(e){var t=wasm_module.str_ln(String(e));return"NaN"===t?_d_ln(e):t},wasm_ops.log10=function(e){var t=wasm_module.str_log10(String(e));return"NaN"===t?_d_log10(e):t},wasm_ops.sin=function(e){return wasm_module.str_sin(String(e))},wasm_ops.cos=function(e){return wasm_module.str_cos(String(e))},wasm_ops.tan=function(e){return wasm_module.str_tan(String(e))},wasm_ops.floor=function(e){return wasm_module.str_floor(String(e))},wasm_ops.ceil=function(e){return wasm_module.str_ceil(String(e))},wasm_ops.trunc=function(e){return wasm_module.str_trunc(String(e))},wasm_ops.round=function(e){return wasm_module.str_round(String(e))},wasm_ops.max=function(e,t){return wasm_module.str_max(String(e),String(t))},wasm_ops.min=function(e,t){return wasm_module.str_min(String(e),String(t))},wasm_ops.compare=function(e,t){return wasm_module.str_compare(String(e),String(t))},wasm_ops.eq=function(e,t){return wasm_module.str_eq(String(e),String(t))},wasm_ops.lt=function(e,t){return wasm_module.str_lt(String(e),String(t))},wasm_ops.gt=function(e,t){return wasm_module.str_gt(String(e),String(t))},wasm_ops.lte=function(e,t){return wasm_module.str_lte(String(e),String(t))},wasm_ops.gte=function(e,t){return wasm_module.str_gte(String(e),String(t))},_wcalc_impl=function(e){var t=wasm_module.eval_expr(String(e));if(t.startsWith("Error:")){var r=get_config("_error");if(void 0!==r)return r;throw new Error(t)}return t},update_wasm_raw_functions()}function trigger_wasm_load(){wasm_loading||wasm_loaded||load_wasm().catch(function(){})}exports.wadd=function(e,t){return trigger_wasm_load(),_d_add(e,t)},exports.wsub=function(e,t){return trigger_wasm_load(),_d_sub(e,t)},exports.wmul=function(e,t){return trigger_wasm_load(),_d_mul(e,t)},exports.wdiv=function(e,t){return trigger_wasm_load(),_d_div(e,t)},exports.wmod=function(e,t){return trigger_wasm_load(),_d_mod(e,t)},exports.wpow=function(e,t){return trigger_wasm_load(),_d_pow(e,t)},exports.widiv=function(e,t){return trigger_wasm_load(),_d_idiv(e,t)},exports.wabs=function(e){return trigger_wasm_load(),_d_abs(e)},exports.wneg=function(e){return trigger_wasm_load(),_d_neg(e)},exports.wsqrt=function(e){return trigger_wasm_load(),_d_sqrt(e)};var wcbrt=function(e){return trigger_wasm_load(),_d_cbrt(e)};exports.wexp=function(e){return trigger_wasm_load(),_d_exp(e)},exports.wln=function(e){return trigger_wasm_load(),_d_ln(e)};var wlog=function(e,t){return trigger_wasm_load(),_d_log(e,t)},wlog2=function(e){return trigger_wasm_load(),_d_log2(e)};exports.wlog10=function(e){return trigger_wasm_load(),_d_log10(e)},exports.wsin=function(e){return trigger_wasm_load(),_d_sin(e)},exports.wcos=function(e){return trigger_wasm_load(),_d_cos(e)},exports.wtan=function(e){return trigger_wasm_load(),_d_tan(e)};var wasin=function(e){return trigger_wasm_load(),_d_asin(e)},wacos=function(e){return trigger_wasm_load(),_d_acos(e)},watan=function(e){return trigger_wasm_load(),_d_atan(e)},wsinh=function(e){return trigger_wasm_load(),_d_sinh(e)},wcosh=function(e){return trigger_wasm_load(),_d_cosh(e)},wtanh=function(e){return trigger_wasm_load(),_d_tanh(e)},wasinh=function(e){return trigger_wasm_load(),_d_asinh(e)},wacosh=function(e){return trigger_wasm_load(),_d_acosh(e)},watanh=function(e){return trigger_wasm_load(),_d_atanh(e)};function update_wasm_raw_functions(){exports.wadd=function(e,t){return wasm_module.str_plus(String(e),String(t))},exports.wsub=function(e,t){return wasm_module.str_sub(String(e),String(t))},exports.wmul=function(e,t){return wasm_module.str_mul(String(e),String(t))},exports.wdiv=function(e,t){var r=wasm_module.str_div(String(e),String(t));if("NaN"===r){var n=get_config("_error");if(void 0!==n)return n;throw new Error("Division by zero")}return r},exports.wmod=function(e,t){var r=wasm_module.str_mod(String(e),String(t));if("NaN"===r){var n=get_config("_error");if(void 0!==n)return n;throw new Error("Modulo by zero")}return r},exports.wpow=function(e,t){var r=wasm_module.str_powd(String(e),String(t));return"NaN"===r||"Overflow"===r?_d_pow(e,t):r},exports.widiv=function(e,t){var r=wasm_module.str_div(String(e),String(t));if("NaN"===r){var n=get_config("_error");if(void 0!==n)return n;throw new Error("Division by zero")}return wasm_module.str_trunc(r)},exports.wabs=function(e){return wasm_module.str_abs(String(e))},exports.wneg=function(e){return wasm_module.str_neg(String(e))},exports.wsqrt=function(e){var t=wasm_module.str_sqrt(String(e));return"NaN"===t?_d_sqrt(e):t},exports.wexp=function(e){return wasm_module.str_exp(String(e))},exports.wln=function(e){var t=wasm_module.str_ln(String(e));return"NaN"===t?_d_ln(e):t},exports.wlog10=function(e){var t=wasm_module.str_log10(String(e));return"NaN"===t?_d_log10(e):t},exports.wsin=function(e){return wasm_module.str_sin(String(e))},exports.wcos=function(e){return wasm_module.str_cos(String(e))},exports.wtan=function(e){return wasm_module.str_tan(String(e))},exports.wfloor=function(e){return wasm_module.str_floor(String(e))},exports.wceil=function(e){return wasm_module.str_ceil(String(e))},exports.wtrunc=function(e){return wasm_module.str_trunc(String(e))},exports.wround=function(e){return wasm_module.str_round(String(e))},exports.wmax=function(e,t){return wasm_module.str_max(String(e),String(t))},exports.wmin=function(e,t){return wasm_module.str_min(String(e),String(t))},exports.wcompare=function(e,t){return wasm_module.str_compare(String(e),String(t))},exports.weq=function(e,t){return wasm_module.str_eq(String(e),String(t))},exports.wlt=function(e,t){return wasm_module.str_lt(String(e),String(t))},exports.wgt=function(e,t){return wasm_module.str_gt(String(e),String(t))},exports.wlte=function(e,t){return wasm_module.str_lte(String(e),String(t))},exports.wgte=function(e,t){return wasm_module.str_gte(String(e),String(t))}}exports.wfloor=function(e){return trigger_wasm_load(),_d_floor(e)},exports.wceil=function(e){return trigger_wasm_load(),_d_ceil(e)},exports.wtrunc=function(e){return trigger_wasm_load(),_d_trunc(e)},exports.wround=function(e){return trigger_wasm_load(),_d_round(e)},exports.wmax=function(e,t){return trigger_wasm_load(),_d_max(e,t)},exports.wmin=function(e,t){return trigger_wasm_load(),_d_min(e,t)},exports.wcompare=function(e,t){return trigger_wasm_load(),_d_compare(e,t)},exports.weq=function(e,t){return trigger_wasm_load(),_d_eq(e,t)},exports.wlt=function(e,t){return trigger_wasm_load(),_d_lt(e,t)},exports.wgt=function(e,t){return trigger_wasm_load(),_d_gt(e,t)},exports.wlte=function(e,t){return trigger_wasm_load(),_d_lte(e,t)},exports.wgte=function(e,t){return trigger_wasm_load(),_d_gte(e,t)};var modes={decimal:decimal_ops,bigint:bigint_ops,wasm:wasm_ops},ops=_objectSpread2({},decimal_ops);function set_compute_mode(e){return modes[e]?(Object.assign(ops,modes[e]),"wasm"!==e||is_wasm_loaded()||load_wasm().catch(function(e){console.warn("Failed to load WASM module, using Decimal fallback:",e.message)}),!0):(console.warn("Unknown compute mode: ".concat(e,", available modes: ").concat(Object.keys(modes).join(", "))),!1)}function is_error_value(e){var t=get_config("_error");return void 0!==t&&e===t}function add(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=t.length>0&&"string"===t[t.length-1]?"string":"number",i="string"===n?t.slice(0,-1):t;if(0===i.length)return"number"===n?0:"0";for(var a=String(i[0]),o=1;o<i.length;o++)a=ops.add(a,String(i[o]));return"number"===n?Number(a):a}function sub(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=t.length>0&&"string"===t[t.length-1]?"string":"number",i="string"===n?t.slice(0,-1):t;if(0===i.length)return"number"===n?0:"0";if(1===i.length){var a=ops.neg(ops.neg(String(i[0])));return"number"===n?Number(a):a}for(var o=String(i[0]),s=1;s<i.length;s++)o=ops.sub(o,String(i[s]));return"number"===n?Number(o):o}function mul(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=t.length>0&&"string"===t[t.length-1]?"string":"number",i="string"===n?t.slice(0,-1):t;if(0===i.length)return"number"===n?1:"1";for(var a=String(i[0]),o=1;o<i.length;o++)a=ops.mul(a,String(i[o]));return"number"===n?Number(a):a}function div(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=t.length>0&&"string"===t[t.length-1]?"string":"number",i="string"===n?t.slice(0,-1):t;if(0===i.length)return"number"===n?1:"1";if(1===i.length){var a=String(i[0]);return"number"===n?Number(a):a}for(var o=String(i[0]),s=1;s<i.length;s++)if(is_error_value(o=ops.div(o,String(i[s]))))return o;return"number"===n?Number(o):o}function mod(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=t.length>0&&"string"===t[t.length-1]?"string":"number",i="string"===n?t.slice(0,-1):t;if(0===i.length)return"number"===n?0:"0";if(1===i.length){var a=String(i[0]);return"number"===n?Number(a):a}for(var o=String(i[0]),s=1;s<i.length;s++)if(is_error_value(o=ops.mod(o,String(i[s]))))return o;return"number"===n?Number(o):o}function pow(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=t.length>0&&"string"===t[t.length-1]?"string":"number",i="string"===n?t.slice(0,-1):t;if(0===i.length)return"number"===n?1:"1";if(1===i.length){var a=String(i[0]);return"number"===n?Number(a):a}for(var o=String(i[i.length-1]),s=i.length-2;s>=0;s--)o=ops.pow(String(i[s]),o);return"number"===n?Number(o):o}function idiv(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=t.length>0&&"string"===t[t.length-1]?"string":"number",i="string"===n?t.slice(0,-1):t;if(0===i.length)return"number"===n?0:"0";if(1===i.length){var a=String(i[0]);return"number"===n?Number(a):a}for(var o=String(i[0]),s=1;s<i.length;s++)if(is_error_value(o=ops.idiv(o,String(i[s]))))return o;return"number"===n?Number(o):o}function abs(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"number",r=ops.abs(String(e));return"number"===t?Number(r):r}function neg(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"number",r=ops.neg(String(e));return"number"===t?Number(r):r}function sqrt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"number",r=ops.sqrt(String(e));return"number"===t?Number(r):r}function ln(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"number",r=ops.ln(String(e));return"number"===t?Number(r):r}function exp(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"number",r=ops.exp(String(e));return"number"===t?Number(r):r}function internal_format(e,t){if(!t)return e;var r=fmt_tokenizer(t,null);return _slicedToArray(format(new Decimal(e),r,{}),1)[0]}function resolve_value(e){if("function"==typeof e){var t=e();return is_error_value(t),t}return e}function create_chain(e){var t=String(e),r=is_error_value(e),n=function(e){return r?t:e?internal_format(t,e):t};return n.add=function(){if(r)return n;for(var e=arguments.length,i=new Array(e),a=0;a<e;a++)i[a]=arguments[a];for(var o=0,s=i;o<s.length;o++){var _=resolve_value(s[o]);if(is_error_value(t=add(t,_,"string")))return r=!0,n}return n},n.sub=function(){if(r)return n;for(var e=arguments.length,i=new Array(e),a=0;a<e;a++)i[a]=arguments[a];for(var o=0,s=i;o<s.length;o++){var _=resolve_value(s[o]);if(is_error_value(t=sub(t,_,"string")))return r=!0,n}return n},n.mul=function(){if(r)return n;for(var e=arguments.length,i=new Array(e),a=0;a<e;a++)i[a]=arguments[a];for(var o=0,s=i;o<s.length;o++){var _=resolve_value(s[o]);if(is_error_value(t=mul(t,_,"string")))return r=!0,n}return n},n.div=function(){if(r)return n;for(var e=arguments.length,i=new Array(e),a=0;a<e;a++)i[a]=arguments[a];for(var o=0,s=i;o<s.length;o++){var _=resolve_value(s[o]);if(is_error_value(t=div(t,_,"string")))return r=!0,n}return n},n.mod=function(){if(r)return n;for(var e=arguments.length,i=new Array(e),a=0;a<e;a++)i[a]=arguments[a];for(var o=0,s=i;o<s.length;o++){var _=resolve_value(s[o]);if(is_error_value(t=mod(t,_,"string")))return r=!0,n}return n},n.pow=function(){if(r)return n;for(var e=arguments.length,i=new Array(e),a=0;a<e;a++)i[a]=arguments[a];for(var o=0,s=i;o<s.length;o++){var _=resolve_value(s[o]);if(is_error_value(t=pow(t,_,"string")))return r=!0,n}return n},n.idiv=function(){if(r)return n;for(var e=arguments.length,i=new Array(e),a=0;a<e;a++)i[a]=arguments[a];for(var o=0,s=i;o<s.length;o++){var _=resolve_value(s[o]);if(is_error_value(t=idiv(t,_,"string")))return r=!0,n}return n},n}function cadd(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(0===t.length)return create_chain(0);for(var n="0",i=0,a=t;i<a.length;i++){var o=resolve_value(a[i]);if(is_error_value(o))return create_chain(o);if(is_error_value(n=add(n,o,"string")))return create_chain(n)}return create_chain(n)}function csub(e){if(void 0===e)return create_chain(0);for(var t=String(resolve_value(e)),r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];for(var a=0,o=n;a<o.length;a++){if(is_error_value(t=sub(t,resolve_value(o[a]),"string")))return create_chain(t)}return create_chain(t)}function cmul(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(0===t.length)return create_chain(1);for(var n="1",i=0,a=t;i<a.length;i++){var o=resolve_value(a[i]);if(is_error_value(o))return create_chain(o);if(is_error_value(n=mul(n,o,"string")))return create_chain(n)}return create_chain(n)}function cdiv(e){if(void 0===e)return create_chain(1);for(var t=String(resolve_value(e)),r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];for(var a=0,o=n;a<o.length;a++){if(is_error_value(t=div(t,resolve_value(o[a]),"string")))return create_chain(t)}return create_chain(t)}function cmod(e){if(void 0===e)return create_chain(0);for(var t=String(resolve_value(e)),r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];for(var a=0,o=n;a<o.length;a++){if(is_error_value(t=mod(t,resolve_value(o[a]),"string")))return create_chain(t)}return create_chain(t)}function cpow(e){if(void 0===e)return create_chain(1);for(var t=String(resolve_value(e)),r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];for(var a=0,o=n;a<o.length;a++){if(is_error_value(t=pow(t,resolve_value(o[a]),"string")))return create_chain(t)}return create_chain(t)}function cidiv(e){if(void 0===e)return create_chain(0);for(var t=String(resolve_value(e)),r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];for(var a=0,o=n;a<o.length;a++){if(is_error_value(t=idiv(t,resolve_value(o[a]),"string")))return create_chain(t)}return create_chain(t)}function print_debug_info(e){var t=[],r=50,n="─".repeat(r);t.push("┌".concat(n,"┐")),t.push("│ [a-calc debug]".concat(" ".repeat(35),"│")),t.push("├".concat(n,"┤"));var i="│ 表达式: ".concat(e.expression);t.push(i+" ".repeat(Math.max(0,52-i.length))+"│"),t.push("│".concat(" ".repeat(r),"│")),t.push("│ 变量:".concat(" ".repeat(45),"│"));for(var a=0,o=Object.entries(e.variables);a<o.length;a++){var s=_slicedToArray(o[a],2),_=s[0],u=s[1],c="│ ".concat(_," = ").concat(u);t.push(c+" ".repeat(Math.max(0,52-c.length))+"│")}if(t.push("│".concat(" ".repeat(r),"│")),t.push("│ 步骤:".concat(" ".repeat(45),"│")),e.steps.forEach(function(e,r){var n="│ ".concat(r+1,". ").concat(e.expression);t.push(n+" ".repeat(Math.max(0,52-n.length))+"│");var i="│ → ".concat(e.substituted," = ").concat(e.result);t.push(i+" ".repeat(Math.max(0,52-i.length))+"│")}),t.push("│".concat(" ".repeat(r),"│")),e.format){var l="│ 格式化: | ".concat(e.format);t.push(l+" ".repeat(Math.max(0,52-l.length))+"│"),t.push("│".concat(" ".repeat(r),"│"))}var p='│ 结果: "'.concat(e.result,'"');t.push(p+" ".repeat(Math.max(0,52-p.length))+"│"),t.push("└".concat(n,"┘")),console.log(t.join("\n"))}function calc(e,t){var r,n=get_config(),i=t?Array.isArray(t)?t:_objectSpread2(_objectSpread2({},n),t):n,a=null!==(r=find_value(i,"_error"))&&void 0!==r?r:get_config("_error"),o=find_value(i,"_debug"),s=find_value(i,"_on_debug"),_=null;o&&(_={expression:e,variables:{},steps:[],format:null,result:null});try{var u,c,l,p=parse_args(e,i),d=p._unit;p._angle_unit&&set_config({_angle_unit:p._angle_unit});var f={_empty_values:p._empty_values,_empty_check:p._empty_check};if(o&&p.fill_data){var g=function(e){if(Array.isArray(e))e.forEach(function(e){return g(e)});else if(e&&"object"===_typeof(e))for(var t=0,r=Object.entries(e);t<r.length;t++){var n=_slicedToArray(r[t],2),i=n[0],a=n[1];i.startsWith("_")||"function"==typeof a||(_.variables[i]=a)}};g(p.fill_data)}var m=tokenizer(p.expr,p.fill_data,d,f);if(m._fill_data=p.fill_data,m._unit=d,m._options=f,o){var v=m.map(function(e){return void 0!==e.real_value&&e.real_value!==e.value?e.real_value:e.value}).join(" ");_.steps.push({expression:p.expr,substituted:v,result:"..."})}var h=eval_tokens(m);if(o&&_.steps.length>0&&(_.steps[_.steps.length-1].result=String(h)),"boolean"==typeof h)return o&&(_.result=h,get_config("_debug_console")&&print_debug_info(_),s&&s(_)),h;if("string"==typeof h&&!is_decimal(h))return o&&(_.result=h,get_config("_debug_console")&&print_debug_info(_),s&&s(_)),h;var w,b,y,x=is_decimal(h)?h:new Decimal(h);b=""===p.fmt_expr||void 0===p.fmt_expr?void 0:fmt_tokenizer(p.fmt_expr,p.fill_data);var S=get_config("_fmt_parsed");if(S&&S.has_var)y=fmt_tokenizer(get_config("_fmt"),p.fill_data);else y=S;if(void 0===b?void 0!==y&&(b=y):void 0!==y&&(b=[].concat(_toConsumableArray(y),_toConsumableArray(b))),o&&(p.fmt_expr||get_config("_fmt"))&&(_.format=p.fmt_expr||get_config("_fmt")),void 0===b)x=x.toFixed();else{var E=_slicedToArray(format(x,b,{_compact_units:p._compact_units,_compact_step:p._compact_step,_unit_convert_out:get_config("_unit_convert_out"),_unit_default_in:get_config("_unit_default_in"),_unit_default_out:get_config("_unit_default_out"),_unit_default_position:get_config("_unit_default_position"),_unit_position_map:get_config("_unit_position_map"),_thousands:p._thousands,_unit_thousands_map:get_config("_unit_thousands_map"),_recognized_unit:m.has_unit?m.unit:null}),2);x=E[0],w=E[1]}if("Infinity"===x||"NaN"===x||void 0===x)throw new Error("计算错误可能是非法的计算式");return!m.has_unit||null!==(u=w)&&void 0!==u&&u.to_number||null!==(c=w)&&void 0!==c&&c.to_number_string||null!==(l=w)&&void 0!==l&&l.unit_handled||(x+=m.unit),o&&(_.result=x,get_config("_debug_console")&&print_debug_info(_),s&&s(_)),x}catch(e){if(o&&(_.result=null!=a?a:e.message,_.error=e.message,get_config("_debug_console")&&print_debug_info(_),s&&s(_)),void 0===a)throw e;return a}}function calc_space(e,t){var r,n=get_config(),i=t?Array.isArray(t)?t:_objectSpread2(_objectSpread2({},n),t):n,a=null!==(r=find_value(i,"_error"))&&void 0!==r?r:get_config("_error"),o=find_value(i,"_debug"),s=find_value(i,"_on_debug"),_=null;o&&(_={expression:e,variables:{},steps:[],format:null,result:null});try{var u,c,l,p=parse_args(e,i),d=p._unit;p._angle_unit&&set_config({_angle_unit:p._angle_unit});var f={_empty_values:p._empty_values,_empty_check:p._empty_check};if(o&&p.fill_data){var g=function(e){if(Array.isArray(e))e.forEach(function(e){return g(e)});else if(e&&"object"===_typeof(e))for(var t=0,r=Object.entries(e);t<r.length;t++){var n=_slicedToArray(r[t],2),i=n[0],a=n[1];i.startsWith("_")||"function"==typeof a||(_.variables[i]=a)}};g(p.fill_data)}var m=tokenizer_space(p.expr,p.fill_data,d,f);if(m._fill_data=p.fill_data,m._unit=d,m._options=f,o){var v=m.map(function(e){return void 0!==e.real_value&&e.real_value!==e.value?e.real_value:e.value}).join(" ");_.steps.push({expression:p.expr,substituted:v,result:"..."})}var h=eval_tokens(m);if(o&&_.steps.length>0&&(_.steps[_.steps.length-1].result=String(h)),"boolean"==typeof h)return o&&(_.result=h,get_config("_debug_console")&&print_debug_info(_),s&&s(_)),h;if("string"==typeof h&&!is_decimal(h))return o&&(_.result=h,get_config("_debug_console")&&print_debug_info(_),s&&s(_)),h;var w,b,y,x=is_decimal(h)?h:new Decimal(h);b=""===p.fmt_expr||void 0===p.fmt_expr?void 0:fmt_tokenizer_space(p.fmt_expr,p.fill_data);var S=get_config("_fmt_parsed");if(S&&S.has_var)y=fmt_tokenizer_space(get_config("_fmt"),p.fill_data);else y=S;if(void 0===b?void 0!==y&&(b=y):void 0!==y&&(b=[].concat(_toConsumableArray(y),_toConsumableArray(b))),o&&(p.fmt_expr||get_config("_fmt"))&&(_.format=p.fmt_expr||get_config("_fmt")),void 0===b)x=x.toFixed();else{var E=_slicedToArray(format(x,b,{_compact_units:p._compact_units,_compact_step:p._compact_step,_unit_convert_out:get_config("_unit_convert_out"),_unit_default_in:get_config("_unit_default_in"),_unit_default_out:get_config("_unit_default_out"),_unit_default_position:get_config("_unit_default_position"),_unit_position_map:get_config("_unit_position_map"),_thousands:p._thousands,_unit_thousands_map:get_config("_unit_thousands_map"),_recognized_unit:m.has_unit?m.unit:null}),2);x=E[0],w=E[1]}if("Infinity"===x||"NaN"===x||void 0===x)throw new Error("计算错误可能是非法的计算式");return!m.has_unit||null!==(u=w)&&void 0!==u&&u.to_number||null!==(c=w)&&void 0!==c&&c.to_number_string||null!==(l=w)&&void 0!==l&&l.unit_handled||(x+=m.unit),o&&(_.result=x,get_config("_debug_console")&&print_debug_info(_),s&&s(_)),x}catch(e){if(o&&(_.result=null!=a?a:e.message,_.error=e.message,get_config("_debug_console")&&print_debug_info(_),s&&s(_)),void 0===a)throw e;return a}}function fmt(e,t,r){return calc(t?"".concat(e," | ").concat(t):"".concat(e),r)}function check_update(){check_version().catch(function(){})}function print_version(){console.log("%ca-calc:%c ".concat(version," %c=> %curl:%c https://www.npmjs.com/package/a-calc"),"color: #fff;background: #67C23A;padding: 2px 5px;border-radius:4px;font-size: 14px;","color: #67C23A;font-size:14px;","color: #67C23A;font-size:14px;","background: #67C23A;font-size:14px; padding: 2px 5px; border-radius: 4px; color: #fff;","font-size:14px;")}on_config_change("_compute_mode",function(e){set_compute_mode(e)}),Decimal.set({precision:50,rounding:Decimal.ROUND_HALF_UP,toExpNeg:-50,toExpPos:50}),register_calc_fallback(calc),register_calc(calc),register_calc_for_sum(calc);var calc_util={check_update:check_update,print_version:print_version,close_important_push:close_important_push,open_important_push:open_important_push},wasm;function radd(){return ops.add.apply(ops,arguments)}function rsub(){return ops.sub.apply(ops,arguments)}function rmul(){return ops.mul.apply(ops,arguments)}function rdiv(){return ops.div.apply(ops,arguments)}function rmod(){return ops.mod.apply(ops,arguments)}function rpow(){return ops.pow.apply(ops,arguments)}function ridiv(){return ops.idiv.apply(ops,arguments)}function rabs(){return ops.abs.apply(ops,arguments)}function rneg(){return ops.neg.apply(ops,arguments)}function rsqrt(){return ops.sqrt.apply(ops,arguments)}function rln(){return ops.ln.apply(ops,arguments)}function rexp(){return ops.exp.apply(ops,arguments)}function rsin(){return ops.sin.apply(ops,arguments)}function rcos(){return ops.cos.apply(ops,arguments)}function rtan(){return ops.tan.apply(ops,arguments)}function rasin(){return ops.asin.apply(ops,arguments)}function racos(){return ops.acos.apply(ops,arguments)}function ratan(){return ops.atan.apply(ops,arguments)}function rsinh(){return ops.sinh.apply(ops,arguments)}function rcosh(){return ops.cosh.apply(ops,arguments)}function rtanh(){return ops.tanh.apply(ops,arguments)}function rasinh(){return ops.asinh.apply(ops,arguments)}function racosh(){return ops.acosh.apply(ops,arguments)}function ratanh(){return ops.atanh.apply(ops,arguments)}function rfloor(){return ops.floor.apply(ops,arguments)}function rceil(){return ops.ceil.apply(ops,arguments)}function rtrunc(){return ops.trunc.apply(ops,arguments)}function rround(){return ops.round.apply(ops,arguments)}function rmax(){return ops.max.apply(ops,arguments)}function rmin(){return ops.min.apply(ops,arguments)}function rcompare(){return ops.compare.apply(ops,arguments)}function req(){return ops.eq.apply(ops,arguments)}function rlt(){return ops.lt.apply(ops,arguments)}function rgt(){return ops.gt.apply(ops,arguments)}function rlte(){return ops.lte.apply(ops,arguments)}function rgte(){return ops.gte.apply(ops,arguments)}function rlog(){return ops.log.apply(ops,arguments)}function rlog2(){return ops.log2.apply(ops,arguments)}function rlog10(){return ops.log10.apply(ops,arguments)}function rcbrt(){return ops.cbrt.apply(ops,arguments)}var cachedDataViewMemory0=null;function getDataViewMemory0(){return(null===cachedDataViewMemory0||!0===cachedDataViewMemory0.buffer.detached||void 0===cachedDataViewMemory0.buffer.detached&&cachedDataViewMemory0.buffer!==wasm.memory.buffer)&&(cachedDataViewMemory0=new DataView(wasm.memory.buffer)),cachedDataViewMemory0}function getStringFromWasm0(e,t){return decodeText(e>>>=0,t)}var cachedUint8ArrayMemory0=null;function getUint8ArrayMemory0(){return null!==cachedUint8ArrayMemory0&&0!==cachedUint8ArrayMemory0.byteLength||(cachedUint8ArrayMemory0=new Uint8Array(wasm.memory.buffer)),cachedUint8ArrayMemory0}function passStringToWasm0(e,t,r){if(void 0===r){var n=cachedTextEncoder.encode(e),i=t(n.length,1)>>>0;return getUint8ArrayMemory0().subarray(i,i+n.length).set(n),WASM_VECTOR_LEN=n.length,i}for(var a=e.length,o=t(a,1)>>>0,s=getUint8ArrayMemory0(),_=0;_<a;_++){var u=e.charCodeAt(_);if(u>127)break;s[o+_]=u}if(_!==a){0!==_&&(e=e.slice(_)),o=r(o,a,a=_+3*e.length,1)>>>0;var c=getUint8ArrayMemory0().subarray(o+_,o+a);o=r(o,a,_+=cachedTextEncoder.encodeInto(e,c).written,1)>>>0}return WASM_VECTOR_LEN=_,o}var cachedTextDecoder=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});cachedTextDecoder.decode();var MAX_SAFARI_DECODE_BYTES=2146435072,numBytesDecoded=0;function decodeText(e,t){return(numBytesDecoded+=t)>=MAX_SAFARI_DECODE_BYTES&&((cachedTextDecoder=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0})).decode(),numBytesDecoded=t),cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(e,e+t))}var cachedTextEncoder=new TextEncoder;"encodeInto"in cachedTextEncoder||(cachedTextEncoder.encodeInto=function(e,t){var r=cachedTextEncoder.encode(e);return t.set(r),{read:e.length,written:r.length}});var WASM_VECTOR_LEN=0;function eval_expr(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.eval_expr(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function eval_expr_safe(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.eval_expr_safe(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_abs(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_abs(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_ceil(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_ceil(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_compare(e,t){var r=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),n=WASM_VECTOR_LEN,i=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;return wasm.str_compare(r,n,i,a)}function str_cos(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_cos(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_div(e,t){var r,n;try{var i=wasm.__wbindgen_add_to_stack_pointer(-16),a=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),o=WASM_VECTOR_LEN,s=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),_=WASM_VECTOR_LEN;wasm.str_div(i,a,o,s,_);var u=getDataViewMemory0().getInt32(i+0,!0),c=getDataViewMemory0().getInt32(i+4,!0);return r=u,n=c,getStringFromWasm0(u,c)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(r,n,1)}}function str_eq(e,t){var r=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),n=WASM_VECTOR_LEN,i=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;return 0!==wasm.str_eq(r,n,i,a)}function str_exp(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_exp(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_floor(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_floor(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_fract(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_fract(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_gt(e,t){var r=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),n=WASM_VECTOR_LEN,i=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;return 0!==wasm.str_gt(r,n,i,a)}function str_gte(e,t){var r=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),n=WASM_VECTOR_LEN,i=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;return 0!==wasm.str_gte(r,n,i,a)}function str_is_integer(e){var t=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),r=WASM_VECTOR_LEN;return 0!==wasm.str_is_integer(t,r)}function str_is_negative(e){var t=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),r=WASM_VECTOR_LEN;return 0!==wasm.str_is_negative(t,r)}function str_is_positive(e){var t=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),r=WASM_VECTOR_LEN;return 0!==wasm.str_is_positive(t,r)}function str_is_zero(e){var t=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),r=WASM_VECTOR_LEN;return 0!==wasm.str_is_zero(t,r)}function str_ln(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_ln(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_log10(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_log10(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_lt(e,t){var r=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),n=WASM_VECTOR_LEN,i=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;return 0!==wasm.str_lt(r,n,i,a)}function str_lte(e,t){var r=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),n=WASM_VECTOR_LEN,i=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;return 0!==wasm.str_lte(r,n,i,a)}function str_max(e,t){var r,n;try{var i=wasm.__wbindgen_add_to_stack_pointer(-16),a=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),o=WASM_VECTOR_LEN,s=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),_=WASM_VECTOR_LEN;wasm.str_max(i,a,o,s,_);var u=getDataViewMemory0().getInt32(i+0,!0),c=getDataViewMemory0().getInt32(i+4,!0);return r=u,n=c,getStringFromWasm0(u,c)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(r,n,1)}}function str_min(e,t){var r,n;try{var i=wasm.__wbindgen_add_to_stack_pointer(-16),a=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),o=WASM_VECTOR_LEN,s=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),_=WASM_VECTOR_LEN;wasm.str_min(i,a,o,s,_);var u=getDataViewMemory0().getInt32(i+0,!0),c=getDataViewMemory0().getInt32(i+4,!0);return r=u,n=c,getStringFromWasm0(u,c)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(r,n,1)}}function str_mod(e,t){var r,n;try{var i=wasm.__wbindgen_add_to_stack_pointer(-16),a=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),o=WASM_VECTOR_LEN,s=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),_=WASM_VECTOR_LEN;wasm.str_mod(i,a,o,s,_);var u=getDataViewMemory0().getInt32(i+0,!0),c=getDataViewMemory0().getInt32(i+4,!0);return r=u,n=c,getStringFromWasm0(u,c)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(r,n,1)}}function str_mul(e,t){var r,n;try{var i=wasm.__wbindgen_add_to_stack_pointer(-16),a=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),o=WASM_VECTOR_LEN,s=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),_=WASM_VECTOR_LEN;wasm.str_mul(i,a,o,s,_);var u=getDataViewMemory0().getInt32(i+0,!0),c=getDataViewMemory0().getInt32(i+4,!0);return r=u,n=c,getStringFromWasm0(u,c)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(r,n,1)}}function str_neg(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_neg(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_normalize(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_normalize(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_plus(e,t){var r,n;try{var i=wasm.__wbindgen_add_to_stack_pointer(-16),a=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),o=WASM_VECTOR_LEN,s=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),_=WASM_VECTOR_LEN;wasm.str_plus(i,a,o,s,_);var u=getDataViewMemory0().getInt32(i+0,!0),c=getDataViewMemory0().getInt32(i+4,!0);return r=u,n=c,getStringFromWasm0(u,c)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(r,n,1)}}function str_pow(e,t){var r,n;try{var i=wasm.__wbindgen_add_to_stack_pointer(-16),a=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),o=WASM_VECTOR_LEN;wasm.str_pow(i,a,o,t);var s=getDataViewMemory0().getInt32(i+0,!0),_=getDataViewMemory0().getInt32(i+4,!0);return r=s,n=_,getStringFromWasm0(s,_)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(r,n,1)}}function str_powd(e,t){var r,n;try{var i=wasm.__wbindgen_add_to_stack_pointer(-16),a=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),o=WASM_VECTOR_LEN,s=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),_=WASM_VECTOR_LEN;wasm.str_powd(i,a,o,s,_);var u=getDataViewMemory0().getInt32(i+0,!0),c=getDataViewMemory0().getInt32(i+4,!0);return r=u,n=c,getStringFromWasm0(u,c)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(r,n,1)}}function str_round(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_round(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_round_dp(e,t){var r,n;try{var i=wasm.__wbindgen_add_to_stack_pointer(-16),a=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),o=WASM_VECTOR_LEN;wasm.str_round_dp(i,a,o,t);var s=getDataViewMemory0().getInt32(i+0,!0),_=getDataViewMemory0().getInt32(i+4,!0);return r=s,n=_,getStringFromWasm0(s,_)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(r,n,1)}}function str_round_dp_bankers(e,t){var r,n;try{var i=wasm.__wbindgen_add_to_stack_pointer(-16),a=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),o=WASM_VECTOR_LEN;wasm.str_round_dp_bankers(i,a,o,t);var s=getDataViewMemory0().getInt32(i+0,!0),_=getDataViewMemory0().getInt32(i+4,!0);return r=s,n=_,getStringFromWasm0(s,_)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(r,n,1)}}function str_scale(e){var t=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),r=WASM_VECTOR_LEN;return wasm.str_scale(t,r)>>>0}function str_sign(e){var t=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),r=WASM_VECTOR_LEN;return wasm.str_sign(t,r)}function str_sin(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_sin(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_sqrt(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_sqrt(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_sub(e,t){var r,n;try{var i=wasm.__wbindgen_add_to_stack_pointer(-16),a=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),o=WASM_VECTOR_LEN,s=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),_=WASM_VECTOR_LEN;wasm.str_sub(i,a,o,s,_);var u=getDataViewMemory0().getInt32(i+0,!0),c=getDataViewMemory0().getInt32(i+4,!0);return r=u,n=c,getStringFromWasm0(u,c)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(r,n,1)}}function str_tan(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_tan(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_trunc(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_trunc(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}var EXPECTED_RESPONSE_TYPES=new Set(["basic","cors","default"]);function __wbg_load(e,t){return _wbg_load.apply(this,arguments)}function _wbg_load(){return(_wbg_load=_asyncToGenerator(_regenerator().m(function e(t,r){var n,i,a;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:if(!("function"==typeof Response&&t instanceof Response)){e.n=8;break}if("function"!=typeof WebAssembly.instantiateStreaming){e.n=5;break}return e.p=1,e.n=2,WebAssembly.instantiateStreaming(t,r);case 2:case 7:return e.a(2,e.v);case 3:if(e.p=3,a=e.v,!(t.ok&&EXPECTED_RESPONSE_TYPES.has(t.type))||"application/wasm"===t.headers.get("Content-Type")){e.n=4;break}console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",a),e.n=5;break;case 4:throw a;case 5:return e.n=6,t.arrayBuffer();case 6:return n=e.v,e.n=7,WebAssembly.instantiate(n,r);case 8:return e.n=9,WebAssembly.instantiate(t,r);case 9:if(!((i=e.v)instanceof WebAssembly.Instance)){e.n=10;break}return e.a(2,{instance:i,module:t});case 10:return e.a(2,i);case 11:return e.a(2)}},e,null,[[1,3]])}))).apply(this,arguments)}function __wbg_get_imports(){var e={wbg:{}};return e}function __wbg_finalize_init(e,t){return wasm=e.exports,__wbg_init.__wbindgen_wasm_module=t,cachedDataViewMemory0=null,cachedUint8ArrayMemory0=null,wasm}function initSync(e){if(void 0!==wasm)return wasm;void 0!==e&&(Object.getPrototypeOf(e)===Object.prototype?e=e.module:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));var t=__wbg_get_imports();return e instanceof WebAssembly.Module||(e=new WebAssembly.Module(e)),__wbg_finalize_init(new WebAssembly.Instance(e,t),e)}function __wbg_init(e){return _wbg_init.apply(this,arguments)}function _wbg_init(){return(_wbg_init=_asyncToGenerator(_regenerator().m(function e(t){var r,n,i,a,o;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:if(void 0===wasm){e.n=1;break}return e.a(2,wasm);case 1:return void 0!==t&&(Object.getPrototypeOf(t)===Object.prototype?t=t.module_or_path:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),void 0===t&&(t=new URL("wasm_calc_bg.wasm","undefined"==typeof document?require("url").pathToFileURL(__filename).href:_documentCurrentScript&&"SCRIPT"===_documentCurrentScript.tagName.toUpperCase()&&_documentCurrentScript.src||new URL("index.js",document.baseURI).href)),r=__wbg_get_imports(),("string"==typeof t||"function"==typeof Request&&t instanceof Request||"function"==typeof URL&&t instanceof URL)&&(t=fetch(t)),o=__wbg_load,e.n=2,t;case 2:return e.n=3,o(e.v,r);case 3:return n=e.v,i=n.instance,a=n.module,e.a(2,__wbg_finalize_init(i,a))}},e)}))).apply(this,arguments)}var wasm_calc=Object.freeze({__proto__:null,default:__wbg_init,eval_expr:eval_expr,eval_expr_safe:eval_expr_safe,initSync:initSync,str_abs:str_abs,str_ceil:str_ceil,str_compare:str_compare,str_cos:str_cos,str_div:str_div,str_eq:str_eq,str_exp:str_exp,str_floor:str_floor,str_fract:str_fract,str_gt:str_gt,str_gte:str_gte,str_is_integer:str_is_integer,str_is_negative:str_is_negative,str_is_positive:str_is_positive,str_is_zero:str_is_zero,str_ln:str_ln,str_log10:str_log10,str_lt:str_lt,str_lte:str_lte,str_max:str_max,str_min:str_min,str_mod:str_mod,str_mul:str_mul,str_neg:str_neg,str_normalize:str_normalize,str_plus:str_plus,str_pow:str_pow,str_powd:str_powd,str_round:str_round,str_round_dp:str_round_dp,str_round_dp_bankers:str_round_dp_bankers,str_scale:str_scale,str_sign:str_sign,str_sin:str_sin,str_sqrt:str_sqrt,str_sub:str_sub,str_tan:str_tan,str_trunc:str_trunc});exports.abs=abs,exports.add=add,exports.babs=babs,exports.bacos=bacos,exports.bacosh=bacosh,exports.badd=badd,exports.basin=basin,exports.basinh=basinh,exports.batan=batan,exports.batanh=batanh,exports.bcbrt=bcbrt,exports.bceil=bceil,exports.bcompare=bcompare,exports.bcos=bcos,exports.bcosh=bcosh,exports.bdiv=bdiv,exports.beq=beq,exports.bexp=bexp,exports.bfloor=bfloor,exports.bgt=bgt,exports.bgte=bgte,exports.bidiv=bidiv,exports.bln=bln,exports.blog=blog,exports.blog10=blog10,exports.blog2=blog2,exports.blt=blt,exports.blte=blte,exports.bmax=bmax,exports.bmin=bmin,exports.bmod=bmod,exports.bmul=bmul,exports.bneg=bneg,exports.bpow=bpow,exports.bround=bround,exports.bsin=bsin,exports.bsinh=bsinh,exports.bsqrt=bsqrt,exports.bsub=bsub,exports.btan=btan,exports.btanh=btanh,exports.btrunc=btrunc,exports.cadd=cadd,exports.calc=calc,exports.calc_space=calc_space,exports.calc_sum=calc_sum,exports.calc_util=calc_util,exports.calc_wrap=calc_wrap,exports.cdiv=cdiv,exports.cidiv=cidiv,exports.cmod=cmod,exports.cmul=cmul,exports.cpow=cpow,exports.csub=csub,exports.dabs=dabs,exports.dacos=dacos,exports.dacosh=dacosh,exports.dadd=dadd,exports.dasin=dasin,exports.dasinh=dasinh,exports.datan=datan,exports.datanh=datanh,exports.dcbrt=dcbrt,exports.dceil=dceil,exports.dcompare=dcompare,exports.dcos=dcos,exports.dcosh=dcosh,exports.ddiv=ddiv,exports.deq=deq,exports.dexp=dexp,exports.dfloor=dfloor,exports.dgt=dgt,exports.dgte=dgte,exports.didiv=didiv,exports.div=div,exports.dln=dln,exports.dlog=dlog,exports.dlog10=dlog10,exports.dlog2=dlog2,exports.dlt=dlt,exports.dlte=dlte,exports.dmax=dmax,exports.dmin=dmin,exports.dmod=dmod,exports.dmul=dmul,exports.dneg=dneg,exports.dpow=dpow,exports.dround=dround,exports.dsin=dsin,exports.dsinh=dsinh,exports.dsqrt=dsqrt,exports.dsub=dsub,exports.dtan=dtan,exports.dtanh=dtanh,exports.dtrunc=dtrunc,exports.exp=exp,exports.fmt=fmt,exports.get_config=get_config,exports.idiv=idiv,exports.is_wasm_loaded=is_wasm_loaded,exports.ln=ln,exports.load_wasm=load_wasm,exports.mod=mod,exports.mul=mul,exports.neg=neg,exports.parse_thousands=parse_thousands,exports.pow=pow,exports.rabs=rabs,exports.racos=racos,exports.racosh=racosh,exports.radd=radd,exports.rasin=rasin,exports.rasinh=rasinh,exports.ratan=ratan,exports.ratanh=ratanh,exports.rcbrt=rcbrt,exports.rceil=rceil,exports.rcompare=rcompare,exports.rcos=rcos,exports.rcosh=rcosh,exports.rdiv=rdiv,exports.req=req,exports.reset_config=reset_config,exports.rexp=rexp,exports.rfloor=rfloor,exports.rgt=rgt,exports.rgte=rgte,exports.ridiv=ridiv,exports.rln=rln,exports.rlog=rlog,exports.rlog10=rlog10,exports.rlog2=rlog2,exports.rlt=rlt,exports.rlte=rlte,exports.rmax=rmax,exports.rmin=rmin,exports.rmod=rmod,exports.rmul=rmul,exports.rneg=rneg,exports.rpow=rpow,exports.rround=rround,exports.rsin=rsin,exports.rsinh=rsinh,exports.rsqrt=rsqrt,exports.rsub=rsub,exports.rtan=rtan,exports.rtanh=rtanh,exports.rtrunc=rtrunc,exports.set_config=set_config,exports.sqrt=sqrt,exports.sub=sub,exports.version=version,exports.wacos=wacos,exports.wacosh=wacosh,exports.wasin=wasin,exports.wasinh=wasinh,exports.watan=watan,exports.watanh=watanh,exports.wcalc=wcalc,exports.wcbrt=wcbrt,exports.wcosh=wcosh,exports.wlog=wlog,exports.wlog2=wlog2,exports.wsinh=wsinh,exports.wtanh=wtanh;