>>0,N=new Uint8Array(B);S[M];){var L=t[S.charCodeAt(M)];if(L===255)return;for(var H=0,W=B-1;(L!==0||H>>0,N[W]=L%256>>>0,L=L/256>>>0;if(L!==0)throw new Error("Non-zero carry");P=H,M++}for(var K=B-P;K!==B&&N[K]===0;)K++;var X=qa.allocUnsafe(O+(B-K));X.fill(0,0,O);for(var q=O;K!==B;)X[q++]=N[K++];return X}function x(S){var M=w(S);if(M)return M;throw new Error("Non-base"+a+" character")}return{encode:p,decodeUnsafe:w,decode:x}}Pd.exports=X6});var bc=T((BB,Rd)=>{var Y6=Bd(),J6="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";Rd.exports=Y6(J6)});var Nd=T((RB,kd)=>{"use strict";var gc=bc(),Z6=qt().Buffer;kd.exports=function(e){function t(s){var a=e(s);return gc.encode(Z6.concat([s,a],s.length+4))}function r(s){var a=s.slice(0,-4),u=s.slice(-4),l=e(a);if(!(u[0]^l[0]|u[1]^l[1]|u[2]^l[2]|u[3]^l[3]))return a}function n(s){var a=gc.decodeUnsafe(s);if(!!a)return r(a)}function i(s){var a=gc.decode(s),u=r(a,e);if(!u)throw new Error("Invalid checksum");return u}return{encode:t,decode:i,decodeUnsafe:n}}});var ci=T((kB,qd)=>{"use strict";var Cd=ka(),Q6=Nd();function e_(e){var t=Cd("sha256").update(e).digest();return Cd("sha256").update(t).digest()}qd.exports=Q6(e_)});var Ud=T((NB,Ld)=>{var La=require("path").sep||"/";Ld.exports=t_;function t_(e){if(typeof e!="string"||e.length<=7||e.substring(0,7)!="file://")throw new TypeError("must pass in a file:// URI to convert to a file path");var t=decodeURI(e.substring(7)),r=t.indexOf("/"),n=t.substring(0,r),i=t.substring(r+1);return n=="localhost"&&(n=""),n&&(n=La+La+n),i=i.replace(/^(.+)\|/,"$1:"),La=="\\"&&(i=i.replace(/\//g,"\\")),/^.+\:/.test(i)||(i=La+i),n+i}});var Kd=T((os,Fd)=>{var mc=require("fs"),Da=require("path"),r_=Ud(),Ua=Da.join,n_=Da.dirname,Dd=mc.accessSync&&function(e){try{mc.accessSync(e)}catch{return!1}return!0}||mc.existsSync||Da.existsSync,Hd={arrow:process.env.NODE_BINDINGS_ARROW||" \u2192 ",compiled:process.env.NODE_BINDINGS_COMPILED_DIR||"compiled",platform:process.platform,arch:process.arch,nodePreGyp:"node-v"+process.versions.modules+"-"+process.platform+"-"+process.arch,version:process.versions.node,bindings:"bindings.node",try:[["module_root","build","bindings"],["module_root","build","Debug","bindings"],["module_root","build","Release","bindings"],["module_root","out","Debug","bindings"],["module_root","Debug","bindings"],["module_root","out","Release","bindings"],["module_root","Release","bindings"],["module_root","build","default","bindings"],["module_root","compiled","version","platform","arch","bindings"],["module_root","addon-build","release","install-root","bindings"],["module_root","addon-build","debug","install-root","bindings"],["module_root","addon-build","default","install-root","bindings"],["module_root","lib","binding","nodePreGyp","bindings"]]};function i_(e){typeof e=="string"?e={bindings:e}:e||(e={}),Object.keys(Hd).map(function(l){l in e||(e[l]=Hd[l])}),e.module_root||(e.module_root=os.getRoot(os.getFileName())),Da.extname(e.bindings)!=".node"&&(e.bindings+=".node");for(var t=typeof __webpack_require__=="function"?__non_webpack_require__:require,r=[],n=0,i=e.try.length,s,a,u;n{"use strict";var Ha=Kd()("secp256k1");delete Ha.path;for(let e in Ha)e.indexOf("is")===0&&(Ha[e].toJSON=function(){return e});Gd.exports=Ha});var zd=T((Vd,yc)=>{(function(e,t){"use strict";function r(y,o){if(!y)throw new Error(o||"Assertion failed")}function n(y,o){y.super_=o;var h=function(){};h.prototype=o.prototype,y.prototype=new h,y.prototype.constructor=y}function i(y,o,h){if(i.isBN(y))return y;this.negative=0,this.words=null,this.length=0,this.red=null,y!==null&&((o==="le"||o==="be")&&(h=o,o=10),this._init(y||0,o||10,h||"be"))}typeof e=="object"?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26;var s;try{typeof window<"u"&&typeof window.Buffer<"u"?s=window.Buffer:s=require("buffer").Buffer}catch{}i.isBN=function(o){return o instanceof i?!0:o!==null&&typeof o=="object"&&o.constructor.wordSize===i.wordSize&&Array.isArray(o.words)},i.max=function(o,h){return o.cmp(h)>0?o:h},i.min=function(o,h){return o.cmp(h)<0?o:h},i.prototype._init=function(o,h,d){if(typeof o=="number")return this._initNumber(o,h,d);if(typeof o=="object")return this._initArray(o,h,d);h==="hex"&&(h=16),r(h===(h|0)&&h>=2&&h<=36),o=o.toString().replace(/\s+/g,"");var v=0;o[0]==="-"&&(v++,this.negative=1),v=0;v-=3)_=o[v]|o[v-1]<<8|o[v-2]<<16,this.words[m]|=_<>>26-E&67108863,E+=24,E>=26&&(E-=26,m++);else if(d==="le")for(v=0,m=0;v>>26-E&67108863,E+=24,E>=26&&(E-=26,m++);return this.strip()};function a(y,o){var h=y.charCodeAt(o);return h>=65&&h<=70?h-55:h>=97&&h<=102?h-87:h-48&15}function u(y,o,h){var d=a(y,h);return h-1>=o&&(d|=a(y,h-1)<<4),d}i.prototype._parseHex=function(o,h,d){this.length=Math.ceil((o.length-h)/6),this.words=new Array(this.length);for(var v=0;v=h;v-=2)E=u(o,h,v)<=18?(m-=18,_+=1,this.words[_]|=E>>>26):m+=8;else{var b=o.length-h;for(v=b%2===0?h+1:h;v=18?(m-=18,_+=1,this.words[_]|=E>>>26):m+=8}this.strip()};function l(y,o,h,d){for(var v=0,m=Math.min(y.length,h),_=o;_=49?v+=E-49+10:E>=17?v+=E-17+10:v+=E}return v}i.prototype._parseBase=function(o,h,d){this.words=[0],this.length=1;for(var v=0,m=1;m<=67108863;m*=h)v++;v--,m=m/h|0;for(var _=o.length-d,E=_%v,b=Math.min(_,_-E)+d,f=0,g=d;g1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?""};var c=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],p=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],w=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(o,h){o=o||10,h=h|0||1;var d;if(o===16||o==="hex"){d="";for(var v=0,m=0,_=0;_>>24-v&16777215,m!==0||_!==this.length-1?d=c[6-b.length]+b+d:d=b+d,v+=2,v>=26&&(v-=26,_--)}for(m!==0&&(d=m.toString(16)+d);d.length%h!==0;)d="0"+d;return this.negative!==0&&(d="-"+d),d}if(o===(o|0)&&o>=2&&o<=36){var f=p[o],g=w[o];d="";var A=this.clone();for(A.negative=0;!A.isZero();){var R=A.modn(g).toString(o);A=A.idivn(g),A.isZero()?d=R+d:d=c[f-R.length]+R+d}for(this.isZero()&&(d="0"+d);d.length%h!==0;)d="0"+d;return this.negative!==0&&(d="-"+d),d}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var o=this.words[0];return this.length===2?o+=this.words[1]*67108864:this.length===3&&this.words[2]===1?o+=4503599627370496+this.words[1]*67108864:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-o:o},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(o,h){return r(typeof s<"u"),this.toArrayLike(s,o,h)},i.prototype.toArray=function(o,h){return this.toArrayLike(Array,o,h)},i.prototype.toArrayLike=function(o,h,d){var v=this.byteLength(),m=d||Math.max(1,v);r(v<=m,"byte array longer than desired length"),r(m>0,"Requested array length <= 0"),this.strip();var _=h==="le",E=new o(m),b,f,g=this.clone();if(_){for(f=0;!g.isZero();f++)b=g.andln(255),g.iushrn(8),E[f]=b;for(;f=4096&&(d+=13,h>>>=13),h>=64&&(d+=7,h>>>=7),h>=8&&(d+=4,h>>>=4),h>=2&&(d+=2,h>>>=2),d+h},i.prototype._zeroBits=function(o){if(o===0)return 26;var h=o,d=0;return(h&8191)===0&&(d+=13,h>>>=13),(h&127)===0&&(d+=7,h>>>=7),(h&15)===0&&(d+=4,h>>>=4),(h&3)===0&&(d+=2,h>>>=2),(h&1)===0&&d++,d},i.prototype.bitLength=function(){var o=this.words[this.length-1],h=this._countBits(o);return(this.length-1)*26+h};function x(y){for(var o=new Array(y.bitLength()),h=0;h>>v}return o}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var o=0,h=0;ho.length?this.clone().ior(o):o.clone().ior(this)},i.prototype.uor=function(o){return this.length>o.length?this.clone().iuor(o):o.clone().iuor(this)},i.prototype.iuand=function(o){var h;this.length>o.length?h=o:h=this;for(var d=0;do.length?this.clone().iand(o):o.clone().iand(this)},i.prototype.uand=function(o){return this.length>o.length?this.clone().iuand(o):o.clone().iuand(this)},i.prototype.iuxor=function(o){var h,d;this.length>o.length?(h=this,d=o):(h=o,d=this);for(var v=0;vo.length?this.clone().ixor(o):o.clone().ixor(this)},i.prototype.uxor=function(o){return this.length>o.length?this.clone().iuxor(o):o.clone().iuxor(this)},i.prototype.inotn=function(o){r(typeof o=="number"&&o>=0);var h=Math.ceil(o/26)|0,d=o%26;this._expand(h),d>0&&h--;for(var v=0;v0&&(this.words[v]=~this.words[v]&67108863>>26-d),this.strip()},i.prototype.notn=function(o){return this.clone().inotn(o)},i.prototype.setn=function(o,h){r(typeof o=="number"&&o>=0);var d=o/26|0,v=o%26;return this._expand(d+1),h?this.words[d]=this.words[d]|1<o.length?(d=this,v=o):(d=o,v=this);for(var m=0,_=0;_>>26;for(;m!==0&&_>>26;if(this.length=d.length,m!==0)this.words[this.length]=m,this.length++;else if(d!==this)for(;_o.length?this.clone().iadd(o):o.clone().iadd(this)},i.prototype.isub=function(o){if(o.negative!==0){o.negative=0;var h=this.iadd(o);return o.negative=1,h._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(o),this.negative=1,this._normSign();var d=this.cmp(o);if(d===0)return this.negative=0,this.length=1,this.words[0]=0,this;var v,m;d>0?(v=this,m=o):(v=o,m=this);for(var _=0,E=0;E>26,this.words[E]=h&67108863;for(;_!==0&&E>26,this.words[E]=h&67108863;if(_===0&&E>>26,A=b&67108863,R=Math.min(f,o.length-1),k=Math.max(0,f-y.length+1);k<=R;k++){var U=f-k|0;v=y.words[U]|0,m=o.words[k]|0,_=v*m+A,g+=_/67108864|0,A=_&67108863}h.words[f]=A|0,b=g|0}return b!==0?h.words[f]=b|0:h.length--,h.strip()}var M=function(o,h,d){var v=o.words,m=h.words,_=d.words,E=0,b,f,g,A=v[0]|0,R=A&8191,k=A>>>13,U=v[1]|0,G=U&8191,F=U>>>13,Le=v[2]|0,V=Le&8191,j=Le>>>13,fr=v[3]|0,Y=fr&8191,oe=fr>>>13,ct=v[4]|0,re=ct&8191,te=ct>>>13,hn=v[5]|0,ae=hn&8191,ne=hn>>>13,Hr=v[6]|0,ie=Hr&8191,J=Hr>>>13,yr=v[7]|0,D=yr&8191,fe=yr>>>13,wr=v[8]|0,se=wr&8191,ue=wr>>>13,qe=v[9]|0,Z=qe&8191,Q=qe>>>13,Jt=m[0]|0,ce=Jt&8191,he=Jt>>>13,Gn=m[1]|0,de=Gn&8191,pe=Gn>>>13,so=m[2]|0,ve=so&8191,be=so>>>13,oo=m[3]|0,ge=oo&8191,me=oo>>>13,ao=m[4]|0,ye=ao&8191,we=ao>>>13,fo=m[5]|0,_e=fo&8191,Ee=fo>>>13,uo=m[6]|0,xe=uo&8191,Se=uo>>>13,co=m[7]|0,Ie=co&8191,Te=co>>>13,ho=m[8]|0,Me=ho&8191,Ae=ho>>>13,lo=m[9]|0,Oe=lo&8191,Pe=lo>>>13;d.negative=o.negative^h.negative,d.length=19,b=Math.imul(R,ce),f=Math.imul(R,he),f=f+Math.imul(k,ce)|0,g=Math.imul(k,he);var Wn=(E+b|0)+((f&8191)<<13)|0;E=(g+(f>>>13)|0)+(Wn>>>26)|0,Wn&=67108863,b=Math.imul(G,ce),f=Math.imul(G,he),f=f+Math.imul(F,ce)|0,g=Math.imul(F,he),b=b+Math.imul(R,de)|0,f=f+Math.imul(R,pe)|0,f=f+Math.imul(k,de)|0,g=g+Math.imul(k,pe)|0;var Vn=(E+b|0)+((f&8191)<<13)|0;E=(g+(f>>>13)|0)+(Vn>>>26)|0,Vn&=67108863,b=Math.imul(V,ce),f=Math.imul(V,he),f=f+Math.imul(j,ce)|0,g=Math.imul(j,he),b=b+Math.imul(G,de)|0,f=f+Math.imul(G,pe)|0,f=f+Math.imul(F,de)|0,g=g+Math.imul(F,pe)|0,b=b+Math.imul(R,ve)|0,f=f+Math.imul(R,be)|0,f=f+Math.imul(k,ve)|0,g=g+Math.imul(k,be)|0;var zn=(E+b|0)+((f&8191)<<13)|0;E=(g+(f>>>13)|0)+(zn>>>26)|0,zn&=67108863,b=Math.imul(Y,ce),f=Math.imul(Y,he),f=f+Math.imul(oe,ce)|0,g=Math.imul(oe,he),b=b+Math.imul(V,de)|0,f=f+Math.imul(V,pe)|0,f=f+Math.imul(j,de)|0,g=g+Math.imul(j,pe)|0,b=b+Math.imul(G,ve)|0,f=f+Math.imul(G,be)|0,f=f+Math.imul(F,ve)|0,g=g+Math.imul(F,be)|0,b=b+Math.imul(R,ge)|0,f=f+Math.imul(R,me)|0,f=f+Math.imul(k,ge)|0,g=g+Math.imul(k,me)|0;var $n=(E+b|0)+((f&8191)<<13)|0;E=(g+(f>>>13)|0)+($n>>>26)|0,$n&=67108863,b=Math.imul(re,ce),f=Math.imul(re,he),f=f+Math.imul(te,ce)|0,g=Math.imul(te,he),b=b+Math.imul(Y,de)|0,f=f+Math.imul(Y,pe)|0,f=f+Math.imul(oe,de)|0,g=g+Math.imul(oe,pe)|0,b=b+Math.imul(V,ve)|0,f=f+Math.imul(V,be)|0,f=f+Math.imul(j,ve)|0,g=g+Math.imul(j,be)|0,b=b+Math.imul(G,ge)|0,f=f+Math.imul(G,me)|0,f=f+Math.imul(F,ge)|0,g=g+Math.imul(F,me)|0,b=b+Math.imul(R,ye)|0,f=f+Math.imul(R,we)|0,f=f+Math.imul(k,ye)|0,g=g+Math.imul(k,we)|0;var jn=(E+b|0)+((f&8191)<<13)|0;E=(g+(f>>>13)|0)+(jn>>>26)|0,jn&=67108863,b=Math.imul(ae,ce),f=Math.imul(ae,he),f=f+Math.imul(ne,ce)|0,g=Math.imul(ne,he),b=b+Math.imul(re,de)|0,f=f+Math.imul(re,pe)|0,f=f+Math.imul(te,de)|0,g=g+Math.imul(te,pe)|0,b=b+Math.imul(Y,ve)|0,f=f+Math.imul(Y,be)|0,f=f+Math.imul(oe,ve)|0,g=g+Math.imul(oe,be)|0,b=b+Math.imul(V,ge)|0,f=f+Math.imul(V,me)|0,f=f+Math.imul(j,ge)|0,g=g+Math.imul(j,me)|0,b=b+Math.imul(G,ye)|0,f=f+Math.imul(G,we)|0,f=f+Math.imul(F,ye)|0,g=g+Math.imul(F,we)|0,b=b+Math.imul(R,_e)|0,f=f+Math.imul(R,Ee)|0,f=f+Math.imul(k,_e)|0,g=g+Math.imul(k,Ee)|0;var Xn=(E+b|0)+((f&8191)<<13)|0;E=(g+(f>>>13)|0)+(Xn>>>26)|0,Xn&=67108863,b=Math.imul(ie,ce),f=Math.imul(ie,he),f=f+Math.imul(J,ce)|0,g=Math.imul(J,he),b=b+Math.imul(ae,de)|0,f=f+Math.imul(ae,pe)|0,f=f+Math.imul(ne,de)|0,g=g+Math.imul(ne,pe)|0,b=b+Math.imul(re,ve)|0,f=f+Math.imul(re,be)|0,f=f+Math.imul(te,ve)|0,g=g+Math.imul(te,be)|0,b=b+Math.imul(Y,ge)|0,f=f+Math.imul(Y,me)|0,f=f+Math.imul(oe,ge)|0,g=g+Math.imul(oe,me)|0,b=b+Math.imul(V,ye)|0,f=f+Math.imul(V,we)|0,f=f+Math.imul(j,ye)|0,g=g+Math.imul(j,we)|0,b=b+Math.imul(G,_e)|0,f=f+Math.imul(G,Ee)|0,f=f+Math.imul(F,_e)|0,g=g+Math.imul(F,Ee)|0,b=b+Math.imul(R,xe)|0,f=f+Math.imul(R,Se)|0,f=f+Math.imul(k,xe)|0,g=g+Math.imul(k,Se)|0;var Yn=(E+b|0)+((f&8191)<<13)|0;E=(g+(f>>>13)|0)+(Yn>>>26)|0,Yn&=67108863,b=Math.imul(D,ce),f=Math.imul(D,he),f=f+Math.imul(fe,ce)|0,g=Math.imul(fe,he),b=b+Math.imul(ie,de)|0,f=f+Math.imul(ie,pe)|0,f=f+Math.imul(J,de)|0,g=g+Math.imul(J,pe)|0,b=b+Math.imul(ae,ve)|0,f=f+Math.imul(ae,be)|0,f=f+Math.imul(ne,ve)|0,g=g+Math.imul(ne,be)|0,b=b+Math.imul(re,ge)|0,f=f+Math.imul(re,me)|0,f=f+Math.imul(te,ge)|0,g=g+Math.imul(te,me)|0,b=b+Math.imul(Y,ye)|0,f=f+Math.imul(Y,we)|0,f=f+Math.imul(oe,ye)|0,g=g+Math.imul(oe,we)|0,b=b+Math.imul(V,_e)|0,f=f+Math.imul(V,Ee)|0,f=f+Math.imul(j,_e)|0,g=g+Math.imul(j,Ee)|0,b=b+Math.imul(G,xe)|0,f=f+Math.imul(G,Se)|0,f=f+Math.imul(F,xe)|0,g=g+Math.imul(F,Se)|0,b=b+Math.imul(R,Ie)|0,f=f+Math.imul(R,Te)|0,f=f+Math.imul(k,Ie)|0,g=g+Math.imul(k,Te)|0;var Jn=(E+b|0)+((f&8191)<<13)|0;E=(g+(f>>>13)|0)+(Jn>>>26)|0,Jn&=67108863,b=Math.imul(se,ce),f=Math.imul(se,he),f=f+Math.imul(ue,ce)|0,g=Math.imul(ue,he),b=b+Math.imul(D,de)|0,f=f+Math.imul(D,pe)|0,f=f+Math.imul(fe,de)|0,g=g+Math.imul(fe,pe)|0,b=b+Math.imul(ie,ve)|0,f=f+Math.imul(ie,be)|0,f=f+Math.imul(J,ve)|0,g=g+Math.imul(J,be)|0,b=b+Math.imul(ae,ge)|0,f=f+Math.imul(ae,me)|0,f=f+Math.imul(ne,ge)|0,g=g+Math.imul(ne,me)|0,b=b+Math.imul(re,ye)|0,f=f+Math.imul(re,we)|0,f=f+Math.imul(te,ye)|0,g=g+Math.imul(te,we)|0,b=b+Math.imul(Y,_e)|0,f=f+Math.imul(Y,Ee)|0,f=f+Math.imul(oe,_e)|0,g=g+Math.imul(oe,Ee)|0,b=b+Math.imul(V,xe)|0,f=f+Math.imul(V,Se)|0,f=f+Math.imul(j,xe)|0,g=g+Math.imul(j,Se)|0,b=b+Math.imul(G,Ie)|0,f=f+Math.imul(G,Te)|0,f=f+Math.imul(F,Ie)|0,g=g+Math.imul(F,Te)|0,b=b+Math.imul(R,Me)|0,f=f+Math.imul(R,Ae)|0,f=f+Math.imul(k,Me)|0,g=g+Math.imul(k,Ae)|0;var Zn=(E+b|0)+((f&8191)<<13)|0;E=(g+(f>>>13)|0)+(Zn>>>26)|0,Zn&=67108863,b=Math.imul(Z,ce),f=Math.imul(Z,he),f=f+Math.imul(Q,ce)|0,g=Math.imul(Q,he),b=b+Math.imul(se,de)|0,f=f+Math.imul(se,pe)|0,f=f+Math.imul(ue,de)|0,g=g+Math.imul(ue,pe)|0,b=b+Math.imul(D,ve)|0,f=f+Math.imul(D,be)|0,f=f+Math.imul(fe,ve)|0,g=g+Math.imul(fe,be)|0,b=b+Math.imul(ie,ge)|0,f=f+Math.imul(ie,me)|0,f=f+Math.imul(J,ge)|0,g=g+Math.imul(J,me)|0,b=b+Math.imul(ae,ye)|0,f=f+Math.imul(ae,we)|0,f=f+Math.imul(ne,ye)|0,g=g+Math.imul(ne,we)|0,b=b+Math.imul(re,_e)|0,f=f+Math.imul(re,Ee)|0,f=f+Math.imul(te,_e)|0,g=g+Math.imul(te,Ee)|0,b=b+Math.imul(Y,xe)|0,f=f+Math.imul(Y,Se)|0,f=f+Math.imul(oe,xe)|0,g=g+Math.imul(oe,Se)|0,b=b+Math.imul(V,Ie)|0,f=f+Math.imul(V,Te)|0,f=f+Math.imul(j,Ie)|0,g=g+Math.imul(j,Te)|0,b=b+Math.imul(G,Me)|0,f=f+Math.imul(G,Ae)|0,f=f+Math.imul(F,Me)|0,g=g+Math.imul(F,Ae)|0,b=b+Math.imul(R,Oe)|0,f=f+Math.imul(R,Pe)|0,f=f+Math.imul(k,Oe)|0,g=g+Math.imul(k,Pe)|0;var Qn=(E+b|0)+((f&8191)<<13)|0;E=(g+(f>>>13)|0)+(Qn>>>26)|0,Qn&=67108863,b=Math.imul(Z,de),f=Math.imul(Z,pe),f=f+Math.imul(Q,de)|0,g=Math.imul(Q,pe),b=b+Math.imul(se,ve)|0,f=f+Math.imul(se,be)|0,f=f+Math.imul(ue,ve)|0,g=g+Math.imul(ue,be)|0,b=b+Math.imul(D,ge)|0,f=f+Math.imul(D,me)|0,f=f+Math.imul(fe,ge)|0,g=g+Math.imul(fe,me)|0,b=b+Math.imul(ie,ye)|0,f=f+Math.imul(ie,we)|0,f=f+Math.imul(J,ye)|0,g=g+Math.imul(J,we)|0,b=b+Math.imul(ae,_e)|0,f=f+Math.imul(ae,Ee)|0,f=f+Math.imul(ne,_e)|0,g=g+Math.imul(ne,Ee)|0,b=b+Math.imul(re,xe)|0,f=f+Math.imul(re,Se)|0,f=f+Math.imul(te,xe)|0,g=g+Math.imul(te,Se)|0,b=b+Math.imul(Y,Ie)|0,f=f+Math.imul(Y,Te)|0,f=f+Math.imul(oe,Ie)|0,g=g+Math.imul(oe,Te)|0,b=b+Math.imul(V,Me)|0,f=f+Math.imul(V,Ae)|0,f=f+Math.imul(j,Me)|0,g=g+Math.imul(j,Ae)|0,b=b+Math.imul(G,Oe)|0,f=f+Math.imul(G,Pe)|0,f=f+Math.imul(F,Oe)|0,g=g+Math.imul(F,Pe)|0;var ei=(E+b|0)+((f&8191)<<13)|0;E=(g+(f>>>13)|0)+(ei>>>26)|0,ei&=67108863,b=Math.imul(Z,ve),f=Math.imul(Z,be),f=f+Math.imul(Q,ve)|0,g=Math.imul(Q,be),b=b+Math.imul(se,ge)|0,f=f+Math.imul(se,me)|0,f=f+Math.imul(ue,ge)|0,g=g+Math.imul(ue,me)|0,b=b+Math.imul(D,ye)|0,f=f+Math.imul(D,we)|0,f=f+Math.imul(fe,ye)|0,g=g+Math.imul(fe,we)|0,b=b+Math.imul(ie,_e)|0,f=f+Math.imul(ie,Ee)|0,f=f+Math.imul(J,_e)|0,g=g+Math.imul(J,Ee)|0,b=b+Math.imul(ae,xe)|0,f=f+Math.imul(ae,Se)|0,f=f+Math.imul(ne,xe)|0,g=g+Math.imul(ne,Se)|0,b=b+Math.imul(re,Ie)|0,f=f+Math.imul(re,Te)|0,f=f+Math.imul(te,Ie)|0,g=g+Math.imul(te,Te)|0,b=b+Math.imul(Y,Me)|0,f=f+Math.imul(Y,Ae)|0,f=f+Math.imul(oe,Me)|0,g=g+Math.imul(oe,Ae)|0,b=b+Math.imul(V,Oe)|0,f=f+Math.imul(V,Pe)|0,f=f+Math.imul(j,Oe)|0,g=g+Math.imul(j,Pe)|0;var ti=(E+b|0)+((f&8191)<<13)|0;E=(g+(f>>>13)|0)+(ti>>>26)|0,ti&=67108863,b=Math.imul(Z,ge),f=Math.imul(Z,me),f=f+Math.imul(Q,ge)|0,g=Math.imul(Q,me),b=b+Math.imul(se,ye)|0,f=f+Math.imul(se,we)|0,f=f+Math.imul(ue,ye)|0,g=g+Math.imul(ue,we)|0,b=b+Math.imul(D,_e)|0,f=f+Math.imul(D,Ee)|0,f=f+Math.imul(fe,_e)|0,g=g+Math.imul(fe,Ee)|0,b=b+Math.imul(ie,xe)|0,f=f+Math.imul(ie,Se)|0,f=f+Math.imul(J,xe)|0,g=g+Math.imul(J,Se)|0,b=b+Math.imul(ae,Ie)|0,f=f+Math.imul(ae,Te)|0,f=f+Math.imul(ne,Ie)|0,g=g+Math.imul(ne,Te)|0,b=b+Math.imul(re,Me)|0,f=f+Math.imul(re,Ae)|0,f=f+Math.imul(te,Me)|0,g=g+Math.imul(te,Ae)|0,b=b+Math.imul(Y,Oe)|0,f=f+Math.imul(Y,Pe)|0,f=f+Math.imul(oe,Oe)|0,g=g+Math.imul(oe,Pe)|0;var ri=(E+b|0)+((f&8191)<<13)|0;E=(g+(f>>>13)|0)+(ri>>>26)|0,ri&=67108863,b=Math.imul(Z,ye),f=Math.imul(Z,we),f=f+Math.imul(Q,ye)|0,g=Math.imul(Q,we),b=b+Math.imul(se,_e)|0,f=f+Math.imul(se,Ee)|0,f=f+Math.imul(ue,_e)|0,g=g+Math.imul(ue,Ee)|0,b=b+Math.imul(D,xe)|0,f=f+Math.imul(D,Se)|0,f=f+Math.imul(fe,xe)|0,g=g+Math.imul(fe,Se)|0,b=b+Math.imul(ie,Ie)|0,f=f+Math.imul(ie,Te)|0,f=f+Math.imul(J,Ie)|0,g=g+Math.imul(J,Te)|0,b=b+Math.imul(ae,Me)|0,f=f+Math.imul(ae,Ae)|0,f=f+Math.imul(ne,Me)|0,g=g+Math.imul(ne,Ae)|0,b=b+Math.imul(re,Oe)|0,f=f+Math.imul(re,Pe)|0,f=f+Math.imul(te,Oe)|0,g=g+Math.imul(te,Pe)|0;var ni=(E+b|0)+((f&8191)<<13)|0;E=(g+(f>>>13)|0)+(ni>>>26)|0,ni&=67108863,b=Math.imul(Z,_e),f=Math.imul(Z,Ee),f=f+Math.imul(Q,_e)|0,g=Math.imul(Q,Ee),b=b+Math.imul(se,xe)|0,f=f+Math.imul(se,Se)|0,f=f+Math.imul(ue,xe)|0,g=g+Math.imul(ue,Se)|0,b=b+Math.imul(D,Ie)|0,f=f+Math.imul(D,Te)|0,f=f+Math.imul(fe,Ie)|0,g=g+Math.imul(fe,Te)|0,b=b+Math.imul(ie,Me)|0,f=f+Math.imul(ie,Ae)|0,f=f+Math.imul(J,Me)|0,g=g+Math.imul(J,Ae)|0,b=b+Math.imul(ae,Oe)|0,f=f+Math.imul(ae,Pe)|0,f=f+Math.imul(ne,Oe)|0,g=g+Math.imul(ne,Pe)|0;var ii=(E+b|0)+((f&8191)<<13)|0;E=(g+(f>>>13)|0)+(ii>>>26)|0,ii&=67108863,b=Math.imul(Z,xe),f=Math.imul(Z,Se),f=f+Math.imul(Q,xe)|0,g=Math.imul(Q,Se),b=b+Math.imul(se,Ie)|0,f=f+Math.imul(se,Te)|0,f=f+Math.imul(ue,Ie)|0,g=g+Math.imul(ue,Te)|0,b=b+Math.imul(D,Me)|0,f=f+Math.imul(D,Ae)|0,f=f+Math.imul(fe,Me)|0,g=g+Math.imul(fe,Ae)|0,b=b+Math.imul(ie,Oe)|0,f=f+Math.imul(ie,Pe)|0,f=f+Math.imul(J,Oe)|0,g=g+Math.imul(J,Pe)|0;var si=(E+b|0)+((f&8191)<<13)|0;E=(g+(f>>>13)|0)+(si>>>26)|0,si&=67108863,b=Math.imul(Z,Ie),f=Math.imul(Z,Te),f=f+Math.imul(Q,Ie)|0,g=Math.imul(Q,Te),b=b+Math.imul(se,Me)|0,f=f+Math.imul(se,Ae)|0,f=f+Math.imul(ue,Me)|0,g=g+Math.imul(ue,Ae)|0,b=b+Math.imul(D,Oe)|0,f=f+Math.imul(D,Pe)|0,f=f+Math.imul(fe,Oe)|0,g=g+Math.imul(fe,Pe)|0;var oi=(E+b|0)+((f&8191)<<13)|0;E=(g+(f>>>13)|0)+(oi>>>26)|0,oi&=67108863,b=Math.imul(Z,Me),f=Math.imul(Z,Ae),f=f+Math.imul(Q,Me)|0,g=Math.imul(Q,Ae),b=b+Math.imul(se,Oe)|0,f=f+Math.imul(se,Pe)|0,f=f+Math.imul(ue,Oe)|0,g=g+Math.imul(ue,Pe)|0;var ai=(E+b|0)+((f&8191)<<13)|0;E=(g+(f>>>13)|0)+(ai>>>26)|0,ai&=67108863,b=Math.imul(Z,Oe),f=Math.imul(Z,Pe),f=f+Math.imul(Q,Oe)|0,g=Math.imul(Q,Pe);var fi=(E+b|0)+((f&8191)<<13)|0;return E=(g+(f>>>13)|0)+(fi>>>26)|0,fi&=67108863,_[0]=Wn,_[1]=Vn,_[2]=zn,_[3]=$n,_[4]=jn,_[5]=Xn,_[6]=Yn,_[7]=Jn,_[8]=Zn,_[9]=Qn,_[10]=ei,_[11]=ti,_[12]=ri,_[13]=ni,_[14]=ii,_[15]=si,_[16]=oi,_[17]=ai,_[18]=fi,E!==0&&(_[19]=E,d.length++),d};Math.imul||(M=S);function O(y,o,h){h.negative=o.negative^y.negative,h.length=y.length+o.length;for(var d=0,v=0,m=0;m>>26)|0,v+=_>>>26,_&=67108863}h.words[m]=E,d=_,_=v}return d!==0?h.words[m]=d:h.length--,h.strip()}function P(y,o,h){var d=new B;return d.mulp(y,o,h)}i.prototype.mulTo=function(o,h){var d,v=this.length+o.length;return this.length===10&&o.length===10?d=M(this,o,h):v<63?d=S(this,o,h):v<1024?d=O(this,o,h):d=P(this,o,h),d};function B(y,o){this.x=y,this.y=o}B.prototype.makeRBT=function(o){for(var h=new Array(o),d=i.prototype._countBits(o)-1,v=0;v>=1;return v},B.prototype.permute=function(o,h,d,v,m,_){for(var E=0;E<_;E++)v[E]=h[o[E]],m[E]=d[o[E]]},B.prototype.transform=function(o,h,d,v,m,_){this.permute(_,o,h,d,v,m);for(var E=1;E>>1)m++;return 1<>>13,d[2*_+1]=m&8191,m=m>>>13;for(_=2*h;_>=26,h+=v/67108864|0,h+=m>>>26,this.words[d]=m&67108863}return h!==0&&(this.words[d]=h,this.length++),this},i.prototype.muln=function(o){return this.clone().imuln(o)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(o){var h=x(o);if(h.length===0)return new i(1);for(var d=this,v=0;v=0);var h=o%26,d=(o-h)/26,v=67108863>>>26-h<<26-h,m;if(h!==0){var _=0;for(m=0;m>>26-h}_&&(this.words[m]=_,this.length++)}if(d!==0){for(m=this.length-1;m>=0;m--)this.words[m+d]=this.words[m];for(m=0;m=0);var v;h?v=(h-h%26)/26:v=0;var m=o%26,_=Math.min((o-m)/26,this.length),E=67108863^67108863>>>m<_)for(this.length-=_,f=0;f=0&&(g!==0||f>=v);f--){var A=this.words[f]|0;this.words[f]=g<<26-m|A>>>m,g=A&E}return b&&g!==0&&(b.words[b.length++]=g),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(o,h,d){return r(this.negative===0),this.iushrn(o,h,d)},i.prototype.shln=function(o){return this.clone().ishln(o)},i.prototype.ushln=function(o){return this.clone().iushln(o)},i.prototype.shrn=function(o){return this.clone().ishrn(o)},i.prototype.ushrn=function(o){return this.clone().iushrn(o)},i.prototype.testn=function(o){r(typeof o=="number"&&o>=0);var h=o%26,d=(o-h)/26,v=1<=0);var h=o%26,d=(o-h)/26;if(r(this.negative===0,"imaskn works only with positive numbers"),this.length<=d)return this;if(h!==0&&d++,this.length=Math.min(d,this.length),h!==0){var v=67108863^67108863>>>h<=67108864;h++)this.words[h]-=67108864,h===this.length-1?this.words[h+1]=1:this.words[h+1]++;return this.length=Math.max(this.length,h+1),this},i.prototype.isubn=function(o){if(r(typeof o=="number"),r(o<67108864),o<0)return this.iaddn(-o);if(this.negative!==0)return this.negative=0,this.iaddn(o),this.negative=1,this;if(this.words[0]-=o,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var h=0;h>26)-(b/67108864|0),this.words[m+d]=_&67108863}for(;m>26,this.words[m+d]=_&67108863;if(E===0)return this.strip();for(r(E===-1),E=0,m=0;m>26,this.words[m]=_&67108863;return this.negative=1,this.strip()},i.prototype._wordDiv=function(o,h){var d=this.length-o.length,v=this.clone(),m=o,_=m.words[m.length-1]|0,E=this._countBits(_);d=26-E,d!==0&&(m=m.ushln(d),v.iushln(d),_=m.words[m.length-1]|0);var b=v.length-m.length,f;if(h!=="mod"){f=new i(null),f.length=b+1,f.words=new Array(f.length);for(var g=0;g=0;R--){var k=(v.words[m.length+R]|0)*67108864+(v.words[m.length+R-1]|0);for(k=Math.min(k/_|0,67108863),v._ishlnsubmul(m,k,R);v.negative!==0;)k--,v.negative=0,v._ishlnsubmul(m,1,R),v.isZero()||(v.negative^=1);f&&(f.words[R]=k)}return f&&f.strip(),v.strip(),h!=="div"&&d!==0&&v.iushrn(d),{div:f||null,mod:v}},i.prototype.divmod=function(o,h,d){if(r(!o.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var v,m,_;return this.negative!==0&&o.negative===0?(_=this.neg().divmod(o,h),h!=="mod"&&(v=_.div.neg()),h!=="div"&&(m=_.mod.neg(),d&&m.negative!==0&&m.iadd(o)),{div:v,mod:m}):this.negative===0&&o.negative!==0?(_=this.divmod(o.neg(),h),h!=="mod"&&(v=_.div.neg()),{div:v,mod:_.mod}):(this.negative&o.negative)!==0?(_=this.neg().divmod(o.neg(),h),h!=="div"&&(m=_.mod.neg(),d&&m.negative!==0&&m.isub(o)),{div:_.div,mod:m}):o.length>this.length||this.cmp(o)<0?{div:new i(0),mod:this}:o.length===1?h==="div"?{div:this.divn(o.words[0]),mod:null}:h==="mod"?{div:null,mod:new i(this.modn(o.words[0]))}:{div:this.divn(o.words[0]),mod:new i(this.modn(o.words[0]))}:this._wordDiv(o,h)},i.prototype.div=function(o){return this.divmod(o,"div",!1).div},i.prototype.mod=function(o){return this.divmod(o,"mod",!1).mod},i.prototype.umod=function(o){return this.divmod(o,"mod",!0).mod},i.prototype.divRound=function(o){var h=this.divmod(o);if(h.mod.isZero())return h.div;var d=h.div.negative!==0?h.mod.isub(o):h.mod,v=o.ushrn(1),m=o.andln(1),_=d.cmp(v);return _<0||m===1&&_===0?h.div:h.div.negative!==0?h.div.isubn(1):h.div.iaddn(1)},i.prototype.modn=function(o){r(o<=67108863);for(var h=(1<<26)%o,d=0,v=this.length-1;v>=0;v--)d=(h*d+(this.words[v]|0))%o;return d},i.prototype.idivn=function(o){r(o<=67108863);for(var h=0,d=this.length-1;d>=0;d--){var v=(this.words[d]|0)+h*67108864;this.words[d]=v/o|0,h=v%o}return this.strip()},i.prototype.divn=function(o){return this.clone().idivn(o)},i.prototype.egcd=function(o){r(o.negative===0),r(!o.isZero());var h=this,d=o.clone();h.negative!==0?h=h.umod(o):h=h.clone();for(var v=new i(1),m=new i(0),_=new i(0),E=new i(1),b=0;h.isEven()&&d.isEven();)h.iushrn(1),d.iushrn(1),++b;for(var f=d.clone(),g=h.clone();!h.isZero();){for(var A=0,R=1;(h.words[0]&R)===0&&A<26;++A,R<<=1);if(A>0)for(h.iushrn(A);A-- >0;)(v.isOdd()||m.isOdd())&&(v.iadd(f),m.isub(g)),v.iushrn(1),m.iushrn(1);for(var k=0,U=1;(d.words[0]&U)===0&&k<26;++k,U<<=1);if(k>0)for(d.iushrn(k);k-- >0;)(_.isOdd()||E.isOdd())&&(_.iadd(f),E.isub(g)),_.iushrn(1),E.iushrn(1);h.cmp(d)>=0?(h.isub(d),v.isub(_),m.isub(E)):(d.isub(h),_.isub(v),E.isub(m))}return{a:_,b:E,gcd:d.iushln(b)}},i.prototype._invmp=function(o){r(o.negative===0),r(!o.isZero());var h=this,d=o.clone();h.negative!==0?h=h.umod(o):h=h.clone();for(var v=new i(1),m=new i(0),_=d.clone();h.cmpn(1)>0&&d.cmpn(1)>0;){for(var E=0,b=1;(h.words[0]&b)===0&&E<26;++E,b<<=1);if(E>0)for(h.iushrn(E);E-- >0;)v.isOdd()&&v.iadd(_),v.iushrn(1);for(var f=0,g=1;(d.words[0]&g)===0&&f<26;++f,g<<=1);if(f>0)for(d.iushrn(f);f-- >0;)m.isOdd()&&m.iadd(_),m.iushrn(1);h.cmp(d)>=0?(h.isub(d),v.isub(m)):(d.isub(h),m.isub(v))}var A;return h.cmpn(1)===0?A=v:A=m,A.cmpn(0)<0&&A.iadd(o),A},i.prototype.gcd=function(o){if(this.isZero())return o.abs();if(o.isZero())return this.abs();var h=this.clone(),d=o.clone();h.negative=0,d.negative=0;for(var v=0;h.isEven()&&d.isEven();v++)h.iushrn(1),d.iushrn(1);do{for(;h.isEven();)h.iushrn(1);for(;d.isEven();)d.iushrn(1);var m=h.cmp(d);if(m<0){var _=h;h=d,d=_}else if(m===0||d.cmpn(1)===0)break;h.isub(d)}while(!0);return d.iushln(v)},i.prototype.invm=function(o){return this.egcd(o).a.umod(o)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(o){return this.words[0]&o},i.prototype.bincn=function(o){r(typeof o=="number");var h=o%26,d=(o-h)/26,v=1<>>26,E&=67108863,this.words[_]=E}return m!==0&&(this.words[_]=m,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(o){var h=o<0;if(this.negative!==0&&!h)return-1;if(this.negative===0&&h)return 1;this.strip();var d;if(this.length>1)d=1;else{h&&(o=-o),r(o<=67108863,"Number is too big");var v=this.words[0]|0;d=v===o?0:vo.length)return 1;if(this.length=0;d--){var v=this.words[d]|0,m=o.words[d]|0;if(v!==m){vm&&(h=1);break}}return h},i.prototype.gtn=function(o){return this.cmpn(o)===1},i.prototype.gt=function(o){return this.cmp(o)===1},i.prototype.gten=function(o){return this.cmpn(o)>=0},i.prototype.gte=function(o){return this.cmp(o)>=0},i.prototype.ltn=function(o){return this.cmpn(o)===-1},i.prototype.lt=function(o){return this.cmp(o)===-1},i.prototype.lten=function(o){return this.cmpn(o)<=0},i.prototype.lte=function(o){return this.cmp(o)<=0},i.prototype.eqn=function(o){return this.cmpn(o)===0},i.prototype.eq=function(o){return this.cmp(o)===0},i.red=function(o){return new q(o)},i.prototype.toRed=function(o){return r(!this.red,"Already a number in reduction context"),r(this.negative===0,"red works only with positives"),o.convertTo(this)._forceRed(o)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(o){return this.red=o,this},i.prototype.forceRed=function(o){return r(!this.red,"Already a number in reduction context"),this._forceRed(o)},i.prototype.redAdd=function(o){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,o)},i.prototype.redIAdd=function(o){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,o)},i.prototype.redSub=function(o){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,o)},i.prototype.redISub=function(o){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,o)},i.prototype.redShl=function(o){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,o)},i.prototype.redMul=function(o){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.mul(this,o)},i.prototype.redIMul=function(o){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.imul(this,o)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(o){return r(this.red&&!o.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,o)};var N={k256:null,p224:null,p192:null,p25519:null};function L(y,o){this.name=y,this.p=new i(o,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}L.prototype._tmp=function(){var o=new i(null);return o.words=new Array(Math.ceil(this.n/13)),o},L.prototype.ireduce=function(o){var h=o,d;do this.split(h,this.tmp),h=this.imulK(h),h=h.iadd(this.tmp),d=h.bitLength();while(d>this.n);var v=d0?h.isub(this.p):h.strip!==void 0?h.strip():h._strip(),h},L.prototype.split=function(o,h){o.iushrn(this.n,0,h)},L.prototype.imulK=function(o){return o.imul(this.k)};function H(){L.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}n(H,L),H.prototype.split=function(o,h){for(var d=4194303,v=Math.min(o.length,9),m=0;m>>22,_=E}_>>>=22,o.words[m-10]=_,_===0&&o.length>10?o.length-=10:o.length-=9},H.prototype.imulK=function(o){o.words[o.length]=0,o.words[o.length+1]=0,o.length+=2;for(var h=0,d=0;d>>=26,o.words[d]=m,h=v}return h!==0&&(o.words[o.length++]=h),o},i._prime=function(o){if(N[o])return N[o];var h;if(o==="k256")h=new H;else if(o==="p224")h=new W;else if(o==="p192")h=new K;else if(o==="p25519")h=new X;else throw new Error("Unknown prime "+o);return N[o]=h,h};function q(y){if(typeof y=="string"){var o=i._prime(y);this.m=o.p,this.prime=o}else r(y.gtn(1),"modulus must be greater than 1"),this.m=y,this.prime=null}q.prototype._verify1=function(o){r(o.negative===0,"red works only with positives"),r(o.red,"red works only with red numbers")},q.prototype._verify2=function(o,h){r((o.negative|h.negative)===0,"red works only with positives"),r(o.red&&o.red===h.red,"red works only with red numbers")},q.prototype.imod=function(o){return this.prime?this.prime.ireduce(o)._forceRed(this):o.umod(this.m)._forceRed(this)},q.prototype.neg=function(o){return o.isZero()?o.clone():this.m.sub(o)._forceRed(this)},q.prototype.add=function(o,h){this._verify2(o,h);var d=o.add(h);return d.cmp(this.m)>=0&&d.isub(this.m),d._forceRed(this)},q.prototype.iadd=function(o,h){this._verify2(o,h);var d=o.iadd(h);return d.cmp(this.m)>=0&&d.isub(this.m),d},q.prototype.sub=function(o,h){this._verify2(o,h);var d=o.sub(h);return d.cmpn(0)<0&&d.iadd(this.m),d._forceRed(this)},q.prototype.isub=function(o,h){this._verify2(o,h);var d=o.isub(h);return d.cmpn(0)<0&&d.iadd(this.m),d},q.prototype.shl=function(o,h){return this._verify1(o),this.imod(o.ushln(h))},q.prototype.imul=function(o,h){return this._verify2(o,h),this.imod(o.imul(h))},q.prototype.mul=function(o,h){return this._verify2(o,h),this.imod(o.mul(h))},q.prototype.isqr=function(o){return this.imul(o,o.clone())},q.prototype.sqr=function(o){return this.mul(o,o)},q.prototype.sqrt=function(o){if(o.isZero())return o.clone();var h=this.m.andln(3);if(r(h%2===1),h===3){var d=this.m.add(new i(1)).iushrn(2);return this.pow(o,d)}for(var v=this.m.subn(1),m=0;!v.isZero()&&v.andln(1)===0;)m++,v.iushrn(1);r(!v.isZero());var _=new i(1).toRed(this),E=_.redNeg(),b=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new i(2*f*f).toRed(this);this.pow(f,b).cmp(E)!==0;)f.redIAdd(E);for(var g=this.pow(f,v),A=this.pow(o,v.addn(1).iushrn(1)),R=this.pow(o,v),k=m;R.cmp(_)!==0;){for(var U=R,G=0;U.cmp(_)!==0;G++)U=U.redSqr();r(G=0;m--){for(var g=h.words[m],A=f-1;A>=0;A--){var R=g>>A&1;if(_!==v[0]&&(_=this.sqr(_)),R===0&&E===0){b=0;continue}E<<=1,E|=R,b++,!(b!==d&&(m!==0||A!==0))&&(_=this.mul(_,v[E]),b=0,E=0)}f=26}return _},q.prototype.convertTo=function(o){var h=o.umod(this.m);return h===o?h.clone():h},q.prototype.convertFrom=function(o){var h=o.clone();return h.red=null,h},i.mont=function(o){return new ee(o)};function ee(y){q.call(this,y),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}n(ee,q),ee.prototype.convertTo=function(o){return this.imod(o.ushln(this.shift))},ee.prototype.convertFrom=function(o){var h=this.imod(o.mul(this.rinv));return h.red=null,h},ee.prototype.imul=function(o,h){if(o.isZero()||h.isZero())return o.words[0]=0,o.length=1,o;var d=o.imul(h),v=d.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),m=d.isub(v).iushrn(this.shift),_=m;return m.cmp(this.m)>=0?_=m.isub(this.m):m.cmpn(0)<0&&(_=m.iadd(this.m)),_._forceRed(this)},ee.prototype.mul=function(o,h){if(o.isZero()||h.isZero())return new i(0)._forceRed(this);var d=o.mul(h),v=d.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),m=d.isub(v).iushrn(this.shift),_=m;return m.cmp(this.m)>=0?_=m.isub(this.m):m.cmpn(0)<0&&(_=m.iadd(this.m)),_._forceRed(this)},ee.prototype.invm=function(o){var h=this.imod(o._invmp(this.m).mul(this.r2));return h._forceRed(this)}})(typeof yc>"u"||yc,Vd)});var $d=T((qB,s_)=>{s_.exports={name:"elliptic",version:"6.5.4",description:"EC cryptography",main:"lib/elliptic.js",files:["lib"],scripts:{lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},repository:{type:"git",url:"git@github.com:indutny/elliptic"},keywords:["EC","Elliptic","curve","Cryptography"],author:"Fedor Indutny ",license:"MIT",bugs:{url:"https://github.com/indutny/elliptic/issues"},homepage:"https://github.com/indutny/elliptic",devDependencies:{brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies:{"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}}});var Er=T((jd,wc)=>{(function(e,t){"use strict";function r(y,o){if(!y)throw new Error(o||"Assertion failed")}function n(y,o){y.super_=o;var h=function(){};h.prototype=o.prototype,y.prototype=new h,y.prototype.constructor=y}function i(y,o,h){if(i.isBN(y))return y;this.negative=0,this.words=null,this.length=0,this.red=null,y!==null&&((o==="le"||o==="be")&&(h=o,o=10),this._init(y||0,o||10,h||"be"))}typeof e=="object"?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26;var s;try{typeof window<"u"&&typeof window.Buffer<"u"?s=window.Buffer:s=require("buffer").Buffer}catch{}i.isBN=function(o){return o instanceof i?!0:o!==null&&typeof o=="object"&&o.constructor.wordSize===i.wordSize&&Array.isArray(o.words)},i.max=function(o,h){return o.cmp(h)>0?o:h},i.min=function(o,h){return o.cmp(h)<0?o:h},i.prototype._init=function(o,h,d){if(typeof o=="number")return this._initNumber(o,h,d);if(typeof o=="object")return this._initArray(o,h,d);h==="hex"&&(h=16),r(h===(h|0)&&h>=2&&h<=36),o=o.toString().replace(/\s+/g,"");var v=0;o[0]==="-"&&(v++,this.negative=1),v=0;v-=3)_=o[v]|o[v-1]<<8|o[v-2]<<16,this.words[m]|=_<>>26-E&67108863,E+=24,E>=26&&(E-=26,m++);else if(d==="le")for(v=0,m=0;v>>26-E&67108863,E+=24,E>=26&&(E-=26,m++);return this.strip()};function a(y,o){var h=y.charCodeAt(o);return h>=65&&h<=70?h-55:h>=97&&h<=102?h-87:h-48&15}function u(y,o,h){var d=a(y,h);return h-1>=o&&(d|=a(y,h-1)<<4),d}i.prototype._parseHex=function(o,h,d){this.length=Math.ceil((o.length-h)/6),this.words=new Array(this.length);for(var v=0;v=h;v-=2)E=u(o,h,v)<=18?(m-=18,_+=1,this.words[_]|=E>>>26):m+=8;else{var b=o.length-h;for(v=b%2===0?h+1:h;v=18?(m-=18,_+=1,this.words[_]|=E>>>26):m+=8}this.strip()};function l(y,o,h,d){for(var v=0,m=Math.min(y.length,h),_=o;_=49?v+=E-49+10:E>=17?v+=E-17+10:v+=E}return v}i.prototype._parseBase=function(o,h,d){this.words=[0],this.length=1;for(var v=0,m=1;m<=67108863;m*=h)v++;v--,m=m/h|0;for(var _=o.length-d,E=_%v,b=Math.min(_,_-E)+d,f=0,g=d;g1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?""};var c=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],p=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],w=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(o,h){o=o||10,h=h|0||1;var d;if(o===16||o==="hex"){d="";for(var v=0,m=0,_=0;_>>24-v&16777215,m!==0||_!==this.length-1?d=c[6-b.length]+b+d:d=b+d,v+=2,v>=26&&(v-=26,_--)}for(m!==0&&(d=m.toString(16)+d);d.length%h!==0;)d="0"+d;return this.negative!==0&&(d="-"+d),d}if(o===(o|0)&&o>=2&&o<=36){var f=p[o],g=w[o];d="";var A=this.clone();for(A.negative=0;!A.isZero();){var R=A.modn(g).toString(o);A=A.idivn(g),A.isZero()?d=R+d:d=c[f-R.length]+R+d}for(this.isZero()&&(d="0"+d);d.length%h!==0;)d="0"+d;return this.negative!==0&&(d="-"+d),d}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var o=this.words[0];return this.length===2?o+=this.words[1]*67108864:this.length===3&&this.words[2]===1?o+=4503599627370496+this.words[1]*67108864:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-o:o},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(o,h){return r(typeof s<"u"),this.toArrayLike(s,o,h)},i.prototype.toArray=function(o,h){return this.toArrayLike(Array,o,h)},i.prototype.toArrayLike=function(o,h,d){var v=this.byteLength(),m=d||Math.max(1,v);r(v<=m,"byte array longer than desired length"),r(m>0,"Requested array length <= 0"),this.strip();var _=h==="le",E=new o(m),b,f,g=this.clone();if(_){for(f=0;!g.isZero();f++)b=g.andln(255),g.iushrn(8),E[f]=b;for(;f=4096&&(d+=13,h>>>=13),h>=64&&(d+=7,h>>>=7),h>=8&&(d+=4,h>>>=4),h>=2&&(d+=2,h>>>=2),d+h},i.prototype._zeroBits=function(o){if(o===0)return 26;var h=o,d=0;return(h&8191)===0&&(d+=13,h>>>=13),(h&127)===0&&(d+=7,h>>>=7),(h&15)===0&&(d+=4,h>>>=4),(h&3)===0&&(d+=2,h>>>=2),(h&1)===0&&d++,d},i.prototype.bitLength=function(){var o=this.words[this.length-1],h=this._countBits(o);return(this.length-1)*26+h};function x(y){for(var o=new Array(y.bitLength()),h=0;h>>v}return o}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var o=0,h=0;ho.length?this.clone().ior(o):o.clone().ior(this)},i.prototype.uor=function(o){return this.length>o.length?this.clone().iuor(o):o.clone().iuor(this)},i.prototype.iuand=function(o){var h;this.length>o.length?h=o:h=this;for(var d=0;do.length?this.clone().iand(o):o.clone().iand(this)},i.prototype.uand=function(o){return this.length>o.length?this.clone().iuand(o):o.clone().iuand(this)},i.prototype.iuxor=function(o){var h,d;this.length>o.length?(h=this,d=o):(h=o,d=this);for(var v=0;vo.length?this.clone().ixor(o):o.clone().ixor(this)},i.prototype.uxor=function(o){return this.length>o.length?this.clone().iuxor(o):o.clone().iuxor(this)},i.prototype.inotn=function(o){r(typeof o=="number"&&o>=0);var h=Math.ceil(o/26)|0,d=o%26;this._expand(h),d>0&&h--;for(var v=0;v0&&(this.words[v]=~this.words[v]&67108863>>26-d),this.strip()},i.prototype.notn=function(o){return this.clone().inotn(o)},i.prototype.setn=function(o,h){r(typeof o=="number"&&o>=0);var d=o/26|0,v=o%26;return this._expand(d+1),h?this.words[d]=this.words[d]|1<o.length?(d=this,v=o):(d=o,v=this);for(var m=0,_=0;_>>26;for(;m!==0&&_>>26;if(this.length=d.length,m!==0)this.words[this.length]=m,this.length++;else if(d!==this)for(;_o.length?this.clone().iadd(o):o.clone().iadd(this)},i.prototype.isub=function(o){if(o.negative!==0){o.negative=0;var h=this.iadd(o);return o.negative=1,h._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(o),this.negative=1,this._normSign();var d=this.cmp(o);if(d===0)return this.negative=0,this.length=1,this.words[0]=0,this;var v,m;d>0?(v=this,m=o):(v=o,m=this);for(var _=0,E=0;E>26,this.words[E]=h&67108863;for(;_!==0&&E>26,this.words[E]=h&67108863;if(_===0&&E>>26,A=b&67108863,R=Math.min(f,o.length-1),k=Math.max(0,f-y.length+1);k<=R;k++){var U=f-k|0;v=y.words[U]|0,m=o.words[k]|0,_=v*m+A,g+=_/67108864|0,A=_&67108863}h.words[f]=A|0,b=g|0}return b!==0?h.words[f]=b|0:h.length--,h.strip()}var M=function(o,h,d){var v=o.words,m=h.words,_=d.words,E=0,b,f,g,A=v[0]|0,R=A&8191,k=A>>>13,U=v[1]|0,G=U&8191,F=U>>>13,Le=v[2]|0,V=Le&8191,j=Le>>>13,fr=v[3]|0,Y=fr&8191,oe=fr>>>13,ct=v[4]|0,re=ct&8191,te=ct>>>13,hn=v[5]|0,ae=hn&8191,ne=hn>>>13,Hr=v[6]|0,ie=Hr&8191,J=Hr>>>13,yr=v[7]|0,D=yr&8191,fe=yr>>>13,wr=v[8]|0,se=wr&8191,ue=wr>>>13,qe=v[9]|0,Z=qe&8191,Q=qe>>>13,Jt=m[0]|0,ce=Jt&8191,he=Jt>>>13,Gn=m[1]|0,de=Gn&8191,pe=Gn>>>13,so=m[2]|0,ve=so&8191,be=so>>>13,oo=m[3]|0,ge=oo&8191,me=oo>>>13,ao=m[4]|0,ye=ao&8191,we=ao>>>13,fo=m[5]|0,_e=fo&8191,Ee=fo>>>13,uo=m[6]|0,xe=uo&8191,Se=uo>>>13,co=m[7]|0,Ie=co&8191,Te=co>>>13,ho=m[8]|0,Me=ho&8191,Ae=ho>>>13,lo=m[9]|0,Oe=lo&8191,Pe=lo>>>13;d.negative=o.negative^h.negative,d.length=19,b=Math.imul(R,ce),f=Math.imul(R,he),f=f+Math.imul(k,ce)|0,g=Math.imul(k,he);var Wn=(E+b|0)+((f&8191)<<13)|0;E=(g+(f>>>13)|0)+(Wn>>>26)|0,Wn&=67108863,b=Math.imul(G,ce),f=Math.imul(G,he),f=f+Math.imul(F,ce)|0,g=Math.imul(F,he),b=b+Math.imul(R,de)|0,f=f+Math.imul(R,pe)|0,f=f+Math.imul(k,de)|0,g=g+Math.imul(k,pe)|0;var Vn=(E+b|0)+((f&8191)<<13)|0;E=(g+(f>>>13)|0)+(Vn>>>26)|0,Vn&=67108863,b=Math.imul(V,ce),f=Math.imul(V,he),f=f+Math.imul(j,ce)|0,g=Math.imul(j,he),b=b+Math.imul(G,de)|0,f=f+Math.imul(G,pe)|0,f=f+Math.imul(F,de)|0,g=g+Math.imul(F,pe)|0,b=b+Math.imul(R,ve)|0,f=f+Math.imul(R,be)|0,f=f+Math.imul(k,ve)|0,g=g+Math.imul(k,be)|0;var zn=(E+b|0)+((f&8191)<<13)|0;E=(g+(f>>>13)|0)+(zn>>>26)|0,zn&=67108863,b=Math.imul(Y,ce),f=Math.imul(Y,he),f=f+Math.imul(oe,ce)|0,g=Math.imul(oe,he),b=b+Math.imul(V,de)|0,f=f+Math.imul(V,pe)|0,f=f+Math.imul(j,de)|0,g=g+Math.imul(j,pe)|0,b=b+Math.imul(G,ve)|0,f=f+Math.imul(G,be)|0,f=f+Math.imul(F,ve)|0,g=g+Math.imul(F,be)|0,b=b+Math.imul(R,ge)|0,f=f+Math.imul(R,me)|0,f=f+Math.imul(k,ge)|0,g=g+Math.imul(k,me)|0;var $n=(E+b|0)+((f&8191)<<13)|0;E=(g+(f>>>13)|0)+($n>>>26)|0,$n&=67108863,b=Math.imul(re,ce),f=Math.imul(re,he),f=f+Math.imul(te,ce)|0,g=Math.imul(te,he),b=b+Math.imul(Y,de)|0,f=f+Math.imul(Y,pe)|0,f=f+Math.imul(oe,de)|0,g=g+Math.imul(oe,pe)|0,b=b+Math.imul(V,ve)|0,f=f+Math.imul(V,be)|0,f=f+Math.imul(j,ve)|0,g=g+Math.imul(j,be)|0,b=b+Math.imul(G,ge)|0,f=f+Math.imul(G,me)|0,f=f+Math.imul(F,ge)|0,g=g+Math.imul(F,me)|0,b=b+Math.imul(R,ye)|0,f=f+Math.imul(R,we)|0,f=f+Math.imul(k,ye)|0,g=g+Math.imul(k,we)|0;var jn=(E+b|0)+((f&8191)<<13)|0;E=(g+(f>>>13)|0)+(jn>>>26)|0,jn&=67108863,b=Math.imul(ae,ce),f=Math.imul(ae,he),f=f+Math.imul(ne,ce)|0,g=Math.imul(ne,he),b=b+Math.imul(re,de)|0,f=f+Math.imul(re,pe)|0,f=f+Math.imul(te,de)|0,g=g+Math.imul(te,pe)|0,b=b+Math.imul(Y,ve)|0,f=f+Math.imul(Y,be)|0,f=f+Math.imul(oe,ve)|0,g=g+Math.imul(oe,be)|0,b=b+Math.imul(V,ge)|0,f=f+Math.imul(V,me)|0,f=f+Math.imul(j,ge)|0,g=g+Math.imul(j,me)|0,b=b+Math.imul(G,ye)|0,f=f+Math.imul(G,we)|0,f=f+Math.imul(F,ye)|0,g=g+Math.imul(F,we)|0,b=b+Math.imul(R,_e)|0,f=f+Math.imul(R,Ee)|0,f=f+Math.imul(k,_e)|0,g=g+Math.imul(k,Ee)|0;var Xn=(E+b|0)+((f&8191)<<13)|0;E=(g+(f>>>13)|0)+(Xn>>>26)|0,Xn&=67108863,b=Math.imul(ie,ce),f=Math.imul(ie,he),f=f+Math.imul(J,ce)|0,g=Math.imul(J,he),b=b+Math.imul(ae,de)|0,f=f+Math.imul(ae,pe)|0,f=f+Math.imul(ne,de)|0,g=g+Math.imul(ne,pe)|0,b=b+Math.imul(re,ve)|0,f=f+Math.imul(re,be)|0,f=f+Math.imul(te,ve)|0,g=g+Math.imul(te,be)|0,b=b+Math.imul(Y,ge)|0,f=f+Math.imul(Y,me)|0,f=f+Math.imul(oe,ge)|0,g=g+Math.imul(oe,me)|0,b=b+Math.imul(V,ye)|0,f=f+Math.imul(V,we)|0,f=f+Math.imul(j,ye)|0,g=g+Math.imul(j,we)|0,b=b+Math.imul(G,_e)|0,f=f+Math.imul(G,Ee)|0,f=f+Math.imul(F,_e)|0,g=g+Math.imul(F,Ee)|0,b=b+Math.imul(R,xe)|0,f=f+Math.imul(R,Se)|0,f=f+Math.imul(k,xe)|0,g=g+Math.imul(k,Se)|0;var Yn=(E+b|0)+((f&8191)<<13)|0;E=(g+(f>>>13)|0)+(Yn>>>26)|0,Yn&=67108863,b=Math.imul(D,ce),f=Math.imul(D,he),f=f+Math.imul(fe,ce)|0,g=Math.imul(fe,he),b=b+Math.imul(ie,de)|0,f=f+Math.imul(ie,pe)|0,f=f+Math.imul(J,de)|0,g=g+Math.imul(J,pe)|0,b=b+Math.imul(ae,ve)|0,f=f+Math.imul(ae,be)|0,f=f+Math.imul(ne,ve)|0,g=g+Math.imul(ne,be)|0,b=b+Math.imul(re,ge)|0,f=f+Math.imul(re,me)|0,f=f+Math.imul(te,ge)|0,g=g+Math.imul(te,me)|0,b=b+Math.imul(Y,ye)|0,f=f+Math.imul(Y,we)|0,f=f+Math.imul(oe,ye)|0,g=g+Math.imul(oe,we)|0,b=b+Math.imul(V,_e)|0,f=f+Math.imul(V,Ee)|0,f=f+Math.imul(j,_e)|0,g=g+Math.imul(j,Ee)|0,b=b+Math.imul(G,xe)|0,f=f+Math.imul(G,Se)|0,f=f+Math.imul(F,xe)|0,g=g+Math.imul(F,Se)|0,b=b+Math.imul(R,Ie)|0,f=f+Math.imul(R,Te)|0,f=f+Math.imul(k,Ie)|0,g=g+Math.imul(k,Te)|0;var Jn=(E+b|0)+((f&8191)<<13)|0;E=(g+(f>>>13)|0)+(Jn>>>26)|0,Jn&=67108863,b=Math.imul(se,ce),f=Math.imul(se,he),f=f+Math.imul(ue,ce)|0,g=Math.imul(ue,he),b=b+Math.imul(D,de)|0,f=f+Math.imul(D,pe)|0,f=f+Math.imul(fe,de)|0,g=g+Math.imul(fe,pe)|0,b=b+Math.imul(ie,ve)|0,f=f+Math.imul(ie,be)|0,f=f+Math.imul(J,ve)|0,g=g+Math.imul(J,be)|0,b=b+Math.imul(ae,ge)|0,f=f+Math.imul(ae,me)|0,f=f+Math.imul(ne,ge)|0,g=g+Math.imul(ne,me)|0,b=b+Math.imul(re,ye)|0,f=f+Math.imul(re,we)|0,f=f+Math.imul(te,ye)|0,g=g+Math.imul(te,we)|0,b=b+Math.imul(Y,_e)|0,f=f+Math.imul(Y,Ee)|0,f=f+Math.imul(oe,_e)|0,g=g+Math.imul(oe,Ee)|0,b=b+Math.imul(V,xe)|0,f=f+Math.imul(V,Se)|0,f=f+Math.imul(j,xe)|0,g=g+Math.imul(j,Se)|0,b=b+Math.imul(G,Ie)|0,f=f+Math.imul(G,Te)|0,f=f+Math.imul(F,Ie)|0,g=g+Math.imul(F,Te)|0,b=b+Math.imul(R,Me)|0,f=f+Math.imul(R,Ae)|0,f=f+Math.imul(k,Me)|0,g=g+Math.imul(k,Ae)|0;var Zn=(E+b|0)+((f&8191)<<13)|0;E=(g+(f>>>13)|0)+(Zn>>>26)|0,Zn&=67108863,b=Math.imul(Z,ce),f=Math.imul(Z,he),f=f+Math.imul(Q,ce)|0,g=Math.imul(Q,he),b=b+Math.imul(se,de)|0,f=f+Math.imul(se,pe)|0,f=f+Math.imul(ue,de)|0,g=g+Math.imul(ue,pe)|0,b=b+Math.imul(D,ve)|0,f=f+Math.imul(D,be)|0,f=f+Math.imul(fe,ve)|0,g=g+Math.imul(fe,be)|0,b=b+Math.imul(ie,ge)|0,f=f+Math.imul(ie,me)|0,f=f+Math.imul(J,ge)|0,g=g+Math.imul(J,me)|0,b=b+Math.imul(ae,ye)|0,f=f+Math.imul(ae,we)|0,f=f+Math.imul(ne,ye)|0,g=g+Math.imul(ne,we)|0,b=b+Math.imul(re,_e)|0,f=f+Math.imul(re,Ee)|0,f=f+Math.imul(te,_e)|0,g=g+Math.imul(te,Ee)|0,b=b+Math.imul(Y,xe)|0,f=f+Math.imul(Y,Se)|0,f=f+Math.imul(oe,xe)|0,g=g+Math.imul(oe,Se)|0,b=b+Math.imul(V,Ie)|0,f=f+Math.imul(V,Te)|0,f=f+Math.imul(j,Ie)|0,g=g+Math.imul(j,Te)|0,b=b+Math.imul(G,Me)|0,f=f+Math.imul(G,Ae)|0,f=f+Math.imul(F,Me)|0,g=g+Math.imul(F,Ae)|0,b=b+Math.imul(R,Oe)|0,f=f+Math.imul(R,Pe)|0,f=f+Math.imul(k,Oe)|0,g=g+Math.imul(k,Pe)|0;var Qn=(E+b|0)+((f&8191)<<13)|0;E=(g+(f>>>13)|0)+(Qn>>>26)|0,Qn&=67108863,b=Math.imul(Z,de),f=Math.imul(Z,pe),f=f+Math.imul(Q,de)|0,g=Math.imul(Q,pe),b=b+Math.imul(se,ve)|0,f=f+Math.imul(se,be)|0,f=f+Math.imul(ue,ve)|0,g=g+Math.imul(ue,be)|0,b=b+Math.imul(D,ge)|0,f=f+Math.imul(D,me)|0,f=f+Math.imul(fe,ge)|0,g=g+Math.imul(fe,me)|0,b=b+Math.imul(ie,ye)|0,f=f+Math.imul(ie,we)|0,f=f+Math.imul(J,ye)|0,g=g+Math.imul(J,we)|0,b=b+Math.imul(ae,_e)|0,f=f+Math.imul(ae,Ee)|0,f=f+Math.imul(ne,_e)|0,g=g+Math.imul(ne,Ee)|0,b=b+Math.imul(re,xe)|0,f=f+Math.imul(re,Se)|0,f=f+Math.imul(te,xe)|0,g=g+Math.imul(te,Se)|0,b=b+Math.imul(Y,Ie)|0,f=f+Math.imul(Y,Te)|0,f=f+Math.imul(oe,Ie)|0,g=g+Math.imul(oe,Te)|0,b=b+Math.imul(V,Me)|0,f=f+Math.imul(V,Ae)|0,f=f+Math.imul(j,Me)|0,g=g+Math.imul(j,Ae)|0,b=b+Math.imul(G,Oe)|0,f=f+Math.imul(G,Pe)|0,f=f+Math.imul(F,Oe)|0,g=g+Math.imul(F,Pe)|0;var ei=(E+b|0)+((f&8191)<<13)|0;E=(g+(f>>>13)|0)+(ei>>>26)|0,ei&=67108863,b=Math.imul(Z,ve),f=Math.imul(Z,be),f=f+Math.imul(Q,ve)|0,g=Math.imul(Q,be),b=b+Math.imul(se,ge)|0,f=f+Math.imul(se,me)|0,f=f+Math.imul(ue,ge)|0,g=g+Math.imul(ue,me)|0,b=b+Math.imul(D,ye)|0,f=f+Math.imul(D,we)|0,f=f+Math.imul(fe,ye)|0,g=g+Math.imul(fe,we)|0,b=b+Math.imul(ie,_e)|0,f=f+Math.imul(ie,Ee)|0,f=f+Math.imul(J,_e)|0,g=g+Math.imul(J,Ee)|0,b=b+Math.imul(ae,xe)|0,f=f+Math.imul(ae,Se)|0,f=f+Math.imul(ne,xe)|0,g=g+Math.imul(ne,Se)|0,b=b+Math.imul(re,Ie)|0,f=f+Math.imul(re,Te)|0,f=f+Math.imul(te,Ie)|0,g=g+Math.imul(te,Te)|0,b=b+Math.imul(Y,Me)|0,f=f+Math.imul(Y,Ae)|0,f=f+Math.imul(oe,Me)|0,g=g+Math.imul(oe,Ae)|0,b=b+Math.imul(V,Oe)|0,f=f+Math.imul(V,Pe)|0,f=f+Math.imul(j,Oe)|0,g=g+Math.imul(j,Pe)|0;var ti=(E+b|0)+((f&8191)<<13)|0;E=(g+(f>>>13)|0)+(ti>>>26)|0,ti&=67108863,b=Math.imul(Z,ge),f=Math.imul(Z,me),f=f+Math.imul(Q,ge)|0,g=Math.imul(Q,me),b=b+Math.imul(se,ye)|0,f=f+Math.imul(se,we)|0,f=f+Math.imul(ue,ye)|0,g=g+Math.imul(ue,we)|0,b=b+Math.imul(D,_e)|0,f=f+Math.imul(D,Ee)|0,f=f+Math.imul(fe,_e)|0,g=g+Math.imul(fe,Ee)|0,b=b+Math.imul(ie,xe)|0,f=f+Math.imul(ie,Se)|0,f=f+Math.imul(J,xe)|0,g=g+Math.imul(J,Se)|0,b=b+Math.imul(ae,Ie)|0,f=f+Math.imul(ae,Te)|0,f=f+Math.imul(ne,Ie)|0,g=g+Math.imul(ne,Te)|0,b=b+Math.imul(re,Me)|0,f=f+Math.imul(re,Ae)|0,f=f+Math.imul(te,Me)|0,g=g+Math.imul(te,Ae)|0,b=b+Math.imul(Y,Oe)|0,f=f+Math.imul(Y,Pe)|0,f=f+Math.imul(oe,Oe)|0,g=g+Math.imul(oe,Pe)|0;var ri=(E+b|0)+((f&8191)<<13)|0;E=(g+(f>>>13)|0)+(ri>>>26)|0,ri&=67108863,b=Math.imul(Z,ye),f=Math.imul(Z,we),f=f+Math.imul(Q,ye)|0,g=Math.imul(Q,we),b=b+Math.imul(se,_e)|0,f=f+Math.imul(se,Ee)|0,f=f+Math.imul(ue,_e)|0,g=g+Math.imul(ue,Ee)|0,b=b+Math.imul(D,xe)|0,f=f+Math.imul(D,Se)|0,f=f+Math.imul(fe,xe)|0,g=g+Math.imul(fe,Se)|0,b=b+Math.imul(ie,Ie)|0,f=f+Math.imul(ie,Te)|0,f=f+Math.imul(J,Ie)|0,g=g+Math.imul(J,Te)|0,b=b+Math.imul(ae,Me)|0,f=f+Math.imul(ae,Ae)|0,f=f+Math.imul(ne,Me)|0,g=g+Math.imul(ne,Ae)|0,b=b+Math.imul(re,Oe)|0,f=f+Math.imul(re,Pe)|0,f=f+Math.imul(te,Oe)|0,g=g+Math.imul(te,Pe)|0;var ni=(E+b|0)+((f&8191)<<13)|0;E=(g+(f>>>13)|0)+(ni>>>26)|0,ni&=67108863,b=Math.imul(Z,_e),f=Math.imul(Z,Ee),f=f+Math.imul(Q,_e)|0,g=Math.imul(Q,Ee),b=b+Math.imul(se,xe)|0,f=f+Math.imul(se,Se)|0,f=f+Math.imul(ue,xe)|0,g=g+Math.imul(ue,Se)|0,b=b+Math.imul(D,Ie)|0,f=f+Math.imul(D,Te)|0,f=f+Math.imul(fe,Ie)|0,g=g+Math.imul(fe,Te)|0,b=b+Math.imul(ie,Me)|0,f=f+Math.imul(ie,Ae)|0,f=f+Math.imul(J,Me)|0,g=g+Math.imul(J,Ae)|0,b=b+Math.imul(ae,Oe)|0,f=f+Math.imul(ae,Pe)|0,f=f+Math.imul(ne,Oe)|0,g=g+Math.imul(ne,Pe)|0;var ii=(E+b|0)+((f&8191)<<13)|0;E=(g+(f>>>13)|0)+(ii>>>26)|0,ii&=67108863,b=Math.imul(Z,xe),f=Math.imul(Z,Se),f=f+Math.imul(Q,xe)|0,g=Math.imul(Q,Se),b=b+Math.imul(se,Ie)|0,f=f+Math.imul(se,Te)|0,f=f+Math.imul(ue,Ie)|0,g=g+Math.imul(ue,Te)|0,b=b+Math.imul(D,Me)|0,f=f+Math.imul(D,Ae)|0,f=f+Math.imul(fe,Me)|0,g=g+Math.imul(fe,Ae)|0,b=b+Math.imul(ie,Oe)|0,f=f+Math.imul(ie,Pe)|0,f=f+Math.imul(J,Oe)|0,g=g+Math.imul(J,Pe)|0;var si=(E+b|0)+((f&8191)<<13)|0;E=(g+(f>>>13)|0)+(si>>>26)|0,si&=67108863,b=Math.imul(Z,Ie),f=Math.imul(Z,Te),f=f+Math.imul(Q,Ie)|0,g=Math.imul(Q,Te),b=b+Math.imul(se,Me)|0,f=f+Math.imul(se,Ae)|0,f=f+Math.imul(ue,Me)|0,g=g+Math.imul(ue,Ae)|0,b=b+Math.imul(D,Oe)|0,f=f+Math.imul(D,Pe)|0,f=f+Math.imul(fe,Oe)|0,g=g+Math.imul(fe,Pe)|0;var oi=(E+b|0)+((f&8191)<<13)|0;E=(g+(f>>>13)|0)+(oi>>>26)|0,oi&=67108863,b=Math.imul(Z,Me),f=Math.imul(Z,Ae),f=f+Math.imul(Q,Me)|0,g=Math.imul(Q,Ae),b=b+Math.imul(se,Oe)|0,f=f+Math.imul(se,Pe)|0,f=f+Math.imul(ue,Oe)|0,g=g+Math.imul(ue,Pe)|0;var ai=(E+b|0)+((f&8191)<<13)|0;E=(g+(f>>>13)|0)+(ai>>>26)|0,ai&=67108863,b=Math.imul(Z,Oe),f=Math.imul(Z,Pe),f=f+Math.imul(Q,Oe)|0,g=Math.imul(Q,Pe);var fi=(E+b|0)+((f&8191)<<13)|0;return E=(g+(f>>>13)|0)+(fi>>>26)|0,fi&=67108863,_[0]=Wn,_[1]=Vn,_[2]=zn,_[3]=$n,_[4]=jn,_[5]=Xn,_[6]=Yn,_[7]=Jn,_[8]=Zn,_[9]=Qn,_[10]=ei,_[11]=ti,_[12]=ri,_[13]=ni,_[14]=ii,_[15]=si,_[16]=oi,_[17]=ai,_[18]=fi,E!==0&&(_[19]=E,d.length++),d};Math.imul||(M=S);function O(y,o,h){h.negative=o.negative^y.negative,h.length=y.length+o.length;for(var d=0,v=0,m=0;m>>26)|0,v+=_>>>26,_&=67108863}h.words[m]=E,d=_,_=v}return d!==0?h.words[m]=d:h.length--,h.strip()}function P(y,o,h){var d=new B;return d.mulp(y,o,h)}i.prototype.mulTo=function(o,h){var d,v=this.length+o.length;return this.length===10&&o.length===10?d=M(this,o,h):v<63?d=S(this,o,h):v<1024?d=O(this,o,h):d=P(this,o,h),d};function B(y,o){this.x=y,this.y=o}B.prototype.makeRBT=function(o){for(var h=new Array(o),d=i.prototype._countBits(o)-1,v=0;v>=1;return v},B.prototype.permute=function(o,h,d,v,m,_){for(var E=0;E<_;E++)v[E]=h[o[E]],m[E]=d[o[E]]},B.prototype.transform=function(o,h,d,v,m,_){this.permute(_,o,h,d,v,m);for(var E=1;E>>1)m++;return 1<>>13,d[2*_+1]=m&8191,m=m>>>13;for(_=2*h;_>=26,h+=v/67108864|0,h+=m>>>26,this.words[d]=m&67108863}return h!==0&&(this.words[d]=h,this.length++),this},i.prototype.muln=function(o){return this.clone().imuln(o)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(o){var h=x(o);if(h.length===0)return new i(1);for(var d=this,v=0;v=0);var h=o%26,d=(o-h)/26,v=67108863>>>26-h<<26-h,m;if(h!==0){var _=0;for(m=0;m>>26-h}_&&(this.words[m]=_,this.length++)}if(d!==0){for(m=this.length-1;m>=0;m--)this.words[m+d]=this.words[m];for(m=0;m=0);var v;h?v=(h-h%26)/26:v=0;var m=o%26,_=Math.min((o-m)/26,this.length),E=67108863^67108863>>>m<_)for(this.length-=_,f=0;f=0&&(g!==0||f>=v);f--){var A=this.words[f]|0;this.words[f]=g<<26-m|A>>>m,g=A&E}return b&&g!==0&&(b.words[b.length++]=g),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(o,h,d){return r(this.negative===0),this.iushrn(o,h,d)},i.prototype.shln=function(o){return this.clone().ishln(o)},i.prototype.ushln=function(o){return this.clone().iushln(o)},i.prototype.shrn=function(o){return this.clone().ishrn(o)},i.prototype.ushrn=function(o){return this.clone().iushrn(o)},i.prototype.testn=function(o){r(typeof o=="number"&&o>=0);var h=o%26,d=(o-h)/26,v=1<=0);var h=o%26,d=(o-h)/26;if(r(this.negative===0,"imaskn works only with positive numbers"),this.length<=d)return this;if(h!==0&&d++,this.length=Math.min(d,this.length),h!==0){var v=67108863^67108863>>>h<=67108864;h++)this.words[h]-=67108864,h===this.length-1?this.words[h+1]=1:this.words[h+1]++;return this.length=Math.max(this.length,h+1),this},i.prototype.isubn=function(o){if(r(typeof o=="number"),r(o<67108864),o<0)return this.iaddn(-o);if(this.negative!==0)return this.negative=0,this.iaddn(o),this.negative=1,this;if(this.words[0]-=o,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var h=0;h>26)-(b/67108864|0),this.words[m+d]=_&67108863}for(;m>26,this.words[m+d]=_&67108863;if(E===0)return this.strip();for(r(E===-1),E=0,m=0;m>26,this.words[m]=_&67108863;return this.negative=1,this.strip()},i.prototype._wordDiv=function(o,h){var d=this.length-o.length,v=this.clone(),m=o,_=m.words[m.length-1]|0,E=this._countBits(_);d=26-E,d!==0&&(m=m.ushln(d),v.iushln(d),_=m.words[m.length-1]|0);var b=v.length-m.length,f;if(h!=="mod"){f=new i(null),f.length=b+1,f.words=new Array(f.length);for(var g=0;g=0;R--){var k=(v.words[m.length+R]|0)*67108864+(v.words[m.length+R-1]|0);for(k=Math.min(k/_|0,67108863),v._ishlnsubmul(m,k,R);v.negative!==0;)k--,v.negative=0,v._ishlnsubmul(m,1,R),v.isZero()||(v.negative^=1);f&&(f.words[R]=k)}return f&&f.strip(),v.strip(),h!=="div"&&d!==0&&v.iushrn(d),{div:f||null,mod:v}},i.prototype.divmod=function(o,h,d){if(r(!o.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var v,m,_;return this.negative!==0&&o.negative===0?(_=this.neg().divmod(o,h),h!=="mod"&&(v=_.div.neg()),h!=="div"&&(m=_.mod.neg(),d&&m.negative!==0&&m.iadd(o)),{div:v,mod:m}):this.negative===0&&o.negative!==0?(_=this.divmod(o.neg(),h),h!=="mod"&&(v=_.div.neg()),{div:v,mod:_.mod}):(this.negative&o.negative)!==0?(_=this.neg().divmod(o.neg(),h),h!=="div"&&(m=_.mod.neg(),d&&m.negative!==0&&m.isub(o)),{div:_.div,mod:m}):o.length>this.length||this.cmp(o)<0?{div:new i(0),mod:this}:o.length===1?h==="div"?{div:this.divn(o.words[0]),mod:null}:h==="mod"?{div:null,mod:new i(this.modn(o.words[0]))}:{div:this.divn(o.words[0]),mod:new i(this.modn(o.words[0]))}:this._wordDiv(o,h)},i.prototype.div=function(o){return this.divmod(o,"div",!1).div},i.prototype.mod=function(o){return this.divmod(o,"mod",!1).mod},i.prototype.umod=function(o){return this.divmod(o,"mod",!0).mod},i.prototype.divRound=function(o){var h=this.divmod(o);if(h.mod.isZero())return h.div;var d=h.div.negative!==0?h.mod.isub(o):h.mod,v=o.ushrn(1),m=o.andln(1),_=d.cmp(v);return _<0||m===1&&_===0?h.div:h.div.negative!==0?h.div.isubn(1):h.div.iaddn(1)},i.prototype.modn=function(o){r(o<=67108863);for(var h=(1<<26)%o,d=0,v=this.length-1;v>=0;v--)d=(h*d+(this.words[v]|0))%o;return d},i.prototype.idivn=function(o){r(o<=67108863);for(var h=0,d=this.length-1;d>=0;d--){var v=(this.words[d]|0)+h*67108864;this.words[d]=v/o|0,h=v%o}return this.strip()},i.prototype.divn=function(o){return this.clone().idivn(o)},i.prototype.egcd=function(o){r(o.negative===0),r(!o.isZero());var h=this,d=o.clone();h.negative!==0?h=h.umod(o):h=h.clone();for(var v=new i(1),m=new i(0),_=new i(0),E=new i(1),b=0;h.isEven()&&d.isEven();)h.iushrn(1),d.iushrn(1),++b;for(var f=d.clone(),g=h.clone();!h.isZero();){for(var A=0,R=1;(h.words[0]&R)===0&&A<26;++A,R<<=1);if(A>0)for(h.iushrn(A);A-- >0;)(v.isOdd()||m.isOdd())&&(v.iadd(f),m.isub(g)),v.iushrn(1),m.iushrn(1);for(var k=0,U=1;(d.words[0]&U)===0&&k<26;++k,U<<=1);if(k>0)for(d.iushrn(k);k-- >0;)(_.isOdd()||E.isOdd())&&(_.iadd(f),E.isub(g)),_.iushrn(1),E.iushrn(1);h.cmp(d)>=0?(h.isub(d),v.isub(_),m.isub(E)):(d.isub(h),_.isub(v),E.isub(m))}return{a:_,b:E,gcd:d.iushln(b)}},i.prototype._invmp=function(o){r(o.negative===0),r(!o.isZero());var h=this,d=o.clone();h.negative!==0?h=h.umod(o):h=h.clone();for(var v=new i(1),m=new i(0),_=d.clone();h.cmpn(1)>0&&d.cmpn(1)>0;){for(var E=0,b=1;(h.words[0]&b)===0&&E<26;++E,b<<=1);if(E>0)for(h.iushrn(E);E-- >0;)v.isOdd()&&v.iadd(_),v.iushrn(1);for(var f=0,g=1;(d.words[0]&g)===0&&f<26;++f,g<<=1);if(f>0)for(d.iushrn(f);f-- >0;)m.isOdd()&&m.iadd(_),m.iushrn(1);h.cmp(d)>=0?(h.isub(d),v.isub(m)):(d.isub(h),m.isub(v))}var A;return h.cmpn(1)===0?A=v:A=m,A.cmpn(0)<0&&A.iadd(o),A},i.prototype.gcd=function(o){if(this.isZero())return o.abs();if(o.isZero())return this.abs();var h=this.clone(),d=o.clone();h.negative=0,d.negative=0;for(var v=0;h.isEven()&&d.isEven();v++)h.iushrn(1),d.iushrn(1);do{for(;h.isEven();)h.iushrn(1);for(;d.isEven();)d.iushrn(1);var m=h.cmp(d);if(m<0){var _=h;h=d,d=_}else if(m===0||d.cmpn(1)===0)break;h.isub(d)}while(!0);return d.iushln(v)},i.prototype.invm=function(o){return this.egcd(o).a.umod(o)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(o){return this.words[0]&o},i.prototype.bincn=function(o){r(typeof o=="number");var h=o%26,d=(o-h)/26,v=1<>>26,E&=67108863,this.words[_]=E}return m!==0&&(this.words[_]=m,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(o){var h=o<0;if(this.negative!==0&&!h)return-1;if(this.negative===0&&h)return 1;this.strip();var d;if(this.length>1)d=1;else{h&&(o=-o),r(o<=67108863,"Number is too big");var v=this.words[0]|0;d=v===o?0:vo.length)return 1;if(this.length=0;d--){var v=this.words[d]|0,m=o.words[d]|0;if(v!==m){vm&&(h=1);break}}return h},i.prototype.gtn=function(o){return this.cmpn(o)===1},i.prototype.gt=function(o){return this.cmp(o)===1},i.prototype.gten=function(o){return this.cmpn(o)>=0},i.prototype.gte=function(o){return this.cmp(o)>=0},i.prototype.ltn=function(o){return this.cmpn(o)===-1},i.prototype.lt=function(o){return this.cmp(o)===-1},i.prototype.lten=function(o){return this.cmpn(o)<=0},i.prototype.lte=function(o){return this.cmp(o)<=0},i.prototype.eqn=function(o){return this.cmpn(o)===0},i.prototype.eq=function(o){return this.cmp(o)===0},i.red=function(o){return new q(o)},i.prototype.toRed=function(o){return r(!this.red,"Already a number in reduction context"),r(this.negative===0,"red works only with positives"),o.convertTo(this)._forceRed(o)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(o){return this.red=o,this},i.prototype.forceRed=function(o){return r(!this.red,"Already a number in reduction context"),this._forceRed(o)},i.prototype.redAdd=function(o){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,o)},i.prototype.redIAdd=function(o){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,o)},i.prototype.redSub=function(o){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,o)},i.prototype.redISub=function(o){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,o)},i.prototype.redShl=function(o){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,o)},i.prototype.redMul=function(o){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.mul(this,o)},i.prototype.redIMul=function(o){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.imul(this,o)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(o){return r(this.red&&!o.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,o)};var N={k256:null,p224:null,p192:null,p25519:null};function L(y,o){this.name=y,this.p=new i(o,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}L.prototype._tmp=function(){var o=new i(null);return o.words=new Array(Math.ceil(this.n/13)),o},L.prototype.ireduce=function(o){var h=o,d;do this.split(h,this.tmp),h=this.imulK(h),h=h.iadd(this.tmp),d=h.bitLength();while(d>this.n);var v=d0?h.isub(this.p):h.strip!==void 0?h.strip():h._strip(),h},L.prototype.split=function(o,h){o.iushrn(this.n,0,h)},L.prototype.imulK=function(o){return o.imul(this.k)};function H(){L.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}n(H,L),H.prototype.split=function(o,h){for(var d=4194303,v=Math.min(o.length,9),m=0;m>>22,_=E}_>>>=22,o.words[m-10]=_,_===0&&o.length>10?o.length-=10:o.length-=9},H.prototype.imulK=function(o){o.words[o.length]=0,o.words[o.length+1]=0,o.length+=2;for(var h=0,d=0;d>>=26,o.words[d]=m,h=v}return h!==0&&(o.words[o.length++]=h),o},i._prime=function(o){if(N[o])return N[o];var h;if(o==="k256")h=new H;else if(o==="p224")h=new W;else if(o==="p192")h=new K;else if(o==="p25519")h=new X;else throw new Error("Unknown prime "+o);return N[o]=h,h};function q(y){if(typeof y=="string"){var o=i._prime(y);this.m=o.p,this.prime=o}else r(y.gtn(1),"modulus must be greater than 1"),this.m=y,this.prime=null}q.prototype._verify1=function(o){r(o.negative===0,"red works only with positives"),r(o.red,"red works only with red numbers")},q.prototype._verify2=function(o,h){r((o.negative|h.negative)===0,"red works only with positives"),r(o.red&&o.red===h.red,"red works only with red numbers")},q.prototype.imod=function(o){return this.prime?this.prime.ireduce(o)._forceRed(this):o.umod(this.m)._forceRed(this)},q.prototype.neg=function(o){return o.isZero()?o.clone():this.m.sub(o)._forceRed(this)},q.prototype.add=function(o,h){this._verify2(o,h);var d=o.add(h);return d.cmp(this.m)>=0&&d.isub(this.m),d._forceRed(this)},q.prototype.iadd=function(o,h){this._verify2(o,h);var d=o.iadd(h);return d.cmp(this.m)>=0&&d.isub(this.m),d},q.prototype.sub=function(o,h){this._verify2(o,h);var d=o.sub(h);return d.cmpn(0)<0&&d.iadd(this.m),d._forceRed(this)},q.prototype.isub=function(o,h){this._verify2(o,h);var d=o.isub(h);return d.cmpn(0)<0&&d.iadd(this.m),d},q.prototype.shl=function(o,h){return this._verify1(o),this.imod(o.ushln(h))},q.prototype.imul=function(o,h){return this._verify2(o,h),this.imod(o.imul(h))},q.prototype.mul=function(o,h){return this._verify2(o,h),this.imod(o.mul(h))},q.prototype.isqr=function(o){return this.imul(o,o.clone())},q.prototype.sqr=function(o){return this.mul(o,o)},q.prototype.sqrt=function(o){if(o.isZero())return o.clone();var h=this.m.andln(3);if(r(h%2===1),h===3){var d=this.m.add(new i(1)).iushrn(2);return this.pow(o,d)}for(var v=this.m.subn(1),m=0;!v.isZero()&&v.andln(1)===0;)m++,v.iushrn(1);r(!v.isZero());var _=new i(1).toRed(this),E=_.redNeg(),b=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new i(2*f*f).toRed(this);this.pow(f,b).cmp(E)!==0;)f.redIAdd(E);for(var g=this.pow(f,v),A=this.pow(o,v.addn(1).iushrn(1)),R=this.pow(o,v),k=m;R.cmp(_)!==0;){for(var U=R,G=0;U.cmp(_)!==0;G++)U=U.redSqr();r(G=0;m--){for(var g=h.words[m],A=f-1;A>=0;A--){var R=g>>A&1;if(_!==v[0]&&(_=this.sqr(_)),R===0&&E===0){b=0;continue}E<<=1,E|=R,b++,!(b!==d&&(m!==0||A!==0))&&(_=this.mul(_,v[E]),b=0,E=0)}f=26}return _},q.prototype.convertTo=function(o){var h=o.umod(this.m);return h===o?h.clone():h},q.prototype.convertFrom=function(o){var h=o.clone();return h.red=null,h},i.mont=function(o){return new ee(o)};function ee(y){q.call(this,y),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}n(ee,q),ee.prototype.convertTo=function(o){return this.imod(o.ushln(this.shift))},ee.prototype.convertFrom=function(o){var h=this.imod(o.mul(this.rinv));return h.red=null,h},ee.prototype.imul=function(o,h){if(o.isZero()||h.isZero())return o.words[0]=0,o.length=1,o;var d=o.imul(h),v=d.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),m=d.isub(v).iushrn(this.shift),_=m;return m.cmp(this.m)>=0?_=m.isub(this.m):m.cmpn(0)<0&&(_=m.iadd(this.m)),_._forceRed(this)},ee.prototype.mul=function(o,h){if(o.isZero()||h.isZero())return new i(0)._forceRed(this);var d=o.mul(h),v=d.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),m=d.isub(v).iushrn(this.shift),_=m;return m.cmp(this.m)>=0?_=m.isub(this.m):m.cmpn(0)<0&&(_=m.iadd(this.m)),_._forceRed(this)},ee.prototype.invm=function(o){var h=this.imod(o._invmp(this.m).mul(this.r2));return h._forceRed(this)}})(typeof wc>"u"||wc,jd)});var ln=T((LB,Yd)=>{Yd.exports=Xd;function Xd(e,t){if(!e)throw new Error(t||"Assertion failed")}Xd.equal=function(t,r,n){if(t!=r)throw new Error(n||"Assertion failed: "+t+" != "+r)}});var _c=T(Qd=>{"use strict";var Fa=Qd;function o_(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if(typeof e!="string"){for(var n=0;n>8,a=i&255;s?r.push(s,a):r.push(a)}return r}Fa.toArray=o_;function Jd(e){return e.length===1?"0"+e:e}Fa.zero2=Jd;function Zd(e){for(var t="",r=0;r{"use strict";var ur=ep,a_=Er(),f_=ln(),Ka=_c();ur.assert=f_;ur.toArray=Ka.toArray;ur.zero2=Ka.zero2;ur.toHex=Ka.toHex;ur.encode=Ka.encode;function u_(e,t,r){var n=new Array(Math.max(e.bitLength(),r)+1);n.fill(0);for(var i=1<(i>>1)-1?u=(i>>1)-l:u=l,s.isubn(u)):u=0,n[a]=u,s.iushrn(1)}return n}ur.getNAF=u_;function c_(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var n=0,i=0,s;e.cmpn(-n)>0||t.cmpn(-i)>0;){var a=e.andln(3)+n&3,u=t.andln(3)+i&3;a===3&&(a=-1),u===3&&(u=-1);var l;(a&1)===0?l=0:(s=e.andln(7)+n&7,(s===3||s===5)&&u===2?l=-a:l=a),r[0].push(l);var c;(u&1)===0?c=0:(s=t.andln(7)+i&7,(s===3||s===5)&&a===2?c=-u:c=u),r[1].push(c),2*n===l+1&&(n=1-n),2*i===c+1&&(i=1-i),e.iushrn(1),t.iushrn(1)}return r}ur.getJSF=c_;function h_(e,t,r){var n="_"+t;e.prototype[t]=function(){return this[n]!==void 0?this[n]:this[n]=r.call(this)}}ur.cachedProperty=h_;function l_(e){return typeof e=="string"?ur.toArray(e,"hex"):e}ur.parseBytes=l_;function d_(e){return new a_(e,"hex","le")}ur.intFromLE=d_});var Ic=T((HB,Sc)=>{var Ec;Sc.exports=function(t){return Ec||(Ec=new dn(null)),Ec.generate(t)};function dn(e){this.rand=e}Sc.exports.Rand=dn;dn.prototype.generate=function(t){return this._rand(t)};dn.prototype._rand=function(t){if(this.rand.getBytes)return this.rand.getBytes(t);for(var r=new Uint8Array(t),n=0;n{"use strict";var hi=Er(),bo=Wt(),Ga=bo.getNAF,p_=bo.getJSF,Wa=bo.assert;function pn(e,t){this.type=e,this.p=new hi(t.p,16),this.red=t.prime?hi.red(t.prime):hi.mont(this.p),this.zero=new hi(0).toRed(this.red),this.one=new hi(1).toRed(this.red),this.two=new hi(2).toRed(this.red),this.n=t.n&&new hi(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}tp.exports=pn;pn.prototype.point=function(){throw new Error("Not implemented")};pn.prototype.validate=function(){throw new Error("Not implemented")};pn.prototype._fixedNafMul=function(t,r){Wa(t.precomputed);var n=t._getDoubles(),i=Ga(r,1,this._bitLength),s=(1<=u;c--)l=(l<<1)+i[c];a.push(l)}for(var p=this.jpoint(null,null,null),w=this.jpoint(null,null,null),x=s;x>0;x--){for(u=0;u=0;l--){for(var c=0;l>=0&&a[l]===0;l--)c++;if(l>=0&&c++,u=u.dblp(c),l<0)break;var p=a[l];Wa(p!==0),t.type==="affine"?p>0?u=u.mixedAdd(s[p-1>>1]):u=u.mixedAdd(s[-p-1>>1].neg()):p>0?u=u.add(s[p-1>>1]):u=u.add(s[-p-1>>1].neg())}return t.type==="affine"?u.toP():u};pn.prototype._wnafMulAdd=function(t,r,n,i,s){var a=this._wnafT1,u=this._wnafT2,l=this._wnafT3,c=0,p,w,x;for(p=0;p=1;p-=2){var M=p-1,O=p;if(a[M]!==1||a[O]!==1){l[M]=Ga(n[M],a[M],this._bitLength),l[O]=Ga(n[O],a[O],this._bitLength),c=Math.max(l[M].length,c),c=Math.max(l[O].length,c);continue}var P=[r[M],null,null,r[O]];r[M].y.cmp(r[O].y)===0?(P[1]=r[M].add(r[O]),P[2]=r[M].toJ().mixedAdd(r[O].neg())):r[M].y.cmp(r[O].y.redNeg())===0?(P[1]=r[M].toJ().mixedAdd(r[O]),P[2]=r[M].add(r[O].neg())):(P[1]=r[M].toJ().mixedAdd(r[O]),P[2]=r[M].toJ().mixedAdd(r[O].neg()));var B=[-3,-1,-5,-7,0,7,5,1,3],N=p_(n[M],n[O]);for(c=Math.max(N[0].length,c),l[M]=new Array(c),l[O]=new Array(c),w=0;w=0;p--){for(var X=0;p>=0;){var q=!0;for(w=0;w=0&&X++,W=W.dblp(X),p<0)break;for(w=0;w0?x=u[w][ee-1>>1]:ee<0&&(x=u[w][-ee-1>>1].neg()),x.type==="affine"?W=W.mixedAdd(x):W=W.add(x))}}for(p=0;p=Math.ceil((t.bitLength()+1)/r.step):!1};Zt.prototype._getDoubles=function(t,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,s=0;s{typeof Object.create=="function"?Tc.exports=function(t,r){r&&(t.super_=r,t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:Tc.exports=function(t,r){if(r){t.super_=r;var n=function(){};n.prototype=r.prototype,t.prototype=new n,t.prototype.constructor=t}}});var ht=T((GB,Ac)=>{try{if(Mc=require("util"),typeof Mc.inherits!="function")throw"";Ac.exports=Mc.inherits}catch{Ac.exports=rp()}var Mc});var ip=T((WB,np)=>{"use strict";var v_=Wt(),st=Er(),Oc=ht(),as=go(),b_=v_.assert;function Qt(e){as.call(this,"short",e),this.a=new st(e.a,16).toRed(this.red),this.b=new st(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}Oc(Qt,as);np.exports=Qt;Qt.prototype._getEndomorphism=function(t){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var r,n;if(t.beta)r=new st(t.beta,16).toRed(this.red);else{var i=this._getEndoRoots(this.p);r=i[0].cmp(i[1])<0?i[0]:i[1],r=r.toRed(this.red)}if(t.lambda)n=new st(t.lambda,16);else{var s=this._getEndoRoots(this.n);this.g.mul(s[0]).x.cmp(this.g.x.redMul(r))===0?n=s[0]:(n=s[1],b_(this.g.mul(n).x.cmp(this.g.x.redMul(r))===0))}var a;return t.basis?a=t.basis.map(function(u){return{a:new st(u.a,16),b:new st(u.b,16)}}):a=this._getEndoBasis(n),{beta:r,lambda:n,basis:a}}};Qt.prototype._getEndoRoots=function(t){var r=t===this.p?this.red:st.mont(t),n=new st(2).toRed(r).redInvm(),i=n.redNeg(),s=new st(3).toRed(r).redNeg().redSqrt().redMul(n),a=i.redAdd(s).fromRed(),u=i.redSub(s).fromRed();return[a,u]};Qt.prototype._getEndoBasis=function(t){for(var r=this.n.ushrn(Math.floor(this.n.bitLength()/2)),n=t,i=this.n.clone(),s=new st(1),a=new st(0),u=new st(0),l=new st(1),c,p,w,x,S,M,O,P=0,B,N;n.cmpn(0)!==0;){var L=i.div(n);B=i.sub(L.mul(n)),N=u.sub(L.mul(s));var H=l.sub(L.mul(a));if(!w&&B.cmp(r)<0)c=O.neg(),p=s,w=B.neg(),x=N;else if(w&&++P===2)break;O=B,i=n,n=B,u=s,s=N,l=a,a=H}S=B.neg(),M=N;var W=w.sqr().add(x.sqr()),K=S.sqr().add(M.sqr());return K.cmp(W)>=0&&(S=c,M=p),w.negative&&(w=w.neg(),x=x.neg()),S.negative&&(S=S.neg(),M=M.neg()),[{a:w,b:x},{a:S,b:M}]};Qt.prototype._endoSplit=function(t){var r=this.endo.basis,n=r[0],i=r[1],s=i.b.mul(t).divRound(this.n),a=n.b.neg().mul(t).divRound(this.n),u=s.mul(n.a),l=a.mul(i.a),c=s.mul(n.b),p=a.mul(i.b),w=t.sub(u).sub(l),x=c.add(p).neg();return{k1:w,k2:x}};Qt.prototype.pointFromX=function(t,r){t=new st(t,16),t.red||(t=t.toRed(this.red));var n=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(r&&!s||!r&&s)&&(i=i.redNeg()),this.point(t,i)};Qt.prototype.validate=function(t){if(t.inf)return!0;var r=t.x,n=t.y,i=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0};Qt.prototype._endoWnafMulAdd=function(t,r,n){for(var i=this._endoWnafT1,s=this._endoWnafT2,a=0;a":""};lt.prototype.isInfinity=function(){return this.inf};lt.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(this.x.cmp(t.x)===0)return this.curve.point(null,null);var r=this.y.redSub(t.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(t.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(t.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)};lt.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(t.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=t.redInvm(),s=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),a=s.redSqr().redISub(this.x.redAdd(this.x)),u=s.redMul(this.x.redSub(a)).redISub(this.y);return this.curve.point(a,u)};lt.prototype.getX=function(){return this.x.fromRed()};lt.prototype.getY=function(){return this.y.fromRed()};lt.prototype.mul=function(t){return t=new st(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)};lt.prototype.mulAdd=function(t,r,n){var i=[this,r],s=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)};lt.prototype.jmulAdd=function(t,r,n){var i=[this,r],s=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)};lt.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||this.x.cmp(t.x)===0&&this.y.cmp(t.y)===0)};lt.prototype.neg=function(t){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var n=this.precomputed,i=function(s){return s.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r};lt.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var t=this.curve.jpoint(this.x,this.y,this.curve.one);return t};function yt(e,t,r,n){as.BasePoint.call(this,e,"jacobian"),t===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new st(0)):(this.x=new st(t,16),this.y=new st(r,16),this.z=new st(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Oc(yt,as.BasePoint);Qt.prototype.jpoint=function(t,r,n){return new yt(this,t,r,n)};yt.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),r=t.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(t);return this.curve.point(n,i)};yt.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};yt.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var r=t.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),s=t.x.redMul(n),a=this.y.redMul(r.redMul(t.z)),u=t.y.redMul(n.redMul(this.z)),l=i.redSub(s),c=a.redSub(u);if(l.cmpn(0)===0)return c.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var p=l.redSqr(),w=p.redMul(l),x=i.redMul(p),S=c.redSqr().redIAdd(w).redISub(x).redISub(x),M=c.redMul(x.redISub(S)).redISub(a.redMul(w)),O=this.z.redMul(t.z).redMul(l);return this.curve.jpoint(S,M,O)};yt.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=t.x.redMul(r),s=this.y,a=t.y.redMul(r).redMul(this.z),u=n.redSub(i),l=s.redSub(a);if(u.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var c=u.redSqr(),p=c.redMul(u),w=n.redMul(c),x=l.redSqr().redIAdd(p).redISub(w).redISub(w),S=l.redMul(w.redISub(x)).redISub(s.redMul(p)),M=this.z.redMul(u);return this.curve.jpoint(x,S,M)};yt.prototype.dblp=function(t){if(t===0)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r=0)return!1;if(n.redIAdd(s),this.x.cmp(n)===0)return!0}};yt.prototype.inspect=function(){return this.isInfinity()?"":""};yt.prototype.isInfinity=function(){return this.z.cmpn(0)===0}});var ap=T((VB,op)=>{"use strict";var fs=Er(),sp=ht(),Va=go(),g_=Wt();function us(e){Va.call(this,"mont",e),this.a=new fs(e.a,16).toRed(this.red),this.b=new fs(e.b,16).toRed(this.red),this.i4=new fs(4).toRed(this.red).redInvm(),this.two=new fs(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}sp(us,Va);op.exports=us;us.prototype.validate=function(t){var r=t.normalize().x,n=r.redSqr(),i=n.redMul(r).redAdd(n.redMul(this.a)).redAdd(r),s=i.redSqrt();return s.redSqr().cmp(i)===0};function dt(e,t,r){Va.BasePoint.call(this,e,"projective"),t===null&&r===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new fs(t,16),this.z=new fs(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}sp(dt,Va.BasePoint);us.prototype.decodePoint=function(t,r){return this.point(g_.toArray(t,r),1)};us.prototype.point=function(t,r){return new dt(this,t,r)};us.prototype.pointFromJSON=function(t){return dt.fromJSON(this,t)};dt.prototype.precompute=function(){};dt.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())};dt.fromJSON=function(t,r){return new dt(t,r[0],r[1]||t.one)};dt.prototype.inspect=function(){return this.isInfinity()?"":""};dt.prototype.isInfinity=function(){return this.z.cmpn(0)===0};dt.prototype.dbl=function(){var t=this.x.redAdd(this.z),r=t.redSqr(),n=this.x.redSub(this.z),i=n.redSqr(),s=r.redSub(i),a=r.redMul(i),u=s.redMul(i.redAdd(this.curve.a24.redMul(s)));return this.curve.point(a,u)};dt.prototype.add=function(){throw new Error("Not supported on Montgomery curve")};dt.prototype.diffAdd=function(t,r){var n=this.x.redAdd(this.z),i=this.x.redSub(this.z),s=t.x.redAdd(t.z),a=t.x.redSub(t.z),u=a.redMul(n),l=s.redMul(i),c=r.z.redMul(u.redAdd(l).redSqr()),p=r.x.redMul(u.redISub(l).redSqr());return this.curve.point(c,p)};dt.prototype.mul=function(t){for(var r=t.clone(),n=this,i=this.curve.point(null,null),s=this,a=[];r.cmpn(0)!==0;r.iushrn(1))a.push(r.andln(1));for(var u=a.length-1;u>=0;u--)a[u]===0?(n=n.diffAdd(i,s),i=i.dbl()):(i=n.diffAdd(i,s),n=n.dbl());return i};dt.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")};dt.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")};dt.prototype.eq=function(t){return this.getX().cmp(t.getX())===0};dt.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this};dt.prototype.getX=function(){return this.normalize(),this.x.fromRed()}});var cp=T((zB,up)=>{"use strict";var m_=Wt(),Fr=Er(),fp=ht(),za=go(),y_=m_.assert;function xr(e){this.twisted=(e.a|0)!==1,this.mOneA=this.twisted&&(e.a|0)===-1,this.extended=this.mOneA,za.call(this,"edwards",e),this.a=new Fr(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new Fr(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new Fr(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),y_(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(e.c|0)===1}fp(xr,za);up.exports=xr;xr.prototype._mulA=function(t){return this.mOneA?t.redNeg():this.a.redMul(t)};xr.prototype._mulC=function(t){return this.oneC?t:this.c.redMul(t)};xr.prototype.jpoint=function(t,r,n,i){return this.point(t,r,n,i)};xr.prototype.pointFromX=function(t,r){t=new Fr(t,16),t.red||(t=t.toRed(this.red));var n=t.redSqr(),i=this.c2.redSub(this.a.redMul(n)),s=this.one.redSub(this.c2.redMul(this.d).redMul(n)),a=i.redMul(s.redInvm()),u=a.redSqrt();if(u.redSqr().redSub(a).cmp(this.zero)!==0)throw new Error("invalid point");var l=u.fromRed().isOdd();return(r&&!l||!r&&l)&&(u=u.redNeg()),this.point(t,u)};xr.prototype.pointFromY=function(t,r){t=new Fr(t,16),t.red||(t=t.toRed(this.red));var n=t.redSqr(),i=n.redSub(this.c2),s=n.redMul(this.d).redMul(this.c2).redSub(this.a),a=i.redMul(s.redInvm());if(a.cmp(this.zero)===0){if(r)throw new Error("invalid point");return this.point(this.zero,t)}var u=a.redSqrt();if(u.redSqr().redSub(a).cmp(this.zero)!==0)throw new Error("invalid point");return u.fromRed().isOdd()!==r&&(u=u.redNeg()),this.point(u,t)};xr.prototype.validate=function(t){if(t.isInfinity())return!0;t.normalize();var r=t.x.redSqr(),n=t.y.redSqr(),i=r.redMul(this.a).redAdd(n),s=this.c2.redMul(this.one.redAdd(this.d.redMul(r).redMul(n)));return i.cmp(s)===0};function Xe(e,t,r,n,i){za.BasePoint.call(this,e,"projective"),t===null&&r===null&&n===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new Fr(t,16),this.y=new Fr(r,16),this.z=n?new Fr(n,16):this.curve.one,this.t=i&&new Fr(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}fp(Xe,za.BasePoint);xr.prototype.pointFromJSON=function(t){return Xe.fromJSON(this,t)};xr.prototype.point=function(t,r,n,i){return new Xe(this,t,r,n,i)};Xe.fromJSON=function(t,r){return new Xe(t,r[0],r[1],r[2])};Xe.prototype.inspect=function(){return this.isInfinity()?"":""};Xe.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)};Xe.prototype._extDbl=function(){var t=this.x.redSqr(),r=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var i=this.curve._mulA(t),s=this.x.redAdd(this.y).redSqr().redISub(t).redISub(r),a=i.redAdd(r),u=a.redSub(n),l=i.redSub(r),c=s.redMul(u),p=a.redMul(l),w=s.redMul(l),x=u.redMul(a);return this.curve.point(c,p,x,w)};Xe.prototype._projDbl=function(){var t=this.x.redAdd(this.y).redSqr(),r=this.x.redSqr(),n=this.y.redSqr(),i,s,a,u,l,c;if(this.curve.twisted){u=this.curve._mulA(r);var p=u.redAdd(n);this.zOne?(i=t.redSub(r).redSub(n).redMul(p.redSub(this.curve.two)),s=p.redMul(u.redSub(n)),a=p.redSqr().redSub(p).redSub(p)):(l=this.z.redSqr(),c=p.redSub(l).redISub(l),i=t.redSub(r).redISub(n).redMul(c),s=p.redMul(u.redSub(n)),a=p.redMul(c))}else u=r.redAdd(n),l=this.curve._mulC(this.z).redSqr(),c=u.redSub(l).redSub(l),i=this.curve._mulC(t.redISub(u)).redMul(c),s=this.curve._mulC(u).redMul(r.redISub(n)),a=u.redMul(c);return this.curve.point(i,s,a)};Xe.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()};Xe.prototype._extAdd=function(t){var r=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),n=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),i=this.t.redMul(this.curve.dd).redMul(t.t),s=this.z.redMul(t.z.redAdd(t.z)),a=n.redSub(r),u=s.redSub(i),l=s.redAdd(i),c=n.redAdd(r),p=a.redMul(u),w=l.redMul(c),x=a.redMul(c),S=u.redMul(l);return this.curve.point(p,w,S,x)};Xe.prototype._projAdd=function(t){var r=this.z.redMul(t.z),n=r.redSqr(),i=this.x.redMul(t.x),s=this.y.redMul(t.y),a=this.curve.d.redMul(i).redMul(s),u=n.redSub(a),l=n.redAdd(a),c=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(i).redISub(s),p=r.redMul(u).redMul(c),w,x;return this.curve.twisted?(w=r.redMul(l).redMul(s.redSub(this.curve._mulA(i))),x=u.redMul(l)):(w=r.redMul(l).redMul(s.redSub(i)),x=this.curve._mulC(u).redMul(l)),this.curve.point(p,w,x)};Xe.prototype.add=function(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)};Xe.prototype.mul=function(t){return this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)};Xe.prototype.mulAdd=function(t,r,n){return this.curve._wnafMulAdd(1,[this,r],[t,n],2,!1)};Xe.prototype.jmulAdd=function(t,r,n){return this.curve._wnafMulAdd(1,[this,r],[t,n],2,!0)};Xe.prototype.normalize=function(){if(this.zOne)return this;var t=this.z.redInvm();return this.x=this.x.redMul(t),this.y=this.y.redMul(t),this.t&&(this.t=this.t.redMul(t)),this.z=this.curve.one,this.zOne=!0,this};Xe.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())};Xe.prototype.getX=function(){return this.normalize(),this.x.fromRed()};Xe.prototype.getY=function(){return this.normalize(),this.y.fromRed()};Xe.prototype.eq=function(t){return this===t||this.getX().cmp(t.getX())===0&&this.getY().cmp(t.getY())===0};Xe.prototype.eqXToP=function(t){var r=t.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(r)===0)return!0;for(var n=t.clone(),i=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),this.x.cmp(r)===0)return!0}};Xe.prototype.toP=Xe.prototype.normalize;Xe.prototype.mixedAdd=Xe.prototype.add});var Pc=T(hp=>{"use strict";var $a=hp;$a.base=go();$a.short=ip();$a.mont=ap();$a.edwards=cp()});var cr=T(Ve=>{"use strict";var w_=ln(),__=ht();Ve.inherits=__;function E_(e,t){return(e.charCodeAt(t)&64512)!==55296||t<0||t+1>=e.length?!1:(e.charCodeAt(t+1)&64512)===56320}function x_(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if(typeof e=="string")if(t){if(t==="hex")for(e=e.replace(/[^a-z0-9]+/ig,""),e.length%2!==0&&(e="0"+e),i=0;i>6|192,r[n++]=s&63|128):E_(e,i)?(s=65536+((s&1023)<<10)+(e.charCodeAt(++i)&1023),r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=s&63|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=s&63|128)}else for(i=0;i>>24|e>>>8&65280|e<<8&16711680|(e&255)<<24;return t>>>0}Ve.htonl=lp;function I_(e,t){for(var r="",n=0;n>>0}return s}Ve.join32=T_;function M_(e,t){for(var r=new Array(e.length*4),n=0,i=0;n>>24,r[i+1]=s>>>16&255,r[i+2]=s>>>8&255,r[i+3]=s&255):(r[i+3]=s>>>24,r[i+2]=s>>>16&255,r[i+1]=s>>>8&255,r[i]=s&255)}return r}Ve.split32=M_;function A_(e,t){return e>>>t|e<<32-t}Ve.rotr32=A_;function O_(e,t){return e<>>32-t}Ve.rotl32=O_;function P_(e,t){return e+t>>>0}Ve.sum32=P_;function B_(e,t,r){return e+t+r>>>0}Ve.sum32_3=B_;function R_(e,t,r,n){return e+t+r+n>>>0}Ve.sum32_4=R_;function k_(e,t,r,n,i){return e+t+r+n+i>>>0}Ve.sum32_5=k_;function N_(e,t,r,n){var i=e[t],s=e[t+1],a=n+s>>>0,u=(a>>0,e[t+1]=a}Ve.sum64=N_;function C_(e,t,r,n){var i=t+n>>>0,s=(i>>0}Ve.sum64_hi=C_;function q_(e,t,r,n){var i=t+n;return i>>>0}Ve.sum64_lo=q_;function L_(e,t,r,n,i,s,a,u){var l=0,c=t;c=c+n>>>0,l+=c>>0,l+=c>>0,l+=c>>0}Ve.sum64_4_hi=L_;function U_(e,t,r,n,i,s,a,u){var l=t+n+s+u;return l>>>0}Ve.sum64_4_lo=U_;function D_(e,t,r,n,i,s,a,u,l,c){var p=0,w=t;w=w+n>>>0,p+=w>>0,p+=w>>0,p+=w>>0,p+=w>>0}Ve.sum64_5_hi=D_;function H_(e,t,r,n,i,s,a,u,l,c){var p=t+n+s+u+c;return p>>>0}Ve.sum64_5_lo=H_;function F_(e,t,r){var n=t<<32-r|e>>>r;return n>>>0}Ve.rotr64_hi=F_;function K_(e,t,r){var n=e<<32-r|t>>>r;return n>>>0}Ve.rotr64_lo=K_;function G_(e,t,r){return e>>>r}Ve.shr64_hi=G_;function W_(e,t,r){var n=e<<32-r|t>>>r;return n>>>0}Ve.shr64_lo=W_});var cs=T(bp=>{"use strict";var vp=cr(),V_=ln();function ja(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}bp.BlockHash=ja;ja.prototype.update=function(t,r){if(t=vp.toArray(t,r),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){t=this.pending;var n=t.length%this._delta8;this.pending=t.slice(t.length-n,t.length),this.pending.length===0&&(this.pending=null),t=vp.join32(t,0,t.length-n,this.endian);for(var i=0;i>>24&255,i[s++]=t>>>16&255,i[s++]=t>>>8&255,i[s++]=t&255}else for(i[s++]=t&255,i[s++]=t>>>8&255,i[s++]=t>>>16&255,i[s++]=t>>>24&255,i[s++]=0,i[s++]=0,i[s++]=0,i[s++]=0,a=8;a{"use strict";var z_=cr(),Sr=z_.rotr32;function $_(e,t,r,n){if(e===0)return gp(t,r,n);if(e===1||e===3)return yp(t,r,n);if(e===2)return mp(t,r,n)}Kr.ft_1=$_;function gp(e,t,r){return e&t^~e&r}Kr.ch32=gp;function mp(e,t,r){return e&t^e&r^t&r}Kr.maj32=mp;function yp(e,t,r){return e^t^r}Kr.p32=yp;function j_(e){return Sr(e,2)^Sr(e,13)^Sr(e,22)}Kr.s0_256=j_;function X_(e){return Sr(e,6)^Sr(e,11)^Sr(e,25)}Kr.s1_256=X_;function Y_(e){return Sr(e,7)^Sr(e,18)^e>>>3}Kr.g0_256=Y_;function J_(e){return Sr(e,17)^Sr(e,19)^e>>>10}Kr.g1_256=J_});var Ep=T((JB,_p)=>{"use strict";var hs=cr(),Z_=cs(),Q_=Bc(),Rc=hs.rotl32,mo=hs.sum32,e4=hs.sum32_5,t4=Q_.ft_1,wp=Z_.BlockHash,r4=[1518500249,1859775393,2400959708,3395469782];function Ir(){if(!(this instanceof Ir))return new Ir;wp.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}hs.inherits(Ir,wp);_p.exports=Ir;Ir.blockSize=512;Ir.outSize=160;Ir.hmacStrength=80;Ir.padLength=64;Ir.prototype._update=function(t,r){for(var n=this.W,i=0;i<16;i++)n[i]=t[r+i];for(;i{"use strict";var ls=cr(),n4=cs(),ds=Bc(),i4=ln(),hr=ls.sum32,s4=ls.sum32_4,o4=ls.sum32_5,a4=ds.ch32,f4=ds.maj32,u4=ds.s0_256,c4=ds.s1_256,h4=ds.g0_256,l4=ds.g1_256,xp=n4.BlockHash,d4=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function Tr(){if(!(this instanceof Tr))return new Tr;xp.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=d4,this.W=new Array(64)}ls.inherits(Tr,xp);Sp.exports=Tr;Tr.blockSize=512;Tr.outSize=256;Tr.hmacStrength=192;Tr.padLength=64;Tr.prototype._update=function(t,r){for(var n=this.W,i=0;i<16;i++)n[i]=t[r+i];for(;i{"use strict";var Nc=cr(),Ip=kc();function Gr(){if(!(this instanceof Gr))return new Gr;Ip.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}Nc.inherits(Gr,Ip);Tp.exports=Gr;Gr.blockSize=512;Gr.outSize=224;Gr.hmacStrength=192;Gr.padLength=64;Gr.prototype._digest=function(t){return t==="hex"?Nc.toHex32(this.h.slice(0,7),"big"):Nc.split32(this.h.slice(0,7),"big")}});var Lc=T((eR,Bp)=>{"use strict";var Lt=cr(),p4=cs(),v4=ln(),Mr=Lt.rotr64_hi,Ar=Lt.rotr64_lo,Ap=Lt.shr64_hi,Op=Lt.shr64_lo,vn=Lt.sum64,Cc=Lt.sum64_hi,qc=Lt.sum64_lo,b4=Lt.sum64_4_hi,g4=Lt.sum64_4_lo,m4=Lt.sum64_5_hi,y4=Lt.sum64_5_lo,Pp=p4.BlockHash,w4=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function lr(){if(!(this instanceof lr))return new lr;Pp.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=w4,this.W=new Array(160)}Lt.inherits(lr,Pp);Bp.exports=lr;lr.blockSize=1024;lr.outSize=512;lr.hmacStrength=192;lr.padLength=128;lr.prototype._prepareBlock=function(t,r){for(var n=this.W,i=0;i<32;i++)n[i]=t[r+i];for(;i{"use strict";var Uc=cr(),Rp=Lc();function Wr(){if(!(this instanceof Wr))return new Wr;Rp.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}Uc.inherits(Wr,Rp);kp.exports=Wr;Wr.blockSize=1024;Wr.outSize=384;Wr.hmacStrength=192;Wr.padLength=128;Wr.prototype._digest=function(t){return t==="hex"?Uc.toHex32(this.h.slice(0,12),"big"):Uc.split32(this.h.slice(0,12),"big")}});var Cp=T(ps=>{"use strict";ps.sha1=Ep();ps.sha224=Mp();ps.sha256=kc();ps.sha384=Np();ps.sha512=Lc()});var Fp=T(Hp=>{"use strict";var li=cr(),k4=cs(),Xa=li.rotl32,qp=li.sum32,yo=li.sum32_3,Lp=li.sum32_4,Dp=k4.BlockHash;function Or(){if(!(this instanceof Or))return new Or;Dp.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}li.inherits(Or,Dp);Hp.ripemd160=Or;Or.blockSize=512;Or.outSize=160;Or.hmacStrength=192;Or.padLength=64;Or.prototype._update=function(t,r){for(var n=this.h[0],i=this.h[1],s=this.h[2],a=this.h[3],u=this.h[4],l=n,c=i,p=s,w=a,x=u,S=0;S<80;S++){var M=qp(Xa(Lp(n,Up(S,i,s,a),t[q4[S]+r],N4(S)),U4[S]),u);n=u,u=a,a=Xa(s,10),s=i,i=M,M=qp(Xa(Lp(l,Up(79-S,c,p,w),t[L4[S]+r],C4(S)),D4[S]),x),l=x,x=w,w=Xa(p,10),p=c,c=M}M=yo(this.h[1],s,w),this.h[1]=yo(this.h[2],a,x),this.h[2]=yo(this.h[3],u,l),this.h[3]=yo(this.h[4],n,c),this.h[4]=yo(this.h[0],i,p),this.h[0]=M};Or.prototype._digest=function(t){return t==="hex"?li.toHex32(this.h,"little"):li.split32(this.h,"little")};function Up(e,t,r,n){return e<=15?t^r^n:e<=31?t&r|~t&n:e<=47?(t|~r)^n:e<=63?t&n|r&~n:t^(r|~n)}function N4(e){return e<=15?0:e<=31?1518500249:e<=47?1859775393:e<=63?2400959708:2840853838}function C4(e){return e<=15?1352829926:e<=31?1548603684:e<=47?1836072691:e<=63?2053994217:0}var q4=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],L4=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],U4=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],D4=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]});var Gp=T((iR,Kp)=>{"use strict";var H4=cr(),F4=ln();function vs(e,t,r){if(!(this instanceof vs))return new vs(e,t,r);this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(H4.toArray(t,r))}Kp.exports=vs;vs.prototype._init=function(t){t.length>this.blockSize&&(t=new this.Hash().update(t).digest()),F4(t.length<=this.blockSize);for(var r=t.length;r{var wt=Wp;wt.utils=cr();wt.common=cs();wt.sha=Cp();wt.ripemd=Fp();wt.hmac=Gp();wt.sha1=wt.sha.sha1;wt.sha256=wt.sha.sha256;wt.sha224=wt.sha.sha224;wt.sha384=wt.sha.sha384;wt.sha512=wt.sha.sha512;wt.ripemd160=wt.ripemd.ripemd160});var zp=T((oR,Vp)=>{Vp.exports={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}});var Ja=T(Xp=>{"use strict";var Hc=Xp,bn=Ya(),Dc=Pc(),K4=Wt(),$p=K4.assert;function jp(e){e.type==="short"?this.curve=new Dc.short(e):e.type==="edwards"?this.curve=new Dc.edwards(e):this.curve=new Dc.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,$p(this.g.validate(),"Invalid curve"),$p(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}Hc.PresetCurve=jp;function gn(e,t){Object.defineProperty(Hc,e,{configurable:!0,enumerable:!0,get:function(){var r=new jp(t);return Object.defineProperty(Hc,e,{configurable:!0,enumerable:!0,value:r}),r}})}gn("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:bn.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]});gn("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:bn.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]});gn("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:bn.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]});gn("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:bn.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]});gn("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:bn.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]});gn("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:bn.sha256,gRed:!1,g:["9"]});gn("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:bn.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var Fc;try{Fc=zp()}catch{Fc=void 0}gn("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:bn.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",Fc]})});var Zp=T((fR,Jp)=>{"use strict";var G4=Ya(),di=_c(),Yp=ln();function mn(e){if(!(this instanceof mn))return new mn(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=di.toArray(e.entropy,e.entropyEnc||"hex"),r=di.toArray(e.nonce,e.nonceEnc||"hex"),n=di.toArray(e.pers,e.persEnc||"hex");Yp(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}Jp.exports=mn;mn.prototype._init=function(t,r,n){var i=t.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(n||[])),this._reseed=1};mn.prototype.generate=function(t,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=di.toArray(n,i||"hex"),this._update(n));for(var s=[];s.length{"use strict";var W4=Er(),V4=Wt(),Kc=V4.assert;function Mt(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}Qp.exports=Mt;Mt.fromPublic=function(t,r,n){return r instanceof Mt?r:new Mt(t,{pub:r,pubEnc:n})};Mt.fromPrivate=function(t,r,n){return r instanceof Mt?r:new Mt(t,{priv:r,privEnc:n})};Mt.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}};Mt.prototype.getPublic=function(t,r){return typeof t=="string"&&(r=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),r?this.pub.encode(r,t):this.pub};Mt.prototype.getPrivate=function(t){return t==="hex"?this.priv.toString(16,2):this.priv};Mt.prototype._importPrivate=function(t,r){this.priv=new W4(t,r||16),this.priv=this.priv.umod(this.ec.curve.n)};Mt.prototype._importPublic=function(t,r){if(t.x||t.y){this.ec.curve.type==="mont"?Kc(t.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&Kc(t.x&&t.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(t.x,t.y);return}this.pub=this.ec.curve.decodePoint(t,r)};Mt.prototype.derive=function(t){return t.validate()||Kc(t.validate(),"public point not validated"),t.mul(this.priv).getX()};Mt.prototype.sign=function(t,r,n){return this.ec.sign(t,this,r,n)};Mt.prototype.verify=function(t,r){return this.ec.verify(t,r,this)};Mt.prototype.inspect=function(){return""}});var n1=T((cR,r1)=>{"use strict";var Za=Er(),Vc=Wt(),z4=Vc.assert;function Qa(e,t){if(e instanceof Qa)return e;this._importDER(e,t)||(z4(e.r&&e.s,"Signature without r or s"),this.r=new Za(e.r,16),this.s=new Za(e.s,16),e.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}r1.exports=Qa;function $4(){this.place=0}function Gc(e,t){var r=e[t.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4)return!1;for(var i=0,s=0,a=t.place;s>>=0;return i<=127?!1:(t.place=a,i)}function t1(e){for(var t=0,r=e.length-1;!e[t]&&!(e[t+1]&128)&&t>>3);for(e.push(r|128);--r;)e.push(t>>>(r<<3)&255);e.push(t)}Qa.prototype.toDER=function(t){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=t1(r),n=t1(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];Wc(i,r.length),i=i.concat(r),i.push(2),Wc(i,n.length);var s=i.concat(n),a=[48];return Wc(a,s.length),a=a.concat(s),Vc.encode(a,t)}});var a1=T((hR,o1)=>{"use strict";var pi=Er(),i1=Zp(),j4=Wt(),zc=Ja(),X4=Ic(),s1=j4.assert,$c=e1(),ef=n1();function er(e){if(!(this instanceof er))return new er(e);typeof e=="string"&&(s1(Object.prototype.hasOwnProperty.call(zc,e),"Unknown curve "+e),e=zc[e]),e instanceof zc.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}o1.exports=er;er.prototype.keyPair=function(t){return new $c(this,t)};er.prototype.keyFromPrivate=function(t,r){return $c.fromPrivate(this,t,r)};er.prototype.keyFromPublic=function(t,r){return $c.fromPublic(this,t,r)};er.prototype.genKeyPair=function(t){t||(t={});for(var r=new i1({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||X4(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new pi(2));;){var s=new pi(r.generate(n));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}};er.prototype._truncateToN=function(t,r){var n=t.byteLength()*8-this.n.bitLength();return n>0&&(t=t.ushrn(n)),!r&&t.cmp(this.n)>=0?t.sub(this.n):t};er.prototype.sign=function(t,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),t=this._truncateToN(new pi(t,16));for(var s=this.n.byteLength(),a=r.getPrivate().toArray("be",s),u=t.toArray("be",s),l=new i1({hash:this.hash,entropy:a,nonce:u,pers:i.pers,persEnc:i.persEnc||"utf8"}),c=this.n.sub(new pi(1)),p=0;;p++){var w=i.k?i.k(p):new pi(l.generate(this.n.byteLength()));if(w=this._truncateToN(w,!0),!(w.cmpn(1)<=0||w.cmp(c)>=0)){var x=this.g.mul(w);if(!x.isInfinity()){var S=x.getX(),M=S.umod(this.n);if(M.cmpn(0)!==0){var O=w.invm(this.n).mul(M.mul(r.getPrivate()).iadd(t));if(O=O.umod(this.n),O.cmpn(0)!==0){var P=(x.getY().isOdd()?1:0)|(S.cmp(M)!==0?2:0);return i.canonical&&O.cmp(this.nh)>0&&(O=this.n.sub(O),P^=1),new ef({r:M,s:O,recoveryParam:P})}}}}}};er.prototype.verify=function(t,r,n,i){t=this._truncateToN(new pi(t,16)),n=this.keyFromPublic(n,i),r=new ef(r,"hex");var s=r.r,a=r.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0||a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var u=a.invm(this.n),l=u.mul(t).umod(this.n),c=u.mul(s).umod(this.n),p;return this.curve._maxwellTrick?(p=this.g.jmulAdd(l,n.getPublic(),c),p.isInfinity()?!1:p.eqXToP(s)):(p=this.g.mulAdd(l,n.getPublic(),c),p.isInfinity()?!1:p.getX().umod(this.n).cmp(s)===0)};er.prototype.recoverPubKey=function(e,t,r,n){s1((3&r)===r,"The recovery param is more than two bits"),t=new ef(t,n);var i=this.n,s=new pi(e),a=t.r,u=t.s,l=r&1,c=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&c)throw new Error("Unable to find sencond key candinate");c?a=this.curve.pointFromX(a.add(this.curve.n),l):a=this.curve.pointFromX(a,l);var p=t.r.invm(i),w=i.sub(s).mul(p).umod(i),x=u.mul(p).umod(i);return this.g.mulAdd(w,a,x)};er.prototype.getKeyRecoveryParam=function(e,t,r,n){if(t=new ef(t,n),t.recoveryParam!==null)return t.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(e,t,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")}});var h1=T((lR,c1)=>{"use strict";var wo=Wt(),u1=wo.assert,f1=wo.parseBytes,bs=wo.cachedProperty;function pt(e,t){this.eddsa=e,this._secret=f1(t.secret),e.isPoint(t.pub)?this._pub=t.pub:this._pubBytes=f1(t.pub)}pt.fromPublic=function(t,r){return r instanceof pt?r:new pt(t,{pub:r})};pt.fromSecret=function(t,r){return r instanceof pt?r:new pt(t,{secret:r})};pt.prototype.secret=function(){return this._secret};bs(pt,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())});bs(pt,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())});bs(pt,"privBytes",function(){var t=this.eddsa,r=this.hash(),n=t.encodingLength-1,i=r.slice(0,t.encodingLength);return i[0]&=248,i[n]&=127,i[n]|=64,i});bs(pt,"priv",function(){return this.eddsa.decodeInt(this.privBytes())});bs(pt,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()});bs(pt,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)});pt.prototype.sign=function(t){return u1(this._secret,"KeyPair can only verify"),this.eddsa.sign(t,this)};pt.prototype.verify=function(t,r){return this.eddsa.verify(t,r,this)};pt.prototype.getSecret=function(t){return u1(this._secret,"KeyPair is public only"),wo.encode(this.secret(),t)};pt.prototype.getPublic=function(t){return wo.encode(this.pubBytes(),t)};c1.exports=pt});var d1=T((dR,l1)=>{"use strict";var Y4=Er(),tf=Wt(),J4=tf.assert,rf=tf.cachedProperty,Z4=tf.parseBytes;function vi(e,t){this.eddsa=e,typeof t!="object"&&(t=Z4(t)),Array.isArray(t)&&(t={R:t.slice(0,e.encodingLength),S:t.slice(e.encodingLength)}),J4(t.R&&t.S,"Signature without R or S"),e.isPoint(t.R)&&(this._R=t.R),t.S instanceof Y4&&(this._S=t.S),this._Rencoded=Array.isArray(t.R)?t.R:t.Rencoded,this._Sencoded=Array.isArray(t.S)?t.S:t.Sencoded}rf(vi,"S",function(){return this.eddsa.decodeInt(this.Sencoded())});rf(vi,"R",function(){return this.eddsa.decodePoint(this.Rencoded())});rf(vi,"Rencoded",function(){return this.eddsa.encodePoint(this.R())});rf(vi,"Sencoded",function(){return this.eddsa.encodeInt(this.S())});vi.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())};vi.prototype.toHex=function(){return tf.encode(this.toBytes(),"hex").toUpperCase()};l1.exports=vi});var m1=T((pR,g1)=>{"use strict";var Q4=Ya(),eE=Ja(),gs=Wt(),tE=gs.assert,v1=gs.parseBytes,b1=h1(),p1=d1();function Ut(e){if(tE(e==="ed25519","only tested with ed25519 so far"),!(this instanceof Ut))return new Ut(e);e=eE[e].curve,this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=Q4.sha512}g1.exports=Ut;Ut.prototype.sign=function(t,r){t=v1(t);var n=this.keyFromSecret(r),i=this.hashInt(n.messagePrefix(),t),s=this.g.mul(i),a=this.encodePoint(s),u=this.hashInt(a,n.pubBytes(),t).mul(n.priv()),l=i.add(u).umod(this.curve.n);return this.makeSignature({R:s,S:l,Rencoded:a})};Ut.prototype.verify=function(t,r,n){t=v1(t),r=this.makeSignature(r);var i=this.keyFromPublic(n),s=this.hashInt(r.Rencoded(),i.pubBytes(),t),a=this.g.mul(r.S()),u=r.R().add(i.pub().mul(s));return u.eq(a)};Ut.prototype.hashInt=function(){for(var t=this.hash(),r=0;r{"use strict";var bi=y1;bi.version=$d().version;bi.utils=Wt();bi.rand=Ic();bi.curve=Pc();bi.curves=Ja();bi.ec=a1();bi.eddsa=m1()});var x1=T((bR,E1)=>{var yn=dc(),rE=Buffer.alloc(1,1),_1=Buffer.alloc(1,0);function nE(e,t,r,n,i){let s=Buffer.alloc(32,0),a=Buffer.alloc(32,1);s=yn("sha256",s).update(a).update(_1).update(t).update(e).update(i||"").digest(),a=yn("sha256",s).update(a).digest(),s=yn("sha256",s).update(a).update(rE).update(t).update(e).update(i||"").digest(),a=yn("sha256",s).update(a).digest(),a=yn("sha256",s).update(a).digest();let u=a;for(;!n(u)||!r(u);)s=yn("sha256",s).update(a).update(_1).digest(),a=yn("sha256",s).update(a).digest(),a=yn("sha256",s).update(a).digest(),u=a;return u}E1.exports=nE});var P1=T((gR,O1)=>{var iE=zd(),sE=w1().ec,jc=new sE("secp256k1"),oE=x1(),nf=Buffer.alloc(32,0),sf=Buffer.from("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141","hex"),S1=Buffer.from("fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f","hex"),dr=jc.curve.n,I1=dr.shrn(1),af=jc.curve.g,ff="Expected Private",gi="Expected Point",uf="Expected Tweak",T1="Expected Hash",aE="Expected Signature",fE="Expected Extra Data (32 bytes)";function _o(e){return Buffer.isBuffer(e)&&e.length===32}function cf(e){return _o(e)?e.compare(sf)<0:!1}function wn(e){if(!Buffer.isBuffer(e)||e.length<33)return!1;let t=e[0],r=e.slice(1,33);if(r.compare(nf)===0||r.compare(S1)>=0)return!1;if((t===2||t===3)&&e.length===33){try{mi(e)}catch{return!1}return!0}let n=e.slice(33);return n.compare(nf)===0||n.compare(S1)>=0?!1:t===4&&e.length===65}function M1(e){return e[0]!==4}function uE(e){return wn(e)?M1(e):!1}function _n(e){return _o(e)?e.compare(nf)>0&&e.compare(sf)<0:!1}function cE(e){let t=e.slice(0,32),r=e.slice(32,64);return Buffer.isBuffer(e)&&e.length===64&&t.compare(sf)<0&&r.compare(sf)<0}function Eo(e,t){return e===void 0&&t!==void 0?M1(t):e===void 0?!0:e}function Vt(e){return new iE(e)}function of(e){return e.toArrayLike(Buffer,"be",32)}function mi(e){return jc.curve.decodePoint(e)}function ms(e,t){return Buffer.from(e._encode(t))}function hE(e,t,r){if(!wn(e))throw new TypeError(gi);if(!wn(t))throw new TypeError(gi);let n=mi(e),i=mi(t),s=n.add(i);if(s.isInfinity())return null;let a=Eo(r,e);return ms(s,a)}function lE(e,t,r){if(!wn(e))throw new TypeError(gi);if(!cf(t))throw new TypeError(uf);let n=Eo(r,e),i=mi(e);if(t.compare(nf)===0)return ms(i,n);let s=Vt(t),a=af.mul(s),u=i.add(a);return u.isInfinity()?null:ms(u,n)}function dE(e,t){if(!wn(e))throw new TypeError(gi);let r=mi(e);if(r.isInfinity())throw new TypeError(gi);let n=Eo(t,e);return ms(r,n)}function pE(e,t){if(!_n(e))throw new TypeError(ff);let r=Vt(e),n=af.mul(r);if(n.isInfinity())return null;let i=Eo(t);return ms(n,i)}function vE(e,t,r){if(!wn(e))throw new TypeError(gi);if(!cf(t))throw new TypeError(uf);let n=Eo(r,e),i=mi(e),s=Vt(t),a=i.mul(s);return a.isInfinity()?null:ms(a,n)}function bE(e,t){if(!_n(e))throw new TypeError(ff);if(!cf(t))throw new TypeError(uf);let r=Vt(e),n=Vt(t),i=of(r.add(n).umod(dr));return _n(i)?i:null}function gE(e,t){if(!_n(e))throw new TypeError(ff);if(!cf(t))throw new TypeError(uf);let r=Vt(e),n=Vt(t),i=of(r.sub(n).umod(dr));return _n(i)?i:null}function mE(e,t){return A1(e,t)}function yE(e,t,r){return A1(e,t,r)}function A1(e,t,r){if(!_o(e))throw new TypeError(T1);if(!_n(t))throw new TypeError(ff);if(r!==void 0&&!_o(r))throw new TypeError(fE);let n=Vt(t),i=Vt(e),s,a;oE(e,t,function(c){let p=Vt(c),w=af.mul(p);return!(w.isInfinity()||(s=w.x.umod(dr),s.isZero()===0)||(a=p.invm(dr).mul(i.add(n.mul(s))).umod(dr),a.isZero()===0))},_n,r),a.cmp(I1)>0&&(a=dr.sub(a));let l=Buffer.allocUnsafe(64);return of(s).copy(l,0),of(a).copy(l,32),l}function wE(e,t,r,n){if(!_o(e))throw new TypeError(T1);if(!wn(t))throw new TypeError(gi);if(!cE(r))throw new TypeError(aE);let i=mi(t),s=Vt(r.slice(0,32)),a=Vt(r.slice(32,64));if(n&&a.cmp(I1)>0||s.gtn(0)<=0||a.gtn(0)<=0)return!1;let u=Vt(e),l=a.invm(dr),c=u.mul(l).umod(dr),p=s.mul(l).umod(dr),w=af.mulAdd(c,i,p);return w.isInfinity()?!1:w.x.umod(dr).eq(s)}O1.exports={isPoint:wn,isPointCompressed:uE,isPrivate:_n,pointAdd:hE,pointAddScalar:lE,pointCompress:dE,pointFromScalar:pE,pointMultiply:vE,privateAdd:bE,privateSub:gE,sign:mE,signWithEntropy:yE,verify:wE}});var pr=T((mR,Xc)=>{"use strict";try{Xc.exports=Wd()}catch{Xc.exports=P1()}});var hf=T((yR,B1)=>{var xo={Array:function(e){return e!=null&&e.constructor===Array},Boolean:function(e){return typeof e=="boolean"},Function:function(e){return typeof e=="function"},Nil:function(e){return e==null},Number:function(e){return typeof e=="number"},Object:function(e){return typeof e=="object"},String:function(e){return typeof e=="string"},"":function(){return!0}};xo.Null=xo.Nil;for(Yc in xo)xo[Yc].toJSON=function(e){return e}.bind(null,Yc);var Yc;B1.exports=xo});var Qc=T((wR,N1)=>{var yi=hf();function R1(e){return e.name||e.toString().match(/function (.*?)\s*\(/)[1]}function Jc(e){return yi.Nil(e)?"":R1(e.constructor)}function _E(e){return yi.Function(e)?"":yi.String(e)?JSON.stringify(e):e&&yi.Object(e)?"":e}function Zc(e,t){Error.captureStackTrace&&Error.captureStackTrace(e,t)}function lf(e){return yi.Function(e)?e.toJSON?e.toJSON():R1(e):yi.Array(e)?"Array":e&&yi.Object(e)?"Object":e!==void 0?e:""}function k1(e,t,r){var n=_E(t);return"Expected "+lf(e)+", got"+(r!==""?" "+r:"")+(n!==""?" "+n:"")}function Vr(e,t,r){r=r||Jc(t),this.message=k1(e,t,r),Zc(this,Vr),this.__type=e,this.__value=t,this.__valueTypeName=r}Vr.prototype=Object.create(Error.prototype);Vr.prototype.constructor=Vr;function EE(e,t,r,n,i){var s='" of type ';return t==="key"&&(s='" with key type '),k1('property "'+lf(r)+s+lf(e),n,i)}function ys(e,t,r,n,i){e?(i=i||Jc(n),this.message=EE(e,r,t,n,i)):this.message='Unexpected property "'+t+'"',Zc(this,Vr),this.__label=r,this.__property=t,this.__type=e,this.__value=n,this.__valueTypeName=i}ys.prototype=Object.create(Error.prototype);ys.prototype.constructor=Vr;function xE(e,t){return new Vr(e,{},t)}function SE(e,t,r){return e instanceof ys?(t=t+"."+e.__property,e=new ys(e.__type,t,e.__label,e.__value,e.__valueTypeName)):e instanceof Vr&&(e=new ys(e.__type,t,r,e.__value,e.__valueTypeName)),Zc(e),e}N1.exports={TfTypeError:Vr,TfPropertyTypeError:ys,tfCustomError:xE,tfSubError:SE,tfJSON:lf,getValueTypeName:Jc}});var U1=T((_R,L1)=>{var nh=hf(),IE=Qc();function C1(e){return Buffer.isBuffer(e)}function q1(e){return typeof e=="string"&&/^([0-9a-f]{2})+$/i.test(e)}function df(e,t){var r=e.toJSON();function n(i){if(!e(i))return!1;if(i.length===t)return!0;throw IE.tfCustomError(r+"(Length: "+t+")",r+"(Length: "+i.length+")")}return n.toJSON=function(){return r},n}var TE=df.bind(null,nh.Array),ME=df.bind(null,C1),AE=df.bind(null,q1),OE=df.bind(null,nh.String);function PE(e,t,r){r=r||nh.Number;function n(i,s){return r(i,s)&&i>e&&i>24===e}function kE(e){return e<<16>>16===e}function NE(e){return(e|0)===e}function CE(e){return typeof e=="number"&&e>=-th&&e<=th&&Math.floor(e)===e}function qE(e){return(e&255)===e}function LE(e){return(e&65535)===e}function UE(e){return e>>>0===e}function DE(e){return typeof e=="number"&&e>=0&&e<=th&&Math.floor(e)===e}var rh={ArrayN:TE,Buffer:C1,BufferN:ME,Finite:BE,Hex:q1,HexN:AE,Int8:RE,Int16:kE,Int32:NE,Int53:CE,Range:PE,StringN:OE,UInt8:qE,UInt16:LE,UInt32:UE,UInt53:DE};for(eh in rh)rh[eh].toJSON=function(e){return e}.bind(null,eh);var eh;L1.exports=rh});var ft=T((ER,K1)=>{var Io=Qc(),_t=hf(),zr=Io.tfJSON,H1=Io.TfTypeError,F1=Io.TfPropertyTypeError,So=Io.tfSubError,HE=Io.getValueTypeName,$r={arrayOf:function(t,r){t=Pr(t),r=r||{};function n(i,s){return!_t.Array(i)||_t.Nil(i)||r.minLength!==void 0&&i.lengthr.maxLength||r.length!==void 0&&i.length!==r.length?!1:i.every(function(a,u){try{return kt(t,a,s)}catch(l){throw So(l,u)}})}return n.toJSON=function(){var i="["+zr(t)+"]";return r.length!==void 0?i+="{"+r.length+"}":(r.minLength!==void 0||r.maxLength!==void 0)&&(i+="{"+(r.minLength===void 0?0:r.minLength)+","+(r.maxLength===void 0?1/0:r.maxLength)+"}"),i},n},maybe:function e(t){t=Pr(t);function r(n,i){return _t.Nil(n)||t(n,i,e)}return r.toJSON=function(){return"?"+zr(t)},r},map:function(t,r){t=Pr(t),r&&(r=Pr(r));function n(i,s){if(!_t.Object(i)||_t.Nil(i))return!1;for(var a in i){try{r&&kt(r,a,s)}catch(l){throw So(l,a,"key")}try{var u=i[a];kt(t,u,s)}catch(l){throw So(l,a)}}return!0}return r?n.toJSON=function(){return"{"+zr(r)+": "+zr(t)+"}"}:n.toJSON=function(){return"{"+zr(t)+"}"},n},object:function(t){var r={};for(var n in t)r[n]=Pr(t[n]);function i(s,a){if(!_t.Object(s)||_t.Nil(s))return!1;var u;try{for(u in r){var l=r[u],c=s[u];kt(l,c,a)}}catch(p){throw So(p,u)}if(a){for(u in s)if(!r[u])throw new F1(void 0,u)}return!0}return i.toJSON=function(){return zr(r)},i},anyOf:function(){var t=[].slice.call(arguments).map(Pr);function r(n,i){return t.some(function(s){try{return kt(s,n,i)}catch{return!1}})}return r.toJSON=function(){return t.map(zr).join("|")},r},allOf:function(){var t=[].slice.call(arguments).map(Pr);function r(n,i){return t.every(function(s){try{return kt(s,n,i)}catch{return!1}})}return r.toJSON=function(){return t.map(zr).join(" & ")},r},quacksLike:function(t){function r(n){return t===HE(n)}return r.toJSON=function(){return t},r},tuple:function(){var t=[].slice.call(arguments).map(Pr);function r(n,i){return _t.Nil(n)||_t.Nil(n.length)||i&&n.length!==t.length?!1:t.every(function(s,a){try{return kt(s,n[a],i)}catch(u){throw So(u,a)}})}return r.toJSON=function(){return"("+t.map(zr).join(", ")+")"},r},value:function(t){function r(n){return n===t}return r.toJSON=function(){return t},r}};$r.oneOf=$r.anyOf;function Pr(e){if(_t.String(e))return e[0]==="?"?$r.maybe(e.slice(1)):_t[e]||$r.quacksLike(e);if(e&&_t.Object(e)){if(_t.Array(e)){if(e.length!==1)throw new TypeError("Expected compile() parameter of type Array of length 1");return $r.arrayOf(e[0])}return $r.object(e)}else if(_t.Function(e))return e;return $r.value(e)}function kt(e,t,r,n){if(_t.Function(e)){if(e(t,r))return!0;throw new H1(n||e,t)}return kt(Pr(e),t,r)}for(jr in _t)kt[jr]=_t[jr];var jr;for(jr in $r)kt[jr]=$r[jr];var D1=U1();for(jr in D1)kt[jr]=D1[jr];kt.compile=Pr;kt.TfTypeError=H1;kt.TfPropertyTypeError=F1;K1.exports=kt});var oh=T((xR,W1)=>{var ih=ci();function G1(e,t){if(t!==void 0&&e[0]!==t)throw new Error("Invalid network version");if(e.length===33)return{version:e[0],privateKey:e.slice(1,33),compressed:!1};if(e.length!==34)throw new Error("Invalid WIF length");if(e[33]!==1)throw new Error("Invalid compression flag");return{version:e[0],privateKey:e.slice(1,33),compressed:!0}}function sh(e,t,r){var n=new Buffer(r?34:33);return n.writeUInt8(e,0),t.copy(n,1),r&&(n[33]=1),n}function FE(e,t){return G1(ih.decode(e),t)}function KE(e,t,r){return typeof e=="number"?ih.encode(sh(e,t,r)):ih.encode(sh(e.version,e.privateKey,e.compressed))}W1.exports={decode:FE,decodeRaw:G1,encode:KE,encodeRaw:sh}});var j1=T(ws=>{"use strict";Object.defineProperty(ws,"__esModule",{value:!0});var ah=Md(),z1=ci(),Br=pr(),Et=ft(),GE=oh(),fh=Et.BufferN(32),WE=Et.compile({wif:Et.UInt8,bip32:{public:Et.UInt32,private:Et.UInt32}}),bf={messagePrefix:`Bitcoin Signed Message:
+`,bech32:"bc",bip32:{public:76067358,private:76066276},pubKeyHash:0,scriptHash:5,wif:128},V1=2147483648,VE=Math.pow(2,31)-1;function zE(e){return Et.String(e)&&e.match(/^(m\/)?(\d+'?\/)*\d+'?$/)!==null}function $E(e){return Et.UInt32(e)&&e<=VE}var pf=class{constructor(t,r,n,i,s=0,a=0,u=0){this.__D=t,this.__Q=r,this.chainCode=n,this.network=i,this.__DEPTH=s,this.__INDEX=a,this.__PARENT_FINGERPRINT=u,Et(WE,i),this.lowR=!1}get depth(){return this.__DEPTH}get index(){return this.__INDEX}get parentFingerprint(){return this.__PARENT_FINGERPRINT}get publicKey(){return this.__Q===void 0&&(this.__Q=Br.pointFromScalar(this.__D,!0)),this.__Q}get privateKey(){return this.__D}get identifier(){return ah.hash160(this.publicKey)}get fingerprint(){return this.identifier.slice(0,4)}get compressed(){return!0}isNeutered(){return this.__D===void 0}neutered(){return vf(this.publicKey,this.chainCode,this.network,this.depth,this.index,this.parentFingerprint)}toBase58(){let t=this.network,r=this.isNeutered()?t.bip32.public:t.bip32.private,n=Buffer.allocUnsafe(78);return n.writeUInt32BE(r,0),n.writeUInt8(this.depth,4),n.writeUInt32BE(this.parentFingerprint,5),n.writeUInt32BE(this.index,9),this.chainCode.copy(n,13),this.isNeutered()?this.publicKey.copy(n,45):(n.writeUInt8(0,45),this.privateKey.copy(n,46)),z1.encode(n)}toWIF(){if(!this.privateKey)throw new TypeError("Missing private key");return GE.encode(this.network.wif,this.privateKey,!0)}derive(t){Et(Et.UInt32,t);let r=t>=V1,n=Buffer.allocUnsafe(37);if(r){if(this.isNeutered())throw new TypeError("Missing private key for hardened child key");n[0]=0,this.privateKey.copy(n,1),n.writeUInt32BE(t,33)}else this.publicKey.copy(n,0),n.writeUInt32BE(t,33);let i=ah.hmacSHA512(this.chainCode,n),s=i.slice(0,32),a=i.slice(32);if(!Br.isPrivate(s))return this.derive(t+1);let u;if(this.isNeutered()){let l=Br.pointAddScalar(this.publicKey,s,!0);if(l===null)return this.derive(t+1);u=vf(l,a,this.network,this.depth+1,t,this.fingerprint.readUInt32BE(0))}else{let l=Br.privateAdd(this.privateKey,s);if(l==null)return this.derive(t+1);u=uh(l,a,this.network,this.depth+1,t,this.fingerprint.readUInt32BE(0))}return u}deriveHardened(t){return Et($E,t),this.derive(t+V1)}derivePath(t){Et(zE,t);let r=t.split("/");if(r[0]==="m"){if(this.parentFingerprint)throw new TypeError("Expected master, got child");r=r.slice(1)}return r.reduce((n,i)=>{let s;return i.slice(-1)==="'"?(s=parseInt(i.slice(0,-1),10),n.deriveHardened(s)):(s=parseInt(i,10),n.derive(s))},this)}sign(t,r){if(!this.privateKey)throw new Error("Missing private key");if(r===void 0&&(r=this.lowR),r===!1)return Br.sign(t,this.privateKey);{let n=Br.sign(t,this.privateKey),i=Buffer.alloc(32,0),s=0;for(;n[0]>127;)s++,i.writeUIntLE(s,0,6),n=Br.signWithEntropy(t,this.privateKey,i);return n}}verify(t,r){return Br.verify(t,this.publicKey,r)}};function jE(e,t){let r=z1.decode(e);if(r.length!==78)throw new TypeError("Invalid buffer length");t=t||bf;let n=r.readUInt32BE(0);if(n!==t.bip32.private&&n!==t.bip32.public)throw new TypeError("Invalid network version");let i=r[4],s=r.readUInt32BE(5);if(i===0&&s!==0)throw new TypeError("Invalid parent fingerprint");let a=r.readUInt32BE(9);if(i===0&&a!==0)throw new TypeError("Invalid index");let u=r.slice(13,45),l;if(n===t.bip32.private){if(r.readUInt8(45)!==0)throw new TypeError("Invalid private key");let c=r.slice(46,78);l=uh(c,u,t,i,a,s)}else{let c=r.slice(45,78);l=vf(c,u,t,i,a,s)}return l}ws.fromBase58=jE;function $1(e,t,r){return uh(e,t,r)}ws.fromPrivateKey=$1;function uh(e,t,r,n,i,s){if(Et({privateKey:fh,chainCode:fh},{privateKey:e,chainCode:t}),r=r||bf,!Br.isPrivate(e))throw new TypeError("Private key not in range [1, n)");return new pf(e,void 0,t,r,n,i,s)}function XE(e,t,r){return vf(e,t,r)}ws.fromPublicKey=XE;function vf(e,t,r,n,i,s){if(Et({publicKey:Et.BufferN(33),chainCode:fh},{publicKey:e,chainCode:t}),r=r||bf,!Br.isPoint(e))throw new TypeError("Point is not on the curve");return new pf(void 0,e,t,r,n,i,s)}function YE(e,t){if(Et(Et.Buffer,e),e.length<16)throw new TypeError("Seed should be at least 128 bits");if(e.length>64)throw new TypeError("Seed should be at most 512 bits");t=t||bf;let r=ah.hmacSHA512(Buffer.from("Bitcoin seed","utf8"),e),n=r.slice(0,32),i=r.slice(32);return $1(n,i,t)}ws.fromSeed=YE});var X1=T(_s=>{"use strict";Object.defineProperty(_s,"__esModule",{value:!0});var gf=j1();_s.fromSeed=gf.fromSeed;_s.fromBase58=gf.fromBase58;_s.fromPublicKey=gf.fromPublicKey;_s.fromPrivateKey=gf.fromPrivateKey});var zt=T(To=>{"use strict";Object.defineProperty(To,"__esModule",{value:!0});To.bitcoin={messagePrefix:`Bitcoin Signed Message:
+`,bech32:"bc",bip32:{public:76067358,private:76066276},pubKeyHash:0,scriptHash:5,wif:128};To.regtest={messagePrefix:`Bitcoin Signed Message:
+`,bech32:"bcrt",bip32:{public:70617039,private:70615956},pubKeyHash:111,scriptHash:196,wif:239};To.testnet={messagePrefix:`Bitcoin Signed Message:
+`,bech32:"tb",bip32:{public:70617039,private:70615956},pubKeyHash:111,scriptHash:196,wif:239}});var Y1=T(mf=>{"use strict";Object.defineProperty(mf,"__esModule",{value:!0});function JE(e,t,r){t=t||4,r=r===void 0?!0:r;let n=e.length;if(n===0)return 0;if(n>t)throw new TypeError("Script number overflow");if(r&&(e[n-1]&127)===0&&(n<=1||(e[n-2]&128)===0))throw new Error("Non-minimally encoded script number");if(n===5){let s=e.readUInt32LE(0),a=e.readUInt8(4);return a&128?-((a&-129)*4294967296+s):a*4294967296+s}let i=0;for(let s=0;s2147483647?5:e>8388607?4:e>32767?3:e>127?2:e>0?1:0}function QE(e){let t=Math.abs(e),r=ZE(t),n=Buffer.allocUnsafe(r),i=e<0;for(let s=0;s>=8;return n[r-1]&128?n.writeUInt8(i?128:0,r-1):i&&(n[r-1]|=128),n}mf.encode=QE});var vr=T(Je=>{"use strict";Object.defineProperty(Je,"__esModule",{value:!0});var Fe=ft(),ex=Math.pow(2,31)-1;function tx(e){return Fe.UInt32(e)&&e<=ex}Je.UInt31=tx;function J1(e){return Fe.String(e)&&!!e.match(/^(m\/)?(\d+'?\/)*\d+'?$/)}Je.BIP32Path=J1;J1.toJSON=()=>"BIP32 derivation path";function rx(e){return(Fe.Buffer(e.publicKey)||typeof e.getPublicKey=="function")&&typeof e.sign=="function"}Je.Signer=rx;var nx=21*1e14;function ix(e){return Fe.UInt53(e)&&e<=nx}Je.Satoshi=ix;Je.ECPoint=Fe.quacksLike("Point");Je.Network=Fe.compile({messagePrefix:Fe.oneOf(Fe.Buffer,Fe.String),bip32:{public:Fe.UInt32,private:Fe.UInt32},pubKeyHash:Fe.UInt8,scriptHash:Fe.UInt8,wif:Fe.UInt8});Je.Buffer256bit=Fe.BufferN(32);Je.Hash160bit=Fe.BufferN(20);Je.Hash256bit=Fe.BufferN(32);Je.Number=Fe.Number;Je.Array=Fe.Array;Je.Boolean=Fe.Boolean;Je.String=Fe.String;Je.Buffer=Fe.Buffer;Je.Hex=Fe.Hex;Je.maybe=Fe.maybe;Je.tuple=Fe.tuple;Je.UInt8=Fe.UInt8;Je.UInt32=Fe.UInt32;Je.Function=Fe.Function;Je.BufferN=Fe.BufferN;Je.Null=Fe.Null;Je.oneOf=Fe.oneOf});var ch=T((OR,Z1)=>{var sx=qt().Buffer;function ox(e){if(e.length<8||e.length>72||e[0]!==48||e[1]!==e.length-2||e[2]!==2)return!1;var t=e[3];if(t===0||5+t>=e.length||e[4+t]!==2)return!1;var r=e[5+t];return!(r===0||6+t+r!==e.length||e[4]&128||t>1&&e[4]===0&&!(e[5]&128)||e[t+6]&128||r>1&&e[t+6]===0&&!(e[t+7]&128))}function ax(e){if(e.length<8)throw new Error("DER sequence length is too short");if(e.length>72)throw new Error("DER sequence length is too long");if(e[0]!==48)throw new Error("Expected DER sequence");if(e[1]!==e.length-2)throw new Error("DER sequence length is invalid");if(e[2]!==2)throw new Error("Expected DER integer");var t=e[3];if(t===0)throw new Error("R length is zero");if(5+t>=e.length)throw new Error("R length is too long");if(e[4+t]!==2)throw new Error("Expected DER integer (2)");var r=e[5+t];if(r===0)throw new Error("S length is zero");if(6+t+r!==e.length)throw new Error("S length is invalid");if(e[4]&128)throw new Error("R value is negative");if(t>1&&e[4]===0&&!(e[5]&128))throw new Error("R value excessively padded");if(e[t+6]&128)throw new Error("S value is negative");if(r>1&&e[t+6]===0&&!(e[t+7]&128))throw new Error("S value excessively padded");return{r:e.slice(4,4+t),s:e.slice(6+t)}}function fx(e,t){var r=e.length,n=t.length;if(r===0)throw new Error("R length is zero");if(n===0)throw new Error("S length is zero");if(r>33)throw new Error("R length is too long");if(n>33)throw new Error("S length is too long");if(e[0]&128)throw new Error("R value is negative");if(t[0]&128)throw new Error("S value is negative");if(r>1&&e[0]===0&&!(e[1]&128))throw new Error("R value excessively padded");if(n>1&&t[0]===0&&!(t[1]&128))throw new Error("S value excessively padded");var i=sx.allocUnsafe(6+r+n);return i[0]=48,i[1]=i.length-2,i[2]=2,i[3]=e.length,e.copy(i,4),i[4+r]=2,i[5+r]=t.length,t.copy(i,6+r),i}Z1.exports={check:ox,decode:ax,encode:fx}});var iv=T(yf=>{"use strict";Object.defineProperty(yf,"__esModule",{value:!0});var Q1=vr(),nv=ch(),ux=ft(),ev=Buffer.alloc(1,0);function tv(e){let t=0;for(;e[t]===0;)++t;return t===e.length?ev:(e=e.slice(t),e[0]&128?Buffer.concat([ev,e],1+e.length):e)}function rv(e){e[0]===0&&(e=e.slice(1));let t=Buffer.alloc(32,0),r=Math.max(0,32-e.length);return e.copy(t,r),t}function cx(e){let t=e.readUInt8(e.length-1),r=t&-129;if(r<=0||r>=4)throw new Error("Invalid hashType "+t);let n=nv.decode(e.slice(0,-1)),i=rv(n.r),s=rv(n.s);return{signature:Buffer.concat([i,s],64),hashType:t}}yf.decode=cx;function hx(e,t){ux({signature:Q1.BufferN(64),hashType:Q1.UInt8},{signature:e,hashType:t});let r=t&-129;if(r<=0||r>=4)throw new Error("Invalid hashType "+t);let n=Buffer.allocUnsafe(1);n.writeUInt8(t,0);let i=tv(e.slice(0,32)),s=tv(e.slice(32,64));return Buffer.concat([nv.encode(i,s),n])}yf.encode=hx});var wf=T((BR,lx)=>{lx.exports={OP_FALSE:0,OP_0:0,OP_PUSHDATA1:76,OP_PUSHDATA2:77,OP_PUSHDATA4:78,OP_1NEGATE:79,OP_RESERVED:80,OP_TRUE:81,OP_1:81,OP_2:82,OP_3:83,OP_4:84,OP_5:85,OP_6:86,OP_7:87,OP_8:88,OP_9:89,OP_10:90,OP_11:91,OP_12:92,OP_13:93,OP_14:94,OP_15:95,OP_16:96,OP_NOP:97,OP_VER:98,OP_IF:99,OP_NOTIF:100,OP_VERIF:101,OP_VERNOTIF:102,OP_ELSE:103,OP_ENDIF:104,OP_VERIFY:105,OP_RETURN:106,OP_TOALTSTACK:107,OP_FROMALTSTACK:108,OP_2DROP:109,OP_2DUP:110,OP_3DUP:111,OP_2OVER:112,OP_2ROT:113,OP_2SWAP:114,OP_IFDUP:115,OP_DEPTH:116,OP_DROP:117,OP_DUP:118,OP_NIP:119,OP_OVER:120,OP_PICK:121,OP_ROLL:122,OP_ROT:123,OP_SWAP:124,OP_TUCK:125,OP_CAT:126,OP_SUBSTR:127,OP_LEFT:128,OP_RIGHT:129,OP_SIZE:130,OP_INVERT:131,OP_AND:132,OP_OR:133,OP_XOR:134,OP_EQUAL:135,OP_EQUALVERIFY:136,OP_RESERVED1:137,OP_RESERVED2:138,OP_1ADD:139,OP_1SUB:140,OP_2MUL:141,OP_2DIV:142,OP_NEGATE:143,OP_ABS:144,OP_NOT:145,OP_0NOTEQUAL:146,OP_ADD:147,OP_SUB:148,OP_MUL:149,OP_DIV:150,OP_MOD:151,OP_LSHIFT:152,OP_RSHIFT:153,OP_BOOLAND:154,OP_BOOLOR:155,OP_NUMEQUAL:156,OP_NUMEQUALVERIFY:157,OP_NUMNOTEQUAL:158,OP_LESSTHAN:159,OP_GREATERTHAN:160,OP_LESSTHANOREQUAL:161,OP_GREATERTHANOREQUAL:162,OP_MIN:163,OP_MAX:164,OP_WITHIN:165,OP_RIPEMD160:166,OP_SHA1:167,OP_SHA256:168,OP_HASH160:169,OP_HASH256:170,OP_CODESEPARATOR:171,OP_CHECKSIG:172,OP_CHECKSIGVERIFY:173,OP_CHECKMULTISIG:174,OP_CHECKMULTISIGVERIFY:175,OP_NOP1:176,OP_NOP2:177,OP_CHECKLOCKTIMEVERIFY:177,OP_NOP3:178,OP_CHECKSEQUENCEVERIFY:178,OP_NOP4:179,OP_NOP5:180,OP_NOP6:181,OP_NOP7:182,OP_NOP8:183,OP_NOP9:184,OP_NOP10:185,OP_PUBKEYHASH:253,OP_PUBKEY:254,OP_INVALIDOPCODE:255}});var av=T((RR,ov)=>{var En=wf();function sv(e){return ee.length)return null;n=e.readUInt8(t+1),i=2}else if(r===En.OP_PUSHDATA2){if(t+3>e.length)return null;n=e.readUInt16LE(t+1),i=3}else{if(t+5>e.length)return null;if(r!==En.OP_PUSHDATA4)throw new Error("Unexpected opcode");n=e.readUInt32LE(t+1),i=5}return{opcode:r,number:n,size:i}}ov.exports={encodingLength:sv,encode:dx,decode:px}});var lv=T((kR,hv)=>{var fv=wf(),cv={};for(hh in fv)uv=fv[hh],cv[uv]=hh;var uv,hh;hv.exports=cv});var ke=T(Ye=>{"use strict";Object.defineProperty(Ye,"__esModule",{value:!0});var dv=Y1(),vx=iv(),xn=vr(),bx=ch(),gx=pr(),lh=av(),Mo=ft();Ye.OPS=wf();var mx=lv(),pv=Ye.OPS.OP_RESERVED;function yx(e){return xn.Number(e)&&(e===Ye.OPS.OP_0||e>=Ye.OPS.OP_1&&e<=Ye.OPS.OP_16||e===Ye.OPS.OP_1NEGATE)}function wx(e){return xn.Buffer(e)||yx(e)}function vv(e){return xn.Array(e)&&e.every(wx)}Ye.isPushOnly=vv;function _f(e){if(e.length===0)return Ye.OPS.OP_0;if(e.length===1){if(e[0]>=1&&e[0]<=16)return pv+e[0];if(e[0]===129)return Ye.OPS.OP_1NEGATE}}function bv(e){return Buffer.isBuffer(e)}function _x(e){return xn.Array(e)}function Ef(e){return Buffer.isBuffer(e)}function gv(e){if(bv(e))return e;Mo(xn.Array,e);let t=e.reduce((i,s)=>Ef(s)?s.length===1&&_f(s)!==void 0?i+1:i+lh.encodingLength(s.length)+s.length:i+1,0),r=Buffer.allocUnsafe(t),n=0;if(e.forEach(i=>{if(Ef(i)){let s=_f(i);if(s!==void 0){r.writeUInt8(s,n),n+=1;return}n+=lh.encode(r,i.length,n),i.copy(r,n),n+=i.length}else r.writeUInt8(i,n),n+=1}),n!==r.length)throw new Error("Could not decode chunks");return r}Ye.compile=gv;function dh(e){if(_x(e))return e;Mo(xn.Buffer,e);let t=[],r=0;for(;rYe.OPS.OP_0&&n<=Ye.OPS.OP_PUSHDATA4){let i=lh.decode(e,r);if(i===null||(r+=i.size,r+i.number>e.length))return null;let s=e.slice(r,r+i.number);r+=i.number;let a=_f(s);a!==void 0?t.push(a):t.push(s)}else t.push(n),r+=1}return t}Ye.decompile=dh;function Ex(e){return bv(e)&&(e=dh(e)),e.map(t=>{if(Ef(t)){let r=_f(t);if(r===void 0)return t.toString("hex");t=r}return mx[t]}).join(" ")}Ye.toASM=Ex;function xx(e){return Mo(xn.String,e),gv(e.split(" ").map(t=>Ye.OPS[t]!==void 0?Ye.OPS[t]:(Mo(xn.Hex,t),Buffer.from(t,"hex"))))}Ye.fromASM=xx;function Sx(e){return e=dh(e),Mo(vv,e),e.map(t=>Ef(t)?t:t===Ye.OPS.OP_0?Buffer.allocUnsafe(0):dv.encode(t-pv))}Ye.toStack=Sx;function Ix(e){return gx.isPoint(e)}Ye.isCanonicalPubKey=Ix;function mv(e){let t=e&-129;return t>0&&t<4}Ye.isDefinedHashType=mv;function Tx(e){return!Buffer.isBuffer(e)||!mv(e[e.length-1])?!1:bx.check(e.slice(0,-1))}Ye.isCanonicalScriptSignature=Tx;Ye.number=dv;Ye.signature=vx});var Sn=T(xf=>{"use strict";Object.defineProperty(xf,"__esModule",{value:!0});function Mx(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get(){let n=r.call(this);return this[t]=n,n},set(n){Object.defineProperty(this,t,{configurable:!0,enumerable:!0,value:n,writable:!0})}})}xf.prop=Mx;function Ax(e){let t;return()=>(t!==void 0||(t=e()),t)}xf.value=Ax});var _v=T(ph=>{"use strict";Object.defineProperty(ph,"__esModule",{value:!0});var Ox=zt(),Sf=ke(),yv=Sn(),Xr=ft(),wv=Sf.OPS;function Px(e,t){return e.length!==t.length?!1:e.every((r,n)=>r.equals(t[n]))}function Bx(e,t){if(!e.data&&!e.output)throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),Xr({network:Xr.maybe(Xr.Object),output:Xr.maybe(Xr.Buffer),data:Xr.maybe(Xr.arrayOf(Xr.Buffer))},e);let n={name:"embed",network:e.network||Ox.bitcoin};if(yv.prop(n,"output",()=>{if(!!e.data)return Sf.compile([wv.OP_RETURN].concat(e.data))}),yv.prop(n,"data",()=>{if(!!e.output)return Sf.decompile(e.output).slice(1)}),t.validate&&e.output){let i=Sf.decompile(e.output);if(i[0]!==wv.OP_RETURN)throw new TypeError("Output is invalid");if(!i.slice(1).every(Xr.Buffer))throw new TypeError("Output is invalid");if(e.data&&!Px(e.data,n.data))throw new TypeError("Data mismatch")}return Object.assign(n,e)}ph.p2data=Bx});var Sv=T(vh=>{"use strict";Object.defineProperty(vh,"__esModule",{value:!0});var Rx=zt(),Es=ke(),In=Sn(),xs=Es.OPS,xt=ft(),Ev=pr(),If=xs.OP_RESERVED;function xv(e,t){return e.length!==t.length?!1:e.every((r,n)=>r.equals(t[n]))}function kx(e,t){if(!e.input&&!e.output&&!(e.pubkeys&&e.m!==void 0)&&!e.signatures)throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{});function r(l){return Es.isCanonicalScriptSignature(l)||(t.allowIncomplete&&l===xs.OP_0)!==void 0}xt({network:xt.maybe(xt.Object),m:xt.maybe(xt.Number),n:xt.maybe(xt.Number),output:xt.maybe(xt.Buffer),pubkeys:xt.maybe(xt.arrayOf(Ev.isPoint)),signatures:xt.maybe(xt.arrayOf(r)),input:xt.maybe(xt.Buffer)},e);let i={network:e.network||Rx.bitcoin},s=[],a=!1;function u(l){a||(a=!0,s=Es.decompile(l),i.m=s[0]-If,i.n=s[s.length-2]-If,i.pubkeys=s.slice(1,-2))}if(In.prop(i,"output",()=>{if(!!e.m&&!!i.n&&!!e.pubkeys)return Es.compile([].concat(If+e.m,e.pubkeys,If+i.n,xs.OP_CHECKMULTISIG))}),In.prop(i,"m",()=>{if(!!i.output)return u(i.output),i.m}),In.prop(i,"n",()=>{if(!!i.pubkeys)return i.pubkeys.length}),In.prop(i,"pubkeys",()=>{if(!!e.output)return u(e.output),i.pubkeys}),In.prop(i,"signatures",()=>{if(!!e.input)return Es.decompile(e.input).slice(1)}),In.prop(i,"input",()=>{if(!!e.signatures)return Es.compile([xs.OP_0].concat(e.signatures))}),In.prop(i,"witness",()=>{if(!!i.input)return[]}),In.prop(i,"name",()=>{if(!(!i.m||!i.n))return`p2ms(${i.m} of ${i.n})`}),t.validate){if(e.output){if(u(e.output),!xt.Number(s[0]))throw new TypeError("Output is invalid");if(!xt.Number(s[s.length-2]))throw new TypeError("Output is invalid");if(s[s.length-1]!==xs.OP_CHECKMULTISIG)throw new TypeError("Output is invalid");if(i.m<=0||i.n>16||i.m>i.n||i.n!==s.length-3)throw new TypeError("Output is invalid");if(!i.pubkeys.every(l=>Ev.isPoint(l)))throw new TypeError("Output is invalid");if(e.m!==void 0&&e.m!==i.m)throw new TypeError("m mismatch");if(e.n!==void 0&&e.n!==i.n)throw new TypeError("n mismatch");if(e.pubkeys&&!xv(e.pubkeys,i.pubkeys))throw new TypeError("Pubkeys mismatch")}if(e.pubkeys){if(e.n!==void 0&&e.n!==e.pubkeys.length)throw new TypeError("Pubkey count mismatch");if(i.n=e.pubkeys.length,i.ni.m)throw new TypeError("Too many signatures provided")}if(e.input){if(e.input[0]!==xs.OP_0)throw new TypeError("Input is invalid");if(i.signatures.length===0||!i.signatures.every(r))throw new TypeError("Input has invalid signature(s)");if(e.signatures&&!xv(e.signatures,i.signatures))throw new TypeError("Signature mismatch");if(e.m!==void 0&&e.m!==e.signatures.length)throw new TypeError("Signature count mismatch")}}return Object.assign(i,e)}vh.p2ms=kx});var Mv=T(bh=>{"use strict";Object.defineProperty(bh,"__esModule",{value:!0});var Nx=zt(),Is=ke(),Ss=Sn(),Yr=ft(),Iv=Is.OPS,Tv=pr();function Cx(e,t){if(!e.input&&!e.output&&!e.pubkey&&!e.input&&!e.signature)throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),Yr({network:Yr.maybe(Yr.Object),output:Yr.maybe(Yr.Buffer),pubkey:Yr.maybe(Tv.isPoint),signature:Yr.maybe(Is.isCanonicalScriptSignature),input:Yr.maybe(Yr.Buffer)},e);let r=Ss.value(()=>Is.decompile(e.input)),i={name:"p2pk",network:e.network||Nx.bitcoin};if(Ss.prop(i,"output",()=>{if(!!e.pubkey)return Is.compile([e.pubkey,Iv.OP_CHECKSIG])}),Ss.prop(i,"pubkey",()=>{if(!!e.output)return e.output.slice(1,-1)}),Ss.prop(i,"signature",()=>{if(!!e.input)return r()[0]}),Ss.prop(i,"input",()=>{if(!!e.signature)return Is.compile([e.signature])}),Ss.prop(i,"witness",()=>{if(!!i.input)return[]}),t.validate){if(e.output){if(e.output[e.output.length-1]!==Iv.OP_CHECKSIG)throw new TypeError("Output is invalid");if(!Tv.isPoint(i.pubkey))throw new TypeError("Output pubkey is invalid");if(e.pubkey&&!e.pubkey.equals(i.pubkey))throw new TypeError("Pubkey mismatch")}if(e.signature&&e.input&&!e.input.equals(i.input))throw new TypeError("Signature mismatch");if(e.input){if(r().length!==1)throw new TypeError("Input is invalid");if(!Is.isCanonicalScriptSignature(i.signature))throw new TypeError("Input has invalid signature")}}return Object.assign(i,e)}bh.p2pk=Cx});var Rr=T(wi=>{"use strict";Object.defineProperty(wi,"__esModule",{value:!0});var Tf=ka();function Av(e){try{return Tf("rmd160").update(e).digest()}catch{return Tf("ripemd160").update(e).digest()}}wi.ripemd160=Av;function qx(e){return Tf("sha1").update(e).digest()}wi.sha1=qx;function Mf(e){return Tf("sha256").update(e).digest()}wi.sha256=Mf;function Lx(e){return Av(Mf(e))}wi.hash160=Lx;function Ux(e){return Mf(Mf(e))}wi.hash256=Ux});var Bv=T(mh=>{"use strict";Object.defineProperty(mh,"__esModule",{value:!0});var gh=Rr(),Dx=zt(),Ts=ke(),Jr=Sn(),$t=ft(),Tn=Ts.OPS,Ov=pr(),Pv=ci();function Hx(e,t){if(!e.address&&!e.hash&&!e.output&&!e.pubkey&&!e.input)throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),$t({network:$t.maybe($t.Object),address:$t.maybe($t.String),hash:$t.maybe($t.BufferN(20)),output:$t.maybe($t.BufferN(25)),pubkey:$t.maybe(Ov.isPoint),signature:$t.maybe(Ts.isCanonicalScriptSignature),input:$t.maybe($t.Buffer)},e);let r=Jr.value(()=>{let a=Pv.decode(e.address),u=a.readUInt8(0),l=a.slice(1);return{version:u,hash:l}}),n=Jr.value(()=>Ts.decompile(e.input)),i=e.network||Dx.bitcoin,s={name:"p2pkh",network:i};if(Jr.prop(s,"address",()=>{if(!s.hash)return;let a=Buffer.allocUnsafe(21);return a.writeUInt8(i.pubKeyHash,0),s.hash.copy(a,1),Pv.encode(a)}),Jr.prop(s,"hash",()=>{if(e.output)return e.output.slice(3,23);if(e.address)return r().hash;if(e.pubkey||s.pubkey)return gh.hash160(e.pubkey||s.pubkey)}),Jr.prop(s,"output",()=>{if(!!s.hash)return Ts.compile([Tn.OP_DUP,Tn.OP_HASH160,s.hash,Tn.OP_EQUALVERIFY,Tn.OP_CHECKSIG])}),Jr.prop(s,"pubkey",()=>{if(!!e.input)return n()[1]}),Jr.prop(s,"signature",()=>{if(!!e.input)return n()[0]}),Jr.prop(s,"input",()=>{if(!!e.pubkey&&!!e.signature)return Ts.compile([e.signature,e.pubkey])}),Jr.prop(s,"witness",()=>{if(!!s.input)return[]}),t.validate){let a=Buffer.from([]);if(e.address){if(r().version!==i.pubKeyHash)throw new TypeError("Invalid version or Network mismatch");if(r().hash.length!==20)throw new TypeError("Invalid address");a=r().hash}if(e.hash){if(a.length>0&&!a.equals(e.hash))throw new TypeError("Hash mismatch");a=e.hash}if(e.output){if(e.output.length!==25||e.output[0]!==Tn.OP_DUP||e.output[1]!==Tn.OP_HASH160||e.output[2]!==20||e.output[23]!==Tn.OP_EQUALVERIFY||e.output[24]!==Tn.OP_CHECKSIG)throw new TypeError("Output is invalid");let u=e.output.slice(3,23);if(a.length>0&&!a.equals(u))throw new TypeError("Hash mismatch");a=u}if(e.pubkey){let u=gh.hash160(e.pubkey);if(a.length>0&&!a.equals(u))throw new TypeError("Hash mismatch");a=u}if(e.input){let u=n();if(u.length!==2)throw new TypeError("Input is invalid");if(!Ts.isCanonicalScriptSignature(u[0]))throw new TypeError("Input has invalid signature");if(!Ov.isPoint(u[1]))throw new TypeError("Input has invalid pubkey");if(e.signature&&!e.signature.equals(u[0]))throw new TypeError("Signature mismatch");if(e.pubkey&&!e.pubkey.equals(u[1]))throw new TypeError("Pubkey mismatch");let l=gh.hash160(u[1]);if(a.length>0&&!a.equals(l))throw new TypeError("Hash mismatch")}}return Object.assign(s,e)}mh.p2pkh=Hx});var Nv=T(yh=>{"use strict";Object.defineProperty(yh,"__esModule",{value:!0});var Rv=Rr(),Fx=zt(),Zr=ke(),kr=Sn(),et=ft(),Af=Zr.OPS,kv=ci();function Kx(e,t){return e.length!==t.length?!1:e.every((r,n)=>r.equals(t[n]))}function Gx(e,t){if(!e.address&&!e.hash&&!e.output&&!e.redeem&&!e.input)throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),et({network:et.maybe(et.Object),address:et.maybe(et.String),hash:et.maybe(et.BufferN(20)),output:et.maybe(et.BufferN(23)),redeem:et.maybe({network:et.maybe(et.Object),output:et.maybe(et.Buffer),input:et.maybe(et.Buffer),witness:et.maybe(et.arrayOf(et.Buffer))}),input:et.maybe(et.Buffer),witness:et.maybe(et.arrayOf(et.Buffer))},e);let r=e.network;r||(r=e.redeem&&e.redeem.network||Fx.bitcoin);let n={network:r},i=kr.value(()=>{let u=kv.decode(e.address),l=u.readUInt8(0),c=u.slice(1);return{version:l,hash:c}}),s=kr.value(()=>Zr.decompile(e.input)),a=kr.value(()=>{let u=s();return{network:r,output:u[u.length-1],input:Zr.compile(u.slice(0,-1)),witness:e.witness||[]}});if(kr.prop(n,"address",()=>{if(!n.hash)return;let u=Buffer.allocUnsafe(21);return u.writeUInt8(n.network.scriptHash,0),n.hash.copy(u,1),kv.encode(u)}),kr.prop(n,"hash",()=>{if(e.output)return e.output.slice(2,22);if(e.address)return i().hash;if(n.redeem&&n.redeem.output)return Rv.hash160(n.redeem.output)}),kr.prop(n,"output",()=>{if(!!n.hash)return Zr.compile([Af.OP_HASH160,n.hash,Af.OP_EQUAL])}),kr.prop(n,"redeem",()=>{if(!!e.input)return a()}),kr.prop(n,"input",()=>{if(!(!e.redeem||!e.redeem.input||!e.redeem.output))return Zr.compile([].concat(Zr.decompile(e.redeem.input),e.redeem.output))}),kr.prop(n,"witness",()=>{if(n.redeem&&n.redeem.witness)return n.redeem.witness;if(n.input)return[]}),kr.prop(n,"name",()=>{let u=["p2sh"];return n.redeem!==void 0&&u.push(n.redeem.name),u.join("-")}),t.validate){let u=Buffer.from([]);if(e.address){if(i().version!==r.scriptHash)throw new TypeError("Invalid version or Network mismatch");if(i().hash.length!==20)throw new TypeError("Invalid address");u=i().hash}if(e.hash){if(u.length>0&&!u.equals(e.hash))throw new TypeError("Hash mismatch");u=e.hash}if(e.output){if(e.output.length!==23||e.output[0]!==Af.OP_HASH160||e.output[1]!==20||e.output[22]!==Af.OP_EQUAL)throw new TypeError("Output is invalid");let c=e.output.slice(2,22);if(u.length>0&&!u.equals(c))throw new TypeError("Hash mismatch");u=c}let l=c=>{if(c.output){let p=Zr.decompile(c.output);if(!p||p.length<1)throw new TypeError("Redeem.output too short");let w=Rv.hash160(c.output);if(u.length>0&&!u.equals(w))throw new TypeError("Hash mismatch");u=w}if(c.input){let p=c.input.length>0,w=c.witness&&c.witness.length>0;if(!p&&!w)throw new TypeError("Empty input");if(p&&w)throw new TypeError("Input and witness provided");if(p){let x=Zr.decompile(c.input);if(!Zr.isPushOnly(x))throw new TypeError("Non push-only scriptSig")}}};if(e.input){let c=s();if(!c||c.length<1)throw new TypeError("Input too short");if(!Buffer.isBuffer(a().output))throw new TypeError("Input is invalid");l(a())}if(e.redeem){if(e.redeem.network&&e.redeem.network!==r)throw new TypeError("Network mismatch");if(e.input){let c=a();if(e.redeem.output&&!e.redeem.output.equals(c.output))throw new TypeError("Redeem.output mismatch");if(e.redeem.input&&!e.redeem.input.equals(c.input))throw new TypeError("Redeem.input mismatch")}l(e.redeem)}if(e.witness&&e.redeem&&e.redeem.witness&&!Kx(e.redeem.witness,e.witness))throw new TypeError("Witness and redeem.witness mismatch")}return Object.assign(n,e)}yh.p2sh=Gx});var Rf=T((KR,Lv)=>{"use strict";var Pf="qpzry9x8gf2tvdw0s3jn54khce6mua7l",wh={};for(Ao=0;Ao>25;return(e&33554431)<<5^-(t>>0&1)&996825010^-(t>>1&1)&642813549^-(t>>2&1)&513874426^-(t>>3&1)&1027748829^-(t>>4&1)&705979059}function Cv(e){for(var t=1,r=0;r126)return"Invalid prefix ("+e+")";t=Ms(t)^n>>5}for(t=Ms(t),r=0;rr)throw new TypeError("Exceeds length limit");e=e.toLowerCase();var n=Cv(e);if(typeof n=="string")throw new Error(n);for(var i=e+"1",s=0;s>5!==0)throw new Error("Non 5-bit word");n=Ms(n)^a,i+=Pf.charAt(a)}for(s=0;s<6;++s)n=Ms(n);for(n^=1,s=0;s<6;++s){var u=n>>(5-s)*5&31;i+=Pf.charAt(u)}return i}function qv(e,t){if(t=t||90,e.length<8)return e+" too short";if(e.length>t)return"Exceeds length limit";var r=e.toLowerCase(),n=e.toUpperCase();if(e!==r&&e!==n)return"Mixed-case string "+e;e=r;var i=e.lastIndexOf("1");if(i===-1)return"No separator character for "+e;if(i===0)return"Missing prefix for "+e;var s=e.slice(0,i),a=e.slice(i+1);if(a.length<6)return"Data too short";var u=Cv(s);if(typeof u=="string")return u;for(var l=[],c=0;c=a.length)&&l.push(w)}return u!==1?"Invalid checksum for "+e:{prefix:s,words:l}}function Vx(){var e=qv.apply(null,arguments);if(typeof e=="object")return e}function zx(e){var t=qv.apply(null,arguments);if(typeof t=="object")return t;throw new Error(t)}function Bf(e,t,r,n){for(var i=0,s=0,a=(1<=r;)s-=r,u.push(i>>s&a);if(n)s>0&&u.push(i<=t)return"Excess padding";if(i<{"use strict";Object.defineProperty(xh,"__esModule",{value:!0});var _h=Rr(),Jx=zt(),Nf=ke(),Mn=Sn(),At=ft(),Uv=Nf.OPS,Eh=pr(),kf=Rf(),Zx=Buffer.alloc(0);function Qx(e,t){if(!e.address&&!e.hash&&!e.output&&!e.pubkey&&!e.witness)throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),At({address:At.maybe(At.String),hash:At.maybe(At.BufferN(20)),input:At.maybe(At.BufferN(0)),network:At.maybe(At.Object),output:At.maybe(At.BufferN(22)),pubkey:At.maybe(Eh.isPoint),signature:At.maybe(Nf.isCanonicalScriptSignature),witness:At.maybe(At.arrayOf(At.Buffer))},e);let r=Mn.value(()=>{let s=kf.decode(e.address),a=s.words.shift(),u=kf.fromWords(s.words);return{version:a,prefix:s.prefix,data:Buffer.from(u)}}),n=e.network||Jx.bitcoin,i={name:"p2wpkh",network:n};if(Mn.prop(i,"address",()=>{if(!i.hash)return;let s=kf.toWords(i.hash);return s.unshift(0),kf.encode(n.bech32,s)}),Mn.prop(i,"hash",()=>{if(e.output)return e.output.slice(2,22);if(e.address)return r().data;if(e.pubkey||i.pubkey)return _h.hash160(e.pubkey||i.pubkey)}),Mn.prop(i,"output",()=>{if(!!i.hash)return Nf.compile([Uv.OP_0,i.hash])}),Mn.prop(i,"pubkey",()=>{if(e.pubkey)return e.pubkey;if(!!e.witness)return e.witness[1]}),Mn.prop(i,"signature",()=>{if(!!e.witness)return e.witness[0]}),Mn.prop(i,"input",()=>{if(!!i.witness)return Zx}),Mn.prop(i,"witness",()=>{if(!!e.pubkey&&!!e.signature)return[e.signature,e.pubkey]}),t.validate){let s=Buffer.from([]);if(e.address){if(n&&n.bech32!==r().prefix)throw new TypeError("Invalid prefix or Network mismatch");if(r().version!==0)throw new TypeError("Invalid address version");if(r().data.length!==20)throw new TypeError("Invalid address data");s=r().data}if(e.hash){if(s.length>0&&!s.equals(e.hash))throw new TypeError("Hash mismatch");s=e.hash}if(e.output){if(e.output.length!==22||e.output[0]!==Uv.OP_0||e.output[1]!==20)throw new TypeError("Output is invalid");if(s.length>0&&!s.equals(e.output.slice(2)))throw new TypeError("Hash mismatch");s=e.output.slice(2)}if(e.pubkey){let a=_h.hash160(e.pubkey);if(s.length>0&&!s.equals(a))throw new TypeError("Hash mismatch");if(s=a,!Eh.isPoint(e.pubkey)||e.pubkey.length!==33)throw new TypeError("Invalid pubkey for p2wpkh")}if(e.witness){if(e.witness.length!==2)throw new TypeError("Witness is invalid");if(!Nf.isCanonicalScriptSignature(e.witness[0]))throw new TypeError("Witness has invalid signature");if(!Eh.isPoint(e.witness[1])||e.witness[1].length!==33)throw new TypeError("Witness has invalid pubkey");if(e.signature&&!e.signature.equals(e.witness[0]))throw new TypeError("Signature mismatch");if(e.pubkey&&!e.pubkey.equals(e.witness[1]))throw new TypeError("Pubkey mismatch");let a=_h.hash160(e.witness[1]);if(s.length>0&&!s.equals(a))throw new TypeError("Hash mismatch")}}return Object.assign(i,e)}xh.p2wpkh=Qx});var Kv=T(Ih=>{"use strict";Object.defineProperty(Ih,"__esModule",{value:!0});var Hv=Rr(),e5=zt(),An=ke(),Qr=Sn(),tt=ft(),Fv=An.OPS,t5=pr(),Cf=Rf(),Sh=Buffer.alloc(0);function r5(e,t){return e.length!==t.length?!1:e.every((r,n)=>r.equals(t[n]))}function qf(e){return!!(Buffer.isBuffer(e)&&e.length===65&&e[0]===4&&t5.isPoint(e))}function n5(e,t){if(!e.address&&!e.hash&&!e.output&&!e.redeem&&!e.witness)throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),tt({network:tt.maybe(tt.Object),address:tt.maybe(tt.String),hash:tt.maybe(tt.BufferN(32)),output:tt.maybe(tt.BufferN(34)),redeem:tt.maybe({input:tt.maybe(tt.Buffer),network:tt.maybe(tt.Object),output:tt.maybe(tt.Buffer),witness:tt.maybe(tt.arrayOf(tt.Buffer))}),input:tt.maybe(tt.BufferN(0)),witness:tt.maybe(tt.arrayOf(tt.Buffer))},e);let r=Qr.value(()=>{let a=Cf.decode(e.address),u=a.words.shift(),l=Cf.fromWords(a.words);return{version:u,prefix:a.prefix,data:Buffer.from(l)}}),n=Qr.value(()=>An.decompile(e.redeem.input)),i=e.network;i||(i=e.redeem&&e.redeem.network||e5.bitcoin);let s={network:i};if(Qr.prop(s,"address",()=>{if(!s.hash)return;let a=Cf.toWords(s.hash);return a.unshift(0),Cf.encode(i.bech32,a)}),Qr.prop(s,"hash",()=>{if(e.output)return e.output.slice(2);if(e.address)return r().data;if(s.redeem&&s.redeem.output)return Hv.sha256(s.redeem.output)}),Qr.prop(s,"output",()=>{if(!!s.hash)return An.compile([Fv.OP_0,s.hash])}),Qr.prop(s,"redeem",()=>{if(!!e.witness)return{output:e.witness[e.witness.length-1],input:Sh,witness:e.witness.slice(0,-1)}}),Qr.prop(s,"input",()=>{if(!!s.witness)return Sh}),Qr.prop(s,"witness",()=>{if(e.redeem&&e.redeem.input&&e.redeem.input.length>0&&e.redeem.output&&e.redeem.output.length>0){let a=An.toStack(n());return s.redeem=Object.assign({witness:a},e.redeem),s.redeem.input=Sh,[].concat(a,e.redeem.output)}if(!!e.redeem&&!!e.redeem.output&&!!e.redeem.witness)return[].concat(e.redeem.witness,e.redeem.output)}),Qr.prop(s,"name",()=>{let a=["p2wsh"];return s.redeem!==void 0&&a.push(s.redeem.name),a.join("-")}),t.validate){let a=Buffer.from([]);if(e.address){if(r().prefix!==i.bech32)throw new TypeError("Invalid prefix or Network mismatch");if(r().version!==0)throw new TypeError("Invalid address version");if(r().data.length!==32)throw new TypeError("Invalid address data");a=r().data}if(e.hash){if(a.length>0&&!a.equals(e.hash))throw new TypeError("Hash mismatch");a=e.hash}if(e.output){if(e.output.length!==34||e.output[0]!==Fv.OP_0||e.output[1]!==32)throw new TypeError("Output is invalid");let u=e.output.slice(2);if(a.length>0&&!a.equals(u))throw new TypeError("Hash mismatch");a=u}if(e.redeem){if(e.redeem.network&&e.redeem.network!==i)throw new TypeError("Network mismatch");if(e.redeem.input&&e.redeem.input.length>0&&e.redeem.witness&&e.redeem.witness.length>0)throw new TypeError("Ambiguous witness source");if(e.redeem.output){if(An.decompile(e.redeem.output).length===0)throw new TypeError("Redeem.output is invalid");let u=Hv.sha256(e.redeem.output);if(a.length>0&&!a.equals(u))throw new TypeError("Hash mismatch");a=u}if(e.redeem.input&&!An.isPushOnly(n()))throw new TypeError("Non push-only scriptSig");if(e.witness&&e.redeem.witness&&!r5(e.witness,e.redeem.witness))throw new TypeError("Witness and redeem.witness mismatch");if(e.redeem.input&&n().some(qf)||e.redeem.output&&(An.decompile(e.redeem.output)||[]).some(qf))throw new TypeError("redeem.input or redeem.output contains uncompressed pubkey")}if(e.witness&&e.witness.length>0){let u=e.witness[e.witness.length-1];if(e.redeem&&e.redeem.output&&!e.redeem.output.equals(u))throw new TypeError("Witness and redeem.output mismatch");if(e.witness.some(qf)||(An.decompile(u)||[]).some(qf))throw new TypeError("Witness contains uncompressed pubkey")}}return Object.assign(s,e)}Ih.p2wsh=n5});var Oo=T(en=>{"use strict";Object.defineProperty(en,"__esModule",{value:!0});var i5=_v();en.embed=i5.p2data;var s5=Sv();en.p2ms=s5.p2ms;var o5=Mv();en.p2pk=o5.p2pk;var a5=Bv();en.p2pkh=a5.p2pkh;var f5=Nv();en.p2sh=f5.p2sh;var u5=Dv();en.p2wpkh=u5.p2wpkh;var c5=Kv();en.p2wsh=c5.p2wsh});var Uf=T(Pn=>{"use strict";Object.defineProperty(Pn,"__esModule",{value:!0});var Gv=zt(),On=Oo(),h5=ke(),Th=vr(),Lf=Rf(),Wv=ci(),l5=ft();function Vv(e){let t=Wv.decode(e);if(t.length<21)throw new TypeError(e+" is too short");if(t.length>21)throw new TypeError(e+" is too long");let r=t.readUInt8(0),n=t.slice(1);return{version:r,hash:n}}Pn.fromBase58Check=Vv;function zv(e){let t=Lf.decode(e),r=Lf.fromWords(t.words.slice(1));return{version:t.words[0],prefix:t.prefix,data:Buffer.from(r)}}Pn.fromBech32=zv;function d5(e,t){l5(Th.tuple(Th.Hash160bit,Th.UInt8),arguments);let r=Buffer.allocUnsafe(21);return r.writeUInt8(t,0),e.copy(r,1),Wv.encode(r)}Pn.toBase58Check=d5;function p5(e,t,r){let n=Lf.toWords(e);return n.unshift(t),Lf.encode(r,n)}Pn.toBech32=p5;function v5(e,t){t=t||Gv.bitcoin;try{return On.p2pkh({output:e,network:t}).address}catch{}try{return On.p2sh({output:e,network:t}).address}catch{}try{return On.p2wpkh({output:e,network:t}).address}catch{}try{return On.p2wsh({output:e,network:t}).address}catch{}throw new Error(h5.toASM(e)+" has no matching Address")}Pn.fromOutputScript=v5;function b5(e,t){t=t||Gv.bitcoin;let r,n;try{r=Vv(e)}catch{}if(r){if(r.version===t.pubKeyHash)return On.p2pkh({hash:r.hash}).output;if(r.version===t.scriptHash)return On.p2sh({hash:r.hash}).output}else{try{n=zv(e)}catch{}if(n){if(n.prefix!==t.bech32)throw new Error(e+" has an invalid prefix");if(n.version===0){if(n.data.length===20)return On.p2wpkh({hash:n.data}).output;if(n.data.length===32)return On.p2wsh({hash:n.data}).output}}}throw new Error(e+" has no matching Script")}Pn.toOutputScript=b5});var jv=T(($R,$v)=>{$v.exports=require("crypto").randomBytes});var Hf=T(As=>{"use strict";Object.defineProperty(As,"__esModule",{value:!0});var Xv=zt(),_i=vr(),tn=pr(),g5=jv(),Bn=ft(),Yv=oh(),Mh=Bn.maybe(Bn.compile({compressed:_i.maybe(_i.Boolean),network:_i.maybe(_i.Network)})),Df=class{constructor(t,r,n){this.__D=t,this.__Q=r,this.lowR=!1,n===void 0&&(n={}),this.compressed=n.compressed===void 0?!0:n.compressed,this.network=n.network||Xv.bitcoin,r!==void 0&&(this.__Q=tn.pointCompress(r,this.compressed))}get privateKey(){return this.__D}get publicKey(){return this.__Q||(this.__Q=tn.pointFromScalar(this.__D,this.compressed)),this.__Q}toWIF(){if(!this.__D)throw new Error("Missing private key");return Yv.encode(this.network.wif,this.__D,this.compressed)}sign(t,r){if(!this.__D)throw new Error("Missing private key");if(r===void 0&&(r=this.lowR),r===!1)return tn.sign(t,this.__D);{let n=tn.sign(t,this.__D),i=Buffer.alloc(32,0),s=0;for(;n[0]>127;)s++,i.writeUIntLE(s,0,6),n=tn.signWithEntropy(t,this.__D,i);return n}}verify(t,r){return tn.verify(t,this.publicKey,r)}};function Ah(e,t){if(Bn(_i.Buffer256bit,e),!tn.isPrivate(e))throw new TypeError("Private key not in range [1, n)");return Bn(Mh,t),new Df(e,void 0,t)}As.fromPrivateKey=Ah;function m5(e,t){return Bn(tn.isPoint,e),Bn(Mh,t),new Df(void 0,e,t)}As.fromPublicKey=m5;function y5(e,t){let r=Yv.decode(e),n=r.version;if(_i.Array(t)){if(t=t.filter(i=>n===i.wif).pop(),!t)throw new Error("Unknown network version")}else if(t=t||Xv.bitcoin,n!==t.wif)throw new Error("Invalid network version");return Ah(r.privateKey,{compressed:r.compressed,network:t})}As.fromWIF=y5;function w5(e){Bn(Mh,e),e===void 0&&(e={});let t=e.rng||g5,r;do r=t(32),Bn(_i.Buffer256bit,r);while(!tn.isPrivate(r));return Ah(r,e)}As.makeRandom=w5});var Ro=T((XR,Zv)=>{"use strict";var Oh=qt().Buffer,_5=9007199254740991;function Ph(e){if(e<0||e>_5||e%1!==0)throw new RangeError("value out of range")}function Po(e,t,r){if(Ph(e),t||(t=Oh.allocUnsafe(Jv(e))),!Oh.isBuffer(t))throw new TypeError("buffer must be a Buffer instance");return r||(r=0),e<253?(t.writeUInt8(e,r),Po.bytes=1):e<=65535?(t.writeUInt8(253,r),t.writeUInt16LE(e,r+1),Po.bytes=3):e<=4294967295?(t.writeUInt8(254,r),t.writeUInt32LE(e,r+1),Po.bytes=5):(t.writeUInt8(255,r),t.writeUInt32LE(e>>>0,r+1),t.writeUInt32LE(e/4294967296|0,r+5),Po.bytes=9),t}function Bo(e,t){if(!Oh.isBuffer(e))throw new TypeError("buffer must be a Buffer instance");t||(t=0);var r=e.readUInt8(t);if(r<253)return Bo.bytes=1,r;if(r===253)return Bo.bytes=3,e.readUInt16LE(t+1);if(r===254)return Bo.bytes=5,e.readUInt32LE(t+1);Bo.bytes=9;var n=e.readUInt32LE(t+1),i=e.readUInt32LE(t+5),s=i*4294967296+n;return Ph(s),s}function Jv(e){return Ph(e),e<253?1:e<=65535?3:e<=4294967295?5:9}Zv.exports={encode:Po,decode:Bo,encodingLength:Jv}});var ko=T(Rn=>{"use strict";Object.defineProperty(Rn,"__esModule",{value:!0});var Os=vr(),Qv=ft(),Ff=Ro();function eb(e,t){if(typeof e!="number")throw new Error("cannot write a non-number as a number");if(e<0)throw new Error("specified a negative value for writing an unsigned value");if(e>t)throw new Error("RangeError: value out of range");if(Math.floor(e)!==e)throw new Error("value has a fractional component")}function tb(e,t){let r=e.readUInt32LE(t),n=e.readUInt32LE(t+4);return n*=4294967296,eb(n+r,9007199254740991),n+r}Rn.readUInt64LE=tb;function rb(e,t,r){return eb(t,9007199254740991),e.writeInt32LE(t&-1,r),e.writeUInt32LE(Math.floor(t/4294967296),r+4),r+8}Rn.writeUInt64LE=rb;function E5(e){if(e.length<1)return e;let t=e.length-1,r=0;for(let n=0;nthis.writeVarSlice(r))}};Rn.BufferWriter=Bh;var Rh=class{constructor(t,r=0){this.buffer=t,this.offset=r,Qv(Os.tuple(Os.Buffer,Os.UInt32),[t,r])}readUInt8(){let t=this.buffer.readUInt8(this.offset);return this.offset++,t}readInt32(){let t=this.buffer.readInt32LE(this.offset);return this.offset+=4,t}readUInt32(){let t=this.buffer.readUInt32LE(this.offset);return this.offset+=4,t}readUInt64(){let t=tb(this.buffer,this.offset);return this.offset+=8,t}readVarInt(){let t=Ff.decode(this.buffer,this.offset);return this.offset+=Ff.decode.bytes,t}readSlice(t){if(this.buffer.length{"use strict";Object.defineProperty(Ch,"__esModule",{value:!0});var kn=ko(),Ei=Rr(),nb=ke(),S5=ke(),ze=vr(),xi=ft(),Kf=Ro();function Ps(e){let t=e.length;return Kf.encodingLength(t)+t}function I5(e){let t=e.length;return Kf.encodingLength(t)+e.reduce((r,n)=>r+Ps(n),0)}var Nh=Buffer.allocUnsafe(0),ib=[],kh=Buffer.from("0000000000000000000000000000000000000000000000000000000000000000","hex"),sb=Buffer.from("0000000000000000000000000000000000000000000000000000000000000001","hex"),T5=Buffer.from("ffffffffffffffff","hex"),M5={script:Nh,valueBuffer:T5};function A5(e){return e.value!==void 0}var Ge=class{constructor(){this.version=1,this.locktime=0,this.ins=[],this.outs=[]}static fromBuffer(t,r){let n=new kn.BufferReader(t),i=new Ge;i.version=n.readInt32();let s=n.readUInt8(),a=n.readUInt8(),u=!1;s===Ge.ADVANCED_TRANSACTION_MARKER&&a===Ge.ADVANCED_TRANSACTION_FLAG?u=!0:n.offset-=2;let l=n.readVarInt();for(let p=0;pt.witness.length!==0)}weight(){let t=this.byteLength(!1),r=this.byteLength(!0);return t*3+r}virtualSize(){return Math.ceil(this.weight()/4)}byteLength(t=!0){let r=t&&this.hasWitnesses();return(r?10:8)+Kf.encodingLength(this.ins.length)+Kf.encodingLength(this.outs.length)+this.ins.reduce((n,i)=>n+40+Ps(i.script),0)+this.outs.reduce((n,i)=>n+8+Ps(i.script),0)+(r?this.ins.reduce((n,i)=>n+I5(i.witness),0):0)}clone(){let t=new Ge;return t.version=this.version,t.locktime=this.locktime,t.ins=this.ins.map(r=>({hash:r.hash,index:r.index,script:r.script,sequence:r.sequence,witness:r.witness})),t.outs=this.outs.map(r=>({script:r.script,value:r.value})),t}hashForSignature(t,r,n){if(xi(ze.tuple(ze.UInt32,ze.Buffer,ze.Number),arguments),t>=this.ins.length)return sb;let i=nb.compile(nb.decompile(r).filter(u=>u!==S5.OPS.OP_CODESEPARATOR)),s=this.clone();if((n&31)===Ge.SIGHASH_NONE)s.outs=[],s.ins.forEach((u,l)=>{l!==t&&(u.sequence=0)});else if((n&31)===Ge.SIGHASH_SINGLE){if(t>=this.outs.length)return sb;s.outs.length=t+1;for(let u=0;u{l!==t&&(u.sequence=0)})}n&Ge.SIGHASH_ANYONECANPAY?(s.ins=[s.ins[t]],s.ins[0].script=i):(s.ins.forEach(u=>{u.script=Nh}),s.ins[t].script=i);let a=Buffer.allocUnsafe(s.byteLength(!1)+4);return a.writeInt32LE(n,a.length-4),s.__toBuffer(a,0,!1),Ei.hash256(a)}hashForWitnessV0(t,r,n,i){xi(ze.tuple(ze.UInt32,ze.Buffer,ze.Satoshi,ze.UInt32),arguments);let s=Buffer.from([]),a,u=kh,l=kh,c=kh;if(i&Ge.SIGHASH_ANYONECANPAY||(s=Buffer.allocUnsafe(36*this.ins.length),a=new kn.BufferWriter(s,0),this.ins.forEach(w=>{a.writeSlice(w.hash),a.writeUInt32(w.index)}),l=Ei.hash256(s)),!(i&Ge.SIGHASH_ANYONECANPAY)&&(i&31)!==Ge.SIGHASH_SINGLE&&(i&31)!==Ge.SIGHASH_NONE&&(s=Buffer.allocUnsafe(4*this.ins.length),a=new kn.BufferWriter(s,0),this.ins.forEach(w=>{a.writeUInt32(w.sequence)}),c=Ei.hash256(s)),(i&31)!==Ge.SIGHASH_SINGLE&&(i&31)!==Ge.SIGHASH_NONE){let w=this.outs.reduce((x,S)=>x+8+Ps(S.script),0);s=Buffer.allocUnsafe(w),a=new kn.BufferWriter(s,0),this.outs.forEach(x=>{a.writeUInt64(x.value),a.writeVarSlice(x.script)}),u=Ei.hash256(s)}else if((i&31)===Ge.SIGHASH_SINGLE&&t{i.writeSlice(a.hash),i.writeUInt32(a.index),i.writeVarSlice(a.script),i.writeUInt32(a.sequence)}),i.writeVarInt(this.outs.length),this.outs.forEach(a=>{A5(a)?i.writeUInt64(a.value):i.writeSlice(a.valueBuffer),i.writeVarSlice(a.script)}),s&&this.ins.forEach(a=>{i.writeVector(a.witness)}),i.writeUInt32(this.locktime),r!==void 0?t.slice(r,i.offset):t}};Ge.DEFAULT_SEQUENCE=4294967295;Ge.SIGHASH_ALL=1;Ge.SIGHASH_NONE=2;Ge.SIGHASH_SINGLE=3;Ge.SIGHASH_ANYONECANPAY=128;Ge.ADVANCED_TRANSACTION_MARKER=0;Ge.ADVANCED_TRANSACTION_FLAG=1;Ch.Transaction=Ge});var ab=T((ZR,ob)=>{ob.exports=function(t,r){if(!Array.isArray(t))throw TypeError("Expected values Array");if(typeof r!="function")throw TypeError("Expected digest Function");for(var n=t.length,i=t.concat();n>1;){for(var s=0,a=0;a{"use strict";Object.defineProperty(Dh,"__esModule",{value:!0});var Gf=ko(),qh=Rr(),O5=No(),P5=vr(),B5=ab(),R5=ft(),Lh=Ro(),Uh=new TypeError("Cannot compute merkle root for zero transactions"),fb=new TypeError("Cannot compute witness commit for non-segwit block"),rn=class{constructor(){this.version=1,this.prevHash=void 0,this.merkleRoot=void 0,this.timestamp=0,this.witnessCommit=void 0,this.bits=0,this.nonce=0,this.transactions=void 0}static fromBuffer(t){if(t.length<80)throw new Error("Buffer too small (< 80 bytes)");let r=new Gf.BufferReader(t),n=new rn;if(n.version=r.readInt32(),n.prevHash=r.readSlice(32),n.merkleRoot=r.readSlice(32),n.timestamp=r.readUInt32(),n.bits=r.readUInt32(),n.nonce=r.readUInt32(),t.length===80)return n;let i=()=>{let u=O5.Transaction.fromBuffer(r.buffer.slice(r.offset),!0);return r.offset+=u.byteLength(),u},s=r.readVarInt();n.transactions=[];for(let u=0;u>24)-3,n=t&8388607,i=Buffer.alloc(32,0);return i.writeUIntBE(n,29-r,3),i}static calculateMerkleRoot(t,r){if(R5([{getHash:P5.Function}],t),t.length===0)throw Uh;if(r&&!ub(t))throw fb;let n=t.map(s=>s.getHash(r)),i=B5(n,qh.hash256);return r?qh.hash256(Buffer.concat([i,t[0].ins[0].witness[0]])):i}getWitnessCommit(){if(!ub(this.transactions))return null;let t=this.transactions[0].outs.filter(n=>n.script.slice(0,6).equals(Buffer.from("6a24aa21a9ed","hex"))).map(n=>n.script.slice(6,38));if(t.length===0)return null;let r=t[t.length-1];return r instanceof Buffer&&r.length===32?r:null}hasWitnessCommit(){return this.witnessCommit instanceof Buffer&&this.witnessCommit.length===32||this.getWitnessCommit()!==null}hasWitness(){return k5(this.transactions)}weight(){let t=this.byteLength(!1,!1),r=this.byteLength(!1,!0);return t*3+r}byteLength(t,r=!0){return t||!this.transactions?80:80+Lh.encodingLength(this.transactions.length)+this.transactions.reduce((n,i)=>n+i.byteLength(r),0)}getHash(){return qh.hash256(this.toBuffer(!0))}getId(){return Gf.reverseBuffer(this.getHash()).toString("hex")}getUTCDate(){let t=new Date(0);return t.setUTCSeconds(this.timestamp),t}toBuffer(t){let r=Buffer.allocUnsafe(this.byteLength(t)),n=new Gf.BufferWriter(r);return n.writeInt32(this.version),n.writeSlice(this.prevHash),n.writeSlice(this.merkleRoot),n.writeUInt32(this.timestamp),n.writeUInt32(this.bits),n.writeUInt32(this.nonce),t||!this.transactions||(Lh.encode(this.transactions.length,r,n.offset),n.offset+=Lh.encode.bytes,this.transactions.forEach(i=>{let s=i.byteLength();i.toBuffer(r,n.offset),n.offset+=s})),r}toHex(t){return this.toBuffer(t).toString("hex")}checkTxRoots(){let t=this.hasWitnessCommit();return!t&&this.hasWitness()?!1:this.__checkMerkleRoot()&&(t?this.__checkWitnessCommit():!0)}checkProofOfWork(){let t=Gf.reverseBuffer(this.getHash()),r=rn.calculateTarget(this.bits);return t.compare(r)<=0}__checkMerkleRoot(){if(!this.transactions)throw Uh;let t=rn.calculateMerkleRoot(this.transactions);return this.merkleRoot.compare(t)===0}__checkWitnessCommit(){if(!this.transactions)throw Uh;if(!this.hasWitnessCommit())throw fb;let t=rn.calculateMerkleRoot(this.transactions,!0);return this.witnessCommit.compare(t)===0}};Dh.Block=rn;function ub(e){return e instanceof Array&&e[0]&&e[0].ins&&e[0].ins instanceof Array&&e[0].ins[0]&&e[0].ins[0].witness&&e[0].ins[0].witness instanceof Array&&e[0].ins[0].witness.length>0}function k5(e){return e instanceof Array&&e.some(t=>typeof t=="object"&&t.ins instanceof Array&&t.ins.some(r=>typeof r=="object"&&r.witness instanceof Array&&r.witness.length>0))}});var vt=T(br=>{"use strict";Object.defineProperty(br,"__esModule",{value:!0});var N5;(function(e){e[e.UNSIGNED_TX=0]="UNSIGNED_TX",e[e.GLOBAL_XPUB=1]="GLOBAL_XPUB"})(N5=br.GlobalTypes||(br.GlobalTypes={}));br.GLOBAL_TYPE_NAMES=["unsignedTx","globalXpub"];var C5;(function(e){e[e.NON_WITNESS_UTXO=0]="NON_WITNESS_UTXO",e[e.WITNESS_UTXO=1]="WITNESS_UTXO",e[e.PARTIAL_SIG=2]="PARTIAL_SIG",e[e.SIGHASH_TYPE=3]="SIGHASH_TYPE",e[e.REDEEM_SCRIPT=4]="REDEEM_SCRIPT",e[e.WITNESS_SCRIPT=5]="WITNESS_SCRIPT",e[e.BIP32_DERIVATION=6]="BIP32_DERIVATION",e[e.FINAL_SCRIPTSIG=7]="FINAL_SCRIPTSIG",e[e.FINAL_SCRIPTWITNESS=8]="FINAL_SCRIPTWITNESS",e[e.POR_COMMITMENT=9]="POR_COMMITMENT",e[e.TAP_KEY_SIG=19]="TAP_KEY_SIG",e[e.TAP_SCRIPT_SIG=20]="TAP_SCRIPT_SIG",e[e.TAP_LEAF_SCRIPT=21]="TAP_LEAF_SCRIPT",e[e.TAP_BIP32_DERIVATION=22]="TAP_BIP32_DERIVATION",e[e.TAP_INTERNAL_KEY=23]="TAP_INTERNAL_KEY",e[e.TAP_MERKLE_ROOT=24]="TAP_MERKLE_ROOT"})(C5=br.InputTypes||(br.InputTypes={}));br.INPUT_TYPE_NAMES=["nonWitnessUtxo","witnessUtxo","partialSig","sighashType","redeemScript","witnessScript","bip32Derivation","finalScriptSig","finalScriptWitness","porCommitment","tapKeySig","tapScriptSig","tapLeafScript","tapBip32Derivation","tapInternalKey","tapMerkleRoot"];var q5;(function(e){e[e.REDEEM_SCRIPT=0]="REDEEM_SCRIPT",e[e.WITNESS_SCRIPT=1]="WITNESS_SCRIPT",e[e.BIP32_DERIVATION=2]="BIP32_DERIVATION",e[e.TAP_INTERNAL_KEY=5]="TAP_INTERNAL_KEY",e[e.TAP_TREE=6]="TAP_TREE",e[e.TAP_BIP32_DERIVATION=7]="TAP_BIP32_DERIVATION"})(q5=br.OutputTypes||(br.OutputTypes={}));br.OUTPUT_TYPE_NAMES=["redeemScript","witnessScript","bip32Derivation","tapInternalKey","tapTree","tapBip32Derivation"]});var lb=T(Si=>{"use strict";Object.defineProperty(Si,"__esModule",{value:!0});var hb=vt(),L5=e=>[...Array(e).keys()];function U5(e){if(e.key[0]!==hb.GlobalTypes.GLOBAL_XPUB)throw new Error("Decode Error: could not decode globalXpub with key 0x"+e.key.toString("hex"));if(e.key.length!==79||![2,3].includes(e.key[46]))throw new Error("Decode Error: globalXpub has invalid extended pubkey in key 0x"+e.key.toString("hex"));if(e.value.length/4%1!==0)throw new Error("Decode Error: Global GLOBAL_XPUB value length should be multiple of 4");let t=e.key.slice(1),r={masterFingerprint:e.value.slice(0,4),extendedPubkey:t,path:"m"};for(let n of L5(e.value.length/4-1)){let i=e.value.readUInt32LE(n*4+4),s=!!(i&2147483648),a=i&2147483647;r.path+="/"+a.toString(10)+(s?"'":"")}return r}Si.decode=U5;function D5(e){let t=Buffer.from([hb.GlobalTypes.GLOBAL_XPUB]),r=Buffer.concat([t,e.extendedPubkey]),n=e.path.split("/"),i=Buffer.allocUnsafe(n.length*4);e.masterFingerprint.copy(i,0);let s=4;return n.slice(1).forEach(a=>{let u=a.slice(-1)==="'",l=2147483647&parseInt(u?a.slice(0,-1):a,10);u&&(l+=2147483648),i.writeUInt32LE(l,s),s+=4}),{key:r,value:i}}Si.encode=D5;Si.expected="{ masterFingerprint: Buffer; extendedPubkey: Buffer; path: string; }";function H5(e){let t=e.extendedPubkey,r=e.masterFingerprint,n=e.path;return Buffer.isBuffer(t)&&t.length===78&&[2,3].indexOf(t[45])>-1&&Buffer.isBuffer(r)&&r.length===4&&typeof n=="string"&&!!n.match(/^m(\/\d+'?)*$/)}Si.check=H5;function F5(e,t,r){let n=t.extendedPubkey.toString("hex");return r.has(n)?!1:(r.add(n),e.filter(i=>i.extendedPubkey.equals(t.extendedPubkey)).length===0)}Si.canAddToArray=F5});var db=T(Hh=>{"use strict";Object.defineProperty(Hh,"__esModule",{value:!0});var K5=vt();function G5(e){return{key:Buffer.from([K5.GlobalTypes.UNSIGNED_TX]),value:e.toBuffer()}}Hh.encode=G5});var vb=T(Ii=>{"use strict";Object.defineProperty(Ii,"__esModule",{value:!0});var pb=vt();function W5(e){if(e.key[0]!==pb.InputTypes.FINAL_SCRIPTSIG)throw new Error("Decode Error: could not decode finalScriptSig with key 0x"+e.key.toString("hex"));return e.value}Ii.decode=W5;function V5(e){return{key:Buffer.from([pb.InputTypes.FINAL_SCRIPTSIG]),value:e}}Ii.encode=V5;Ii.expected="Buffer";function z5(e){return Buffer.isBuffer(e)}Ii.check=z5;function $5(e,t){return!!e&&!!t&&e.finalScriptSig===void 0}Ii.canAdd=$5});var gb=T(Ti=>{"use strict";Object.defineProperty(Ti,"__esModule",{value:!0});var bb=vt();function j5(e){if(e.key[0]!==bb.InputTypes.FINAL_SCRIPTWITNESS)throw new Error("Decode Error: could not decode finalScriptWitness with key 0x"+e.key.toString("hex"));return e.value}Ti.decode=j5;function X5(e){return{key:Buffer.from([bb.InputTypes.FINAL_SCRIPTWITNESS]),value:e}}Ti.encode=X5;Ti.expected="Buffer";function Y5(e){return Buffer.isBuffer(e)}Ti.check=Y5;function J5(e,t){return!!e&&!!t&&e.finalScriptWitness===void 0}Ti.canAdd=J5});var yb=T(Mi=>{"use strict";Object.defineProperty(Mi,"__esModule",{value:!0});var mb=vt();function Z5(e){if(e.key[0]!==mb.InputTypes.NON_WITNESS_UTXO)throw new Error("Decode Error: could not decode nonWitnessUtxo with key 0x"+e.key.toString("hex"));return e.value}Mi.decode=Z5;function Q5(e){return{key:Buffer.from([mb.InputTypes.NON_WITNESS_UTXO]),value:e}}Mi.encode=Q5;Mi.expected="Buffer";function eS(e){return Buffer.isBuffer(e)}Mi.check=eS;function tS(e,t){return!!e&&!!t&&e.nonWitnessUtxo===void 0}Mi.canAdd=tS});var _b=T(Ai=>{"use strict";Object.defineProperty(Ai,"__esModule",{value:!0});var wb=vt();function rS(e){if(e.key[0]!==wb.InputTypes.PARTIAL_SIG)throw new Error("Decode Error: could not decode partialSig with key 0x"+e.key.toString("hex"));if(!(e.key.length===34||e.key.length===66)||![2,3,4].includes(e.key[1]))throw new Error("Decode Error: partialSig has invalid pubkey in key 0x"+e.key.toString("hex"));return{pubkey:e.key.slice(1),signature:e.value}}Ai.decode=rS;function nS(e){let t=Buffer.from([wb.InputTypes.PARTIAL_SIG]);return{key:Buffer.concat([t,e.pubkey]),value:e.signature}}Ai.encode=nS;Ai.expected="{ pubkey: Buffer; signature: Buffer; }";function iS(e){return Buffer.isBuffer(e.pubkey)&&Buffer.isBuffer(e.signature)&&[33,65].includes(e.pubkey.length)&&[2,3,4].includes(e.pubkey[0])&&sS(e.signature)}Ai.check=iS;function sS(e){if(!Buffer.isBuffer(e)||e.length<9||e[0]!==48||e.length!==e[1]+3||e[2]!==2)return!1;let t=e[3];if(t>33||t<1||e[3+t+1]!==2)return!1;let r=e[3+t+2];return!(r>33||r<1||e.length!==3+t+2+r+2)}function oS(e,t,r){let n=t.pubkey.toString("hex");return r.has(n)?!1:(r.add(n),e.filter(i=>i.pubkey.equals(t.pubkey)).length===0)}Ai.canAddToArray=oS});var xb=T(Oi=>{"use strict";Object.defineProperty(Oi,"__esModule",{value:!0});var Eb=vt();function aS(e){if(e.key[0]!==Eb.InputTypes.POR_COMMITMENT)throw new Error("Decode Error: could not decode porCommitment with key 0x"+e.key.toString("hex"));return e.value.toString("utf8")}Oi.decode=aS;function fS(e){return{key:Buffer.from([Eb.InputTypes.POR_COMMITMENT]),value:Buffer.from(e,"utf8")}}Oi.encode=fS;Oi.expected="string";function uS(e){return typeof e=="string"}Oi.check=uS;function cS(e,t){return!!e&&!!t&&e.porCommitment===void 0}Oi.canAdd=cS});var Ib=T(Pi=>{"use strict";Object.defineProperty(Pi,"__esModule",{value:!0});var Sb=vt();function hS(e){if(e.key[0]!==Sb.InputTypes.SIGHASH_TYPE)throw new Error("Decode Error: could not decode sighashType with key 0x"+e.key.toString("hex"));return e.value.readUInt32LE(0)}Pi.decode=hS;function lS(e){let t=Buffer.from([Sb.InputTypes.SIGHASH_TYPE]),r=Buffer.allocUnsafe(4);return r.writeUInt32LE(e,0),{key:t,value:r}}Pi.encode=lS;Pi.expected="number";function dS(e){return typeof e=="number"}Pi.check=dS;function pS(e,t){return!!e&&!!t&&e.sighashType===void 0}Pi.canAdd=pS});var Ab=T(Bi=>{"use strict";Object.defineProperty(Bi,"__esModule",{value:!0});var Tb=vt();function vS(e){if(e.key[0]!==Tb.InputTypes.TAP_KEY_SIG||e.key.length!==1)throw new Error("Decode Error: could not decode tapKeySig with key 0x"+e.key.toString("hex"));if(!Mb(e.value))throw new Error("Decode Error: tapKeySig not a valid 64-65-byte BIP340 signature");return e.value}Bi.decode=vS;function bS(e){return{key:Buffer.from([Tb.InputTypes.TAP_KEY_SIG]),value:e}}Bi.encode=bS;Bi.expected="Buffer";function Mb(e){return Buffer.isBuffer(e)&&(e.length===64||e.length===65)}Bi.check=Mb;function gS(e,t){return!!e&&!!t&&e.tapKeySig===void 0}Bi.canAdd=gS});var Pb=T(Ri=>{"use strict";Object.defineProperty(Ri,"__esModule",{value:!0});var Ob=vt();function mS(e){if(e.key[0]!==Ob.InputTypes.TAP_LEAF_SCRIPT)throw new Error("Decode Error: could not decode tapLeafScript with key 0x"+e.key.toString("hex"));if((e.key.length-2)%32!==0)throw new Error("Decode Error: tapLeafScript has invalid control block in key 0x"+e.key.toString("hex"));let t=e.value[e.value.length-1];if((e.key[1]&254)!==t)throw new Error("Decode Error: tapLeafScript bad leaf version in key 0x"+e.key.toString("hex"));let r=e.value.slice(0,-1);return{controlBlock:e.key.slice(1),script:r,leafVersion:t}}Ri.decode=mS;function yS(e){let t=Buffer.from([Ob.InputTypes.TAP_LEAF_SCRIPT]),r=Buffer.from([e.leafVersion]);return{key:Buffer.concat([t,e.controlBlock]),value:Buffer.concat([e.script,r])}}Ri.encode=yS;Ri.expected="{ controlBlock: Buffer; leafVersion: number, script: Buffer; }";function wS(e){return Buffer.isBuffer(e.controlBlock)&&(e.controlBlock.length-1)%32===0&&(e.controlBlock[0]&254)===e.leafVersion&&Buffer.isBuffer(e.script)}Ri.check=wS;function _S(e,t,r){let n=t.controlBlock.toString("hex");return r.has(n)?!1:(r.add(n),e.filter(i=>i.controlBlock.equals(t.controlBlock)).length===0)}Ri.canAddToArray=_S});var kb=T(ki=>{"use strict";Object.defineProperty(ki,"__esModule",{value:!0});var Bb=vt();function ES(e){if(e.key[0]!==Bb.InputTypes.TAP_MERKLE_ROOT||e.key.length!==1)throw new Error("Decode Error: could not decode tapMerkleRoot with key 0x"+e.key.toString("hex"));if(!Rb(e.value))throw new Error("Decode Error: tapMerkleRoot not a 32-byte hash");return e.value}ki.decode=ES;function xS(e){return{key:Buffer.from([Bb.InputTypes.TAP_MERKLE_ROOT]),value:e}}ki.encode=xS;ki.expected="Buffer";function Rb(e){return Buffer.isBuffer(e)&&e.length===32}ki.check=Rb;function SS(e,t){return!!e&&!!t&&e.tapMerkleRoot===void 0}ki.canAdd=SS});var Cb=T(Ni=>{"use strict";Object.defineProperty(Ni,"__esModule",{value:!0});var Nb=vt();function IS(e){if(e.key[0]!==Nb.InputTypes.TAP_SCRIPT_SIG)throw new Error("Decode Error: could not decode tapScriptSig with key 0x"+e.key.toString("hex"));if(e.key.length!==65)throw new Error("Decode Error: tapScriptSig has invalid key 0x"+e.key.toString("hex"));if(e.value.length!==64&&e.value.length!==65)throw new Error("Decode Error: tapScriptSig has invalid signature in key 0x"+e.key.toString("hex"));let t=e.key.slice(1,33),r=e.key.slice(33);return{pubkey:t,leafHash:r,signature:e.value}}Ni.decode=IS;function TS(e){let t=Buffer.from([Nb.InputTypes.TAP_SCRIPT_SIG]);return{key:Buffer.concat([t,e.pubkey,e.leafHash]),value:e.signature}}Ni.encode=TS;Ni.expected="{ pubkey: Buffer; leafHash: Buffer; signature: Buffer; }";function MS(e){return Buffer.isBuffer(e.pubkey)&&Buffer.isBuffer(e.leafHash)&&Buffer.isBuffer(e.signature)&&e.pubkey.length===32&&e.leafHash.length===32&&(e.signature.length===64||e.signature.length===65)}Ni.check=MS;function AS(e,t,r){let n=t.pubkey.toString("hex")+t.leafHash.toString("hex");return r.has(n)?!1:(r.add(n),e.filter(i=>i.pubkey.equals(t.pubkey)&&i.leafHash.equals(t.leafHash)).length===0)}Ni.canAddToArray=AS});var Ci=T(Lo=>{"use strict";Object.defineProperty(Lo,"__esModule",{value:!0});var OS=9007199254740991;function Fh(e){if(e<0||e>OS||e%1!==0)throw new RangeError("value out of range")}function Co(e,t,r){if(Fh(e),t||(t=Buffer.allocUnsafe(qb(e))),!Buffer.isBuffer(t))throw new TypeError("buffer must be a Buffer instance");return r||(r=0),e<253?(t.writeUInt8(e,r),Object.assign(Co,{bytes:1})):e<=65535?(t.writeUInt8(253,r),t.writeUInt16LE(e,r+1),Object.assign(Co,{bytes:3})):e<=4294967295?(t.writeUInt8(254,r),t.writeUInt32LE(e,r+1),Object.assign(Co,{bytes:5})):(t.writeUInt8(255,r),t.writeUInt32LE(e>>>0,r+1),t.writeUInt32LE(e/4294967296|0,r+5),Object.assign(Co,{bytes:9})),t}Lo.encode=Co;function qo(e,t){if(!Buffer.isBuffer(e))throw new TypeError("buffer must be a Buffer instance");t||(t=0);let r=e.readUInt8(t);if(r<253)return Object.assign(qo,{bytes:1}),r;if(r===253)return Object.assign(qo,{bytes:3}),e.readUInt16LE(t+1);if(r===254)return Object.assign(qo,{bytes:5}),e.readUInt32LE(t+1);{Object.assign(qo,{bytes:9});let n=e.readUInt32LE(t+1),s=e.readUInt32LE(t+5)*4294967296+n;return Fh(s),s}}Lo.decode=qo;function qb(e){return Fh(e),e<253?1:e<=65535?3:e<=4294967295?5:9}Lo.encodingLength=qb});var Vf=T(Nn=>{"use strict";Object.defineProperty(Nn,"__esModule",{value:!0});var Wf=Ci();Nn.range=e=>[...Array(e).keys()];function PS(e){if(e.length<1)return e;let t=e.length-1,r=0;for(let n=0;nt)throw new Error("RangeError: value out of range");if(Math.floor(e)!==e)throw new Error("value has a fractional component")}function RS(e,t){let r=e.readUInt32LE(t),n=e.readUInt32LE(t+4);return n*=4294967296,Ub(n+r,9007199254740991),n+r}Nn.readUInt64LE=RS;function kS(e,t,r){return Ub(t,9007199254740991),e.writeInt32LE(t&-1,r),e.writeUInt32LE(Math.floor(t/4294967296),r+4),r+8}Nn.writeUInt64LE=kS});var Fb=T(qi=>{"use strict";Object.defineProperty(qi,"__esModule",{value:!0});var Db=vt(),Hb=Vf(),zf=Ci();function NS(e){if(e.key[0]!==Db.InputTypes.WITNESS_UTXO)throw new Error("Decode Error: could not decode witnessUtxo with key 0x"+e.key.toString("hex"));let t=Hb.readUInt64LE(e.value,0),r=8,n=zf.decode(e.value,r);r+=zf.encodingLength(n);let i=e.value.slice(r);if(i.length!==n)throw new Error("Decode Error: WITNESS_UTXO script is not proper length");return{script:i,value:t}}qi.decode=NS;function CS(e){let{script:t,value:r}=e,n=zf.encodingLength(t.length),i=Buffer.allocUnsafe(8+n+t.length);return Hb.writeUInt64LE(i,r,0),zf.encode(t.length,i,8),t.copy(i,8+n),{key:Buffer.from([Db.InputTypes.WITNESS_UTXO]),value:i}}qi.encode=CS;qi.expected="{ script: Buffer; value: number; }";function qS(e){return Buffer.isBuffer(e.script)&&typeof e.value=="number"}qi.check=qS;function LS(e,t){return!!e&&!!t&&e.witnessUtxo===void 0}qi.canAdd=LS});var Gb=T(Li=>{"use strict";Object.defineProperty(Li,"__esModule",{value:!0});var Kb=vt(),Kh=Ci();function US(e){if(e.key[0]!==Kb.OutputTypes.TAP_TREE||e.key.length!==1)throw new Error("Decode Error: could not decode tapTree with key 0x"+e.key.toString("hex"));let t=0,r=[];for(;t[Buffer.of(n.depth,n.leafVersion),Kh.encode(n.script.length),n.script]));return{key:t,value:Buffer.concat(r)}}Li.encode=DS;Li.expected="{ leaves: [{ depth: number; leafVersion: number, script: Buffer; }] }";function HS(e){return Array.isArray(e.leaves)&&e.leaves.every(t=>t.depth>=0&&t.depth<=128&&(t.leafVersion&254)===t.leafVersion&&Buffer.isBuffer(t.script))}Li.check=HS;function FS(e,t){return!!e&&!!t&&e.tapTree===void 0}Li.canAdd=FS});var Wh=T(Gh=>{"use strict";Object.defineProperty(Gh,"__esModule",{value:!0});var KS=e=>[...Array(e).keys()],GS=e=>e.length===33&&[2,3].includes(e[0])||e.length===65&&e[0]===4;function WS(e,t=GS){function r(u){if(u.key[0]!==e)throw new Error("Decode Error: could not decode bip32Derivation with key 0x"+u.key.toString("hex"));let l=u.key.slice(1);if(!t(l))throw new Error("Decode Error: bip32Derivation has invalid pubkey in key 0x"+u.key.toString("hex"));if(u.value.length/4%1!==0)throw new Error("Decode Error: Input BIP32_DERIVATION value length should be multiple of 4");let c={masterFingerprint:u.value.slice(0,4),pubkey:l,path:"m"};for(let p of KS(u.value.length/4-1)){let w=u.value.readUInt32LE(p*4+4),x=!!(w&2147483648),S=w&2147483647;c.path+="/"+S.toString(10)+(x?"'":"")}return c}function n(u){let l=Buffer.from([e]),c=Buffer.concat([l,u.pubkey]),p=u.path.split("/"),w=Buffer.allocUnsafe(p.length*4);u.masterFingerprint.copy(w,0);let x=4;return p.slice(1).forEach(S=>{let M=S.slice(-1)==="'",O=2147483647&parseInt(M?S.slice(0,-1):S,10);M&&(O+=2147483648),w.writeUInt32LE(O,x),x+=4}),{key:c,value:w}}let i="{ masterFingerprint: Buffer; pubkey: Buffer; path: string; }";function s(u){return Buffer.isBuffer(u.pubkey)&&Buffer.isBuffer(u.masterFingerprint)&&typeof u.path=="string"&&t(u.pubkey)&&u.masterFingerprint.length===4}function a(u,l,c){let p=l.pubkey.toString("hex");return c.has(p)?!1:(c.add(p),u.filter(w=>w.pubkey.equals(l.pubkey)).length===0)}return{decode:r,encode:n,check:s,expected:i,canAddToArray:a}}Gh.makeConverter=WS});var Wb=T(Vh=>{"use strict";Object.defineProperty(Vh,"__esModule",{value:!0});function VS(e){return t;function t(r){let n;if(e.includes(r.key[0])&&(n=r.key.slice(1),!(n.length===33||n.length===65)||![2,3,4].includes(n[0])))throw new Error("Format Error: invalid pubkey in key 0x"+r.key.toString("hex"));return n}}Vh.makeChecker=VS});var Vb=T(zh=>{"use strict";Object.defineProperty(zh,"__esModule",{value:!0});function zS(e){function t(a){if(a.key[0]!==e)throw new Error("Decode Error: could not decode redeemScript with key 0x"+a.key.toString("hex"));return a.value}function r(a){return{key:Buffer.from([e]),value:a}}let n="Buffer";function i(a){return Buffer.isBuffer(a)}function s(a,u){return!!a&&!!u&&a.redeemScript===void 0}return{decode:t,encode:r,check:i,expected:n,canAdd:s}}zh.makeConverter=zS});var zb=T($h=>{"use strict";Object.defineProperty($h,"__esModule",{value:!0});var $f=Ci(),$S=Wh(),jS=e=>e.length===32;function XS(e){let t=$S.makeConverter(e,jS);function r(a){let u=$f.decode(a.value),l=$f.encodingLength(u),c=t.decode({key:a.key,value:a.value.slice(l+u*32)}),p=new Array(u);for(let w=0,x=l;w