diff --git a/assets/index.e937e86f.js b/assets/index.f87ee40e.js similarity index 93% rename from assets/index.e937e86f.js rename to assets/index.f87ee40e.js index 6144120..13d1cf6 100644 --- a/assets/index.e937e86f.js +++ b/assets/index.f87ee40e.js @@ -103,7 +103,7 @@ function print() { __p += __j.call(arguments, '') } * https://github.com/MikeMcl/decimal.js * Copyright (c) 2022 Michael Mclaughlin * MIT Licence - */var Vr=9e15,ur=1e9,Jc="0123456789abcdef",Ts="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Ms="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",ed={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-Vr,maxE:Vr,crypto:!1},ty,mn,ee=!0,yu="[DecimalError] ",rr=yu+"Invalid argument: ",ny=yu+"Precision limit exceeded",ry=yu+"crypto unavailable",iy="[object Decimal]",rt=Math.floor,Ue=Math.pow,XS=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,QS=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,ZS=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,oy=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Kt=1e7,Q=7,JS=9007199254740991,eb=Ts.length-1,td=Ms.length-1,T={toStringTag:iy};T.absoluteValue=T.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),G(e)};T.ceil=function(){return G(new this.constructor(this),this.e+1,2)};T.clampedTo=T.clamp=function(e,t){var n,r=this,i=r.constructor;if(e=new i(e),t=new i(t),!e.s||!t.s)return new i(NaN);if(e.gt(t))throw Error(rr+t);return n=r.cmp(e),n<0?e:r.cmp(t)>0?t:new i(r)};T.comparedTo=T.cmp=function(e){var t,n,r,i,o=this,a=o.d,u=(e=new o.constructor(e)).d,s=o.s,l=e.s;if(!a||!u)return!s||!l?NaN:s!==l?s:a===u?0:!a^s<0?1:-1;if(!a[0]||!u[0])return a[0]?s:u[0]?-l:0;if(s!==l)return s;if(o.e!==e.e)return o.e>e.e^s<0?1:-1;for(r=a.length,i=u.length,t=0,n=ru[t]^s<0?1:-1;return r===i?0:r>i^s<0?1:-1};T.cosine=T.cos=function(){var e,t,n=this,r=n.constructor;return n.d?n.d[0]?(e=r.precision,t=r.rounding,r.precision=e+Math.max(n.e,n.sd())+Q,r.rounding=1,n=tb(r,cy(r,n)),r.precision=e,r.rounding=t,G(mn==2||mn==3?n.neg():n,e,t,!0)):new r(1):new r(NaN)};T.cubeRoot=T.cbrt=function(){var e,t,n,r,i,o,a,u,s,l,d=this,c=d.constructor;if(!d.isFinite()||d.isZero())return new c(d);for(ee=!1,o=d.s*Ue(d.s*d,1/3),!o||Math.abs(o)==1/0?(n=Ke(d.d),e=d.e,(o=(e-n.length+1)%3)&&(n+=o==1||o==-2?"0":"00"),o=Ue(n,1/3),e=rt((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),r=new c(n),r.s=d.s):r=new c(o.toString()),a=(e=c.precision)+3;;)if(u=r,s=u.times(u).times(u),l=s.plus(d),r=pe(l.plus(d).times(u),l.plus(s),a+2,1),Ke(u.d).slice(0,a)===(n=Ke(r.d)).slice(0,a))if(n=n.slice(a-3,a+1),n=="9999"||!i&&n=="4999"){if(!i&&(G(u,e+1,0),u.times(u).times(u).eq(d))){r=u;break}a+=4,i=1}else{(!+n||!+n.slice(1)&&n.charAt(0)=="5")&&(G(r,e+1,1),t=!r.times(r).times(r).eq(d));break}return ee=!0,G(r,e,c.rounding,t)};T.decimalPlaces=T.dp=function(){var e,t=this.d,n=NaN;if(t){if(e=t.length-1,n=(e-rt(this.e/Q))*Q,e=t[e],e)for(;e%10==0;e/=10)n--;n<0&&(n=0)}return n};T.dividedBy=T.div=function(e){return pe(this,new this.constructor(e))};T.dividedToIntegerBy=T.divToInt=function(e){var t=this,n=t.constructor;return G(pe(t,new n(e),0,1,1),n.precision,n.rounding)};T.equals=T.eq=function(e){return this.cmp(e)===0};T.floor=function(){return G(new this.constructor(this),this.e+1,3)};T.greaterThan=T.gt=function(e){return this.cmp(e)>0};T.greaterThanOrEqualTo=T.gte=function(e){var t=this.cmp(e);return t==1||t===0};T.hyperbolicCosine=T.cosh=function(){var e,t,n,r,i,o=this,a=o.constructor,u=new a(1);if(!o.isFinite())return new a(o.s?1/0:NaN);if(o.isZero())return u;n=a.precision,r=a.rounding,a.precision=n+Math.max(o.e,o.sd())+4,a.rounding=1,i=o.d.length,i<32?(e=Math.ceil(i/3),t=(1/Eu(4,e)).toString()):(e=16,t="2.3283064365386962890625e-10"),o=ci(a,1,o.times(t),new a(1),!0);for(var s,l=e,d=new a(8);l--;)s=o.times(o),o=u.minus(s.times(d.minus(s.times(d))));return G(o,a.precision=n,a.rounding=r,!0)};T.hyperbolicSine=T.sinh=function(){var e,t,n,r,i=this,o=i.constructor;if(!i.isFinite()||i.isZero())return new o(i);if(t=o.precision,n=o.rounding,o.precision=t+Math.max(i.e,i.sd())+4,o.rounding=1,r=i.d.length,r<3)i=ci(o,2,i,i,!0);else{e=1.4*Math.sqrt(r),e=e>16?16:e|0,i=i.times(1/Eu(5,e)),i=ci(o,2,i,i,!0);for(var a,u=new o(5),s=new o(16),l=new o(20);e--;)a=i.times(i),i=i.times(u.plus(a.times(s.times(a).plus(l))))}return o.precision=t,o.rounding=n,G(i,t,n,!0)};T.hyperbolicTangent=T.tanh=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+7,r.rounding=1,pe(n.sinh(),n.cosh(),r.precision=e,r.rounding=t)):new r(n.s)};T.inverseCosine=T.acos=function(){var e,t=this,n=t.constructor,r=t.abs().cmp(1),i=n.precision,o=n.rounding;return r!==-1?r===0?t.isNeg()?Wt(n,i,o):new n(0):new n(NaN):t.isZero()?Wt(n,i+4,o).times(.5):(n.precision=i+6,n.rounding=1,t=t.asin(),e=Wt(n,i+4,o).times(.5),n.precision=i,n.rounding=o,e.minus(t))};T.inverseHyperbolicCosine=T.acosh=function(){var e,t,n=this,r=n.constructor;return n.lte(1)?new r(n.eq(1)?0:NaN):n.isFinite()?(e=r.precision,t=r.rounding,r.precision=e+Math.max(Math.abs(n.e),n.sd())+4,r.rounding=1,ee=!1,n=n.times(n).minus(1).sqrt().plus(n),ee=!0,r.precision=e,r.rounding=t,n.ln()):new r(n)};T.inverseHyperbolicSine=T.asinh=function(){var e,t,n=this,r=n.constructor;return!n.isFinite()||n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+2*Math.max(Math.abs(n.e),n.sd())+6,r.rounding=1,ee=!1,n=n.times(n).plus(1).sqrt().plus(n),ee=!0,r.precision=e,r.rounding=t,n.ln())};T.inverseHyperbolicTangent=T.atanh=function(){var e,t,n,r,i=this,o=i.constructor;return i.isFinite()?i.e>=0?new o(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=o.precision,t=o.rounding,r=i.sd(),Math.max(r,e)<2*-i.e-1?G(new o(i),e,t,!0):(o.precision=n=r-i.e,i=pe(i.plus(1),new o(1).minus(i),n+e,1),o.precision=e+4,o.rounding=1,i=i.ln(),o.precision=e,o.rounding=t,i.times(.5))):new o(NaN)};T.inverseSine=T.asin=function(){var e,t,n,r,i=this,o=i.constructor;return i.isZero()?new o(i):(t=i.abs().cmp(1),n=o.precision,r=o.rounding,t!==-1?t===0?(e=Wt(o,n+4,r).times(.5),e.s=i.s,e):new o(NaN):(o.precision=n+6,o.rounding=1,i=i.div(new o(1).minus(i.times(i)).sqrt().plus(1)).atan(),o.precision=n,o.rounding=r,i.times(2)))};T.inverseTangent=T.atan=function(){var e,t,n,r,i,o,a,u,s,l=this,d=l.constructor,c=d.precision,f=d.rounding;if(l.isFinite()){if(l.isZero())return new d(l);if(l.abs().eq(1)&&c+4<=td)return a=Wt(d,c+4,f).times(.25),a.s=l.s,a}else{if(!l.s)return new d(NaN);if(c+4<=td)return a=Wt(d,c+4,f).times(.5),a.s=l.s,a}for(d.precision=u=c+10,d.rounding=1,n=Math.min(28,u/Q+2|0),e=n;e;--e)l=l.div(l.times(l).plus(1).sqrt().plus(1));for(ee=!1,t=Math.ceil(u/Q),r=1,s=l.times(l),a=new d(l),i=l;e!==-1;)if(i=i.times(s),o=a.minus(i.div(r+=2)),i=i.times(s),a=o.plus(i.div(r+=2)),a.d[t]!==void 0)for(e=t;a.d[e]===o.d[e]&&e--;);return n&&(a=a.times(2<this.d.length-2};T.isNaN=function(){return!this.s};T.isNegative=T.isNeg=function(){return this.s<0};T.isPositive=T.isPos=function(){return this.s>0};T.isZero=function(){return!!this.d&&this.d[0]===0};T.lessThan=T.lt=function(e){return this.cmp(e)<0};T.lessThanOrEqualTo=T.lte=function(e){return this.cmp(e)<1};T.logarithm=T.log=function(e){var t,n,r,i,o,a,u,s,l=this,d=l.constructor,c=d.precision,f=d.rounding,p=5;if(e==null)e=new d(10),t=!0;else{if(e=new d(e),n=e.d,e.s<0||!n||!n[0]||e.eq(1))return new d(NaN);t=e.eq(10)}if(n=l.d,l.s<0||!n||!n[0]||l.eq(1))return new d(n&&!n[0]?-1/0:l.s!=1?NaN:n?0:1/0);if(t)if(n.length>1)o=!0;else{for(i=n[0];i%10===0;)i/=10;o=i!==1}if(ee=!1,u=c+p,a=jn(l,u),r=t?Ps(d,u+10):jn(e,u),s=pe(a,r,u,1),Lo(s.d,i=c,f))do if(u+=10,a=jn(l,u),r=t?Ps(d,u+10):jn(e,u),s=pe(a,r,u,1),!o){+Ke(s.d).slice(i+1,i+15)+1==1e14&&(s=G(s,c+1,0));break}while(Lo(s.d,i+=10,f));return ee=!0,G(s,c,f)};T.minus=T.sub=function(e){var t,n,r,i,o,a,u,s,l,d,c,f,p=this,y=p.constructor;if(e=new y(e),!p.d||!e.d)return!p.s||!e.s?e=new y(NaN):p.d?e.s=-e.s:e=new y(e.d||p.s!==e.s?p:NaN),e;if(p.s!=e.s)return e.s=-e.s,p.plus(e);if(l=p.d,f=e.d,u=y.precision,s=y.rounding,!l[0]||!f[0]){if(f[0])e.s=-e.s;else if(l[0])e=new y(p);else return new y(s===3?-0:0);return ee?G(e,u,s):e}if(n=rt(e.e/Q),d=rt(p.e/Q),l=l.slice(),o=d-n,o){for(c=o<0,c?(t=l,o=-o,a=f.length):(t=f,n=d,a=l.length),r=Math.max(Math.ceil(u/Q),a)+2,o>r&&(o=r,t.length=1),t.reverse(),r=o;r--;)t.push(0);t.reverse()}else{for(r=l.length,a=f.length,c=r0;--r)l[a++]=0;for(r=f.length;r>o;){if(l[--r]a?o+1:a+1,i>a&&(i=a,n.length=1),n.reverse();i--;)n.push(0);n.reverse()}for(a=l.length,i=d.length,a-i<0&&(i=a,n=d,d=l,l=n),t=0;i;)t=(l[--i]=l[i]+d[i]+t)/Kt|0,l[i]%=Kt;for(t&&(l.unshift(t),++r),a=l.length;l[--a]==0;)l.pop();return e.d=l,e.e=wu(l,r),ee?G(e,u,s):e};T.precision=T.sd=function(e){var t,n=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(rr+e);return n.d?(t=ay(n.d),e&&n.e+1>t&&(t=n.e+1)):t=NaN,t};T.round=function(){var e=this,t=e.constructor;return G(new t(e),e.e+1,t.rounding)};T.sine=T.sin=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+Math.max(n.e,n.sd())+Q,r.rounding=1,n=rb(r,cy(r,n)),r.precision=e,r.rounding=t,G(mn>2?n.neg():n,e,t,!0)):new r(NaN)};T.squareRoot=T.sqrt=function(){var e,t,n,r,i,o,a=this,u=a.d,s=a.e,l=a.s,d=a.constructor;if(l!==1||!u||!u[0])return new d(!l||l<0&&(!u||u[0])?NaN:u?a:1/0);for(ee=!1,l=Math.sqrt(+a),l==0||l==1/0?(t=Ke(u),(t.length+s)%2==0&&(t+="0"),l=Math.sqrt(t),s=rt((s+1)/2)-(s<0||s%2),l==1/0?t="5e"+s:(t=l.toExponential(),t=t.slice(0,t.indexOf("e")+1)+s),r=new d(t)):r=new d(l.toString()),n=(s=d.precision)+3;;)if(o=r,r=o.plus(pe(a,o,n+2,1)).times(.5),Ke(o.d).slice(0,n)===(t=Ke(r.d)).slice(0,n))if(t=t.slice(n-3,n+1),t=="9999"||!i&&t=="4999"){if(!i&&(G(o,s+1,0),o.times(o).eq(a))){r=o;break}n+=4,i=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(G(r,s+1,1),e=!r.times(r).eq(a));break}return ee=!0,G(r,s,d.rounding,e)};T.tangent=T.tan=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+10,r.rounding=1,n=n.sin(),n.s=1,n=pe(n,new r(1).minus(n.times(n)).sqrt(),e+10,0),r.precision=e,r.rounding=t,G(mn==2||mn==4?n.neg():n,e,t,!0)):new r(NaN)};T.times=T.mul=function(e){var t,n,r,i,o,a,u,s,l,d=this,c=d.constructor,f=d.d,p=(e=new c(e)).d;if(e.s*=d.s,!f||!f[0]||!p||!p[0])return new c(!e.s||f&&!f[0]&&!p||p&&!p[0]&&!f?NaN:!f||!p?e.s/0:e.s*0);for(n=rt(d.e/Q)+rt(e.e/Q),s=f.length,l=p.length,s=0;){for(t=0,i=s+r;i>r;)u=o[i]+p[r]*f[i-r-1]+t,o[i--]=u%Kt|0,t=u/Kt|0;o[i]=(o[i]+t)%Kt|0}for(;!o[--a];)o.pop();return t?++n:o.shift(),e.d=o,e.e=wu(o,n),ee?G(e,c.precision,c.rounding):e};T.toBinary=function(e,t){return Kf(this,2,e,t)};T.toDecimalPlaces=T.toDP=function(e,t){var n=this,r=n.constructor;return n=new r(n),e===void 0?n:(vt(e,0,ur),t===void 0?t=r.rounding:vt(t,0,8),G(n,e+n.e+1,t))};T.toExponential=function(e,t){var n,r=this,i=r.constructor;return e===void 0?n=ln(r,!0):(vt(e,0,ur),t===void 0?t=i.rounding:vt(t,0,8),r=G(new i(r),e+1,t),n=ln(r,!0,e+1)),r.isNeg()&&!r.isZero()?"-"+n:n};T.toFixed=function(e,t){var n,r,i=this,o=i.constructor;return e===void 0?n=ln(i):(vt(e,0,ur),t===void 0?t=o.rounding:vt(t,0,8),r=G(new o(i),e+i.e+1,t),n=ln(r,!1,e+r.e+1)),i.isNeg()&&!i.isZero()?"-"+n:n};T.toFraction=function(e){var t,n,r,i,o,a,u,s,l,d,c,f,p=this,y=p.d,m=p.constructor;if(!y)return new m(p);if(l=n=new m(1),r=s=new m(0),t=new m(r),o=t.e=ay(y)-p.e-1,a=o%Q,t.d[0]=Ue(10,a<0?Q+a:a),e==null)e=o>0?t:l;else{if(u=new m(e),!u.isInt()||u.lt(l))throw Error(rr+u);e=u.gt(t)?o>0?t:l:u}for(ee=!1,u=new m(Ke(y)),d=m.precision,m.precision=o=y.length*Q*2;c=pe(u,t,0,1,1),i=n.plus(c.times(r)),i.cmp(e)!=1;)n=r,r=i,i=l,l=s.plus(c.times(i)),s=i,i=t,t=u.minus(c.times(i)),u=i;return i=pe(e.minus(n),r,0,1,1),s=s.plus(i.times(l)),n=n.plus(i.times(r)),s.s=l.s=p.s,f=pe(l,r,o,1).minus(p).abs().cmp(pe(s,n,o,1).minus(p).abs())<1?[l,r]:[s,n],m.precision=d,ee=!0,f};T.toHexadecimal=T.toHex=function(e,t){return Kf(this,16,e,t)};T.toNearest=function(e,t){var n=this,r=n.constructor;if(n=new r(n),e==null){if(!n.d)return n;e=new r(1),t=r.rounding}else{if(e=new r(e),t===void 0?t=r.rounding:vt(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]?(ee=!1,n=pe(n,e,0,t,1).times(e),ee=!0,G(n)):(e.s=n.s,n=e),n};T.toNumber=function(){return+this};T.toOctal=function(e,t){return Kf(this,8,e,t)};T.toPower=T.pow=function(e){var t,n,r,i,o,a,u=this,s=u.constructor,l=+(e=new s(e));if(!u.d||!e.d||!u.d[0]||!e.d[0])return new s(Ue(+u,l));if(u=new s(u),u.eq(1))return u;if(r=s.precision,o=s.rounding,e.eq(1))return G(u,r,o);if(t=rt(e.e/Q),t>=e.d.length-1&&(n=l<0?-l:l)<=JS)return i=sy(s,u,n,r),e.s<0?new s(1).div(i):G(i,r,o);if(a=u.s,a<0){if(ts.maxE+1||t0?a/0:0):(ee=!1,s.rounding=u.s=1,n=Math.min(12,(t+"").length),i=nd(e.times(jn(u,r+n)),r),i.d&&(i=G(i,r+5,1),Lo(i.d,r,o)&&(t=r+10,i=G(nd(e.times(jn(u,t+n)),t),t+5,1),+Ke(i.d).slice(r+1,r+15)+1==1e14&&(i=G(i,r+1,0)))),i.s=a,ee=!0,s.rounding=o,G(i,r,o))};T.toPrecision=function(e,t){var n,r=this,i=r.constructor;return e===void 0?n=ln(r,r.e<=i.toExpNeg||r.e>=i.toExpPos):(vt(e,1,ur),t===void 0?t=i.rounding:vt(t,0,8),r=G(new i(r),e,t),n=ln(r,e<=r.e||r.e<=i.toExpNeg,e)),r.isNeg()&&!r.isZero()?"-"+n:n};T.toSignificantDigits=T.toSD=function(e,t){var n=this,r=n.constructor;return e===void 0?(e=r.precision,t=r.rounding):(vt(e,1,ur),t===void 0?t=r.rounding:vt(t,0,8)),G(new r(n),e,t)};T.toString=function(){var e=this,t=e.constructor,n=ln(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?"-"+n:n};T.truncated=T.trunc=function(){return G(new this.constructor(this),this.e+1,1)};T.valueOf=T.toJSON=function(){var e=this,t=e.constructor,n=ln(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?"-"+n:n};function Ke(e){var t,n,r,i=e.length-1,o="",a=e[0];if(i>0){for(o+=a,t=1;tn)throw Error(rr+e)}function Lo(e,t,n,r){var i,o,a,u;for(o=e[0];o>=10;o/=10)--t;return--t<0?(t+=Q,i=0):(i=Math.ceil((t+1)/Q),t%=Q),o=Ue(10,Q-t),u=e[i]%o|0,r==null?t<3?(t==0?u=u/100|0:t==1&&(u=u/10|0),a=n<4&&u==99999||n>3&&u==49999||u==5e4||u==0):a=(n<4&&u+1==o||n>3&&u+1==o/2)&&(e[i+1]/o/100|0)==Ue(10,t-2)-1||(u==o/2||u==0)&&(e[i+1]/o/100|0)==0:t<4?(t==0?u=u/1e3|0:t==1?u=u/100|0:t==2&&(u=u/10|0),a=(r||n<4)&&u==9999||!r&&n>3&&u==4999):a=((r||n<4)&&u+1==o||!r&&n>3&&u+1==o/2)&&(e[i+1]/o/1e3|0)==Ue(10,t-3)-1,a}function Ga(e,t,n){for(var r,i=[0],o,a=0,u=e.length;an-1&&(i[r+1]===void 0&&(i[r+1]=0),i[r+1]+=i[r]/n|0,i[r]%=n)}return i.reverse()}function tb(e,t){var n,r,i;if(t.isZero())return t;r=t.d.length,r<32?(n=Math.ceil(r/3),i=(1/Eu(4,n)).toString()):(n=16,i="2.3283064365386962890625e-10"),e.precision+=n,t=ci(e,1,t.times(i),new e(1));for(var o=n;o--;){var a=t.times(t);t=a.times(a).minus(a).times(8).plus(1)}return e.precision-=n,t}var pe=function(){function e(r,i,o){var a,u=0,s=r.length;for(r=r.slice();s--;)a=r[s]*i+u,r[s]=a%o|0,u=a/o|0;return u&&r.unshift(u),r}function t(r,i,o,a){var u,s;if(o!=a)s=o>a?1:-1;else for(u=s=0;ui[u]?1:-1;break}return s}function n(r,i,o,a){for(var u=0;o--;)r[o]-=u,u=r[o]1;)r.shift()}return function(r,i,o,a,u,s){var l,d,c,f,p,y,m,E,h,g,w,x,b,F,k,A,M,I,U,H,Z=r.constructor,j=r.s==i.s?1:-1,O=r.d,$=i.d;if(!O||!O[0]||!$||!$[0])return new Z(!r.s||!i.s||(O?$&&O[0]==$[0]:!$)?NaN:O&&O[0]==0||!$?j*0:j/0);for(s?(p=1,d=r.e-i.e):(s=Kt,p=Q,d=rt(r.e/p)-rt(i.e/p)),U=$.length,M=O.length,h=new Z(j),g=h.d=[],c=0;$[c]==(O[c]||0);c++);if($[c]>(O[c]||0)&&d--,o==null?(F=o=Z.precision,a=Z.rounding):u?F=o+(r.e-i.e)+1:F=o,F<0)g.push(1),y=!0;else{if(F=F/p+2|0,c=0,U==1){for(f=0,$=$[0],F++;(c1&&($=e($,f,s),O=e(O,f,s),U=$.length,M=O.length),A=U,w=O.slice(0,U),x=w.length;x=s/2&&++I;do f=0,l=t($,w,U,x),l<0?(b=w[0],U!=x&&(b=b*s+(w[1]||0)),f=b/I|0,f>1?(f>=s&&(f=s-1),m=e($,f,s),E=m.length,x=w.length,l=t(m,w,E,x),l==1&&(f--,n(m,U=10;f/=10)c++;h.e=c+d*p-1,G(h,u?o+h.e+1:o,a,y)}return h}}();function G(e,t,n,r){var i,o,a,u,s,l,d,c,f,p=e.constructor;e:if(t!=null){if(c=e.d,!c)return e;for(i=1,u=c[0];u>=10;u/=10)i++;if(o=t-i,o<0)o+=Q,a=t,d=c[f=0],s=d/Ue(10,i-a-1)%10|0;else if(f=Math.ceil((o+1)/Q),u=c.length,f>=u)if(r){for(;u++<=f;)c.push(0);d=s=0,i=1,o%=Q,a=o-Q+1}else break e;else{for(d=u=c[f],i=1;u>=10;u/=10)i++;o%=Q,a=o-Q+i,s=a<0?0:d/Ue(10,i-a-1)%10|0}if(r=r||t<0||c[f+1]!==void 0||(a<0?d:d%Ue(10,i-a-1)),l=n<4?(s||r)&&(n==0||n==(e.s<0?3:2)):s>5||s==5&&(n==4||r||n==6&&(o>0?a>0?d/Ue(10,i-a):0:c[f-1])%10&1||n==(e.s<0?8:7)),t<1||!c[0])return c.length=0,l?(t-=e.e+1,c[0]=Ue(10,(Q-t%Q)%Q),e.e=-t||0):c[0]=e.e=0,e;if(o==0?(c.length=f,u=1,f--):(c.length=f+1,u=Ue(10,Q-o),c[f]=a>0?(d/Ue(10,i-a)%Ue(10,a)|0)*u:0),l)for(;;)if(f==0){for(o=1,a=c[0];a>=10;a/=10)o++;for(a=c[0]+=u,u=1;a>=10;a/=10)u++;o!=u&&(e.e++,c[0]==Kt&&(c[0]=1));break}else{if(c[f]+=u,c[f]!=Kt)break;c[f--]=0,u=1}for(o=c.length;c[--o]===0;)c.pop()}return ee&&(e.e>p.maxE?(e.d=null,e.e=NaN):e.e0?o=o.charAt(0)+"."+o.slice(1)+Mn(r):a>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(e.e<0?"e":"e+")+e.e):i<0?(o="0."+Mn(-i-1)+o,n&&(r=n-a)>0&&(o+=Mn(r))):i>=a?(o+=Mn(i+1-a),n&&(r=n-i-1)>0&&(o=o+"."+Mn(r))):((r=i+1)0&&(i+1===a&&(o+="."),o+=Mn(r))),o}function wu(e,t){var n=e[0];for(t*=Q;n>=10;n/=10)t++;return t}function Ps(e,t,n){if(t>eb)throw ee=!0,n&&(e.precision=n),Error(ny);return G(new e(Ts),t,1,!0)}function Wt(e,t,n){if(t>td)throw Error(ny);return G(new e(Ms),t,n,!0)}function ay(e){var t=e.length-1,n=t*Q+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 Mn(e){for(var t="";e--;)t+="0";return t}function sy(e,t,n,r){var i,o=new e(1),a=Math.ceil(r/Q+4);for(ee=!1;;){if(n%2&&(o=o.times(t),Tm(o.d,a)&&(i=!0)),n=rt(n/2),n===0){n=o.d.length-1,i&&o.d[n]===0&&++o.d[n];break}t=t.times(t),Tm(t.d,a)}return ee=!0,o}function Im(e){return e.d[e.d.length-1]&1}function uy(e,t,n){for(var r,i=new e(t[0]),o=0;++o17)return new f(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:0/0);for(t==null?(ee=!1,s=y):s=t,u=new f(.03125);e.e>-2;)e=e.times(u),c+=5;for(r=Math.log(Ue(2,c))/Math.LN10*2+5|0,s+=r,n=o=a=new f(1),f.precision=s;;){if(o=G(o.times(e),s,1),n=n.times(++d),u=a.plus(pe(o,n,s,1)),Ke(u.d).slice(0,s)===Ke(a.d).slice(0,s)){for(i=c;i--;)a=G(a.times(a),s,1);if(t==null)if(l<3&&Lo(a.d,s-r,p,l))f.precision=s+=10,n=o=u=new f(1),d=0,l++;else return G(a,f.precision=y,p,ee=!0);else return f.precision=y,a}a=u}}function jn(e,t){var n,r,i,o,a,u,s,l,d,c,f,p=1,y=10,m=e,E=m.d,h=m.constructor,g=h.rounding,w=h.precision;if(m.s<0||!E||!E[0]||!m.e&&E[0]==1&&E.length==1)return new h(E&&!E[0]?-1/0:m.s!=1?NaN:E?0:m);if(t==null?(ee=!1,d=w):d=t,h.precision=d+=y,n=Ke(E),r=n.charAt(0),Math.abs(o=m.e)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)m=m.times(e),n=Ke(m.d),r=n.charAt(0),p++;o=m.e,r>1?(m=new h("0."+n),o++):m=new h(r+"."+n.slice(1))}else return l=Ps(h,d+2,w).times(o+""),m=jn(new h(r+"."+n.slice(1)),d-y).plus(l),h.precision=w,t==null?G(m,w,g,ee=!0):m;for(c=m,s=a=m=pe(m.minus(1),m.plus(1),d,1),f=G(m.times(m),d,1),i=3;;){if(a=G(a.times(f),d,1),l=s.plus(pe(a,new h(i),d,1)),Ke(l.d).slice(0,d)===Ke(s.d).slice(0,d))if(s=s.times(2),o!==0&&(s=s.plus(Ps(h,d+2,w).times(o+""))),s=pe(s,new h(p),d,1),t==null)if(Lo(s.d,d-y,g,u))h.precision=d+=y,l=a=m=pe(c.minus(1),c.plus(1),d,1),f=G(m.times(m),d,1),i=u=1;else return G(s,h.precision=w,g,ee=!0);else return h.precision=w,s;s=l,i+=2}}function ly(e){return String(e.s*e.s/0)}function rd(e,t){var n,r,i;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;t.charCodeAt(r)===48;r++);for(i=t.length;t.charCodeAt(i-1)===48;--i);if(t=t.slice(r,i),t){if(i-=r,e.e=n=n-r-1,e.d=[],r=(n+1)%Q,n<0&&(r+=Q),re.constructor.maxE?(e.d=null,e.e=NaN):e.e-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),oy.test(t))return rd(e,t)}else if(t==="Infinity"||t==="NaN")return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(QS.test(t))n=16,t=t.toLowerCase();else if(XS.test(t))n=2;else if(ZS.test(t))n=8;else throw Error(rr+t);for(o=t.search(/p/i),o>0?(s=+t.slice(o+1),t=t.substring(2,o)):t=t.slice(2),o=t.indexOf("."),a=o>=0,r=e.constructor,a&&(t=t.replace(".",""),u=t.length,o=u-o,i=sy(r,new r(n),o,o*2)),l=Ga(t,n,Kt),d=l.length-1,o=d;l[o]===0;--o)l.pop();return o<0?new r(e.s*0):(e.e=wu(l,d),e.d=l,ee=!1,a&&(e=pe(e,i,u*4)),s&&(e=e.times(Math.abs(s)<54?Ue(2,s):yt.pow(2,s))),ee=!0,e)}function rb(e,t){var n,r=t.d.length;if(r<3)return t.isZero()?t:ci(e,2,t,t);n=1.4*Math.sqrt(r),n=n>16?16:n|0,t=t.times(1/Eu(5,n)),t=ci(e,2,t,t);for(var i,o=new e(5),a=new e(16),u=new e(20);n--;)i=t.times(t),t=t.times(o.plus(i.times(a.times(i).minus(u))));return t}function ci(e,t,n,r,i){var o,a,u,s,l=e.precision,d=Math.ceil(l/Q);for(ee=!1,s=n.times(n),u=new e(r);;){if(a=pe(u.times(s),new e(t++*t++),l,1),u=i?r.plus(a):r.minus(a),r=pe(a.times(s),new e(t++*t++),l,1),a=u.plus(r),a.d[d]!==void 0){for(o=d;a.d[o]===u.d[o]&&o--;);if(o==-1)break}o=u,u=r,r=a,a=o}return ee=!0,a.d.length=d+1,a}function Eu(e,t){for(var n=e;--t;)n*=e;return n}function cy(e,t){var n,r=t.s<0,i=Wt(e,e.precision,1),o=i.times(.5);if(t=t.abs(),t.lte(o))return mn=r?4:1,t;if(n=t.divToInt(i),n.isZero())mn=r?3:2;else{if(t=t.minus(n.times(i)),t.lte(o))return mn=Im(n)?r?2:3:r?4:1,t;mn=Im(n)?r?1:4:r?3:2}return t.minus(i).abs()}function Kf(e,t,n,r){var i,o,a,u,s,l,d,c,f,p=e.constructor,y=n!==void 0;if(y?(vt(n,1,ur),r===void 0?r=p.rounding:vt(r,0,8)):(n=p.precision,r=p.rounding),!e.isFinite())d=ly(e);else{for(d=ln(e),a=d.indexOf("."),y?(i=2,t==16?n=n*4-3:t==8&&(n=n*3-2)):i=t,a>=0&&(d=d.replace(".",""),f=new p(1),f.e=d.length-a,f.d=Ga(ln(f),10,i),f.e=f.d.length),c=Ga(d,10,i),o=s=c.length;c[--s]==0;)c.pop();if(!c[0])d=y?"0p+0":"0";else{if(a<0?o--:(e=new p(e),e.d=c,e.e=o,e=pe(e,f,n,r,0,i),c=e.d,o=e.e,l=ty),a=c[n],u=i/2,l=l||c[n+1]!==void 0,l=r<4?(a!==void 0||l)&&(r===0||r===(e.s<0?3:2)):a>u||a===u&&(r===4||l||r===6&&c[n-1]&1||r===(e.s<0?8:7)),c.length=n,l)for(;++c[--n]>i-1;)c[n]=0,n||(++o,c.unshift(1));for(s=c.length;!c[s-1];--s);for(a=0,d="";a1)if(t==16||t==8){for(a=t==16?4:3,--s;s%a;s++)d+="0";for(c=Ga(d,i,t),s=c.length;!c[s-1];--s);for(a=1,d="1.";as)for(o-=s;o--;)d+="0";else ot)return e.length=t,!0}function ib(e){return new this(e).abs()}function ob(e){return new this(e).acos()}function ab(e){return new this(e).acosh()}function sb(e,t){return new this(e).plus(t)}function ub(e){return new this(e).asin()}function lb(e){return new this(e).asinh()}function cb(e){return new this(e).atan()}function db(e){return new this(e).atanh()}function fb(e,t){e=new this(e),t=new this(t);var n,r=this.precision,i=this.rounding,o=r+4;return!e.s||!t.s?n=new this(NaN):!e.d&&!t.d?(n=Wt(this,o,1).times(t.s>0?.25:.75),n.s=e.s):!t.d||e.isZero()?(n=t.s<0?Wt(this,r,i):new this(0),n.s=e.s):!e.d||t.isZero()?(n=Wt(this,o,1).times(.5),n.s=e.s):t.s<0?(this.precision=o,this.rounding=1,n=this.atan(pe(e,t,o,1)),t=Wt(this,o,1),this.precision=r,this.rounding=i,n=e.s<0?n.minus(t):n.plus(t)):n=this.atan(pe(e,t,o,1)),n}function pb(e){return new this(e).cbrt()}function hb(e){return G(e=new this(e),e.e+1,2)}function mb(e,t,n){return new this(e).clamp(t,n)}function gb(e){if(!e||typeof e!="object")throw Error(yu+"Object expected");var t,n,r,i=e.defaults===!0,o=["precision",1,ur,"rounding",0,8,"toExpNeg",-Vr,0,"toExpPos",0,Vr,"maxE",0,Vr,"minE",-Vr,0,"modulo",0,9];for(t=0;t=o[t+1]&&r<=o[t+2])this[n]=r;else throw Error(rr+n+": "+r);if(n="crypto",i&&(this[n]=ed[n]),(r=e[n])!==void 0)if(r===!0||r===!1||r===0||r===1)if(r)if(typeof crypto!="undefined"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[n]=!0;else throw Error(ry);else this[n]=!1;else throw Error(rr+n+": "+r);return this}function vb(e){return new this(e).cos()}function yb(e){return new this(e).cosh()}function dy(e){var t,n,r;function i(o){var a,u,s,l=this;if(!(l instanceof i))return new i(o);if(l.constructor=i,Mm(o)){l.s=o.s,ee?!o.d||o.e>i.maxE?(l.e=NaN,l.d=null):o.e=10;u/=10)a++;ee?a>i.maxE?(l.e=NaN,l.d=null):a=429e7?t[o]=crypto.getRandomValues(new Uint32Array(1))[0]:u[o++]=i%1e7;else if(crypto.randomBytes){for(t=crypto.randomBytes(r*=4);o=214e7?crypto.randomBytes(4).copy(t,o):(u.push(i%1e7),o+=4);o=r/4}else throw Error(ry);else for(;o=10;i/=10)r++;rt in e?Hb(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ie=(e,t,n)=>(Vb(e,typeof t!="symbol"?t+"":t,n),n);yt.set({precision:80});var ao=(e=18)=>{let t=e;return(typeof e!="number"||e<=0)&&(t=18),yt.pow(10,t)},Yf=e=>typeof e=="bigint",z=class{constructor(e){S(this,"value");S(this,"equals",e=>{const t=new z(e);return this.value.eq(t.value)});S(this,"lessThan",e=>{const t=new z(e);return this.value.lessThan(t.value)});S(this,"greaterThan",e=>{const t=new z(e);return this.value.greaterThan(t.value)});S(this,"lessThanOrEqualTo",e=>{const t=new z(e);return this.value.lessThanOrEqualTo(t.value)});S(this,"greaterThanOrEqualTo",e=>{const t=new z(e);return this.value.greaterThanOrEqualTo(t.value)});S(this,"add",e=>{const t=new z(e);return new z(this.value.add(t.value))});S(this,"sub",e=>{const t=new z(e);return new z(this.value.sub(t.value))});S(this,"mul",e=>{const t=new z(e);return new z(this.value.mul(t.value))});S(this,"div",e=>{const t=new z(e);return new z(this.value.div(t.value))});S(this,"pow",e=>{const t=new z(e);return new z(this.value.pow(t.value))});S(this,"log",e=>{const t=new z(e);return new z(this.value.log(t.value))});S(this,"sqrt",()=>new z(this.value.sqrt()));S(this,"mod",e=>{const t=new z(e);return new z(this.value.mod(t.value))});S(this,"equalsWith",e=>{const t=new z(e);return this.value.eq(t.value)});S(this,"isNaN",()=>this.value.isNaN());S(this,"isFinite",()=>this.value.isFinite());S(this,"toDecimalStandardUnit",(e,t=18)=>{if(typeof e=="number"&&e>=0){const n=this.value.div(ao(t)).toFixed();if(n==="NaN"||n.indexOf("Infinity")!==-1||n.indexOf("e")!==-1)return n;const r=n.indexOf(".");return e===0?n.slice(0,r):r===-1?n+"."+"0".repeat(e):n.length-r-1this.value.div(ao(e)).toHex());S(this,"toDecimalMinUnit",e=>{if(typeof e=="number"&&e>=0){const t=this.value.toFixed();if(t==="NaN"||t.indexOf("Infinity")!==-1||t.indexOf("e")!==-1)return t;const n=t.indexOf(".");return e===0?n===-1?t:t.slice(0,n):n===-1?t+"."+"0".repeat(e):t.length-n-1this.value.toHex());S(this,"toString",()=>this.toDecimalStandardUnit());S(this,"toDecimal",()=>this.value);z.isUnit(e)?this.value=e.value:yt.isDecimal(e)?this.value=e:this.value=new yt(Yf(e)?e.toString():e)}[Symbol.toPrimitive](e){return e=="string"?this.toDecimalStandardUnit():this.value}},ke=z;Ie(ke,"isUnit",e=>e instanceof z);Ie(ke,"fromStandardUnit",(e,t=18)=>yt.isDecimal(e)||z.isUnit(e)?new z(e.mul(ao(t))):new z(new yt(Yf(e)?e.toString():e).mul(ao(t))));Ie(ke,"fromMinUnit",e=>yt.isDecimal(e)||z.isUnit(e)?new z(e):new z(new yt(Yf(e)?e.toString():e)));Ie(ke,"fromDecimal",e=>z.fromMinUnit(e));Ie(ke,"equals",(e,t)=>{const n=new z(e),r=new z(t);return n.value.eq(r.value)});Ie(ke,"min",(e,t)=>{const n=new z(e),r=new z(t);return n.greaterThan(r)?r:n});Ie(ke,"max",(e,t)=>{const n=new z(e),r=new z(t);return n.greaterThan(r)?n:r});Ie(ke,"clamp",(e,t,n)=>{const r=new z(e),i=new z(t),o=new z(n);return r.greaterThan(o)?o:r.lessThan(i)?i:r});Ie(ke,"lessThan",(e,t)=>{const n=new z(e),r=new z(t);return n.value.lessThan(r.value)});Ie(ke,"greaterThan",(e,t)=>{const n=new z(e),r=new z(t);return n.value.greaterThan(r.value)});Ie(ke,"lessThanOrEqualTo",(e,t)=>{const n=new z(e),r=new z(t);return n.value.lessThanOrEqualTo(r.value)});Ie(ke,"greaterThanOrEqualTo",(e,t)=>{const n=new z(e),r=new z(t);return n.value.greaterThanOrEqualTo(r.value)});Ie(ke,"add",(e,t)=>{const n=new z(e),r=new z(t);return new z(n.value.add(r.value))});Ie(ke,"sub",(e,t)=>{const n=new z(e),r=new z(t);return new z(n.value.sub(r.value))});Ie(ke,"mul",(e,t)=>{const n=new z(e),r=new z(t);return new z(n.value.mul(r.value))});Ie(ke,"div",(e,t)=>{const n=new z(e),r=new z(t);return new z(n.value.div(r.value))});Ie(ke,"pow",(e,t)=>{const n=new z(e),r=new z(t);return new z(n.value.pow(r.value))});Ie(ke,"log",(e,t)=>{const n=new z(e),r=new z(t);return new z(n.value.log(r.value))});Ie(ke,"sqrt",e=>{const t=new z(e);return new z(t.value.sqrt())});Ie(ke,"mod",(e,t)=>{const n=new z(e),r=new z(t);return new z(n.value.mod(r.value))});Ie(ke,"isNaN",e=>typeof e!="object"?Number.isNaN(Number(e)):yt.isDecimal(e)||z.isUnit(e)?e.isNaN():!1);Ie(ke,"isFinite",e=>typeof e!="object"?Number.isFinite(Number(e)):yt.isDecimal(e)||z.isUnit(e)?e.isFinite():!1);var fy=ke;function Wb(e){return{all:e=e||new Map,on:function(t,n){var r=e.get(t);r?r.push(n):e.set(t,[n])},off:function(t,n){var r=e.get(t);r&&(n?r.splice(r.indexOf(n)>>>0,1):e.set(t,[]))},emit:function(t,n){var r=e.get(t);r&&r.slice().map(function(i){i(n)}),(r=e.get("*"))&&r.slice().map(function(i){i(t,n)})}}}var qb=class{constructor(e){S(this,"emitter",Wb());S(this,"state",{status:"in-detecting",accounts:void 0,chainId:void 0,balance:void 0});S(this,"trackBalanceInterval");S(this,"detectTimer");S(this,"trackBalanceChangeOnceCallback",[]);S(this,"RPCMethod");S(this,"provider");S(this,"resolveDetect");S(this,"detectPromise",new Promise(e=>this.resolveDetect=()=>{this.detectTimer&&clearTimeout(this.detectTimer),e()}));S(this,"handleStateChange",(e,t)=>{const n=this.state[e];let r=!1;switch(e){case"accounts":r=(n==null?void 0:n[0])!==(t==null?void 0:t[0]);break;case"balance":t!==void 0&&n!==void 0?r=!n.equalsWith(t):r=n!==t;break;default:r=n!==t}r&&(Object.assign(this.state,{[e]:t}),this.emitter.emit(e,t),e==="balance"&&this.trackBalanceChangeOnceCallback.length&&(this.trackBalanceChangeOnceCallback.forEach(i=>i()),this.trackBalanceChangeOnceCallback=[]))});S(this,"handleStatusChanged",e=>this.handleStateChange("status",e));S(this,"handleAccountsChanged",e=>{!!(e!=null&&e[0])?this.handleStatusChanged("active"):this.handleStatusChanged("not-active"),this.handleStateChange("accounts",e)});S(this,"handleChainChanged",e=>{if(!e||e==="0xNaN"){this.handleStateChange("chainId",void 0),this.handleAccountsChanged(void 0);return}this.handleStateChange("chainId",String(parseInt(e)))});S(this,"handleBalanceChanged",e=>{if(typeof e!="string"&&typeof e!="number"){this.handleStateChange("balance",void 0);return}this.handleStateChange("balance",fy.fromMinUnit(e))});S(this,"batchGetInfo",async({isRequestConnect:e}={isRequestConnect:!1})=>{try{const[t,n]=await Promise.all([this.RPCMethod.getChainId(),e?this.RPCMethod.requestAccounts():this.RPCMethod.getAccounts()]);this.RPCMethod.setAccounts(n);let r=setTimeout(()=>{this.handleChainChanged(t),this.handleAccountsChanged(n),this.handleBalanceChanged(void 0),this.resolveDetect(),r=void 0},1250);try{const i=await this.RPCMethod.getBalance();r!==void 0&&(clearTimeout(r),this.handleChainChanged(t),this.handleAccountsChanged(n)),this.handleBalanceChanged(i)}catch{r!==void 0&&(clearTimeout(r),this.handleChainChanged(t),this.handleAccountsChanged(n),this.handleBalanceChanged(void 0))}return n}catch(t){throw t}finally{this.resolveDetect()}});S(this,"checkConnected",e=>{var n;const t=(n=this.state.accounts)==null?void 0:n[0];if(!t)throw new Error(`${e} error: request connect to wallet.`);return t});S(this,"on",this.emitter.on);S(this,"off",this.emitter.off);S(this,"clear",this.emitter.all.clear);S(this,"completeDetect",()=>this.detectPromise);S(this,"startTrackBalance",(e=1500)=>{this.stopTrackBalance();const t=()=>{var i;const n=(i=this.state.accounts)==null?void 0:i[0],r=this.state.chainId;!r||r==="9007199254740991"||!n||this.RPCMethod.getBalance().then(o=>this.handleBalanceChanged(o))};t(),this.trackBalanceInterval=setInterval(t,e)});S(this,"stopTrackBalance",()=>{this.trackBalanceInterval!==void 0&&(clearInterval(this.trackBalanceInterval),this.trackBalanceInterval=void 0)});S(this,"trackBalanceChangeOnce",e=>{typeof e=="function"&&this.trackBalanceChangeOnceCallback.push(e)});S(this,"connect",async()=>{const e=this.state.status;if(e!=="not-active"){if(e==="active")return Promise.resolve(this.state.accounts);throw new Error(`Current status ${e} is not allowed to connect.`)}this.handleStatusChanged("in-activating");const t=this.batchGetInfo({isRequestConnect:!0});return t.catch(()=>this.handleStatusChanged("not-active")),t});S(this,"sendTransaction",e=>{if(!this.RPCMethod.sendTransaction)throw new Error("Current Wallet does'nt have sendTransaction method.");const t=this.checkConnected("sendTransaction");return this.RPCMethod.sendTransaction({...e,from:t,...e.value?{}:{value:"0x0"}})});S(this,"personalSign",e=>{if(!this.RPCMethod.personalSign)throw new Error("Current Wallet does'nt have personalSign method.");return this.checkConnected("personalSign"),this.RPCMethod.personalSign(e)});S(this,"typedSign",e=>{if(!this.RPCMethod.typedSign)throw new Error("Current Wallet does'nt have typedSign method.");return this.checkConnected("typedSign"),this.RPCMethod.typedSign(e)});S(this,"addChain",(e,t=!0)=>{if(!this.RPCMethod.addChain)throw new Error("Current Wallet does'nt have addChain method.");return t&&this.checkConnected("addChain"),this.RPCMethod.addChain(e)});S(this,"switchChain",e=>{if(!this.RPCMethod.switchChain)throw new Error("Current Wallet does'nt have switchChain method.");return this.checkConnected("switchChain"),this.RPCMethod.switchChain(e)});S(this,"watchAsset",e=>{if(!this.RPCMethod.watchAsset)throw new Error("Current Wallet does'nt have watchAsset method.");return this.checkConnected("watchAsset"),this.RPCMethod.watchAsset(e)});S(this,"requestPermissions",e=>{if(!this.RPCMethod.requestPermissions)throw new Error("Current Wallet does'nt have requestPermissions method.");return this.RPCMethod.requestPermissions(e)});S(this,"requestCrossNetworkPermission",()=>{if(!this.RPCMethod.requestCrossNetworkPermission)throw new Error("Current Wallet does'nt have requestCrossNetworkPermission method.");return this.RPCMethod.requestCrossNetworkPermission()});S(this,"setCrossNetworkChain",e=>{typeof e!="string"&&e!==void 0||(this.RPCMethod.crossNetworkChain=e,this.RPCMethod.getAccounts().then(t=>{this.RPCMethod.setAccounts(t),this.handleAccountsChanged(t)}))});this.RPCMethod=e,this.RPCMethod.detectAndSetProvider().then(t=>{this.batchGetInfo(),this.RPCMethod.onChainIdChange(()=>this.batchGetInfo()),this.RPCMethod.onAccountsChange(()=>this.batchGetInfo()),this.provider=t}).catch(()=>{this.handleStatusChanged("not-installed"),this.resolveDetect()}),this.detectTimer=setTimeout(()=>{if(console.error(`Unable to detect ${this.RPCMethod.sessionKey?"window."+this.RPCMethod.sessionKey.split("-")[0]:"wallet"}.`),this.RPCMethod.sessionKey){const t=Number(sessionStorage.getItem(this.RPCMethod.sessionKey)||0);if(t>=this.RPCMethod.retryLimit)throw new Error(`Unable to detect ${this.RPCMethod.sessionKey?"window."+this.RPCMethod.sessionKey.split("-")[0]:"wallet"}.`);sessionStorage.setItem(this.RPCMethod.sessionKey,String(t+1))}window.location.reload()},this.RPCMethod.detectTimeout)}},Cu=qb,Gb=class{constructor(){S(this,"account");S(this,"crossNetworkChain");S(this,"sessionKey");S(this,"retryLimit",2);S(this,"detectTimeout",1500);S(this,"detectAndSetProvider",()=>{const e=this.detectProvider();return e.then(t=>this.provider=t).catch(t=>console.warn(t)),e});S(this,"setAccounts",e=>{this.account=e==null?void 0:e[0]});S(this,"getProvider",()=>this.provider)}},Xf=Gb;function xu({silent:e=!1,interval:t=10,timeout:n=100,walletFlag:r,isSingleWalletFlag:i,injectFlag:o="ethereum",defaultWaltFlag:a}){return new Promise((u,s)=>{async function l(){let d=await Kb(o,t,n);if(!d)return s(`Unable to detect window.${o}.`);let c=!1,f=!1;const p=d.providers;if(p!=null&&p.length?typeof r!="string"||!r?a?d=p.find(y=>Il(y,a,i)):d=p[0]:d=p.find(y=>Il(y,r,i)):(c=typeof r=="string"&&!!r,f=c&&Il(d,r,i)),d&&!c||f)u(d);else{const y=`Non-${r} Wallet detected.`;!e&&console.error("detect-provider:",y),s(y)}}l()})}function Il(e,t,n=!1){const r=e?Object.keys(e).filter(i=>i==null?void 0:i.startsWith("is")):[];return!!e&&(n?r.length===1&&r[0]===t:r.includes(t))}var Kb=async(e,t,n)=>new Promise(r=>{const i=u=>{clearInterval(a),clearTimeout(o),r(u)},o=setTimeout(()=>{i(null)},n),a=setInterval(()=>{globalThis[e]&&i(globalThis[e])},t)}),Yb=+xs.version.split(".")[0]<18,Xb=typeof queueMicrotask=="function"?queueMicrotask:e=>Promise.resolve(null).then(e),Fa=[],ka=e=>Yb?function(){!Fa.length&&xs.unstable_batchedUpdates&&Xb(()=>{xs.unstable_batchedUpdates(()=>{Fa.forEach(t=>t()),Fa=[]})}),Fa.push(e.bind(null,...arguments))}:e,Qf=(e,t)=>{e.on("status",ka(n=>t.setState({status:n}))),e.on("accounts",ka(n=>t.setState({accounts:n}))),e.on("chainId",ka(n=>t.setState({chainId:n}))),e.on("balance",ka(n=>t.setState({balance:n})))},Lt={status:e=>e.status,chainId:e=>e.chainId,balance:e=>e.balance,accounts:e=>e.accounts,account:e=>{var t;return(t=e.accounts)==null?void 0:t[0]}},Qb=class extends Xf{constructor(){super(...arguments);S(this,"sessionKey","ethereum--isMetaMask");S(this,"detectProvider",()=>xu({injectFlag:"ethereum",defaultWaltFlag:"isMetaMask"}));S(this,"requestAccounts",()=>this.provider.request({method:"eth_requestAccounts"}));S(this,"getAccounts",()=>this.provider.request({method:"eth_accounts"}));S(this,"getChainId",()=>this.provider.request({method:"eth_chainId"}));S(this,"getBalance",async()=>{if(!this.account)throw new Error("getBalance error: must connect to wallet");try{return await this.provider.request({method:"eth_getBalance",params:[this.account,"latest"]})}catch(t){throw t}});S(this,"onAccountsChange",t=>this.provider.on("accountsChanged",t));S(this,"onChainIdChange",t=>this.provider.on("chainChanged",t));S(this,"sendTransaction",t=>this.provider.request({method:"eth_sendTransaction",params:[t]}));S(this,"personalSign",t=>this.provider.request({method:"personal_sign",params:[t,this.account]}));S(this,"typedSign",t=>this.provider.request({method:"eth_signTypedData_v4",params:[this.account,JSON.stringify(t)]}));S(this,"addChain",t=>this.provider.request({method:"wallet_addEthereumChain",params:[t]}));S(this,"switchChain",t=>this.provider.request({method:"wallet_switchEthereumChain",params:[{chainId:t}]}));S(this,"watchAsset",t=>this.provider.request({method:"wallet_watchAsset",params:t}));S(this,"isHostedByFluent",()=>this.provider===window.conflux);S(this,"requestPermissions",t=>this.provider.request({method:"wallet_requestPermissions",params:[t]}));S(this,"requestCrossNetworkPermission",()=>this.isHostedByFluent()?this.provider.request({method:"wallet_requestPermissions",params:[{wallet_accounts:{},wallet_crossNetworkTypeGetConfluxBase32Address:{},wallet_crossNetworkTypeGetEthereumHexAddress:{}}]}):Promise.reject())}},Be=new Cu(new Qb),Qo=qf(Gf(()=>({status:"in-detecting",accounts:void 0,chainId:void 0,balance:void 0})));Qf(Be,Qo);var Zf=()=>Qo(Lt.status),Jf=()=>Qo(Lt.chainId),ep=()=>Qo(Lt.account),Pm=0,tp=()=>(C.exports.useEffect(()=>(++Pm===1&&Be.startTrackBalance(),()=>{--Pm===0&&Be.stopTrackBalance()}),[]),Qo(Lt.balance));Be.startTrackBalance;Be.stopTrackBalance;Be.trackBalanceChangeOnce;var Zb=Be.completeDetect,np=Be.connect;Be.sendTransaction;Be.personalSign;Be.typedSign;Be.addChain;Be.switchChain;Be.watchAsset;Be.requestPermissions;Be.requestCrossNetworkPermission;Be.setCrossNetworkChain;Be.provider;Be.completeDetect().then(()=>Be.provider);const Om=e=>{try{return e instanceof HTMLElement}catch{return typeof e=="object"&&e.nodeType===1&&typeof e.style=="object"&&typeof e.ownerDocument=="object"}},Bm=e=>((globalThis==null?void 0:globalThis.queueMicrotask)||(globalThis==null?void 0:globalThis.setTimeout))(e),Jb={from:{clipPath:"inset(50% round 50% 50%)"},enter:{clipPath:"inset(0% round 0% 0%)",config:{mass:1,tension:180,friction:24}},leave:{clipPath:"inset(50% round 50% 50%)",config:{mass:1,tension:180,friction:24,clamp:!0}}},e3={from:{clipPath:"polygon(50% 20%, 50% 50%, 20% 50%, 50% 50%, 50% 80%, 50% 50%, 80% 50%, 50% 50%)"},enter:{clipPath:"polygon(50% 0%, 0% 0%, 0% 50%, 0% 100%, 50% 100%, 100% 100%, 100% 50%, 100% 0%)",config:{mass:1,tension:180,friction:24}},leave:{clipPath:"polygon(50% 20%, 50% 50%, 20% 50%, 50% 50%, 50% 80%, 50% 50%, 80% 50%, 50% 50%)",config:{mass:1,tension:240,friction:22,clamp:!0}}},t3={from:{clipPath:"circle(0% at 50% 50%)"},enter:{clipPath:"circle(100% at 50% 50%)",config:{mass:1,tension:170,friction:26}},leave:{clipPath:"circle(0% at 50% 50%)",config:{mass:1,tension:170,friction:26,clamp:!0}}},n3={from:{filter:"blur(8px)",opacity:0},enter:{filter:"blur(0px)",opacity:1,config:{mass:1,tension:200,friction:26}},leave:{filter:"blur(8px)",config:{mass:1,tension:240,friction:24,clamp:!0}}},r3={from:{opacity:0},enter:{opacity:1,config:{mass:1,tension:170,friction:26}},leave:{opacity:0,config:{mass:1,tension:170,friction:26,clamp:!0}}},i3={from:{opacity:0,transform:"translate3d(0, 200%, 0)"},enter:{opacity:1,transform:"translate3d(0, 0%, 0)",config:{mass:1,tension:260,friction:19}},leave:{opacity:0,transform:"translate3d(0, 200%, 0)",config:{mass:1,tension:170,friction:26,clamp:!0}}},o3={from:{opacity:0,transform:"translate3d(0, -200%, 0)"},enter:{opacity:1,transform:"translate3d(0, 0%, 0)",config:{mass:1,tension:260,friction:19}},leave:{opacity:0,transform:"translate3d(0, -200%, 0)",config:{mass:1,tension:170,friction:26,clamp:!0}}},a3={from:{opacity:0,transform:"translate3d(-175%, 0, 0)"},enter:{opacity:1,transform:"translate3d(0%, 0, 0)",config:{mass:1,tension:260,friction:19}},leave:{opacity:0,transform:"translate3d(-175%, 0, 0)",config:{mass:1,tension:170,friction:26,clamp:!0}}},s3={from:{opacity:0,transform:"translate3d(175%, 0, 0)"},enter:{opacity:1,transform:"translate3d(0%, 0, 0)",config:{mass:1,tension:210,friction:20}},leave:{opacity:0,transform:"translate3d(175%, 0, 0)",config:{mass:1,tension:280,friction:60}}},u3={from:{transform:"perspective(400px) rotate3d(1, 0, 0, 90deg)"},enter:{transform:"perspective(400px) rotate3d(1, 0, 0, 0deg)",opacity:1,config:{mass:1,tension:180,friction:26}},leave:{transform:"perspective(400px) rotate3d(1, 0, 0, 90deg)",opacity:0,config:{mass:1,tension:240,friction:26,clamp:!0}}},l3={from:{transform:"rotate3d(0, 0, 1, 200deg)",opacity:0},enter:{transform:"rotate3d(0, 0, 1, 0deg)",opacity:1,config:{mass:1,tension:210,friction:26}},leave:{transform:"rotate3d(0, 0, 1, 200deg)",opacity:0,config:{mass:1,tension:240,friction:26,clamp:!0}}},c3={from:{transform:"scale3d(0.3, 0.3, 0.3)"},enter:{transform:"scale3d(1, 1, 1)",config:{mass:1,tension:210,friction:26}},leave:{transform:"scale3d(0, 0, 0)",config:{mass:1,tension:240,friction:26,clamp:!0}}},d3={from:{transform:"scale3d(0, 1, 1)"},enter:{transform:"scale3d(1, 1, 1)",config:{mass:1,tension:210,friction:26}},leave:{transform:"scale3d(0, 1, 0.1)",config:{mass:1,tension:240,friction:26,clamp:!0}}},f3={blur:n3,clipRectSp:e3,clipRect:Jb,clipCircle:t3,fade:r3,flip:u3,door:d3,zoom:c3,slideUp:i3,slideDown:o3,slideRight:s3,slideLeft:a3,rotate:l3},Oi=f3,p3=({list:e,children:t,animatedHeight:n,animationType:r="zoom",animationDuration:i,ItemWrapperClassName:o,ItemWrapperStyle:a,...u})=>{const s=C.exports.useRef(new WeakMap),l=Vf(e,{keys:d=>d.key,from:d=>{var c;return{...Oi[(c=d==null?void 0:d.animationType)!=null?c:r].from,height:n?0:void 0}},enter:d=>async c=>{var f,p,y,m,E,h,g;return await c({...Oi[(f=d==null?void 0:d.animationType)!=null?f:r].enter,height:n?s.current.get(d):void 0,config:{...(y=Oi[(p=d==null?void 0:d.animationType)!=null?p:r].enter)==null?void 0:y.config,duration:typeof((m=d==null?void 0:d.animationDuration)!=null?m:i)=="object"?(h=(E=d==null?void 0:d.animationDuration)!=null?E:i)==null?void 0:h.enter:(g=d==null?void 0:d.animationDuration)!=null?g:i}})},leave:d=>{var c,f,p,y,m,E,h;return{...Oi[(c=d==null?void 0:d.animationType)!=null?c:r].leave,height:n?0:void 0,margin:0,overflow:"hidden",config:{...(p=Oi[(f=d==null?void 0:d.animationType)!=null?f:r].leave)==null?void 0:p.config,duration:typeof((y=d==null?void 0:d.animationDuration)!=null?y:i)=="object"?(E=(m=d==null?void 0:d.animationDuration)!=null?m:i)==null?void 0:E.leave:(h=d==null?void 0:d.animationDuration)!=null?h:i}}}});return v("div",{...u,children:l((d,c,f,p)=>{var y,m;return v(gr.div,{className:ge("w-fit bg-transparent origin-center overflow-visible backface-visible will-change-transform",(y=c==null?void 0:c.ItemWrapperClassName)!=null?y:o),style:{...(m=c==null?void 0:c.ItemWrapperStyle)!=null?m:a,...d},children:n?v(gr.div,{className:"w-fit will-change-[height]",ref:E=>{var h;return(h=s.current)==null?void 0:h.set(c,E==null?void 0:E.offsetHeight)},children:C.exports.cloneElement(t(c,p))}):C.exports.cloneElement(t(c,p))})})})},rp=()=>typeof window=="undefined",id=e=>{e=e||navigator.userAgent;const t=/(iPad).*OS\s([\d_]+)/.test(e),n=!t&&/(iPhone\sOS)\s([\d_]+)/.test(e),r=/(Android);?[\s/]+([\d.]+)?/.test(e);return{ios:n||t,android:r}};function h3(e){if(rp())return!1;if(!e)throw new Error("options must be provided");let t=!1;const n={get passive(){t=!0}},r=()=>{},i="__TUA_BSL_TEST_PASSIVE__";window.addEventListener(i,r,n),window.removeEventListener(i,r,n);const{capture:o}=e;return t?e:typeof o!="undefined"?o:!1}let od=0,py=0,hy=0,ad=null,Os=!1;const so=[],my=h3({passive:!1}),m3=()=>{const e=document.body,t={...e.style},n=window.innerWidth-e.clientWidth;return e.style.overflow="hidden",e.style.boxSizing="border-box",e.style.paddingRight=`${n}px`,()=>{["overflow","boxSizing","paddingRight"].forEach(r=>{e.style[r]=t[r]||""})}},g3=()=>{const e=document.documentElement,t=document.body,n=e.scrollTop||t.scrollTop,r={...e.style},i={...t.style};return e.style.height="100%",e.style.overflow="hidden",t.style.top=`-${n}px`,t.style.width="100%",t.style.height="auto",t.style.position="fixed",t.style.overflow="hidden",()=>{e.style.height=r.height||"",e.style.overflow=r.overflow||"",["top","width","height","overflow","position"].forEach(o=>{t.style[o]=i[o]||""}),window.scrollTo(0,n)}},ip=e=>{!e.cancelable||e.preventDefault()},v3=(e,t)=>{if(t){const{scrollTop:n,scrollLeft:r,scrollWidth:i,scrollHeight:o,clientWidth:a,clientHeight:u}=t,s=e.targetTouches[0].clientX-hy,l=e.targetTouches[0].clientY-py,d=Math.abs(l)>Math.abs(s),c=l>0&&n===0,f=s>0&&r===0,p=s<0&&r+a+1>=i,y=l<0&&n+u+1>=o;if(d&&(c||y)||!d&&(f||p))return ip(e)}return e.stopPropagation(),!0},y3=e=>{e||e!==null&&console.warn("If scrolling is also required in the floating layer, the target element must be provided.")},w3=e=>{rp()||(y3(e),id().ios?(e&&(Array.isArray(e)?e:[e]).forEach(n=>{n&&so.indexOf(n)===-1&&(n.ontouchstart=r=>{py=r.targetTouches[0].clientY,hy=r.targetTouches[0].clientX},n.ontouchmove=r=>{r.targetTouches.length===1&&v3(r,n)},so.push(n))}),Os||(document.addEventListener("touchmove",ip,my),Os=!0)):od<=0&&(ad=id().android?g3():m3()),od+=1)},E3=()=>{if(!rp()){if(od=0,!id().ios&&typeof ad=="function"){ad();return}if(so.length){let e=so.pop();for(;e;)e.ontouchmove=null,e.ontouchstart=null,e=so.pop()}Os&&(document.removeEventListener("touchmove",ip,my),Os=!1)}},C3=({open:e,className:t,style:n,...r})=>{const i=Vf(e,{from:{opacity:0},enter:{opacity:1},leave:{opacity:0},reverse:e});return C.exports.useEffect(()=>{e?w3():E3()},[e]),i((o,a)=>a&&v(gr.div,{className:ge("fixed left-0 top-0 w-full h-full bg-black bg-opacity-40 z-[200] contain-strict",t),style:{...n,...o},...r}))},x3=C.exports.forwardRef(({handleClose:e,Content:t,duration:n},r)=>(C.exports.useEffect(()=>{let i;return n!==0&&(i=setTimeout(e,n)),()=>clearTimeout(i)},[]),C.exports.isValidElement(t)||typeof t=="function"?v("div",{className:"flex flex-col w-fit bg-transparent backface-visible overflow-hidden contain-content",ref:r,children:typeof t=="function"?v(t,{}):t}):v("div",{ref:r,className:"w-fit px-[5px] py-[8px] bg-black bg-opacity-70 text-white rounded backface-visible",children:t}))),Rm=C.exports.forwardRef((e,t)=>{const[n,r]=C.exports.useState([]),i=C.exports.useRef([]),[o,a]=C.exports.useState(!1),[u,s]=C.exports.useState(void 0),[l,d]=C.exports.useState(void 0),[c,f]=C.exports.useState(void 0),[p,y]=C.exports.useState(void 0),[m,E]=C.exports.useState(void 0),[h,g]=C.exports.useState(void 0),[w,x]=C.exports.useState(void 0),b=C.exports.useCallback(({Content:M,duration:I=3e3,showMask:U=!1,key:H,preventDuplicate:Z,maximum:j,unique:O,queue:$,...W})=>{const _=H!=null?H:Lc("popup");return r(L=>H&&L.find(B=>B.key===H)?L:$&&L.length?(i.current.push({Content:M,duration:I,showMask:U,key:_,preventDuplicate:Z,maximum:j,unique:O,...W}),L):Z&&L.find(B=>B.Content===M)?L:(j&&L.length>0&&L.length>=j&&(L=L.slice(0,j-1)),[{key:_,Content:M,duration:I,showMask:U,...W},...O&&L.length>=1?[]:L])),Bm(()=>{U&&a(!0)}),_},[]),F=C.exports.useCallback(M=>{let I=!1;r(U=>{const H=U.filter(Z=>Z.key!==M);return H.find(Z=>Z.showMask)||a(!1),!H.length&&i.current.length&&(I=!0),H}),Bm(()=>{I&&b(i.current.shift())})},[]),k=C.exports.useCallback(()=>{i.current=[],r([]),a(!1)},[]),A=C.exports.useCallback(M=>{f(()=>M)},[]);return C.exports.useImperativeHandle(t,()=>({show:b,hide:F,hideAll:k,setMaskStyle:s,setMaskClassName:d,setListStyle:y,setListClassName:E,setItemWrapperStyle:g,setItemWrapperClassName:x,setMaskClickHandler:A})),N("div",{children:[v(C3,{open:o,className:l,style:u,onClick:c}),v(p3,{className:ge("fixed flex flex-col items-center w-fit left-[50%] top-[30%] translate-x-[-50%] z-[201]",m),list:n,animatedHeight:!0,style:p,ItemWrapperClassName:w,ItemWrapperStyle:{marginBottom:12,...h},children:M=>v(x3,{handleClose:()=>{var I;F(M.key),(I=M==null?void 0:M.onClose)==null||I.call(M)},...M})})]})});class Su{constructor(){S(this,"popupRef");S(this,"show");S(this,"hide");S(this,"hideAll");S(this,"setMaskStyle");S(this,"setMaskClassName");S(this,"setMaskClickHandler");S(this,"setListStyle");S(this,"setListClassName");S(this,"setItemWrapperStyle");S(this,"setItemWrapperClassName");S(this,"isInInit",!1);S(this,"isEndInit",!1);S(this,"completeInit");S(this,"initPromise");S(this,"resetMethod",()=>{this.show=this.popupRef.current.show,this.hide=this.popupRef.current.hide,this.hideAll=this.popupRef.current.hideAll,this.setMaskStyle=this.popupRef.current.setMaskStyle,this.setMaskClassName=this.popupRef.current.setMaskClassName,this.setMaskClickHandler=this.popupRef.current.setMaskClickHandler,this.setListStyle=this.popupRef.current.setListStyle,this.setListClassName=this.popupRef.current.setListClassName,this.setItemWrapperStyle=this.popupRef.current.setItemWrapperStyle,this.setItemWrapperClassName=this.popupRef.current.setItemWrapperClassName});S(this,"waitRefReady",()=>{const t=()=>{this.popupRef.current?this.completeInit():setTimeout(t,16)};return t(),this.initPromise});S(this,"init",async t=>{(!t||!Om(t))&&(t=document.createElement("div"),t.setAttribute("id","popup-container-"+Lc()),t.style.position="absolute",document.body.appendChild(t)),B1(t).render(v(Rm,{ref:this.popupRef})),await this.waitRefReady(),this.resetMethod(),this.isEndInit=!0});S(this,"Provider",({container:t})=>{(!t||!Om(t))&&(t=document.createElement("div"),t.setAttribute("id","popup-container-"+Lc()),t.style.position="absolute",document.body.appendChild(t));const n=br.exports.createPortal(kd.createElement(Rm,{ref:this.popupRef}),t);return this.waitRefReady().then(this.resetMethod),n});this.popupRef=C.exports.createRef(),this.show=t=>this.judgeInit("show",t),this.hide=t=>this.judgeInit("hide",t),this.hideAll=()=>this.judgeInit("hideAll"),this.setMaskStyle=t=>this.judgeInit("setMaskStyle",t),this.setMaskClassName=t=>this.judgeInit("setMaskClassName",t),this.setMaskClickHandler=t=>this.judgeInit("setMaskClickHandler",t),this.setListStyle=t=>this.judgeInit("setListStyle",t),this.setListClassName=t=>this.judgeInit("setListClassName",t),this.setItemWrapperStyle=t=>this.judgeInit("setItemWrapperStyle",t),this.setItemWrapperClassName=t=>this.judgeInit("setItemWrapperClassName",t),this.initPromise=new Promise(t=>this.completeInit=t)}judgeInit(t,n){if(!this.isEndInit){this.isInInit||(this.isInInit=!0,this.init()),this.initPromise.then(()=>{this[t](n)});return}return this[t](n)}}new Su;const op=new Su;op.setListStyle({top:"unset",left:"unset",transform:"unset",right:"12px",bottom:"6px",flexDirection:"column-reverse"});const S3=C.exports.memo(({text:e,duration:t})=>{const n=Zc({from:{transform:"translateX(-100%)"},to:{transform:"translateX(0)"},config:{duration:6e3}});return N("div",{className:"relative flex justify-center items-center min-w-[240px] h-[40px] px-[32px] bg-[#445159] text-white rounded overflow-hidden",children:[e,t?v(gr.div,{className:"absolute bottom-0 w-full h-[4px] bg-gradient-to-l from-[#15C184] to-[#2959B4]",style:n}):null]})}),Ee=(e,t)=>{var n;return op.show({Content:v(S3,{text:e,duration:(n=t==null?void 0:t.duration)!=null?n:6e3}),duration:6e3,animationType:"slideRight",...t})};op.hide;var gy="/assets/cfx.d75b3570.svg";const b3="_spin_7vpum_1";var Zo={"connected-spin":"_connected-spin_7vpum_1",spin:b3};const F3=()=>{const e=Zf(),t=ep(),n=Jf(),r=tp(),i=C.exports.useCallback(async()=>{try{await np(),Ee("Connect to Fluent Success!")}catch(o){(o==null?void 0:o.code)===4001&&Ee("User rejected connection.",{key:"user-rejected-connection"})}},[]);return console.log("render status:",e," , account:",t," , chainId:",n),N("div",{className:"flex justify-center items-center",children:[e!=="in-detecting"&&e!=="active"&&N("button",{className:ge("button w-[168px]",{error:e==="not-installed"}),onClick:i,disabled:e!=="not-active",children:[e==="in-activating"&&"connecting...",e==="not-installed"&&"Fluent Not Install",e==="not-active"&&"Connect Fluent"]}),e==="active"&&N("div",{className:"min-w-[440px] mt-[16px] p-[16px] rounded-[8px] border-[1px] border-[#EAECEF] dark:border-transparent shadow dark:shadow-none bg-white dark:bg-[#374151] transition-colors",children:[N("p",{className:"inline-flex items-center px-[10px] py-[4px] rounded-3xl text-[16px] text-primary bg-[#ecedf5] dark:text-[#f8f9fe] dark:bg-primary transition-colors",children:[v("span",{className:`mr-[4px] ${Zo["connected-spin"]}`}),"Conflux Chain"]}),v("p",{className:"mt-[16px] text-[16px] leading-[22px] text-text1 transition-colors",children:"chainId:"}),v("p",{className:"text-[14px] leading-[18px] text-text2 transition-colors",children:n}),v("p",{className:"mt-[6px] text-[16px] leading-[22px] text-text1 transition-colors",children:"account address:"}),v("p",{className:"text-[14px] leading-[18px] text-text2 transition-colors",children:t}),v("p",{className:"mt-[6px] text-[16px] leading-[22px] text-text1 transition-colors",children:"balance:"}),v("p",{className:"text-[14px] leading-[18px] text-text2 transition-colors",children:`${r==null?void 0:r.toDecimalStandardUnit()} CFX`}),N("div",{className:"mt-[16px] px-[12px] py-[10px] flex items-center text-[14px] text-[#3D3F4C] bg-[#F7F8FA] rounded-[2px]",children:[v("img",{className:"mr-[8px] w-[24px] h-[24px]",src:gy,alt:"cfx icon"}),"CFX (Conflux Network)",v("span",{className:"ml-[8px] mt-[2px] inline-block px-[4px] text-[12px] text-white text-center bg-[#44D7B6] rounded-[2px]",children:"Connected"})]})]})]})};var vy=class extends Xf{constructor(){super(...arguments);S(this,"sessionKey","ethereum--isMetaMask");S(this,"detectProvider",()=>xu({injectFlag:"ethereum",defaultWaltFlag:"isMetaMask"}));S(this,"requestAccounts",()=>this.provider.request({method:"eth_requestAccounts"}));S(this,"getAccounts",()=>this.provider.request({method:"eth_accounts"}));S(this,"getChainId",()=>this.provider.request({method:"eth_chainId"}));S(this,"getBalance",async()=>{if(!this.account)throw new Error("getBalance error: must connect to wallet");try{return await this.provider.request({method:"eth_getBalance",params:[this.account,"latest"]})}catch(t){throw t}});S(this,"onAccountsChange",t=>this.provider.on("accountsChanged",t));S(this,"onChainIdChange",t=>this.provider.on("chainChanged",t));S(this,"sendTransaction",t=>this.provider.request({method:"eth_sendTransaction",params:[t]}));S(this,"personalSign",t=>this.provider.request({method:"personal_sign",params:[t,this.account]}));S(this,"typedSign",t=>this.provider.request({method:"eth_signTypedData_v4",params:[this.account,JSON.stringify(t)]}));S(this,"addChain",t=>this.provider.request({method:"wallet_addEthereumChain",params:[t]}));S(this,"switchChain",t=>this.provider.request({method:"wallet_switchEthereumChain",params:[{chainId:t}]}));S(this,"watchAsset",t=>this.provider.request({method:"wallet_watchAsset",params:t}));S(this,"isHostedByFluent",()=>this.provider===window.conflux);S(this,"requestPermissions",t=>this.provider.request({method:"wallet_requestPermissions",params:[t]}));S(this,"requestCrossNetworkPermission",()=>this.isHostedByFluent()?this.provider.request({method:"wallet_requestPermissions",params:[{wallet_accounts:{},wallet_crossNetworkTypeGetConfluxBase32Address:{},wallet_crossNetworkTypeGetEthereumHexAddress:{}}]}):Promise.reject())}};new Cu(new vy);var k3=class extends vy{constructor(){super(...arguments);S(this,"sessionKey","fluent-isFluent");S(this,"detectProvider",()=>xu({injectFlag:"fluent",walletFlag:"isFluent"}));S(this,"requestCrossNetworkPermission",()=>this.provider.request({method:"wallet_requestPermissions",params:[{wallet_accounts:{},wallet_crossNetworkTypeGetConfluxBase32Address:{},wallet_crossNetworkTypeGetEthereumHexAddress:{}}]}))}},Re=new Cu(new k3),Jo=qf(Gf(()=>({status:"in-detecting",accounts:void 0,chainId:void 0,balance:void 0})));Qf(Re,Jo);var A3=()=>Jo(Lt.status),D3=()=>Jo(Lt.chainId),_3=()=>Jo(Lt.account),Nm=0,I3=()=>(C.exports.useEffect(()=>(++Nm===1&&Re.startTrackBalance(),()=>{--Nm===0&&Re.stopTrackBalance()}),[]),Jo(Lt.balance));Re.startTrackBalance;Re.stopTrackBalance;Re.trackBalanceChangeOnce;Re.completeDetect;var T3=Re.connect;Re.sendTransaction;Re.personalSign;Re.typedSign;Re.addChain;Re.switchChain;Re.watchAsset;Re.requestPermissions;Re.requestCrossNetworkPermission;Re.setCrossNetworkChain;Re.provider;Re.completeDetect().then(()=>Re.provider);var M3="/assets/metamask-fox.b8558514.svg";const sd=({useStatus:e,useAccount:t,useChainId:n,useBalance:r,connect:i,type:o})=>{const a=e(),u=t(),s=n(),l=r(),d=C.exports.useCallback(async()=>{try{await i(),Ee(`Connect to ${o} Success!`)}catch(c){(c==null?void 0:c.code)===4001&&Ee(`User rejected ${o} connection.`,{key:`user-rejected-connection-${o}`})}},[]);return console.log(`render ${o} status:`,a," , account:",u," , chainId:",s),N("div",{className:"flex justify-center items-center",children:[a!=="in-detecting"&&a!=="active"&&N("button",{className:ge("button w-[168px]",{error:a==="not-installed",metamask:o==="MetaMask"}),onClick:d,disabled:a!=="not-active",children:[a==="in-activating"&&"connecting...",a==="not-installed"&&`${o} Not Install`,a==="not-active"&&`Connect ${o}`]}),a==="active"&&N("div",{className:"min-w-[440px] mt-[16px] p-[16px] rounded-[8px] border-[1px] border-[#EAECEF] dark:border-transparent shadow dark:shadow-none bg-white dark:bg-[#374151] transition-colors",children:[N("p",{className:ge("inline-flex items-center px-[10px] py-[4px] rounded-3xl text-[16px] bg-[#ecedf5] dark:text-[#f8f9fe] transition-colors",o==="Fluent"?"text-primary dark:bg-primary":"text-metamask dark:bg-metamask"),children:[v("span",{className:`mr-[4px] ${Zo["connected-spin"]}`}),`${o==="Fluent"?"Conflux":"Ethereum"}`," Chain"]}),v("p",{className:"mt-[16px] text-[16px] leading-[22px] text-text1 transition-colors",children:"chainId:"}),v("p",{className:"text-[14px] leading-[18px] text-text2 transition-colors",children:s}),v("p",{className:"mt-[6px] text-[16px] leading-[22px] text-text1 transition-colors",children:"account address:"}),v("p",{className:"text-[14px] leading-[18px] text-text2 transition-colors",children:u}),v("p",{className:"mt-[6px] text-[16px] leading-[22px] text-text1 transition-colors",children:"balance:"}),v("p",{className:"text-[14px] leading-[18px] text-text2 transition-colors",children:`${l==null?void 0:l.toDecimalStandardUnit()} ${o==="Fluent"?"CFX":"ETH"}`}),N("div",{className:"mt-[16px] px-[12px] py-[10px] flex items-center text-[14px] text-[#3D3F4C] bg-[#F7F8FA] rounded-[2px]",children:[v("img",{className:"mr-[8px] w-[24px] h-[24px]",src:o==="Fluent"?gy:M3,alt:"cfx icon"}),o==="Fluent"?"CFX (Conflux Network)":"ETH (Ethereum Network)",v("span",{className:"ml-[8px] mt-[2px] inline-block px-[4px] text-[12px] text-white text-center bg-[#44D7B6] rounded-[2px]",children:"Connected"})]})]})]})},P3=()=>N("div",{className:"flex justify-center gap-8",children:[v(sd,{useStatus:A3,useAccount:_3,useChainId:D3,useBalance:I3,connect:T3,type:"Fluent"}),v(sd,{useStatus:Zf,useAccount:ep,useChainId:Jf,useBalance:tp,connect:np,type:"MetaMask"})]});var O3=class extends Xf{constructor(){super(...arguments);S(this,"sessionKey","conflux");S(this,"detectProvider",()=>{const t=xu({injectFlag:"conflux"});return t.then(n=>{n.isConfluxPortal&&n.send&&!n.request&&(this.provider.request=({method:r,params:i})=>{var o;return r==="accounts"?Promise.resolve(this.provider.selectedAddress):r==="cfx_chainId"?Promise.resolve(this.provider.networkVersion):(o=this.provider)==null?void 0:o.send(r,i)})}),t});S(this,"requestAccounts",()=>this.provider.request({method:"cfx_requestAccounts"}));S(this,"getAccounts",()=>this.provider.request({method:"cfx_accounts"}));S(this,"getChainId",()=>this.provider.request({method:"cfx_chainId"}));S(this,"getBalance",async()=>{if(!this.account)throw new Error("getBalance error: must connect to wallet");try{return await this.provider.request({method:"cfx_getBalance",params:[this.account,"latest_state"]})}catch(t){throw t}});S(this,"onAccountsChange",t=>this.provider.on("accountsChanged",t));S(this,"onChainIdChange",t=>this.provider.on("chainChanged",t));S(this,"sendTransaction",t=>this.provider.request({method:"cfx_sendTransaction",params:[t]}));S(this,"personalSign",t=>this.provider.request({method:"personal_sign",params:[t,this.account]}));S(this,"typedSign",t=>this.provider.request({method:"cfx_signTypedData_v4",params:[this.account,JSON.stringify(t)]}));S(this,"addChain",t=>this.provider.request({method:"wallet_addConfluxChain",params:[t]}));S(this,"switchChain",t=>this.provider.request({method:"wallet_switchConfluxChain",params:[{chainId:t}]}));S(this,"watchAsset",t=>this.provider.request({method:"wallet_watchAsset",params:t}));S(this,"requestPermissions",t=>this.provider.request({method:"wallet_requestPermissions",params:[t]}))}},Ne=new Cu(new O3),ea=qf(Gf(()=>({status:"in-detecting",accounts:void 0,chainId:void 0,balance:void 0})));Qf(Ne,ea);var bu=()=>ea(Lt.status),Fu=()=>ea(Lt.chainId),ku=()=>ea(Lt.account),Lm=0,Au=()=>(C.exports.useEffect(()=>(++Lm===1&&Ne.startTrackBalance(),()=>{--Lm===0&&Ne.stopTrackBalance()}),[]),ea(Lt.balance));Ne.startTrackBalance;Ne.stopTrackBalance;var B3=Ne.trackBalanceChangeOnce,R3=Ne.completeDetect,Du=Ne.connect,N3=Ne.sendTransaction,L3=Ne.personalSign,$3=Ne.typedSign,U3=Ne.addChain,j3=Ne.switchChain,z3=Ne.watchAsset;Ne.requestPermissions;Ne.requestCrossNetworkPermission;Ne.setCrossNetworkChain;Ne.provider;Ne.completeDetect().then(()=>Ne.provider);const H3=()=>{const[e,t]=C.exports.useState(()=>{const r=localStorage.getItem("wallet");return r!=="Fluent"&&r!=="MetaMask"?"Fluent":r}),n=C.exports.useCallback(()=>{t(r=>{const i=r==="Fluent"?"MetaMask":"Fluent";return localStorage.setItem("wallet",i),i})},[]);return N(Nt,{children:[v(sd,{useStatus:e==="Fluent"?bu:Zf,useAccount:e==="Fluent"?ku:ep,useChainId:e==="Fluent"?Fu:Jf,useBalance:e==="Fluent"?Au:tp,connect:e==="Fluent"?Du:np,type:e}),N("button",{className:ge("mt-6 inline-flex mx-auto button w-[188px] h-[36px]",{metamask:e==="Fluent"}),onClick:n,children:["Switch to ",e==="Fluent"?"MetaMask":"Fluent"]})]})};var V3="/assets/success.089c49c8.svg",W3="/assets/close.3ffc782c.svg";const ap=new Su,sp=new Su,q3=C.exports.memo(()=>N("div",{className:"w-[340px] h-[150px] text-center bg-bg rounded-[8px]",children:[v("div",{className:"modal-spin mt-[24px]"}),v("p",{className:"font-medium text-[16px] text-text1 mt-[12px] leading-[22px]",children:"Waiting"}),v("p",{className:"mt-[8px] text-[14px] text-text2 leading-[18px]",children:"Confirm the transaction in your Fluent wallet..."})]})),G3=C.exports.memo(({TxnHash:e,action:t="Transaction"})=>N("div",{className:"relative w-[340px] min-h-[192px] p-[24px] text-center bg-bg rounded-lg ",children:[v("img",{className:"absolute right-[12px] top-[12px] w-[16px] h-[16px] cursor-pointer hover:scale-110 transition-transform select-none",onClick:sp.hideAll,src:W3,alt:"close icon"}),v("img",{className:"w-[48px] h-[48px] mt-[28px] mx-auto",src:V3,alt:"success icon"}),N("p",{className:"mt-[12px] font-medium text-[16px] leading-[22px] text-text1 text-center",children:[t," Submitted"]}),v("p",{className:"mt-[12px] mb-[4px] text-[14px] leading-[18px] text-text1 text-left",children:"Txn Hash:"}),v("p",{className:"text-[14px] leading-[18px] text-text2 text-left break-words",children:e})]})),ud=()=>ap.show({Content:v(q3,{}),duration:0,showMask:!0,animationType:"door"}),ld=(e,t="Transaction")=>(ap.hideAll(),sp.show({Content:v(G3,{TxnHash:e,action:t}),duration:0,showMask:!0,animationType:"door"})),cd=e=>ap.hide(e),K3=e=>sp.hide(e),Y3=()=>{const e=bu(),t=ku(),n=Fu(),r=Au(),i=C.exports.useCallback(async()=>{try{await Du(),Ee("Connect to Fluent Success!")}catch(a){console.log(a),(a==null?void 0:a.code)===4001&&Ee("User rejected connection.",{key:"user-rejected-connection"})}},[]),o=C.exports.useCallback(async()=>{if(!t)return;let a=null,u=null;try{a=ud();const s=await N3({to:t,value:fy.fromStandardUnit("1").toHexMinUnit()});u=ld(s),B3(()=>{K3(u),Ee("It seems the transaction is complete")})}catch(s){cd(a),(s==null?void 0:s.code)===4001&&Ee("User canceled transaction.")}},[t]);return N("div",{className:"flex justify-center items-center",children:[e!=="in-detecting"&&e!=="active"&&N("button",{className:ge("button w-[168px]",{error:e==="not-installed"}),onClick:i,disabled:e!=="not-active",children:[e==="in-activating"&&"connecting...",e==="not-installed"&&"Fluent Not Install",e==="not-active"&&"Connect Fluent"]}),e==="active"&&N("div",{className:"min-w-[440px] mt-[16px] p-[16px] rounded-[8px] border-[1px] border-[#EAECEF] dark:border-transparent shadow dark:shadow-none bg-white dark:bg-[#374151] transition-colors",children:[N("p",{className:"inline-flex items-center px-[10px] py-[4px] rounded-3xl text-[16px] text-primary bg-[#ecedf5] dark:text-[#f8f9fe] dark:bg-primary transition-colors",children:[v("span",{className:`mr-[4px] ${Zo["connected-spin"]}`}),"Conflux Chain"]}),v("p",{className:"mt-[16px] text-[16px] leading-[22px] text-text1 transition-colors",children:"chainId:"}),v("p",{className:"text-[14px] leading-[18px] text-text2 transition-colors",children:n}),v("p",{className:"mt-[6px] text-[16px] leading-[22px] text-text1 transition-colors",children:"account address:"}),v("p",{className:"text-[14px] leading-[18px] text-text2 transition-colors",children:t}),v("p",{className:"mt-[6px] text-[16px] leading-[22px] text-text1 transition-colors",children:"balance:"}),v("p",{className:"text-[14px] leading-[18px] text-text2 transition-colors",children:`${r==null?void 0:r.toDecimalStandardUnit()} CFX`}),v("button",{className:"button w-full my-4 h-[36px]",onClick:o,children:"Send 1 native token to self (connected account)"})]})]})},X3=()=>{const e=bu(),t=ku(),n=Fu(),r=Au(),i=C.exports.useCallback(async()=>{try{await Du(),Ee("Connect to Fluent Success!")}catch(u){console.log(u),(u==null?void 0:u.code)===4001&&Ee("User rejected connection.",{key:"user-rejected-connection"})}},[]),o=C.exports.useCallback(async()=>{let u=null;try{u=ud();const s=await L3("Personal Sign message example");ld(s,"Personal Sign")}catch(s){console.log(u),cd(u),(s==null?void 0:s.code)===4001&&Ee("User canceled Personal Sign.")}},[]),a=C.exports.useCallback(async()=>{let u=null;try{u=ud();const s=await $3(Q3);ld(s,"Typed Sign")}catch(s){cd(u),(s==null?void 0:s.code)===4001&&Ee("User canceled Typed Sign.")}},[]);return N("div",{className:"flex justify-center items-center",children:[e!=="in-detecting"&&e!=="active"&&N("button",{className:ge("button w-[168px]",{error:e==="not-installed"}),onClick:i,disabled:e!=="not-active",children:[e==="in-activating"&&"connecting...",e==="not-installed"&&"Fluent Not Install",e==="not-active"&&"Connect Fluent"]}),e==="active"&&N("div",{className:"min-w-[440px] mt-[16px] p-[16px] rounded-[8px] border-[1px] border-[#EAECEF] dark:border-transparent shadow dark:shadow-none bg-white dark:bg-[#374151] transition-colors",children:[N("p",{className:"inline-flex items-center px-[10px] py-[4px] rounded-3xl text-[16px] text-primary bg-[#ecedf5] dark:text-[#f8f9fe] dark:bg-primary transition-colors",children:[v("span",{className:`mr-[4px] ${Zo["connected-spin"]}`}),"Conflux Chain"]}),v("p",{className:"mt-[16px] text-[16px] leading-[22px] text-text1 transition-colors",children:"chainId:"}),v("p",{className:"text-[14px] leading-[18px] text-text2 transition-colors",children:n}),v("p",{className:"mt-[6px] text-[16px] leading-[22px] text-text1 transition-colors",children:"account address:"}),v("p",{className:"text-[14px] leading-[18px] text-text2 transition-colors",children:t}),v("p",{className:"mt-[6px] text-[16px] leading-[22px] text-text1 transition-colors",children:"balance:"}),v("p",{className:"text-[14px] leading-[18px] text-text2 transition-colors",children:`${r==null?void 0:r.toDecimalStandardUnit()} CFX`}),N("div",{className:"flex gap-8",children:[v("button",{className:"button w-[50%] my-4 h-[36px]",onClick:o,children:"Personal Sign"}),v("button",{className:"button w-[50%] my-4 h-[36px]",onClick:a,children:"Typed Sign"})]})]})]})},Q3={types:{CIP23Domain:[{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"}],Person:[{name:"name",type:"string"},{name:"wallets",type:"address[]"}],Mail:[{name:"from",type:"Person"},{name:"to",type:"Person[]"},{name:"contents",type:"string"}],Group:[{name:"name",type:"string"},{name:"members",type:"Person[]"}]},domain:{name:"Ether Mail",version:"1",chainId:1,verifyingContract:"0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC"},primaryType:"Mail",message:{from:{name:"Cow",wallets:["0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826","0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF"]},to:[{name:"Bob",wallets:["0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB","0xB0BdaBea57B0BDABeA57b0bdABEA57b0BDabEa57","0xB0B0b0b0b0b0B000000000000000000000000000"]}],contents:"Hello, Bob!"}},Z3=()=>{const e=bu(),t=ku(),n=Fu(),r=Au(),i=C.exports.useCallback(async()=>{try{await Du(),Ee("Connect to Fluent Success!")}catch(s){console.log(s),(s==null?void 0:s.code)===4001&&Ee("User rejected connection.",{key:"user-rejected-connection"})}},[]),o=C.exports.useCallback(async()=>{U3({chainId:"0x2ee0",chainName:"123Conflux",nativeCurrency:{name:"Conflux",symbol:"CFX",decimals:18},rpcUrls:["http://47.104.89.179:12537"],blockExplorerUrls:["https://confluxscan.io"]}).then(()=>{Ee("Add 123Conflux chain success!")}).catch(s=>{var l;(s==null?void 0:s.code)===4001&&Ee("User rejected add 123Conflux chain."),(s==null?void 0:s.code)===-32602&&((l=s==null?void 0:s.message)==null?void 0:l.indexOf("Duplicate network endpoint"))!==-1&&Ee("Have added 123Conflux chain.")})},[]),a=C.exports.useCallback(async()=>{j3(n==="12000"?"0x1":"0x2ee0").then(()=>{Ee(`Switch to ${n==="12000"?"Testnet":"123Conflux"} chain success!`)}).catch(s=>{var l;(s==null?void 0:s.code)===4001&&Ee(`User rejected switch to ${n==="12000"?"Testnet":"123Conflux"} chain.`),(s==null?void 0:s.code)===-32602&&((l=s==null?void 0:s.message)==null?void 0:l.indexOf("try add the network"))!==-1&&Ee(`${n==="12000"?"Testnet":"123Conflux"} chain not added, try add first.`)})},[n]),u=C.exports.useCallback(async()=>{z3({type:"ERC20",options:{address:"cfxtest:acepe88unk7fvs18436178up33hb4zkuf62a9dk1gv",symbol:"cUSDT",decimals:18,image:"https://scan-icons.oss-cn-hongkong.aliyuncs.com/testnet/cfxtest%3Aacepe88unk7fvs18436178up33hb4zkuf62a9dk1gv.png"}}).then(s=>{Ee(s?"Add cUSTD success!":"Add cUSTD failed.")}).catch(s=>{(s==null?void 0:s.code)===4001&&Ee("User rejected add cUSTD."),(s==null?void 0:s.code)===-32602&&Ee("Add cUSTD failed, please check your network.")})},[]);return N("div",{className:"flex justify-center items-center",children:[e!=="in-detecting"&&e!=="active"&&N("button",{className:ge("button w-[168px]",{error:e==="not-installed"}),onClick:i,disabled:e!=="not-active",children:[e==="in-activating"&&"connecting...",e==="not-installed"&&"Fluent Not Install",e==="not-active"&&"Connect Fluent"]}),e==="active"&&N("div",{className:"mt-[16px] p-[16px] rounded-[8px] border-[1px] border-[#EAECEF] dark:border-transparent shadow dark:shadow-none bg-white dark:bg-[#374151] transition-colors",children:[N("p",{className:"inline-flex items-center px-[10px] py-[4px] rounded-3xl text-[16px] text-primary bg-[#ecedf5] dark:text-[#f8f9fe] dark:bg-primary transition-colors",children:[v("span",{className:`mr-[4px] ${Zo["connected-spin"]}`}),"Conflux Chain"]}),v("p",{className:"mt-[16px] text-[16px] leading-[22px] text-text1 transition-colors",children:"chainId:"}),v("p",{className:"text-[14px] leading-[18px] text-text2 transition-colors",children:n}),v("p",{className:"mt-[6px] text-[16px] leading-[22px] text-text1 transition-colors",children:"account address:"}),v("p",{className:"text-[14px] leading-[18px] text-text2 transition-colors",children:t}),v("p",{className:"mt-[6px] text-[16px] leading-[22px] text-text1 transition-colors",children:"balance:"}),v("p",{className:"text-[14px] leading-[18px] text-text2 transition-colors",children:`${r==null?void 0:r.toDecimalStandardUnit()} CFX`}),N("div",{className:"flex gap-4",children:[v("button",{className:"button w-[50%] my-4 h-[36px]",onClick:o,children:"Add 123Conflux Chain"}),v("button",{className:"button w-[50%] my-4 h-[36px]",onClick:a,children:n!=="12000"?"Switch to 123Conflux":"Switch to Testnet"}),v("button",{className:"button w-[50%] my-4 h-[36px]",onClick:u,disabled:n!=="1",children:"Add cUSTD to Testnet"})]})]})]})};var J3="/assets/code.81066be6.svg";const dd=[{title:"demo_connect_title",introduce:"demo_connect_introduce",Demo:F3,code:"https://github.com/Conflux-Chain/use-wallet/blob/main/dev-examples/docs/src/pages/Demo/Connect/index.tsx"},{title:"demo_connect_both_title",introduce:"demo_connect_both_introduce",Demo:P3,code:"https://github.com/Conflux-Chain/use-wallet/blob/main/dev-examples/docs/src/pages/Demo/ConnectBoth/index.tsx"},{title:"demo_connect_switch_title",introduce:"demo_connect_switch_introduce",Demo:H3,code:"https://github.com/Conflux-Chain/use-wallet/blob/main/dev-examples/docs/src/pages/Demo/ConnectSwitch/index.tsx"},{title:"demo_send_transaction_title",introduce:"demo_send_transaction_introduce",Demo:Y3,code:"https://github.com/Conflux-Chain/use-wallet/blob/main/dev-examples/docs/src/pages/Demo/SendTransaction/index.tsx"},{title:"demo_sign_title",introduce:"demo_sign_introduce",Demo:X3,code:"https://github.com/Conflux-Chain/use-wallet/blob/main/dev-examples/docs/src/pages/Demo/Sign/index.tsx"},{title:"demo_addSwitch_title",introduce:"demo_addSwitch_introduce",Demo:Z3,code:"https://github.com/Conflux-Chain/use-wallet/blob/main/dev-examples/docs/src/pages/Demo/AddSwitch/index.tsx"}],$m=Object.fromEntries(dd.map(e=>[e.title,e])),eF={en:{demo_connect_title:"Connect fluent wallet",demo_connect_introduce:"The first step of Dapp, connect your wallet.Then you can get information about your current account.",demo_connect_both_title:"Connect both fluent and metamask",demo_connect_both_introduce:"A dapp that needs to cross-chain, or conflux cross-space, needs to connect to multiple wallets at the same time.",demo_connect_switch_title:"Switch connect wallet with the same code",demo_connect_switch_introduce:"Maybe you need to make a dapp that supports both Conflux and Ethereum, and don't want to maintain two similar pieces of code.",demo_send_transaction_title:"Send Transaction",demo_send_transaction_introduce:"This example demonstrates how to send a transaction.",demo_sign_title:"Sign",demo_sign_introduce:"Use use-wallet wrapped personalSign and typedSign method signatures.",demo_addSwitch_title:"add/switch chain and watchAsset",demo_addSwitch_introduce:"Add/switch chain and add token using use-wallet wrapper methods"},zh:{demo_connect_title:"\u8FDE\u63A5 fluent \u94B1\u5305",demo_connect_introduce:"Dapp \u7684\u7B2C\u4E00\u6B65\uFF0C\u8FDE\u63A5\u4F60\u7684\u94B1\u5305\u3002\u7136\u540E\u53EF\u4EE5\u83B7\u53D6\u5F53\u524D\u8D26\u6237\u7684\u4FE1\u606F\u3002",demo_connect_both_title:"\u540C\u65F6\u8FDE\u63A5 fluent \u548C metamask",demo_connect_both_introduce:"\u9700\u8981\u8DE8\u94FE\u7684 dapp\uFF0C\u6216\u8005\u662F conflux \u8DE8space \u7684 dapp\uFF0C\u9700\u8981\u540C\u65F6\u8FDE\u63A5\u591A\u4E2A\u94B1\u5305\u3002",demo_connect_switch_title:"\u540C\u4E00\u4EFD\u4EE3\u7801\u5207\u6362\u8FDE\u63A5\u7684\u94B1\u5305",demo_connect_switch_introduce:"\u4E5F\u8BB8\u4F60\u9700\u8981\u505A\u4E00\u4E2A\u540C\u65F6\u652F\u6301 Conflux \u548C Ethereum \u7684 dapp\uFF0C\u53C8\u4E0D\u60F3\u7EF4\u62A4\u4E24\u4EFD\u76F8\u4F3C\u7684\u4EE3\u7801\u3002",demo_send_transaction_title:"\u53D1\u8D77\u4EA4\u6613",demo_send_transaction_introduce:"\u8FD9\u4E2A\u4F8B\u5B50\u6F14\u793A\u4E86\u5982\u4F55\u53D1\u8D77\u4E00\u7B14\u4EA4\u6613\u3002",demo_sign_title:"\u7B7E\u540D",demo_sign_introduce:"\u4F7F\u7528 use-wallet \u5C01\u88C5\u7684 personalSign \u548C typedSign \u7684\u65B9\u6CD5\u7B7E\u540D\u3002",demo_addSwitch_title:"\u6DFB\u52A0/\u5207\u6362\u94FE \u4EE5\u53CA \u6DFB\u52A0token",demo_addSwitch_introduce:"\u4F7F\u7528 use-wallet \u5C01\u88C5\u65B9\u6CD5 \u6DFB\u52A0/\u5207\u6362\u94FE \u4EE5\u53CA \u6DFB\u52A0token\u3002"}},Um=()=>{const e=Fe(eF),[t,n]=C.exports.useState(()=>{const g=localStorage.getItem("current-demo");return!g||!$m[g]?"demo_connect_title":g}),[r,i]=FS(),o=C.exports.useMemo(()=>$m[t],[t]),a=C.exports.useCallback(g=>{n(g),s(!1),localStorage.setItem("current-demo",g)},[]),[u,s]=C.exports.useState(!1),l=C.exports.useCallback(()=>s(!0),[]),d=C.exports.useCallback(()=>s(!1),[]),c=SS(d);C.exports.useEffect(()=>{ba.mount();const g=ba.bind("esc",d);return()=>{ba.unmount(),g&&ba.unbind(g)}},[]);const f=Fl(),p=Zc({ref:f,config:{duration:150,clamp:!0},from:{opacity:1},to:{opacity:u?0:1}}),y=Fl(),m=Zc({ref:y,config:{...Lv.stiff,clamp:!0},from:{borderColor:"transparent",translateX:"-50%",width:480,height:i.height},to:{translateX:"-50%",width:u?Math.min(window.innerWidth*.8,1024):480,height:u?460:i.height,borderColor:u?"var(--color-primary)":"transparent"}}),E=Fl(),h=Vf(u?dd:[],{keys:g=>g.title,ref:E,trail:300/dd.length,config:{clamp:!0},from:{opacity:0,scale:0},enter:{opacity:1,scale:1},leave:{opacity:0,scale:0}});return K6(u?[f,y,E]:[E,y,f],u?[0,.1,.2]:[0,.48,.57]),N(Nt,{children:[v(gr.dl,{ref:c,className:ge("absolute top-12 left-1/2 translate-x-[-50%] max-w-[1024px] rounded-md bg-primarytrans dark:bg-[#4b5563] border-4 border-transparent contain-strict transition-colors not-transition-border-color z-10",!u&&"pointer-events-none"),style:m,children:v(vv,{className:"h-[460px]",contentClassName:"w-full pt-4 pb-5 flex flex-wrap justify-center items-stretch gap-4",children:h((g,w)=>w&&N(gr.div,{className:ge("w-[480px] max-w-[100%] px-6 py-4 rounded-md shadow-md border-2 border-transparent transition-colors hover:border-primary bg-white dark:bg-[#374151]",w.title===o.title?"border-primary pointer-events-none":"hover:border-dashed cursor-pointer"),style:g,onClick:()=>a(w.title),children:[v("div",{className:"text-lg font-semibold text-text1 transition-colors",children:e[w.title]}),v("div",{className:"mt-4 text-base text-text2 transition-colors",children:e[w.introduce]})]}))})}),N(gr.div,{ref:r,className:ge("absolute top-12 left-1/2 translate-x-[-50%] w-[480px] max-w-[100%] px-6 py-4 rounded-md bg-primarytrans dark:bg-[#4b5563] shadow-md dark:shadow-none contain-content transition-colors z-20",u&&"pointer-events-none"),style:p,children:[N("div",{className:"relative text-lg font-semibold text-text1 transition-colors",children:[v("p",{className:"w-[55%]",children:e[o.title]}),v("a",{className:"button absolute w-10 p-0 h-8 text-sm top-0 right-[7.5rem]",href:o.code,target:"_blank",rel:"nofollow noopener noreferrer",title:o.code,children:v("img",{className:"w-5 h-5 max-w-none",src:J3,alt:"code"})}),v("button",{className:"button absolute px-2 h-8 text-sm top-0 right-0",onClick:l,children:"More Demo"})]}),v("div",{className:"relative mt-4 text-base text-text2 transition-colors",children:e[o.introduce]})]}),v(tF,{Demo:o.Demo,mt:Math.max(280,i.height+100)})]})},tF=C.exports.memo(({Demo:e,mt:t=280})=>v("div",{className:"mx-auto w-[600px] flex flex-col justify-center",style:{marginTop:t},children:v(e,{})})),nF=()=>{const{pathname:e}=kn(),t=e.split("/")[3]||"basic";return N("div",{className:"docs py-8 max-w-6xl mx-auto px-4 sm:px-6 lg:px-8",children:[v("h2",{className:"capitalize text-center",children:t}),v(_4,{})]})},yy=C.exports.createContext("dark"),up=()=>C.exports.useContext(yy),rF=["react","vue3","svelte"],wy=["basic","hooks","function","utils","others","FAQ"],iF=()=>{const e=up(),{pathname:t}=kn(),n=t.split("/")[2]||"react",r=t.split("/")[3]||"basic";return N(Nt,{children:[v("div",{className:"mt-6 flex justify-center items-end gap-5 h-10",children:rF.map(i=>N(Rc,{className:ge("relative text-center transition-colors px-3 ml-4 capitalize",e==="light"?"h-full flex justify-center items-center":"h-10 leading-10 rounded-md",n!==i&&"hover:text-text1 cursor-pointer",n===i?"pointer-events-none text-text1":"text-text2",n===i&&e==="dark"&&"bg-[#4b5563]",n!==i&&e==="dark"&&"hover:bg-[#374151]"),to:`${i}/${r}`,children:[i,e==="light"&&v("span",{className:ge("absolute w-full left-0 bottom-0 h-1 rounded-sm bg-primary opacity-0 transition-opacity",n===i&&"opacity-100")})]},i))}),v("div",{className:"mt-2 flex justify-center items-end gap-5 h-10",children:wy.map(i=>N(Rc,{className:ge("relative text-center transition-colors px-3 ml-4 capitalize",e==="light"?"h-full flex justify-center items-center":"h-10 leading-10 rounded-md",r!==i&&"hover:text-text1 cursor-pointer",r===i?"pointer-events-none text-text1":"text-text2",r===i&&e==="dark"&&"bg-[#4b5563]",r!==i&&e==="dark"&&"hover:bg-[#374151]"),to:`${n}/${i}`,children:[i,e==="light"&&v("span",{className:ge("absolute w-full left-0 bottom-0 h-1 rounded-sm bg-primary opacity-0 transition-opacity",r===i&&"opacity-100")})]},i))}),v(oF,{currentCataloguePath:r})]})},oF=C.exports.memo(({currentCataloguePath:e})=>{const[t,n]=C.exports.useState([]),[r,i]=C.exports.useState(""),o=wy.find(l=>l===e),a=C.exports.useRef([]),u=C.exports.useRef(null);C.exports.useEffect(()=>{var m,E;u.current||(u.current=(m=document.querySelector(".scroll-content"))==null?void 0:m.parentNode);const l=u.current;if(l.scrollTo({top:0}),!o||!l)return;const d=Array.from(document.querySelectorAll("h3"));if(!(d!=null&&d.length))return;n(d),i((E=d[0].textContent)!=null?E:"");let c=l.scrollHeight-l.clientHeight,f=!0;const p=()=>{a.current=d.map(h=>({top:h.offsetTop-128,name:h.textContent})),c=l.scrollHeight-l.clientHeight,f=a.current.length>=2&&c>a.current[a.current.length-2].top,f||(a.current[a.current.length-2].cannotReach=!0)};window.addEventListener("resize",p),p();const y=au(()=>{if(!f&&Math.abs(l.scrollTop-c)<=4){i(d[d.length-1].textContent);return}const h=a.current.find(g=>g.top>=l.scrollTop);!h||i(h.name)},24);return l.addEventListener("scroll",y),()=>{l.removeEventListener("scroll",y),window.removeEventListener("resize",p)}},[o]);const s=C.exports.useCallback(l=>{const d=a.current.findIndex(f=>f.name===l.target.textContent);if(d===-1||!u.current)return;const c=a.current[d];u.current.scrollTo({top:d===0?0:c.cannotReach?u.current.scrollHeight-u.current.clientHeight-40:c.top,behavior:"smooth"})},[]);return v("div",{className:"fixed flex-col hidden xl:flex left-[50%] top-[33.5%] translate-x-[600px] translate-y-[-50%]",children:t==null?void 0:t.map(l=>v("a",{className:ge("h-8 cursor-pointer transition-colors",r===l.textContent?"text-primary":"text-text2"),onClick:s,children:l.textContent},l.textContent))})}),aF=()=>N(Nt,{children:[v(iF,{}),v(nF,{})]});/** + */var Vr=9e15,ur=1e9,Jc="0123456789abcdef",Ts="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Ms="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",ed={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-Vr,maxE:Vr,crypto:!1},ty,mn,ee=!0,yu="[DecimalError] ",rr=yu+"Invalid argument: ",ny=yu+"Precision limit exceeded",ry=yu+"crypto unavailable",iy="[object Decimal]",rt=Math.floor,Ue=Math.pow,XS=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,QS=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,ZS=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,oy=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Kt=1e7,Q=7,JS=9007199254740991,eb=Ts.length-1,td=Ms.length-1,T={toStringTag:iy};T.absoluteValue=T.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),G(e)};T.ceil=function(){return G(new this.constructor(this),this.e+1,2)};T.clampedTo=T.clamp=function(e,t){var n,r=this,i=r.constructor;if(e=new i(e),t=new i(t),!e.s||!t.s)return new i(NaN);if(e.gt(t))throw Error(rr+t);return n=r.cmp(e),n<0?e:r.cmp(t)>0?t:new i(r)};T.comparedTo=T.cmp=function(e){var t,n,r,i,o=this,a=o.d,u=(e=new o.constructor(e)).d,s=o.s,l=e.s;if(!a||!u)return!s||!l?NaN:s!==l?s:a===u?0:!a^s<0?1:-1;if(!a[0]||!u[0])return a[0]?s:u[0]?-l:0;if(s!==l)return s;if(o.e!==e.e)return o.e>e.e^s<0?1:-1;for(r=a.length,i=u.length,t=0,n=ru[t]^s<0?1:-1;return r===i?0:r>i^s<0?1:-1};T.cosine=T.cos=function(){var e,t,n=this,r=n.constructor;return n.d?n.d[0]?(e=r.precision,t=r.rounding,r.precision=e+Math.max(n.e,n.sd())+Q,r.rounding=1,n=tb(r,cy(r,n)),r.precision=e,r.rounding=t,G(mn==2||mn==3?n.neg():n,e,t,!0)):new r(1):new r(NaN)};T.cubeRoot=T.cbrt=function(){var e,t,n,r,i,o,a,u,s,l,d=this,c=d.constructor;if(!d.isFinite()||d.isZero())return new c(d);for(ee=!1,o=d.s*Ue(d.s*d,1/3),!o||Math.abs(o)==1/0?(n=Ke(d.d),e=d.e,(o=(e-n.length+1)%3)&&(n+=o==1||o==-2?"0":"00"),o=Ue(n,1/3),e=rt((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),r=new c(n),r.s=d.s):r=new c(o.toString()),a=(e=c.precision)+3;;)if(u=r,s=u.times(u).times(u),l=s.plus(d),r=pe(l.plus(d).times(u),l.plus(s),a+2,1),Ke(u.d).slice(0,a)===(n=Ke(r.d)).slice(0,a))if(n=n.slice(a-3,a+1),n=="9999"||!i&&n=="4999"){if(!i&&(G(u,e+1,0),u.times(u).times(u).eq(d))){r=u;break}a+=4,i=1}else{(!+n||!+n.slice(1)&&n.charAt(0)=="5")&&(G(r,e+1,1),t=!r.times(r).times(r).eq(d));break}return ee=!0,G(r,e,c.rounding,t)};T.decimalPlaces=T.dp=function(){var e,t=this.d,n=NaN;if(t){if(e=t.length-1,n=(e-rt(this.e/Q))*Q,e=t[e],e)for(;e%10==0;e/=10)n--;n<0&&(n=0)}return n};T.dividedBy=T.div=function(e){return pe(this,new this.constructor(e))};T.dividedToIntegerBy=T.divToInt=function(e){var t=this,n=t.constructor;return G(pe(t,new n(e),0,1,1),n.precision,n.rounding)};T.equals=T.eq=function(e){return this.cmp(e)===0};T.floor=function(){return G(new this.constructor(this),this.e+1,3)};T.greaterThan=T.gt=function(e){return this.cmp(e)>0};T.greaterThanOrEqualTo=T.gte=function(e){var t=this.cmp(e);return t==1||t===0};T.hyperbolicCosine=T.cosh=function(){var e,t,n,r,i,o=this,a=o.constructor,u=new a(1);if(!o.isFinite())return new a(o.s?1/0:NaN);if(o.isZero())return u;n=a.precision,r=a.rounding,a.precision=n+Math.max(o.e,o.sd())+4,a.rounding=1,i=o.d.length,i<32?(e=Math.ceil(i/3),t=(1/Eu(4,e)).toString()):(e=16,t="2.3283064365386962890625e-10"),o=ci(a,1,o.times(t),new a(1),!0);for(var s,l=e,d=new a(8);l--;)s=o.times(o),o=u.minus(s.times(d.minus(s.times(d))));return G(o,a.precision=n,a.rounding=r,!0)};T.hyperbolicSine=T.sinh=function(){var e,t,n,r,i=this,o=i.constructor;if(!i.isFinite()||i.isZero())return new o(i);if(t=o.precision,n=o.rounding,o.precision=t+Math.max(i.e,i.sd())+4,o.rounding=1,r=i.d.length,r<3)i=ci(o,2,i,i,!0);else{e=1.4*Math.sqrt(r),e=e>16?16:e|0,i=i.times(1/Eu(5,e)),i=ci(o,2,i,i,!0);for(var a,u=new o(5),s=new o(16),l=new o(20);e--;)a=i.times(i),i=i.times(u.plus(a.times(s.times(a).plus(l))))}return o.precision=t,o.rounding=n,G(i,t,n,!0)};T.hyperbolicTangent=T.tanh=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+7,r.rounding=1,pe(n.sinh(),n.cosh(),r.precision=e,r.rounding=t)):new r(n.s)};T.inverseCosine=T.acos=function(){var e,t=this,n=t.constructor,r=t.abs().cmp(1),i=n.precision,o=n.rounding;return r!==-1?r===0?t.isNeg()?Wt(n,i,o):new n(0):new n(NaN):t.isZero()?Wt(n,i+4,o).times(.5):(n.precision=i+6,n.rounding=1,t=t.asin(),e=Wt(n,i+4,o).times(.5),n.precision=i,n.rounding=o,e.minus(t))};T.inverseHyperbolicCosine=T.acosh=function(){var e,t,n=this,r=n.constructor;return n.lte(1)?new r(n.eq(1)?0:NaN):n.isFinite()?(e=r.precision,t=r.rounding,r.precision=e+Math.max(Math.abs(n.e),n.sd())+4,r.rounding=1,ee=!1,n=n.times(n).minus(1).sqrt().plus(n),ee=!0,r.precision=e,r.rounding=t,n.ln()):new r(n)};T.inverseHyperbolicSine=T.asinh=function(){var e,t,n=this,r=n.constructor;return!n.isFinite()||n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+2*Math.max(Math.abs(n.e),n.sd())+6,r.rounding=1,ee=!1,n=n.times(n).plus(1).sqrt().plus(n),ee=!0,r.precision=e,r.rounding=t,n.ln())};T.inverseHyperbolicTangent=T.atanh=function(){var e,t,n,r,i=this,o=i.constructor;return i.isFinite()?i.e>=0?new o(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=o.precision,t=o.rounding,r=i.sd(),Math.max(r,e)<2*-i.e-1?G(new o(i),e,t,!0):(o.precision=n=r-i.e,i=pe(i.plus(1),new o(1).minus(i),n+e,1),o.precision=e+4,o.rounding=1,i=i.ln(),o.precision=e,o.rounding=t,i.times(.5))):new o(NaN)};T.inverseSine=T.asin=function(){var e,t,n,r,i=this,o=i.constructor;return i.isZero()?new o(i):(t=i.abs().cmp(1),n=o.precision,r=o.rounding,t!==-1?t===0?(e=Wt(o,n+4,r).times(.5),e.s=i.s,e):new o(NaN):(o.precision=n+6,o.rounding=1,i=i.div(new o(1).minus(i.times(i)).sqrt().plus(1)).atan(),o.precision=n,o.rounding=r,i.times(2)))};T.inverseTangent=T.atan=function(){var e,t,n,r,i,o,a,u,s,l=this,d=l.constructor,c=d.precision,f=d.rounding;if(l.isFinite()){if(l.isZero())return new d(l);if(l.abs().eq(1)&&c+4<=td)return a=Wt(d,c+4,f).times(.25),a.s=l.s,a}else{if(!l.s)return new d(NaN);if(c+4<=td)return a=Wt(d,c+4,f).times(.5),a.s=l.s,a}for(d.precision=u=c+10,d.rounding=1,n=Math.min(28,u/Q+2|0),e=n;e;--e)l=l.div(l.times(l).plus(1).sqrt().plus(1));for(ee=!1,t=Math.ceil(u/Q),r=1,s=l.times(l),a=new d(l),i=l;e!==-1;)if(i=i.times(s),o=a.minus(i.div(r+=2)),i=i.times(s),a=o.plus(i.div(r+=2)),a.d[t]!==void 0)for(e=t;a.d[e]===o.d[e]&&e--;);return n&&(a=a.times(2<this.d.length-2};T.isNaN=function(){return!this.s};T.isNegative=T.isNeg=function(){return this.s<0};T.isPositive=T.isPos=function(){return this.s>0};T.isZero=function(){return!!this.d&&this.d[0]===0};T.lessThan=T.lt=function(e){return this.cmp(e)<0};T.lessThanOrEqualTo=T.lte=function(e){return this.cmp(e)<1};T.logarithm=T.log=function(e){var t,n,r,i,o,a,u,s,l=this,d=l.constructor,c=d.precision,f=d.rounding,p=5;if(e==null)e=new d(10),t=!0;else{if(e=new d(e),n=e.d,e.s<0||!n||!n[0]||e.eq(1))return new d(NaN);t=e.eq(10)}if(n=l.d,l.s<0||!n||!n[0]||l.eq(1))return new d(n&&!n[0]?-1/0:l.s!=1?NaN:n?0:1/0);if(t)if(n.length>1)o=!0;else{for(i=n[0];i%10===0;)i/=10;o=i!==1}if(ee=!1,u=c+p,a=jn(l,u),r=t?Ps(d,u+10):jn(e,u),s=pe(a,r,u,1),Lo(s.d,i=c,f))do if(u+=10,a=jn(l,u),r=t?Ps(d,u+10):jn(e,u),s=pe(a,r,u,1),!o){+Ke(s.d).slice(i+1,i+15)+1==1e14&&(s=G(s,c+1,0));break}while(Lo(s.d,i+=10,f));return ee=!0,G(s,c,f)};T.minus=T.sub=function(e){var t,n,r,i,o,a,u,s,l,d,c,f,p=this,y=p.constructor;if(e=new y(e),!p.d||!e.d)return!p.s||!e.s?e=new y(NaN):p.d?e.s=-e.s:e=new y(e.d||p.s!==e.s?p:NaN),e;if(p.s!=e.s)return e.s=-e.s,p.plus(e);if(l=p.d,f=e.d,u=y.precision,s=y.rounding,!l[0]||!f[0]){if(f[0])e.s=-e.s;else if(l[0])e=new y(p);else return new y(s===3?-0:0);return ee?G(e,u,s):e}if(n=rt(e.e/Q),d=rt(p.e/Q),l=l.slice(),o=d-n,o){for(c=o<0,c?(t=l,o=-o,a=f.length):(t=f,n=d,a=l.length),r=Math.max(Math.ceil(u/Q),a)+2,o>r&&(o=r,t.length=1),t.reverse(),r=o;r--;)t.push(0);t.reverse()}else{for(r=l.length,a=f.length,c=r0;--r)l[a++]=0;for(r=f.length;r>o;){if(l[--r]a?o+1:a+1,i>a&&(i=a,n.length=1),n.reverse();i--;)n.push(0);n.reverse()}for(a=l.length,i=d.length,a-i<0&&(i=a,n=d,d=l,l=n),t=0;i;)t=(l[--i]=l[i]+d[i]+t)/Kt|0,l[i]%=Kt;for(t&&(l.unshift(t),++r),a=l.length;l[--a]==0;)l.pop();return e.d=l,e.e=wu(l,r),ee?G(e,u,s):e};T.precision=T.sd=function(e){var t,n=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(rr+e);return n.d?(t=ay(n.d),e&&n.e+1>t&&(t=n.e+1)):t=NaN,t};T.round=function(){var e=this,t=e.constructor;return G(new t(e),e.e+1,t.rounding)};T.sine=T.sin=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+Math.max(n.e,n.sd())+Q,r.rounding=1,n=rb(r,cy(r,n)),r.precision=e,r.rounding=t,G(mn>2?n.neg():n,e,t,!0)):new r(NaN)};T.squareRoot=T.sqrt=function(){var e,t,n,r,i,o,a=this,u=a.d,s=a.e,l=a.s,d=a.constructor;if(l!==1||!u||!u[0])return new d(!l||l<0&&(!u||u[0])?NaN:u?a:1/0);for(ee=!1,l=Math.sqrt(+a),l==0||l==1/0?(t=Ke(u),(t.length+s)%2==0&&(t+="0"),l=Math.sqrt(t),s=rt((s+1)/2)-(s<0||s%2),l==1/0?t="5e"+s:(t=l.toExponential(),t=t.slice(0,t.indexOf("e")+1)+s),r=new d(t)):r=new d(l.toString()),n=(s=d.precision)+3;;)if(o=r,r=o.plus(pe(a,o,n+2,1)).times(.5),Ke(o.d).slice(0,n)===(t=Ke(r.d)).slice(0,n))if(t=t.slice(n-3,n+1),t=="9999"||!i&&t=="4999"){if(!i&&(G(o,s+1,0),o.times(o).eq(a))){r=o;break}n+=4,i=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(G(r,s+1,1),e=!r.times(r).eq(a));break}return ee=!0,G(r,s,d.rounding,e)};T.tangent=T.tan=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+10,r.rounding=1,n=n.sin(),n.s=1,n=pe(n,new r(1).minus(n.times(n)).sqrt(),e+10,0),r.precision=e,r.rounding=t,G(mn==2||mn==4?n.neg():n,e,t,!0)):new r(NaN)};T.times=T.mul=function(e){var t,n,r,i,o,a,u,s,l,d=this,c=d.constructor,f=d.d,p=(e=new c(e)).d;if(e.s*=d.s,!f||!f[0]||!p||!p[0])return new c(!e.s||f&&!f[0]&&!p||p&&!p[0]&&!f?NaN:!f||!p?e.s/0:e.s*0);for(n=rt(d.e/Q)+rt(e.e/Q),s=f.length,l=p.length,s=0;){for(t=0,i=s+r;i>r;)u=o[i]+p[r]*f[i-r-1]+t,o[i--]=u%Kt|0,t=u/Kt|0;o[i]=(o[i]+t)%Kt|0}for(;!o[--a];)o.pop();return t?++n:o.shift(),e.d=o,e.e=wu(o,n),ee?G(e,c.precision,c.rounding):e};T.toBinary=function(e,t){return Kf(this,2,e,t)};T.toDecimalPlaces=T.toDP=function(e,t){var n=this,r=n.constructor;return n=new r(n),e===void 0?n:(vt(e,0,ur),t===void 0?t=r.rounding:vt(t,0,8),G(n,e+n.e+1,t))};T.toExponential=function(e,t){var n,r=this,i=r.constructor;return e===void 0?n=ln(r,!0):(vt(e,0,ur),t===void 0?t=i.rounding:vt(t,0,8),r=G(new i(r),e+1,t),n=ln(r,!0,e+1)),r.isNeg()&&!r.isZero()?"-"+n:n};T.toFixed=function(e,t){var n,r,i=this,o=i.constructor;return e===void 0?n=ln(i):(vt(e,0,ur),t===void 0?t=o.rounding:vt(t,0,8),r=G(new o(i),e+i.e+1,t),n=ln(r,!1,e+r.e+1)),i.isNeg()&&!i.isZero()?"-"+n:n};T.toFraction=function(e){var t,n,r,i,o,a,u,s,l,d,c,f,p=this,y=p.d,m=p.constructor;if(!y)return new m(p);if(l=n=new m(1),r=s=new m(0),t=new m(r),o=t.e=ay(y)-p.e-1,a=o%Q,t.d[0]=Ue(10,a<0?Q+a:a),e==null)e=o>0?t:l;else{if(u=new m(e),!u.isInt()||u.lt(l))throw Error(rr+u);e=u.gt(t)?o>0?t:l:u}for(ee=!1,u=new m(Ke(y)),d=m.precision,m.precision=o=y.length*Q*2;c=pe(u,t,0,1,1),i=n.plus(c.times(r)),i.cmp(e)!=1;)n=r,r=i,i=l,l=s.plus(c.times(i)),s=i,i=t,t=u.minus(c.times(i)),u=i;return i=pe(e.minus(n),r,0,1,1),s=s.plus(i.times(l)),n=n.plus(i.times(r)),s.s=l.s=p.s,f=pe(l,r,o,1).minus(p).abs().cmp(pe(s,n,o,1).minus(p).abs())<1?[l,r]:[s,n],m.precision=d,ee=!0,f};T.toHexadecimal=T.toHex=function(e,t){return Kf(this,16,e,t)};T.toNearest=function(e,t){var n=this,r=n.constructor;if(n=new r(n),e==null){if(!n.d)return n;e=new r(1),t=r.rounding}else{if(e=new r(e),t===void 0?t=r.rounding:vt(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]?(ee=!1,n=pe(n,e,0,t,1).times(e),ee=!0,G(n)):(e.s=n.s,n=e),n};T.toNumber=function(){return+this};T.toOctal=function(e,t){return Kf(this,8,e,t)};T.toPower=T.pow=function(e){var t,n,r,i,o,a,u=this,s=u.constructor,l=+(e=new s(e));if(!u.d||!e.d||!u.d[0]||!e.d[0])return new s(Ue(+u,l));if(u=new s(u),u.eq(1))return u;if(r=s.precision,o=s.rounding,e.eq(1))return G(u,r,o);if(t=rt(e.e/Q),t>=e.d.length-1&&(n=l<0?-l:l)<=JS)return i=sy(s,u,n,r),e.s<0?new s(1).div(i):G(i,r,o);if(a=u.s,a<0){if(ts.maxE+1||t0?a/0:0):(ee=!1,s.rounding=u.s=1,n=Math.min(12,(t+"").length),i=nd(e.times(jn(u,r+n)),r),i.d&&(i=G(i,r+5,1),Lo(i.d,r,o)&&(t=r+10,i=G(nd(e.times(jn(u,t+n)),t),t+5,1),+Ke(i.d).slice(r+1,r+15)+1==1e14&&(i=G(i,r+1,0)))),i.s=a,ee=!0,s.rounding=o,G(i,r,o))};T.toPrecision=function(e,t){var n,r=this,i=r.constructor;return e===void 0?n=ln(r,r.e<=i.toExpNeg||r.e>=i.toExpPos):(vt(e,1,ur),t===void 0?t=i.rounding:vt(t,0,8),r=G(new i(r),e,t),n=ln(r,e<=r.e||r.e<=i.toExpNeg,e)),r.isNeg()&&!r.isZero()?"-"+n:n};T.toSignificantDigits=T.toSD=function(e,t){var n=this,r=n.constructor;return e===void 0?(e=r.precision,t=r.rounding):(vt(e,1,ur),t===void 0?t=r.rounding:vt(t,0,8)),G(new r(n),e,t)};T.toString=function(){var e=this,t=e.constructor,n=ln(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?"-"+n:n};T.truncated=T.trunc=function(){return G(new this.constructor(this),this.e+1,1)};T.valueOf=T.toJSON=function(){var e=this,t=e.constructor,n=ln(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?"-"+n:n};function Ke(e){var t,n,r,i=e.length-1,o="",a=e[0];if(i>0){for(o+=a,t=1;tn)throw Error(rr+e)}function Lo(e,t,n,r){var i,o,a,u;for(o=e[0];o>=10;o/=10)--t;return--t<0?(t+=Q,i=0):(i=Math.ceil((t+1)/Q),t%=Q),o=Ue(10,Q-t),u=e[i]%o|0,r==null?t<3?(t==0?u=u/100|0:t==1&&(u=u/10|0),a=n<4&&u==99999||n>3&&u==49999||u==5e4||u==0):a=(n<4&&u+1==o||n>3&&u+1==o/2)&&(e[i+1]/o/100|0)==Ue(10,t-2)-1||(u==o/2||u==0)&&(e[i+1]/o/100|0)==0:t<4?(t==0?u=u/1e3|0:t==1?u=u/100|0:t==2&&(u=u/10|0),a=(r||n<4)&&u==9999||!r&&n>3&&u==4999):a=((r||n<4)&&u+1==o||!r&&n>3&&u+1==o/2)&&(e[i+1]/o/1e3|0)==Ue(10,t-3)-1,a}function Ga(e,t,n){for(var r,i=[0],o,a=0,u=e.length;an-1&&(i[r+1]===void 0&&(i[r+1]=0),i[r+1]+=i[r]/n|0,i[r]%=n)}return i.reverse()}function tb(e,t){var n,r,i;if(t.isZero())return t;r=t.d.length,r<32?(n=Math.ceil(r/3),i=(1/Eu(4,n)).toString()):(n=16,i="2.3283064365386962890625e-10"),e.precision+=n,t=ci(e,1,t.times(i),new e(1));for(var o=n;o--;){var a=t.times(t);t=a.times(a).minus(a).times(8).plus(1)}return e.precision-=n,t}var pe=function(){function e(r,i,o){var a,u=0,s=r.length;for(r=r.slice();s--;)a=r[s]*i+u,r[s]=a%o|0,u=a/o|0;return u&&r.unshift(u),r}function t(r,i,o,a){var u,s;if(o!=a)s=o>a?1:-1;else for(u=s=0;ui[u]?1:-1;break}return s}function n(r,i,o,a){for(var u=0;o--;)r[o]-=u,u=r[o]1;)r.shift()}return function(r,i,o,a,u,s){var l,d,c,f,p,y,m,E,h,g,w,x,b,F,k,A,M,I,U,H,Z=r.constructor,j=r.s==i.s?1:-1,O=r.d,$=i.d;if(!O||!O[0]||!$||!$[0])return new Z(!r.s||!i.s||(O?$&&O[0]==$[0]:!$)?NaN:O&&O[0]==0||!$?j*0:j/0);for(s?(p=1,d=r.e-i.e):(s=Kt,p=Q,d=rt(r.e/p)-rt(i.e/p)),U=$.length,M=O.length,h=new Z(j),g=h.d=[],c=0;$[c]==(O[c]||0);c++);if($[c]>(O[c]||0)&&d--,o==null?(F=o=Z.precision,a=Z.rounding):u?F=o+(r.e-i.e)+1:F=o,F<0)g.push(1),y=!0;else{if(F=F/p+2|0,c=0,U==1){for(f=0,$=$[0],F++;(c1&&($=e($,f,s),O=e(O,f,s),U=$.length,M=O.length),A=U,w=O.slice(0,U),x=w.length;x=s/2&&++I;do f=0,l=t($,w,U,x),l<0?(b=w[0],U!=x&&(b=b*s+(w[1]||0)),f=b/I|0,f>1?(f>=s&&(f=s-1),m=e($,f,s),E=m.length,x=w.length,l=t(m,w,E,x),l==1&&(f--,n(m,U=10;f/=10)c++;h.e=c+d*p-1,G(h,u?o+h.e+1:o,a,y)}return h}}();function G(e,t,n,r){var i,o,a,u,s,l,d,c,f,p=e.constructor;e:if(t!=null){if(c=e.d,!c)return e;for(i=1,u=c[0];u>=10;u/=10)i++;if(o=t-i,o<0)o+=Q,a=t,d=c[f=0],s=d/Ue(10,i-a-1)%10|0;else if(f=Math.ceil((o+1)/Q),u=c.length,f>=u)if(r){for(;u++<=f;)c.push(0);d=s=0,i=1,o%=Q,a=o-Q+1}else break e;else{for(d=u=c[f],i=1;u>=10;u/=10)i++;o%=Q,a=o-Q+i,s=a<0?0:d/Ue(10,i-a-1)%10|0}if(r=r||t<0||c[f+1]!==void 0||(a<0?d:d%Ue(10,i-a-1)),l=n<4?(s||r)&&(n==0||n==(e.s<0?3:2)):s>5||s==5&&(n==4||r||n==6&&(o>0?a>0?d/Ue(10,i-a):0:c[f-1])%10&1||n==(e.s<0?8:7)),t<1||!c[0])return c.length=0,l?(t-=e.e+1,c[0]=Ue(10,(Q-t%Q)%Q),e.e=-t||0):c[0]=e.e=0,e;if(o==0?(c.length=f,u=1,f--):(c.length=f+1,u=Ue(10,Q-o),c[f]=a>0?(d/Ue(10,i-a)%Ue(10,a)|0)*u:0),l)for(;;)if(f==0){for(o=1,a=c[0];a>=10;a/=10)o++;for(a=c[0]+=u,u=1;a>=10;a/=10)u++;o!=u&&(e.e++,c[0]==Kt&&(c[0]=1));break}else{if(c[f]+=u,c[f]!=Kt)break;c[f--]=0,u=1}for(o=c.length;c[--o]===0;)c.pop()}return ee&&(e.e>p.maxE?(e.d=null,e.e=NaN):e.e0?o=o.charAt(0)+"."+o.slice(1)+Mn(r):a>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(e.e<0?"e":"e+")+e.e):i<0?(o="0."+Mn(-i-1)+o,n&&(r=n-a)>0&&(o+=Mn(r))):i>=a?(o+=Mn(i+1-a),n&&(r=n-i-1)>0&&(o=o+"."+Mn(r))):((r=i+1)0&&(i+1===a&&(o+="."),o+=Mn(r))),o}function wu(e,t){var n=e[0];for(t*=Q;n>=10;n/=10)t++;return t}function Ps(e,t,n){if(t>eb)throw ee=!0,n&&(e.precision=n),Error(ny);return G(new e(Ts),t,1,!0)}function Wt(e,t,n){if(t>td)throw Error(ny);return G(new e(Ms),t,n,!0)}function ay(e){var t=e.length-1,n=t*Q+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 Mn(e){for(var t="";e--;)t+="0";return t}function sy(e,t,n,r){var i,o=new e(1),a=Math.ceil(r/Q+4);for(ee=!1;;){if(n%2&&(o=o.times(t),Tm(o.d,a)&&(i=!0)),n=rt(n/2),n===0){n=o.d.length-1,i&&o.d[n]===0&&++o.d[n];break}t=t.times(t),Tm(t.d,a)}return ee=!0,o}function Im(e){return e.d[e.d.length-1]&1}function uy(e,t,n){for(var r,i=new e(t[0]),o=0;++o17)return new f(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:0/0);for(t==null?(ee=!1,s=y):s=t,u=new f(.03125);e.e>-2;)e=e.times(u),c+=5;for(r=Math.log(Ue(2,c))/Math.LN10*2+5|0,s+=r,n=o=a=new f(1),f.precision=s;;){if(o=G(o.times(e),s,1),n=n.times(++d),u=a.plus(pe(o,n,s,1)),Ke(u.d).slice(0,s)===Ke(a.d).slice(0,s)){for(i=c;i--;)a=G(a.times(a),s,1);if(t==null)if(l<3&&Lo(a.d,s-r,p,l))f.precision=s+=10,n=o=u=new f(1),d=0,l++;else return G(a,f.precision=y,p,ee=!0);else return f.precision=y,a}a=u}}function jn(e,t){var n,r,i,o,a,u,s,l,d,c,f,p=1,y=10,m=e,E=m.d,h=m.constructor,g=h.rounding,w=h.precision;if(m.s<0||!E||!E[0]||!m.e&&E[0]==1&&E.length==1)return new h(E&&!E[0]?-1/0:m.s!=1?NaN:E?0:m);if(t==null?(ee=!1,d=w):d=t,h.precision=d+=y,n=Ke(E),r=n.charAt(0),Math.abs(o=m.e)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)m=m.times(e),n=Ke(m.d),r=n.charAt(0),p++;o=m.e,r>1?(m=new h("0."+n),o++):m=new h(r+"."+n.slice(1))}else return l=Ps(h,d+2,w).times(o+""),m=jn(new h(r+"."+n.slice(1)),d-y).plus(l),h.precision=w,t==null?G(m,w,g,ee=!0):m;for(c=m,s=a=m=pe(m.minus(1),m.plus(1),d,1),f=G(m.times(m),d,1),i=3;;){if(a=G(a.times(f),d,1),l=s.plus(pe(a,new h(i),d,1)),Ke(l.d).slice(0,d)===Ke(s.d).slice(0,d))if(s=s.times(2),o!==0&&(s=s.plus(Ps(h,d+2,w).times(o+""))),s=pe(s,new h(p),d,1),t==null)if(Lo(s.d,d-y,g,u))h.precision=d+=y,l=a=m=pe(c.minus(1),c.plus(1),d,1),f=G(m.times(m),d,1),i=u=1;else return G(s,h.precision=w,g,ee=!0);else return h.precision=w,s;s=l,i+=2}}function ly(e){return String(e.s*e.s/0)}function rd(e,t){var n,r,i;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;t.charCodeAt(r)===48;r++);for(i=t.length;t.charCodeAt(i-1)===48;--i);if(t=t.slice(r,i),t){if(i-=r,e.e=n=n-r-1,e.d=[],r=(n+1)%Q,n<0&&(r+=Q),re.constructor.maxE?(e.d=null,e.e=NaN):e.e-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),oy.test(t))return rd(e,t)}else if(t==="Infinity"||t==="NaN")return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(QS.test(t))n=16,t=t.toLowerCase();else if(XS.test(t))n=2;else if(ZS.test(t))n=8;else throw Error(rr+t);for(o=t.search(/p/i),o>0?(s=+t.slice(o+1),t=t.substring(2,o)):t=t.slice(2),o=t.indexOf("."),a=o>=0,r=e.constructor,a&&(t=t.replace(".",""),u=t.length,o=u-o,i=sy(r,new r(n),o,o*2)),l=Ga(t,n,Kt),d=l.length-1,o=d;l[o]===0;--o)l.pop();return o<0?new r(e.s*0):(e.e=wu(l,d),e.d=l,ee=!1,a&&(e=pe(e,i,u*4)),s&&(e=e.times(Math.abs(s)<54?Ue(2,s):yt.pow(2,s))),ee=!0,e)}function rb(e,t){var n,r=t.d.length;if(r<3)return t.isZero()?t:ci(e,2,t,t);n=1.4*Math.sqrt(r),n=n>16?16:n|0,t=t.times(1/Eu(5,n)),t=ci(e,2,t,t);for(var i,o=new e(5),a=new e(16),u=new e(20);n--;)i=t.times(t),t=t.times(o.plus(i.times(a.times(i).minus(u))));return t}function ci(e,t,n,r,i){var o,a,u,s,l=e.precision,d=Math.ceil(l/Q);for(ee=!1,s=n.times(n),u=new e(r);;){if(a=pe(u.times(s),new e(t++*t++),l,1),u=i?r.plus(a):r.minus(a),r=pe(a.times(s),new e(t++*t++),l,1),a=u.plus(r),a.d[d]!==void 0){for(o=d;a.d[o]===u.d[o]&&o--;);if(o==-1)break}o=u,u=r,r=a,a=o}return ee=!0,a.d.length=d+1,a}function Eu(e,t){for(var n=e;--t;)n*=e;return n}function cy(e,t){var n,r=t.s<0,i=Wt(e,e.precision,1),o=i.times(.5);if(t=t.abs(),t.lte(o))return mn=r?4:1,t;if(n=t.divToInt(i),n.isZero())mn=r?3:2;else{if(t=t.minus(n.times(i)),t.lte(o))return mn=Im(n)?r?2:3:r?4:1,t;mn=Im(n)?r?1:4:r?3:2}return t.minus(i).abs()}function Kf(e,t,n,r){var i,o,a,u,s,l,d,c,f,p=e.constructor,y=n!==void 0;if(y?(vt(n,1,ur),r===void 0?r=p.rounding:vt(r,0,8)):(n=p.precision,r=p.rounding),!e.isFinite())d=ly(e);else{for(d=ln(e),a=d.indexOf("."),y?(i=2,t==16?n=n*4-3:t==8&&(n=n*3-2)):i=t,a>=0&&(d=d.replace(".",""),f=new p(1),f.e=d.length-a,f.d=Ga(ln(f),10,i),f.e=f.d.length),c=Ga(d,10,i),o=s=c.length;c[--s]==0;)c.pop();if(!c[0])d=y?"0p+0":"0";else{if(a<0?o--:(e=new p(e),e.d=c,e.e=o,e=pe(e,f,n,r,0,i),c=e.d,o=e.e,l=ty),a=c[n],u=i/2,l=l||c[n+1]!==void 0,l=r<4?(a!==void 0||l)&&(r===0||r===(e.s<0?3:2)):a>u||a===u&&(r===4||l||r===6&&c[n-1]&1||r===(e.s<0?8:7)),c.length=n,l)for(;++c[--n]>i-1;)c[n]=0,n||(++o,c.unshift(1));for(s=c.length;!c[s-1];--s);for(a=0,d="";a1)if(t==16||t==8){for(a=t==16?4:3,--s;s%a;s++)d+="0";for(c=Ga(d,i,t),s=c.length;!c[s-1];--s);for(a=1,d="1.";as)for(o-=s;o--;)d+="0";else ot)return e.length=t,!0}function ib(e){return new this(e).abs()}function ob(e){return new this(e).acos()}function ab(e){return new this(e).acosh()}function sb(e,t){return new this(e).plus(t)}function ub(e){return new this(e).asin()}function lb(e){return new this(e).asinh()}function cb(e){return new this(e).atan()}function db(e){return new this(e).atanh()}function fb(e,t){e=new this(e),t=new this(t);var n,r=this.precision,i=this.rounding,o=r+4;return!e.s||!t.s?n=new this(NaN):!e.d&&!t.d?(n=Wt(this,o,1).times(t.s>0?.25:.75),n.s=e.s):!t.d||e.isZero()?(n=t.s<0?Wt(this,r,i):new this(0),n.s=e.s):!e.d||t.isZero()?(n=Wt(this,o,1).times(.5),n.s=e.s):t.s<0?(this.precision=o,this.rounding=1,n=this.atan(pe(e,t,o,1)),t=Wt(this,o,1),this.precision=r,this.rounding=i,n=e.s<0?n.minus(t):n.plus(t)):n=this.atan(pe(e,t,o,1)),n}function pb(e){return new this(e).cbrt()}function hb(e){return G(e=new this(e),e.e+1,2)}function mb(e,t,n){return new this(e).clamp(t,n)}function gb(e){if(!e||typeof e!="object")throw Error(yu+"Object expected");var t,n,r,i=e.defaults===!0,o=["precision",1,ur,"rounding",0,8,"toExpNeg",-Vr,0,"toExpPos",0,Vr,"maxE",0,Vr,"minE",-Vr,0,"modulo",0,9];for(t=0;t=o[t+1]&&r<=o[t+2])this[n]=r;else throw Error(rr+n+": "+r);if(n="crypto",i&&(this[n]=ed[n]),(r=e[n])!==void 0)if(r===!0||r===!1||r===0||r===1)if(r)if(typeof crypto!="undefined"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[n]=!0;else throw Error(ry);else this[n]=!1;else throw Error(rr+n+": "+r);return this}function vb(e){return new this(e).cos()}function yb(e){return new this(e).cosh()}function dy(e){var t,n,r;function i(o){var a,u,s,l=this;if(!(l instanceof i))return new i(o);if(l.constructor=i,Mm(o)){l.s=o.s,ee?!o.d||o.e>i.maxE?(l.e=NaN,l.d=null):o.e=10;u/=10)a++;ee?a>i.maxE?(l.e=NaN,l.d=null):a=429e7?t[o]=crypto.getRandomValues(new Uint32Array(1))[0]:u[o++]=i%1e7;else if(crypto.randomBytes){for(t=crypto.randomBytes(r*=4);o=214e7?crypto.randomBytes(4).copy(t,o):(u.push(i%1e7),o+=4);o=r/4}else throw Error(ry);else for(;o=10;i/=10)r++;rt in e?Hb(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ie=(e,t,n)=>(Vb(e,typeof t!="symbol"?t+"":t,n),n);yt.set({precision:80});var ao=(e=18)=>{let t=e;return(typeof e!="number"||e<=0)&&(t=18),yt.pow(10,t)},Yf=e=>typeof e=="bigint",z=class{constructor(e){S(this,"value");S(this,"equals",e=>{const t=new z(e);return this.value.eq(t.value)});S(this,"lessThan",e=>{const t=new z(e);return this.value.lessThan(t.value)});S(this,"greaterThan",e=>{const t=new z(e);return this.value.greaterThan(t.value)});S(this,"lessThanOrEqualTo",e=>{const t=new z(e);return this.value.lessThanOrEqualTo(t.value)});S(this,"greaterThanOrEqualTo",e=>{const t=new z(e);return this.value.greaterThanOrEqualTo(t.value)});S(this,"add",e=>{const t=new z(e);return new z(this.value.add(t.value))});S(this,"sub",e=>{const t=new z(e);return new z(this.value.sub(t.value))});S(this,"mul",e=>{const t=new z(e);return new z(this.value.mul(t.value))});S(this,"div",e=>{const t=new z(e);return new z(this.value.div(t.value))});S(this,"pow",e=>{const t=new z(e);return new z(this.value.pow(t.value))});S(this,"log",e=>{const t=new z(e);return new z(this.value.log(t.value))});S(this,"sqrt",()=>new z(this.value.sqrt()));S(this,"mod",e=>{const t=new z(e);return new z(this.value.mod(t.value))});S(this,"equalsWith",e=>{const t=new z(e);return this.value.eq(t.value)});S(this,"isNaN",()=>this.value.isNaN());S(this,"isFinite",()=>this.value.isFinite());S(this,"toDecimalStandardUnit",(e,t=18)=>{if(typeof e=="number"&&e>=0){const n=this.value.div(ao(t)).toFixed();if(n==="NaN"||n.indexOf("Infinity")!==-1||n.indexOf("e")!==-1)return n;const r=n.indexOf(".");return e===0?n.slice(0,r):r===-1?n+"."+"0".repeat(e):n.length-r-1this.value.div(ao(e)).toHex());S(this,"toDecimalMinUnit",e=>{if(typeof e=="number"&&e>=0){const t=this.value.toFixed();if(t==="NaN"||t.indexOf("Infinity")!==-1||t.indexOf("e")!==-1)return t;const n=t.indexOf(".");return e===0?n===-1?t:t.slice(0,n):n===-1?t+"."+"0".repeat(e):t.length-n-1this.value.toHex());S(this,"toString",()=>this.toDecimalStandardUnit());S(this,"toDecimal",()=>this.value);z.isUnit(e)?this.value=e.value:yt.isDecimal(e)?this.value=e:this.value=new yt(Yf(e)?e.toString():e)}[Symbol.toPrimitive](e){return e=="string"?this.toDecimalStandardUnit():this.value}},ke=z;Ie(ke,"isUnit",e=>e instanceof z);Ie(ke,"fromStandardUnit",(e,t=18)=>yt.isDecimal(e)||z.isUnit(e)?new z(e.mul(ao(t))):new z(new yt(Yf(e)?e.toString():e).mul(ao(t))));Ie(ke,"fromMinUnit",e=>yt.isDecimal(e)||z.isUnit(e)?new z(e):new z(new yt(Yf(e)?e.toString():e)));Ie(ke,"fromDecimal",e=>z.fromMinUnit(e));Ie(ke,"equals",(e,t)=>{const n=new z(e),r=new z(t);return n.value.eq(r.value)});Ie(ke,"min",(e,t)=>{const n=new z(e),r=new z(t);return n.greaterThan(r)?r:n});Ie(ke,"max",(e,t)=>{const n=new z(e),r=new z(t);return n.greaterThan(r)?n:r});Ie(ke,"clamp",(e,t,n)=>{const r=new z(e),i=new z(t),o=new z(n);return r.greaterThan(o)?o:r.lessThan(i)?i:r});Ie(ke,"lessThan",(e,t)=>{const n=new z(e),r=new z(t);return n.value.lessThan(r.value)});Ie(ke,"greaterThan",(e,t)=>{const n=new z(e),r=new z(t);return n.value.greaterThan(r.value)});Ie(ke,"lessThanOrEqualTo",(e,t)=>{const n=new z(e),r=new z(t);return n.value.lessThanOrEqualTo(r.value)});Ie(ke,"greaterThanOrEqualTo",(e,t)=>{const n=new z(e),r=new z(t);return n.value.greaterThanOrEqualTo(r.value)});Ie(ke,"add",(e,t)=>{const n=new z(e),r=new z(t);return new z(n.value.add(r.value))});Ie(ke,"sub",(e,t)=>{const n=new z(e),r=new z(t);return new z(n.value.sub(r.value))});Ie(ke,"mul",(e,t)=>{const n=new z(e),r=new z(t);return new z(n.value.mul(r.value))});Ie(ke,"div",(e,t)=>{const n=new z(e),r=new z(t);return new z(n.value.div(r.value))});Ie(ke,"pow",(e,t)=>{const n=new z(e),r=new z(t);return new z(n.value.pow(r.value))});Ie(ke,"log",(e,t)=>{const n=new z(e),r=new z(t);return new z(n.value.log(r.value))});Ie(ke,"sqrt",e=>{const t=new z(e);return new z(t.value.sqrt())});Ie(ke,"mod",(e,t)=>{const n=new z(e),r=new z(t);return new z(n.value.mod(r.value))});Ie(ke,"isNaN",e=>typeof e!="object"?Number.isNaN(Number(e)):yt.isDecimal(e)||z.isUnit(e)?e.isNaN():!1);Ie(ke,"isFinite",e=>typeof e!="object"?Number.isFinite(Number(e)):yt.isDecimal(e)||z.isUnit(e)?e.isFinite():!1);var fy=ke;function Wb(e){return{all:e=e||new Map,on:function(t,n){var r=e.get(t);r?r.push(n):e.set(t,[n])},off:function(t,n){var r=e.get(t);r&&(n?r.splice(r.indexOf(n)>>>0,1):e.set(t,[]))},emit:function(t,n){var r=e.get(t);r&&r.slice().map(function(i){i(n)}),(r=e.get("*"))&&r.slice().map(function(i){i(t,n)})}}}var qb=class{constructor(e){S(this,"emitter",Wb());S(this,"state",{status:"in-detecting",accounts:void 0,chainId:void 0,balance:void 0});S(this,"trackBalanceInterval");S(this,"detectTimer");S(this,"trackBalanceChangeOnceCallback",[]);S(this,"RPCMethod");S(this,"provider");S(this,"resolveDetect");S(this,"detectPromise",new Promise(e=>this.resolveDetect=()=>{this.detectTimer&&clearTimeout(this.detectTimer),e()}));S(this,"handleStateChange",(e,t)=>{const n=this.state[e];let r=!1;switch(e){case"accounts":r=(n==null?void 0:n[0])!==(t==null?void 0:t[0]);break;case"balance":t!==void 0&&n!==void 0?r=!n.equalsWith(t):r=n!==t;break;default:r=n!==t}r&&(Object.assign(this.state,{[e]:t}),this.emitter.emit(e,t),e==="balance"&&this.trackBalanceChangeOnceCallback.length&&(this.trackBalanceChangeOnceCallback.forEach(i=>i()),this.trackBalanceChangeOnceCallback=[]))});S(this,"handleStatusChanged",e=>this.handleStateChange("status",e));S(this,"handleAccountsChanged",e=>{!!(e!=null&&e[0])?this.handleStatusChanged("active"):this.handleStatusChanged("not-active"),this.handleStateChange("accounts",e)});S(this,"handleChainChanged",e=>{if(!e||e==="0xNaN"){this.handleStateChange("chainId",void 0),this.handleAccountsChanged(void 0);return}this.handleStateChange("chainId",String(parseInt(e)))});S(this,"handleBalanceChanged",e=>{if(typeof e!="string"&&typeof e!="number"){this.handleStateChange("balance",void 0);return}this.handleStateChange("balance",fy.fromMinUnit(e))});S(this,"batchGetInfo",async({isRequestConnect:e}={isRequestConnect:!1})=>{try{const[t,n]=await Promise.all([this.RPCMethod.getChainId(),e?this.RPCMethod.requestAccounts():this.RPCMethod.getAccounts()]);this.RPCMethod.setAccounts(n);let r=setTimeout(()=>{this.handleChainChanged(t),this.handleAccountsChanged(n),this.handleBalanceChanged(void 0),this.resolveDetect(),r=void 0},1250);try{const i=await this.RPCMethod.getBalance();r!==void 0&&(clearTimeout(r),this.handleChainChanged(t),this.handleAccountsChanged(n)),this.handleBalanceChanged(i)}catch{r!==void 0&&(clearTimeout(r),this.handleChainChanged(t),this.handleAccountsChanged(n),this.handleBalanceChanged(void 0))}return n}catch(t){throw t}finally{this.resolveDetect()}});S(this,"checkConnected",e=>{var n;const t=(n=this.state.accounts)==null?void 0:n[0];if(!t)throw new Error(`${e} error: request connect to wallet.`);return t});S(this,"on",this.emitter.on);S(this,"off",this.emitter.off);S(this,"clear",this.emitter.all.clear);S(this,"completeDetect",()=>this.detectPromise);S(this,"startTrackBalance",(e=1500)=>{this.stopTrackBalance();const t=()=>{var i;const n=(i=this.state.accounts)==null?void 0:i[0],r=this.state.chainId;!r||r==="9007199254740991"||!n||this.RPCMethod.getBalance().then(o=>this.handleBalanceChanged(o))};t(),this.trackBalanceInterval=setInterval(t,e)});S(this,"stopTrackBalance",()=>{this.trackBalanceInterval!==void 0&&(clearInterval(this.trackBalanceInterval),this.trackBalanceInterval=void 0)});S(this,"trackBalanceChangeOnce",e=>{typeof e=="function"&&this.trackBalanceChangeOnceCallback.push(e)});S(this,"connect",async()=>{const e=this.state.status;if(e!=="not-active"){if(e==="active")return Promise.resolve(this.state.accounts);throw new Error(`Current status ${e} is not allowed to connect.`)}this.handleStatusChanged("in-activating");const t=this.batchGetInfo({isRequestConnect:!0});return t.catch(()=>this.handleStatusChanged("not-active")),t});S(this,"sendTransaction",e=>{if(!this.RPCMethod.sendTransaction)throw new Error("Current Wallet does'nt have sendTransaction method.");const t=this.checkConnected("sendTransaction");return this.RPCMethod.sendTransaction({...e,from:t,...e.value?{}:{value:"0x0"}})});S(this,"personalSign",e=>{if(!this.RPCMethod.personalSign)throw new Error("Current Wallet does'nt have personalSign method.");return this.checkConnected("personalSign"),this.RPCMethod.personalSign(e)});S(this,"typedSign",e=>{if(!this.RPCMethod.typedSign)throw new Error("Current Wallet does'nt have typedSign method.");return this.checkConnected("typedSign"),this.RPCMethod.typedSign(e)});S(this,"addChain",(e,t=!0)=>{if(!this.RPCMethod.addChain)throw new Error("Current Wallet does'nt have addChain method.");return t&&this.checkConnected("addChain"),this.RPCMethod.addChain(e)});S(this,"switchChain",e=>{if(!this.RPCMethod.switchChain)throw new Error("Current Wallet does'nt have switchChain method.");return this.checkConnected("switchChain"),this.RPCMethod.switchChain(e)});S(this,"watchAsset",e=>{if(!this.RPCMethod.watchAsset)throw new Error("Current Wallet does'nt have watchAsset method.");return this.checkConnected("watchAsset"),this.RPCMethod.watchAsset(e)});S(this,"requestPermissions",e=>{if(!this.RPCMethod.requestPermissions)throw new Error("Current Wallet does'nt have requestPermissions method.");return this.RPCMethod.requestPermissions(e)});S(this,"requestCrossNetworkPermission",()=>{if(!this.RPCMethod.requestCrossNetworkPermission)throw new Error("Current Wallet does'nt have requestCrossNetworkPermission method.");return this.RPCMethod.requestCrossNetworkPermission()});S(this,"setCrossNetworkChain",e=>{typeof e!="string"&&e!==void 0||(this.RPCMethod.crossNetworkChain=e,this.RPCMethod.getAccounts().then(t=>{this.RPCMethod.setAccounts(t),this.handleAccountsChanged(t)}))});this.RPCMethod=e,this.RPCMethod.detectAndSetProvider().then(t=>{this.batchGetInfo(),this.RPCMethod.onChainIdChange(()=>this.batchGetInfo()),this.RPCMethod.onAccountsChange(()=>this.batchGetInfo()),this.provider=t}).catch(()=>{this.handleStatusChanged("not-installed"),this.resolveDetect()}),this.detectTimer=setTimeout(()=>{if(console.error(`Unable to detect ${this.RPCMethod.sessionKey?"window."+this.RPCMethod.sessionKey.split("-")[0]:"wallet"}.`),this.RPCMethod.sessionKey){const t=Number(sessionStorage.getItem(this.RPCMethod.sessionKey)||0);if(t>=this.RPCMethod.retryLimit)throw new Error(`Unable to detect ${this.RPCMethod.sessionKey?"window."+this.RPCMethod.sessionKey.split("-")[0]:"wallet"}.`);sessionStorage.setItem(this.RPCMethod.sessionKey,String(t+1))}window.location.reload()},this.RPCMethod.detectTimeout)}},Cu=qb,Gb=class{constructor(){S(this,"account");S(this,"crossNetworkChain");S(this,"sessionKey");S(this,"retryLimit",2);S(this,"detectTimeout",1500);S(this,"detectAndSetProvider",()=>{const e=this.detectProvider();return e.then(t=>this.provider=t).catch(t=>console.warn(t)),e});S(this,"setAccounts",e=>{this.account=e==null?void 0:e[0]});S(this,"getProvider",()=>this.provider)}},Xf=Gb;function xu({silent:e=!1,interval:t=10,timeout:n=100,walletFlag:r,isSingleWalletFlag:i,injectFlag:o="ethereum",defaultWaltFlag:a}){return new Promise((u,s)=>{async function l(){let d=await Kb(o,t,n);if(!d)return s(`Unable to detect window.${o}.`);let c=!1,f=!1;const p=d.providers;if(p!=null&&p.length?typeof r!="string"||!r?a?d=p.find(y=>Il(y,a,i)):d=p[0]:d=p.find(y=>Il(y,r,i)):(c=typeof r=="string"&&!!r,f=c&&Il(d,r,i)),d&&!c||f)u(d);else{const y=`Non-${r} Wallet detected.`;!e&&console.error("detect-provider:",y),s(y)}}l()})}function Il(e,t,n=!1){const r=e?Object.keys(e).filter(i=>i==null?void 0:i.startsWith("is")):[];return!!e&&(n?r.length===1&&r[0]===t:r.includes(t))}var Kb=async(e,t,n)=>new Promise(r=>{const i=u=>{clearInterval(a),clearTimeout(o),r(u)},o=setTimeout(()=>{i(null)},n),a=setInterval(()=>{globalThis[e]&&i(globalThis[e])},t)}),Yb=+xs.version.split(".")[0]<18,Xb=typeof queueMicrotask=="function"?queueMicrotask:e=>Promise.resolve(null).then(e),Fa=[],ka=e=>Yb?function(){!Fa.length&&xs.unstable_batchedUpdates&&Xb(()=>{xs.unstable_batchedUpdates(()=>{Fa.forEach(t=>t()),Fa=[]})}),Fa.push(e.bind(null,...arguments))}:e,Qf=(e,t)=>{e.on("status",ka(n=>t.setState({status:n}))),e.on("accounts",ka(n=>t.setState({accounts:n}))),e.on("chainId",ka(n=>t.setState({chainId:n}))),e.on("balance",ka(n=>t.setState({balance:n})))},Lt={status:e=>e.status,chainId:e=>e.chainId,balance:e=>e.balance,accounts:e=>e.accounts,account:e=>{var t;return(t=e.accounts)==null?void 0:t[0]}},Qb=class extends Xf{constructor(){super(...arguments);S(this,"sessionKey","ethereum--isMetaMask");S(this,"detectProvider",()=>xu({injectFlag:"ethereum",defaultWaltFlag:"isMetaMask"}));S(this,"requestAccounts",()=>this.provider.request({method:"eth_requestAccounts"}));S(this,"getAccounts",()=>this.provider.request({method:"eth_accounts"}));S(this,"getChainId",()=>this.provider.request({method:"eth_chainId"}));S(this,"getBalance",async()=>{if(!this.account)throw new Error("getBalance error: must connect to wallet");try{return await this.provider.request({method:"eth_getBalance",params:[this.account,"latest"]})}catch(t){throw t}});S(this,"onAccountsChange",t=>this.provider.on("accountsChanged",t));S(this,"onChainIdChange",t=>this.provider.on("chainChanged",t));S(this,"sendTransaction",t=>this.provider.request({method:"eth_sendTransaction",params:[t]}));S(this,"personalSign",t=>this.provider.request({method:"personal_sign",params:[t,this.account]}));S(this,"typedSign",t=>this.provider.request({method:"eth_signTypedData_v4",params:[this.account,JSON.stringify(t)]}));S(this,"addChain",t=>this.provider.request({method:"wallet_addEthereumChain",params:[t]}));S(this,"switchChain",t=>this.provider.request({method:"wallet_switchEthereumChain",params:[{chainId:t}]}));S(this,"watchAsset",t=>this.provider.request({method:"wallet_watchAsset",params:t}));S(this,"isHostedByFluent",()=>this.provider===window.conflux);S(this,"requestPermissions",t=>this.provider.request({method:"wallet_requestPermissions",params:[t]}));S(this,"requestCrossNetworkPermission",()=>this.isHostedByFluent()?this.provider.request({method:"wallet_requestPermissions",params:[{wallet_accounts:{},wallet_crossNetworkTypeGetConfluxBase32Address:{},wallet_crossNetworkTypeGetEthereumHexAddress:{}}]}):Promise.reject())}},Be=new Cu(new Qb),Qo=qf(Gf(()=>({status:"in-detecting",accounts:void 0,chainId:void 0,balance:void 0})));Qf(Be,Qo);var Zf=()=>Qo(Lt.status),Jf=()=>Qo(Lt.chainId),ep=()=>Qo(Lt.account),Pm=0,tp=()=>(C.exports.useEffect(()=>(++Pm===1&&Be.startTrackBalance(),()=>{--Pm===0&&Be.stopTrackBalance()}),[]),Qo(Lt.balance));Be.startTrackBalance;Be.stopTrackBalance;Be.trackBalanceChangeOnce;var Zb=Be.completeDetect,np=Be.connect;Be.sendTransaction;Be.personalSign;Be.typedSign;Be.addChain;Be.switchChain;Be.watchAsset;Be.requestPermissions;Be.requestCrossNetworkPermission;Be.setCrossNetworkChain;Be.provider;Be.completeDetect().then(()=>Be.provider);const Om=e=>{try{return e instanceof HTMLElement}catch{return typeof e=="object"&&e.nodeType===1&&typeof e.style=="object"&&typeof e.ownerDocument=="object"}},Bm=e=>((globalThis==null?void 0:globalThis.queueMicrotask)||(globalThis==null?void 0:globalThis.setTimeout))(e),Jb={from:{clipPath:"inset(50% round 50% 50%)"},enter:{clipPath:"inset(0% round 0% 0%)",config:{mass:1,tension:180,friction:24}},leave:{clipPath:"inset(50% round 50% 50%)",config:{mass:1,tension:180,friction:24,clamp:!0}}},e3={from:{clipPath:"polygon(50% 20%, 50% 50%, 20% 50%, 50% 50%, 50% 80%, 50% 50%, 80% 50%, 50% 50%)"},enter:{clipPath:"polygon(50% 0%, 0% 0%, 0% 50%, 0% 100%, 50% 100%, 100% 100%, 100% 50%, 100% 0%)",config:{mass:1,tension:180,friction:24}},leave:{clipPath:"polygon(50% 20%, 50% 50%, 20% 50%, 50% 50%, 50% 80%, 50% 50%, 80% 50%, 50% 50%)",config:{mass:1,tension:240,friction:22,clamp:!0}}},t3={from:{clipPath:"circle(0% at 50% 50%)"},enter:{clipPath:"circle(100% at 50% 50%)",config:{mass:1,tension:170,friction:26}},leave:{clipPath:"circle(0% at 50% 50%)",config:{mass:1,tension:170,friction:26,clamp:!0}}},n3={from:{filter:"blur(8px)",opacity:0},enter:{filter:"blur(0px)",opacity:1,config:{mass:1,tension:200,friction:26}},leave:{filter:"blur(8px)",config:{mass:1,tension:240,friction:24,clamp:!0}}},r3={from:{opacity:0},enter:{opacity:1,config:{mass:1,tension:170,friction:26}},leave:{opacity:0,config:{mass:1,tension:170,friction:26,clamp:!0}}},i3={from:{opacity:0,transform:"translate3d(0, 200%, 0)"},enter:{opacity:1,transform:"translate3d(0, 0%, 0)",config:{mass:1,tension:260,friction:19}},leave:{opacity:0,transform:"translate3d(0, 200%, 0)",config:{mass:1,tension:170,friction:26,clamp:!0}}},o3={from:{opacity:0,transform:"translate3d(0, -200%, 0)"},enter:{opacity:1,transform:"translate3d(0, 0%, 0)",config:{mass:1,tension:260,friction:19}},leave:{opacity:0,transform:"translate3d(0, -200%, 0)",config:{mass:1,tension:170,friction:26,clamp:!0}}},a3={from:{opacity:0,transform:"translate3d(-175%, 0, 0)"},enter:{opacity:1,transform:"translate3d(0%, 0, 0)",config:{mass:1,tension:260,friction:19}},leave:{opacity:0,transform:"translate3d(-175%, 0, 0)",config:{mass:1,tension:170,friction:26,clamp:!0}}},s3={from:{opacity:0,transform:"translate3d(175%, 0, 0)"},enter:{opacity:1,transform:"translate3d(0%, 0, 0)",config:{mass:1,tension:210,friction:20}},leave:{opacity:0,transform:"translate3d(175%, 0, 0)",config:{mass:1,tension:280,friction:60}}},u3={from:{transform:"perspective(400px) rotate3d(1, 0, 0, 90deg)"},enter:{transform:"perspective(400px) rotate3d(1, 0, 0, 0deg)",opacity:1,config:{mass:1,tension:180,friction:26}},leave:{transform:"perspective(400px) rotate3d(1, 0, 0, 90deg)",opacity:0,config:{mass:1,tension:240,friction:26,clamp:!0}}},l3={from:{transform:"rotate3d(0, 0, 1, 200deg)",opacity:0},enter:{transform:"rotate3d(0, 0, 1, 0deg)",opacity:1,config:{mass:1,tension:210,friction:26}},leave:{transform:"rotate3d(0, 0, 1, 200deg)",opacity:0,config:{mass:1,tension:240,friction:26,clamp:!0}}},c3={from:{transform:"scale3d(0.3, 0.3, 0.3)"},enter:{transform:"scale3d(1, 1, 1)",config:{mass:1,tension:210,friction:26}},leave:{transform:"scale3d(0, 0, 0)",config:{mass:1,tension:240,friction:26,clamp:!0}}},d3={from:{transform:"scale3d(0, 1, 1)"},enter:{transform:"scale3d(1, 1, 1)",config:{mass:1,tension:210,friction:26}},leave:{transform:"scale3d(0, 1, 0.1)",config:{mass:1,tension:240,friction:26,clamp:!0}}},f3={blur:n3,clipRectSp:e3,clipRect:Jb,clipCircle:t3,fade:r3,flip:u3,door:d3,zoom:c3,slideUp:i3,slideDown:o3,slideRight:s3,slideLeft:a3,rotate:l3},Oi=f3,p3=({list:e,children:t,animatedHeight:n,animationType:r="zoom",animationDuration:i,ItemWrapperClassName:o,ItemWrapperStyle:a,...u})=>{const s=C.exports.useRef(new WeakMap),l=Vf(e,{keys:d=>d.key,from:d=>{var c;return{...Oi[(c=d==null?void 0:d.animationType)!=null?c:r].from,height:n?0:void 0}},enter:d=>async c=>{var f,p,y,m,E,h,g;return await c({...Oi[(f=d==null?void 0:d.animationType)!=null?f:r].enter,height:n?s.current.get(d):void 0,config:{...(y=Oi[(p=d==null?void 0:d.animationType)!=null?p:r].enter)==null?void 0:y.config,duration:typeof((m=d==null?void 0:d.animationDuration)!=null?m:i)=="object"?(h=(E=d==null?void 0:d.animationDuration)!=null?E:i)==null?void 0:h.enter:(g=d==null?void 0:d.animationDuration)!=null?g:i}})},leave:d=>{var c,f,p,y,m,E,h;return{...Oi[(c=d==null?void 0:d.animationType)!=null?c:r].leave,height:n?0:void 0,margin:0,overflow:"hidden",config:{...(p=Oi[(f=d==null?void 0:d.animationType)!=null?f:r].leave)==null?void 0:p.config,duration:typeof((y=d==null?void 0:d.animationDuration)!=null?y:i)=="object"?(E=(m=d==null?void 0:d.animationDuration)!=null?m:i)==null?void 0:E.leave:(h=d==null?void 0:d.animationDuration)!=null?h:i}}}});return v("div",{...u,children:l((d,c,f,p)=>{var y,m;return v(gr.div,{className:ge("w-fit bg-transparent origin-center overflow-visible backface-visible will-change-transform",(y=c==null?void 0:c.ItemWrapperClassName)!=null?y:o),style:{...(m=c==null?void 0:c.ItemWrapperStyle)!=null?m:a,...d},children:n?v(gr.div,{className:"w-fit will-change-[height]",ref:E=>{var h;return(h=s.current)==null?void 0:h.set(c,E==null?void 0:E.offsetHeight)},children:C.exports.cloneElement(t(c,p))}):C.exports.cloneElement(t(c,p))})})})},rp=()=>typeof window=="undefined",id=e=>{e=e||navigator.userAgent;const t=/(iPad).*OS\s([\d_]+)/.test(e),n=!t&&/(iPhone\sOS)\s([\d_]+)/.test(e),r=/(Android);?[\s/]+([\d.]+)?/.test(e);return{ios:n||t,android:r}};function h3(e){if(rp())return!1;if(!e)throw new Error("options must be provided");let t=!1;const n={get passive(){t=!0}},r=()=>{},i="__TUA_BSL_TEST_PASSIVE__";window.addEventListener(i,r,n),window.removeEventListener(i,r,n);const{capture:o}=e;return t?e:typeof o!="undefined"?o:!1}let od=0,py=0,hy=0,ad=null,Os=!1;const so=[],my=h3({passive:!1}),m3=()=>{const e=document.body,t={...e.style},n=window.innerWidth-e.clientWidth;return e.style.overflow="hidden",e.style.boxSizing="border-box",e.style.paddingRight=`${n}px`,()=>{["overflow","boxSizing","paddingRight"].forEach(r=>{e.style[r]=t[r]||""})}},g3=()=>{const e=document.documentElement,t=document.body,n=e.scrollTop||t.scrollTop,r={...e.style},i={...t.style};return e.style.height="100%",e.style.overflow="hidden",t.style.top=`-${n}px`,t.style.width="100%",t.style.height="auto",t.style.position="fixed",t.style.overflow="hidden",()=>{e.style.height=r.height||"",e.style.overflow=r.overflow||"",["top","width","height","overflow","position"].forEach(o=>{t.style[o]=i[o]||""}),window.scrollTo(0,n)}},ip=e=>{!e.cancelable||e.preventDefault()},v3=(e,t)=>{if(t){const{scrollTop:n,scrollLeft:r,scrollWidth:i,scrollHeight:o,clientWidth:a,clientHeight:u}=t,s=e.targetTouches[0].clientX-hy,l=e.targetTouches[0].clientY-py,d=Math.abs(l)>Math.abs(s),c=l>0&&n===0,f=s>0&&r===0,p=s<0&&r+a+1>=i,y=l<0&&n+u+1>=o;if(d&&(c||y)||!d&&(f||p))return ip(e)}return e.stopPropagation(),!0},y3=e=>{e||e!==null&&console.warn("If scrolling is also required in the floating layer, the target element must be provided.")},w3=e=>{rp()||(y3(e),id().ios?(e&&(Array.isArray(e)?e:[e]).forEach(n=>{n&&so.indexOf(n)===-1&&(n.ontouchstart=r=>{py=r.targetTouches[0].clientY,hy=r.targetTouches[0].clientX},n.ontouchmove=r=>{r.targetTouches.length===1&&v3(r,n)},so.push(n))}),Os||(document.addEventListener("touchmove",ip,my),Os=!0)):od<=0&&(ad=id().android?g3():m3()),od+=1)},E3=()=>{if(!rp()){if(od=0,!id().ios&&typeof ad=="function"){ad();return}if(so.length){let e=so.pop();for(;e;)e.ontouchmove=null,e.ontouchstart=null,e=so.pop()}Os&&(document.removeEventListener("touchmove",ip,my),Os=!1)}},C3=({open:e,className:t,style:n,...r})=>{const i=Vf(e,{from:{opacity:0},enter:{opacity:1},leave:{opacity:0},reverse:e});return C.exports.useEffect(()=>{e?w3():E3()},[e]),i((o,a)=>a&&v(gr.div,{className:ge("fixed left-0 top-0 w-full h-full bg-black bg-opacity-40 z-[200] contain-strict",t),style:{...n,...o},...r}))},x3=C.exports.forwardRef(({handleClose:e,Content:t,duration:n},r)=>(C.exports.useEffect(()=>{let i;return n!==0&&(i=setTimeout(e,n)),()=>clearTimeout(i)},[]),C.exports.isValidElement(t)||typeof t=="function"?v("div",{className:"flex flex-col w-fit bg-transparent backface-visible overflow-hidden contain-content",ref:r,children:typeof t=="function"?v(t,{}):t}):v("div",{ref:r,className:"w-fit px-[5px] py-[8px] bg-black bg-opacity-70 text-white rounded backface-visible",children:t}))),Rm=C.exports.forwardRef((e,t)=>{const[n,r]=C.exports.useState([]),i=C.exports.useRef([]),[o,a]=C.exports.useState(!1),[u,s]=C.exports.useState(void 0),[l,d]=C.exports.useState(void 0),[c,f]=C.exports.useState(void 0),[p,y]=C.exports.useState(void 0),[m,E]=C.exports.useState(void 0),[h,g]=C.exports.useState(void 0),[w,x]=C.exports.useState(void 0),b=C.exports.useCallback(({Content:M,duration:I=3e3,showMask:U=!1,key:H,preventDuplicate:Z,maximum:j,unique:O,queue:$,...W})=>{const _=H!=null?H:Lc("popup");return r(L=>H&&L.find(B=>B.key===H)?L:$&&L.length?(i.current.push({Content:M,duration:I,showMask:U,key:_,preventDuplicate:Z,maximum:j,unique:O,...W}),L):Z&&L.find(B=>B.Content===M)?L:(j&&L.length>0&&L.length>=j&&(L=L.slice(0,j-1)),[{key:_,Content:M,duration:I,showMask:U,...W},...O&&L.length>=1?[]:L])),Bm(()=>{U&&a(!0)}),_},[]),F=C.exports.useCallback(M=>{let I=!1;r(U=>{const H=U.filter(Z=>Z.key!==M);return H.find(Z=>Z.showMask)||a(!1),!H.length&&i.current.length&&(I=!0),H}),Bm(()=>{I&&b(i.current.shift())})},[]),k=C.exports.useCallback(()=>{i.current=[],r([]),a(!1)},[]),A=C.exports.useCallback(M=>{f(()=>M)},[]);return C.exports.useImperativeHandle(t,()=>({show:b,hide:F,hideAll:k,setMaskStyle:s,setMaskClassName:d,setListStyle:y,setListClassName:E,setItemWrapperStyle:g,setItemWrapperClassName:x,setMaskClickHandler:A})),N("div",{children:[v(C3,{open:o,className:l,style:u,onClick:c}),v(p3,{className:ge("fixed flex flex-col items-center w-fit left-[50%] top-[30%] translate-x-[-50%] z-[201]",m),list:n,animatedHeight:!0,style:p,ItemWrapperClassName:w,ItemWrapperStyle:{marginBottom:12,...h},children:M=>v(x3,{handleClose:()=>{var I;F(M.key),(I=M==null?void 0:M.onClose)==null||I.call(M)},...M})})]})});class Su{constructor(){S(this,"popupRef");S(this,"show");S(this,"hide");S(this,"hideAll");S(this,"setMaskStyle");S(this,"setMaskClassName");S(this,"setMaskClickHandler");S(this,"setListStyle");S(this,"setListClassName");S(this,"setItemWrapperStyle");S(this,"setItemWrapperClassName");S(this,"isInInit",!1);S(this,"isEndInit",!1);S(this,"completeInit");S(this,"initPromise");S(this,"resetMethod",()=>{this.show=this.popupRef.current.show,this.hide=this.popupRef.current.hide,this.hideAll=this.popupRef.current.hideAll,this.setMaskStyle=this.popupRef.current.setMaskStyle,this.setMaskClassName=this.popupRef.current.setMaskClassName,this.setMaskClickHandler=this.popupRef.current.setMaskClickHandler,this.setListStyle=this.popupRef.current.setListStyle,this.setListClassName=this.popupRef.current.setListClassName,this.setItemWrapperStyle=this.popupRef.current.setItemWrapperStyle,this.setItemWrapperClassName=this.popupRef.current.setItemWrapperClassName});S(this,"waitRefReady",()=>{const t=()=>{this.popupRef.current?this.completeInit():setTimeout(t,16)};return t(),this.initPromise});S(this,"init",async t=>{(!t||!Om(t))&&(t=document.createElement("div"),t.setAttribute("id","popup-container-"+Lc()),t.style.position="absolute",document.body.appendChild(t)),B1(t).render(v(Rm,{ref:this.popupRef})),await this.waitRefReady(),this.resetMethod(),this.isEndInit=!0});S(this,"Provider",({container:t})=>{(!t||!Om(t))&&(t=document.createElement("div"),t.setAttribute("id","popup-container-"+Lc()),t.style.position="absolute",document.body.appendChild(t));const n=br.exports.createPortal(kd.createElement(Rm,{ref:this.popupRef}),t);return this.waitRefReady().then(this.resetMethod),n});this.popupRef=C.exports.createRef(),this.show=t=>this.judgeInit("show",t),this.hide=t=>this.judgeInit("hide",t),this.hideAll=()=>this.judgeInit("hideAll"),this.setMaskStyle=t=>this.judgeInit("setMaskStyle",t),this.setMaskClassName=t=>this.judgeInit("setMaskClassName",t),this.setMaskClickHandler=t=>this.judgeInit("setMaskClickHandler",t),this.setListStyle=t=>this.judgeInit("setListStyle",t),this.setListClassName=t=>this.judgeInit("setListClassName",t),this.setItemWrapperStyle=t=>this.judgeInit("setItemWrapperStyle",t),this.setItemWrapperClassName=t=>this.judgeInit("setItemWrapperClassName",t),this.initPromise=new Promise(t=>this.completeInit=t)}judgeInit(t,n){if(!this.isEndInit){this.isInInit||(this.isInInit=!0,this.init()),this.initPromise.then(()=>{this[t](n)});return}return this[t](n)}}new Su;const op=new Su;op.setListStyle({top:"unset",left:"unset",transform:"unset",right:"12px",bottom:"6px",flexDirection:"column-reverse"});const S3=C.exports.memo(({text:e,duration:t})=>{const n=Zc({from:{transform:"translateX(-100%)"},to:{transform:"translateX(0)"},config:{duration:6e3}});return N("div",{className:"relative flex justify-center items-center min-w-[240px] h-[40px] px-[32px] bg-[#445159] text-white rounded overflow-hidden",children:[e,t?v(gr.div,{className:"absolute bottom-0 w-full h-[4px] bg-gradient-to-l from-[#15C184] to-[#2959B4]",style:n}):null]})}),Ee=(e,t)=>{var n;return op.show({Content:v(S3,{text:e,duration:(n=t==null?void 0:t.duration)!=null?n:6e3}),duration:6e3,animationType:"slideRight",...t})};op.hide;var gy="./assets/cfx.d75b3570.svg";const b3="_spin_7vpum_1";var Zo={"connected-spin":"_connected-spin_7vpum_1",spin:b3};const F3=()=>{const e=Zf(),t=ep(),n=Jf(),r=tp(),i=C.exports.useCallback(async()=>{try{await np(),Ee("Connect to Fluent Success!")}catch(o){(o==null?void 0:o.code)===4001&&Ee("User rejected connection.",{key:"user-rejected-connection"})}},[]);return console.log("render status:",e," , account:",t," , chainId:",n),N("div",{className:"flex justify-center items-center",children:[e!=="in-detecting"&&e!=="active"&&N("button",{className:ge("button w-[168px]",{error:e==="not-installed"}),onClick:i,disabled:e!=="not-active",children:[e==="in-activating"&&"connecting...",e==="not-installed"&&"Fluent Not Install",e==="not-active"&&"Connect Fluent"]}),e==="active"&&N("div",{className:"min-w-[440px] mt-[16px] p-[16px] rounded-[8px] border-[1px] border-[#EAECEF] dark:border-transparent shadow dark:shadow-none bg-white dark:bg-[#374151] transition-colors",children:[N("p",{className:"inline-flex items-center px-[10px] py-[4px] rounded-3xl text-[16px] text-primary bg-[#ecedf5] dark:text-[#f8f9fe] dark:bg-primary transition-colors",children:[v("span",{className:`mr-[4px] ${Zo["connected-spin"]}`}),"Conflux Chain"]}),v("p",{className:"mt-[16px] text-[16px] leading-[22px] text-text1 transition-colors",children:"chainId:"}),v("p",{className:"text-[14px] leading-[18px] text-text2 transition-colors",children:n}),v("p",{className:"mt-[6px] text-[16px] leading-[22px] text-text1 transition-colors",children:"account address:"}),v("p",{className:"text-[14px] leading-[18px] text-text2 transition-colors",children:t}),v("p",{className:"mt-[6px] text-[16px] leading-[22px] text-text1 transition-colors",children:"balance:"}),v("p",{className:"text-[14px] leading-[18px] text-text2 transition-colors",children:`${r==null?void 0:r.toDecimalStandardUnit()} CFX`}),N("div",{className:"mt-[16px] px-[12px] py-[10px] flex items-center text-[14px] text-[#3D3F4C] bg-[#F7F8FA] rounded-[2px]",children:[v("img",{className:"mr-[8px] w-[24px] h-[24px]",src:gy,alt:"cfx icon"}),"CFX (Conflux Network)",v("span",{className:"ml-[8px] mt-[2px] inline-block px-[4px] text-[12px] text-white text-center bg-[#44D7B6] rounded-[2px]",children:"Connected"})]})]})]})};var vy=class extends Xf{constructor(){super(...arguments);S(this,"sessionKey","ethereum--isMetaMask");S(this,"detectProvider",()=>xu({injectFlag:"ethereum",defaultWaltFlag:"isMetaMask"}));S(this,"requestAccounts",()=>this.provider.request({method:"eth_requestAccounts"}));S(this,"getAccounts",()=>this.provider.request({method:"eth_accounts"}));S(this,"getChainId",()=>this.provider.request({method:"eth_chainId"}));S(this,"getBalance",async()=>{if(!this.account)throw new Error("getBalance error: must connect to wallet");try{return await this.provider.request({method:"eth_getBalance",params:[this.account,"latest"]})}catch(t){throw t}});S(this,"onAccountsChange",t=>this.provider.on("accountsChanged",t));S(this,"onChainIdChange",t=>this.provider.on("chainChanged",t));S(this,"sendTransaction",t=>this.provider.request({method:"eth_sendTransaction",params:[t]}));S(this,"personalSign",t=>this.provider.request({method:"personal_sign",params:[t,this.account]}));S(this,"typedSign",t=>this.provider.request({method:"eth_signTypedData_v4",params:[this.account,JSON.stringify(t)]}));S(this,"addChain",t=>this.provider.request({method:"wallet_addEthereumChain",params:[t]}));S(this,"switchChain",t=>this.provider.request({method:"wallet_switchEthereumChain",params:[{chainId:t}]}));S(this,"watchAsset",t=>this.provider.request({method:"wallet_watchAsset",params:t}));S(this,"isHostedByFluent",()=>this.provider===window.conflux);S(this,"requestPermissions",t=>this.provider.request({method:"wallet_requestPermissions",params:[t]}));S(this,"requestCrossNetworkPermission",()=>this.isHostedByFluent()?this.provider.request({method:"wallet_requestPermissions",params:[{wallet_accounts:{},wallet_crossNetworkTypeGetConfluxBase32Address:{},wallet_crossNetworkTypeGetEthereumHexAddress:{}}]}):Promise.reject())}};new Cu(new vy);var k3=class extends vy{constructor(){super(...arguments);S(this,"sessionKey","fluent-isFluent");S(this,"detectProvider",()=>xu({injectFlag:"fluent",walletFlag:"isFluent"}));S(this,"requestCrossNetworkPermission",()=>this.provider.request({method:"wallet_requestPermissions",params:[{wallet_accounts:{},wallet_crossNetworkTypeGetConfluxBase32Address:{},wallet_crossNetworkTypeGetEthereumHexAddress:{}}]}))}},Re=new Cu(new k3),Jo=qf(Gf(()=>({status:"in-detecting",accounts:void 0,chainId:void 0,balance:void 0})));Qf(Re,Jo);var A3=()=>Jo(Lt.status),D3=()=>Jo(Lt.chainId),_3=()=>Jo(Lt.account),Nm=0,I3=()=>(C.exports.useEffect(()=>(++Nm===1&&Re.startTrackBalance(),()=>{--Nm===0&&Re.stopTrackBalance()}),[]),Jo(Lt.balance));Re.startTrackBalance;Re.stopTrackBalance;Re.trackBalanceChangeOnce;Re.completeDetect;var T3=Re.connect;Re.sendTransaction;Re.personalSign;Re.typedSign;Re.addChain;Re.switchChain;Re.watchAsset;Re.requestPermissions;Re.requestCrossNetworkPermission;Re.setCrossNetworkChain;Re.provider;Re.completeDetect().then(()=>Re.provider);var M3="./assets/metamask-fox.b8558514.svg";const sd=({useStatus:e,useAccount:t,useChainId:n,useBalance:r,connect:i,type:o})=>{const a=e(),u=t(),s=n(),l=r(),d=C.exports.useCallback(async()=>{try{await i(),Ee(`Connect to ${o} Success!`)}catch(c){(c==null?void 0:c.code)===4001&&Ee(`User rejected ${o} connection.`,{key:`user-rejected-connection-${o}`})}},[]);return console.log(`render ${o} status:`,a," , account:",u," , chainId:",s),N("div",{className:"flex justify-center items-center",children:[a!=="in-detecting"&&a!=="active"&&N("button",{className:ge("button w-[168px]",{error:a==="not-installed",metamask:o==="MetaMask"}),onClick:d,disabled:a!=="not-active",children:[a==="in-activating"&&"connecting...",a==="not-installed"&&`${o} Not Install`,a==="not-active"&&`Connect ${o}`]}),a==="active"&&N("div",{className:"min-w-[440px] mt-[16px] p-[16px] rounded-[8px] border-[1px] border-[#EAECEF] dark:border-transparent shadow dark:shadow-none bg-white dark:bg-[#374151] transition-colors",children:[N("p",{className:ge("inline-flex items-center px-[10px] py-[4px] rounded-3xl text-[16px] bg-[#ecedf5] dark:text-[#f8f9fe] transition-colors",o==="Fluent"?"text-primary dark:bg-primary":"text-metamask dark:bg-metamask"),children:[v("span",{className:`mr-[4px] ${Zo["connected-spin"]}`}),`${o==="Fluent"?"Conflux":"Ethereum"}`," Chain"]}),v("p",{className:"mt-[16px] text-[16px] leading-[22px] text-text1 transition-colors",children:"chainId:"}),v("p",{className:"text-[14px] leading-[18px] text-text2 transition-colors",children:s}),v("p",{className:"mt-[6px] text-[16px] leading-[22px] text-text1 transition-colors",children:"account address:"}),v("p",{className:"text-[14px] leading-[18px] text-text2 transition-colors",children:u}),v("p",{className:"mt-[6px] text-[16px] leading-[22px] text-text1 transition-colors",children:"balance:"}),v("p",{className:"text-[14px] leading-[18px] text-text2 transition-colors",children:`${l==null?void 0:l.toDecimalStandardUnit()} ${o==="Fluent"?"CFX":"ETH"}`}),N("div",{className:"mt-[16px] px-[12px] py-[10px] flex items-center text-[14px] text-[#3D3F4C] bg-[#F7F8FA] rounded-[2px]",children:[v("img",{className:"mr-[8px] w-[24px] h-[24px]",src:o==="Fluent"?gy:M3,alt:"cfx icon"}),o==="Fluent"?"CFX (Conflux Network)":"ETH (Ethereum Network)",v("span",{className:"ml-[8px] mt-[2px] inline-block px-[4px] text-[12px] text-white text-center bg-[#44D7B6] rounded-[2px]",children:"Connected"})]})]})]})},P3=()=>N("div",{className:"flex justify-center gap-8",children:[v(sd,{useStatus:A3,useAccount:_3,useChainId:D3,useBalance:I3,connect:T3,type:"Fluent"}),v(sd,{useStatus:Zf,useAccount:ep,useChainId:Jf,useBalance:tp,connect:np,type:"MetaMask"})]});var O3=class extends Xf{constructor(){super(...arguments);S(this,"sessionKey","conflux");S(this,"detectProvider",()=>{const t=xu({injectFlag:"conflux"});return t.then(n=>{n.isConfluxPortal&&n.send&&!n.request&&(this.provider.request=({method:r,params:i})=>{var o;return r==="accounts"?Promise.resolve(this.provider.selectedAddress):r==="cfx_chainId"?Promise.resolve(this.provider.networkVersion):(o=this.provider)==null?void 0:o.send(r,i)})}),t});S(this,"requestAccounts",()=>this.provider.request({method:"cfx_requestAccounts"}));S(this,"getAccounts",()=>this.provider.request({method:"cfx_accounts"}));S(this,"getChainId",()=>this.provider.request({method:"cfx_chainId"}));S(this,"getBalance",async()=>{if(!this.account)throw new Error("getBalance error: must connect to wallet");try{return await this.provider.request({method:"cfx_getBalance",params:[this.account,"latest_state"]})}catch(t){throw t}});S(this,"onAccountsChange",t=>this.provider.on("accountsChanged",t));S(this,"onChainIdChange",t=>this.provider.on("chainChanged",t));S(this,"sendTransaction",t=>this.provider.request({method:"cfx_sendTransaction",params:[t]}));S(this,"personalSign",t=>this.provider.request({method:"personal_sign",params:[t,this.account]}));S(this,"typedSign",t=>this.provider.request({method:"cfx_signTypedData_v4",params:[this.account,JSON.stringify(t)]}));S(this,"addChain",t=>this.provider.request({method:"wallet_addConfluxChain",params:[t]}));S(this,"switchChain",t=>this.provider.request({method:"wallet_switchConfluxChain",params:[{chainId:t}]}));S(this,"watchAsset",t=>this.provider.request({method:"wallet_watchAsset",params:t}));S(this,"requestPermissions",t=>this.provider.request({method:"wallet_requestPermissions",params:[t]}))}},Ne=new Cu(new O3),ea=qf(Gf(()=>({status:"in-detecting",accounts:void 0,chainId:void 0,balance:void 0})));Qf(Ne,ea);var bu=()=>ea(Lt.status),Fu=()=>ea(Lt.chainId),ku=()=>ea(Lt.account),Lm=0,Au=()=>(C.exports.useEffect(()=>(++Lm===1&&Ne.startTrackBalance(),()=>{--Lm===0&&Ne.stopTrackBalance()}),[]),ea(Lt.balance));Ne.startTrackBalance;Ne.stopTrackBalance;var B3=Ne.trackBalanceChangeOnce,R3=Ne.completeDetect,Du=Ne.connect,N3=Ne.sendTransaction,L3=Ne.personalSign,$3=Ne.typedSign,U3=Ne.addChain,j3=Ne.switchChain,z3=Ne.watchAsset;Ne.requestPermissions;Ne.requestCrossNetworkPermission;Ne.setCrossNetworkChain;Ne.provider;Ne.completeDetect().then(()=>Ne.provider);const H3=()=>{const[e,t]=C.exports.useState(()=>{const r=localStorage.getItem("wallet");return r!=="Fluent"&&r!=="MetaMask"?"Fluent":r}),n=C.exports.useCallback(()=>{t(r=>{const i=r==="Fluent"?"MetaMask":"Fluent";return localStorage.setItem("wallet",i),i})},[]);return N(Nt,{children:[v(sd,{useStatus:e==="Fluent"?bu:Zf,useAccount:e==="Fluent"?ku:ep,useChainId:e==="Fluent"?Fu:Jf,useBalance:e==="Fluent"?Au:tp,connect:e==="Fluent"?Du:np,type:e}),N("button",{className:ge("mt-6 inline-flex mx-auto button w-[188px] h-[36px]",{metamask:e==="Fluent"}),onClick:n,children:["Switch to ",e==="Fluent"?"MetaMask":"Fluent"]})]})};var V3="./assets/success.089c49c8.svg",W3="./assets/close.3ffc782c.svg";const ap=new Su,sp=new Su,q3=C.exports.memo(()=>N("div",{className:"w-[340px] h-[150px] text-center bg-bg rounded-[8px]",children:[v("div",{className:"modal-spin mt-[24px]"}),v("p",{className:"font-medium text-[16px] text-text1 mt-[12px] leading-[22px]",children:"Waiting"}),v("p",{className:"mt-[8px] text-[14px] text-text2 leading-[18px]",children:"Confirm the transaction in your Fluent wallet..."})]})),G3=C.exports.memo(({TxnHash:e,action:t="Transaction"})=>N("div",{className:"relative w-[340px] min-h-[192px] p-[24px] text-center bg-bg rounded-lg ",children:[v("img",{className:"absolute right-[12px] top-[12px] w-[16px] h-[16px] cursor-pointer hover:scale-110 transition-transform select-none",onClick:sp.hideAll,src:W3,alt:"close icon"}),v("img",{className:"w-[48px] h-[48px] mt-[28px] mx-auto",src:V3,alt:"success icon"}),N("p",{className:"mt-[12px] font-medium text-[16px] leading-[22px] text-text1 text-center",children:[t," Submitted"]}),v("p",{className:"mt-[12px] mb-[4px] text-[14px] leading-[18px] text-text1 text-left",children:"Txn Hash:"}),v("p",{className:"text-[14px] leading-[18px] text-text2 text-left break-words",children:e})]})),ud=()=>ap.show({Content:v(q3,{}),duration:0,showMask:!0,animationType:"door"}),ld=(e,t="Transaction")=>(ap.hideAll(),sp.show({Content:v(G3,{TxnHash:e,action:t}),duration:0,showMask:!0,animationType:"door"})),cd=e=>ap.hide(e),K3=e=>sp.hide(e),Y3=()=>{const e=bu(),t=ku(),n=Fu(),r=Au(),i=C.exports.useCallback(async()=>{try{await Du(),Ee("Connect to Fluent Success!")}catch(a){console.log(a),(a==null?void 0:a.code)===4001&&Ee("User rejected connection.",{key:"user-rejected-connection"})}},[]),o=C.exports.useCallback(async()=>{if(!t)return;let a=null,u=null;try{a=ud();const s=await N3({to:t,value:fy.fromStandardUnit("1").toHexMinUnit()});u=ld(s),B3(()=>{K3(u),Ee("It seems the transaction is complete")})}catch(s){cd(a),(s==null?void 0:s.code)===4001&&Ee("User canceled transaction.")}},[t]);return N("div",{className:"flex justify-center items-center",children:[e!=="in-detecting"&&e!=="active"&&N("button",{className:ge("button w-[168px]",{error:e==="not-installed"}),onClick:i,disabled:e!=="not-active",children:[e==="in-activating"&&"connecting...",e==="not-installed"&&"Fluent Not Install",e==="not-active"&&"Connect Fluent"]}),e==="active"&&N("div",{className:"min-w-[440px] mt-[16px] p-[16px] rounded-[8px] border-[1px] border-[#EAECEF] dark:border-transparent shadow dark:shadow-none bg-white dark:bg-[#374151] transition-colors",children:[N("p",{className:"inline-flex items-center px-[10px] py-[4px] rounded-3xl text-[16px] text-primary bg-[#ecedf5] dark:text-[#f8f9fe] dark:bg-primary transition-colors",children:[v("span",{className:`mr-[4px] ${Zo["connected-spin"]}`}),"Conflux Chain"]}),v("p",{className:"mt-[16px] text-[16px] leading-[22px] text-text1 transition-colors",children:"chainId:"}),v("p",{className:"text-[14px] leading-[18px] text-text2 transition-colors",children:n}),v("p",{className:"mt-[6px] text-[16px] leading-[22px] text-text1 transition-colors",children:"account address:"}),v("p",{className:"text-[14px] leading-[18px] text-text2 transition-colors",children:t}),v("p",{className:"mt-[6px] text-[16px] leading-[22px] text-text1 transition-colors",children:"balance:"}),v("p",{className:"text-[14px] leading-[18px] text-text2 transition-colors",children:`${r==null?void 0:r.toDecimalStandardUnit()} CFX`}),v("button",{className:"button w-full my-4 h-[36px]",onClick:o,children:"Send 1 native token to self (connected account)"})]})]})},X3=()=>{const e=bu(),t=ku(),n=Fu(),r=Au(),i=C.exports.useCallback(async()=>{try{await Du(),Ee("Connect to Fluent Success!")}catch(u){console.log(u),(u==null?void 0:u.code)===4001&&Ee("User rejected connection.",{key:"user-rejected-connection"})}},[]),o=C.exports.useCallback(async()=>{let u=null;try{u=ud();const s=await L3("Personal Sign message example");ld(s,"Personal Sign")}catch(s){console.log(u),cd(u),(s==null?void 0:s.code)===4001&&Ee("User canceled Personal Sign.")}},[]),a=C.exports.useCallback(async()=>{let u=null;try{u=ud();const s=await $3(Q3);ld(s,"Typed Sign")}catch(s){cd(u),(s==null?void 0:s.code)===4001&&Ee("User canceled Typed Sign.")}},[]);return N("div",{className:"flex justify-center items-center",children:[e!=="in-detecting"&&e!=="active"&&N("button",{className:ge("button w-[168px]",{error:e==="not-installed"}),onClick:i,disabled:e!=="not-active",children:[e==="in-activating"&&"connecting...",e==="not-installed"&&"Fluent Not Install",e==="not-active"&&"Connect Fluent"]}),e==="active"&&N("div",{className:"min-w-[440px] mt-[16px] p-[16px] rounded-[8px] border-[1px] border-[#EAECEF] dark:border-transparent shadow dark:shadow-none bg-white dark:bg-[#374151] transition-colors",children:[N("p",{className:"inline-flex items-center px-[10px] py-[4px] rounded-3xl text-[16px] text-primary bg-[#ecedf5] dark:text-[#f8f9fe] dark:bg-primary transition-colors",children:[v("span",{className:`mr-[4px] ${Zo["connected-spin"]}`}),"Conflux Chain"]}),v("p",{className:"mt-[16px] text-[16px] leading-[22px] text-text1 transition-colors",children:"chainId:"}),v("p",{className:"text-[14px] leading-[18px] text-text2 transition-colors",children:n}),v("p",{className:"mt-[6px] text-[16px] leading-[22px] text-text1 transition-colors",children:"account address:"}),v("p",{className:"text-[14px] leading-[18px] text-text2 transition-colors",children:t}),v("p",{className:"mt-[6px] text-[16px] leading-[22px] text-text1 transition-colors",children:"balance:"}),v("p",{className:"text-[14px] leading-[18px] text-text2 transition-colors",children:`${r==null?void 0:r.toDecimalStandardUnit()} CFX`}),N("div",{className:"flex gap-8",children:[v("button",{className:"button w-[50%] my-4 h-[36px]",onClick:o,children:"Personal Sign"}),v("button",{className:"button w-[50%] my-4 h-[36px]",onClick:a,children:"Typed Sign"})]})]})]})},Q3={types:{CIP23Domain:[{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"}],Person:[{name:"name",type:"string"},{name:"wallets",type:"address[]"}],Mail:[{name:"from",type:"Person"},{name:"to",type:"Person[]"},{name:"contents",type:"string"}],Group:[{name:"name",type:"string"},{name:"members",type:"Person[]"}]},domain:{name:"Ether Mail",version:"1",chainId:1,verifyingContract:"0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC"},primaryType:"Mail",message:{from:{name:"Cow",wallets:["0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826","0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF"]},to:[{name:"Bob",wallets:["0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB","0xB0BdaBea57B0BDABeA57b0bdABEA57b0BDabEa57","0xB0B0b0b0b0b0B000000000000000000000000000"]}],contents:"Hello, Bob!"}},Z3=()=>{const e=bu(),t=ku(),n=Fu(),r=Au(),i=C.exports.useCallback(async()=>{try{await Du(),Ee("Connect to Fluent Success!")}catch(s){console.log(s),(s==null?void 0:s.code)===4001&&Ee("User rejected connection.",{key:"user-rejected-connection"})}},[]),o=C.exports.useCallback(async()=>{U3({chainId:"0x2ee0",chainName:"123Conflux",nativeCurrency:{name:"Conflux",symbol:"CFX",decimals:18},rpcUrls:["http://47.104.89.179:12537"],blockExplorerUrls:["https://confluxscan.io"]}).then(()=>{Ee("Add 123Conflux chain success!")}).catch(s=>{var l;(s==null?void 0:s.code)===4001&&Ee("User rejected add 123Conflux chain."),(s==null?void 0:s.code)===-32602&&((l=s==null?void 0:s.message)==null?void 0:l.indexOf("Duplicate network endpoint"))!==-1&&Ee("Have added 123Conflux chain.")})},[]),a=C.exports.useCallback(async()=>{j3(n==="12000"?"0x1":"0x2ee0").then(()=>{Ee(`Switch to ${n==="12000"?"Testnet":"123Conflux"} chain success!`)}).catch(s=>{var l;(s==null?void 0:s.code)===4001&&Ee(`User rejected switch to ${n==="12000"?"Testnet":"123Conflux"} chain.`),(s==null?void 0:s.code)===-32602&&((l=s==null?void 0:s.message)==null?void 0:l.indexOf("try add the network"))!==-1&&Ee(`${n==="12000"?"Testnet":"123Conflux"} chain not added, try add first.`)})},[n]),u=C.exports.useCallback(async()=>{z3({type:"ERC20",options:{address:"cfxtest:acepe88unk7fvs18436178up33hb4zkuf62a9dk1gv",symbol:"cUSDT",decimals:18,image:"https://scan-icons.oss-cn-hongkong.aliyuncs.com/testnet/cfxtest%3Aacepe88unk7fvs18436178up33hb4zkuf62a9dk1gv.png"}}).then(s=>{Ee(s?"Add cUSTD success!":"Add cUSTD failed.")}).catch(s=>{(s==null?void 0:s.code)===4001&&Ee("User rejected add cUSTD."),(s==null?void 0:s.code)===-32602&&Ee("Add cUSTD failed, please check your network.")})},[]);return N("div",{className:"flex justify-center items-center",children:[e!=="in-detecting"&&e!=="active"&&N("button",{className:ge("button w-[168px]",{error:e==="not-installed"}),onClick:i,disabled:e!=="not-active",children:[e==="in-activating"&&"connecting...",e==="not-installed"&&"Fluent Not Install",e==="not-active"&&"Connect Fluent"]}),e==="active"&&N("div",{className:"mt-[16px] p-[16px] rounded-[8px] border-[1px] border-[#EAECEF] dark:border-transparent shadow dark:shadow-none bg-white dark:bg-[#374151] transition-colors",children:[N("p",{className:"inline-flex items-center px-[10px] py-[4px] rounded-3xl text-[16px] text-primary bg-[#ecedf5] dark:text-[#f8f9fe] dark:bg-primary transition-colors",children:[v("span",{className:`mr-[4px] ${Zo["connected-spin"]}`}),"Conflux Chain"]}),v("p",{className:"mt-[16px] text-[16px] leading-[22px] text-text1 transition-colors",children:"chainId:"}),v("p",{className:"text-[14px] leading-[18px] text-text2 transition-colors",children:n}),v("p",{className:"mt-[6px] text-[16px] leading-[22px] text-text1 transition-colors",children:"account address:"}),v("p",{className:"text-[14px] leading-[18px] text-text2 transition-colors",children:t}),v("p",{className:"mt-[6px] text-[16px] leading-[22px] text-text1 transition-colors",children:"balance:"}),v("p",{className:"text-[14px] leading-[18px] text-text2 transition-colors",children:`${r==null?void 0:r.toDecimalStandardUnit()} CFX`}),N("div",{className:"flex gap-4",children:[v("button",{className:"button w-[50%] my-4 h-[36px]",onClick:o,children:"Add 123Conflux Chain"}),v("button",{className:"button w-[50%] my-4 h-[36px]",onClick:a,children:n!=="12000"?"Switch to 123Conflux":"Switch to Testnet"}),v("button",{className:"button w-[50%] my-4 h-[36px]",onClick:u,disabled:n!=="1",children:"Add cUSTD to Testnet"})]})]})]})};var J3="./assets/code.81066be6.svg";const dd=[{title:"demo_connect_title",introduce:"demo_connect_introduce",Demo:F3,code:"https://github.com/Conflux-Chain/use-wallet/blob/main/dev-examples/docs/src/pages/Demo/Connect/index.tsx"},{title:"demo_connect_both_title",introduce:"demo_connect_both_introduce",Demo:P3,code:"https://github.com/Conflux-Chain/use-wallet/blob/main/dev-examples/docs/src/pages/Demo/ConnectBoth/index.tsx"},{title:"demo_connect_switch_title",introduce:"demo_connect_switch_introduce",Demo:H3,code:"https://github.com/Conflux-Chain/use-wallet/blob/main/dev-examples/docs/src/pages/Demo/ConnectSwitch/index.tsx"},{title:"demo_send_transaction_title",introduce:"demo_send_transaction_introduce",Demo:Y3,code:"https://github.com/Conflux-Chain/use-wallet/blob/main/dev-examples/docs/src/pages/Demo/SendTransaction/index.tsx"},{title:"demo_sign_title",introduce:"demo_sign_introduce",Demo:X3,code:"https://github.com/Conflux-Chain/use-wallet/blob/main/dev-examples/docs/src/pages/Demo/Sign/index.tsx"},{title:"demo_addSwitch_title",introduce:"demo_addSwitch_introduce",Demo:Z3,code:"https://github.com/Conflux-Chain/use-wallet/blob/main/dev-examples/docs/src/pages/Demo/AddSwitch/index.tsx"}],$m=Object.fromEntries(dd.map(e=>[e.title,e])),eF={en:{demo_connect_title:"Connect fluent wallet",demo_connect_introduce:"The first step of Dapp, connect your wallet.Then you can get information about your current account.",demo_connect_both_title:"Connect both fluent and metamask",demo_connect_both_introduce:"A dapp that needs to cross-chain, or conflux cross-space, needs to connect to multiple wallets at the same time.",demo_connect_switch_title:"Switch connect wallet with the same code",demo_connect_switch_introduce:"Maybe you need to make a dapp that supports both Conflux and Ethereum, and don't want to maintain two similar pieces of code.",demo_send_transaction_title:"Send Transaction",demo_send_transaction_introduce:"This example demonstrates how to send a transaction.",demo_sign_title:"Sign",demo_sign_introduce:"Use use-wallet wrapped personalSign and typedSign method signatures.",demo_addSwitch_title:"add/switch chain and watchAsset",demo_addSwitch_introduce:"Add/switch chain and add token using use-wallet wrapper methods"},zh:{demo_connect_title:"\u8FDE\u63A5 fluent \u94B1\u5305",demo_connect_introduce:"Dapp \u7684\u7B2C\u4E00\u6B65\uFF0C\u8FDE\u63A5\u4F60\u7684\u94B1\u5305\u3002\u7136\u540E\u53EF\u4EE5\u83B7\u53D6\u5F53\u524D\u8D26\u6237\u7684\u4FE1\u606F\u3002",demo_connect_both_title:"\u540C\u65F6\u8FDE\u63A5 fluent \u548C metamask",demo_connect_both_introduce:"\u9700\u8981\u8DE8\u94FE\u7684 dapp\uFF0C\u6216\u8005\u662F conflux \u8DE8space \u7684 dapp\uFF0C\u9700\u8981\u540C\u65F6\u8FDE\u63A5\u591A\u4E2A\u94B1\u5305\u3002",demo_connect_switch_title:"\u540C\u4E00\u4EFD\u4EE3\u7801\u5207\u6362\u8FDE\u63A5\u7684\u94B1\u5305",demo_connect_switch_introduce:"\u4E5F\u8BB8\u4F60\u9700\u8981\u505A\u4E00\u4E2A\u540C\u65F6\u652F\u6301 Conflux \u548C Ethereum \u7684 dapp\uFF0C\u53C8\u4E0D\u60F3\u7EF4\u62A4\u4E24\u4EFD\u76F8\u4F3C\u7684\u4EE3\u7801\u3002",demo_send_transaction_title:"\u53D1\u8D77\u4EA4\u6613",demo_send_transaction_introduce:"\u8FD9\u4E2A\u4F8B\u5B50\u6F14\u793A\u4E86\u5982\u4F55\u53D1\u8D77\u4E00\u7B14\u4EA4\u6613\u3002",demo_sign_title:"\u7B7E\u540D",demo_sign_introduce:"\u4F7F\u7528 use-wallet \u5C01\u88C5\u7684 personalSign \u548C typedSign \u7684\u65B9\u6CD5\u7B7E\u540D\u3002",demo_addSwitch_title:"\u6DFB\u52A0/\u5207\u6362\u94FE \u4EE5\u53CA \u6DFB\u52A0token",demo_addSwitch_introduce:"\u4F7F\u7528 use-wallet \u5C01\u88C5\u65B9\u6CD5 \u6DFB\u52A0/\u5207\u6362\u94FE \u4EE5\u53CA \u6DFB\u52A0token\u3002"}},Um=()=>{const e=Fe(eF),[t,n]=C.exports.useState(()=>{const g=localStorage.getItem("current-demo");return!g||!$m[g]?"demo_connect_title":g}),[r,i]=FS(),o=C.exports.useMemo(()=>$m[t],[t]),a=C.exports.useCallback(g=>{n(g),s(!1),localStorage.setItem("current-demo",g)},[]),[u,s]=C.exports.useState(!1),l=C.exports.useCallback(()=>s(!0),[]),d=C.exports.useCallback(()=>s(!1),[]),c=SS(d);C.exports.useEffect(()=>{ba.mount();const g=ba.bind("esc",d);return()=>{ba.unmount(),g&&ba.unbind(g)}},[]);const f=Fl(),p=Zc({ref:f,config:{duration:150,clamp:!0},from:{opacity:1},to:{opacity:u?0:1}}),y=Fl(),m=Zc({ref:y,config:{...Lv.stiff,clamp:!0},from:{borderColor:"transparent",translateX:"-50%",width:480,height:i.height},to:{translateX:"-50%",width:u?Math.min(window.innerWidth*.8,1024):480,height:u?460:i.height,borderColor:u?"var(--color-primary)":"transparent"}}),E=Fl(),h=Vf(u?dd:[],{keys:g=>g.title,ref:E,trail:300/dd.length,config:{clamp:!0},from:{opacity:0,scale:0},enter:{opacity:1,scale:1},leave:{opacity:0,scale:0}});return K6(u?[f,y,E]:[E,y,f],u?[0,.1,.2]:[0,.48,.57]),N(Nt,{children:[v(gr.dl,{ref:c,className:ge("absolute top-12 left-1/2 translate-x-[-50%] max-w-[1024px] rounded-md bg-primarytrans dark:bg-[#4b5563] border-4 border-transparent contain-strict transition-colors not-transition-border-color z-10",!u&&"pointer-events-none"),style:m,children:v(vv,{className:"h-[460px]",contentClassName:"w-full pt-4 pb-5 flex flex-wrap justify-center items-stretch gap-4",children:h((g,w)=>w&&N(gr.div,{className:ge("w-[480px] max-w-[100%] px-6 py-4 rounded-md shadow-md border-2 border-transparent transition-colors hover:border-primary bg-white dark:bg-[#374151]",w.title===o.title?"border-primary pointer-events-none":"hover:border-dashed cursor-pointer"),style:g,onClick:()=>a(w.title),children:[v("div",{className:"text-lg font-semibold text-text1 transition-colors",children:e[w.title]}),v("div",{className:"mt-4 text-base text-text2 transition-colors",children:e[w.introduce]})]}))})}),N(gr.div,{ref:r,className:ge("absolute top-12 left-1/2 translate-x-[-50%] w-[480px] max-w-[100%] px-6 py-4 rounded-md bg-primarytrans dark:bg-[#4b5563] shadow-md dark:shadow-none contain-content transition-colors z-20",u&&"pointer-events-none"),style:p,children:[N("div",{className:"relative text-lg font-semibold text-text1 transition-colors",children:[v("p",{className:"w-[55%]",children:e[o.title]}),v("a",{className:"button absolute w-10 p-0 h-8 text-sm top-0 right-[7.5rem]",href:o.code,target:"_blank",rel:"nofollow noopener noreferrer",title:o.code,children:v("img",{className:"w-5 h-5 max-w-none",src:J3,alt:"code"})}),v("button",{className:"button absolute px-2 h-8 text-sm top-0 right-0",onClick:l,children:"More Demo"})]}),v("div",{className:"relative mt-4 text-base text-text2 transition-colors",children:e[o.introduce]})]}),v(tF,{Demo:o.Demo,mt:Math.max(280,i.height+100)})]})},tF=C.exports.memo(({Demo:e,mt:t=280})=>v("div",{className:"mx-auto w-[600px] flex flex-col justify-center",style:{marginTop:t},children:v(e,{})})),nF=()=>{const{pathname:e}=kn(),t=e.split("/")[3]||"basic";return N("div",{className:"docs py-8 max-w-6xl mx-auto px-4 sm:px-6 lg:px-8",children:[v("h2",{className:"capitalize text-center",children:t}),v(_4,{})]})},yy=C.exports.createContext("dark"),up=()=>C.exports.useContext(yy),rF=["react","vue3","svelte"],wy=["basic","hooks","function","utils","others","FAQ"],iF=()=>{const e=up(),{pathname:t}=kn(),n=t.split("/")[2]||"react",r=t.split("/")[3]||"basic";return N(Nt,{children:[v("div",{className:"mt-6 flex justify-center items-end gap-5 h-10",children:rF.map(i=>N(Rc,{className:ge("relative text-center transition-colors px-3 ml-4 capitalize",e==="light"?"h-full flex justify-center items-center":"h-10 leading-10 rounded-md",n!==i&&"hover:text-text1 cursor-pointer",n===i?"pointer-events-none text-text1":"text-text2",n===i&&e==="dark"&&"bg-[#4b5563]",n!==i&&e==="dark"&&"hover:bg-[#374151]"),to:`${i}/${r}`,children:[i,e==="light"&&v("span",{className:ge("absolute w-full left-0 bottom-0 h-1 rounded-sm bg-primary opacity-0 transition-opacity",n===i&&"opacity-100")})]},i))}),v("div",{className:"mt-2 flex justify-center items-end gap-5 h-10",children:wy.map(i=>N(Rc,{className:ge("relative text-center transition-colors px-3 ml-4 capitalize",e==="light"?"h-full flex justify-center items-center":"h-10 leading-10 rounded-md",r!==i&&"hover:text-text1 cursor-pointer",r===i?"pointer-events-none text-text1":"text-text2",r===i&&e==="dark"&&"bg-[#4b5563]",r!==i&&e==="dark"&&"hover:bg-[#374151]"),to:`${n}/${i}`,children:[i,e==="light"&&v("span",{className:ge("absolute w-full left-0 bottom-0 h-1 rounded-sm bg-primary opacity-0 transition-opacity",r===i&&"opacity-100")})]},i))}),v(oF,{currentCataloguePath:r})]})},oF=C.exports.memo(({currentCataloguePath:e})=>{const[t,n]=C.exports.useState([]),[r,i]=C.exports.useState(""),o=wy.find(l=>l===e),a=C.exports.useRef([]),u=C.exports.useRef(null);C.exports.useEffect(()=>{var m,E;u.current||(u.current=(m=document.querySelector(".scroll-content"))==null?void 0:m.parentNode);const l=u.current;if(l.scrollTo({top:0}),!o||!l)return;const d=Array.from(document.querySelectorAll("h3"));if(!(d!=null&&d.length))return;n(d),i((E=d[0].textContent)!=null?E:"");let c=l.scrollHeight-l.clientHeight,f=!0;const p=()=>{a.current=d.map(h=>({top:h.offsetTop-128,name:h.textContent})),c=l.scrollHeight-l.clientHeight,f=a.current.length>=2&&c>a.current[a.current.length-2].top,f||(a.current[a.current.length-2].cannotReach=!0)};window.addEventListener("resize",p),p();const y=au(()=>{if(!f&&Math.abs(l.scrollTop-c)<=4){i(d[d.length-1].textContent);return}const h=a.current.find(g=>g.top>=l.scrollTop);!h||i(h.name)},24);return l.addEventListener("scroll",y),()=>{l.removeEventListener("scroll",y),window.removeEventListener("resize",p)}},[o]);const s=C.exports.useCallback(l=>{const d=a.current.findIndex(f=>f.name===l.target.textContent);if(d===-1||!u.current)return;const c=a.current[d];u.current.scrollTo({top:d===0?0:c.cannotReach?u.current.scrollHeight-u.current.clientHeight-40:c.top,behavior:"smooth"})},[]);return v("div",{className:"fixed flex-col hidden xl:flex left-[50%] top-[33.5%] translate-x-[600px] translate-y-[-50%]",children:t==null?void 0:t.map(l=>v("a",{className:ge("h-8 cursor-pointer transition-colors",r===l.textContent?"text-primary":"text-text2"),onClick:s,children:l.textContent},l.textContent))})}),aF=()=>N(Nt,{children:[v(iF,{}),v(nF,{})]});/** * Prism: Lightweight, robust, elegant syntax highlighting * * @license MIT @@ -605,7 +605,7 @@ Promise.all([completeDetectConflux(), completeDetectEthereum()]).then(() => { createApp(App).mount('#app'); }); `,aD=e=>e==="vue3"||e==="svelte"?x0:oD,sD={en:{step1:"The 'provider' can be imported directly from use-wallet to use. It is the (conflux | ethereum) object in window. The difference is that it has a typescript declaration.",step2:"Note that the value of the imported provider object is undefined until the detect process is completed."},zh:{step1:"\u53EF\u4EE5\u4ECE use-wallet \u4E2D\u76F4\u63A5\u5F15\u5165 provider \u4F7F\u7528\uFF0C\u5B83\u5C31\u662F window \u4E2D\u7684 (conflux | ethereum) \u5BF9\u8C61\u3002\u533A\u522B\u662F\u5B83\u5E26\u6709 typescript \u7684\u58F0\u660E\u3002",step2:"\u9700\u8981\u6CE8\u610F\u7684\u662F\u5728 detect \u8FC7\u7A0B\u5B8C\u6210\u4E4B\u524D\uFF0Cimport \u7684 provider \u5BF9\u8C61\u503C\u662F undefined\u3002"}},uD=()=>{const e=Fe(sD),t=Le(),n="declare const provider: Provider | undefined;",r=`import { provider } from '@cfxjs/use-wallet-${t}/conflux'; -// same as window.conflux`;return N("section",{children:[v("h3",{children:"provider"}),v("h4",{children:"declare:"}),v(re,{language:"ts",children:n}),v("h4",{children:"Usage:"}),v(re,{language:"ts",children:r}),v("h4",{children:"Description:"}),v("p",{dangerouslySetInnerHTML:{__html:e.step1}}),v("p",{dangerouslySetInnerHTML:{__html:e.step2}})]})},lD=()=>N(Nt,{children:[v(rD,{}),v(uD,{})]});var cD="/assets/fluentAdvance1.d90bd216.jpg",dD="/assets/fluentAdvance2.eea2deb1.jpg";const fD={en:{title1:"Open hosting:",title2:"Determine if MetaMask is hosted:",step1:`Turn on "Priority Connection" in Fluent's Advanced Settings to enable hosting. When hosting is enabled, Fluent will be the default wallet connection in any DApp that uses MetaMask.`,step2:"In the browser, the Fluent wallet injects the window.conflux object in the global scope, while MetaMask injects the window.ethereum object. When Fluent hosting is enabled, Fluent will modify the window.ethereum object in the browser to use Fluent by default when it needs to connect to MetaMask, thus enabling hosting of MetaMask.",step3:"You can use the isFluent field in the provider to determine if the current MetaMask is hosted, and return true if it is hosted, otherwise return false.",step4:"Determining whether a MetaMask is hosted should be done after wallet detection is complete, since the provider is undefined until detection is complete."},zh:{title1:"\u5F00\u542F\u6258\u7BA1\uFF1A",title2:"\u5224\u65AD MetaMask \u662F\u5426\u88AB\u6258\u7BA1\uFF1A",step1:"\u5728 Fluent \u7684\u9AD8\u7EA7\u9009\u9879\u4E2D\u6253\u5F00\u201C\u4F18\u5148\u8FDE\u63A5\u201D\uFF0C\u5373\u53EF\u542F\u7528\u6258\u7BA1\u3002\u542F\u7528\u6258\u7BA1\u540E\uFF0C\u5728\u4EFB\u4F55\u4F7F\u7528 MetaMask \u7684 DApp \u4E2D\uFF0C Fluent \u5C06\u4F1A\u4F5C\u4E3A\u9ED8\u8BA4\u94B1\u5305\u8FDE\u63A5\u3002",step2:"\u5728\u6D4F\u89C8\u5668\u4E2D\uFF0CFluent \u94B1\u5305\u5728\u5168\u5C40\u4F5C\u7528\u57DF\u4E2D\u6CE8\u5165\u4E86 window.conflux \u5BF9\u8C61\uFF0C\u800C MetaMask \u5219\u6CE8\u5165\u4E86 window.ethereum \u5BF9\u8C61\u3002\u5F53\u542F\u7528\u4E86 Fluent \u7684\u6258\u7BA1\u529F\u80FD\u540E\uFF0CFluent \u5C06\u4FEE\u6539\u6D4F\u89C8\u5668\u4E2D\u7684 window.ethereum \u5BF9\u8C61\uFF0C\u4EE5\u4FBF\u5728\u9700\u8981\u8FDE\u63A5\u5230 MetaMask \u65F6\u9ED8\u8BA4\u4F7F\u7528 Fluent\uFF0C\u4ECE\u800C\u5B9E\u73B0\u5BF9 MetaMask \u7684\u6258\u7BA1\u3002",step3:"\u53EF\u4EE5\u901A\u8FC7 provider \u4E2D\u7684 isFluent \u5B57\u6BB5\u5224\u65AD\u5F53\u524D MetaMask \u662F\u5426\u88AB\u6258\u7BA1\uFF0C\u88AB\u6258\u7BA1\u5219\u8FD4\u56DE true\uFF0C\u5426\u5219\u8FD4\u56DE false\u3002",step4:"\u5224\u65AD MetaMask \u662F\u5426\u88AB\u6258\u7BA1\u5E94\u5728\u94B1\u5305\u63A2\u6D4B\u5B8C\u6BD5\u540E\u8FDB\u884C\uFF0C\u56E0\u4E3A provider \u5728\u63A2\u6D4B\u5B8C\u6210\u524D\u4E3A undefined\u3002"}},pD=()=>{const e=Fe(fD),n=`import { provider, completeDetect } from '@cfxjs/use-wallet-${Le()}/ethereum'; +// same as window.conflux`;return N("section",{children:[v("h3",{children:"provider"}),v("h4",{children:"declare:"}),v(re,{language:"ts",children:n}),v("h4",{children:"Usage:"}),v(re,{language:"ts",children:r}),v("h4",{children:"Description:"}),v("p",{dangerouslySetInnerHTML:{__html:e.step1}}),v("p",{dangerouslySetInnerHTML:{__html:e.step2}})]})},lD=()=>N(Nt,{children:[v(rD,{}),v(uD,{})]});var cD="./assets/fluentAdvance1.d90bd216.jpg",dD="./assets/fluentAdvance2.eea2deb1.jpg";const fD={en:{title1:"Open hosting:",title2:"Determine if MetaMask is hosted:",step1:`Turn on "Priority Connection" in Fluent's Advanced Settings to enable hosting. When hosting is enabled, Fluent will be the default wallet connection in any DApp that uses MetaMask.`,step2:"In the browser, the Fluent wallet injects the window.conflux object in the global scope, while MetaMask injects the window.ethereum object. When Fluent hosting is enabled, Fluent will modify the window.ethereum object in the browser to use Fluent by default when it needs to connect to MetaMask, thus enabling hosting of MetaMask.",step3:"You can use the isFluent field in the provider to determine if the current MetaMask is hosted, and return true if it is hosted, otherwise return false.",step4:"Determining whether a MetaMask is hosted should be done after wallet detection is complete, since the provider is undefined until detection is complete."},zh:{title1:"\u5F00\u542F\u6258\u7BA1\uFF1A",title2:"\u5224\u65AD MetaMask \u662F\u5426\u88AB\u6258\u7BA1\uFF1A",step1:"\u5728 Fluent \u7684\u9AD8\u7EA7\u9009\u9879\u4E2D\u6253\u5F00\u201C\u4F18\u5148\u8FDE\u63A5\u201D\uFF0C\u5373\u53EF\u542F\u7528\u6258\u7BA1\u3002\u542F\u7528\u6258\u7BA1\u540E\uFF0C\u5728\u4EFB\u4F55\u4F7F\u7528 MetaMask \u7684 DApp \u4E2D\uFF0C Fluent \u5C06\u4F1A\u4F5C\u4E3A\u9ED8\u8BA4\u94B1\u5305\u8FDE\u63A5\u3002",step2:"\u5728\u6D4F\u89C8\u5668\u4E2D\uFF0CFluent \u94B1\u5305\u5728\u5168\u5C40\u4F5C\u7528\u57DF\u4E2D\u6CE8\u5165\u4E86 window.conflux \u5BF9\u8C61\uFF0C\u800C MetaMask \u5219\u6CE8\u5165\u4E86 window.ethereum \u5BF9\u8C61\u3002\u5F53\u542F\u7528\u4E86 Fluent \u7684\u6258\u7BA1\u529F\u80FD\u540E\uFF0CFluent \u5C06\u4FEE\u6539\u6D4F\u89C8\u5668\u4E2D\u7684 window.ethereum \u5BF9\u8C61\uFF0C\u4EE5\u4FBF\u5728\u9700\u8981\u8FDE\u63A5\u5230 MetaMask \u65F6\u9ED8\u8BA4\u4F7F\u7528 Fluent\uFF0C\u4ECE\u800C\u5B9E\u73B0\u5BF9 MetaMask \u7684\u6258\u7BA1\u3002",step3:"\u53EF\u4EE5\u901A\u8FC7 provider \u4E2D\u7684 isFluent \u5B57\u6BB5\u5224\u65AD\u5F53\u524D MetaMask \u662F\u5426\u88AB\u6258\u7BA1\uFF0C\u88AB\u6258\u7BA1\u5219\u8FD4\u56DE true\uFF0C\u5426\u5219\u8FD4\u56DE false\u3002",step4:"\u5224\u65AD MetaMask \u662F\u5426\u88AB\u6258\u7BA1\u5E94\u5728\u94B1\u5305\u63A2\u6D4B\u5B8C\u6BD5\u540E\u8FDB\u884C\uFF0C\u56E0\u4E3A provider \u5728\u63A2\u6D4B\u5B8C\u6210\u524D\u4E3A undefined\u3002"}},pD=()=>{const e=Fe(fD),n=`import { provider, completeDetect } from '@cfxjs/use-wallet-${Le()}/ethereum'; let isMetaMaskHostedByFluent = false; completeDetect().then(() => { @@ -708,4 +708,4 @@ import { typedSign as typedSignESapce, trackBalanceChangeOnce as trackESapceBalanceChangeOnce, completeDetect as completeDetectESapce, -} from "@cfxjs/use-wallet-${t}/ethereum/Fluent";`;return N("section",{children:[v("h3",{children:"Only Fluent"}),v("p",{dangerouslySetInnerHTML:{__html:Zn(e.step1,{currentLib:t})}}),v("h4",{children:e.title1}),v(re,{language:"ts",children:n}),v("h4",{children:e.title2}),v(re,{language:"ts",children:r})]})},yD=()=>N(Nt,{children:[v(pD,{}),v(mD,{}),v(vD,{})]});var wD="/assets/logo.7f1c7427.svg",ED="/assets/dark-mode.72a5a2b4.svg",CD="/assets/light-mode.048397cc.svg";const xD={en:{Guide:"Guide",API:"API",Demo:"Demo"},zh:{Guide:"\u6307\u5F15",API:"\u63A5\u53E3",Demo:"\u6837\u4F8B"}},SD=[{path:"/home",key:"Guide"},{path:"/api",key:"API"},{path:"/demo",key:"Demo"}],bD=({handleSwitchLocale:e,handleSwitchMode:t})=>{const n=up(),r=Zx(),i=Fe(xD),{pathname:o}=kn(),a=o==="/"?"/home":o;return v("nav",{className:"flex items-center h-16 bg-bg transition-colors shadow-sm z-10",children:N("div",{className:"container mx-auto px-8 h-full flex items-center justify-between",children:[N("div",{className:"h-full flex items-center",children:[v("img",{className:"w-10 h-10 mr-1 translate-y-[-1px]",src:wD,alt:"logo"}),v("span",{className:"mr-4 text-xl text-text1 transition-colors whitespace-nowrap",children:"Fluent use-wallet"}),SD.map(u=>N(Rc,{className:ge("relative text-center transition-colors",r==="zh"?"w-18 ml-4":"w-20 ml-5",n==="light"?"h-full flex justify-center items-center":"h-10 leading-10 rounded-md",a.indexOf(u.path)===-1&&"hover:text-text1 cursor-pointer",a.indexOf(u.path)!==-1?"pointer-events-none text-text1":"text-text2",a.indexOf(u.path)!==-1&&n==="dark"&&"bg-[#4b5563]",a.indexOf(u.path)===-1&&n==="dark"&&"hover:bg-[#374151]"),to:u.path,children:[i[u.key],n==="light"&&v("span",{className:ge("absolute w-full left-0 bottom-0 h-1 rounded-sm bg-primary opacity-0 transition-opacity",a.indexOf(u.path)!==-1&&"opacity-100")})]},u.key))]}),N("div",{className:"flex",children:[v("div",{id:"locale",onClick:e,className:"inline-block w-[24px] h-[24px] cursor-pointer transition-all",children:N("svg",{className:"pointer-events-none transition-all",fill:n==="dark"?"#c2c6cd":"#3D3F4C",viewBox:"0 0 1088 1024",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",children:[v("path",{d:"M729.6 294.4c19.2 57.6 44.8 102.4 89.6 147.2 38.4-38.4 64-89.6 83.2-147.2H729.6zm-422.4 320h166.4l-83.2-224z"}),v("path",{d:"M947.2 0h-768c-70.4 0-128 57.6-128 128v768c0 70.4 57.6 128 128 128h768c70.4 0 128-57.6 128-128V128c0-70.4-51.2-128-128-128zM633.6 825.6c-12.8 12.8-25.6 12.8-38.4 12.8-6.4 0-19.2 0-25.6-6.4s-12.8 0-12.8-6.4-6.4-12.8-12.8-25.6-6.4-19.2-12.8-32l-25.6-70.4h-224L256 768c-12.8 25.6-19.2 44.8-25.6 57.6-6.4 12.8-19.2 12.8-38.4 12.8-12.8 0-25.6-6.4-38.4-12.8-12.8-12.8-19.2-19.2-19.2-32 0-6.4 0-12.8 6.4-25.6s6.4-19.2 12.8-32l140.8-358.4c6.4-12.8 6.4-25.6 12.8-38.4s12.8-25.6 19.2-32 12.8-19.2 25.6-25.6c12.8-6.4 25.6-6.4 38.4-6.4 12.8 0 25.6 0 38.4 6.4 12.8 6.4 19.2 12.8 25.6 25.6 6.4 6.4 12.8 19.2 19.2 32 6.4 12.8 12.8 25.6 19.2 44.8l140.8 352c12.8 25.6 19.2 44.8 19.2 57.6-6.4 6.4-12.8 19.2-19.2 32zm352-249.6c-70.4-25.6-121.6-57.6-166.4-96-44.8 44.8-102.4 76.8-172.8 96l-19.2-32c70.4-19.2 128-44.8 172.8-89.6-44.8-44.8-83.2-102.4-96-166.4h-64v-25.6h172.8c-12.8-19.2-25.6-44.8-38.4-64l19.2-6.4c12.8 19.2 32 44.8 44.8 70.4h160v32h-64c-19.2 64-51.2 121.6-89.6 160 44.8 38.4 96 70.4 166.4 89.6l-25.6 32z"})]})}),v("img",{id:"mode",className:"ml-6 w-6 h-6 cursor-pointer",src:n==="light"?ED:CD,alt:"dark/light mode",onClick:t})]})]})})};var FD=C.exports.memo(bD);const $l=e=>N(et,{path:e,children:[v(et,{index:!0,element:v(C0,{})}),v(et,{path:"basic",element:v(C0,{})},"basic"),v(et,{path:"function",element:v(UA,{})},"function"),v(et,{path:"hooks",element:v(YA,{})},"hooks"),v(et,{path:"utils",element:v(tD,{})},"utils"),v(et,{path:"others",element:v(lD,{})},"others"),v(et,{path:"faq",element:v(yD,{})},"faq")]},e),kD=()=>{const[e,t]=C.exports.useState(()=>{const a=localStorage.getItem("mode")||"light";return a==="light"||a==="dark"?a:"light"});C.exports.useEffect(()=>{e==="dark"?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")},[e]);const n=C.exports.useCallback(()=>{t(a=>{const u=a==="light"?"dark":"light";return localStorage.setItem("mode",u),u})},[]),[r,i]=C.exports.useState(()=>{const a=localStorage.getItem("locale");return a==="en"||a==="zh"?a:navigator.language.includes("zh")?"zh":"en"}),o=C.exports.useCallback(()=>i(a=>{const u=a==="zh"?"en":"zh";return localStorage.setItem("locale",u),u}),[]);return v(yy.Provider,{value:e,children:v(Af.Provider,{value:r,children:N(U4,{children:[v(FD,{handleSwitchLocale:o,handleSwitchMode:n}),v(vv,{contentClassName:"scroll-content",children:N(T4,{children:[v(et,{path:"/",element:v(t6,{})},"Guide"),v(et,{path:"demo",element:v(Um,{})},"Demo"),N(et,{path:"api",element:v(aF,{}),children:[$l("react"),$l("vue3"),$l("svelte")]},"API"),v(et,{path:"demo",element:v(Um,{})},"Demo"),v(et,{path:"api/",element:v(vl,{to:"/api/react"})}),v(et,{path:"api/*",element:v(vl,{to:"/api/react"})}),v(et,{path:"*",element:v(vl,{to:"/"})})]})})]})})})};var F0;const AD=(F0=localStorage.getItem("mode"))!=null?F0:"light";AD==="dark"?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark");Promise.all([R3(),Zb()]).then(()=>{Ul.createRoot(document.getElementById("root")).render(v(kD,{}))})});export default DD(); +} from "@cfxjs/use-wallet-${t}/ethereum/Fluent";`;return N("section",{children:[v("h3",{children:"Only Fluent"}),v("p",{dangerouslySetInnerHTML:{__html:Zn(e.step1,{currentLib:t})}}),v("h4",{children:e.title1}),v(re,{language:"ts",children:n}),v("h4",{children:e.title2}),v(re,{language:"ts",children:r})]})},yD=()=>N(Nt,{children:[v(pD,{}),v(mD,{}),v(vD,{})]});var wD="./assets/logo.7f1c7427.svg",ED="./assets/dark-mode.72a5a2b4.svg",CD="./assets/light-mode.048397cc.svg";const xD={en:{Guide:"Guide",API:"API",Demo:"Demo"},zh:{Guide:"\u6307\u5F15",API:"\u63A5\u53E3",Demo:"\u6837\u4F8B"}},SD=[{path:"/home",key:"Guide"},{path:"/api",key:"API"},{path:"/demo",key:"Demo"}],bD=({handleSwitchLocale:e,handleSwitchMode:t})=>{const n=up(),r=Zx(),i=Fe(xD),{pathname:o}=kn(),a=o==="/"?"/home":o;return v("nav",{className:"flex items-center h-16 bg-bg transition-colors shadow-sm z-10",children:N("div",{className:"container mx-auto px-8 h-full flex items-center justify-between",children:[N("div",{className:"h-full flex items-center",children:[v("img",{className:"w-10 h-10 mr-1 translate-y-[-1px]",src:wD,alt:"logo"}),v("span",{className:"mr-4 text-xl text-text1 transition-colors whitespace-nowrap",children:"Fluent use-wallet"}),SD.map(u=>N(Rc,{className:ge("relative text-center transition-colors",r==="zh"?"w-18 ml-4":"w-20 ml-5",n==="light"?"h-full flex justify-center items-center":"h-10 leading-10 rounded-md",a.indexOf(u.path)===-1&&"hover:text-text1 cursor-pointer",a.indexOf(u.path)!==-1?"pointer-events-none text-text1":"text-text2",a.indexOf(u.path)!==-1&&n==="dark"&&"bg-[#4b5563]",a.indexOf(u.path)===-1&&n==="dark"&&"hover:bg-[#374151]"),to:u.path,children:[i[u.key],n==="light"&&v("span",{className:ge("absolute w-full left-0 bottom-0 h-1 rounded-sm bg-primary opacity-0 transition-opacity",a.indexOf(u.path)!==-1&&"opacity-100")})]},u.key))]}),N("div",{className:"flex",children:[v("div",{id:"locale",onClick:e,className:"inline-block w-[24px] h-[24px] cursor-pointer transition-all",children:N("svg",{className:"pointer-events-none transition-all",fill:n==="dark"?"#c2c6cd":"#3D3F4C",viewBox:"0 0 1088 1024",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",children:[v("path",{d:"M729.6 294.4c19.2 57.6 44.8 102.4 89.6 147.2 38.4-38.4 64-89.6 83.2-147.2H729.6zm-422.4 320h166.4l-83.2-224z"}),v("path",{d:"M947.2 0h-768c-70.4 0-128 57.6-128 128v768c0 70.4 57.6 128 128 128h768c70.4 0 128-57.6 128-128V128c0-70.4-51.2-128-128-128zM633.6 825.6c-12.8 12.8-25.6 12.8-38.4 12.8-6.4 0-19.2 0-25.6-6.4s-12.8 0-12.8-6.4-6.4-12.8-12.8-25.6-6.4-19.2-12.8-32l-25.6-70.4h-224L256 768c-12.8 25.6-19.2 44.8-25.6 57.6-6.4 12.8-19.2 12.8-38.4 12.8-12.8 0-25.6-6.4-38.4-12.8-12.8-12.8-19.2-19.2-19.2-32 0-6.4 0-12.8 6.4-25.6s6.4-19.2 12.8-32l140.8-358.4c6.4-12.8 6.4-25.6 12.8-38.4s12.8-25.6 19.2-32 12.8-19.2 25.6-25.6c12.8-6.4 25.6-6.4 38.4-6.4 12.8 0 25.6 0 38.4 6.4 12.8 6.4 19.2 12.8 25.6 25.6 6.4 6.4 12.8 19.2 19.2 32 6.4 12.8 12.8 25.6 19.2 44.8l140.8 352c12.8 25.6 19.2 44.8 19.2 57.6-6.4 6.4-12.8 19.2-19.2 32zm352-249.6c-70.4-25.6-121.6-57.6-166.4-96-44.8 44.8-102.4 76.8-172.8 96l-19.2-32c70.4-19.2 128-44.8 172.8-89.6-44.8-44.8-83.2-102.4-96-166.4h-64v-25.6h172.8c-12.8-19.2-25.6-44.8-38.4-64l19.2-6.4c12.8 19.2 32 44.8 44.8 70.4h160v32h-64c-19.2 64-51.2 121.6-89.6 160 44.8 38.4 96 70.4 166.4 89.6l-25.6 32z"})]})}),v("img",{id:"mode",className:"ml-6 w-6 h-6 cursor-pointer",src:n==="light"?ED:CD,alt:"dark/light mode",onClick:t})]})]})})};var FD=C.exports.memo(bD);const $l=e=>N(et,{path:e,children:[v(et,{index:!0,element:v(C0,{})}),v(et,{path:"basic",element:v(C0,{})},"basic"),v(et,{path:"function",element:v(UA,{})},"function"),v(et,{path:"hooks",element:v(YA,{})},"hooks"),v(et,{path:"utils",element:v(tD,{})},"utils"),v(et,{path:"others",element:v(lD,{})},"others"),v(et,{path:"faq",element:v(yD,{})},"faq")]},e),kD=()=>{const[e,t]=C.exports.useState(()=>{const a=localStorage.getItem("mode")||"light";return a==="light"||a==="dark"?a:"light"});C.exports.useEffect(()=>{e==="dark"?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")},[e]);const n=C.exports.useCallback(()=>{t(a=>{const u=a==="light"?"dark":"light";return localStorage.setItem("mode",u),u})},[]),[r,i]=C.exports.useState(()=>{const a=localStorage.getItem("locale");return a==="en"||a==="zh"?a:navigator.language.includes("zh")?"zh":"en"}),o=C.exports.useCallback(()=>i(a=>{const u=a==="zh"?"en":"zh";return localStorage.setItem("locale",u),u}),[]);return v(yy.Provider,{value:e,children:v(Af.Provider,{value:r,children:N(U4,{children:[v(FD,{handleSwitchLocale:o,handleSwitchMode:n}),v(vv,{contentClassName:"scroll-content",children:N(T4,{children:[v(et,{path:"/",element:v(t6,{})},"Guide"),v(et,{path:"demo",element:v(Um,{})},"Demo"),N(et,{path:"api",element:v(aF,{}),children:[$l("react"),$l("vue3"),$l("svelte")]},"API"),v(et,{path:"demo",element:v(Um,{})},"Demo"),v(et,{path:"api/",element:v(vl,{to:"/api/react"})}),v(et,{path:"api/*",element:v(vl,{to:"/api/react"})}),v(et,{path:"*",element:v(vl,{to:"/"})})]})})]})})})};var F0;const AD=(F0=localStorage.getItem("mode"))!=null?F0:"light";AD==="dark"?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark");Promise.all([R3(),Zb()]).then(()=>{Ul.createRoot(document.getElementById("root")).render(v(kD,{}))})});export default DD(); diff --git a/index.html b/index.html index 5d70df1..6735cf1 100644 --- a/index.html +++ b/index.html @@ -2,11 +2,11 @@ - + @cfxjs/use-wallet - - + +