import{a3 as zi,a4 as ji}from"./index-b3d5c748.js";var Yt={exports:{}};(function(r,n){(function(){var f,h=0xdeadbeefcafe,u=(h&16777215)==15715070;function s(t,e,i){t!=null&&(typeof t=="number"?this.fromNumber(t,e,i):e==null&&typeof t!="string"?this.fromString(t,256):this.fromString(t,e))}function a(){return new s(null)}function T(t,e,i,o,c,l){for(;--l>=0;){var x=e*this[t++]+i[o]+c;c=Math.floor(x/67108864),i[o++]=x&67108863}return c}function d(t,e,i,o,c,l){for(var x=e&32767,p=e>>15;--l>=0;){var D=this[t]&32767,q=this[t++]>>15,L=p*D+q*x;D=x*D+((L&32767)<<15)+i[o]+(c&1073741823),c=(D>>>30)+(L>>>15)+p*q+(c>>>30),i[o++]=D&1073741823}return c}function B(t,e,i,o,c,l){for(var x=e&16383,p=e>>14;--l>=0;){var D=this[t]&16383,q=this[t++]>>14,L=p*D+q*x;D=x*D+((L&16383)<<14)+i[o]+c,c=(D>>28)+(L>>14)+p*q,i[o++]=D&268435455}return c}var g=typeof navigator<"u";g&&u&&navigator.appName=="Microsoft Internet Explorer"?(s.prototype.am=d,f=30):g&&u&&navigator.appName!="Netscape"?(s.prototype.am=T,f=26):(s.prototype.am=B,f=28),s.prototype.DB=f,s.prototype.DM=(1<=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s}function $(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+this.DV:this.t=0}function R(t){var e=a();return e.fromInt(t),e}function Q(t,e){var i;if(e==16)i=4;else if(e==8)i=3;else if(e==256)i=8;else if(e==2)i=1;else if(e==32)i=5;else if(e==4)i=2;else{this.fromRadix(t,e);return}this.t=0,this.s=0;for(var o=t.length,c=!1,l=0;--o>=0;){var x=i==8?t[o]&255:A(t,o);if(x<0){t.charAt(o)=="-"&&(c=!0);continue}c=!1,l==0?this[this.t++]=x:l+i>this.DB?(this[this.t-1]|=(x&(1<>this.DB-l):this[this.t-1]|=x<=this.DB&&(l-=this.DB)}i==8&&t[0]&128&&(this.s=-1,l>0&&(this[this.t-1]|=(1<0&&this[this.t-1]==t;)--this.t}function xt(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(t==16)e=4;else if(t==8)e=3;else if(t==2)e=1;else if(t==32)e=5;else if(t==4)e=2;else return this.toRadix(t);var i=(1<0)for(p>p)>0&&(c=!0,l=E(o));x>=0;)p>(p+=this.DB-e)):(o=this[x]>>(p-=e)&i,p<=0&&(p+=this.DB,--x)),o>0&&(c=!0),c&&(l+=E(o));return c?l:"0"}function pt(){var t=a();return s.ZERO.subTo(this,t),t}function dt(){return this.s<0?this.negate():this}function gt(t){var e=this.s-t.s;if(e!=0)return e;var i=this.t;if(e=i-t.t,e!=0)return this.s<0?-e:e;for(;--i>=0;)if((e=this[i]-t[i])!=0)return e;return 0}function F(t){var e=1,i;return(i=t>>>16)!=0&&(t=i,e+=16),(i=t>>8)!=0&&(t=i,e+=8),(i=t>>4)!=0&&(t=i,e+=4),(i=t>>2)!=0&&(t=i,e+=2),(i=t>>1)!=0&&(t=i,e+=1),e}function oe(){return this.t<=0?0:this.DB*(this.t-1)+F(this[this.t-1]^this.s&this.DM)}function fe(t,e){var i;for(i=this.t-1;i>=0;--i)e[i+t]=this[i];for(i=t-1;i>=0;--i)e[i]=0;e.t=this.t+t,e.s=this.s}function he(t,e){for(var i=t;i=0;--p)e[p+l+1]=this[p]>>o|x,x=(this[p]&c)<=0;--p)e[p]=0;e[l]=x,e.t=this.t+l+1,e.s=this.s,e.clamp()}function ce(t,e){e.s=this.s;var i=Math.floor(t/this.DB);if(i>=this.t){e.t=0;return}var o=t%this.DB,c=this.DB-o,l=(1<>o;for(var x=i+1;x>o;o>0&&(e[this.t-i-1]|=(this.s&l)<>=this.DB;if(t.t>=this.DB;o+=this.s}else{for(o+=this.s;i>=this.DB;o-=t.s}e.s=o<0?-1:0,o<-1?e[i++]=this.DV+o:o>0&&(e[i++]=o),e.t=i,e.clamp()}function ae(t,e){var i=this.abs(),o=t.abs(),c=i.t;for(e.t=c+o.t;--c>=0;)e[c]=0;for(c=0;c=0;)t[i]=0;for(i=0;i=e.DV&&(t[i+e.t]-=e.DV,t[i+e.t+1]=1)}t.t>0&&(t[t.t-1]+=e.am(i,e[i],t,2*i,0,1)),t.s=0,t.clamp()}function pe(t,e,i){var o=t.abs();if(!(o.t<=0)){var c=this.abs();if(c.t0?(o.lShiftTo(D,l),c.lShiftTo(D,i)):(o.copyTo(l),c.copyTo(i));var q=l.t,L=l[q-1];if(L!=0){var H=L*(1<1?l[q-2]>>this.F2:0),_=this.FV/H,yt=(1<=0&&(i[i.t++]=1,i.subTo(G,i)),s.ONE.dlShiftTo(q,G),G.subTo(l,l);l.t=0;){var Et=i[--k]==L?this.DM:Math.floor(i[k]*_+(i[k-1]+j)*yt);if((i[k]+=l.am(0,Et,i,vt,0,q))0&&i.rShiftTo(D,i),x<0&&s.ZERO.subTo(i,i)}}}function de(t){var e=a();return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(s.ZERO)>0&&t.subTo(e,e),e}function tt(t){this.m=t}function ge(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t}function me(t){return t}function ye(t){t.divRemTo(this.m,null,t)}function ve(t,e,i){t.multiplyTo(e,i),this.reduce(i)}function be(t,e){t.squareTo(e),this.reduce(e)}tt.prototype.convert=ge,tt.prototype.revert=me,tt.prototype.reduce=ye,tt.prototype.mulTo=ve,tt.prototype.sqrTo=be;function Te(){if(this.t<1)return 0;var t=this[0];if(!(t&1))return 0;var e=t&3;return e=e*(2-(t&15)*e)&15,e=e*(2-(t&255)*e)&255,e=e*(2-((t&65535)*e&65535))&65535,e=e*(2-t*e%this.DV)%this.DV,e>0?this.DV-e:-e}function et(t){this.m=t,this.mp=t.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<0&&this.m.subTo(e,e),e}function Fe(t){var e=a();return t.copyTo(e),this.reduce(e),e}function Be(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e>15)*this.mpl&this.um)<<15)&t.DM;for(i=e+this.m.t,t[i]+=this.m.am(0,o,t,e,0,this.m.t);t[i]>=t.DV;)t[i]-=t.DV,t[++i]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)}function Se(t,e){t.squareTo(e),this.reduce(e)}function De(t,e,i){t.multiplyTo(e,i),this.reduce(i)}et.prototype.convert=we,et.prototype.revert=Fe,et.prototype.reduce=Be,et.prototype.mulTo=De,et.prototype.sqrTo=Se;function Ie(){return(this.t>0?this[0]&1:this.s)==0}function qe(t,e){if(t>4294967295||t<1)return s.ONE;var i=a(),o=a(),c=e.convert(this),l=F(t)-1;for(c.copyTo(i);--l>=0;)if(e.sqrTo(i,o),(t&1<0)e.mulTo(o,c,i);else{var x=i;i=o,o=x}return e.revert(i)}function Ee(t,e){var i;return t<256||e.isEven()?i=new tt(e):i=new et(e),this.exp(t,i)}s.prototype.copyTo=M,s.prototype.fromInt=$,s.prototype.fromString=Q,s.prototype.clamp=J,s.prototype.dlShiftTo=fe,s.prototype.drShiftTo=he,s.prototype.lShiftTo=ue,s.prototype.rShiftTo=ce,s.prototype.subTo=le,s.prototype.multiplyTo=ae,s.prototype.squareTo=xe,s.prototype.divRemTo=pe,s.prototype.invDigit=Te,s.prototype.isEven=Ie,s.prototype.exp=qe,s.prototype.toString=xt,s.prototype.negate=pt,s.prototype.abs=dt,s.prototype.compareTo=gt,s.prototype.bitLength=oe,s.prototype.mod=de,s.prototype.modPowInt=Ee,s.ZERO=R(0),s.ONE=R(1);function Ae(){var t=a();return this.copyTo(t),t}function Re(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this[0];if(this.t==0)return 0}return(this[1]&(1<<32-this.DB)-1)<>24}function Ce(){return this.t==0?this.s:this[0]<<16>>16}function Me(t){return Math.floor(Math.LN2*this.DB/Math.log(t))}function Oe(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function He(t){if(t==null&&(t=10),this.signum()==0||t<2||t>36)return"0";var e=this.chunkSize(t),i=Math.pow(t,e),o=R(i),c=a(),l=a(),x="";for(this.divRemTo(o,c,l);c.signum()>0;)x=(i+l.intValue()).toString(t).substr(1)+x,c.divRemTo(o,c,l);return l.intValue().toString(t)+x}function Ve(t,e){this.fromInt(0),e==null&&(e=10);for(var i=this.chunkSize(e),o=Math.pow(e,i),c=!1,l=0,x=0,p=0;p=i&&(this.dMultiply(o),this.dAddOffset(x,0),l=0,x=0)}l>0&&(this.dMultiply(Math.pow(e,l)),this.dAddOffset(x,0)),c&&s.ZERO.subTo(this,this)}function Le(t,e,i){if(typeof e=="number")if(t<2)this.fromInt(1);else for(this.fromNumber(t,i),this.testBit(t-1)||this.bitwiseTo(s.ONE.shiftLeft(t-1),Dt,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(s.ONE.shiftLeft(t-1),this);else{var o=new Array,c=t&7;o.length=(t>>3)+1,e.nextBytes(o),c>0?o[0]&=(1<0)for(i>i)!=(this.s&this.DM)>>i&&(e[c++]=o|this.s<=0;)i<8?(o=(this[t]&(1<>(i+=this.DB-8)):(o=this[t]>>(i-=8)&255,i<=0&&(i+=this.DB,--t)),o&128&&(o|=-256),c==0&&(this.s&128)!=(o&128)&&++c,(c>0||o!=this.s)&&(e[c++]=o);return e}function ze(t){return this.compareTo(t)==0}function je(t){return this.compareTo(t)<0?this:t}function ke(t){return this.compareTo(t)>0?this:t}function Ze(t,e,i){var o,c,l=Math.min(t.t,this.t);for(o=0;o>=16,e+=16),t&255||(t>>=8,e+=8),t&15||(t>>=4,e+=4),t&3||(t>>=2,e+=2),t&1||++e,e}function Je(){for(var t=0;t=this.t?this.s!=0:(this[e]&1<>=this.DB;if(t.t>=this.DB;o+=this.s}else{for(o+=this.s;i>=this.DB;o+=t.s}e.s=o<0?-1:0,o>0?e[i++]=o:o<-1&&(e[i++]=this.DV+o),e.t=i,e.clamp()}function hi(t){var e=a();return this.addTo(t,e),e}function ui(t){var e=a();return this.subTo(t,e),e}function ci(t){var e=a();return this.multiplyTo(t,e),e}function li(){var t=a();return this.squareTo(t),t}function ai(t){var e=a();return this.divRemTo(t,e,null),e}function xi(t){var e=a();return this.divRemTo(t,null,e),e}function pi(t){var e=a(),i=a();return this.divRemTo(t,e,i),new Array(e,i)}function di(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()}function gi(t,e){if(t!=0){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=t;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}}function ct(){}function Ot(t){return t}function mi(t,e,i){t.multiplyTo(e,i)}function yi(t,e){t.squareTo(e)}ct.prototype.convert=Ot,ct.prototype.revert=Ot,ct.prototype.mulTo=mi,ct.prototype.sqrTo=yi;function vi(t){return this.exp(t,new ct)}function bi(t,e,i){var o=Math.min(this.t+t.t,e);for(i.s=0,i.t=o;o>0;)i[--o]=0;var c;for(c=i.t-this.t;o=0;)i[o]=0;for(o=Math.max(e-this.t,0);o2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=a();return t.copyTo(e),this.reduce(e),e}function Fi(t){return t}function Bi(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)}function Si(t,e){t.squareTo(e),this.reduce(e)}function Di(t,e,i){t.multiplyTo(e,i),this.reduce(i)}it.prototype.convert=wi,it.prototype.revert=Fi,it.prototype.reduce=Bi,it.prototype.mulTo=Di,it.prototype.sqrTo=Si;function Ii(t,e){var i=t.bitLength(),o,c=R(1),l;if(i<=0)return c;i<18?o=1:i<48?o=3:i<144?o=4:i<768?o=5:o=6,i<8?l=new tt(e):e.isEven()?l=new it(e):l=new et(e);var x=new Array,p=3,D=o-1,q=(1<1){var L=a();for(l.sqrTo(x[1],L);p<=q;)x[p]=a(),l.mulTo(L,x[p-2],x[p]),p+=2}var H=t.t-1,_,yt=!0,j=a(),k;for(i=F(t[H])-1;H>=0;){for(i>=D?_=t[H]>>i-D&q:(_=(t[H]&(1<0&&(_|=t[H-1]>>this.DB+i-D)),p=o;!(_&1);)_>>=1,--p;if((i-=p)<0&&(i+=this.DB,--H),yt)x[_].copyTo(c),yt=!1;else{for(;p>1;)l.sqrTo(c,j),l.sqrTo(j,c),p-=2;p>0?l.sqrTo(c,j):(k=c,c=j,j=k),l.mulTo(j,x[_],c)}for(;H>=0&&!(t[H]&1<0&&(e.rShiftTo(l,e),i.rShiftTo(l,i));e.signum()>0;)(c=e.getLowestSetBit())>0&&e.rShiftTo(c,e),(c=i.getLowestSetBit())>0&&i.rShiftTo(c,i),e.compareTo(i)>=0?(e.subTo(i,e),e.rShiftTo(1,e)):(i.subTo(e,i),i.rShiftTo(1,i));return l>0&&i.lShiftTo(l,i),i}function Ei(t){if(t<=0)return 0;var e=this.DV%t,i=this.s<0?t-1:0;if(this.t>0)if(e==0)i=this[0]%t;else for(var o=this.t-1;o>=0;--o)i=(e*i+this[o])%t;return i}function Ai(t){var e=t.isEven();if(this.isEven()&&e||t.signum()==0)return s.ZERO;for(var i=t.clone(),o=this.clone(),c=R(1),l=R(0),x=R(0),p=R(1);i.signum()!=0;){for(;i.isEven();)i.rShiftTo(1,i),e?((!c.isEven()||!l.isEven())&&(c.addTo(this,c),l.subTo(t,l)),c.rShiftTo(1,c)):l.isEven()||l.subTo(t,l),l.rShiftTo(1,l);for(;o.isEven();)o.rShiftTo(1,o),e?((!x.isEven()||!p.isEven())&&(x.addTo(this,x),p.subTo(t,p)),x.rShiftTo(1,x)):p.isEven()||p.subTo(t,p),p.rShiftTo(1,p);i.compareTo(o)>=0?(i.subTo(o,i),e&&c.subTo(x,c),l.subTo(p,l)):(o.subTo(i,o),e&&x.subTo(c,x),p.subTo(l,p))}if(o.compareTo(s.ONE)!=0)return s.ZERO;if(p.compareTo(t)>=0)return p.subtract(t);if(p.signum()<0)p.addTo(t,p);else return p;return p.signum()<0?p.add(t):p}var P=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],Ri=(1<<26)/P[P.length-1];function Pi(t){var e,i=this.abs();if(i.t==1&&i[0]<=P[P.length-1]){for(e=0;e>1,t>P.length&&(t=P.length);for(var c=a(),l=0;l>8&255,O[I++]^=t>>16&255,O[I++]^=t>>24&255,I>=qt&&(I-=qt)}function Ht(){Mi(new Date().getTime())}if(O==null){O=new Array,I=0;var z;if(typeof window<"u"&&window.crypto){if(window.crypto.getRandomValues){var Vt=new Uint8Array(32);for(window.crypto.getRandomValues(Vt),z=0;z<32;++z)O[I++]=Vt[z]}else if(navigator.appName=="Netscape"&&navigator.appVersion<"5"){var Lt=window.crypto.random(32);for(z=0;z>>8,O[I++]=z&255;I=0,Ht()}function Oi(){if(mt==null){for(Ht(),mt=Ni(),mt.init(O),I=0;In.getEncodedHex()).join(""),this.v}}function Xt(r,n){return+r[n+2]<8?1:+r.substr(n+2,2)&127+1}function jt(r,n){const f=Xt(r,n),h=r.substr(n+2,f*2);return h?(+h[0]<8?new ht(h,16):new ht(h.substr(2),16)).intValue():-1}function At(r,n){const f=Xt(r,n);return n+(f+1)*2}var Ui={encodeDer(r,n){const f=new zt(r),h=new zt(n);return new Zi([f,h]).getEncodedHex()},decodeDer(r){const n=At(r,0),f=At(r,n),h=jt(r,n),u=r.substr(f,h*2),s=f+u.length,a=At(r,s),T=jt(r,s),d=r.substr(a,T*2),B=new ht(u,16),g=new ht(d,16);return{r:B,s:g}}};const{BigInteger:C}=St,kt=new C("2"),Zt=new C("3");class K{constructor(n,f){this.x=f,this.q=n}equals(n){return n===this?!0:this.q.equals(n.q)&&this.x.equals(n.x)}toBigInteger(){return this.x}negate(){return new K(this.q,this.x.negate().mod(this.q))}add(n){return new K(this.q,this.x.add(n.toBigInteger()).mod(this.q))}subtract(n){return new K(this.q,this.x.subtract(n.toBigInteger()).mod(this.q))}multiply(n){return new K(this.q,this.x.multiply(n.toBigInteger()).mod(this.q))}divide(n){return new K(this.q,this.x.multiply(n.toBigInteger().modInverse(this.q)).mod(this.q))}square(){return new K(this.q,this.x.square().mod(this.q))}}class W{constructor(n,f,h,u){this.curve=n,this.x=f,this.y=h,this.z=u??C.ONE,this.zinv=null}getX(){return this.zinv===null&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.x.toBigInteger().multiply(this.zinv).mod(this.curve.q))}getY(){return this.zinv===null&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.y.toBigInteger().multiply(this.zinv).mod(this.curve.q))}equals(n){return n===this?!0:this.isInfinity()?n.isInfinity():n.isInfinity()?this.isInfinity():n.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(n.z)).mod(this.curve.q).equals(C.ZERO)?n.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(n.z)).mod(this.curve.q).equals(C.ZERO):!1}isInfinity(){return this.x===null&&this.y===null?!0:this.z.equals(C.ZERO)&&!this.y.toBigInteger().equals(C.ZERO)}negate(){return new W(this.curve,this.x,this.y.negate(),this.z)}add(n){if(this.isInfinity())return n;if(n.isInfinity())return this;const f=this.x.toBigInteger(),h=this.y.toBigInteger(),u=this.z,s=n.x.toBigInteger(),a=n.y.toBigInteger(),T=n.z,d=this.curve.q,B=f.multiply(T).mod(d),g=s.multiply(u).mod(d),m=B.subtract(g),v=h.multiply(T).mod(d),w=a.multiply(u).mod(d),y=v.subtract(w);if(C.ZERO.equals(m))return C.ZERO.equals(y)?this.twice():this.curve.infinity;const S=B.add(g),E=u.multiply(T).mod(d),A=m.square().mod(d),M=m.multiply(A).mod(d),$=E.multiply(y.square()).subtract(S.multiply(A)).mod(d),R=m.multiply($).mod(d),Q=y.multiply(A.multiply(B).subtract($)).subtract(v.multiply(M)).mod(d),J=M.multiply(E).mod(d);return new W(this.curve,this.curve.fromBigInteger(R),this.curve.fromBigInteger(Q),J)}twice(){if(this.isInfinity())return this;if(!this.y.toBigInteger().signum())return this.curve.infinity;const n=this.x.toBigInteger(),f=this.y.toBigInteger(),h=this.z,u=this.curve.q,s=this.curve.a.toBigInteger(),a=n.square().multiply(Zt).add(s.multiply(h.square())).mod(u),T=f.shiftLeft(1).multiply(h).mod(u),d=f.square().mod(u),B=d.multiply(n).multiply(h).mod(u),g=T.square().mod(u),m=a.square().subtract(B.shiftLeft(3)).mod(u),v=T.multiply(m).mod(u),w=a.multiply(B.shiftLeft(2).subtract(m)).subtract(g.shiftLeft(1).multiply(d)).mod(u),y=T.multiply(g).mod(u);return new W(this.curve,this.curve.fromBigInteger(v),this.curve.fromBigInteger(w),y)}multiply(n){if(this.isInfinity())return this;if(!n.signum())return this.curve.infinity;const f=n.multiply(Zt),h=this.negate();let u=this;for(let s=f.bitLength()-2;s>0;s--){u=u.twice();const a=f.testBit(s),T=n.testBit(s);a!==T&&(u=u.add(a?this:h))}return u}}let $i=class{constructor(n,f,h){this.q=n,this.a=this.fromBigInteger(f),this.b=this.fromBigInteger(h),this.infinity=new W(this,null,null)}equals(n){return n===this?!0:this.q.equals(n.q)&&this.a.equals(n.a)&&this.b.equals(n.b)}fromBigInteger(n){return new K(this.q,n)}decodePointHex(n){switch(parseInt(n.substr(0,2),16)){case 0:return this.infinity;case 2:case 3:const f=this.fromBigInteger(new C(n.substr(2),16));let h=this.fromBigInteger(f.multiply(f.square()).add(f.multiply(this.a)).add(this.b).toBigInteger().modPow(this.q.divide(new C("4")).add(C.ONE),this.q));return h.toBigInteger().mod(kt).equals(new C(n.substr(0,2),16).subtract(kt))||(h=h.negate()),new W(this,f,h);case 4:case 6:case 7:const u=(n.length-2)/2,s=n.substr(2,u),a=n.substr(u+2,u);return new W(this,this.fromBigInteger(new C(s,16)),this.fromBigInteger(new C(a,16)));default:return null}}};var _i={ECPointFp:W,ECCurveFp:$i};const{BigInteger:U,SecureRandom:Gi}=St,{ECCurveFp:Yi}=_i,Ki=new Gi,{curve:ft,G:Xi,n:Ut}=Wt();function Wi(){return ft}function Wt(){const r=new U("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFF",16),n=new U("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFC",16),f=new U("28E9FA9E9D9F5E344D5A9E4BCF6509A7F39789F515AB8F92DDBCBD414D940E93",16),h=new Yi(r,n,f),u="32C4AE2C1F1981195F9904466A39C9948FE30BBFF2660BE1715A4589334C74C7",s="BC3736A2F4F6779C59BDCEE36B692153D0A9877CC62A474002DF32E52139F0A0",a=h.decodePointHex("04"+u+s),T=new U("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFF7203DF6B21C6052B53BBF40939D54123",16);return{curve:h,G:a,n:T}}function Qi(r,n,f){const u=(r?new U(r,n,f):new U(Ut.bitLength(),Ki)).mod(Ut.subtract(U.ONE)).add(U.ONE),s=lt(u.toString(16),64),a=Xi.multiply(u),T=lt(a.getX().toBigInteger().toString(16),64),d=lt(a.getY().toBigInteger().toString(16),64),B="04"+T+d;return{privateKey:s,publicKey:B}}function Ji(r){if(r.length!==130)throw new Error("Invalid public key to compress");const n=(r.length-2)/2,f=r.substr(2,n),h=new U(r.substr(n+2,n),16);let u="03";return h.mod(new U("2")).equals(U.ZERO)&&(u="02"),u+f}function tn(r){r=unescape(encodeURIComponent(r));const n=r.length,f=[];for(let u=0;u>>2]|=(r.charCodeAt(u)&255)<<24-u%4*8;const h=[];for(let u=0;u>>2]>>>24-u%4*8&255;h.push((s>>>4).toString(16)),h.push((s&15).toString(16))}return h.join("")}function lt(r,n){return r.length>=n?r:new Array(n-r.length+1).join("0")+r}function en(r){return r.map(n=>(n=n.toString(16),n.length===1?"0"+n:n)).join("")}function nn(r){const n=[];let f=0;for(let h=0;h>>3]|=parseInt(r[f],10)<<24-h%8*4,f++;try{const h=[];for(let u=0;u>>2]>>>24-u%4*8&255;h.push(String.fromCharCode(s))}return decodeURIComponent(escape(h.join("")))}catch{throw new Error("Malformed UTF-8 data")}}function rn(r){const n=[];let f=r.length;f%2!==0&&(r=lt(r,f+1)),f=r.length;for(let h=0;h>>32-f}function $t(r,n){const f=[];for(let h=r.length-1;h>=0;h--)f[h]=(r[h]^n[h])&255;return f}function hn(r){return r^N(r,9)^N(r,17)}function un(r){return r^N(r,15)^N(r,23)}function Bt(r){let n=r.length*8,f=n%512;f=f>=448?512-f%448-1:448-f-1;const h=new Array((f-7)/8),u=new Array(8);for(let g=0,m=h.length;g=0;g--)if(n.length>8){const m=n.length-8;u[g]=parseInt(n.substr(m),2),n=n.substr(0,m)}else n.length>0&&(u[g]=parseInt(n,2),n="");const s=new Uint8Array([...r,128,...h,...u]),a=new DataView(s.buffer,0),T=s.length/64,d=new Uint32Array([1937774191,1226093241,388252375,3666478592,2842636476,372324522,3817729613,2969243214]);for(let g=0;g=0&&F<=15?v:w,J=N(N(y,12)+M+N(gt,F),7),xt=J^N(y,12),pt=(F>=0&&F<=15?y^S^E:y&S|y&E|S&E)+A+xt+Rt[F],dt=(F>=0&&F<=15?M^$^R:M&$|~M&R)+Q+J+Z[F],A=E,E=N(S,9),S=y,y=pt,Q=R,R=N($,19),$=M,M=hn(dt);d[0]^=y,d[1]^=S,d[2]^=E,d[3]^=A,d[4]^=M,d[5]^=$,d[6]^=R,d[7]^=Q}const B=[];for(let g=0,m=d.length;g>>24,(v&16711680)>>>16,(v&65280)>>>8,v&255)}return B}const at=64,Qt=new Uint8Array(at),Jt=new Uint8Array(at);for(let r=0;rat&&(n=Bt(n));n.length128&&(s=s.substr(s.length-128));const a=n.multiply(u),T=b.hexToArray(b.leftPad(a.getX().toBigInteger().toRadix(16),64)),d=b.hexToArray(b.leftPad(a.getY().toBigInteger().toRadix(16),64)),B=b.arrayToHex(ut([].concat(T,r,d)));let g=1,m=0,v=[];const w=[].concat(T,d),y=()=>{v=ut([...w,g>>24&255,g>>16&255,g>>8&255,g&255]),g++,m=0};y();for(let E=0,A=r.length;E{w=ut([...y,m>>24&255,m>>16&255,m>>8&255,m&255]),m++,v=0};S();for(let A=0,M=a.length;A>8&255);const m=ut(B);return b.arrayToHex(ut(m.concat(b.hexToArray(r))))}function re(r){const n=rt.multiply(new V(r,16)),f=b.leftPad(n.getX().toBigInteger().toString(16),64),h=b.leftPad(n.getY().toBigInteger().toString(16),64);return"04"+f+h}function se(){const r=b.generateKeyPairHex(),n=ee.decodePointHex(r.publicKey);return r.k=new V(r.privateKey,16),r.x1=n.getX().toBigInteger(),r}var mn={generateKeyPairHex:b.generateKeyPairHex,compressPublicKeyHex:b.compressPublicKeyHex,comparePublicKeyHex:b.comparePublicKeyHex,doEncrypt:xn,doDecrypt:pn,doSignature:dn,doVerifySignature:gn,getPublicKeyFromPrivateKey:re,getPoint:se,verifyPublicKey:b.verifyPublicKey};const{sm3:yn,hmac:vn}=te;function bn(r,n){return r.length>=n?r:new Array(n-r.length+1).join("0")+r}function _t(r){return r.map(n=>(n=n.toString(16),n.length===1?"0"+n:n)).join("")}function Tn(r){const n=[];let f=r.length;f%2!==0&&(r=bn(r,f+1)),f=r.length;for(let h=0;h>>6),n.push(128|u&63);else if(u<=55295||u>=57344&&u<=65535)n.push(224|u>>>12),n.push(128|u>>>6&63),n.push(128|u&63);else if(u>=65536&&u<=1114111)f++,n.push(240|u>>>18&28),n.push(128|u>>>12&63),n.push(128|u>>>6&63),n.push(128|u&63);else throw n.push(u),new Error("input is not supported")}return n}var Fn=function(r,n){if(r=typeof r=="string"?wn(r):Array.prototype.slice.call(r),n){if((n.mode||"hmac")!=="hmac")throw new Error("invalid mode");let h=n.key;if(!h)throw new Error("invalid key");return h=typeof h=="string"?Tn(h):Array.prototype.slice.call(h),_t(vn(r,h))}return _t(yn(r))};const Y=0,Bn=32,nt=16,bt=[214,144,233,254,204,225,61,183,22,182,20,194,40,251,44,5,43,103,154,118,42,190,4,195,170,68,19,38,73,134,6,153,156,66,80,244,145,239,152,122,51,84,11,67,237,207,172,98,228,179,28,169,201,8,232,149,128,223,148,250,117,143,63,166,71,7,167,252,243,115,23,186,131,89,60,25,230,133,79,168,104,107,129,178,113,100,218,139,248,235,15,75,112,86,157,53,30,36,14,94,99,88,209,162,37,34,124,59,1,33,120,135,212,0,70,87,159,211,39,82,76,54,2,231,160,196,200,158,234,191,138,210,64,199,56,181,163,247,242,206,249,97,21,161,224,174,93,164,155,52,26,85,173,147,50,48,245,140,177,227,29,246,226,46,130,102,202,96,192,41,35,171,13,83,78,111,213,219,55,69,222,253,142,47,3,255,106,114,109,108,91,81,141,27,175,146,187,221,188,127,17,217,92,65,31,16,90,216,10,193,49,136,165,205,123,189,45,116,208,18,184,229,180,176,137,105,151,74,12,150,119,126,101,185,241,9,197,110,198,132,24,240,125,236,58,220,77,32,121,238,95,62,215,203,57,72],Tt=[462357,472066609,943670861,1415275113,1886879365,2358483617,2830087869,3301692121,3773296373,4228057617,404694573,876298825,1347903077,1819507329,2291111581,2762715833,3234320085,3705924337,4177462797,337322537,808926789,1280531041,1752135293,2223739545,2695343797,3166948049,3638552301,4110090761,269950501,741554753,1213159005,1684763257];function Pt(r){const n=[];for(let f=0,h=r.length;f(n=n.toString(16),n.length===1?"0"+n:n)).join("")}function Dn(r){const n=[];for(let f=0,h=r.length;f>>6),n.push(128|u&63);else if(u<=55295||u>=57344&&u<=65535)n.push(224|u>>>12),n.push(128|u>>>6&63),n.push(128|u&63);else if(u>=65536&&u<=1114111)f++,n.push(240|u>>>18&28),n.push(128|u>>>12&63),n.push(128|u>>>6&63),n.push(128|u&63);else throw n.push(u),new Error("input is not supported")}return n}function In(r){const n=[];for(let f=0,h=r.length;f=240&&r[f]<=247?(n.push(String.fromCodePoint(((r[f]&7)<<18)+((r[f+1]&63)<<12)+((r[f+2]&63)<<6)+(r[f+3]&63))),f+=3):r[f]>=224&&r[f]<=239?(n.push(String.fromCodePoint(((r[f]&15)<<12)+((r[f+1]&63)<<6)+(r[f+2]&63))),f+=2):r[f]>=192&&r[f]<=223?(n.push(String.fromCodePoint(((r[f]&31)<<6)+(r[f+1]&63))),f++):n.push(String.fromCodePoint(r[f]));return n.join("")}function ot(r,n){const f=n&31;return r<>>32-f}function X(r){return(bt[r>>>24&255]&255)<<24|(bt[r>>>16&255]&255)<<16|(bt[r>>>8&255]&255)<<8|bt[r&255]&255}function wt(r){return r^ot(r,2)^ot(r,10)^ot(r,18)^ot(r,24)}function Ft(r){return r^ot(r,13)^ot(r,23)}function qn(r,n,f){const h=new Array(4),u=new Array(4);for(let s=0;s<4;s++)u[0]=r[4*s]&255,u[1]=r[4*s+1]&255,u[2]=r[4*s+2]&255,u[3]=r[4*s+3]&255,h[s]=u[0]<<24|u[1]<<16|u[2]<<8|u[3];for(let s=0,a;s<32;s+=4)a=h[1]^h[2]^h[3]^f[s+0],h[0]^=wt(X(a)),a=h[2]^h[3]^h[0]^f[s+1],h[1]^=wt(X(a)),a=h[3]^h[0]^h[1]^f[s+2],h[2]^=wt(X(a)),a=h[0]^h[1]^h[2]^f[s+3],h[3]^=wt(X(a));for(let s=0;s<16;s+=4)n[s]=h[3-s/4]>>>24&255,n[s+1]=h[3-s/4]>>>16&255,n[s+2]=h[3-s/4]>>>8&255,n[s+3]=h[3-s/4]&255}function En(r,n,f){const h=new Array(4),u=new Array(4);for(let s=0;s<4;s++)u[0]=r[0+4*s]&255,u[1]=r[1+4*s]&255,u[2]=r[2+4*s]&255,u[3]=r[3+4*s]&255,h[s]=u[0]<<24|u[1]<<16|u[2]<<8|u[3];h[0]^=2746333894,h[1]^=1453994832,h[2]^=1736282519,h[3]^=2993693404;for(let s=0,a;s<32;s+=4)a=h[1]^h[2]^h[3]^Tt[s+0],n[s+0]=h[0]^=Ft(X(a)),a=h[2]^h[3]^h[0]^Tt[s+1],n[s+1]=h[1]^=Ft(X(a)),a=h[3]^h[0]^h[1]^Tt[s+2],n[s+2]=h[2]^=Ft(X(a)),a=h[0]^h[1]^h[2]^Tt[s+3],n[s+3]=h[3]^=Ft(X(a));if(f===Y)for(let s=0,a;s<16;s++)a=n[s],n[s]=n[31-s],n[31-s]=a}function Gt(r,n,f,{padding:h="pkcs#7",mode:u,iv:s=[],output:a="string"}={}){if(u==="cbc"&&(typeof s=="string"&&(s=Pt(s)),s.length!==128/8))throw new Error("iv is invalid");if(typeof n=="string"&&(n=Pt(n)),n.length!==128/8)throw new Error("key is invalid");if(typeof r=="string"?f!==Y?r=Dn(r):r=Pt(r):r=[...r],(h==="pkcs#5"||h==="pkcs#7")&&f!==Y){const v=nt-r.length%nt;for(let w=0;w=nt;){const v=r.slice(m,m+16),w=new Array(16);if(u==="cbc")for(let y=0;y