vue3-calculator
Version:
A Vue 3 calculator component with scientific and standard modes
9 lines • 64.5 kB
JavaScript
(function(x,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],a):(x=typeof globalThis<"u"?globalThis:x||self,a(x.Vue3Calculator={},x.Vue))})(this,function(x,a){"use strict";/*!
* decimal.js v10.6.0
* An arbitrary-precision Decimal type for JavaScript.
* https://github.com/MikeMcl/decimal.js
* Copyright (c) 2025 Michael Mclaughlin <M8ch88l@gmail.com>
* MIT Licence
*/var ue=9e15,Q=1e9,Ve="0123456789abcdef",he="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",pe="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",ke={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-ue,maxE:ue,crypto:!1},ze,j,C=!0,ge="[DecimalError] ",Y=ge+"Invalid argument: ",Le=ge+"Precision limit exceeded",He=ge+"crypto unavailable",$e="[object Decimal]",O=Math.floor,A=Math.pow,je=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,Je=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,Ke=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,Fe=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,W=1e7,N=7,Qe=9007199254740991,Ye=he.length-1,Ce=pe.length-1,p={toStringTag:$e};p.absoluteValue=p.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),w(e)},p.ceil=function(){return w(new this.constructor(this),this.e+1,2)},p.clampedTo=p.clamp=function(e,t){var n,i=this,r=i.constructor;if(e=new r(e),t=new r(t),!e.s||!t.s)return new r(NaN);if(e.gt(t))throw Error(Y+t);return n=i.cmp(e),n<0?e:i.cmp(t)>0?t:new r(i)},p.comparedTo=p.cmp=function(e){var t,n,i,r,o=this,s=o.d,l=(e=new o.constructor(e)).d,u=o.s,c=e.s;if(!s||!l)return!u||!c?NaN:u!==c?u:s===l?0:!s^u<0?1:-1;if(!s[0]||!l[0])return s[0]?u:l[0]?-c:0;if(u!==c)return u;if(o.e!==e.e)return o.e>e.e^u<0?1:-1;for(i=s.length,r=l.length,t=0,n=i<r?i:r;t<n;++t)if(s[t]!==l[t])return s[t]>l[t]^u<0?1:-1;return i===r?0:i>r^u<0?1:-1},p.cosine=p.cos=function(){var e,t,n=this,i=n.constructor;return n.d?n.d[0]?(e=i.precision,t=i.rounding,i.precision=e+Math.max(n.e,n.sd())+N,i.rounding=1,n=et(i,Pe(i,n)),i.precision=e,i.rounding=t,w(j==2||j==3?n.neg():n,e,t,!0)):new i(1):new i(NaN)},p.cubeRoot=p.cbrt=function(){var e,t,n,i,r,o,s,l,u,c,f=this,m=f.constructor;if(!f.isFinite()||f.isZero())return new m(f);for(C=!1,o=f.s*A(f.s*f,1/3),!o||Math.abs(o)==1/0?(n=D(f.d),e=f.e,(o=(e-n.length+1)%3)&&(n+=o==1||o==-2?"0":"00"),o=A(n,1/3),e=O((e+1)/3)-(e%3==(e<0?-1:2)),o==1/0?n="5e"+e:(n=o.toExponential(),n=n.slice(0,n.indexOf("e")+1)+e),i=new m(n),i.s=f.s):i=new m(o.toString()),s=(e=m.precision)+3;;)if(l=i,u=l.times(l).times(l),c=u.plus(f),i=$(c.plus(f).times(l),c.plus(u),s+2,1),D(l.d).slice(0,s)===(n=D(i.d)).slice(0,s))if(n=n.slice(s-3,s+1),n=="9999"||!r&&n=="4999"){if(!r&&(w(l,e+1,0),l.times(l).times(l).eq(f))){i=l;break}s+=4,r=1}else{(!+n||!+n.slice(1)&&n.charAt(0)=="5")&&(w(i,e+1,1),t=!i.times(i).times(i).eq(f));break}return C=!0,w(i,e,m.rounding,t)},p.decimalPlaces=p.dp=function(){var e,t=this.d,n=NaN;if(t){if(e=t.length-1,n=(e-O(this.e/N))*N,e=t[e],e)for(;e%10==0;e/=10)n--;n<0&&(n=0)}return n},p.dividedBy=p.div=function(e){return $(this,new this.constructor(e))},p.dividedToIntegerBy=p.divToInt=function(e){var t=this,n=t.constructor;return w($(t,new n(e),0,1,1),n.precision,n.rounding)},p.equals=p.eq=function(e){return this.cmp(e)===0},p.floor=function(){return w(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 t==1||t===0},p.hyperbolicCosine=p.cosh=function(){var e,t,n,i,r,o=this,s=o.constructor,l=new s(1);if(!o.isFinite())return new s(o.s?1/0:NaN);if(o.isZero())return l;n=s.precision,i=s.rounding,s.precision=n+Math.max(o.e,o.sd())+4,s.rounding=1,r=o.d.length,r<32?(e=Math.ceil(r/3),t=(1/be(4,e)).toString()):(e=16,t="2.3283064365386962890625e-10"),o=fe(s,1,o.times(t),new s(1),!0);for(var u,c=e,f=new s(8);c--;)u=o.times(o),o=l.minus(u.times(f.minus(u.times(f))));return w(o,s.precision=n,s.rounding=i,!0)},p.hyperbolicSine=p.sinh=function(){var e,t,n,i,r=this,o=r.constructor;if(!r.isFinite()||r.isZero())return new o(r);if(t=o.precision,n=o.rounding,o.precision=t+Math.max(r.e,r.sd())+4,o.rounding=1,i=r.d.length,i<3)r=fe(o,2,r,r,!0);else{e=1.4*Math.sqrt(i),e=e>16?16:e|0,r=r.times(1/be(5,e)),r=fe(o,2,r,r,!0);for(var s,l=new o(5),u=new o(16),c=new o(20);e--;)s=r.times(r),r=r.times(l.plus(s.times(u.times(s).plus(c))))}return o.precision=t,o.rounding=n,w(r,t,n,!0)},p.hyperbolicTangent=p.tanh=function(){var e,t,n=this,i=n.constructor;return n.isFinite()?n.isZero()?new i(n):(e=i.precision,t=i.rounding,i.precision=e+7,i.rounding=1,$(n.sinh(),n.cosh(),i.precision=e,i.rounding=t)):new i(n.s)},p.inverseCosine=p.acos=function(){var e=this,t=e.constructor,n=e.abs().cmp(1),i=t.precision,r=t.rounding;return n!==-1?n===0?e.isNeg()?X(t,i,r):new t(0):new t(NaN):e.isZero()?X(t,i+4,r).times(.5):(t.precision=i+6,t.rounding=1,e=new t(1).minus(e).div(e.plus(1)).sqrt().atan(),t.precision=i,t.rounding=r,e.times(2))},p.inverseHyperbolicCosine=p.acosh=function(){var e,t,n=this,i=n.constructor;return n.lte(1)?new i(n.eq(1)?0:NaN):n.isFinite()?(e=i.precision,t=i.rounding,i.precision=e+Math.max(Math.abs(n.e),n.sd())+4,i.rounding=1,C=!1,n=n.times(n).minus(1).sqrt().plus(n),C=!0,i.precision=e,i.rounding=t,n.ln()):new i(n)},p.inverseHyperbolicSine=p.asinh=function(){var e,t,n=this,i=n.constructor;return!n.isFinite()||n.isZero()?new i(n):(e=i.precision,t=i.rounding,i.precision=e+2*Math.max(Math.abs(n.e),n.sd())+6,i.rounding=1,C=!1,n=n.times(n).plus(1).sqrt().plus(n),C=!0,i.precision=e,i.rounding=t,n.ln())},p.inverseHyperbolicTangent=p.atanh=function(){var e,t,n,i,r=this,o=r.constructor;return r.isFinite()?r.e>=0?new o(r.abs().eq(1)?r.s/0:r.isZero()?r:NaN):(e=o.precision,t=o.rounding,i=r.sd(),Math.max(i,e)<2*-r.e-1?w(new o(r),e,t,!0):(o.precision=n=i-r.e,r=$(r.plus(1),new o(1).minus(r),n+e,1),o.precision=e+4,o.rounding=1,r=r.ln(),o.precision=e,o.rounding=t,r.times(.5))):new o(NaN)},p.inverseSine=p.asin=function(){var e,t,n,i,r=this,o=r.constructor;return r.isZero()?new o(r):(t=r.abs().cmp(1),n=o.precision,i=o.rounding,t!==-1?t===0?(e=X(o,n+4,i).times(.5),e.s=r.s,e):new o(NaN):(o.precision=n+6,o.rounding=1,r=r.div(new o(1).minus(r.times(r)).sqrt().plus(1)).atan(),o.precision=n,o.rounding=i,r.times(2)))},p.inverseTangent=p.atan=function(){var e,t,n,i,r,o,s,l,u,c=this,f=c.constructor,m=f.precision,h=f.rounding;if(c.isFinite()){if(c.isZero())return new f(c);if(c.abs().eq(1)&&m+4<=Ce)return s=X(f,m+4,h).times(.25),s.s=c.s,s}else{if(!c.s)return new f(NaN);if(m+4<=Ce)return s=X(f,m+4,h).times(.5),s.s=c.s,s}for(f.precision=l=m+10,f.rounding=1,n=Math.min(28,l/N+2|0),e=n;e;--e)c=c.div(c.times(c).plus(1).sqrt().plus(1));for(C=!1,t=Math.ceil(l/N),i=1,u=c.times(c),s=new f(c),r=c;e!==-1;)if(r=r.times(u),o=s.minus(r.div(i+=2)),r=r.times(u),s=o.plus(r.div(i+=2)),s.d[t]!==void 0)for(e=t;s.d[e]===o.d[e]&&e--;);return n&&(s=s.times(2<<n-1)),C=!0,w(s,f.precision=m,f.rounding=h,!0)},p.isFinite=function(){return!!this.d},p.isInteger=p.isInt=function(){return!!this.d&&O(this.e/N)>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&&this.d[0]===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,n,i,r,o,s,l,u,c=this,f=c.constructor,m=f.precision,h=f.rounding,v=5;if(e==null)e=new f(10),t=!0;else{if(e=new f(e),n=e.d,e.s<0||!n||!n[0]||e.eq(1))return new f(NaN);t=e.eq(10)}if(n=c.d,c.s<0||!n||!n[0]||c.eq(1))return new f(n&&!n[0]?-1/0:c.s!=1?NaN:n?0:1/0);if(t)if(n.length>1)o=!0;else{for(r=n[0];r%10===0;)r/=10;o=r!==1}if(C=!1,l=m+v,s=te(c,l),i=t?Ne(f,l+10):te(e,l),u=$(s,i,l,1),de(u.d,r=m,h))do if(l+=10,s=te(c,l),i=t?Ne(f,l+10):te(e,l),u=$(s,i,l,1),!o){+D(u.d).slice(r+1,r+15)+1==1e14&&(u=w(u,m+1,0));break}while(de(u.d,r+=10,h));return C=!0,w(u,m,h)},p.minus=p.sub=function(e){var t,n,i,r,o,s,l,u,c,f,m,h,v=this,k=v.constructor;if(e=new k(e),!v.d||!e.d)return!v.s||!e.s?e=new k(NaN):v.d?e.s=-e.s:e=new k(e.d||v.s!==e.s?v:NaN),e;if(v.s!=e.s)return e.s=-e.s,v.plus(e);if(c=v.d,h=e.d,l=k.precision,u=k.rounding,!c[0]||!h[0]){if(h[0])e.s=-e.s;else if(c[0])e=new k(v);else return new k(u===3?-0:0);return C?w(e,l,u):e}if(n=O(e.e/N),f=O(v.e/N),c=c.slice(),o=f-n,o){for(m=o<0,m?(t=c,o=-o,s=h.length):(t=h,n=f,s=c.length),i=Math.max(Math.ceil(l/N),s)+2,o>i&&(o=i,t.length=1),t.reverse(),i=o;i--;)t.push(0);t.reverse()}else{for(i=c.length,s=h.length,m=i<s,m&&(s=i),i=0;i<s;i++)if(c[i]!=h[i]){m=c[i]<h[i];break}o=0}for(m&&(t=c,c=h,h=t,e.s=-e.s),s=c.length,i=h.length-s;i>0;--i)c[s++]=0;for(i=h.length;i>o;){if(c[--i]<h[i]){for(r=i;r&&c[--r]===0;)c[r]=W-1;--c[r],c[i]+=W}c[i]-=h[i]}for(;c[--s]===0;)c.pop();for(;c[0]===0;c.shift())--n;return c[0]?(e.d=c,e.e=we(c,n),C?w(e,l,u):e):new k(u===3?-0:0)},p.modulo=p.mod=function(e){var t,n=this,i=n.constructor;return e=new i(e),!n.d||!e.s||e.d&&!e.d[0]?new i(NaN):!e.d||n.d&&!n.d[0]?w(new i(n),i.precision,i.rounding):(C=!1,i.modulo==9?(t=$(n,e.abs(),0,3,1),t.s*=e.s):t=$(n,e,0,i.modulo,1),t=t.times(e),C=!0,n.minus(t))},p.naturalExponential=p.exp=function(){return Me(this)},p.naturalLogarithm=p.ln=function(){return te(this)},p.negated=p.neg=function(){var e=new this.constructor(this);return e.s=-e.s,w(e)},p.plus=p.add=function(e){var t,n,i,r,o,s,l,u,c,f,m=this,h=m.constructor;if(e=new h(e),!m.d||!e.d)return!m.s||!e.s?e=new h(NaN):m.d||(e=new h(e.d||m.s===e.s?m:NaN)),e;if(m.s!=e.s)return e.s=-e.s,m.minus(e);if(c=m.d,f=e.d,l=h.precision,u=h.rounding,!c[0]||!f[0])return f[0]||(e=new h(m)),C?w(e,l,u):e;if(o=O(m.e/N),i=O(e.e/N),c=c.slice(),r=o-i,r){for(r<0?(n=c,r=-r,s=f.length):(n=f,i=o,s=c.length),o=Math.ceil(l/N),s=o>s?o+1:s+1,r>s&&(r=s,n.length=1),n.reverse();r--;)n.push(0);n.reverse()}for(s=c.length,r=f.length,s-r<0&&(r=s,n=f,f=c,c=n),t=0;r;)t=(c[--r]=c[r]+f[r]+t)/W|0,c[r]%=W;for(t&&(c.unshift(t),++i),s=c.length;c[--s]==0;)c.pop();return e.d=c,e.e=we(c,i),C?w(e,l,u):e},p.precision=p.sd=function(e){var t,n=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(Y+e);return n.d?(t=qe(n.d),e&&n.e+1>t&&(t=n.e+1)):t=NaN,t},p.round=function(){var e=this,t=e.constructor;return w(new t(e),e.e+1,t.rounding)},p.sine=p.sin=function(){var e,t,n=this,i=n.constructor;return n.isFinite()?n.isZero()?new i(n):(e=i.precision,t=i.rounding,i.precision=e+Math.max(n.e,n.sd())+N,i.rounding=1,n=nt(i,Pe(i,n)),i.precision=e,i.rounding=t,w(j>2?n.neg():n,e,t,!0)):new i(NaN)},p.squareRoot=p.sqrt=function(){var e,t,n,i,r,o,s=this,l=s.d,u=s.e,c=s.s,f=s.constructor;if(c!==1||!l||!l[0])return new f(!c||c<0&&(!l||l[0])?NaN:l?s:1/0);for(C=!1,c=Math.sqrt(+s),c==0||c==1/0?(t=D(l),(t.length+u)%2==0&&(t+="0"),c=Math.sqrt(t),u=O((u+1)/2)-(u<0||u%2),c==1/0?t="5e"+u:(t=c.toExponential(),t=t.slice(0,t.indexOf("e")+1)+u),i=new f(t)):i=new f(c.toString()),n=(u=f.precision)+3;;)if(o=i,i=o.plus($(s,o,n+2,1)).times(.5),D(o.d).slice(0,n)===(t=D(i.d)).slice(0,n))if(t=t.slice(n-3,n+1),t=="9999"||!r&&t=="4999"){if(!r&&(w(o,u+1,0),o.times(o).eq(s))){i=o;break}n+=4,r=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(w(i,u+1,1),e=!i.times(i).eq(s));break}return C=!0,w(i,u,f.rounding,e)},p.tangent=p.tan=function(){var e,t,n=this,i=n.constructor;return n.isFinite()?n.isZero()?new i(n):(e=i.precision,t=i.rounding,i.precision=e+10,i.rounding=1,n=n.sin(),n.s=1,n=$(n,new i(1).minus(n.times(n)).sqrt(),e+10,0),i.precision=e,i.rounding=t,w(j==2||j==4?n.neg():n,e,t,!0)):new i(NaN)},p.times=p.mul=function(e){var t,n,i,r,o,s,l,u,c,f=this,m=f.constructor,h=f.d,v=(e=new m(e)).d;if(e.s*=f.s,!h||!h[0]||!v||!v[0])return new m(!e.s||h&&!h[0]&&!v||v&&!v[0]&&!h?NaN:!h||!v?e.s/0:e.s*0);for(n=O(f.e/N)+O(e.e/N),u=h.length,c=v.length,u<c&&(o=h,h=v,v=o,s=u,u=c,c=s),o=[],s=u+c,i=s;i--;)o.push(0);for(i=c;--i>=0;){for(t=0,r=u+i;r>i;)l=o[r]+v[i]*h[r-i-1]+t,o[r--]=l%W|0,t=l/W|0;o[r]=(o[r]+t)%W|0}for(;!o[--s];)o.pop();return t?++n:o.shift(),e.d=o,e.e=we(o,n),C?w(e,m.precision,m.rounding):e},p.toBinary=function(e,t){return ye(this,2,e,t)},p.toDecimalPlaces=p.toDP=function(e,t){var n=this,i=n.constructor;return n=new i(n),e===void 0?n:(Z(e,0,Q),t===void 0?t=i.rounding:Z(t,0,8),w(n,e+n.e+1,t))},p.toExponential=function(e,t){var n,i=this,r=i.constructor;return e===void 0?n=G(i,!0):(Z(e,0,Q),t===void 0?t=r.rounding:Z(t,0,8),i=w(new r(i),e+1,t),n=G(i,!0,e+1)),i.isNeg()&&!i.isZero()?"-"+n:n},p.toFixed=function(e,t){var n,i,r=this,o=r.constructor;return e===void 0?n=G(r):(Z(e,0,Q),t===void 0?t=o.rounding:Z(t,0,8),i=w(new o(r),e+r.e+1,t),n=G(i,!1,e+i.e+1)),r.isNeg()&&!r.isZero()?"-"+n:n},p.toFraction=function(e){var t,n,i,r,o,s,l,u,c,f,m,h,v=this,k=v.d,b=v.constructor;if(!k)return new b(v);if(c=n=new b(1),i=u=new b(0),t=new b(i),o=t.e=qe(k)-v.e-1,s=o%N,t.d[0]=A(10,s<0?N+s:s),e==null)e=o>0?t:c;else{if(l=new b(e),!l.isInt()||l.lt(c))throw Error(Y+l);e=l.gt(t)?o>0?t:c:l}for(C=!1,l=new b(D(k)),f=b.precision,b.precision=o=k.length*N*2;m=$(l,t,0,1,1),r=n.plus(m.times(i)),r.cmp(e)!=1;)n=i,i=r,r=c,c=u.plus(m.times(r)),u=r,r=t,t=l.minus(m.times(r)),l=r;return r=$(e.minus(n),i,0,1,1),u=u.plus(r.times(c)),n=n.plus(r.times(i)),u.s=c.s=v.s,h=$(c,i,o,1).minus(v).abs().cmp($(u,n,o,1).minus(v).abs())<1?[c,i]:[u,n],b.precision=f,C=!0,h},p.toHexadecimal=p.toHex=function(e,t){return ye(this,16,e,t)},p.toNearest=function(e,t){var n=this,i=n.constructor;if(n=new i(n),e==null){if(!n.d)return n;e=new i(1),t=i.rounding}else{if(e=new i(e),t===void 0?t=i.rounding:Z(t,0,8),!n.d)return e.s?n:e;if(!e.d)return e.s&&(e.s=n.s),e}return e.d[0]?(C=!1,n=$(n,e,0,t,1).times(e),C=!0,w(n)):(e.s=n.s,n=e),n},p.toNumber=function(){return+this},p.toOctal=function(e,t){return ye(this,8,e,t)},p.toPower=p.pow=function(e){var t,n,i,r,o,s,l=this,u=l.constructor,c=+(e=new u(e));if(!l.d||!e.d||!l.d[0]||!e.d[0])return new u(A(+l,c));if(l=new u(l),l.eq(1))return l;if(i=u.precision,o=u.rounding,e.eq(1))return w(l,i,o);if(t=O(e.e/N),t>=e.d.length-1&&(n=c<0?-c:c)<=Qe)return r=Ae(u,l,n,i),e.s<0?new u(1).div(r):w(r,i,o);if(s=l.s,s<0){if(t<e.d.length-1)return new u(NaN);if((e.d[t]&1)==0&&(s=1),l.e==0&&l.d[0]==1&&l.d.length==1)return l.s=s,l}return n=A(+l,c),t=n==0||!isFinite(n)?O(c*(Math.log("0."+D(l.d))/Math.LN10+l.e+1)):new u(n+"").e,t>u.maxE+1||t<u.minE-1?new u(t>0?s/0:0):(C=!1,u.rounding=l.s=1,n=Math.min(12,(t+"").length),r=Me(e.times(te(l,i+n)),i),r.d&&(r=w(r,i+5,1),de(r.d,i,o)&&(t=i+10,r=w(Me(e.times(te(l,t+n)),t),t+5,1),+D(r.d).slice(i+1,i+15)+1==1e14&&(r=w(r,i+1,0)))),r.s=s,C=!0,u.rounding=o,w(r,i,o))},p.toPrecision=function(e,t){var n,i=this,r=i.constructor;return e===void 0?n=G(i,i.e<=r.toExpNeg||i.e>=r.toExpPos):(Z(e,1,Q),t===void 0?t=r.rounding:Z(t,0,8),i=w(new r(i),e,t),n=G(i,e<=i.e||i.e<=r.toExpNeg,e)),i.isNeg()&&!i.isZero()?"-"+n:n},p.toSignificantDigits=p.toSD=function(e,t){var n=this,i=n.constructor;return e===void 0?(e=i.precision,t=i.rounding):(Z(e,1,Q),t===void 0?t=i.rounding:Z(t,0,8)),w(new i(n),e,t)},p.toString=function(){var e=this,t=e.constructor,n=G(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?"-"+n:n},p.truncated=p.trunc=function(){return w(new this.constructor(this),this.e+1,1)},p.valueOf=p.toJSON=function(){var e=this,t=e.constructor,n=G(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?"-"+n:n};function D(e){var t,n,i,r=e.length-1,o="",s=e[0];if(r>0){for(o+=s,t=1;t<r;t++)i=e[t]+"",n=N-i.length,n&&(o+=ee(n)),o+=i;s=e[t],i=s+"",n=N-i.length,n&&(o+=ee(n))}else if(s===0)return"0";for(;s%10===0;)s/=10;return o+s}function Z(e,t,n){if(e!==~~e||e<t||e>n)throw Error(Y+e)}function de(e,t,n,i){var r,o,s,l;for(o=e[0];o>=10;o/=10)--t;return--t<0?(t+=N,r=0):(r=Math.ceil((t+1)/N),t%=N),o=A(10,N-t),l=e[r]%o|0,i==null?t<3?(t==0?l=l/100|0:t==1&&(l=l/10|0),s=n<4&&l==99999||n>3&&l==49999||l==5e4||l==0):s=(n<4&&l+1==o||n>3&&l+1==o/2)&&(e[r+1]/o/100|0)==A(10,t-2)-1||(l==o/2||l==0)&&(e[r+1]/o/100|0)==0:t<4?(t==0?l=l/1e3|0:t==1?l=l/100|0:t==2&&(l=l/10|0),s=(i||n<4)&&l==9999||!i&&n>3&&l==4999):s=((i||n<4)&&l+1==o||!i&&n>3&&l+1==o/2)&&(e[r+1]/o/1e3|0)==A(10,t-3)-1,s}function ve(e,t,n){for(var i,r=[0],o,s=0,l=e.length;s<l;){for(o=r.length;o--;)r[o]*=t;for(r[0]+=Ve.indexOf(e.charAt(s++)),i=0;i<r.length;i++)r[i]>n-1&&(r[i+1]===void 0&&(r[i+1]=0),r[i+1]+=r[i]/n|0,r[i]%=n)}return r.reverse()}function et(e,t){var n,i,r;if(t.isZero())return t;i=t.d.length,i<32?(n=Math.ceil(i/3),r=(1/be(4,n)).toString()):(n=16,r="2.3283064365386962890625e-10"),e.precision+=n,t=fe(e,1,t.times(r),new e(1));for(var o=n;o--;){var s=t.times(t);t=s.times(s).minus(s).times(8).plus(1)}return e.precision-=n,t}var $=function(){function e(i,r,o){var s,l=0,u=i.length;for(i=i.slice();u--;)s=i[u]*r+l,i[u]=s%o|0,l=s/o|0;return l&&i.unshift(l),i}function t(i,r,o,s){var l,u;if(o!=s)u=o>s?1:-1;else for(l=u=0;l<o;l++)if(i[l]!=r[l]){u=i[l]>r[l]?1:-1;break}return u}function n(i,r,o,s){for(var l=0;o--;)i[o]-=l,l=i[o]<r[o]?1:0,i[o]=l*s+i[o]-r[o];for(;!i[0]&&i.length>1;)i.shift()}return function(i,r,o,s,l,u){var c,f,m,h,v,k,b,H,B,I,S,q,ne,U,le,ie,J,ae,R,re,oe=i.constructor,K=i.s==r.s?1:-1,F=i.d,g=r.d;if(!F||!F[0]||!g||!g[0])return new oe(!i.s||!r.s||(F?g&&F[0]==g[0]:!g)?NaN:F&&F[0]==0||!g?K*0:K/0);for(u?(v=1,f=i.e-r.e):(u=W,v=N,f=O(i.e/v)-O(r.e/v)),R=g.length,J=F.length,B=new oe(K),I=B.d=[],m=0;g[m]==(F[m]||0);m++);if(g[m]>(F[m]||0)&&f--,o==null?(U=o=oe.precision,s=oe.rounding):l?U=o+(i.e-r.e)+1:U=o,U<0)I.push(1),k=!0;else{if(U=U/v+2|0,m=0,R==1){for(h=0,g=g[0],U++;(m<J||h)&&U--;m++)le=h*u+(F[m]||0),I[m]=le/g|0,h=le%g|0;k=h||m<J}else{for(h=u/(g[0]+1)|0,h>1&&(g=e(g,h,u),F=e(F,h,u),R=g.length,J=F.length),ie=R,S=F.slice(0,R),q=S.length;q<R;)S[q++]=0;re=g.slice(),re.unshift(0),ae=g[0],g[1]>=u/2&&++ae;do h=0,c=t(g,S,R,q),c<0?(ne=S[0],R!=q&&(ne=ne*u+(S[1]||0)),h=ne/ae|0,h>1?(h>=u&&(h=u-1),b=e(g,h,u),H=b.length,q=S.length,c=t(b,S,H,q),c==1&&(h--,n(b,R<H?re:g,H,u))):(h==0&&(c=h=1),b=g.slice()),H=b.length,H<q&&b.unshift(0),n(S,b,q,u),c==-1&&(q=S.length,c=t(g,S,R,q),c<1&&(h++,n(S,R<q?re:g,q,u))),q=S.length):c===0&&(h++,S=[0]),I[m++]=h,c&&S[0]?S[q++]=F[ie]||0:(S=[F[ie]],q=1);while((ie++<J||S[0]!==void 0)&&U--);k=S[0]!==void 0}I[0]||I.shift()}if(v==1)B.e=f,ze=k;else{for(m=1,h=I[0];h>=10;h/=10)m++;B.e=m+f*v-1,w(B,l?o+B.e+1:o,s,k)}return B}}();function w(e,t,n,i){var r,o,s,l,u,c,f,m,h,v=e.constructor;e:if(t!=null){if(m=e.d,!m)return e;for(r=1,l=m[0];l>=10;l/=10)r++;if(o=t-r,o<0)o+=N,s=t,f=m[h=0],u=f/A(10,r-s-1)%10|0;else if(h=Math.ceil((o+1)/N),l=m.length,h>=l)if(i){for(;l++<=h;)m.push(0);f=u=0,r=1,o%=N,s=o-N+1}else break e;else{for(f=l=m[h],r=1;l>=10;l/=10)r++;o%=N,s=o-N+r,u=s<0?0:f/A(10,r-s-1)%10|0}if(i=i||t<0||m[h+1]!==void 0||(s<0?f:f%A(10,r-s-1)),c=n<4?(u||i)&&(n==0||n==(e.s<0?3:2)):u>5||u==5&&(n==4||i||n==6&&(o>0?s>0?f/A(10,r-s):0:m[h-1])%10&1||n==(e.s<0?8:7)),t<1||!m[0])return m.length=0,c?(t-=e.e+1,m[0]=A(10,(N-t%N)%N),e.e=-t||0):m[0]=e.e=0,e;if(o==0?(m.length=h,l=1,h--):(m.length=h+1,l=A(10,N-o),m[h]=s>0?(f/A(10,r-s)%A(10,s)|0)*l:0),c)for(;;)if(h==0){for(o=1,s=m[0];s>=10;s/=10)o++;for(s=m[0]+=l,l=1;s>=10;s/=10)l++;o!=l&&(e.e++,m[0]==W&&(m[0]=1));break}else{if(m[h]+=l,m[h]!=W)break;m[h--]=0,l=1}for(o=m.length;m[--o]===0;)m.pop()}return C&&(e.e>v.maxE?(e.d=null,e.e=NaN):e.e<v.minE&&(e.e=0,e.d=[0])),e}function G(e,t,n){if(!e.isFinite())return De(e);var i,r=e.e,o=D(e.d),s=o.length;return t?(n&&(i=n-s)>0?o=o.charAt(0)+"."+o.slice(1)+ee(i):s>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(e.e<0?"e":"e+")+e.e):r<0?(o="0."+ee(-r-1)+o,n&&(i=n-s)>0&&(o+=ee(i))):r>=s?(o+=ee(r+1-s),n&&(i=n-r-1)>0&&(o=o+"."+ee(i))):((i=r+1)<s&&(o=o.slice(0,i)+"."+o.slice(i)),n&&(i=n-s)>0&&(r+1===s&&(o+="."),o+=ee(i))),o}function we(e,t){var n=e[0];for(t*=N;n>=10;n/=10)t++;return t}function Ne(e,t,n){if(t>Ye)throw C=!0,n&&(e.precision=n),Error(Le);return w(new e(he),t,1,!0)}function X(e,t,n){if(t>Ce)throw Error(Le);return w(new e(pe),t,n,!0)}function qe(e){var t=e.length-1,n=t*N+1;if(t=e[t],t){for(;t%10==0;t/=10)n--;for(t=e[0];t>=10;t/=10)n++}return n}function ee(e){for(var t="";e--;)t+="0";return t}function Ae(e,t,n,i){var r,o=new e(1),s=Math.ceil(i/N+4);for(C=!1;;){if(n%2&&(o=o.times(t),Oe(o.d,s)&&(r=!0)),n=O(n/2),n===0){n=o.d.length-1,r&&o.d[n]===0&&++o.d[n];break}t=t.times(t),Oe(t.d,s)}return C=!0,o}function Ie(e){return e.d[e.d.length-1]&1}function Te(e,t,n){for(var i,r,o=new e(t[0]),s=0;++s<t.length;){if(r=new e(t[s]),!r.s){o=r;break}i=o.cmp(r),(i===n||i===0&&o.s===n)&&(o=r)}return o}function Me(e,t){var n,i,r,o,s,l,u,c=0,f=0,m=0,h=e.constructor,v=h.rounding,k=h.precision;if(!e.d||!e.d[0]||e.e>17)return new h(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:NaN);for(t==null?(C=!1,u=k):u=t,l=new h(.03125);e.e>-2;)e=e.times(l),m+=5;for(i=Math.log(A(2,m))/Math.LN10*2+5|0,u+=i,n=o=s=new h(1),h.precision=u;;){if(o=w(o.times(e),u,1),n=n.times(++f),l=s.plus($(o,n,u,1)),D(l.d).slice(0,u)===D(s.d).slice(0,u)){for(r=m;r--;)s=w(s.times(s),u,1);if(t==null)if(c<3&&de(s.d,u-i,v,c))h.precision=u+=10,n=o=l=new h(1),f=0,c++;else return w(s,h.precision=k,v,C=!0);else return h.precision=k,s}s=l}}function te(e,t){var n,i,r,o,s,l,u,c,f,m,h,v=1,k=10,b=e,H=b.d,B=b.constructor,I=B.rounding,S=B.precision;if(b.s<0||!H||!H[0]||!b.e&&H[0]==1&&H.length==1)return new B(H&&!H[0]?-1/0:b.s!=1?NaN:H?0:b);if(t==null?(C=!1,f=S):f=t,B.precision=f+=k,n=D(H),i=n.charAt(0),Math.abs(o=b.e)<15e14){for(;i<7&&i!=1||i==1&&n.charAt(1)>3;)b=b.times(e),n=D(b.d),i=n.charAt(0),v++;o=b.e,i>1?(b=new B("0."+n),o++):b=new B(i+"."+n.slice(1))}else return c=Ne(B,f+2,S).times(o+""),b=te(new B(i+"."+n.slice(1)),f-k).plus(c),B.precision=S,t==null?w(b,S,I,C=!0):b;for(m=b,u=s=b=$(b.minus(1),b.plus(1),f,1),h=w(b.times(b),f,1),r=3;;){if(s=w(s.times(h),f,1),c=u.plus($(s,new B(r),f,1)),D(c.d).slice(0,f)===D(u.d).slice(0,f))if(u=u.times(2),o!==0&&(u=u.plus(Ne(B,f+2,S).times(o+""))),u=$(u,new B(v),f,1),t==null)if(de(u.d,f-k,I,l))B.precision=f+=k,c=s=b=$(m.minus(1),m.plus(1),f,1),h=w(b.times(b),f,1),r=l=1;else return w(u,B.precision=S,I,C=!0);else return B.precision=S,u;u=c,r+=2}}function De(e){return String(e.s*e.s/0)}function Ee(e,t){var n,i,r;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(i=t.search(/e/i))>0?(n<0&&(n=i),n+=+t.slice(i+1),t=t.substring(0,i)):n<0&&(n=t.length),i=0;t.charCodeAt(i)===48;i++);for(r=t.length;t.charCodeAt(r-1)===48;--r);if(t=t.slice(i,r),t){if(r-=i,e.e=n=n-i-1,e.d=[],i=(n+1)%N,n<0&&(i+=N),i<r){for(i&&e.d.push(+t.slice(0,i)),r-=N;i<r;)e.d.push(+t.slice(i,i+=N));t=t.slice(i),i=N-t.length}else i-=r;for(;i--;)t+="0";e.d.push(+t),C&&(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 tt(e,t){var n,i,r,o,s,l,u,c,f;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),Fe.test(t))return Ee(e,t)}else if(t==="Infinity"||t==="NaN")return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(Je.test(t))n=16,t=t.toLowerCase();else if(je.test(t))n=2;else if(Ke.test(t))n=8;else throw Error(Y+t);for(o=t.search(/p/i),o>0?(u=+t.slice(o+1),t=t.substring(2,o)):t=t.slice(2),o=t.indexOf("."),s=o>=0,i=e.constructor,s&&(t=t.replace(".",""),l=t.length,o=l-o,r=Ae(i,new i(n),o,o*2)),c=ve(t,n,W),f=c.length-1,o=f;c[o]===0;--o)c.pop();return o<0?new i(e.s*0):(e.e=we(c,f),e.d=c,C=!1,s&&(e=$(e,r,l*4)),u&&(e=e.times(Math.abs(u)<54?A(2,u):y.pow(2,u))),C=!0,e)}function nt(e,t){var n,i=t.d.length;if(i<3)return t.isZero()?t:fe(e,2,t,t);n=1.4*Math.sqrt(i),n=n>16?16:n|0,t=t.times(1/be(5,n)),t=fe(e,2,t,t);for(var r,o=new e(5),s=new e(16),l=new e(20);n--;)r=t.times(t),t=t.times(o.plus(r.times(s.times(r).minus(l))));return t}function fe(e,t,n,i,r){var o,s,l,u,c=e.precision,f=Math.ceil(c/N);for(C=!1,u=n.times(n),l=new e(i);;){if(s=$(l.times(u),new e(t++*t++),c,1),l=r?i.plus(s):i.minus(s),i=$(s.times(u),new e(t++*t++),c,1),s=l.plus(i),s.d[f]!==void 0){for(o=f;s.d[o]===l.d[o]&&o--;);if(o==-1)break}o=l,l=i,i=s,s=o}return C=!0,s.d.length=f+1,s}function be(e,t){for(var n=e;--t;)n*=e;return n}function Pe(e,t){var n,i=t.s<0,r=X(e,e.precision,1),o=r.times(.5);if(t=t.abs(),t.lte(o))return j=i?4:1,t;if(n=t.divToInt(r),n.isZero())j=i?3:2;else{if(t=t.minus(n.times(r)),t.lte(o))return j=Ie(n)?i?2:3:i?4:1,t;j=Ie(n)?i?1:4:i?3:2}return t.minus(r).abs()}function ye(e,t,n,i){var r,o,s,l,u,c,f,m,h,v=e.constructor,k=n!==void 0;if(k?(Z(n,1,Q),i===void 0?i=v.rounding:Z(i,0,8)):(n=v.precision,i=v.rounding),!e.isFinite())f=De(e);else{for(f=G(e),s=f.indexOf("."),k?(r=2,t==16?n=n*4-3:t==8&&(n=n*3-2)):r=t,s>=0&&(f=f.replace(".",""),h=new v(1),h.e=f.length-s,h.d=ve(G(h),10,r),h.e=h.d.length),m=ve(f,10,r),o=u=m.length;m[--u]==0;)m.pop();if(!m[0])f=k?"0p+0":"0";else{if(s<0?o--:(e=new v(e),e.d=m,e.e=o,e=$(e,h,n,i,0,r),m=e.d,o=e.e,c=ze),s=m[n],l=r/2,c=c||m[n+1]!==void 0,c=i<4?(s!==void 0||c)&&(i===0||i===(e.s<0?3:2)):s>l||s===l&&(i===4||c||i===6&&m[n-1]&1||i===(e.s<0?8:7)),m.length=n,c)for(;++m[--n]>r-1;)m[n]=0,n||(++o,m.unshift(1));for(u=m.length;!m[u-1];--u);for(s=0,f="";s<u;s++)f+=Ve.charAt(m[s]);if(k){if(u>1)if(t==16||t==8){for(s=t==16?4:3,--u;u%s;u++)f+="0";for(m=ve(f,r,t),u=m.length;!m[u-1];--u);for(s=1,f="1.";s<u;s++)f+=Ve.charAt(m[s])}else f=f.charAt(0)+"."+f.slice(1);f=f+(o<0?"p":"p+")+o}else if(o<0){for(;++o;)f="0"+f;f="0."+f}else if(++o>u)for(o-=u;o--;)f+="0";else o<u&&(f=f.slice(0,o)+"."+f.slice(o))}f=(t==16?"0x":t==2?"0b":t==8?"0o":"")+f}return e.s<0?"-"+f:f}function Oe(e,t){if(e.length>t)return e.length=t,!0}function it(e){return new this(e).abs()}function rt(e){return new this(e).acos()}function ot(e){return new this(e).acosh()}function st(e,t){return new this(e).plus(t)}function lt(e){return new this(e).asin()}function at(e){return new this(e).asinh()}function ct(e){return new this(e).atan()}function ut(e){return new this(e).atanh()}function ft(e,t){e=new this(e),t=new this(t);var n,i=this.precision,r=this.rounding,o=i+4;return!e.s||!t.s?n=new this(NaN):!e.d&&!t.d?(n=X(this,o,1).times(t.s>0?.25:.75),n.s=e.s):!t.d||e.isZero()?(n=t.s<0?X(this,i,r):new this(0),n.s=e.s):!e.d||t.isZero()?(n=X(this,o,1).times(.5),n.s=e.s):t.s<0?(this.precision=o,this.rounding=1,n=this.atan($(e,t,o,1)),t=X(this,o,1),this.precision=i,this.rounding=r,n=e.s<0?n.minus(t):n.plus(t)):n=this.atan($(e,t,o,1)),n}function dt(e){return new this(e).cbrt()}function mt(e){return w(e=new this(e),e.e+1,2)}function ht(e,t,n){return new this(e).clamp(t,n)}function pt(e){if(!e||typeof e!="object")throw Error(ge+"Object expected");var t,n,i,r=e.defaults===!0,o=["precision",1,Q,"rounding",0,8,"toExpNeg",-ue,0,"toExpPos",0,ue,"maxE",0,ue,"minE",-ue,0,"modulo",0,9];for(t=0;t<o.length;t+=3)if(n=o[t],r&&(this[n]=ke[n]),(i=e[n])!==void 0)if(O(i)===i&&i>=o[t+1]&&i<=o[t+2])this[n]=i;else throw Error(Y+n+": "+i);if(n="crypto",r&&(this[n]=ke[n]),(i=e[n])!==void 0)if(i===!0||i===!1||i===0||i===1)if(i)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[n]=!0;else throw Error(He);else this[n]=!1;else throw Error(Y+n+": "+i);return this}function gt(e){return new this(e).cos()}function vt(e){return new this(e).cosh()}function Re(e){var t,n,i;function r(o){var s,l,u,c=this;if(!(c instanceof r))return new r(o);if(c.constructor=r,Ze(o)){c.s=o.s,C?!o.d||o.e>r.maxE?(c.e=NaN,c.d=null):o.e<r.minE?(c.e=0,c.d=[0]):(c.e=o.e,c.d=o.d.slice()):(c.e=o.e,c.d=o.d?o.d.slice():o.d);return}if(u=typeof o,u==="number"){if(o===0){c.s=1/o<0?-1:1,c.e=0,c.d=[0];return}if(o<0?(o=-o,c.s=-1):c.s=1,o===~~o&&o<1e7){for(s=0,l=o;l>=10;l/=10)s++;C?s>r.maxE?(c.e=NaN,c.d=null):s<r.minE?(c.e=0,c.d=[0]):(c.e=s,c.d=[o]):(c.e=s,c.d=[o]);return}if(o*0!==0){o||(c.s=NaN),c.e=NaN,c.d=null;return}return Ee(c,o.toString())}if(u==="string")return(l=o.charCodeAt(0))===45?(o=o.slice(1),c.s=-1):(l===43&&(o=o.slice(1)),c.s=1),Fe.test(o)?Ee(c,o):tt(c,o);if(u==="bigint")return o<0?(o=-o,c.s=-1):c.s=1,Ee(c,o.toString());throw Error(Y+o)}if(r.prototype=p,r.ROUND_UP=0,r.ROUND_DOWN=1,r.ROUND_CEIL=2,r.ROUND_FLOOR=3,r.ROUND_HALF_UP=4,r.ROUND_HALF_DOWN=5,r.ROUND_HALF_EVEN=6,r.ROUND_HALF_CEIL=7,r.ROUND_HALF_FLOOR=8,r.EUCLID=9,r.config=r.set=pt,r.clone=Re,r.isDecimal=Ze,r.abs=it,r.acos=rt,r.acosh=ot,r.add=st,r.asin=lt,r.asinh=at,r.atan=ct,r.atanh=ut,r.atan2=ft,r.cbrt=dt,r.ceil=mt,r.clamp=ht,r.cos=gt,r.cosh=vt,r.div=wt,r.exp=Nt,r.floor=Et,r.hypot=bt,r.ln=Vt,r.log=kt,r.log10=Mt,r.log2=Ct,r.max=yt,r.min=St,r.mod=Bt,r.mul=zt,r.pow=Lt,r.random=Ht,r.round=$t,r.sign=Ft,r.sin=qt,r.sinh=At,r.sqrt=It,r.sub=Tt,r.sum=Dt,r.tan=Pt,r.tanh=Ot,r.trunc=Rt,e===void 0&&(e={}),e&&e.defaults!==!0)for(i=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],t=0;t<i.length;)e.hasOwnProperty(n=i[t++])||(e[n]=this[n]);return r.config(e),r}function wt(e,t){return new this(e).div(t)}function Nt(e){return new this(e).exp()}function Et(e){return w(e=new this(e),e.e+1,3)}function bt(){var e,t,n=new this(0);for(C=!1,e=0;e<arguments.length;)if(t=new this(arguments[e++]),t.d)n.d&&(n=n.plus(t.times(t)));else{if(t.s)return C=!0,new this(1/0);n=t}return C=!0,n.sqrt()}function Ze(e){return e instanceof y||e&&e.toStringTag===$e||!1}function Vt(e){return new this(e).ln()}function kt(e,t){return new this(e).log(t)}function Ct(e){return new this(e).log(2)}function Mt(e){return new this(e).log(10)}function yt(){return Te(this,arguments,-1)}function St(){return Te(this,arguments,1)}function Bt(e,t){return new this(e).mod(t)}function zt(e,t){return new this(e).mul(t)}function Lt(e,t){return new this(e).pow(t)}function Ht(e){var t,n,i,r,o=0,s=new this(1),l=[];if(e===void 0?e=this.precision:Z(e,1,Q),i=Math.ceil(e/N),this.crypto)if(crypto.getRandomValues)for(t=crypto.getRandomValues(new Uint32Array(i));o<i;)r=t[o],r>=429e7?t[o]=crypto.getRandomValues(new Uint32Array(1))[0]:l[o++]=r%1e7;else if(crypto.randomBytes){for(t=crypto.randomBytes(i*=4);o<i;)r=t[o]+(t[o+1]<<8)+(t[o+2]<<16)+((t[o+3]&127)<<24),r>=214e7?crypto.randomBytes(4).copy(t,o):(l.push(r%1e7),o+=4);o=i/4}else throw Error(He);else for(;o<i;)l[o++]=Math.random()*1e7|0;for(i=l[--o],e%=N,i&&e&&(r=A(10,N-e),l[o]=(i/r|0)*r);l[o]===0;o--)l.pop();if(o<0)n=0,l=[0];else{for(n=-1;l[0]===0;n-=N)l.shift();for(i=1,r=l[0];r>=10;r/=10)i++;i<N&&(n-=N-i)}return s.e=n,s.d=l,s}function $t(e){return w(e=new this(e),e.e+1,this.rounding)}function Ft(e){return e=new this(e),e.d?e.d[0]?e.s:0*e.s:e.s||NaN}function qt(e){return new this(e).sin()}function At(e){return new this(e).sinh()}function It(e){return new this(e).sqrt()}function Tt(e,t){return new this(e).sub(t)}function Dt(){var e=0,t=arguments,n=new this(t[e]);for(C=!1;n.s&&++e<t.length;)n=n.plus(t[e]);return C=!0,w(n,this.precision,this.rounding)}function Pt(e){return new this(e).tan()}function Ot(e){return new this(e).tanh()}function Rt(e){return w(e=new this(e),e.e+1,1)}p[Symbol.for("nodejs.util.inspect.custom")]=p.toString,p[Symbol.toStringTag]="Decimal";var y=p.constructor=Re(ke);he=new y(he),pe=new y(pe);const Ue=16;function me(){const e=a.ref("0"),t=a.ref(""),n=a.ref(null),i=a.ref(!1),r=a.ref([]),o=a.ref("0"),s=a.ref(!1),l=a.ref(""),u=a.ref("");y.set({precision:20});const c=a.computed(()=>s.value?l.value||"错误":m(e.value)),f=a.computed(()=>u.value||"");function m(g){if(!g||g==="0")return"0";try{const E=new y(g);let z;E.isInteger()?z=E.toFixed(0):z=E.toFixed();let _=z;z.includes(".")&&(_=z.replace(/\.?0+$/,""));const se=_.split(".");return se[0]&&(se[0]=se[0].replace(/\B(?=(\d{3})+(?!\d))/g,",")),se.join(".")}catch{return g}}function h(g){if(s.value&&I(),u.value.endsWith("=")&&(u.value=""),i.value)e.value=g,i.value=!1;else{const E=e.value==="0"?g:e.value+g;E.replace(/[.-]/g,"").length<=Ue&&(e.value=E)}}function v(){if(s.value&&I(),u.value.endsWith("=")&&(u.value=""),i.value)e.value="0.",i.value=!1;else if(!e.value.includes(".")){const g=e.value+".";g.replace(/[.-]/g,"").length<=Ue&&(e.value=g)}}function k(g){if(s.value){I();return}const E=e.value;let z=t.value,_=n.value;if(t.value&&n.value&&!i.value?(b(),t.value=e.value):t.value=E,g==="="){if(z&&_){const se=`${z} ${_} ${E}`;r.value.unshift(`${se} = ${e.value}`),r.value.length>50&&(r.value=r.value.slice(0,50)),u.value=`${z} ${_} ${E} =`,n.value=null,t.value=""}}else u.value=`${t.value} ${g}`,n.value=g;i.value=!0}function b(){if(!(!t.value||!n.value))try{if(t.value==="NaN"||t.value==="Infinity"||e.value==="NaN"||e.value==="Infinity")throw new Error("无效的数值");const g=new y(t.value),E=new y(e.value);let z;switch(n.value){case"+":z=g.plus(E);break;case"-":z=g.minus(E);break;case"*":z=g.times(E);break;case"/":if(E.isZero())throw l.value="除数不能为零",new Error("除数不能为零");z=g.dividedBy(E);break;case"^":z=new y(Math.pow(g.toNumber(),E.toNumber()));break;default:return}e.value=z.toString(),s.value=!1,l.value=""}catch(g){e.value="错误",s.value=!0,l.value||(l.value=g instanceof Error?g.message:"计算错误"),console.error("计算错误:",g)}}function H(g){g>=0&&g<r.value.length&&r.value.splice(g,1)}function B(){e.value="0",s.value=!1}function I(){e.value="0",t.value="",n.value=null,i.value=!1,u.value="",s.value=!1,l.value=""}function S(){if(s.value||i.value){B();return}e.value.length>1?e.value=e.value.slice(0,-1):e.value="0"}function q(){s.value||e.value!=="0"&&(e.value=e.value.startsWith("-")?e.value.slice(1):"-"+e.value)}function ne(){if(!s.value)try{const E=new y(e.value).dividedBy(100);e.value=E.toString()}catch{e.value="错误",s.value=!0}}function U(){if(!s.value)try{const g=new y(e.value);if(g.isNegative())throw l.value="负数不能开平方根",new Error("负数不能开平方根");const E=g.sqrt();u.value=`√(${g}) =`,e.value=E.toString(),l.value=""}catch(g){e.value="错误",s.value=!0,l.value||(l.value=g instanceof Error?g.message:"计算错误")}}function le(){if(!s.value)try{const g=new y(e.value),E=g.times(g);u.value=`sqr(${g}) =`,e.value=E.toString(),l.value=""}catch(g){e.value="错误",s.value=!0,l.value=g instanceof Error?g.message:"计算错误"}}function ie(){if(!s.value)try{const g=new y(e.value);if(g.isZero())throw l.value="零不能求倒数",new Error("零不能求倒数");const E=new y(1).dividedBy(g);u.value=`1/(${g}) =`,e.value=E.toString(),l.value=""}catch(g){e.value="错误",s.value=!0,l.value||(l.value=g instanceof Error?g.message:"计算错误")}}function J(){s.value||(o.value=e.value,i.value=!0)}function ae(){e.value=o.value,i.value=!0}function R(){o.value="0"}function re(){if(!s.value)try{const g=new y(o.value),E=new y(e.value);o.value=g.plus(E).toString(),i.value=!0}catch(g){console.error("内存加法错误:",g)}}function oe(){if(!s.value)try{const g=new y(o.value),E=new y(e.value);o.value=g.minus(E).toString(),i.value=!0}catch(g){console.error("内存减法错误:",g)}}function K(g){if(!s.value)try{const E=new y(e.value);let z;switch(g){case"sin":z=new y(Math.sin(E.toNumber()*Math.PI/180));break;case"cos":z=new y(Math.cos(E.toNumber()*Math.PI/180));break;case"tan":z=new y(Math.tan(E.toNumber()*Math.PI/180));break;case"log":if(E.lte(0))throw l.value="对数的真数必须大于0",new Error("对数的真数必须大于0");z=new y(Math.log10(E.toNumber()));break;case"ln":if(E.lte(0))throw l.value="自然对数的真数必须大于0",new Error("自然对数的真数必须大于0");z=new y(Math.log(E.toNumber()));break;case"exp":z=new y(Math.exp(E.toNumber()));break;case"pow":t.value=E.toString(),n.value="^",i.value=!0,u.value=`${E} ^`;return;default:return}e.value=z.toString(),i.value=!0,s.value=!1,l.value=""}catch(E){e.value="错误",s.value=!0,l.value||(l.value=E instanceof Error?E.message:"科学计算错误"),console.error("科学计算错误:",E)}}function F(){if(!s.value)try{const g=new y(e.value);if(g.isNegative()||!g.isInteger())throw l.value="阶乘只能计算非负整数",new Error("阶乘只能计算非负整数");if(g.gt(170))throw l.value="数值过大,无法计算阶乘",new Error("数值过大,无法计算阶乘");let E=new y(1),z=g.toNumber();for(let _=2;_<=z;_++)E=E.times(_);e.value=E.toString(),i.value=!0,s.value=!1,l.value=""}catch(g){e.value="错误",s.value=!0,l.value||(l.value=g instanceof Error?g.message:"阶乘计算错误"),console.error("阶乘计算错误:",g)}}return{display:e,previousValue:t,currentOperator:n,waitingForNewValue:i,history:r,memory:o,isError:s,errorMessage:l,expression:u,displayText:c,expressionText:f,inputNumber:h,inputDecimal:v,inputOperator:k,calculate:b,removeHistoryItem:H,clearEntry:B,clearAll:I,backspace:S,toggleSign:q,percentage:ne,squareRoot:U,square:le,reciprocal:ie,memoryStore:J,memoryRecall:ae,memoryClear:R,memoryAdd:re,memorySubtract:oe,formatNumber:m,scientificFunction:K,factorial:F}}const Zt={class:"calculator"},Ut={class:"toolbar-area"},xt={class:"toolbar-left"},_t={class:"mode-display"},Wt={class:"display-area"},Gt={class:"expression"},Xt={class:"memory-section"},jt=["disabled"],Jt=["disabled"],Kt=["disabled"],Qt={class:"buttons-area"},Yt={key:0,class:"button-row scientific-row"},en={key:1,class:"button-row scientific-row"},tn={class:"button-row"},nn={class:"button-row"},rn={class:"button-row"},on={class:"button-row"},sn={class:"button-row"},ln={class:"drawer-content"},an={key:0,class:"mode-check"},cn={key:0,class:"mode-check"},un={class:"history-list"},fn=["onClick"],dn=["onClick"],mn={key:0,class:"history-empty"},hn={class:"memory-list"},pn=["onClick"],gn={class:"memory-actions"},vn=["onClick"],wn=["onClick"],Nn=["onClick"],En={key:0,class:"memory-empty"},bn={key:0,class:"memory-footer"},Se=((e,t)=>{const n=e.__vccOpts||e;for(const[i,r]of t)n[i]=r;return n})(a.defineComponent({__name:"Calculator",setup(e){const t=me(),n=a.ref(),i=a.ref(!1),r=a.ref(!1),o=a.ref(!1),s=a.ref([]),l=a.ref("standard"),u=a.computed(()=>l.value==="standard"?"标准型":"科学型"),c=a.computed(()=>t.displayText.value),f=a.computed(()=>t.expressionText.value),m=a.computed(()=>t.history.value),h=a.ref("32px");function v(){a.nextTick(()=>{if(!n.value)return;const M=n.value,d=c.value,V=M.clientWidth-32,L=32,T=16,P=document.createElement("span");P.style.visibility="hidden",P.style.position="absolute",P.style.fontSize=`${L}px`,P.style.fontWeight="300",P.style.fontFamily=getComputedStyle(M).fontFamily,P.textContent=d,document.body.appendChild(P);const Ge=P.offsetWidth;document.body.removeChild(P);let Xe=L;Ge>V&&(Xe=Math.max(T,V/Ge*L)),h.value=`${Xe}px`})}a.watch(c,v,{immediate:!0});function k(M){t.inputNumber(M)}function b(){t.inputDecimal()}function H(M){t.inputOperator(M)}function B(){t.clearEntry()}function I(){t.clearAll()}function S(){t.backspace()}function q(){t.toggleSign()}function ne(){t.percentage()}function U(){t.squareRoot()}function le(){t.square()}function ie(){t.reciprocal()}function J(){const M=c.value;t.memoryStore(),M!=="0"&&!s.value.includes(M)&&s.value.unshift(M)}function ae(){s.value.length>0&&(t.display.value=s.value[0]||"0",t.waitingForNewValue.value=!0)}function R(){t.memoryClear(),s.value=[]}function re(){try{const M=t.display.value||"0",d=s.value.length>0&&s.value[0]||"0",V=new y(M),L=new y(d);console.log(V.plus(L));const T=V.plus(L).toString();s.value.length>0?s.value[0]=T:s.value.unshift(T)}catch(M){console.error("内存加法计算错误:",M);const d=parseFloat(t.display.value)||0,V=s.value.length>0&&parseFloat(s.value[0]||"0")||0,L=d+V;s.value.length>0?s.value[0]=L.toString():s.value.unshift(L.toString())}}function oe(){try{const M=t.display.value||"0",d=s.value.length>0&&s.value[0]||"0",V=new y(M),T=new y(d).minus(V).toString();s.value.length>0?s.value[0]=T:s.value.unshift(T)}catch(M){console.error("内存减法计算错误:",M);const d=parseFloat(t.display.value)||0,L=(s.value.length>0&&parseFloat(s.value[0]||"0")||0)-d;s.value.length>0?s.value[0]=L.toString():s.value.unshift(L.toString())}}function K(){i.value=!i.value}function F(){o.value=!o.value}function g(M){t.display.value=M,t.waitingForNewValue.value=!0,o.value=!1}function E(){s.value=[]}function z(M){s.value.splice(M,1)}function _(M,d){try{const V=t.display.value||"0",L=new y(V),T=new y(M||"0"),P=L.plus(T).toString();s.value[d]=P}catch(V){console.error("内存项加法计算错误:",V);const L=parseFloat(t.display.value)||0,T=parseFloat(M)||0,P=L+T;s.value[d]=P.toString()}}function se(M,d){try{const V=t.display.value||"0",L=new y(V),P=new y(M||"0").minus(L).toString();s.value[d]=P}catch(V){console.error("内存项减法计算错误:",V);const L=parseFloat(t.display.value)||0,P=(parseFloat(M)||0)-L;s.value[d]=P.toString()}}function Cn(){r.value=!r.value}function Be(){r.value=!1}function _e(M){l.value=M,Be(),t.clearAll()}function ce(M){t.scientificFunction(M)}function Mn(){t.factorial()}function yn(M){t.removeHistoryItem(M)}function Sn(M){const d=M.split(" = ")[1];d&&(t.display.value=d,t.waitingForNewValue.value=!0,i.value=!1)}function We(M){M.preventDefault();const d=M.key;/^[0-9]$/.test(d)?k(d):d==="+"?H("+"):d==="-"?H("-"):d==="*"?H("*"):d==="/"?H("/"):d==="Enter"||d==="="?H("="):d==="."?b():d==="Backspace"?S():d==="Escape"?I():d==="Delete"&&B()}return a.onMounted(()=>{document.addEventListener("keydown",We)}),a.onUnmounted(()=>{document.removeEventListener("keydown",We)}),(M,d)=>(a.openBlock(),a.createElementBlock("div",Zt,[a.createElementVNode("div",Ut,[a.createElementVNode("div",xt,[a.createElementVNode("button",{class:"btn btn-menu",onClick:Cn,title:"切换计算器模式"},d[26]||(d[26]=[a.createElementVNode("svg",{width:"16",height:"16",viewBox:"0 0 16 16"},[a.createElementVNode("path",{d:"M2 3h12v1H2V3zm0 4h12v1H2V7zm0 4h12v1H2v-1z",fill:"currentColor"})],-1)])),a.createElementVNode("div",_t,a.toDisplayString(u.value),1)]),a.createElementVNode("div",{class:"toolbar-right"},[a.createElementVNode("button",{class:"btn btn-memory",onClick:K,title:"历史记录"},d[27]||(d[27]=[a.createElementVNode("svg",{viewBox:"0 0 1024 1024",width:"22",height:"22"},[a.createElementVNode("path",{d:"M537.6 95.6928A409.2928 409.2928 0 0 0 159.3344 351.232l-23.2448-43.4176a28.16 28.16 0 0 0-49.664 26.5728l55.1936 102.9632a28.2112 28.2112 0 0 0 24.832 14.848 27.6992 27.6992 0 0 0 12.4416-2.9184l109.9776-54.272a28.16 28.16 0 0 0-24.9344-50.5344l-51.2 25.6a351.6416 351.6416 0 1 1 12.4416 294.4512 28.16 28.16 0 0 0-50.0736 25.6A407.9616 407.9616 0 1 0 537.6 95.6928z",fill:"#555555"}),a.createElementVNode("path",{d:"M522.9056 297.7792a28.16 28.16 0 0 0-28.16 28.16V568.32a28.16 28.16 0 0 0 28.16 28.16h205.8752a28.16 28.16 0 0 0 0-56.32h-177.7152V325.9392a28.16 28.16 0 0 0-28.16-28.16z",fill:"#555555"})],-1)]))])]),a.createElementVNode("div",Wt,[a.createElementVNode("div",Gt,a.toDisplayString(f.value),1),a.createElementVNode("div",{ref_key:"displayRef",ref:n,class:"display",style:a.normalizeStyle({fontSize:h.value})},a.toDisplayString(c.value),5)]),a.createElementVNode("div",Xt,[a.createElementVNode("button",{class:"btn btn-memory",onClick:R,disabled:s.value.length===0,title:"清除所有记忆"}," MC ",8,jt),a.createElementVNode("button",{class:"btn btn-memory",onClick:ae,disabled:s.value.length===0,title:"记忆调用"}," MR ",8,Jt),a.createElementVNode("button",{class:"btn btn-memory",onClick:re,title:"记忆加法"}," M+ "),a.createElementVNode("button",{class:"btn btn-memory",onClick:oe,title:"记忆减法"}," M- "),a.createElementVNode("button",{class:"btn btn-memory",onClick:J,title:"记忆存储"}," MS "),a.createElementVNode("button",{class:"btn btn-memory",onClick:F,disabled:s.value.length===0,title:"内存记录"}," M∨ ",8,Kt)]),a.createElementVNode("div",Qt,[l.value==="scientific"?(a.openBlock(),a.createElementBlock("div",Yt,[a.createElementVNode("button",{class:"btn btn-function",onClick:d[0]||(d[0]=V=>ce("sin")),title:"正弦"}," sin "),a.createElementVNode("button",{class:"btn btn-function",onClick:d[1]||(d[1]=V=>ce("cos")),title:"余弦"}," cos "),a.createElementVNode("button",{class:"btn btn-function",onClick:d[2]||(d[2]=V=>ce("tan")),title:"正切"}," tan "),a.createElementVNode("button",{class:"btn btn-function",onClick:d[3]||(d[3]=V=>ce("log")),title:"常用对数"}," log ")])):a.createCommentVNode("",!0),l.value==="scientific"?(a.openBlock(),a.createElementBlock("div",en,[a.createElementVNode("button",{class:"btn btn-function",onClick:d[4]||(d[4]=V=>ce("ln")),title:"自然对数"}," ln "),a.createElementVNode("button",{class:"btn btn-function",onClick:d[5]||(d[5]=V=>ce("exp")),title:"e的x次方"}," e^x "),a.createElementVNode("button",{class:"btn btn-function",onClick:d[6]||(d[6]=V=>ce("pow")),title:"x的y次方"}," x^y "),a.createElementVNode("button",{class:"btn btn-function",onClick:Mn,title:"阶乘"}," n! ")])):a.createCommentVNode("",!0),a.createElementVNode("div",{class:"button-row"},[a.createElementVNode("button",{class:"btn btn-function",onClick:ne},"%"),a.createElementVNode("button",{class:"btn btn-clear",onClick:B},"CE"),a.createElementVNode("button",{class:"btn btn-clear",onClick:I},"C"),a.createElementVNode("button",{class:"btn btn-function",onClick:S},d[28]||(d[28]=[a.createElementVNode("svg",{viewBox:"0 0 1395 1024",width:"20",height:"20"},[a.createElementVNode("path",{d:"M1229.851676 1024h-719.567568a23.911784 23.911784 0 0 1-3.90227-1.051676 96.864865 96.864865 0 0 1-64.152216-28.118486L28.118486 580.718703a97.639784 97.639784 0 0 1 0-138.046271L442.229622 28.588973A97.224649 97.224649 0 0 1 509.868973 0h719.982703a166.054054 166.054054 0 0 1 166.054054 166.054054v691.891892a166.054054 166.054054 0 0 1-166.054054 166.054054z m110.702702-820.556108A149.808432 149.808432 0 0 0 1189.113081 55.351351H532.48a89.558486 89.558486 0 0 0-61.689081 25.378595L92.132324 454.739027a78.01773 78.01773 0 0 0 0 114.604973l378.658595 373.178811a89.254054 89.254054 0 0 0 58.506378 25.074162 23.081514 23.081514 0 0 0 3.542487 0.940973h656.273297a149.808432 149.808432 0 0 0 151.441297-148.009514v-617.167567z m-253.536864 519.776865l-19.566703 19.566702a13.837838 13.837838 0 0 1-19.566703 0l-205.491892-205.491891-205.491892 205.491891a13.837838 13.837838 0 0 1-19.566702 0l-19.566703-19.566702a13.837838 13.837838 0 0 1 0-19.566703L803.258811 498.162162l-205.491892-205.491892a13.837838 13.837838 0 0 1 0-19.566702l19.566703-19.566703a13.837838 13.837838 0 0 1 19.566702 0l205.491892 205.491892 205.491892-205.491892a13.837838 13.837838 0 0 1 19.566703 0l19.566703 19.566703a13.837838 13.837838 0 0 1 0 19.566702L881.525622 498.162162l205.491892 205.491892a13.837838 13.837838 0 0 1 0 19.566703z",fill:"#333333"})],-1)]))]),a.createElementVNode("div",tn,[a.createElementVNode("button",{class:"btn btn-function",onClick:ie,title:"倒数 (1/x)"},d[29]||(d[29]=[a.createElementVNode("svg",{width:"30",height:"30",viewBox:"0 0 20 20"},[a.createElementVNode("text",{x:"6",y:"10","font-size":"7","font-family":"Arial, sans-serif","font-weight":"500",fill:"currentColor"}," 1 "),a.createElementVNode("line",{x1:"8",y1:"16",x2:"14",y2:"6",stroke:"currentColor","stroke-width":"0.6"}),a.createElementVNode("text",{x:"12",y:"16","font-size":"7","font-family":"Arial, sans-serif","font-style":"italic",fill:"currentColor"}," x ")],-1)])),a.createElementVNode("button",{class:"btn btn-function",onClick:le,title:"平方 (x²)"},d[30]||(d[30]=[a.createElementVNode("svg",{viewBox:"0 0 1024 1024",width:"20",height:"20"},[a.createElementVNode("path",{d:"M634.34666667 990.22222222L398.72 639.39555555 162.66666667 990.22222222h-60.69333334l268.26666667-391.57333333L123.62666667 245.68888889h60.69333333l216.53333333 316.48L612.58666667 245.68888889h60.69333333L430.93333333 598.75555555l264 391.57333334-60.58666666-0.10666667zM750.93333333 372.19555555v-17.6c9.38666667-23.57333333 21.76-45.33333333 37.33333334-65.38666666 15.36-20.16 36.26666667-41.28 62.29333333-63.78666667 30.61333333-26.45333333 51.84-48.53333333 63.46666667-65.92s17.38666667-36.8 17.38666666-58.02666667c0-22.82666667-6.72-40.53333333-19.94666666-53.65333333-13.22666667-12.90666667-31.36-19.41333333-54.4-19.41333333-20.48 0-37.86666667 6.29333333-52.16 18.88-14.29333333 12.48-22.61333333 29.54666667-24.85333334 51.09333333L755.62666667 94.22222222c2.56-26.13333333 13.01333333-47.14666667 31.68-63.04 18.45333333-15.89333333 42.02666667-23.89333333 70.61333333-23.89333333 30.4 0 54.50666667 8 72.32 24.10666666 17.70666667 16.10666667 26.45333333 38.4 26.45333333 66.98666667 0 16.64-2.56 31.68-7.57333333 44.90666667s-13.22666667 26.77333333-24.64 40.74666666c-11.41333333 13.97333333-30.08 32.42666667-55.78666667 55.57333334-21.22666667 18.88-39.36 37.12-54.18666666 54.72s-26.45333333 36.05333333-34.77333334 55.25333333h182.4v22.50666667H750.93333333z",fill:"#000000"})],-1)])),a.createElementVNode("button",{class:"btn btn-function",onClick:U,title:"平方根 (√x)"},d[31]||(d[31]=[a.createElementVNode("svg",{viewBox:"0 0 1445 1024",width:"20",height:"20"},[a.createElementVNode("path",{d:"M923.768471 421.647059c15.36 16.263529 26.985412 32.647529 34.816 48.971294 5.662118 11.264 14.878118 40.96 27.76847 88.907294l41.441883-62.102588c10.962824-15.058824 24.274824-29.394824 39.996235-43.068235 15.661176-13.673412 29.515294-23.009882 41.381647-28.009412 7.529412-3.132235 15.841882-4.698353 24.937412-4.698353 13.492706 0 24.214588 3.614118 32.225882 10.842353s12.047059 15.962353 12.047059 26.322823c0 11.926588-2.409412 20.118588-7.107765 24.45553a43.971765 43.971765 0 0 1-30.117647 11.806117c-6.625882 0-13.613176-1.445647-21.142588-4.21647-14.757647-5.059765-24.696471-7.589647-29.635765-7.589647-7.529412 0-16.504471 4.397176-26.864941 13.251764-19.456 16.263529-42.646588 47.766588-69.632 94.569412l38.550588 161.852235c6.023529 24.756706 11.023059 39.634824 15.058824 44.453648 4.096 4.879059 8.192 7.288471 12.288 7.28847 6.625882 0 14.275765-3.614118 23.070117-10.842353 17.227294-14.396235 31.924706-33.189647 44.212706-56.44047l16.444236 8.432941a294.671059 294.671059 0 0 1-75.294118 92.28047c-17.227294 13.854118-31.804235 20.720941-43.730824 20.720942-17.588706 0-31.563294-9.878588-41.863529-29.635765-6.625882-12.288-20.239059-64.933647-40.96-158.117647-48.971294 84.992-88.184471 139.745882-117.639529 164.201412-19.154824 15.661176-37.647059 23.491765-55.536942 23.491764a50.838588 50.838588 0 0 1-34.334117-13.613176 35.84 35.84 0 0 1-11.324236-27.708236c0-10.420706 3.433412-19.034353 10.360471-25.901176a34.575059 34.575059 0 0 1 25.419294-10.360471c9.999059 0 20.660706 4.999529 31.984941 15.058824 8.131765 7.228235 14.456471 10.842353 18.853647 10.842353 3.734588 0 8.613647-2.529882 14.576942-7.589647 14.697412-11.866353 34.816-37.647059 60.235294-77.101177 25.419294-39.574588 42.044235-68.126118 49.874823-85.714823a5098.315294 5098.315294 0 0 0-31.563294-120.952471c-7.228235-20.359529-16.624941-34.816-28.190118-43.248941-11.625412-8.432941-28.732235-12.709647-51.32047-12.709647-7.228235 0-15.540706 0.301176-24.937412 0.903529v-16.865882L923.768471 421.647059zM164.201412 523.806118l-90.473412 45.236706a30.117647 30.117647 0 0 1-26.985412-53.850353l120.470588-60.235295a30.117647 30.117647 0 0 1 41.682824 16.323765l143.661176 383.096471L512.602353 54.392471A30.117647 30.117647 0 0 1 542.117647 30.117647h843.294118a30.117647 30.117647 0 1 1 0 60.235294H566.814118L390.927059 969.667765c-5.903059 29.696-47.104 33.069176-57.705412 4.698353l-168.96-450.56z",fill:"#000000"})],-1)])),a.createElementVNode("button",{class:"btn btn-operator",onClick:d[7]||(d[7]=V=>H("/"))},d[32]||(d[32]=[a.createElementVNode("svg",{viewBox:"0 0 1461 1024",width:"20",height:"20"},[a.createElementVNode("path",{d:"M0 464.484686m55.698745 0l1349.623431 0q55.698745 0 55.698745 55.698745l0 0q0 55.698745-55.698745 55.698745l-1349.623431 0q-55.698745 0-55.698745-55.698745l0 0q0-55.698745 55.698745-55.698745Z",fill:"#333"}),a.createElementVNode("path",{d:"M729.082287 100.686192m-100.686192 0a100.686192 100.686192 0 1 0 201.372385 0 100.686192 100.686192 0 1 0-201.372385 0Z",fill:"#333"}),a.createElementVNode("path",{d:"M729.082287 923.313808m-100.686192 0a100.686192 100.686192 0 1 0 201.372385 0 100.686192 100.686192 0 1 0-201.372385 0Z","p-id":"33119"})],-1)]))]),a.createElementVNode("div",nn,[a.createElementVNode("button",{class:"btn btn-number",onClick:d[8]||(d[8]=V=>k("7"))},"7"),a.createElementVNode("button",{class:"btn btn-number",onClick:d[9]||(d[9]=V=>k("8"))},"8"),a.createElementVNode("button",{class:"btn btn-number",onClick:d[10]||(d[10]=V=>k("9"))},"9"),a.createElementVNode("button",{class:"btn btn-operator",onClick:d[11]||(d[11]=V=>H("*"))},d[33]||(d[33]=[a.createElementVNode("svg",{viewBox:"0 0 1024 1024",width:"20",height:"20"},[a.createElementVNode("path",{d:"M198.4 243.2c-6.4-12.8-6.4-32 0-44.8 12.8-6.4 32-6.4 44.8 0l582.4 582.4c12.8 12.8 12.8 32 0 44.8-12.8 6.4-32 6.4-44.8 0L198.4 243.2z m0 0",fill:"#333"}),a.createElementVNode("path",{d:"M780.8 198.4c12.8-6.4 32-6.4 44.8 0 12.8 12.8 12.8 32 0 44.8l-582.4 582.4c-12.8 6.4-32 6.4-44.8 0-6.4-12.8-6.4-32 0-44.8l582.4-582.4z m0 0",fill:"#333"})],-1)]))]),a.createElementVNode("div",rn,[a.createElementVNode("button",{class:"btn btn-number",onClick:d[12]||(d[12]=V=>k("4"))},"4"),a.createElementVNode("button",{class:"btn btn-number",onClick:d[13]||(d[13]=V=>k("5"))},"5"),a.createElementVNode("button",{class:"btn btn-number",onClick:d[14]||(d[14]=V=>k("6"))},"6"),a.createElementVNode("button",{class:"btn btn-operator",onClick:d[15]||(d[15]=V=>H("-"))},d[34]||(d[34]=[a.createElementVNode("svg",{viewBox:"0 0 1024 1024",width:"20",height:"20"},[a.createElementVNode("path",{d:"M128 512h768v46.933333H128z",fill:"#333"})],-1)]))]),a.createElementVNode("div",on,[a.createElementVNode("button",{class:"btn btn-number",onClick:d[16]||(d[16]=V=>k("1"))},"1"),a.createElementVNode("button",{class:"btn btn-number",onClick:d[17]||(d[17]=V=>k("2"))},"2"),a.createElementVNode("button",{class:"btn btn-number",onClick:d[18]||(d[18]=V=>k("3"))},"3"),a.createElementVNode("button",{class:"btn btn-operator",onClick:d[19]||(d[19]=V=>H("+"))},d[35]||(d[35]=[a.createElementVNode("svg",{viewBox:"0 0 1024 1024",width:"20",height:"20"},[a.createElementVNode("path",{d:"M863.328262 481.340895l-317.344013 0.099772L545.984249 162.816826c0-17.664722-14.336138-32.00086-32.00086-32.00086s-31.99914 14.336138-31.99914 32.00086l0 318.400215-322.368714-0.17718c-0.032684 0-0.063647 0-0.096331 0-17.632039 0-31.935493 14.239806-32.00086 31.904529-0.096331 17.664722 14.208843 32.031824 31.871845 32.095471l322.59234 0.17718 0 319.167424c0 17.695686 14.336138 32.00086 31.99914 32.00086s32.00086-14.303454 32.00086-32.00086L545.982529 545.440667l317.087703-0.099772c0.063647 0 0.096331 0 0.127295 0 17.632039 0 31.935493-14.239806 32.00086-31.904529S880.960301 481.404542 863.328262 481.340895z",fill:"#333333"})],-1)]))]),a.createElementVNode("div",sn,[a.createElementVNode("button",{class:"btn btn-function",onClick:q},d[36]||(d[36]=[a.createElementVNode("svg",{viewBox:"0 0 1024 1024",width:"25",height:"25"},[a.createElementVNode("path",{d:"M552.96 747.52h225.28v48.64h-225.28zM655.36 227.84l38.4 23.04-314.88 545.28-38.4-23.04zM245.76 314.88h225.28v48.64H245.76z",fill:"#333333"}),a.createElementVNode("path",{d:"M335.36 227.84H384v225.28h-48.64z",fill:"#333333"})],-1)])),a.createElementVNode("button",{class:"btn btn-number",onClick:d[20]||(d[20]=V=>k("0"))},"0"),a.createElementVNode("button",{class:"btn btn-function",onClick:b},"."),a.createElementVNode("button",{class:"btn btn-equals",onClick:d[21]||(d[21]=V=>H("="))},"=")])]),r.value?(a.openBlock(),a.createElementBlock("div",{key:0,class:"drawer-overlay",onClick:Be})):a.createCommentVNode("",!0),a.createElementVNode("div",{class:a.normalizeClass(["drawer-menu",{"drawer-open":r.value}])},[a.createElementVNode("div",{class:"drawer-header"},[d[38]||(d[38]=a.createElementVNode("h3",null,"计算器",-1)),a.createElementVNode("button",{class:"btn btn-close",onClick:Be,title:"关闭菜单"},d[37]||(d[37]=[a.createElementVNode("svg",{width:"16",height:"16",viewBox:"0 0 16 16"},[a.createElementVNode("path",{d:"M2.146 2.854a.5.5 0 1 1 .708-.708L8 7.293l5.146-5.147a.5.5 0 0 1 .708.708L8.707 8l5.147 5.146a.5.5 0 0 1-.708.708L8 8.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 8 2.146 2.854Z",fill:"currentColor"})],-1)]))]),a.createElementVNode("div",ln,[a.createElementVNode("div",{class:a.normalizeClass(["mode-option",{active:l.value==="standard"}]),onClick:d[22]||(d[22]=V=>_e("standard"))},[d[40]||(d[40]=a.createStaticVNode('<div class="mode-icon" data-v-d83a4ce9><svg width="20" height="20" viewBox="0 0 16 16" data-v-d83a4ce9><path d="M2 2h12a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1zm0 1v10h12V3H2z" fill="currentColor" data-v-d83a4ce9></path><path d="M4 5h2v2H4V5zm3 0h2v2H7V5zm3 0h2v2h-2V5zM4 8h2v2H4V8zm3 0h2v2H7V8zm3 0h2v2h-2V8z" fill="currentColor" data-v-d83a4ce9></path></svg></div><div class="mode-info" data-v-d83a4ce9><div class="mode-title" data-v-d83a4ce9>标准型</div><div class="mode-desc" data-v-d83a4ce9>基本的算术运算</div></div>',2)),l.value==="standard"?(a.openBlock(),a.createElementBlock("div",an,d[39]||(d[39]=[a.createElementVNode("svg",{width:"16",height:"16",viewBox:"0 0 16 16"},[a.createElementVNode("path",{d:"M13.854 3.646a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6.5 10.293l6.646-6.647a.5.5 0 0 1 .708 0z",fill:"currentColor"})],-1)]))):a.createCommentVNode("",!0)],2),a.createElementVNode("div",{class:a.normalizeClass(["mode-option",{active:l.value==="scientific"}]),onClick:d[23]||(d[23]=V=>_e("scientific"))},[d[42]||(d[42]=a.createStaticVNode('<div class="mode-icon" data-v-d83a4ce9><svg width="20" height="20" viewBox="0 0 16 16" data-v-d83a4ce9><path d="M2 2h12a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1zm0 1v10h12V3H2z" fill="currentColor" data-v-d83a4ce9></path><path d="M3 4h1v1H3V4zm2 0h1v1H5V4zm2 0h1v1H7V4zm2 0h1v1H9V4zm2 0h1v1h-1V4zM3 6h1v1H3V6zm2 0h1v1H5V6zm2 0h1v1H7V6zm2 0h1v1H9V6zm2 0h1v1h-1V6zM3 8h1v1H3V8zm2 0h1v1H5V8zm2 0h1v1H7V8zm2 0h1v1H9V8zm2 0h1v1h-1V8zM3 10h1v1H3v-1zm2 0h1v1H5v-1zm2 0h1v1H7v-1zm2 0h1v1H9v-1zm2 0h1v1h-1v-1z" fill="currentColor" data-v-d83a4ce9></path></svg></div><div class="mode-info" data-v-d83a4ce9><div class="mode-title" data-v-d83a4ce9>科学型</div><div class="mode-desc" data-v-d83a4ce9>高级数学函数和运算</div></div>',2)),l.value==="scientific"?(a.openBlock(),a.createElementBlock("div",cn,d[41]||(d[41]=[a.createElementVNode("svg",{width:"16",height:"16",viewBox:"0 0 16 16"},[a.createElementVNode("path",{d:"M13.854 3.646a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6.5 10.293l6.646-6.647a.5.5 0 0 1 .708 0z",fill:"currentColor"})],-1)]))):a.createCommentVNode("",!0)],2)])],2),a.createVNode(a.Transition,{name:"history-slide"},{default:a.withCtx(()=>[i.value?(a.openBlock(),a.createElementBlock("div",{key:0,class:"history-overlay",onClick:K},[a.createElementVNode("div",{class:"history-panel",onClick:d[24]||(d[24]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",{class:"history-header"},[d[44]||(d[44]=a.createElementVNode("h3",null,"历史记录",-1)),a.createElementVNode("div",{class:"history-actions"},[a.createElementVNode("button",{class:"btn btn-close",onClick:K,title:"关闭历史记录"},d[43]||(d[43]=[a.createElementVNode("svg",{width:"16",height:"16",viewBox:"0 0 16 16"},[a.createElementVNode("path",{d:"M2.146 2.854a.5.5 0 1 1 .708-.708L8 7.293l5.146-5.147a.5.5 0 0 1 .708.708L8.707 8l5.147 5.146a.5.5 0 0 1-.708.708L8 8.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 8 2.146 2.854Z",fill:"currentColor"})],-1)]))])]),a.createElementVNode("div",un,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(m.value,(V,L)=>(a.openBlock(),a.createElementBlock("div",{key:L,class:"history-item"},[a.createElementVNode("div",{class:"history-content",onClick:T=>Sn(V)},a.toDisplayString(V),9,fn),a.createElementVNode("button",{class:"btn btn-delete",onClick:T=>yn(L),title:"删除此条记录"},d[45]||(d[45]=[a.createElementVNode("svg",{width:"14",height:"14",viewBox:"0 0 16 16"},[a.createElementVNode("path",{d:"M2.5 1a1 1 0 0 0-1 1v1a1 1 0 0 0 1 1H3v9a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V4h.5a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H10a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1H2.5zm3 4a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 .5-.5zM8 5a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7A.5.5 0 0 1 8 5zm3 .5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 1 0z",fill:"currentColor"})],-1)]),8,dn)]))),128)),m.value.length===0?(a.openBlock(),a.createElementBlock("div",mn," 暂无历史记录 ")):a.createCommentVNode("",!0)])])])):a.createCommentVNode("",!0)]),_:1}),a.createVNode(a.Transition,{name:"memory-slide"},{default:a.withCtx(()=>[o.value?(a.openBlock(),a.createElementBlock("div",{key:0,class:"memory-overlay",onClick:F},[a.createElementVNode("div",{class:"memory-panel",onClick:d[25]||(d[25]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",{class:"memory-header"},[d[47]||(d[47]=a.createElementVNode("h3",null,"内存记录",-1)),a.createElementVNode("div",{class:"memory-actions"},[a.createElementVNode("button",{class:"btn btn-close",onClick:F,title:"关闭内存记录"},d[46]||(d[46]=[a.createElementVNode("svg",{width:"16",height:"16",viewBox:"0 0 16 16"},[a.createElementVNode("path",{d:"M2.146 2.854a.5.5 0 1 1 .708-.708L8 7.293l5.146-5.147a.5.5 0 0 1 .708.708L8.707 8l5.147 5.146a.5.5 0 0 1-.708.708L8 8.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 8 2.146 2.854Z",fill:"currentColor"})],-1)]))])]),a.createElementVNode("div",hn,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(s.value,(V,L)=>(a.openBlock(),a.createElementBlock("div",{key:L,class:"memory-item"},[a.createElementVNode("div",{class:"memory-value",onClick:T=>g(V)},a.toDisplayString(V),9,pn),a.createElementVNode("div",gn,[a.createElementVNode("button",{class:"btn btn-mini",onClick:T=>z(L),title:"清除此项"}," MC ",8,vn),a.createElementVNode("button",{class:"btn btn-mini",onClick:T=>_(V,L),title:"内存加法"}," M+ ",8,wn),a.createElementVNode("button",{class:"btn btn-mini",onClick:T=>se(V,L),title:"内存减法"}," M- ",8,Nn)])]))),128)),s.value.length===0?(a.openBlock(),a.createElementBlock("div",En," 内存中未保存任何内容 ")):a.createCommentVNode("",!0)]),s.value.length>0?(a.openBlock(),a.createElementBlock("div",bn,[a.createElementVNode("button",{class:"btn btn-clear-memory",onClick:E,title:"清空所有内存记录"},d[48]||(d[48]=[a.createElementVNode("svg",{width:"14",height:"14",viewBox:"0 0 16 16"},[a.createElementVNode("path",{d:"M2.5 1a1 1 0 0 0-1 1v1a1 1 0 0 0 1 1H3v9a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V4h.5a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H10a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1H2.5zm3 4a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 .5-.5zM8 5a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7A.5.5 0 0 1 8 5zm3 .5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 1 0z",fill:"currentColor"})],-1)]))])):a.createCommentVNode("",!0)])])):a.createCommentVNode("",!0)]),_:1})]))}}),[["__scopeId","data-v-d83a4ce9"]]);function xe(e){e.component("Calculator",Se)}const Vn={install:xe,Calculator:Se,useCalculator:me,useCalculatorStore:me},kn="1.0.0";x.Calculator=Se,x.default=Vn,x.install=xe,x.useCalculator=me,x.useCalculatorStore=me,x.version=kn,Object.defineProperties(x,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
//# sourceMappingURL=index.umd.js.map