| 123456789 |
- import{_ as e}from"./uni-easyinput.BPzETTZ_.js";import{d as n,u as i,c as t,r,w as s,aO as o,g as u,h as c,j as a,k as l,l as f,m as d,p as h,t as p,n as g,y as m,A as w,_ as v}from"./index-Bsqftdzs.js";import{_ as N,a as b}from"./uni-forms.CphUpLq_.js";import{a as y}from"./user.DQRxKOVW.js";import{s as E}from"./toast.8oYJgYNU.js";import{u as x}from"./useEmailCountdown.NSZAI2tk.js";const M=v(n({__name:"cwg-email-code-popup",props:{visible:{type:Boolean,default:!1},email:{type:String,default:""},country:{type:String,default:""},api:{type:Function,default:()=>{}}},emits:["update:visible","confirm"],setup(n,{emit:v}){const{time:M,text:_,canSend:q,start:O,restore:C}=x({storageKey:"emailCodeTimer"}),{t:F,locale:S}=i(),A=n,k=v,D=t({get:()=>A.visible,set:e=>k("update:visible",e)}),Z=r(null),R=r(!1),T=r({emailCode:""}),P=t(()=>({emailCode:{rules:[{required:!0,errorMessage:F("vaildate.code.empty")},{validateFunction:(e,n,i,t)=>n&&!!/^\d{6}$/.test(n)||(t(F("vaildate.code.empty")),!1)}]}}));async function U(){q.value&&!R.value&&await async function(){try{return R.value=!0,200===(await A.api({email:A.email||void 0,country:A.country||void 0})).code?(E(F("Msg.CodeSuccess")),O(),!0):(E(F("Msg.CodeFail")),!1)}catch(e){return E(F("Msg.CodeFail")),!1}finally{R.value=!1}}()}s(S,()=>{var e;null==(e=Z.value)||e.clearValidate()});const L=async()=>{if(Z.value)try{await Z.value.validate(),D.value=!1,console.log(T.value.emailCode,12121),k("confirm",T.value.emailCode)}catch(e){if(e instanceof Array)return void E(e[0].errorMessage);E(F("Msg.CodeFail"))}};return o(()=>{C()}),(n,i)=>{const t=u(c("uni-easyinput"),e),r=u(c("uni-forms-item"),N),s=m,o=w,v=u(c("uni-forms"),b),E=u(c("cwg-popup"),y);return a(),l(E,{visible:D.value,"onUpdate:visible":i[2]||(i[2]=e=>D.value=e),type:"center","mask-click":!1,"show-footers":!0,title:g(F)("signup.form.code")},{footer:f(()=>[d(o,{onClick:i[1]||(i[1]=e=>D.value=!1)},{default:f(()=>[h(p(g(F)("Btn.Cancel")),1)]),_:1}),d(o,{type:"primary",onClick:L},{default:f(()=>[h(p(g(F)("Btn.Confirm")),1)]),_:1})]),default:f(()=>[d(s,{class:"popup-content"},{default:f(()=>[d(s,{class:"card-handle-dialog-content"},{default:f(()=>[d(v,{ref_key:"formRef1",ref:Z,model:T.value,rules:P.value,"label-position":"top","validate-trigger":"submit","label-width":200,class:"base-info-form"},{default:f(()=>[d(s,{class:"code-input-wrapper"},{default:f(()=>[d(s,{class:"code-input"},{default:f(()=>[d(r,{label:g(F)("signup.form.code"),name:"emailCode"},{default:f(()=>[d(t,{type:"number",modelValue:T.value.emailCode,"onUpdate:modelValue":i[0]||(i[0]=e=>T.value.emailCode=e),placeholder:g(F)("signup.form.code")},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1}),d(s,{class:"get-code-btn"},{default:f(()=>[d(s,{class:"cwg-button ok-button"},{default:f(()=>[d(o,{type:"primary",block:"",disabled:!g(q)||R.value,onClick:U},{default:f(()=>[h(p(g(_)),1)]),_:1},8,["disabled"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model","rules"])]),_:1})]),_:1})]),_:1},8,["visible","title"])}}}),[["__scopeId","data-v-0fb23092"]]);
- /*!
- * 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 _,q,O=9e15,C=1e9,F="0123456789abcdef",S="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",A="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",k={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-O,maxE:O,crypto:!1},D=!0,Z="[DecimalError] ",R=Z+"Invalid argument: ",T=Z+"Precision limit exceeded",P=Z+"crypto unavailable",U="[object Decimal]",L=Math.floor,I=Math.pow,j=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,B=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,H=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,V=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,$=1e7,W=S.length-1,J=A.length-1,K={toStringTag:U};function z(e){var n,i,t,r=e.length-1,s="",o=e[0];if(r>0){for(s+=o,n=1;n<r;n++)(i=7-(t=e[n]+"").length)&&(s+=oe(i)),s+=t;(i=7-(t=(o=e[n])+"").length)&&(s+=oe(i))}else if(0===o)return"0";for(;o%10==0;)o/=10;return s+o}function G(e,n,i){if(e!==~~e||e<n||e>i)throw Error(R+e)}function Q(e,n,i,t){var r,s,o,u;for(s=e[0];s>=10;s/=10)--n;return--n<0?(n+=7,r=0):(r=Math.ceil((n+1)/7),n%=7),s=I(10,7-n),u=e[r]%s|0,null==t?n<3?(0==n?u=u/100|0:1==n&&(u=u/10|0),o=i<4&&99999==u||i>3&&49999==u||5e4==u||0==u):o=(i<4&&u+1==s||i>3&&u+1==s/2)&&(e[r+1]/s/100|0)==I(10,n-2)-1||(u==s/2||0==u)&&!(e[r+1]/s/100|0):n<4?(0==n?u=u/1e3|0:1==n?u=u/100|0:2==n&&(u=u/10|0),o=(t||i<4)&&9999==u||!t&&i>3&&4999==u):o=((t||i<4)&&u+1==s||!t&&i>3&&u+1==s/2)&&(e[r+1]/s/1e3|0)==I(10,n-3)-1,o}function X(e,n,i){for(var t,r,s=[0],o=0,u=e.length;o<u;){for(r=s.length;r--;)s[r]*=n;for(s[0]+=F.indexOf(e.charAt(o++)),t=0;t<s.length;t++)s[t]>i-1&&(void 0===s[t+1]&&(s[t+1]=0),s[t+1]+=s[t]/i|0,s[t]%=i)}return s.reverse()}K.absoluteValue=K.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),ee(e)},K.ceil=function(){return ee(new this.constructor(this),this.e+1,2)},K.clampedTo=K.clamp=function(e,n){var i=this,t=i.constructor;if(e=new t(e),n=new t(n),!e.s||!n.s)return new t(NaN);if(e.gt(n))throw Error(R+n);return i.cmp(e)<0?e:i.cmp(n)>0?n:new t(i)},K.comparedTo=K.cmp=function(e){var n,i,t,r,s=this,o=s.d,u=(e=new s.constructor(e)).d,c=s.s,a=e.s;if(!o||!u)return c&&a?c!==a?c:o===u?0:!o^c<0?1:-1:NaN;if(!o[0]||!u[0])return o[0]?c:u[0]?-a:0;if(c!==a)return c;if(s.e!==e.e)return s.e>e.e^c<0?1:-1;for(n=0,i=(t=o.length)<(r=u.length)?t:r;n<i;++n)if(o[n]!==u[n])return o[n]>u[n]^c<0?1:-1;return t===r?0:t>r^c<0?1:-1},K.cosine=K.cos=function(){var e,n,i=this,t=i.constructor;return i.d?i.d[0]?(e=t.precision,n=t.rounding,t.precision=e+Math.max(i.e,i.sd())+7,t.rounding=1,i=function(e,n){var i,t,r;if(n.isZero())return n;t=n.d.length,t<32?r=(1/ge(4,i=Math.ceil(t/3))).toString():(i=16,r="2.3283064365386962890625e-10");e.precision+=i,n=pe(e,1,n.times(r),new e(1));for(var s=i;s--;){var o=n.times(n);n=o.times(o).minus(o).times(8).plus(1)}return e.precision-=i,n}(t,me(t,i)),t.precision=e,t.rounding=n,ee(2==q||3==q?i.neg():i,e,n,!0)):new t(1):new t(NaN)},K.cubeRoot=K.cbrt=function(){var e,n,i,t,r,s,o,u,c,a,l=this,f=l.constructor;if(!l.isFinite()||l.isZero())return new f(l);for(D=!1,(s=l.s*I(l.s*l,1/3))&&Math.abs(s)!=1/0?t=new f(s.toString()):(i=z(l.d),(s=((e=l.e)-i.length+1)%3)&&(i+=1==s||-2==s?"0":"00"),s=I(i,1/3),e=L((e+1)/3)-(e%3==(e<0?-1:2)),(t=new f(i=s==1/0?"5e"+e:(i=s.toExponential()).slice(0,i.indexOf("e")+1)+e)).s=l.s),o=(e=f.precision)+3;;)if(a=(c=(u=t).times(u).times(u)).plus(l),t=Y(a.plus(l).times(u),a.plus(c),o+2,1),z(u.d).slice(0,o)===(i=z(t.d)).slice(0,o)){if("9999"!=(i=i.slice(o-3,o+1))&&(r||"4999"!=i)){+i&&(+i.slice(1)||"5"!=i.charAt(0))||(ee(t,e+1,1),n=!t.times(t).times(t).eq(l));break}if(!r&&(ee(u,e+1,0),u.times(u).times(u).eq(l))){t=u;break}o+=4,r=1}return D=!0,ee(t,e,f.rounding,n)},K.decimalPlaces=K.dp=function(){var e,n=this.d,i=NaN;if(n){if(i=7*((e=n.length-1)-L(this.e/7)),e=n[e])for(;e%10==0;e/=10)i--;i<0&&(i=0)}return i},K.dividedBy=K.div=function(e){return Y(this,new this.constructor(e))},K.dividedToIntegerBy=K.divToInt=function(e){var n=this.constructor;return ee(Y(this,new n(e),0,1,1),n.precision,n.rounding)},K.equals=K.eq=function(e){return 0===this.cmp(e)},K.floor=function(){return ee(new this.constructor(this),this.e+1,3)},K.greaterThan=K.gt=function(e){return this.cmp(e)>0},K.greaterThanOrEqualTo=K.gte=function(e){var n=this.cmp(e);return 1==n||0===n},K.hyperbolicCosine=K.cosh=function(){var e,n,i,t,r,s=this,o=s.constructor,u=new o(1);if(!s.isFinite())return new o(s.s?1/0:NaN);if(s.isZero())return u;i=o.precision,t=o.rounding,o.precision=i+Math.max(s.e,s.sd())+4,o.rounding=1,(r=s.d.length)<32?n=(1/ge(4,e=Math.ceil(r/3))).toString():(e=16,n="2.3283064365386962890625e-10"),s=pe(o,1,s.times(n),new o(1),!0);for(var c,a=e,l=new o(8);a--;)c=s.times(s),s=u.minus(c.times(l.minus(c.times(l))));return ee(s,o.precision=i,o.rounding=t,!0)},K.hyperbolicSine=K.sinh=function(){var e,n,i,t,r=this,s=r.constructor;if(!r.isFinite()||r.isZero())return new s(r);if(n=s.precision,i=s.rounding,s.precision=n+Math.max(r.e,r.sd())+4,s.rounding=1,(t=r.d.length)<3)r=pe(s,2,r,r,!0);else{e=(e=1.4*Math.sqrt(t))>16?16:0|e,r=pe(s,2,r=r.times(1/ge(5,e)),r,!0);for(var o,u=new s(5),c=new s(16),a=new s(20);e--;)o=r.times(r),r=r.times(u.plus(o.times(c.times(o).plus(a))))}return s.precision=n,s.rounding=i,ee(r,n,i,!0)},K.hyperbolicTangent=K.tanh=function(){var e,n,i=this,t=i.constructor;return i.isFinite()?i.isZero()?new t(i):(e=t.precision,n=t.rounding,t.precision=e+7,t.rounding=1,Y(i.sinh(),i.cosh(),t.precision=e,t.rounding=n)):new t(i.s)},K.inverseCosine=K.acos=function(){var e=this,n=e.constructor,i=e.abs().cmp(1),t=n.precision,r=n.rounding;return-1!==i?0===i?e.isNeg()?re(n,t,r):new n(0):new n(NaN):e.isZero()?re(n,t+4,r).times(.5):(n.precision=t+6,n.rounding=1,e=new n(1).minus(e).div(e.plus(1)).sqrt().atan(),n.precision=t,n.rounding=r,e.times(2))},K.inverseHyperbolicCosine=K.acosh=function(){var e,n,i=this,t=i.constructor;return i.lte(1)?new t(i.eq(1)?0:NaN):i.isFinite()?(e=t.precision,n=t.rounding,t.precision=e+Math.max(Math.abs(i.e),i.sd())+4,t.rounding=1,D=!1,i=i.times(i).minus(1).sqrt().plus(i),D=!0,t.precision=e,t.rounding=n,i.ln()):new t(i)},K.inverseHyperbolicSine=K.asinh=function(){var e,n,i=this,t=i.constructor;return!i.isFinite()||i.isZero()?new t(i):(e=t.precision,n=t.rounding,t.precision=e+2*Math.max(Math.abs(i.e),i.sd())+6,t.rounding=1,D=!1,i=i.times(i).plus(1).sqrt().plus(i),D=!0,t.precision=e,t.rounding=n,i.ln())},K.inverseHyperbolicTangent=K.atanh=function(){var e,n,i,t,r=this,s=r.constructor;return r.isFinite()?r.e>=0?new s(r.abs().eq(1)?r.s/0:r.isZero()?r:NaN):(e=s.precision,n=s.rounding,t=r.sd(),Math.max(t,e)<2*-r.e-1?ee(new s(r),e,n,!0):(s.precision=i=t-r.e,r=Y(r.plus(1),new s(1).minus(r),i+e,1),s.precision=e+4,s.rounding=1,r=r.ln(),s.precision=e,s.rounding=n,r.times(.5))):new s(NaN)},K.inverseSine=K.asin=function(){var e,n,i,t,r=this,s=r.constructor;return r.isZero()?new s(r):(n=r.abs().cmp(1),i=s.precision,t=s.rounding,-1!==n?0===n?((e=re(s,i+4,t).times(.5)).s=r.s,e):new s(NaN):(s.precision=i+6,s.rounding=1,r=r.div(new s(1).minus(r.times(r)).sqrt().plus(1)).atan(),s.precision=i,s.rounding=t,r.times(2)))},K.inverseTangent=K.atan=function(){var e,n,i,t,r,s,o,u,c,a=this,l=a.constructor,f=l.precision,d=l.rounding;if(a.isFinite()){if(a.isZero())return new l(a);if(a.abs().eq(1)&&f+4<=J)return(o=re(l,f+4,d).times(.25)).s=a.s,o}else{if(!a.s)return new l(NaN);if(f+4<=J)return(o=re(l,f+4,d).times(.5)).s=a.s,o}for(l.precision=u=f+10,l.rounding=1,e=i=Math.min(28,u/7+2|0);e;--e)a=a.div(a.times(a).plus(1).sqrt().plus(1));for(D=!1,n=Math.ceil(u/7),t=1,c=a.times(a),o=new l(a),r=a;-1!==e;)if(r=r.times(c),s=o.minus(r.div(t+=2)),r=r.times(c),void 0!==(o=s.plus(r.div(t+=2))).d[n])for(e=n;o.d[e]===s.d[e]&&e--;);return i&&(o=o.times(2<<i-1)),D=!0,ee(o,l.precision=f,l.rounding=d,!0)},K.isFinite=function(){return!!this.d},K.isInteger=K.isInt=function(){return!!this.d&&L(this.e/7)>this.d.length-2},K.isNaN=function(){return!this.s},K.isNegative=K.isNeg=function(){return this.s<0},K.isPositive=K.isPos=function(){return this.s>0},K.isZero=function(){return!!this.d&&0===this.d[0]},K.lessThan=K.lt=function(e){return this.cmp(e)<0},K.lessThanOrEqualTo=K.lte=function(e){return this.cmp(e)<1},K.logarithm=K.log=function(e){var n,i,t,r,s,o,u,c,a=this,l=a.constructor,f=l.precision,d=l.rounding;if(null==e)e=new l(10),n=!0;else{if(i=(e=new l(e)).d,e.s<0||!i||!i[0]||e.eq(1))return new l(NaN);n=e.eq(10)}if(i=a.d,a.s<0||!i||!i[0]||a.eq(1))return new l(i&&!i[0]?-1/0:1!=a.s?NaN:i?0:1/0);if(n)if(i.length>1)s=!0;else{for(r=i[0];r%10==0;)r/=10;s=1!==r}if(D=!1,o=fe(a,u=f+5),t=n?te(l,u+10):fe(e,u),Q((c=Y(o,t,u,1)).d,r=f,d))do{if(o=fe(a,u+=10),t=n?te(l,u+10):fe(e,u),c=Y(o,t,u,1),!s){+z(c.d).slice(r+1,r+15)+1==1e14&&(c=ee(c,f+1,0));break}}while(Q(c.d,r+=10,d));return D=!0,ee(c,f,d)},K.minus=K.sub=function(e){var n,i,t,r,s,o,u,c,a,l,f,d,h=this,p=h.constructor;if(e=new p(e),!h.d||!e.d)return h.s&&e.s?h.d?e.s=-e.s:e=new p(e.d||h.s!==e.s?h:NaN):e=new p(NaN),e;if(h.s!=e.s)return e.s=-e.s,h.plus(e);if(a=h.d,d=e.d,u=p.precision,c=p.rounding,!a[0]||!d[0]){if(d[0])e.s=-e.s;else{if(!a[0])return new p(3===c?-0:0);e=new p(h)}return D?ee(e,u,c):e}if(i=L(e.e/7),l=L(h.e/7),a=a.slice(),s=l-i){for((f=s<0)?(n=a,s=-s,o=d.length):(n=d,i=l,o=a.length),s>(t=Math.max(Math.ceil(u/7),o)+2)&&(s=t,n.length=1),n.reverse(),t=s;t--;)n.push(0);n.reverse()}else{for((f=(t=a.length)<(o=d.length))&&(o=t),t=0;t<o;t++)if(a[t]!=d[t]){f=a[t]<d[t];break}s=0}for(f&&(n=a,a=d,d=n,e.s=-e.s),o=a.length,t=d.length-o;t>0;--t)a[o++]=0;for(t=d.length;t>s;){if(a[--t]<d[t]){for(r=t;r&&0===a[--r];)a[r]=$-1;--a[r],a[t]+=$}a[t]-=d[t]}for(;0===a[--o];)a.pop();for(;0===a[0];a.shift())--i;return a[0]?(e.d=a,e.e=ie(a,i),D?ee(e,u,c):e):new p(3===c?-0:0)},K.modulo=K.mod=function(e){var n,i=this,t=i.constructor;return e=new t(e),!i.d||!e.s||e.d&&!e.d[0]?new t(NaN):!e.d||i.d&&!i.d[0]?ee(new t(i),t.precision,t.rounding):(D=!1,9==t.modulo?(n=Y(i,e.abs(),0,3,1)).s*=e.s:n=Y(i,e,0,t.modulo,1),n=n.times(e),D=!0,i.minus(n))},K.naturalExponential=K.exp=function(){return le(this)},K.naturalLogarithm=K.ln=function(){return fe(this)},K.negated=K.neg=function(){var e=new this.constructor(this);return e.s=-e.s,ee(e)},K.plus=K.add=function(e){var n,i,t,r,s,o,u,c,a,l,f=this,d=f.constructor;if(e=new d(e),!f.d||!e.d)return f.s&&e.s?f.d||(e=new d(e.d||f.s===e.s?f:NaN)):e=new d(NaN),e;if(f.s!=e.s)return e.s=-e.s,f.minus(e);if(a=f.d,l=e.d,u=d.precision,c=d.rounding,!a[0]||!l[0])return l[0]||(e=new d(f)),D?ee(e,u,c):e;if(s=L(f.e/7),t=L(e.e/7),a=a.slice(),r=s-t){for(r<0?(i=a,r=-r,o=l.length):(i=l,t=s,o=a.length),r>(o=(s=Math.ceil(u/7))>o?s+1:o+1)&&(r=o,i.length=1),i.reverse();r--;)i.push(0);i.reverse()}for((o=a.length)-(r=l.length)<0&&(r=o,i=l,l=a,a=i),n=0;r;)n=(a[--r]=a[r]+l[r]+n)/$|0,a[r]%=$;for(n&&(a.unshift(n),++t),o=a.length;0==a[--o];)a.pop();return e.d=a,e.e=ie(a,t),D?ee(e,u,c):e},K.precision=K.sd=function(e){var n,i=this;if(void 0!==e&&e!==!!e&&1!==e&&0!==e)throw Error(R+e);return i.d?(n=se(i.d),e&&i.e+1>n&&(n=i.e+1)):n=NaN,n},K.round=function(){var e=this,n=e.constructor;return ee(new n(e),e.e+1,n.rounding)},K.sine=K.sin=function(){var e,n,i=this,t=i.constructor;return i.isFinite()?i.isZero()?new t(i):(e=t.precision,n=t.rounding,t.precision=e+Math.max(i.e,i.sd())+7,t.rounding=1,i=function(e,n){var i,t=n.d.length;if(t<3)return n.isZero()?n:pe(e,2,n,n);i=(i=1.4*Math.sqrt(t))>16?16:0|i,n=n.times(1/ge(5,i)),n=pe(e,2,n,n);for(var r,s=new e(5),o=new e(16),u=new e(20);i--;)r=n.times(n),n=n.times(s.plus(r.times(o.times(r).minus(u))));return n}(t,me(t,i)),t.precision=e,t.rounding=n,ee(q>2?i.neg():i,e,n,!0)):new t(NaN)},K.squareRoot=K.sqrt=function(){var e,n,i,t,r,s,o=this,u=o.d,c=o.e,a=o.s,l=o.constructor;if(1!==a||!u||!u[0])return new l(!a||a<0&&(!u||u[0])?NaN:u?o:1/0);for(D=!1,0==(a=Math.sqrt(+o))||a==1/0?(((n=z(u)).length+c)%2==0&&(n+="0"),a=Math.sqrt(n),c=L((c+1)/2)-(c<0||c%2),t=new l(n=a==1/0?"5e"+c:(n=a.toExponential()).slice(0,n.indexOf("e")+1)+c)):t=new l(a.toString()),i=(c=l.precision)+3;;)if(t=(s=t).plus(Y(o,s,i+2,1)).times(.5),z(s.d).slice(0,i)===(n=z(t.d)).slice(0,i)){if("9999"!=(n=n.slice(i-3,i+1))&&(r||"4999"!=n)){+n&&(+n.slice(1)||"5"!=n.charAt(0))||(ee(t,c+1,1),e=!t.times(t).eq(o));break}if(!r&&(ee(s,c+1,0),s.times(s).eq(o))){t=s;break}i+=4,r=1}return D=!0,ee(t,c,l.rounding,e)},K.tangent=K.tan=function(){var e,n,i=this,t=i.constructor;return i.isFinite()?i.isZero()?new t(i):(e=t.precision,n=t.rounding,t.precision=e+10,t.rounding=1,(i=i.sin()).s=1,i=Y(i,new t(1).minus(i.times(i)).sqrt(),e+10,0),t.precision=e,t.rounding=n,ee(2==q||4==q?i.neg():i,e,n,!0)):new t(NaN)},K.times=K.mul=function(e){var n,i,t,r,s,o,u,c,a,l=this,f=l.constructor,d=l.d,h=(e=new f(e)).d;if(e.s*=l.s,!(d&&d[0]&&h&&h[0]))return new f(!e.s||d&&!d[0]&&!h||h&&!h[0]&&!d?NaN:d&&h?0*e.s:e.s/0);for(i=L(l.e/7)+L(e.e/7),(c=d.length)<(a=h.length)&&(s=d,d=h,h=s,o=c,c=a,a=o),s=[],t=o=c+a;t--;)s.push(0);for(t=a;--t>=0;){for(n=0,r=c+t;r>t;)u=s[r]+h[t]*d[r-t-1]+n,s[r--]=u%$|0,n=u/$|0;s[r]=(s[r]+n)%$|0}for(;!s[--o];)s.pop();return n?++i:s.shift(),e.d=s,e.e=ie(s,i),D?ee(e,f.precision,f.rounding):e},K.toBinary=function(e,n){return we(this,2,e,n)},K.toDecimalPlaces=K.toDP=function(e,n){var i=this,t=i.constructor;return i=new t(i),void 0===e?i:(G(e,0,C),void 0===n?n=t.rounding:G(n,0,8),ee(i,e+i.e+1,n))},K.toExponential=function(e,n){var i,t=this,r=t.constructor;return void 0===e?i=ne(t,!0):(G(e,0,C),void 0===n?n=r.rounding:G(n,0,8),i=ne(t=ee(new r(t),e+1,n),!0,e+1)),t.isNeg()&&!t.isZero()?"-"+i:i},K.toFixed=function(e,n){var i,t,r=this,s=r.constructor;return void 0===e?i=ne(r):(G(e,0,C),void 0===n?n=s.rounding:G(n,0,8),i=ne(t=ee(new s(r),e+r.e+1,n),!1,e+t.e+1)),r.isNeg()&&!r.isZero()?"-"+i:i},K.toFraction=function(e){var n,i,t,r,s,o,u,c,a,l,f,d,h=this,p=h.d,g=h.constructor;if(!p)return new g(h);if(a=i=new g(1),t=c=new g(0),o=(s=(n=new g(t)).e=se(p)-h.e-1)%7,n.d[0]=I(10,o<0?7+o:o),null==e)e=s>0?n:a;else{if(!(u=new g(e)).isInt()||u.lt(a))throw Error(R+u);e=u.gt(n)?s>0?n:a:u}for(D=!1,u=new g(z(p)),l=g.precision,g.precision=s=7*p.length*2;f=Y(u,n,0,1,1),1!=(r=i.plus(f.times(t))).cmp(e);)i=t,t=r,r=a,a=c.plus(f.times(r)),c=r,r=n,n=u.minus(f.times(r)),u=r;return r=Y(e.minus(i),t,0,1,1),c=c.plus(r.times(a)),i=i.plus(r.times(t)),c.s=a.s=h.s,d=Y(a,t,s,1).minus(h).abs().cmp(Y(c,i,s,1).minus(h).abs())<1?[a,t]:[c,i],g.precision=l,D=!0,d},K.toHexadecimal=K.toHex=function(e,n){return we(this,16,e,n)},K.toNearest=function(e,n){var i=this,t=i.constructor;if(i=new t(i),null==e){if(!i.d)return i;e=new t(1),n=t.rounding}else{if(e=new t(e),void 0===n?n=t.rounding:G(n,0,8),!i.d)return e.s?i:e;if(!e.d)return e.s&&(e.s=i.s),e}return e.d[0]?(D=!1,i=Y(i,e,0,n,1).times(e),D=!0,ee(i)):(e.s=i.s,i=e),i},K.toNumber=function(){return+this},K.toOctal=function(e,n){return we(this,8,e,n)},K.toPower=K.pow=function(e){var n,i,t,r,s,o,u=this,c=u.constructor,a=+(e=new c(e));if(!(u.d&&e.d&&u.d[0]&&e.d[0]))return new c(I(+u,a));if((u=new c(u)).eq(1))return u;if(t=c.precision,s=c.rounding,e.eq(1))return ee(u,t,s);if((n=L(e.e/7))>=e.d.length-1&&(i=a<0?-a:a)<=9007199254740991)return r=ue(c,u,i,t),e.s<0?new c(1).div(r):ee(r,t,s);if((o=u.s)<0){if(n<e.d.length-1)return new c(NaN);if(1&e.d[n]||(o=1),0==u.e&&1==u.d[0]&&1==u.d.length)return u.s=o,u}return(n=0!=(i=I(+u,a))&&isFinite(i)?new c(i+"").e:L(a*(Math.log("0."+z(u.d))/Math.LN10+u.e+1)))>c.maxE+1||n<c.minE-1?new c(n>0?o/0:0):(D=!1,c.rounding=u.s=1,i=Math.min(12,(n+"").length),(r=le(e.times(fe(u,t+i)),t)).d&&Q((r=ee(r,t+5,1)).d,t,s)&&(n=t+10,+z((r=ee(le(e.times(fe(u,n+i)),n),n+5,1)).d).slice(t+1,t+15)+1==1e14&&(r=ee(r,t+1,0))),r.s=o,D=!0,c.rounding=s,ee(r,t,s))},K.toPrecision=function(e,n){var i,t=this,r=t.constructor;return void 0===e?i=ne(t,t.e<=r.toExpNeg||t.e>=r.toExpPos):(G(e,1,C),void 0===n?n=r.rounding:G(n,0,8),i=ne(t=ee(new r(t),e,n),e<=t.e||t.e<=r.toExpNeg,e)),t.isNeg()&&!t.isZero()?"-"+i:i},K.toSignificantDigits=K.toSD=function(e,n){var i=this.constructor;return void 0===e?(e=i.precision,n=i.rounding):(G(e,1,C),void 0===n?n=i.rounding:G(n,0,8)),ee(new i(this),e,n)},K.toString=function(){var e=this,n=e.constructor,i=ne(e,e.e<=n.toExpNeg||e.e>=n.toExpPos);return e.isNeg()&&!e.isZero()?"-"+i:i},K.truncated=K.trunc=function(){return ee(new this.constructor(this),this.e+1,1)},K.valueOf=K.toJSON=function(){var e=this,n=e.constructor,i=ne(e,e.e<=n.toExpNeg||e.e>=n.toExpPos);return e.isNeg()?"-"+i:i};var Y=function(){function e(e,n,i){var t,r=0,s=e.length;for(e=e.slice();s--;)t=e[s]*n+r,e[s]=t%i|0,r=t/i|0;return r&&e.unshift(r),e}function n(e,n,i,t){var r,s;if(i!=t)s=i>t?1:-1;else for(r=s=0;r<i;r++)if(e[r]!=n[r]){s=e[r]>n[r]?1:-1;break}return s}function i(e,n,i,t){for(var r=0;i--;)e[i]-=r,r=e[i]<n[i]?1:0,e[i]=r*t+e[i]-n[i];for(;!e[0]&&e.length>1;)e.shift()}return function(t,r,s,o,u,c){var a,l,f,d,h,p,g,m,w,v,N,b,y,E,x,M,q,O,C,F,S=t.constructor,A=t.s==r.s?1:-1,k=t.d,D=r.d;if(!(k&&k[0]&&D&&D[0]))return new S(t.s&&r.s&&(k?!D||k[0]!=D[0]:D)?k&&0==k[0]||!D?0*A:A/0:NaN);for(c?(h=1,l=t.e-r.e):(c=$,h=7,l=L(t.e/h)-L(r.e/h)),C=D.length,q=k.length,v=(w=new S(A)).d=[],f=0;D[f]==(k[f]||0);f++);if(D[f]>(k[f]||0)&&l--,null==s?(E=s=S.precision,o=S.rounding):E=u?s+(t.e-r.e)+1:s,E<0)v.push(1),p=!0;else{if(E=E/h+2|0,f=0,1==C){for(d=0,D=D[0],E++;(f<q||d)&&E--;f++)x=d*c+(k[f]||0),v[f]=x/D|0,d=x%D|0;p=d||f<q}else{for((d=c/(D[0]+1)|0)>1&&(D=e(D,d,c),k=e(k,d,c),C=D.length,q=k.length),M=C,b=(N=k.slice(0,C)).length;b<C;)N[b++]=0;(F=D.slice()).unshift(0),O=D[0],D[1]>=c/2&&++O;do{d=0,(a=n(D,N,C,b))<0?(y=N[0],C!=b&&(y=y*c+(N[1]||0)),(d=y/O|0)>1?(d>=c&&(d=c-1),1==(a=n(g=e(D,d,c),N,m=g.length,b=N.length))&&(d--,i(g,C<m?F:D,m,c))):(0==d&&(a=d=1),g=D.slice()),(m=g.length)<b&&g.unshift(0),i(N,g,b,c),-1==a&&(a=n(D,N,C,b=N.length))<1&&(d++,i(N,C<b?F:D,b,c)),b=N.length):0===a&&(d++,N=[0]),v[f++]=d,a&&N[0]?N[b++]=k[M]||0:(N=[k[M]],b=1)}while((M++<q||void 0!==N[0])&&E--);p=void 0!==N[0]}v[0]||v.shift()}if(1==h)w.e=l,_=p;else{for(f=1,d=v[0];d>=10;d/=10)f++;w.e=f+l*h-1,ee(w,u?s+w.e+1:s,o,p)}return w}}();function ee(e,n,i,t){var r,s,o,u,c,a,l,f,d,h=e.constructor;e:if(null!=n){if(!(f=e.d))return e;for(r=1,u=f[0];u>=10;u/=10)r++;if((s=n-r)<0)s+=7,o=n,c=(l=f[d=0])/I(10,r-o-1)%10|0;else if((d=Math.ceil((s+1)/7))>=(u=f.length)){if(!t)break e;for(;u++<=d;)f.push(0);l=c=0,r=1,o=(s%=7)-7+1}else{for(l=u=f[d],r=1;u>=10;u/=10)r++;c=(o=(s%=7)-7+r)<0?0:l/I(10,r-o-1)%10|0}if(t=t||n<0||void 0!==f[d+1]||(o<0?l:l%I(10,r-o-1)),a=i<4?(c||t)&&(0==i||i==(e.s<0?3:2)):c>5||5==c&&(4==i||t||6==i&&(s>0?o>0?l/I(10,r-o):0:f[d-1])%10&1||i==(e.s<0?8:7)),n<1||!f[0])return f.length=0,a?(n-=e.e+1,f[0]=I(10,(7-n%7)%7),e.e=-n||0):f[0]=e.e=0,e;if(0==s?(f.length=d,u=1,d--):(f.length=d+1,u=I(10,7-s),f[d]=o>0?(l/I(10,r-o)%I(10,o)|0)*u:0),a)for(;;){if(0==d){for(s=1,o=f[0];o>=10;o/=10)s++;for(o=f[0]+=u,u=1;o>=10;o/=10)u++;s!=u&&(e.e++,f[0]==$&&(f[0]=1));break}if(f[d]+=u,f[d]!=$)break;f[d--]=0,u=1}for(s=f.length;0===f[--s];)f.pop()}return D&&(e.e>h.maxE?(e.d=null,e.e=NaN):e.e<h.minE&&(e.e=0,e.d=[0])),e}function ne(e,n,i){if(!e.isFinite())return de(e);var t,r=e.e,s=z(e.d),o=s.length;return n?(i&&(t=i-o)>0?s=s.charAt(0)+"."+s.slice(1)+oe(t):o>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(e.e<0?"e":"e+")+e.e):r<0?(s="0."+oe(-r-1)+s,i&&(t=i-o)>0&&(s+=oe(t))):r>=o?(s+=oe(r+1-o),i&&(t=i-r-1)>0&&(s=s+"."+oe(t))):((t=r+1)<o&&(s=s.slice(0,t)+"."+s.slice(t)),i&&(t=i-o)>0&&(r+1===o&&(s+="."),s+=oe(t))),s}function ie(e,n){var i=e[0];for(n*=7;i>=10;i/=10)n++;return n}function te(e,n,i){if(n>W)throw D=!0,i&&(e.precision=i),Error(T);return ee(new e(S),n,1,!0)}function re(e,n,i){if(n>J)throw Error(T);return ee(new e(A),n,i,!0)}function se(e){var n=e.length-1,i=7*n+1;if(n=e[n]){for(;n%10==0;n/=10)i--;for(n=e[0];n>=10;n/=10)i++}return i}function oe(e){for(var n="";e--;)n+="0";return n}function ue(e,n,i,t){var r,s=new e(1),o=Math.ceil(t/7+4);for(D=!1;;){if(i%2&&ve((s=s.times(n)).d,o)&&(r=!0),0===(i=L(i/2))){i=s.d.length-1,r&&0===s.d[i]&&++s.d[i];break}ve((n=n.times(n)).d,o)}return D=!0,s}function ce(e){return 1&e.d[e.d.length-1]}function ae(e,n,i){for(var t,r,s=new e(n[0]),o=0;++o<n.length;){if(!(r=new e(n[o])).s){s=r;break}((t=s.cmp(r))===i||0===t&&s.s===i)&&(s=r)}return s}function le(e,n){var i,t,r,s,o,u,c,a=0,l=0,f=0,d=e.constructor,h=d.rounding,p=d.precision;if(!e.d||!e.d[0]||e.e>17)return new d(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:NaN);for(null==n?(D=!1,c=p):c=n,u=new d(.03125);e.e>-2;)e=e.times(u),f+=5;for(c+=t=Math.log(I(2,f))/Math.LN10*2+5|0,i=s=o=new d(1),d.precision=c;;){if(s=ee(s.times(e),c,1),i=i.times(++l),z((u=o.plus(Y(s,i,c,1))).d).slice(0,c)===z(o.d).slice(0,c)){for(r=f;r--;)o=ee(o.times(o),c,1);if(null!=n)return d.precision=p,o;if(!(a<3&&Q(o.d,c-t,h,a)))return ee(o,d.precision=p,h,D=!0);d.precision=c+=10,i=s=u=new d(1),l=0,a++}o=u}}function fe(e,n){var i,t,r,s,o,u,c,a,l,f,d,h=1,p=e,g=p.d,m=p.constructor,w=m.rounding,v=m.precision;if(p.s<0||!g||!g[0]||!p.e&&1==g[0]&&1==g.length)return new m(g&&!g[0]?-1/0:1!=p.s?NaN:g?0:p);if(null==n?(D=!1,l=v):l=n,m.precision=l+=10,t=(i=z(g)).charAt(0),!(Math.abs(s=p.e)<15e14))return a=te(m,l+2,v).times(s+""),p=fe(new m(t+"."+i.slice(1)),l-10).plus(a),m.precision=v,null==n?ee(p,v,w,D=!0):p;for(;t<7&&1!=t||1==t&&i.charAt(1)>3;)t=(i=z((p=p.times(e)).d)).charAt(0),h++;for(s=p.e,t>1?(p=new m("0."+i),s++):p=new m(t+"."+i.slice(1)),f=p,c=o=p=Y(p.minus(1),p.plus(1),l,1),d=ee(p.times(p),l,1),r=3;;){if(o=ee(o.times(d),l,1),z((a=c.plus(Y(o,new m(r),l,1))).d).slice(0,l)===z(c.d).slice(0,l)){if(c=c.times(2),0!==s&&(c=c.plus(te(m,l+2,v).times(s+""))),c=Y(c,new m(h),l,1),null!=n)return m.precision=v,c;if(!Q(c.d,l-10,w,u))return ee(c,m.precision=v,w,D=!0);m.precision=l+=10,a=o=p=Y(f.minus(1),f.plus(1),l,1),d=ee(p.times(p),l,1),r=u=1}c=a,r+=2}}function de(e){return String(e.s*e.s/0)}function he(e,n){var i,t,r;for((i=n.indexOf("."))>-1&&(n=n.replace(".","")),(t=n.search(/e/i))>0?(i<0&&(i=t),i+=+n.slice(t+1),n=n.substring(0,t)):i<0&&(i=n.length),t=0;48===n.charCodeAt(t);t++);for(r=n.length;48===n.charCodeAt(r-1);--r);if(n=n.slice(t,r)){if(r-=t,e.e=i=i-t-1,e.d=[],t=(i+1)%7,i<0&&(t+=7),t<r){for(t&&e.d.push(+n.slice(0,t)),r-=7;t<r;)e.d.push(+n.slice(t,t+=7));t=7-(n=n.slice(t)).length}else t-=r;for(;t--;)n+="0";e.d.push(+n),D&&(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 pe(e,n,i,t,r){var s,o,u,c,a=e.precision,l=Math.ceil(a/7);for(D=!1,c=i.times(i),u=new e(t);;){if(o=Y(u.times(c),new e(n++*n++),a,1),u=r?t.plus(o):t.minus(o),t=Y(o.times(c),new e(n++*n++),a,1),void 0!==(o=u.plus(t)).d[l]){for(s=l;o.d[s]===u.d[s]&&s--;);if(-1==s)break}s=u,u=t,t=o,o=s}return D=!0,o.d.length=l+1,o}function ge(e,n){for(var i=e;--n;)i*=e;return i}function me(e,n){var i,t=n.s<0,r=re(e,e.precision,1),s=r.times(.5);if((n=n.abs()).lte(s))return q=t?4:1,n;if((i=n.divToInt(r)).isZero())q=t?3:2;else{if((n=n.minus(i.times(r))).lte(s))return q=ce(i)?t?2:3:t?4:1,n;q=ce(i)?t?1:4:t?3:2}return n.minus(r).abs()}function we(e,n,i,t){var r,s,o,u,c,a,l,f,d,h=e.constructor,p=void 0!==i;if(p?(G(i,1,C),void 0===t?t=h.rounding:G(t,0,8)):(i=h.precision,t=h.rounding),e.isFinite()){for(p?(r=2,16==n?i=4*i-3:8==n&&(i=3*i-2)):r=n,(o=(l=ne(e)).indexOf("."))>=0&&(l=l.replace(".",""),(d=new h(1)).e=l.length-o,d.d=X(ne(d),10,r),d.e=d.d.length),s=c=(f=X(l,10,r)).length;0==f[--c];)f.pop();if(f[0]){if(o<0?s--:((e=new h(e)).d=f,e.e=s,f=(e=Y(e,d,i,t,0,r)).d,s=e.e,a=_),o=f[i],u=r/2,a=a||void 0!==f[i+1],a=t<4?(void 0!==o||a)&&(0===t||t===(e.s<0?3:2)):o>u||o===u&&(4===t||a||6===t&&1&f[i-1]||t===(e.s<0?8:7)),f.length=i,a)for(;++f[--i]>r-1;)f[i]=0,i||(++s,f.unshift(1));for(c=f.length;!f[c-1];--c);for(o=0,l="";o<c;o++)l+=F.charAt(f[o]);if(p){if(c>1)if(16==n||8==n){for(o=16==n?4:3,--c;c%o;c++)l+="0";for(c=(f=X(l,r,n)).length;!f[c-1];--c);for(o=1,l="1.";o<c;o++)l+=F.charAt(f[o])}else l=l.charAt(0)+"."+l.slice(1);l=l+(s<0?"p":"p+")+s}else if(s<0){for(;++s;)l="0"+l;l="0."+l}else if(++s>c)for(s-=c;s--;)l+="0";else s<c&&(l=l.slice(0,s)+"."+l.slice(s))}else l=p?"0p+0":"0";l=(16==n?"0x":2==n?"0b":8==n?"0o":"")+l}else l=de(e);return e.s<0?"-"+l:l}function ve(e,n){if(e.length>n)return e.length=n,!0}function Ne(e){return new this(e).abs()}function be(e){return new this(e).acos()}function ye(e){return new this(e).acosh()}function Ee(e,n){return new this(e).plus(n)}function xe(e){return new this(e).asin()}function Me(e){return new this(e).asinh()}function _e(e){return new this(e).atan()}function qe(e){return new this(e).atanh()}function Oe(e,n){e=new this(e),n=new this(n);var i,t=this.precision,r=this.rounding,s=t+4;return e.s&&n.s?e.d||n.d?!n.d||e.isZero()?(i=n.s<0?re(this,t,r):new this(0)).s=e.s:!e.d||n.isZero()?(i=re(this,s,1).times(.5)).s=e.s:n.s<0?(this.precision=s,this.rounding=1,i=this.atan(Y(e,n,s,1)),n=re(this,s,1),this.precision=t,this.rounding=r,i=e.s<0?i.minus(n):i.plus(n)):i=this.atan(Y(e,n,s,1)):(i=re(this,s,1).times(n.s>0?.25:.75)).s=e.s:i=new this(NaN),i}function Ce(e){return new this(e).cbrt()}function Fe(e){return ee(e=new this(e),e.e+1,2)}function Se(e,n,i){return new this(e).clamp(n,i)}function Ae(e){if(!e||"object"!=typeof e)throw Error(Z+"Object expected");var n,i,t,r=!0===e.defaults,s=["precision",1,C,"rounding",0,8,"toExpNeg",-O,0,"toExpPos",0,O,"maxE",0,O,"minE",-O,0,"modulo",0,9];for(n=0;n<s.length;n+=3)if(i=s[n],r&&(this[i]=k[i]),void 0!==(t=e[i])){if(!(L(t)===t&&t>=s[n+1]&&t<=s[n+2]))throw Error(R+i+": "+t);this[i]=t}if(i="crypto",r&&(this[i]=k[i]),void 0!==(t=e[i])){if(!0!==t&&!1!==t&&0!==t&&1!==t)throw Error(R+i+": "+t);if(t){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw Error(P);this[i]=!0}else this[i]=!1}return this}function ke(e){return new this(e).cos()}function De(e){return new this(e).cosh()}function Ze(e,n){return new this(e).div(n)}function Re(e){return new this(e).exp()}function Te(e){return ee(e=new this(e),e.e+1,3)}function Pe(){var e,n,i=new this(0);for(D=!1,e=0;e<arguments.length;)if((n=new this(arguments[e++])).d)i.d&&(i=i.plus(n.times(n)));else{if(n.s)return D=!0,new this(1/0);i=n}return D=!0,i.sqrt()}function Ue(e){return e instanceof on||e&&e.toStringTag===U||!1}function Le(e){return new this(e).ln()}function Ie(e,n){return new this(e).log(n)}function je(e){return new this(e).log(2)}function Be(e){return new this(e).log(10)}function He(){return ae(this,arguments,-1)}function Ve(){return ae(this,arguments,1)}function $e(e,n){return new this(e).mod(n)}function We(e,n){return new this(e).mul(n)}function Je(e,n){return new this(e).pow(n)}function Ke(e){var n,i,t,r,s=0,o=new this(1),u=[];if(void 0===e?e=this.precision:G(e,1,C),t=Math.ceil(e/7),this.crypto)if(crypto.getRandomValues)for(n=crypto.getRandomValues(new Uint32Array(t));s<t;)(r=n[s])>=429e7?n[s]=crypto.getRandomValues(new Uint32Array(1))[0]:u[s++]=r%1e7;else{if(!crypto.randomBytes)throw Error(P);for(n=crypto.randomBytes(t*=4);s<t;)(r=n[s]+(n[s+1]<<8)+(n[s+2]<<16)+((127&n[s+3])<<24))>=214e7?crypto.randomBytes(4).copy(n,s):(u.push(r%1e7),s+=4);s=t/4}else for(;s<t;)u[s++]=1e7*Math.random()|0;for(e%=7,(t=u[--s])&&e&&(r=I(10,7-e),u[s]=(t/r|0)*r);0===u[s];s--)u.pop();if(s<0)i=0,u=[0];else{for(i=-1;0===u[0];i-=7)u.shift();for(t=1,r=u[0];r>=10;r/=10)t++;t<7&&(i-=7-t)}return o.e=i,o.d=u,o}function ze(e){return ee(e=new this(e),e.e+1,this.rounding)}function Ge(e){return(e=new this(e)).d?e.d[0]?e.s:0*e.s:e.s||NaN}function Qe(e){return new this(e).sin()}function Xe(e){return new this(e).sinh()}function Ye(e){return new this(e).sqrt()}function en(e,n){return new this(e).sub(n)}function nn(){var e=0,n=arguments,i=new this(n[e]);for(D=!1;i.s&&++e<n.length;)i=i.plus(n[e]);return D=!0,ee(i,this.precision,this.rounding)}function tn(e){return new this(e).tan()}function rn(e){return new this(e).tanh()}function sn(e){return ee(e=new this(e),e.e+1,1)}K[Symbol.for("nodejs.util.inspect.custom")]=K.toString,K[Symbol.toStringTag]="Decimal";var on=K.constructor=function e(n){var i,t,r;function s(e){var n,i,t,r=this;if(!(r instanceof s))return new s(e);if(r.constructor=s,Ue(e))return r.s=e.s,void(D?!e.d||e.e>s.maxE?(r.e=NaN,r.d=null):e.e<s.minE?(r.e=0,r.d=[0]):(r.e=e.e,r.d=e.d.slice()):(r.e=e.e,r.d=e.d?e.d.slice():e.d));if("number"===(t=typeof e)){if(0===e)return r.s=1/e<0?-1:1,r.e=0,void(r.d=[0]);if(e<0?(e=-e,r.s=-1):r.s=1,e===~~e&&e<1e7){for(n=0,i=e;i>=10;i/=10)n++;return void(D?n>s.maxE?(r.e=NaN,r.d=null):n<s.minE?(r.e=0,r.d=[0]):(r.e=n,r.d=[e]):(r.e=n,r.d=[e]))}return 0*e!=0?(e||(r.s=NaN),r.e=NaN,void(r.d=null)):he(r,e.toString())}if("string"===t)return 45===(i=e.charCodeAt(0))?(e=e.slice(1),r.s=-1):(43===i&&(e=e.slice(1)),r.s=1),V.test(e)?he(r,e):function(e,n){var i,t,r,s,o,u,c,a,l;if(n.indexOf("_")>-1){if(n=n.replace(/(\d)_(?=\d)/g,"$1"),V.test(n))return he(e,n)}else if("Infinity"===n||"NaN"===n)return+n||(e.s=NaN),e.e=NaN,e.d=null,e;if(B.test(n))i=16,n=n.toLowerCase();else if(j.test(n))i=2;else{if(!H.test(n))throw Error(R+n);i=8}for((s=n.search(/p/i))>0?(c=+n.slice(s+1),n=n.substring(2,s)):n=n.slice(2),o=(s=n.indexOf("."))>=0,t=e.constructor,o&&(s=(u=(n=n.replace(".","")).length)-s,r=ue(t,new t(i),s,2*s)),s=l=(a=X(n,i,$)).length-1;0===a[s];--s)a.pop();return s<0?new t(0*e.s):(e.e=ie(a,l),e.d=a,D=!1,o&&(e=Y(e,r,4*u)),c&&(e=e.times(Math.abs(c)<54?I(2,c):on.pow(2,c))),D=!0,e)}(r,e);if("bigint"===t)return e<0?(e=-e,r.s=-1):r.s=1,he(r,e.toString());throw Error(R+e)}if(s.prototype=K,s.ROUND_UP=0,s.ROUND_DOWN=1,s.ROUND_CEIL=2,s.ROUND_FLOOR=3,s.ROUND_HALF_UP=4,s.ROUND_HALF_DOWN=5,s.ROUND_HALF_EVEN=6,s.ROUND_HALF_CEIL=7,s.ROUND_HALF_FLOOR=8,s.EUCLID=9,s.config=s.set=Ae,s.clone=e,s.isDecimal=Ue,s.abs=Ne,s.acos=be,s.acosh=ye,s.add=Ee,s.asin=xe,s.asinh=Me,s.atan=_e,s.atanh=qe,s.atan2=Oe,s.cbrt=Ce,s.ceil=Fe,s.clamp=Se,s.cos=ke,s.cosh=De,s.div=Ze,s.exp=Re,s.floor=Te,s.hypot=Pe,s.ln=Le,s.log=Ie,s.log10=Be,s.log2=je,s.max=He,s.min=Ve,s.mod=$e,s.mul=We,s.pow=Je,s.random=Ke,s.round=ze,s.sign=Ge,s.sin=Qe,s.sinh=Xe,s.sqrt=Ye,s.sub=en,s.sum=nn,s.tan=tn,s.tanh=rn,s.trunc=sn,void 0===n&&(n={}),n&&!0!==n.defaults)for(r=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],i=0;i<r.length;)n.hasOwnProperty(t=r[i++])||(n[t]=this[t]);return s.config(n),s}(k);S=new on(S),A=new on(A);export{on as D,M as _};
|