From 4d13f1c8dba099ff14695127146dea05dfe7db2a Mon Sep 17 00:00:00 2001 From: Ardis Lu Date: Sat, 11 Mar 2023 22:21:37 -0800 Subject: [PATCH] Bump vendor version --- functions/api.js | 1 + functions/verifyMessage.js | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/functions/api.js b/functions/api.js index 8ef4a2d..76829a5 100644 --- a/functions/api.js +++ b/functions/api.js @@ -1,3 +1,4 @@ +// From "ethers/hash" v6.1.0 import { verifyMessage } from './verifyMessage'; // Same function used on the frontend, ran again to verify. diff --git a/functions/verifyMessage.js b/functions/verifyMessage.js index 0f42ba5..9e3234e 100644 --- a/functions/verifyMessage.js +++ b/functions/verifyMessage.js @@ -1,10 +1,10 @@ -var An=Object.create;var ei=Object.defineProperty;var Sn=Object.getOwnPropertyDescriptor;var En=Object.getOwnPropertyNames;var In=Object.getPrototypeOf,Nn=Object.prototype.hasOwnProperty;var Ft=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Pn=(e,t,i,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of En(t))!Nn.call(e,n)&&n!==i&&ei(e,n,{get:()=>t[n],enumerable:!(s=Sn(t,n))||s.enumerable});return e};var Qr=(e,t,i)=>(i=e!=null?An(In(e)):{},Pn(t||!e||!e.__esModule?ei(i,"default",{value:e,enumerable:!0}):i,e));var di=Ft(()=>{});var ke=Ft((vi,Fe)=>{(function(e,t){"use strict";function i(p,r){if(!p)throw new Error(r||"Assertion failed")}function s(p,r){p.super_=r;var o=function(){};o.prototype=r.prototype,p.prototype=new o,p.prototype.constructor=p}function n(p,r,o){if(n.isBN(p))return p;this.negative=0,this.words=null,this.length=0,this.red=null,p!==null&&((r==="le"||r==="be")&&(o=r,r=10),this._init(p||0,r||10,o||"be"))}typeof e=="object"?e.exports=n:t.BN=n,n.BN=n,n.wordSize=26;var l;try{typeof window<"u"&&typeof window.Buffer<"u"?l=window.Buffer:l=di().Buffer}catch{}n.isBN=function(r){return r instanceof n?!0:r!==null&&typeof r=="object"&&r.constructor.wordSize===n.wordSize&&Array.isArray(r.words)},n.max=function(r,o){return r.cmp(o)>0?r:o},n.min=function(r,o){return r.cmp(o)<0?r:o},n.prototype._init=function(r,o,h){if(typeof r=="number")return this._initNumber(r,o,h);if(typeof r=="object")return this._initArray(r,o,h);o==="hex"&&(o=16),i(o===(o|0)&&o>=2&&o<=36),r=r.toString().replace(/\s+/g,"");var u=0;r[0]==="-"&&(u++,this.negative=1),u=0;u-=3)g=r[u]|r[u-1]<<8|r[u-2]<<16,this.words[c]|=g<>>26-b&67108863,b+=24,b>=26&&(b-=26,c++);else if(h==="le")for(u=0,c=0;u>>26-b&67108863,b+=24,b>=26&&(b-=26,c++);return this._strip()};function m(p,r){var o=p.charCodeAt(r);if(o>=48&&o<=57)return o-48;if(o>=65&&o<=70)return o-55;if(o>=97&&o<=102)return o-87;i(!1,"Invalid character in "+p)}function x(p,r,o){var h=m(p,o);return o-1>=r&&(h|=m(p,o-1)<<4),h}n.prototype._parseHex=function(r,o,h){this.length=Math.ceil((r.length-o)/6),this.words=new Array(this.length);for(var u=0;u=o;u-=2)b=x(r,o,u)<=18?(c-=18,g+=1,this.words[g]|=b>>>26):c+=8;else{var d=r.length-o;for(u=d%2===0?o+1:o;u=18?(c-=18,g+=1,this.words[g]|=b>>>26):c+=8}this._strip()};function y(p,r,o,h){for(var u=0,c=0,g=Math.min(p.length,o),b=r;b=49?c=d-49+10:d>=17?c=d-17+10:c=d,i(d>=0&&c1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},n.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{n.prototype[Symbol.for("nodejs.util.inspect.custom")]=A}catch{n.prototype.inspect=A}else n.prototype.inspect=A;function A(){return(this.red?""}var _=["","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"],I=[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],P=[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];n.prototype.toString=function(r,o){r=r||10,o=o|0||1;var h;if(r===16||r==="hex"){h="";for(var u=0,c=0,g=0;g>>24-u&16777215,u+=2,u>=26&&(u-=26,g--),c!==0||g!==this.length-1?h=_[6-d.length]+d+h:h=d+h}for(c!==0&&(h=c.toString(16)+h);h.length%o!==0;)h="0"+h;return this.negative!==0&&(h="-"+h),h}if(r===(r|0)&&r>=2&&r<=36){var f=I[r],v=P[r];h="";var B=this.clone();for(B.negative=0;!B.isZero();){var a=B.modrn(v).toString(r);B=B.idivn(v),B.isZero()?h=a+h:h=_[f-a.length]+a+h}for(this.isZero()&&(h="0"+h);h.length%o!==0;)h="0"+h;return this.negative!==0&&(h="-"+h),h}i(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var r=this.words[0];return this.length===2?r+=this.words[1]*67108864:this.length===3&&this.words[2]===1?r+=4503599627370496+this.words[1]*67108864:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-r:r},n.prototype.toJSON=function(){return this.toString(16,2)},l&&(n.prototype.toBuffer=function(r,o){return this.toArrayLike(l,r,o)}),n.prototype.toArray=function(r,o){return this.toArrayLike(Array,r,o)};var N=function(r,o){return r.allocUnsafe?r.allocUnsafe(o):new r(o)};n.prototype.toArrayLike=function(r,o,h){this._strip();var u=this.byteLength(),c=h||Math.max(1,u);i(u<=c,"byte array longer than desired length"),i(c>0,"Requested array length <= 0");var g=N(r,c),b=o==="le"?"LE":"BE";return this["_toArrayLike"+b](g,u),g},n.prototype._toArrayLikeLE=function(r,o){for(var h=0,u=0,c=0,g=0;c>8&255),h>16&255),g===6?(h>24&255),u=0,g=0):(u=b>>>24,g+=2)}if(h=0&&(r[h--]=b>>8&255),h>=0&&(r[h--]=b>>16&255),g===6?(h>=0&&(r[h--]=b>>24&255),u=0,g=0):(u=b>>>24,g+=2)}if(h>=0)for(r[h--]=u;h>=0;)r[h--]=0},Math.clz32?n.prototype._countBits=function(r){return 32-Math.clz32(r)}:n.prototype._countBits=function(r){var o=r,h=0;return o>=4096&&(h+=13,o>>>=13),o>=64&&(h+=7,o>>>=7),o>=8&&(h+=4,o>>>=4),o>=2&&(h+=2,o>>>=2),h+o},n.prototype._zeroBits=function(r){if(r===0)return 26;var o=r,h=0;return(o&8191)===0&&(h+=13,o>>>=13),(o&127)===0&&(h+=7,o>>>=7),(o&15)===0&&(h+=4,o>>>=4),(o&3)===0&&(h+=2,o>>>=2),(o&1)===0&&h++,h},n.prototype.bitLength=function(){var r=this.words[this.length-1],o=this._countBits(r);return(this.length-1)*26+o};function k(p){for(var r=new Array(p.bitLength()),o=0;o>>u&1}return r}n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var r=0,o=0;or.length?this.clone().ior(r):r.clone().ior(this)},n.prototype.uor=function(r){return this.length>r.length?this.clone().iuor(r):r.clone().iuor(this)},n.prototype.iuand=function(r){var o;this.length>r.length?o=r:o=this;for(var h=0;hr.length?this.clone().iand(r):r.clone().iand(this)},n.prototype.uand=function(r){return this.length>r.length?this.clone().iuand(r):r.clone().iuand(this)},n.prototype.iuxor=function(r){var o,h;this.length>r.length?(o=this,h=r):(o=r,h=this);for(var u=0;ur.length?this.clone().ixor(r):r.clone().ixor(this)},n.prototype.uxor=function(r){return this.length>r.length?this.clone().iuxor(r):r.clone().iuxor(this)},n.prototype.inotn=function(r){i(typeof r=="number"&&r>=0);var o=Math.ceil(r/26)|0,h=r%26;this._expand(o),h>0&&o--;for(var u=0;u0&&(this.words[u]=~this.words[u]&67108863>>26-h),this._strip()},n.prototype.notn=function(r){return this.clone().inotn(r)},n.prototype.setn=function(r,o){i(typeof r=="number"&&r>=0);var h=r/26|0,u=r%26;return this._expand(h+1),o?this.words[h]=this.words[h]|1<r.length?(h=this,u=r):(h=r,u=this);for(var c=0,g=0;g>>26;for(;c!==0&&g>>26;if(this.length=h.length,c!==0)this.words[this.length]=c,this.length++;else if(h!==this)for(;gr.length?this.clone().iadd(r):r.clone().iadd(this)},n.prototype.isub=function(r){if(r.negative!==0){r.negative=0;var o=this.iadd(r);return r.negative=1,o._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(r),this.negative=1,this._normSign();var h=this.cmp(r);if(h===0)return this.negative=0,this.length=1,this.words[0]=0,this;var u,c;h>0?(u=this,c=r):(u=r,c=this);for(var g=0,b=0;b>26,this.words[b]=o&67108863;for(;g!==0&&b>26,this.words[b]=o&67108863;if(g===0&&b>>26,B=d&67108863,a=Math.min(f,r.length-1),M=Math.max(0,f-p.length+1);M<=a;M++){var S=f-M|0;u=p.words[S]|0,c=r.words[M]|0,g=u*c+B,v+=g/67108864|0,B=g&67108863}o.words[f]=B|0,d=v|0}return d!==0?o.words[f]=d|0:o.length--,o._strip()}var C=function(r,o,h){var u=r.words,c=o.words,g=h.words,b=0,d,f,v,B=u[0]|0,a=B&8191,M=B>>>13,S=u[1]|0,E=S&8191,R=S>>>13,T=u[2]|0,F=T&8191,O=T>>>13,It=u[3]|0,q=It&8191,L=It>>>13,xr=u[4]|0,J=xr&8191,Z=xr>>>13,br=u[5]|0,W=br&8191,X=br>>>13,yr=u[6]|0,V=yr&8191,j=yr>>>13,wr=u[7]|0,$=wr&8191,Y=wr>>>13,Mr=u[8]|0,Q=Mr&8191,tt=Mr>>>13,_r=u[9]|0,rt=_r&8191,et=_r>>>13,Ar=c[0]|0,it=Ar&8191,nt=Ar>>>13,Sr=c[1]|0,ft=Sr&8191,ot=Sr>>>13,Er=c[2]|0,st=Er&8191,at=Er>>>13,Ir=c[3]|0,ht=Ir&8191,ut=Ir>>>13,Nr=c[4]|0,lt=Nr&8191,ct=Nr>>>13,Pr=c[5]|0,dt=Pr&8191,vt=Pr>>>13,Rr=c[6]|0,pt=Rr&8191,mt=Rr>>>13,Or=c[7]|0,gt=Or&8191,xt=Or>>>13,Fr=c[8]|0,bt=Fr&8191,yt=Fr>>>13,kr=c[9]|0,wt=kr&8191,Mt=kr>>>13;h.negative=r.negative^o.negative,h.length=19,d=Math.imul(a,it),f=Math.imul(a,nt),f=f+Math.imul(M,it)|0,v=Math.imul(M,nt);var hr=(b+d|0)+((f&8191)<<13)|0;b=(v+(f>>>13)|0)+(hr>>>26)|0,hr&=67108863,d=Math.imul(E,it),f=Math.imul(E,nt),f=f+Math.imul(R,it)|0,v=Math.imul(R,nt),d=d+Math.imul(a,ft)|0,f=f+Math.imul(a,ot)|0,f=f+Math.imul(M,ft)|0,v=v+Math.imul(M,ot)|0;var ur=(b+d|0)+((f&8191)<<13)|0;b=(v+(f>>>13)|0)+(ur>>>26)|0,ur&=67108863,d=Math.imul(F,it),f=Math.imul(F,nt),f=f+Math.imul(O,it)|0,v=Math.imul(O,nt),d=d+Math.imul(E,ft)|0,f=f+Math.imul(E,ot)|0,f=f+Math.imul(R,ft)|0,v=v+Math.imul(R,ot)|0,d=d+Math.imul(a,st)|0,f=f+Math.imul(a,at)|0,f=f+Math.imul(M,st)|0,v=v+Math.imul(M,at)|0;var lr=(b+d|0)+((f&8191)<<13)|0;b=(v+(f>>>13)|0)+(lr>>>26)|0,lr&=67108863,d=Math.imul(q,it),f=Math.imul(q,nt),f=f+Math.imul(L,it)|0,v=Math.imul(L,nt),d=d+Math.imul(F,ft)|0,f=f+Math.imul(F,ot)|0,f=f+Math.imul(O,ft)|0,v=v+Math.imul(O,ot)|0,d=d+Math.imul(E,st)|0,f=f+Math.imul(E,at)|0,f=f+Math.imul(R,st)|0,v=v+Math.imul(R,at)|0,d=d+Math.imul(a,ht)|0,f=f+Math.imul(a,ut)|0,f=f+Math.imul(M,ht)|0,v=v+Math.imul(M,ut)|0;var cr=(b+d|0)+((f&8191)<<13)|0;b=(v+(f>>>13)|0)+(cr>>>26)|0,cr&=67108863,d=Math.imul(J,it),f=Math.imul(J,nt),f=f+Math.imul(Z,it)|0,v=Math.imul(Z,nt),d=d+Math.imul(q,ft)|0,f=f+Math.imul(q,ot)|0,f=f+Math.imul(L,ft)|0,v=v+Math.imul(L,ot)|0,d=d+Math.imul(F,st)|0,f=f+Math.imul(F,at)|0,f=f+Math.imul(O,st)|0,v=v+Math.imul(O,at)|0,d=d+Math.imul(E,ht)|0,f=f+Math.imul(E,ut)|0,f=f+Math.imul(R,ht)|0,v=v+Math.imul(R,ut)|0,d=d+Math.imul(a,lt)|0,f=f+Math.imul(a,ct)|0,f=f+Math.imul(M,lt)|0,v=v+Math.imul(M,ct)|0;var dr=(b+d|0)+((f&8191)<<13)|0;b=(v+(f>>>13)|0)+(dr>>>26)|0,dr&=67108863,d=Math.imul(W,it),f=Math.imul(W,nt),f=f+Math.imul(X,it)|0,v=Math.imul(X,nt),d=d+Math.imul(J,ft)|0,f=f+Math.imul(J,ot)|0,f=f+Math.imul(Z,ft)|0,v=v+Math.imul(Z,ot)|0,d=d+Math.imul(q,st)|0,f=f+Math.imul(q,at)|0,f=f+Math.imul(L,st)|0,v=v+Math.imul(L,at)|0,d=d+Math.imul(F,ht)|0,f=f+Math.imul(F,ut)|0,f=f+Math.imul(O,ht)|0,v=v+Math.imul(O,ut)|0,d=d+Math.imul(E,lt)|0,f=f+Math.imul(E,ct)|0,f=f+Math.imul(R,lt)|0,v=v+Math.imul(R,ct)|0,d=d+Math.imul(a,dt)|0,f=f+Math.imul(a,vt)|0,f=f+Math.imul(M,dt)|0,v=v+Math.imul(M,vt)|0;var de=(b+d|0)+((f&8191)<<13)|0;b=(v+(f>>>13)|0)+(de>>>26)|0,de&=67108863,d=Math.imul(V,it),f=Math.imul(V,nt),f=f+Math.imul(j,it)|0,v=Math.imul(j,nt),d=d+Math.imul(W,ft)|0,f=f+Math.imul(W,ot)|0,f=f+Math.imul(X,ft)|0,v=v+Math.imul(X,ot)|0,d=d+Math.imul(J,st)|0,f=f+Math.imul(J,at)|0,f=f+Math.imul(Z,st)|0,v=v+Math.imul(Z,at)|0,d=d+Math.imul(q,ht)|0,f=f+Math.imul(q,ut)|0,f=f+Math.imul(L,ht)|0,v=v+Math.imul(L,ut)|0,d=d+Math.imul(F,lt)|0,f=f+Math.imul(F,ct)|0,f=f+Math.imul(O,lt)|0,v=v+Math.imul(O,ct)|0,d=d+Math.imul(E,dt)|0,f=f+Math.imul(E,vt)|0,f=f+Math.imul(R,dt)|0,v=v+Math.imul(R,vt)|0,d=d+Math.imul(a,pt)|0,f=f+Math.imul(a,mt)|0,f=f+Math.imul(M,pt)|0,v=v+Math.imul(M,mt)|0;var ve=(b+d|0)+((f&8191)<<13)|0;b=(v+(f>>>13)|0)+(ve>>>26)|0,ve&=67108863,d=Math.imul($,it),f=Math.imul($,nt),f=f+Math.imul(Y,it)|0,v=Math.imul(Y,nt),d=d+Math.imul(V,ft)|0,f=f+Math.imul(V,ot)|0,f=f+Math.imul(j,ft)|0,v=v+Math.imul(j,ot)|0,d=d+Math.imul(W,st)|0,f=f+Math.imul(W,at)|0,f=f+Math.imul(X,st)|0,v=v+Math.imul(X,at)|0,d=d+Math.imul(J,ht)|0,f=f+Math.imul(J,ut)|0,f=f+Math.imul(Z,ht)|0,v=v+Math.imul(Z,ut)|0,d=d+Math.imul(q,lt)|0,f=f+Math.imul(q,ct)|0,f=f+Math.imul(L,lt)|0,v=v+Math.imul(L,ct)|0,d=d+Math.imul(F,dt)|0,f=f+Math.imul(F,vt)|0,f=f+Math.imul(O,dt)|0,v=v+Math.imul(O,vt)|0,d=d+Math.imul(E,pt)|0,f=f+Math.imul(E,mt)|0,f=f+Math.imul(R,pt)|0,v=v+Math.imul(R,mt)|0,d=d+Math.imul(a,gt)|0,f=f+Math.imul(a,xt)|0,f=f+Math.imul(M,gt)|0,v=v+Math.imul(M,xt)|0;var pe=(b+d|0)+((f&8191)<<13)|0;b=(v+(f>>>13)|0)+(pe>>>26)|0,pe&=67108863,d=Math.imul(Q,it),f=Math.imul(Q,nt),f=f+Math.imul(tt,it)|0,v=Math.imul(tt,nt),d=d+Math.imul($,ft)|0,f=f+Math.imul($,ot)|0,f=f+Math.imul(Y,ft)|0,v=v+Math.imul(Y,ot)|0,d=d+Math.imul(V,st)|0,f=f+Math.imul(V,at)|0,f=f+Math.imul(j,st)|0,v=v+Math.imul(j,at)|0,d=d+Math.imul(W,ht)|0,f=f+Math.imul(W,ut)|0,f=f+Math.imul(X,ht)|0,v=v+Math.imul(X,ut)|0,d=d+Math.imul(J,lt)|0,f=f+Math.imul(J,ct)|0,f=f+Math.imul(Z,lt)|0,v=v+Math.imul(Z,ct)|0,d=d+Math.imul(q,dt)|0,f=f+Math.imul(q,vt)|0,f=f+Math.imul(L,dt)|0,v=v+Math.imul(L,vt)|0,d=d+Math.imul(F,pt)|0,f=f+Math.imul(F,mt)|0,f=f+Math.imul(O,pt)|0,v=v+Math.imul(O,mt)|0,d=d+Math.imul(E,gt)|0,f=f+Math.imul(E,xt)|0,f=f+Math.imul(R,gt)|0,v=v+Math.imul(R,xt)|0,d=d+Math.imul(a,bt)|0,f=f+Math.imul(a,yt)|0,f=f+Math.imul(M,bt)|0,v=v+Math.imul(M,yt)|0;var me=(b+d|0)+((f&8191)<<13)|0;b=(v+(f>>>13)|0)+(me>>>26)|0,me&=67108863,d=Math.imul(rt,it),f=Math.imul(rt,nt),f=f+Math.imul(et,it)|0,v=Math.imul(et,nt),d=d+Math.imul(Q,ft)|0,f=f+Math.imul(Q,ot)|0,f=f+Math.imul(tt,ft)|0,v=v+Math.imul(tt,ot)|0,d=d+Math.imul($,st)|0,f=f+Math.imul($,at)|0,f=f+Math.imul(Y,st)|0,v=v+Math.imul(Y,at)|0,d=d+Math.imul(V,ht)|0,f=f+Math.imul(V,ut)|0,f=f+Math.imul(j,ht)|0,v=v+Math.imul(j,ut)|0,d=d+Math.imul(W,lt)|0,f=f+Math.imul(W,ct)|0,f=f+Math.imul(X,lt)|0,v=v+Math.imul(X,ct)|0,d=d+Math.imul(J,dt)|0,f=f+Math.imul(J,vt)|0,f=f+Math.imul(Z,dt)|0,v=v+Math.imul(Z,vt)|0,d=d+Math.imul(q,pt)|0,f=f+Math.imul(q,mt)|0,f=f+Math.imul(L,pt)|0,v=v+Math.imul(L,mt)|0,d=d+Math.imul(F,gt)|0,f=f+Math.imul(F,xt)|0,f=f+Math.imul(O,gt)|0,v=v+Math.imul(O,xt)|0,d=d+Math.imul(E,bt)|0,f=f+Math.imul(E,yt)|0,f=f+Math.imul(R,bt)|0,v=v+Math.imul(R,yt)|0,d=d+Math.imul(a,wt)|0,f=f+Math.imul(a,Mt)|0,f=f+Math.imul(M,wt)|0,v=v+Math.imul(M,Mt)|0;var ge=(b+d|0)+((f&8191)<<13)|0;b=(v+(f>>>13)|0)+(ge>>>26)|0,ge&=67108863,d=Math.imul(rt,ft),f=Math.imul(rt,ot),f=f+Math.imul(et,ft)|0,v=Math.imul(et,ot),d=d+Math.imul(Q,st)|0,f=f+Math.imul(Q,at)|0,f=f+Math.imul(tt,st)|0,v=v+Math.imul(tt,at)|0,d=d+Math.imul($,ht)|0,f=f+Math.imul($,ut)|0,f=f+Math.imul(Y,ht)|0,v=v+Math.imul(Y,ut)|0,d=d+Math.imul(V,lt)|0,f=f+Math.imul(V,ct)|0,f=f+Math.imul(j,lt)|0,v=v+Math.imul(j,ct)|0,d=d+Math.imul(W,dt)|0,f=f+Math.imul(W,vt)|0,f=f+Math.imul(X,dt)|0,v=v+Math.imul(X,vt)|0,d=d+Math.imul(J,pt)|0,f=f+Math.imul(J,mt)|0,f=f+Math.imul(Z,pt)|0,v=v+Math.imul(Z,mt)|0,d=d+Math.imul(q,gt)|0,f=f+Math.imul(q,xt)|0,f=f+Math.imul(L,gt)|0,v=v+Math.imul(L,xt)|0,d=d+Math.imul(F,bt)|0,f=f+Math.imul(F,yt)|0,f=f+Math.imul(O,bt)|0,v=v+Math.imul(O,yt)|0,d=d+Math.imul(E,wt)|0,f=f+Math.imul(E,Mt)|0,f=f+Math.imul(R,wt)|0,v=v+Math.imul(R,Mt)|0;var xe=(b+d|0)+((f&8191)<<13)|0;b=(v+(f>>>13)|0)+(xe>>>26)|0,xe&=67108863,d=Math.imul(rt,st),f=Math.imul(rt,at),f=f+Math.imul(et,st)|0,v=Math.imul(et,at),d=d+Math.imul(Q,ht)|0,f=f+Math.imul(Q,ut)|0,f=f+Math.imul(tt,ht)|0,v=v+Math.imul(tt,ut)|0,d=d+Math.imul($,lt)|0,f=f+Math.imul($,ct)|0,f=f+Math.imul(Y,lt)|0,v=v+Math.imul(Y,ct)|0,d=d+Math.imul(V,dt)|0,f=f+Math.imul(V,vt)|0,f=f+Math.imul(j,dt)|0,v=v+Math.imul(j,vt)|0,d=d+Math.imul(W,pt)|0,f=f+Math.imul(W,mt)|0,f=f+Math.imul(X,pt)|0,v=v+Math.imul(X,mt)|0,d=d+Math.imul(J,gt)|0,f=f+Math.imul(J,xt)|0,f=f+Math.imul(Z,gt)|0,v=v+Math.imul(Z,xt)|0,d=d+Math.imul(q,bt)|0,f=f+Math.imul(q,yt)|0,f=f+Math.imul(L,bt)|0,v=v+Math.imul(L,yt)|0,d=d+Math.imul(F,wt)|0,f=f+Math.imul(F,Mt)|0,f=f+Math.imul(O,wt)|0,v=v+Math.imul(O,Mt)|0;var be=(b+d|0)+((f&8191)<<13)|0;b=(v+(f>>>13)|0)+(be>>>26)|0,be&=67108863,d=Math.imul(rt,ht),f=Math.imul(rt,ut),f=f+Math.imul(et,ht)|0,v=Math.imul(et,ut),d=d+Math.imul(Q,lt)|0,f=f+Math.imul(Q,ct)|0,f=f+Math.imul(tt,lt)|0,v=v+Math.imul(tt,ct)|0,d=d+Math.imul($,dt)|0,f=f+Math.imul($,vt)|0,f=f+Math.imul(Y,dt)|0,v=v+Math.imul(Y,vt)|0,d=d+Math.imul(V,pt)|0,f=f+Math.imul(V,mt)|0,f=f+Math.imul(j,pt)|0,v=v+Math.imul(j,mt)|0,d=d+Math.imul(W,gt)|0,f=f+Math.imul(W,xt)|0,f=f+Math.imul(X,gt)|0,v=v+Math.imul(X,xt)|0,d=d+Math.imul(J,bt)|0,f=f+Math.imul(J,yt)|0,f=f+Math.imul(Z,bt)|0,v=v+Math.imul(Z,yt)|0,d=d+Math.imul(q,wt)|0,f=f+Math.imul(q,Mt)|0,f=f+Math.imul(L,wt)|0,v=v+Math.imul(L,Mt)|0;var ye=(b+d|0)+((f&8191)<<13)|0;b=(v+(f>>>13)|0)+(ye>>>26)|0,ye&=67108863,d=Math.imul(rt,lt),f=Math.imul(rt,ct),f=f+Math.imul(et,lt)|0,v=Math.imul(et,ct),d=d+Math.imul(Q,dt)|0,f=f+Math.imul(Q,vt)|0,f=f+Math.imul(tt,dt)|0,v=v+Math.imul(tt,vt)|0,d=d+Math.imul($,pt)|0,f=f+Math.imul($,mt)|0,f=f+Math.imul(Y,pt)|0,v=v+Math.imul(Y,mt)|0,d=d+Math.imul(V,gt)|0,f=f+Math.imul(V,xt)|0,f=f+Math.imul(j,gt)|0,v=v+Math.imul(j,xt)|0,d=d+Math.imul(W,bt)|0,f=f+Math.imul(W,yt)|0,f=f+Math.imul(X,bt)|0,v=v+Math.imul(X,yt)|0,d=d+Math.imul(J,wt)|0,f=f+Math.imul(J,Mt)|0,f=f+Math.imul(Z,wt)|0,v=v+Math.imul(Z,Mt)|0;var we=(b+d|0)+((f&8191)<<13)|0;b=(v+(f>>>13)|0)+(we>>>26)|0,we&=67108863,d=Math.imul(rt,dt),f=Math.imul(rt,vt),f=f+Math.imul(et,dt)|0,v=Math.imul(et,vt),d=d+Math.imul(Q,pt)|0,f=f+Math.imul(Q,mt)|0,f=f+Math.imul(tt,pt)|0,v=v+Math.imul(tt,mt)|0,d=d+Math.imul($,gt)|0,f=f+Math.imul($,xt)|0,f=f+Math.imul(Y,gt)|0,v=v+Math.imul(Y,xt)|0,d=d+Math.imul(V,bt)|0,f=f+Math.imul(V,yt)|0,f=f+Math.imul(j,bt)|0,v=v+Math.imul(j,yt)|0,d=d+Math.imul(W,wt)|0,f=f+Math.imul(W,Mt)|0,f=f+Math.imul(X,wt)|0,v=v+Math.imul(X,Mt)|0;var Me=(b+d|0)+((f&8191)<<13)|0;b=(v+(f>>>13)|0)+(Me>>>26)|0,Me&=67108863,d=Math.imul(rt,pt),f=Math.imul(rt,mt),f=f+Math.imul(et,pt)|0,v=Math.imul(et,mt),d=d+Math.imul(Q,gt)|0,f=f+Math.imul(Q,xt)|0,f=f+Math.imul(tt,gt)|0,v=v+Math.imul(tt,xt)|0,d=d+Math.imul($,bt)|0,f=f+Math.imul($,yt)|0,f=f+Math.imul(Y,bt)|0,v=v+Math.imul(Y,yt)|0,d=d+Math.imul(V,wt)|0,f=f+Math.imul(V,Mt)|0,f=f+Math.imul(j,wt)|0,v=v+Math.imul(j,Mt)|0;var _e=(b+d|0)+((f&8191)<<13)|0;b=(v+(f>>>13)|0)+(_e>>>26)|0,_e&=67108863,d=Math.imul(rt,gt),f=Math.imul(rt,xt),f=f+Math.imul(et,gt)|0,v=Math.imul(et,xt),d=d+Math.imul(Q,bt)|0,f=f+Math.imul(Q,yt)|0,f=f+Math.imul(tt,bt)|0,v=v+Math.imul(tt,yt)|0,d=d+Math.imul($,wt)|0,f=f+Math.imul($,Mt)|0,f=f+Math.imul(Y,wt)|0,v=v+Math.imul(Y,Mt)|0;var Ae=(b+d|0)+((f&8191)<<13)|0;b=(v+(f>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,d=Math.imul(rt,bt),f=Math.imul(rt,yt),f=f+Math.imul(et,bt)|0,v=Math.imul(et,yt),d=d+Math.imul(Q,wt)|0,f=f+Math.imul(Q,Mt)|0,f=f+Math.imul(tt,wt)|0,v=v+Math.imul(tt,Mt)|0;var Se=(b+d|0)+((f&8191)<<13)|0;b=(v+(f>>>13)|0)+(Se>>>26)|0,Se&=67108863,d=Math.imul(rt,wt),f=Math.imul(rt,Mt),f=f+Math.imul(et,wt)|0,v=Math.imul(et,Mt);var Ee=(b+d|0)+((f&8191)<<13)|0;return b=(v+(f>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,g[0]=hr,g[1]=ur,g[2]=lr,g[3]=cr,g[4]=dr,g[5]=de,g[6]=ve,g[7]=pe,g[8]=me,g[9]=ge,g[10]=xe,g[11]=be,g[12]=ye,g[13]=we,g[14]=Me,g[15]=_e,g[16]=Ae,g[17]=Se,g[18]=Ee,b!==0&&(g[19]=b,h.length++),h};Math.imul||(C=U);function St(p,r,o){o.negative=r.negative^p.negative,o.length=p.length+r.length;for(var h=0,u=0,c=0;c>>26)|0,u+=g>>>26,g&=67108863}o.words[c]=b,h=g,g=u}return h!==0?o.words[c]=h:o.length--,o._strip()}function Rt(p,r,o){return St(p,r,o)}n.prototype.mulTo=function(r,o){var h,u=this.length+r.length;return this.length===10&&r.length===10?h=C(this,r,o):u<63?h=U(this,r,o):u<1024?h=St(this,r,o):h=Rt(this,r,o),h};function At(p,r){this.x=p,this.y=r}At.prototype.makeRBT=function(r){for(var o=new Array(r),h=n.prototype._countBits(r)-1,u=0;u>=1;return u},At.prototype.permute=function(r,o,h,u,c,g){for(var b=0;b>>1)c++;return 1<>>13,h[2*g+1]=c&8191,c=c>>>13;for(g=2*o;g>=26,h+=c/67108864|0,h+=g>>>26,this.words[u]=g&67108863}return h!==0&&(this.words[u]=h,this.length++),o?this.ineg():this},n.prototype.muln=function(r){return this.clone().imuln(r)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(r){var o=k(r);if(o.length===0)return new n(1);for(var h=this,u=0;u=0);var o=r%26,h=(r-o)/26,u=67108863>>>26-o<<26-o,c;if(o!==0){var g=0;for(c=0;c>>26-o}g&&(this.words[c]=g,this.length++)}if(h!==0){for(c=this.length-1;c>=0;c--)this.words[c+h]=this.words[c];for(c=0;c=0);var u;o?u=(o-o%26)/26:u=0;var c=r%26,g=Math.min((r-c)/26,this.length),b=67108863^67108863>>>c<g)for(this.length-=g,f=0;f=0&&(v!==0||f>=u);f--){var B=this.words[f]|0;this.words[f]=v<<26-c|B>>>c,v=B&b}return d&&v!==0&&(d.words[d.length++]=v),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},n.prototype.ishrn=function(r,o,h){return i(this.negative===0),this.iushrn(r,o,h)},n.prototype.shln=function(r){return this.clone().ishln(r)},n.prototype.ushln=function(r){return this.clone().iushln(r)},n.prototype.shrn=function(r){return this.clone().ishrn(r)},n.prototype.ushrn=function(r){return this.clone().iushrn(r)},n.prototype.testn=function(r){i(typeof r=="number"&&r>=0);var o=r%26,h=(r-o)/26,u=1<=0);var o=r%26,h=(r-o)/26;if(i(this.negative===0,"imaskn works only with positive numbers"),this.length<=h)return this;if(o!==0&&h++,this.length=Math.min(h,this.length),o!==0){var u=67108863^67108863>>>o<=67108864;o++)this.words[o]-=67108864,o===this.length-1?this.words[o+1]=1:this.words[o+1]++;return this.length=Math.max(this.length,o+1),this},n.prototype.isubn=function(r){if(i(typeof r=="number"),i(r<67108864),r<0)return this.iaddn(-r);if(this.negative!==0)return this.negative=0,this.iaddn(r),this.negative=1,this;if(this.words[0]-=r,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var o=0;o>26)-(d/67108864|0),this.words[c+h]=g&67108863}for(;c>26,this.words[c+h]=g&67108863;if(b===0)return this._strip();for(i(b===-1),b=0,c=0;c>26,this.words[c]=g&67108863;return this.negative=1,this._strip()},n.prototype._wordDiv=function(r,o){var h=this.length-r.length,u=this.clone(),c=r,g=c.words[c.length-1]|0,b=this._countBits(g);h=26-b,h!==0&&(c=c.ushln(h),u.iushln(h),g=c.words[c.length-1]|0);var d=u.length-c.length,f;if(o!=="mod"){f=new n(null),f.length=d+1,f.words=new Array(f.length);for(var v=0;v=0;a--){var M=(u.words[c.length+a]|0)*67108864+(u.words[c.length+a-1]|0);for(M=Math.min(M/g|0,67108863),u._ishlnsubmul(c,M,a);u.negative!==0;)M--,u.negative=0,u._ishlnsubmul(c,1,a),u.isZero()||(u.negative^=1);f&&(f.words[a]=M)}return f&&f._strip(),u._strip(),o!=="div"&&h!==0&&u.iushrn(h),{div:f||null,mod:u}},n.prototype.divmod=function(r,o,h){if(i(!r.isZero()),this.isZero())return{div:new n(0),mod:new n(0)};var u,c,g;return this.negative!==0&&r.negative===0?(g=this.neg().divmod(r,o),o!=="mod"&&(u=g.div.neg()),o!=="div"&&(c=g.mod.neg(),h&&c.negative!==0&&c.iadd(r)),{div:u,mod:c}):this.negative===0&&r.negative!==0?(g=this.divmod(r.neg(),o),o!=="mod"&&(u=g.div.neg()),{div:u,mod:g.mod}):(this.negative&r.negative)!==0?(g=this.neg().divmod(r.neg(),o),o!=="div"&&(c=g.mod.neg(),h&&c.negative!==0&&c.isub(r)),{div:g.div,mod:c}):r.length>this.length||this.cmp(r)<0?{div:new n(0),mod:this}:r.length===1?o==="div"?{div:this.divn(r.words[0]),mod:null}:o==="mod"?{div:null,mod:new n(this.modrn(r.words[0]))}:{div:this.divn(r.words[0]),mod:new n(this.modrn(r.words[0]))}:this._wordDiv(r,o)},n.prototype.div=function(r){return this.divmod(r,"div",!1).div},n.prototype.mod=function(r){return this.divmod(r,"mod",!1).mod},n.prototype.umod=function(r){return this.divmod(r,"mod",!0).mod},n.prototype.divRound=function(r){var o=this.divmod(r);if(o.mod.isZero())return o.div;var h=o.div.negative!==0?o.mod.isub(r):o.mod,u=r.ushrn(1),c=r.andln(1),g=h.cmp(u);return g<0||c===1&&g===0?o.div:o.div.negative!==0?o.div.isubn(1):o.div.iaddn(1)},n.prototype.modrn=function(r){var o=r<0;o&&(r=-r),i(r<=67108863);for(var h=(1<<26)%r,u=0,c=this.length-1;c>=0;c--)u=(h*u+(this.words[c]|0))%r;return o?-u:u},n.prototype.modn=function(r){return this.modrn(r)},n.prototype.idivn=function(r){var o=r<0;o&&(r=-r),i(r<=67108863);for(var h=0,u=this.length-1;u>=0;u--){var c=(this.words[u]|0)+h*67108864;this.words[u]=c/r|0,h=c%r}return this._strip(),o?this.ineg():this},n.prototype.divn=function(r){return this.clone().idivn(r)},n.prototype.egcd=function(r){i(r.negative===0),i(!r.isZero());var o=this,h=r.clone();o.negative!==0?o=o.umod(r):o=o.clone();for(var u=new n(1),c=new n(0),g=new n(0),b=new n(1),d=0;o.isEven()&&h.isEven();)o.iushrn(1),h.iushrn(1),++d;for(var f=h.clone(),v=o.clone();!o.isZero();){for(var B=0,a=1;(o.words[0]&a)===0&&B<26;++B,a<<=1);if(B>0)for(o.iushrn(B);B-- >0;)(u.isOdd()||c.isOdd())&&(u.iadd(f),c.isub(v)),u.iushrn(1),c.iushrn(1);for(var M=0,S=1;(h.words[0]&S)===0&&M<26;++M,S<<=1);if(M>0)for(h.iushrn(M);M-- >0;)(g.isOdd()||b.isOdd())&&(g.iadd(f),b.isub(v)),g.iushrn(1),b.iushrn(1);o.cmp(h)>=0?(o.isub(h),u.isub(g),c.isub(b)):(h.isub(o),g.isub(u),b.isub(c))}return{a:g,b,gcd:h.iushln(d)}},n.prototype._invmp=function(r){i(r.negative===0),i(!r.isZero());var o=this,h=r.clone();o.negative!==0?o=o.umod(r):o=o.clone();for(var u=new n(1),c=new n(0),g=h.clone();o.cmpn(1)>0&&h.cmpn(1)>0;){for(var b=0,d=1;(o.words[0]&d)===0&&b<26;++b,d<<=1);if(b>0)for(o.iushrn(b);b-- >0;)u.isOdd()&&u.iadd(g),u.iushrn(1);for(var f=0,v=1;(h.words[0]&v)===0&&f<26;++f,v<<=1);if(f>0)for(h.iushrn(f);f-- >0;)c.isOdd()&&c.iadd(g),c.iushrn(1);o.cmp(h)>=0?(o.isub(h),u.isub(c)):(h.isub(o),c.isub(u))}var B;return o.cmpn(1)===0?B=u:B=c,B.cmpn(0)<0&&B.iadd(r),B},n.prototype.gcd=function(r){if(this.isZero())return r.abs();if(r.isZero())return this.abs();var o=this.clone(),h=r.clone();o.negative=0,h.negative=0;for(var u=0;o.isEven()&&h.isEven();u++)o.iushrn(1),h.iushrn(1);do{for(;o.isEven();)o.iushrn(1);for(;h.isEven();)h.iushrn(1);var c=o.cmp(h);if(c<0){var g=o;o=h,h=g}else if(c===0||h.cmpn(1)===0)break;o.isub(h)}while(!0);return h.iushln(u)},n.prototype.invm=function(r){return this.egcd(r).a.umod(r)},n.prototype.isEven=function(){return(this.words[0]&1)===0},n.prototype.isOdd=function(){return(this.words[0]&1)===1},n.prototype.andln=function(r){return this.words[0]&r},n.prototype.bincn=function(r){i(typeof r=="number");var o=r%26,h=(r-o)/26,u=1<>>26,b&=67108863,this.words[g]=b}return c!==0&&(this.words[g]=c,this.length++),this},n.prototype.isZero=function(){return this.length===1&&this.words[0]===0},n.prototype.cmpn=function(r){var o=r<0;if(this.negative!==0&&!o)return-1;if(this.negative===0&&o)return 1;this._strip();var h;if(this.length>1)h=1;else{o&&(r=-r),i(r<=67108863,"Number is too big");var u=this.words[0]|0;h=u===r?0:ur.length)return 1;if(this.length=0;h--){var u=this.words[h]|0,c=r.words[h]|0;if(u!==c){uc&&(o=1);break}}return o},n.prototype.gtn=function(r){return this.cmpn(r)===1},n.prototype.gt=function(r){return this.cmp(r)===1},n.prototype.gten=function(r){return this.cmpn(r)>=0},n.prototype.gte=function(r){return this.cmp(r)>=0},n.prototype.ltn=function(r){return this.cmpn(r)===-1},n.prototype.lt=function(r){return this.cmp(r)===-1},n.prototype.lten=function(r){return this.cmpn(r)<=0},n.prototype.lte=function(r){return this.cmp(r)<=0},n.prototype.eqn=function(r){return this.cmpn(r)===0},n.prototype.eq=function(r){return this.cmp(r)===0},n.red=function(r){return new G(r)},n.prototype.toRed=function(r){return i(!this.red,"Already a number in reduction context"),i(this.negative===0,"red works only with positives"),r.convertTo(this)._forceRed(r)},n.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(r){return this.red=r,this},n.prototype.forceRed=function(r){return i(!this.red,"Already a number in reduction context"),this._forceRed(r)},n.prototype.redAdd=function(r){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,r)},n.prototype.redIAdd=function(r){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,r)},n.prototype.redSub=function(r){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,r)},n.prototype.redISub=function(r){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,r)},n.prototype.redShl=function(r){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,r)},n.prototype.redMul=function(r){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,r),this.red.mul(this,r)},n.prototype.redIMul=function(r){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,r),this.red.imul(this,r)},n.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(r){return i(this.red&&!r.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,r)};var Et={k256:null,p224:null,p192:null,p25519:null};function K(p,r){this.name=p,this.p=new n(r,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}K.prototype._tmp=function(){var r=new n(null);return r.words=new Array(Math.ceil(this.n/13)),r},K.prototype.ireduce=function(r){var o=r,h;do this.split(o,this.tmp),o=this.imulK(o),o=o.iadd(this.tmp),h=o.bitLength();while(h>this.n);var u=h0?o.isub(this.p):o.strip!==void 0?o.strip():o._strip(),o},K.prototype.split=function(r,o){r.iushrn(this.n,0,o)},K.prototype.imulK=function(r){return r.imul(this.k)};function Ot(){K.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}s(Ot,K),Ot.prototype.split=function(r,o){for(var h=4194303,u=Math.min(r.length,9),c=0;c>>22,g=b}g>>>=22,r.words[c-10]=g,g===0&&r.length>10?r.length-=10:r.length-=9},Ot.prototype.imulK=function(r){r.words[r.length]=0,r.words[r.length+1]=0,r.length+=2;for(var o=0,h=0;h>>=26,r.words[h]=c,o=u}return o!==0&&(r.words[r.length++]=o),r},n._prime=function(r){if(Et[r])return Et[r];var o;if(r==="k256")o=new Ot;else if(r==="p224")o=new qt;else if(r==="p192")o=new Lt;else if(r==="p25519")o=new ar;else throw new Error("Unknown prime "+r);return Et[r]=o,o};function G(p){if(typeof p=="string"){var r=n._prime(p);this.m=r.p,this.prime=r}else i(p.gtn(1),"modulus must be greater than 1"),this.m=p,this.prime=null}G.prototype._verify1=function(r){i(r.negative===0,"red works only with positives"),i(r.red,"red works only with red numbers")},G.prototype._verify2=function(r,o){i((r.negative|o.negative)===0,"red works only with positives"),i(r.red&&r.red===o.red,"red works only with red numbers")},G.prototype.imod=function(r){return this.prime?this.prime.ireduce(r)._forceRed(this):(w(r,r.umod(this.m)._forceRed(this)),r)},G.prototype.neg=function(r){return r.isZero()?r.clone():this.m.sub(r)._forceRed(this)},G.prototype.add=function(r,o){this._verify2(r,o);var h=r.add(o);return h.cmp(this.m)>=0&&h.isub(this.m),h._forceRed(this)},G.prototype.iadd=function(r,o){this._verify2(r,o);var h=r.iadd(o);return h.cmp(this.m)>=0&&h.isub(this.m),h},G.prototype.sub=function(r,o){this._verify2(r,o);var h=r.sub(o);return h.cmpn(0)<0&&h.iadd(this.m),h._forceRed(this)},G.prototype.isub=function(r,o){this._verify2(r,o);var h=r.isub(o);return h.cmpn(0)<0&&h.iadd(this.m),h},G.prototype.shl=function(r,o){return this._verify1(r),this.imod(r.ushln(o))},G.prototype.imul=function(r,o){return this._verify2(r,o),this.imod(r.imul(o))},G.prototype.mul=function(r,o){return this._verify2(r,o),this.imod(r.mul(o))},G.prototype.isqr=function(r){return this.imul(r,r.clone())},G.prototype.sqr=function(r){return this.mul(r,r)},G.prototype.sqrt=function(r){if(r.isZero())return r.clone();var o=this.m.andln(3);if(i(o%2===1),o===3){var h=this.m.add(new n(1)).iushrn(2);return this.pow(r,h)}for(var u=this.m.subn(1),c=0;!u.isZero()&&u.andln(1)===0;)c++,u.iushrn(1);i(!u.isZero());var g=new n(1).toRed(this),b=g.redNeg(),d=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new n(2*f*f).toRed(this);this.pow(f,d).cmp(b)!==0;)f.redIAdd(b);for(var v=this.pow(f,u),B=this.pow(r,u.addn(1).iushrn(1)),a=this.pow(r,u),M=c;a.cmp(g)!==0;){for(var S=a,E=0;S.cmp(g)!==0;E++)S=S.redSqr();i(E=0;c--){for(var v=o.words[c],B=f-1;B>=0;B--){var a=v>>B&1;if(g!==u[0]&&(g=this.sqr(g)),a===0&&b===0){d=0;continue}b<<=1,b|=a,d++,!(d!==h&&(c!==0||B!==0))&&(g=this.mul(g,u[b]),d=0,b=0)}f=26}return g},G.prototype.convertTo=function(r){var o=r.umod(this.m);return o===r?o.clone():o},G.prototype.convertFrom=function(r){var o=r.clone();return o.red=null,o},n.mont=function(r){return new zt(r)};function zt(p){G.call(this,p),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new n(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)}s(zt,G),zt.prototype.convertTo=function(r){return this.imod(r.ushln(this.shift))},zt.prototype.convertFrom=function(r){var o=this.imod(r.mul(this.rinv));return o.red=null,o},zt.prototype.imul=function(r,o){if(r.isZero()||o.isZero())return r.words[0]=0,r.length=1,r;var h=r.imul(o),u=h.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),c=h.isub(u).iushrn(this.shift),g=c;return c.cmp(this.m)>=0?g=c.isub(this.m):c.cmpn(0)<0&&(g=c.iadd(this.m)),g._forceRed(this)},zt.prototype.mul=function(r,o){if(r.isZero()||o.isZero())return new n(0)._forceRed(this);var h=r.mul(o),u=h.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),c=h.isub(u).iushrn(this.shift),g=c;return c.cmp(this.m)>=0?g=c.isub(this.m):c.cmpn(0)<0&&(g=c.iadd(this.m)),g._forceRed(this)},zt.prototype.invm=function(r){var o=this.imod(r._invmp(this.m).mul(this.r2));return o._forceRed(this)}})(typeof Fe>"u"||Fe,vi)});var gi=Ft((Lo,ne)=>{(function(){"use strict";var e="input is invalid type",t="finalize already called",i=typeof window=="object",s=i?window:{};s.JS_SHA3_NO_WINDOW&&(i=!1);var n=!i&&typeof self=="object",l=!s.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;l?s=global:n&&(s=self);var m=!s.JS_SHA3_NO_COMMON_JS&&typeof ne=="object"&&ne.exports,x=typeof define=="function"&&define.amd,y=!s.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",w="0123456789abcdef".split(""),A=[31,7936,2031616,520093696],_=[4,1024,262144,67108864],I=[1,256,65536,16777216],P=[6,1536,393216,100663296],N=[0,8,16,24],k=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],U=[224,256,384,512],C=[128,256],St=["hex","buffer","arrayBuffer","array","digest"],Rt={128:168,256:136};(s.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(a){return Object.prototype.toString.call(a)==="[object Array]"}),y&&(s.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(a){return typeof a=="object"&&a.buffer&&a.buffer.constructor===ArrayBuffer});for(var At=function(a,M,S){return function(E){return new f(a,M,a).update(E)[S]()}},Et=function(a,M,S){return function(E,R){return new f(a,M,R).update(E)[S]()}},K=function(a,M,S){return function(E,R,T,F){return r["cshake"+a].update(E,R,T,F)[S]()}},Ot=function(a,M,S){return function(E,R,T,F){return r["kmac"+a].update(E,R,T,F)[S]()}},qt=function(a,M,S,E){for(var R=0;R>5,this.byteCount=this.blockCount<<2,this.outputBlocks=S>>5,this.extraBytes=(S&31)>>3;for(var E=0;E<50;++E)this.s[E]=0}f.prototype.update=function(a){if(this.finalized)throw new Error(t);var M,S=typeof a;if(S!=="string"){if(S==="object"){if(a===null)throw new Error(e);if(y&&a.constructor===ArrayBuffer)a=new Uint8Array(a);else if(!Array.isArray(a)&&(!y||!ArrayBuffer.isView(a)))throw new Error(e)}else throw new Error(e);M=!0}for(var E=this.blocks,R=this.byteCount,T=a.length,F=this.blockCount,O=0,It=this.s,q,L;O>2]|=a[O]<>2]|=L<>2]|=(192|L>>6)<>2]|=(128|L&63)<=57344?(E[q>>2]|=(224|L>>12)<>2]|=(128|L>>6&63)<>2]|=(128|L&63)<>2]|=(240|L>>18)<>2]|=(128|L>>12&63)<>2]|=(128|L>>6&63)<>2]|=(128|L&63)<=R){for(this.start=q-R,this.block=E[F],q=0;q>8,S=a&255;S>0;)R.unshift(S),a=a>>8,S=a&255,++E;return M?R.push(E):R.unshift(E),this.update(R),R.length},f.prototype.encodeString=function(a){var M,S=typeof a;if(S!=="string"){if(S==="object"){if(a===null)throw new Error(e);if(y&&a.constructor===ArrayBuffer)a=new Uint8Array(a);else if(!Array.isArray(a)&&(!y||!ArrayBuffer.isView(a)))throw new Error(e)}else throw new Error(e);M=!0}var E=0,R=a.length;if(M)E=R;else for(var T=0;T=57344?E+=3:(F=65536+((F&1023)<<10|a.charCodeAt(++T)&1023),E+=4)}return E+=this.encode(E*8),this.update(a),E},f.prototype.bytepad=function(a,M){for(var S=this.encode(M),E=0;E>2]|=this.padding[M&3],this.lastByteIndex===this.byteCount)for(a[0]=a[S],M=1;M>4&15]+w[O&15]+w[O>>12&15]+w[O>>8&15]+w[O>>20&15]+w[O>>16&15]+w[O>>28&15]+w[O>>24&15];T%a===0&&(B(M),R=0)}return E&&(O=M[R],F+=w[O>>4&15]+w[O&15],E>1&&(F+=w[O>>12&15]+w[O>>8&15]),E>2&&(F+=w[O>>20&15]+w[O>>16&15])),F},f.prototype.arrayBuffer=function(){this.finalize();var a=this.blockCount,M=this.s,S=this.outputBlocks,E=this.extraBytes,R=0,T=0,F=this.outputBits>>3,O;E?O=new ArrayBuffer(S+1<<2):O=new ArrayBuffer(F);for(var It=new Uint32Array(O);T>8&255,F[O+2]=It>>16&255,F[O+3]=It>>24&255;T%a===0&&B(M)}return E&&(O=T<<2,It=M[R],F[O]=It&255,E>1&&(F[O+1]=It>>8&255),E>2&&(F[O+2]=It>>16&255)),F};function v(a,M,S){f.call(this,a,M,S)}v.prototype=new f,v.prototype.finalize=function(){return this.encode(this.outputBits,!0),f.prototype.finalize.call(this)};var B=function(a){var M,S,E,R,T,F,O,It,q,L,xr,J,Z,br,W,X,yr,V,j,wr,$,Y,Mr,Q,tt,_r,rt,et,Ar,it,nt,Sr,ft,ot,Er,st,at,Ir,ht,ut,Nr,lt,ct,Pr,dt,vt,Rr,pt,mt,Or,gt,xt,Fr,bt,yt,kr,wt,Mt,hr,ur,lr,cr,dr;for(E=0;E<48;E+=2)R=a[0]^a[10]^a[20]^a[30]^a[40],T=a[1]^a[11]^a[21]^a[31]^a[41],F=a[2]^a[12]^a[22]^a[32]^a[42],O=a[3]^a[13]^a[23]^a[33]^a[43],It=a[4]^a[14]^a[24]^a[34]^a[44],q=a[5]^a[15]^a[25]^a[35]^a[45],L=a[6]^a[16]^a[26]^a[36]^a[46],xr=a[7]^a[17]^a[27]^a[37]^a[47],J=a[8]^a[18]^a[28]^a[38]^a[48],Z=a[9]^a[19]^a[29]^a[39]^a[49],M=J^(F<<1|O>>>31),S=Z^(O<<1|F>>>31),a[0]^=M,a[1]^=S,a[10]^=M,a[11]^=S,a[20]^=M,a[21]^=S,a[30]^=M,a[31]^=S,a[40]^=M,a[41]^=S,M=R^(It<<1|q>>>31),S=T^(q<<1|It>>>31),a[2]^=M,a[3]^=S,a[12]^=M,a[13]^=S,a[22]^=M,a[23]^=S,a[32]^=M,a[33]^=S,a[42]^=M,a[43]^=S,M=F^(L<<1|xr>>>31),S=O^(xr<<1|L>>>31),a[4]^=M,a[5]^=S,a[14]^=M,a[15]^=S,a[24]^=M,a[25]^=S,a[34]^=M,a[35]^=S,a[44]^=M,a[45]^=S,M=It^(J<<1|Z>>>31),S=q^(Z<<1|J>>>31),a[6]^=M,a[7]^=S,a[16]^=M,a[17]^=S,a[26]^=M,a[27]^=S,a[36]^=M,a[37]^=S,a[46]^=M,a[47]^=S,M=L^(R<<1|T>>>31),S=xr^(T<<1|R>>>31),a[8]^=M,a[9]^=S,a[18]^=M,a[19]^=S,a[28]^=M,a[29]^=S,a[38]^=M,a[39]^=S,a[48]^=M,a[49]^=S,br=a[0],W=a[1],vt=a[11]<<4|a[10]>>>28,Rr=a[10]<<4|a[11]>>>28,et=a[20]<<3|a[21]>>>29,Ar=a[21]<<3|a[20]>>>29,ur=a[31]<<9|a[30]>>>23,lr=a[30]<<9|a[31]>>>23,lt=a[40]<<18|a[41]>>>14,ct=a[41]<<18|a[40]>>>14,ot=a[2]<<1|a[3]>>>31,Er=a[3]<<1|a[2]>>>31,X=a[13]<<12|a[12]>>>20,yr=a[12]<<12|a[13]>>>20,pt=a[22]<<10|a[23]>>>22,mt=a[23]<<10|a[22]>>>22,it=a[33]<<13|a[32]>>>19,nt=a[32]<<13|a[33]>>>19,cr=a[42]<<2|a[43]>>>30,dr=a[43]<<2|a[42]>>>30,bt=a[5]<<30|a[4]>>>2,yt=a[4]<<30|a[5]>>>2,st=a[14]<<6|a[15]>>>26,at=a[15]<<6|a[14]>>>26,V=a[25]<<11|a[24]>>>21,j=a[24]<<11|a[25]>>>21,Or=a[34]<<15|a[35]>>>17,gt=a[35]<<15|a[34]>>>17,Sr=a[45]<<29|a[44]>>>3,ft=a[44]<<29|a[45]>>>3,Q=a[6]<<28|a[7]>>>4,tt=a[7]<<28|a[6]>>>4,kr=a[17]<<23|a[16]>>>9,wt=a[16]<<23|a[17]>>>9,Ir=a[26]<<25|a[27]>>>7,ht=a[27]<<25|a[26]>>>7,wr=a[36]<<21|a[37]>>>11,$=a[37]<<21|a[36]>>>11,xt=a[47]<<24|a[46]>>>8,Fr=a[46]<<24|a[47]>>>8,Pr=a[8]<<27|a[9]>>>5,dt=a[9]<<27|a[8]>>>5,_r=a[18]<<20|a[19]>>>12,rt=a[19]<<20|a[18]>>>12,Mt=a[29]<<7|a[28]>>>25,hr=a[28]<<7|a[29]>>>25,ut=a[38]<<8|a[39]>>>24,Nr=a[39]<<8|a[38]>>>24,Y=a[48]<<14|a[49]>>>18,Mr=a[49]<<14|a[48]>>>18,a[0]=br^~X&V,a[1]=W^~yr&j,a[10]=Q^~_r&et,a[11]=tt^~rt&Ar,a[20]=ot^~st&Ir,a[21]=Er^~at&ht,a[30]=Pr^~vt&pt,a[31]=dt^~Rr&mt,a[40]=bt^~kr&Mt,a[41]=yt^~wt&hr,a[2]=X^~V&wr,a[3]=yr^~j&$,a[12]=_r^~et&it,a[13]=rt^~Ar&nt,a[22]=st^~Ir&ut,a[23]=at^~ht&Nr,a[32]=vt^~pt&Or,a[33]=Rr^~mt>,a[42]=kr^~Mt&ur,a[43]=wt^~hr&lr,a[4]=V^~wr&Y,a[5]=j^~$&Mr,a[14]=et^~it&Sr,a[15]=Ar^~nt&ft,a[24]=Ir^~ut<,a[25]=ht^~Nr&ct,a[34]=pt^~Or&xt,a[35]=mt^~gt&Fr,a[44]=Mt^~ur&cr,a[45]=hr^~lr&dr,a[6]=wr^~Y&br,a[7]=$^~Mr&W,a[16]=it^~Sr&Q,a[17]=nt^~ft&tt,a[26]=ut^~lt&ot,a[27]=Nr^~ct&Er,a[36]=Or^~xt&Pr,a[37]=gt^~Fr&dt,a[46]=ur^~cr&bt,a[47]=lr^~dr&yt,a[8]=Y^~br&X,a[9]=Mr^~W&yr,a[18]=Sr^~Q&_r,a[19]=ft^~tt&rt,a[28]=lt^~ot&st,a[29]=ct^~Er&at,a[38]=xt^~Pr&vt,a[39]=Fr^~dt&Rr,a[48]=cr^~bt&kr,a[49]=dr^~yt&wt,a[0]^=k[E],a[1]^=k[E+1]};if(m)ne.exports=r;else{for(h=0;h{Pi.exports=Ni;function Ni(e,t){if(!e)throw new Error(t||"Assertion failed")}Ni.equal=function(t,i,s){if(t!=i)throw new Error(s||"Assertion failed: "+t+" != "+i)}});var Ri=Ft((g0,Ce)=>{typeof Object.create=="function"?Ce.exports=function(t,i){i&&(t.super_=i,t.prototype=Object.create(i.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:Ce.exports=function(t,i){if(i){t.super_=i;var s=function(){};s.prototype=i.prototype,t.prototype=new s,t.prototype.constructor=t}}});var Wt=Ft(H=>{"use strict";var zn=Ur(),Kn=Ri();H.inherits=Kn;function Hn(e,t){return(e.charCodeAt(t)&64512)!==55296||t<0||t+1>=e.length?!1:(e.charCodeAt(t+1)&64512)===56320}function Gn(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var i=[];if(typeof e=="string")if(t){if(t==="hex")for(e=e.replace(/[^a-z0-9]+/ig,""),e.length%2!==0&&(e="0"+e),n=0;n>6|192,i[s++]=l&63|128):Hn(e,n)?(l=65536+((l&1023)<<10)+(e.charCodeAt(++n)&1023),i[s++]=l>>18|240,i[s++]=l>>12&63|128,i[s++]=l>>6&63|128,i[s++]=l&63|128):(i[s++]=l>>12|224,i[s++]=l>>6&63|128,i[s++]=l&63|128)}else for(n=0;n>>24|e>>>8&65280|e<<8&16711680|(e&255)<<24;return t>>>0}H.htonl=Oi;function Zn(e,t){for(var i="",s=0;s>>0}return l}H.join32=Wn;function Xn(e,t){for(var i=new Array(e.length*4),s=0,n=0;s>>24,i[n+1]=l>>>16&255,i[n+2]=l>>>8&255,i[n+3]=l&255):(i[n+3]=l>>>24,i[n+2]=l>>>16&255,i[n+1]=l>>>8&255,i[n]=l&255)}return i}H.split32=Xn;function Vn(e,t){return e>>>t|e<<32-t}H.rotr32=Vn;function jn(e,t){return e<>>32-t}H.rotl32=jn;function $n(e,t){return e+t>>>0}H.sum32=$n;function Yn(e,t,i){return e+t+i>>>0}H.sum32_3=Yn;function Qn(e,t,i,s){return e+t+i+s>>>0}H.sum32_4=Qn;function tf(e,t,i,s,n){return e+t+i+s+n>>>0}H.sum32_5=tf;function rf(e,t,i,s){var n=e[t],l=e[t+1],m=s+l>>>0,x=(m>>0,e[t+1]=m}H.sum64=rf;function ef(e,t,i,s){var n=t+s>>>0,l=(n>>0}H.sum64_hi=ef;function nf(e,t,i,s){var n=t+s;return n>>>0}H.sum64_lo=nf;function ff(e,t,i,s,n,l,m,x){var y=0,w=t;w=w+s>>>0,y+=w>>0,y+=w>>0,y+=w>>0}H.sum64_4_hi=ff;function of(e,t,i,s,n,l,m,x){var y=t+s+l+x;return y>>>0}H.sum64_4_lo=of;function sf(e,t,i,s,n,l,m,x,y,w){var A=0,_=t;_=_+s>>>0,A+=_>>0,A+=_>>0,A+=_>>0,A+=_>>0}H.sum64_5_hi=sf;function af(e,t,i,s,n,l,m,x,y,w){var A=t+s+l+x+w;return A>>>0}H.sum64_5_lo=af;function hf(e,t,i){var s=t<<32-i|e>>>i;return s>>>0}H.rotr64_hi=hf;function uf(e,t,i){var s=e<<32-i|t>>>i;return s>>>0}H.rotr64_lo=uf;function lf(e,t,i){return e>>>i}H.shr64_hi=lf;function cf(e,t,i){var s=e<<32-i|t>>>i;return s>>>0}H.shr64_lo=cf});var zr=Ft(qi=>{"use strict";var Bi=Wt(),df=Ur();function fe(){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}qi.BlockHash=fe;fe.prototype.update=function(t,i){if(t=Bi.toArray(t,i),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){t=this.pending;var s=t.length%this._delta8;this.pending=t.slice(t.length-s,t.length),this.pending.length===0&&(this.pending=null),t=Bi.join32(t,0,t.length-s,this.endian);for(var n=0;n>>24&255,n[l++]=t>>>16&255,n[l++]=t>>>8&255,n[l++]=t&255}else for(n[l++]=t&255,n[l++]=t>>>8&255,n[l++]=t>>>16&255,n[l++]=t>>>24&255,n[l++]=0,n[l++]=0,n[l++]=0,n[l++]=0,m=8;m{"use strict";var vf=Wt(),$t=vf.rotr32;function pf(e,t,i,s){if(e===0)return Ti(t,i,s);if(e===1||e===3)return Li(t,i,s);if(e===2)return Ci(t,i,s)}fr.ft_1=pf;function Ti(e,t,i){return e&t^~e&i}fr.ch32=Ti;function Ci(e,t,i){return e&t^e&i^t&i}fr.maj32=Ci;function Li(e,t,i){return e^t^i}fr.p32=Li;function mf(e){return $t(e,2)^$t(e,13)^$t(e,22)}fr.s0_256=mf;function gf(e){return $t(e,6)^$t(e,11)^$t(e,25)}fr.s1_256=gf;function xf(e){return $t(e,7)^$t(e,18)^e>>>3}fr.g0_256=xf;function bf(e){return $t(e,17)^$t(e,19)^e>>>10}fr.g1_256=bf});var zi=Ft((w0,Ui)=>{"use strict";var Kr=Wt(),yf=zr(),wf=Le(),De=Kr.rotl32,$r=Kr.sum32,Mf=Kr.sum32_5,_f=wf.ft_1,Di=yf.BlockHash,Af=[1518500249,1859775393,2400959708,3395469782];function Yt(){if(!(this instanceof Yt))return new Yt;Di.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}Kr.inherits(Yt,Di);Ui.exports=Yt;Yt.blockSize=512;Yt.outSize=160;Yt.hmacStrength=80;Yt.padLength=64;Yt.prototype._update=function(t,i){for(var s=this.W,n=0;n<16;n++)s[n]=t[i+n];for(;n{"use strict";var Hr=Wt(),Sf=zr(),Gr=Le(),Ef=Ur(),Xt=Hr.sum32,If=Hr.sum32_4,Nf=Hr.sum32_5,Pf=Gr.ch32,Rf=Gr.maj32,Of=Gr.s0_256,Ff=Gr.s1_256,kf=Gr.g0_256,Bf=Gr.g1_256,Ki=Sf.BlockHash,qf=[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 Qt(){if(!(this instanceof Qt))return new Qt;Ki.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=qf,this.W=new Array(64)}Hr.inherits(Qt,Ki);Hi.exports=Qt;Qt.blockSize=512;Qt.outSize=256;Qt.hmacStrength=192;Qt.padLength=64;Qt.prototype._update=function(t,i){for(var s=this.W,n=0;n<16;n++)s[n]=t[i+n];for(;n{"use strict";var ze=Wt(),Gi=Ue();function or(){if(!(this instanceof or))return new or;Gi.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}ze.inherits(or,Gi);Ji.exports=or;or.blockSize=512;or.outSize=224;or.hmacStrength=192;or.padLength=64;or.prototype._digest=function(t){return t==="hex"?ze.toHex32(this.h.slice(0,7),"big"):ze.split32(this.h.slice(0,7),"big")}});var Ge=Ft((A0,ji)=>{"use strict";var Dt=Wt(),Tf=zr(),Cf=Ur(),tr=Dt.rotr64_hi,rr=Dt.rotr64_lo,Wi=Dt.shr64_hi,Xi=Dt.shr64_lo,pr=Dt.sum64,Ke=Dt.sum64_hi,He=Dt.sum64_lo,Lf=Dt.sum64_4_hi,Df=Dt.sum64_4_lo,Uf=Dt.sum64_5_hi,zf=Dt.sum64_5_lo,Vi=Tf.BlockHash,Kf=[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 Vt(){if(!(this instanceof Vt))return new Vt;Vi.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=Kf,this.W=new Array(160)}Dt.inherits(Vt,Vi);ji.exports=Vt;Vt.blockSize=1024;Vt.outSize=512;Vt.hmacStrength=192;Vt.padLength=128;Vt.prototype._prepareBlock=function(t,i){for(var s=this.W,n=0;n<32;n++)s[n]=t[i+n];for(;n{"use strict";var Je=Wt(),$i=Ge();function sr(){if(!(this instanceof sr))return new sr;$i.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}Je.inherits(sr,$i);Yi.exports=sr;sr.blockSize=1024;sr.outSize=384;sr.hmacStrength=192;sr.padLength=128;sr.prototype._digest=function(t){return t==="hex"?Je.toHex32(this.h.slice(0,12),"big"):Je.split32(this.h.slice(0,12),"big")}});var tn=Ft(Jr=>{"use strict";Jr.sha1=zi();Jr.sha224=Zi();Jr.sha256=Ue();Jr.sha384=Qi();Jr.sha512=Ge()});var sn=Ft(on=>{"use strict";var qr=Wt(),ro=zr(),oe=qr.rotl32,rn=qr.sum32,Yr=qr.sum32_3,en=qr.sum32_4,fn=ro.BlockHash;function er(){if(!(this instanceof er))return new er;fn.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}qr.inherits(er,fn);on.ripemd160=er;er.blockSize=512;er.outSize=160;er.hmacStrength=192;er.padLength=64;er.prototype._update=function(t,i){for(var s=this.h[0],n=this.h[1],l=this.h[2],m=this.h[3],x=this.h[4],y=s,w=n,A=l,_=m,I=x,P=0;P<80;P++){var N=rn(oe(en(s,nn(P,n,l,m),t[no[P]+i],eo(P)),oo[P]),x);s=x,x=m,m=oe(l,10),l=n,n=N,N=rn(oe(en(y,nn(79-P,w,A,_),t[fo[P]+i],io(P)),so[P]),I),y=I,I=_,_=oe(A,10),A=w,w=N}N=Yr(this.h[1],l,_),this.h[1]=Yr(this.h[2],m,I),this.h[2]=Yr(this.h[3],x,y),this.h[3]=Yr(this.h[4],s,w),this.h[4]=Yr(this.h[0],n,A),this.h[0]=N};er.prototype._digest=function(t){return t==="hex"?qr.toHex32(this.h,"little"):qr.split32(this.h,"little")};function nn(e,t,i,s){return e<=15?t^i^s:e<=31?t&i|~t&s:e<=47?(t|~i)^s:e<=63?t&s|i&~s:t^(i|~s)}function eo(e){return e<=15?0:e<=31?1518500249:e<=47?1859775393:e<=63?2400959708:2840853838}function io(e){return e<=15?1352829926:e<=31?1548603684:e<=47?1836072691:e<=63?2053994217:0}var no=[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],fo=[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],oo=[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],so=[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 hn=Ft((N0,an)=>{"use strict";var ao=Wt(),ho=Ur();function Zr(e,t,i){if(!(this instanceof Zr))return new Zr(e,t,i);this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(ao.toArray(t,i))}an.exports=Zr;Zr.prototype._init=function(t){t.length>this.blockSize&&(t=new this.Hash().update(t).digest()),ho(t.length<=this.blockSize);for(var i=t.length;i{var kt=un;kt.utils=Wt();kt.common=zr();kt.sha=tn();kt.ripemd=sn();kt.hmac=hn();kt.sha1=kt.sha.sha1;kt.sha256=kt.sha.sha256;kt.sha224=kt.sha.sha224;kt.sha384=kt.sha.sha384;kt.sha512=kt.sha.sha512;kt.ripemd160=kt.ripemd.ripemd160});var ii="logger/5.7.0";var ni=!1,fi=!1,te={debug:1,default:2,info:2,warning:3,error:4,off:5},oi=te.default,Ie=null;function Rn(){try{let e=[];if(["NFD","NFC","NFKD","NFKC"].forEach(t=>{try{if("test".normalize(t)!=="test")throw new Error("bad normalize")}catch{e.push(t)}}),e.length)throw new Error("missing "+e.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(e){return e.message}return null}var si=Rn(),Ne;(function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"})(Ne||(Ne={}));var Jt;(function(e){e.UNKNOWN_ERROR="UNKNOWN_ERROR",e.NOT_IMPLEMENTED="NOT_IMPLEMENTED",e.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.TIMEOUT="TIMEOUT",e.BUFFER_OVERRUN="BUFFER_OVERRUN",e.NUMERIC_FAULT="NUMERIC_FAULT",e.MISSING_NEW="MISSING_NEW",e.INVALID_ARGUMENT="INVALID_ARGUMENT",e.MISSING_ARGUMENT="MISSING_ARGUMENT",e.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",e.CALL_EXCEPTION="CALL_EXCEPTION",e.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",e.NONCE_EXPIRED="NONCE_EXPIRED",e.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",e.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",e.TRANSACTION_REPLACED="TRANSACTION_REPLACED",e.ACTION_REJECTED="ACTION_REJECTED"})(Jt||(Jt={}));var ai="0123456789abcdef",z=class{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,i){let s=t.toLowerCase();te[s]==null&&this.throwArgumentError("invalid log level name","logLevel",t),!(oi>te[s])&&console.log.apply(console,i)}debug(...t){this._log(z.levels.DEBUG,t)}info(...t){this._log(z.levels.INFO,t)}warn(...t){this._log(z.levels.WARNING,t)}makeError(t,i,s){if(fi)return this.makeError("censored error",i,{});i||(i=z.errors.UNKNOWN_ERROR),s||(s={});let n=[];Object.keys(s).forEach(y=>{let w=s[y];try{if(w instanceof Uint8Array){let A="";for(let _=0;_>4],A+=ai[w[_]&15];n.push(y+"=Uint8Array(0x"+A+")")}else n.push(y+"="+JSON.stringify(w))}catch{n.push(y+"="+JSON.stringify(s[y].toString()))}}),n.push(`code=${i}`),n.push(`version=${this.version}`);let l=t,m="";switch(i){case Jt.NUMERIC_FAULT:{m="NUMERIC_FAULT";let y=t;switch(y){case"overflow":case"underflow":case"division-by-zero":m+="-"+y;break;case"negative-power":case"negative-width":m+="-unsupported";break;case"unbound-bitwise-result":m+="-unbound-result";break}break}case Jt.CALL_EXCEPTION:case Jt.INSUFFICIENT_FUNDS:case Jt.MISSING_NEW:case Jt.NONCE_EXPIRED:case Jt.REPLACEMENT_UNDERPRICED:case Jt.TRANSACTION_REPLACED:case Jt.UNPREDICTABLE_GAS_LIMIT:m=i;break}m&&(t+=" [ See: https://links.ethers.org/v5-errors-"+m+" ]"),n.length&&(t+=" ("+n.join(", ")+")");let x=new Error(t);return x.reason=l,x.code=i,Object.keys(s).forEach(function(y){x[y]=s[y]}),x}throwError(t,i,s){throw this.makeError(t,i,s)}throwArgumentError(t,i,s){return this.throwError(t,z.errors.INVALID_ARGUMENT,{argument:i,value:s})}assert(t,i,s,n){t||this.throwError(i,s,n)}assertArgument(t,i,s,n){t||this.throwArgumentError(i,s,n)}checkNormalize(t){t==null&&(t="platform missing String.prototype.normalize"),si&&this.throwError("platform missing String.prototype.normalize",z.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:si})}checkSafeUint53(t,i){typeof t=="number"&&(i==null&&(i="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(i,z.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(i,z.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,i,s){s?s=": "+s:s="",ti&&this.throwError("too many arguments"+s,z.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:i})}checkNew(t,i){(t===Object||t==null)&&this.throwError("missing new",z.errors.MISSING_NEW,{name:i.name})}checkAbstract(t,i){t===i?this.throwError("cannot instantiate abstract class "+JSON.stringify(i.name)+" directly; use a sub-class",z.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):(t===Object||t==null)&&this.throwError("missing new",z.errors.MISSING_NEW,{name:i.name})}static globalLogger(){return Ie||(Ie=new z(ii)),Ie}static setCensorship(t,i){if(!t&&i&&this.globalLogger().throwError("cannot permanently disable censorship",z.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),ni){if(!t)return;this.globalLogger().throwError("error censorship permanent",z.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}fi=!!t,ni=!!i}static setLogLevel(t){let i=te[t.toLowerCase()];if(i==null){z.globalLogger().warn("invalid log level - "+t);return}oi=i}static from(t){return new z(t)}};z.errors=Jt;z.levels=Ne;var hi="bytes/5.7.0";var Nt=new z(hi);function li(e){return!!e.toHexString}function Cr(e){return e.slice||(e.slice=function(){let t=Array.prototype.slice.call(arguments);return Cr(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function ci(e){return Zt(e)&&!(e.length%2)||Re(e)}function ui(e){return typeof e=="number"&&e==e&&e%1===0}function Re(e){if(e==null)return!1;if(e.constructor===Uint8Array)return!0;if(typeof e=="string"||!ui(e.length)||e.length<0)return!1;for(let t=0;t=256)return!1}return!0}function _t(e,t){if(t||(t={}),typeof e=="number"){Nt.checkSafeUint53(e,"invalid arrayify value");let i=[];for(;e;)i.unshift(e&255),e=parseInt(String(e/256));return i.length===0&&i.push(0),Cr(new Uint8Array(i))}if(t.allowMissingPrefix&&typeof e=="string"&&e.substring(0,2)!=="0x"&&(e="0x"+e),li(e)&&(e=e.toHexString()),Zt(e)){let i=e.substring(2);i.length%2&&(t.hexPad==="left"?i="0"+i:t.hexPad==="right"?i+="0":Nt.throwArgumentError("hex data is odd-length","value",e));let s=[];for(let n=0;n_t(n)),i=t.reduce((n,l)=>n+l.length,0),s=new Uint8Array(i);return t.reduce((n,l)=>(s.set(l,n),n+l.length),0),Cr(s)}function On(e,t){e=_t(e),e.length>t&&Nt.throwArgumentError("value out of range","value",arguments[0]);let i=new Uint8Array(t);return i.set(e,t-e.length),Cr(i)}function Zt(e,t){return!(typeof e!="string"||!e.match(/^0x[0-9A-Fa-f]*$/)||t&&e.length!==2+2*t)}var Pe="0123456789abcdef";function Tt(e,t){if(t||(t={}),typeof e=="number"){Nt.checkSafeUint53(e,"invalid hexlify value");let i="";for(;e;)i=Pe[e&15]+i,e=Math.floor(e/16);return i.length?(i.length%2&&(i="0"+i),"0x"+i):"0x00"}if(typeof e=="bigint")return e=e.toString(16),e.length%2?"0x0"+e:"0x"+e;if(t.allowMissingPrefix&&typeof e=="string"&&e.substring(0,2)!=="0x"&&(e="0x"+e),li(e))return e.toHexString();if(Zt(e))return e.length%2&&(t.hexPad==="left"?e="0x0"+e.substring(2):t.hexPad==="right"?e+="0":Nt.throwArgumentError("hex data is odd-length","value",e)),e.toLowerCase();if(Re(e)){let i="0x";for(let s=0;s>4]+Pe[n&15]}return i}return Nt.throwArgumentError("invalid hexlify value","value",e)}function re(e){if(typeof e!="string")e=Tt(e);else if(!Zt(e)||e.length%2)return null;return(e.length-2)/2}function ee(e,t,i){return typeof e!="string"?e=Tt(e):(!Zt(e)||e.length%2)&&Nt.throwArgumentError("invalid hexData","value",e),t=2+2*t,i!=null?"0x"+e.substring(t,2+2*i):"0x"+e.substring(t)}function vr(e,t){for(typeof e!="string"?e=Tt(e):Zt(e)||Nt.throwArgumentError("invalid hex string","value",e),e.length>2*t+2&&Nt.throwArgumentError("value out of range","value",arguments[1]);e.length<2*t+2;)e="0x0"+e.substring(2);return e}function ie(e){let t={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(ci(e)){let i=_t(e);i.length===64?(t.v=27+(i[32]>>7),i[32]&=127,t.r=Tt(i.slice(0,32)),t.s=Tt(i.slice(32,64))):i.length===65?(t.r=Tt(i.slice(0,32)),t.s=Tt(i.slice(32,64)),t.v=i[64]):Nt.throwArgumentError("invalid signature string","signature",e),t.v<27&&(t.v===0||t.v===1?t.v+=27:Nt.throwArgumentError("signature invalid v byte","signature",e)),t.recoveryParam=1-t.v%2,t.recoveryParam&&(i[32]|=128),t._vs=Tt(i.slice(32,64))}else{if(t.r=e.r,t.s=e.s,t.v=e.v,t.recoveryParam=e.recoveryParam,t._vs=e._vs,t._vs!=null){let n=On(_t(t._vs),32);t._vs=Tt(n);let l=n[0]>=128?1:0;t.recoveryParam==null?t.recoveryParam=l:t.recoveryParam!==l&&Nt.throwArgumentError("signature recoveryParam mismatch _vs","signature",e),n[0]&=127;let m=Tt(n);t.s==null?t.s=m:t.s!==m&&Nt.throwArgumentError("signature v mismatch _vs","signature",e)}if(t.recoveryParam==null)t.v==null?Nt.throwArgumentError("signature missing v and recoveryParam","signature",e):t.v===0||t.v===1?t.recoveryParam=t.v:t.recoveryParam=1-t.v%2;else if(t.v==null)t.v=27+t.recoveryParam;else{let n=t.v===0||t.v===1?t.v:1-t.v%2;t.recoveryParam!==n&&Nt.throwArgumentError("signature recoveryParam mismatch v","signature",e)}t.r==null||!Zt(t.r)?Nt.throwArgumentError("signature missing or invalid r","signature",e):t.r=vr(t.r,32),t.s==null||!Zt(t.s)?Nt.throwArgumentError("signature missing or invalid s","signature",e):t.s=vr(t.s,32);let i=_t(t.s);i[0]>=128&&Nt.throwArgumentError("signature s out of range","signature",e),t.recoveryParam&&(i[0]|=128);let s=Tt(i);t._vs&&(Zt(t._vs)||Nt.throwArgumentError("signature invalid _vs","signature",e),t._vs=vr(t._vs,32)),t._vs==null?t._vs=s:t._vs!==s&&Nt.throwArgumentError("signature _vs mismatch v and s","signature",e)}return t.yParityAndS=t._vs,t.compact=t.r+t.yParityAndS.substring(2),t}var mi=Qr(ke());var pi="bignumber/5.7.0";var Fn=mi.default.BN,Bo=new z(pi);function Be(e){return new Fn(e,36).toString(16)}var xi=Qr(gi());function Lr(e){return"0x"+xi.default.keccak_256(_t(e))}var bi="address/5.7.0";var Xr=new z(bi);function yi(e){Zt(e,20)||Xr.throwArgumentError("invalid address","address",e),e=e.toLowerCase();let t=e.substring(2).split(""),i=new Uint8Array(40);for(let n=0;n<40;n++)i[n]=t[n].charCodeAt(0);let s=_t(Lr(i));for(let n=0;n<40;n+=2)s[n>>1]>>4>=8&&(t[n]=t[n].toUpperCase()),(s[n>>1]&15)>=8&&(t[n+1]=t[n+1].toUpperCase());return"0x"+t.join("")}var qn=9007199254740991;function Tn(e){return Math.log10?Math.log10(e):Math.log(e)/Math.LN10}var qe={};for(let e=0;e<10;e++)qe[String(e)]=String(e);for(let e=0;e<26;e++)qe[String.fromCharCode(65+e)]=String(10+e);var wi=Math.floor(Tn(qn));function Cn(e){e=e.toUpperCase(),e=e.substring(4)+e.substring(0,2)+"00";let t=e.split("").map(s=>qe[s]).join("");for(;t.length>=wi;){let s=t.substring(0,wi);t=parseInt(s,10)%97+t.substring(s.length)}let i=String(98-parseInt(t,10)%97);for(;i.length<2;)i="0"+i;return i}function Mi(e){let t=null;if(typeof e!="string"&&Xr.throwArgumentError("invalid address","address",e),e.match(/^(0x)?[0-9a-fA-F]{40}$/))e.substring(0,2)!=="0x"&&(e="0x"+e),t=yi(e),e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&t!==e&&Xr.throwArgumentError("bad address checksum","address",e);else if(e.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(e.substring(2,4)!==Cn(e)&&Xr.throwArgumentError("bad icap checksum","address",e),t=Be(e.substring(4));t.length<40;)t="0"+t;t=yi("0x"+t)}else Xr.throwArgumentError("invalid address","address",e);return t}var _i="properties/5.7.0";var Yo=new z(_i);function Dr(e,t,i){Object.defineProperty(e,t,{enumerable:!0,value:i,writable:!1})}var Ai="strings/5.7.0";var Si=new z(Ai),Vr;(function(e){e.current="",e.NFC="NFC",e.NFD="NFD",e.NFKC="NFKC",e.NFKD="NFKD"})(Vr||(Vr={}));var Br;(function(e){e.UNEXPECTED_CONTINUE="unexpected continuation byte",e.BAD_PREFIX="bad codepoint prefix",e.OVERRUN="string overrun",e.MISSING_CONTINUE="missing continuation byte",e.OUT_OF_RANGE="out of UTF-8 range",e.UTF16_SURROGATE="UTF-16 surrogate",e.OVERLONG="overlong representation"})(Br||(Br={}));function Ln(e,t,i,s,n){return Si.throwArgumentError(`invalid codepoint at offset ${t}; ${e}`,"bytes",i)}function Ei(e,t,i,s,n){if(e===Br.BAD_PREFIX||e===Br.UNEXPECTED_CONTINUE){let l=0;for(let m=t+1;m>6===2;m++)l++;return l}return e===Br.OVERRUN?i.length-t-1:0}function Dn(e,t,i,s,n){return e===Br.OVERLONG?(s.push(n),0):(s.push(65533),Ei(e,t,i,s,n))}var Un=Object.freeze({error:Ln,ignore:Ei,replace:Dn});function jr(e,t=Vr.current){t!=Vr.current&&(Si.checkNormalize(),e=e.normalize(t));let i=[];for(let s=0;s>6|192),i.push(n&63|128);else if((n&64512)==55296){s++;let l=e.charCodeAt(s);if(s>=e.length||(l&64512)!==56320)throw new Error("invalid utf-8 string");let m=65536+((n&1023)<<10)+(l&1023);i.push(m>>18|240),i.push(m>>12&63|128),i.push(m>>6&63|128),i.push(m&63|128)}else i.push(n>>12|224),i.push(n>>6&63|128),i.push(n&63|128)}return _t(i)}var Ii=`Ethereum Signed Message: -`;function Te(e){return typeof e=="string"&&(e=jr(e)),Lr(Oe([jr(Ii),jr(String(e.length)),e]))}var D=Qr(ke()),ir=Qr(ln());function Wr(e,t,i){return i={path:t,exports:{},require:function(s,n){return uo(s,n??i.path)}},e(i,i.exports),i.exports}function uo(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var Ve=dn;function dn(e,t){if(!e)throw new Error(t||"Assertion failed")}dn.equal=function(t,i,s){if(t!=i)throw new Error(s||"Assertion failed: "+t+" != "+i)};var jt=Wr(function(e,t){"use strict";var i=t;function s(m,x){if(Array.isArray(m))return m.slice();if(!m)return[];var y=[];if(typeof m!="string"){for(var w=0;w>8,I=A&255;_?y.push(_,I):y.push(I)}return y}i.toArray=s;function n(m){return m.length===1?"0"+m:m}i.zero2=n;function l(m){for(var x="",y=0;y(I>>1)-1?k=(I>>1)-U:k=U,P.isubn(k)):k=0,_[N]=k,P.iushrn(1)}return _}i.getNAF=s;function n(y,w){var A=[[],[]];y=y.clone(),w=w.clone();for(var _=0,I=0,P;y.cmpn(-_)>0||w.cmpn(-I)>0;){var N=y.andln(3)+_&3,k=w.andln(3)+I&3;N===3&&(N=-1),k===3&&(k=-1);var U;(N&1)===0?U=0:(P=y.andln(7)+_&7,(P===3||P===5)&&k===2?U=-N:U=N),A[0].push(U);var C;(k&1)===0?C=0:(P=w.andln(7)+I&7,(P===3||P===5)&&N===2?C=-k:C=k),A[1].push(C),2*_===U+1&&(_=1-_),2*I===C+1&&(I=1-I),y.iushrn(1),w.iushrn(1)}return A}i.getJSF=n;function l(y,w,A){var _="_"+w;y.prototype[w]=function(){return this[_]!==void 0?this[_]:this[_]=A.call(this)}}i.cachedProperty=l;function m(y){return typeof y=="string"?i.toArray(y,"hex"):y}i.parseBytes=m;function x(y){return new D.default(y,"hex","le")}i.intFromLE=x}),he=Ut.getNAF,lo=Ut.getJSF,ue=Ut.assert;function gr(e,t){this.type=e,this.p=new D.default(t.p,16),this.red=t.prime?D.default.red(t.prime):D.default.mont(this.p),this.zero=new D.default(0).toRed(this.red),this.one=new D.default(1).toRed(this.red),this.two=new D.default(2).toRed(this.red),this.n=t.n&&new D.default(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 i=this.n&&this.p.div(this.n);!i||i.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Tr=gr;gr.prototype.point=function(){throw new Error("Not implemented")};gr.prototype.validate=function(){throw new Error("Not implemented")};gr.prototype._fixedNafMul=function(t,i){ue(t.precomputed);var s=t._getDoubles(),n=he(i,1,this._bitLength),l=(1<=x;w--)y=(y<<1)+n[w];m.push(y)}for(var A=this.jpoint(null,null,null),_=this.jpoint(null,null,null),I=l;I>0;I--){for(x=0;x=0;y--){for(var w=0;y>=0&&m[y]===0;y--)w++;if(y>=0&&w++,x=x.dblp(w),y<0)break;var A=m[y];ue(A!==0),t.type==="affine"?A>0?x=x.mixedAdd(l[A-1>>1]):x=x.mixedAdd(l[-A-1>>1].neg()):A>0?x=x.add(l[A-1>>1]):x=x.add(l[-A-1>>1].neg())}return t.type==="affine"?x.toP():x};gr.prototype._wnafMulAdd=function(t,i,s,n,l){var m=this._wnafT1,x=this._wnafT2,y=this._wnafT3,w=0,A,_,I;for(A=0;A=1;A-=2){var N=A-1,k=A;if(m[N]!==1||m[k]!==1){y[N]=he(s[N],m[N],this._bitLength),y[k]=he(s[k],m[k],this._bitLength),w=Math.max(y[N].length,w),w=Math.max(y[k].length,w);continue}var U=[i[N],null,null,i[k]];i[N].y.cmp(i[k].y)===0?(U[1]=i[N].add(i[k]),U[2]=i[N].toJ().mixedAdd(i[k].neg())):i[N].y.cmp(i[k].y.redNeg())===0?(U[1]=i[N].toJ().mixedAdd(i[k]),U[2]=i[N].add(i[k].neg())):(U[1]=i[N].toJ().mixedAdd(i[k]),U[2]=i[N].toJ().mixedAdd(i[k].neg()));var C=[-3,-1,-5,-7,0,7,5,1,3],St=lo(s[N],s[k]);for(w=Math.max(St[0].length,w),y[N]=new Array(w),y[k]=new Array(w),_=0;_=0;A--){for(var Ot=0;A>=0;){var qt=!0;for(_=0;_=0&&Ot++,Et=Et.dblp(Ot),A<0)break;for(_=0;_0?I=x[_][Lt-1>>1]:Lt<0&&(I=x[_][-Lt-1>>1].neg()),I.type==="affine"?Et=Et.mixedAdd(I):Et=Et.add(I))}}for(A=0;A=Math.ceil((t.bitLength()+1)/i.step):!1};Ht.prototype._getDoubles=function(t,i){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var s=[this],n=this,l=0;l=0&&(P=w,N=A),_.negative&&(_=_.neg(),I=I.neg()),P.negative&&(P=P.neg(),N=N.neg()),[{a:_,b:I},{a:P,b:N}]};Gt.prototype._endoSplit=function(t){var i=this.endo.basis,s=i[0],n=i[1],l=n.b.mul(t).divRound(this.n),m=s.b.neg().mul(t).divRound(this.n),x=l.mul(s.a),y=m.mul(n.a),w=l.mul(s.b),A=m.mul(n.b),_=t.sub(x).sub(y),I=w.add(A).neg();return{k1:_,k2:I}};Gt.prototype.pointFromX=function(t,i){t=new D.default(t,16),t.red||(t=t.toRed(this.red));var s=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),n=s.redSqrt();if(n.redSqr().redSub(s).cmp(this.zero)!==0)throw new Error("invalid point");var l=n.fromRed().isOdd();return(i&&!l||!i&&l)&&(n=n.redNeg()),this.point(t,n)};Gt.prototype.validate=function(t){if(t.inf)return!0;var i=t.x,s=t.y,n=this.a.redMul(i),l=i.redSqr().redMul(i).redIAdd(n).redIAdd(this.b);return s.redSqr().redISub(l).cmpn(0)===0};Gt.prototype._endoWnafMulAdd=function(t,i,s){for(var n=this._endoWnafT1,l=this._endoWnafT2,m=0;m":""};Pt.prototype.isInfinity=function(){return this.inf};Pt.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 i=this.y.redSub(t.y);i.cmpn(0)!==0&&(i=i.redMul(this.x.redSub(t.x).redInvm()));var s=i.redSqr().redISub(this.x).redISub(t.x),n=i.redMul(this.x.redSub(s)).redISub(this.y);return this.curve.point(s,n)};Pt.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 i=this.curve.a,s=this.x.redSqr(),n=t.redInvm(),l=s.redAdd(s).redIAdd(s).redIAdd(i).redMul(n),m=l.redSqr().redISub(this.x.redAdd(this.x)),x=l.redMul(this.x.redSub(m)).redISub(this.y);return this.curve.point(m,x)};Pt.prototype.getX=function(){return this.x.fromRed()};Pt.prototype.getY=function(){return this.y.fromRed()};Pt.prototype.mul=function(t){return t=new D.default(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)};Pt.prototype.mulAdd=function(t,i,s){var n=[this,i],l=[t,s];return this.curve.endo?this.curve._endoWnafMulAdd(n,l):this.curve._wnafMulAdd(1,n,l,2)};Pt.prototype.jmulAdd=function(t,i,s){var n=[this,i],l=[t,s];return this.curve.endo?this.curve._endoWnafMulAdd(n,l,!0):this.curve._wnafMulAdd(1,n,l,2,!0)};Pt.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)};Pt.prototype.neg=function(t){if(this.inf)return this;var i=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var s=this.precomputed,n=function(l){return l.neg()};i.precomputed={naf:s.naf&&{wnd:s.naf.wnd,points:s.naf.points.map(n)},doubles:s.doubles&&{step:s.doubles.step,points:s.doubles.points.map(n)}}}return i};Pt.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 Bt(e,t,i,s){Tr.BasePoint.call(this,e,"jacobian"),t===null&&i===null&&s===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new D.default(0)):(this.x=new D.default(t,16),this.y=new D.default(i,16),this.z=new D.default(s,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}je(Bt,Tr.BasePoint);Gt.prototype.jpoint=function(t,i,s){return new Bt(this,t,i,s)};Bt.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),i=t.redSqr(),s=this.x.redMul(i),n=this.y.redMul(i).redMul(t);return this.curve.point(s,n)};Bt.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};Bt.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var i=t.z.redSqr(),s=this.z.redSqr(),n=this.x.redMul(i),l=t.x.redMul(s),m=this.y.redMul(i.redMul(t.z)),x=t.y.redMul(s.redMul(this.z)),y=n.redSub(l),w=m.redSub(x);if(y.cmpn(0)===0)return w.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var A=y.redSqr(),_=A.redMul(y),I=n.redMul(A),P=w.redSqr().redIAdd(_).redISub(I).redISub(I),N=w.redMul(I.redISub(P)).redISub(m.redMul(_)),k=this.z.redMul(t.z).redMul(y);return this.curve.jpoint(P,N,k)};Bt.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var i=this.z.redSqr(),s=this.x,n=t.x.redMul(i),l=this.y,m=t.y.redMul(i).redMul(this.z),x=s.redSub(n),y=l.redSub(m);if(x.cmpn(0)===0)return y.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var w=x.redSqr(),A=w.redMul(x),_=s.redMul(w),I=y.redSqr().redIAdd(A).redISub(_).redISub(_),P=y.redMul(_.redISub(I)).redISub(l.redMul(A)),N=this.z.redMul(x);return this.curve.jpoint(I,P,N)};Bt.prototype.dblp=function(t){if(t===0)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var i;if(this.curve.zeroA||this.curve.threeA){var s=this;for(i=0;i=0)return!1;if(s.redIAdd(l),this.x.cmp(s)===0)return!0}};Bt.prototype.inspect=function(){return this.isInfinity()?"":""};Bt.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var se=Wr(function(e,t){"use strict";var i=t;i.base=Tr,i.short=vo,i.mont=null,i.edwards=null}),ae=Wr(function(e,t){"use strict";var i=t,s=Ut.assert;function n(x){x.type==="short"?this.curve=new se.short(x):x.type==="edwards"?this.curve=new se.edwards(x):this.curve=new se.mont(x),this.g=this.curve.g,this.n=this.curve.n,this.hash=x.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}i.PresetCurve=n;function l(x,y){Object.defineProperty(i,x,{configurable:!0,enumerable:!0,get:function(){var w=new n(y);return Object.defineProperty(i,x,{configurable:!0,enumerable:!0,value:w}),w}})}l("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:ir.default.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),l("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:ir.default.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),l("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:ir.default.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),l("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:ir.default.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"]}),l("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:ir.default.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"]}),l("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:ir.default.sha256,gRed:!1,g:["9"]}),l("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:ir.default.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var m;try{m=null.crash()}catch{m=void 0}l("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:ir.default.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",m]})});function mr(e){if(!(this instanceof mr))return new mr(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=jt.toArray(e.entropy,e.entropyEnc||"hex"),i=jt.toArray(e.nonce,e.nonceEnc||"hex"),s=jt.toArray(e.pers,e.persEnc||"hex");Ve(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,i,s)}var vn=mr;mr.prototype._init=function(t,i,s){var n=t.concat(i).concat(s);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var l=0;l=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(s||[])),this._reseed=1};mr.prototype.generate=function(t,i,s,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof i!="string"&&(n=s,s=i,i=null),s&&(s=jt.toArray(s,n||"hex"),this._update(s));for(var l=[];l.length"};var po=Ut.assert;function le(e,t){if(e instanceof le)return e;this._importDER(e,t)||(po(e.r&&e.s,"Signature without r or s"),this.r=new D.default(e.r,16),this.s=new D.default(e.s,16),e.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}var ce=le;function mo(){this.place=0}function Ze(e,t){var i=e[t.place++];if(!(i&128))return i;var s=i&15;if(s===0||s>4)return!1;for(var n=0,l=0,m=t.place;l>>=0;return n<=127?!1:(t.place=m,n)}function cn(e){for(var t=0,i=e.length-1;!e[t]&&!(e[t+1]&128)&&t>>3);for(e.push(i|128);--i;)e.push(t>>>(i<<3)&255);e.push(t)}le.prototype.toDER=function(t){var i=this.r.toArray(),s=this.s.toArray();for(i[0]&128&&(i=[0].concat(i)),s[0]&128&&(s=[0].concat(s)),i=cn(i),s=cn(s);!s[0]&&!(s[1]&128);)s=s.slice(1);var n=[2];We(n,i.length),n=n.concat(i),n.push(2),We(n,s.length);var l=n.concat(s),m=[48];return We(m,l.length),m=m.concat(l),Ut.encode(m,t)};var go=function(){throw new Error("unsupported")},pn=Ut.assert;function Kt(e){if(!(this instanceof Kt))return new Kt(e);typeof e=="string"&&(pn(Object.prototype.hasOwnProperty.call(ae,e),"Unknown curve "+e),e=ae[e]),e instanceof ae.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}var xo=Kt;Kt.prototype.keyPair=function(t){return new $e(this,t)};Kt.prototype.keyFromPrivate=function(t,i){return $e.fromPrivate(this,t,i)};Kt.prototype.keyFromPublic=function(t,i){return $e.fromPublic(this,t,i)};Kt.prototype.genKeyPair=function(t){t||(t={});for(var i=new vn({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||go(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),s=this.n.byteLength(),n=this.n.sub(new D.default(2));;){var l=new D.default(i.generate(s));if(!(l.cmp(n)>0))return l.iaddn(1),this.keyFromPrivate(l)}};Kt.prototype._truncateToN=function(t,i){var s=t.byteLength()*8-this.n.bitLength();return s>0&&(t=t.ushrn(s)),!i&&t.cmp(this.n)>=0?t.sub(this.n):t};Kt.prototype.sign=function(t,i,s,n){typeof s=="object"&&(n=s,s=null),n||(n={}),i=this.keyFromPrivate(i,s),t=this._truncateToN(new D.default(t,16));for(var l=this.n.byteLength(),m=i.getPrivate().toArray("be",l),x=t.toArray("be",l),y=new vn({hash:this.hash,entropy:m,nonce:x,pers:n.pers,persEnc:n.persEnc||"utf8"}),w=this.n.sub(new D.default(1)),A=0;;A++){var _=n.k?n.k(A):new D.default(y.generate(this.n.byteLength()));if(_=this._truncateToN(_,!0),!(_.cmpn(1)<=0||_.cmp(w)>=0)){var I=this.g.mul(_);if(!I.isInfinity()){var P=I.getX(),N=P.umod(this.n);if(N.cmpn(0)!==0){var k=_.invm(this.n).mul(N.mul(i.getPrivate()).iadd(t));if(k=k.umod(this.n),k.cmpn(0)!==0){var U=(I.getY().isOdd()?1:0)|(P.cmp(N)!==0?2:0);return n.canonical&&k.cmp(this.nh)>0&&(k=this.n.sub(k),U^=1),new ce({r:N,s:k,recoveryParam:U})}}}}}};Kt.prototype.verify=function(t,i,s,n){t=this._truncateToN(new D.default(t,16)),s=this.keyFromPublic(s,n),i=new ce(i,"hex");var l=i.r,m=i.s;if(l.cmpn(1)<0||l.cmp(this.n)>=0||m.cmpn(1)<0||m.cmp(this.n)>=0)return!1;var x=m.invm(this.n),y=x.mul(t).umod(this.n),w=x.mul(l).umod(this.n),A;return this.curve._maxwellTrick?(A=this.g.jmulAdd(y,s.getPublic(),w),A.isInfinity()?!1:A.eqXToP(l)):(A=this.g.mulAdd(y,s.getPublic(),w),A.isInfinity()?!1:A.getX().umod(this.n).cmp(l)===0)};Kt.prototype.recoverPubKey=function(e,t,i,s){pn((3&i)===i,"The recovery param is more than two bits"),t=new ce(t,s);var n=this.n,l=new D.default(e),m=t.r,x=t.s,y=i&1,w=i>>1;if(m.cmp(this.curve.p.umod(this.curve.n))>=0&&w)throw new Error("Unable to find sencond key candinate");w?m=this.curve.pointFromX(m.add(this.curve.n),y):m=this.curve.pointFromX(m,y);var A=t.r.invm(n),_=n.sub(l).mul(A).umod(n),I=x.mul(A).umod(n);return this.g.mulAdd(_,m,I)};Kt.prototype.getKeyRecoveryParam=function(e,t,i,s){if(t=new ce(t,s),t.recoveryParam!==null)return t.recoveryParam;for(var n=0;n<4;n++){var l;try{l=this.recoverPubKey(e,t,n)}catch{continue}if(l.eq(i))return n}throw new Error("Unable to find valid recovery factor")};var bo=Wr(function(e,t){"use strict";var i=t;i.version="6.5.4",i.utils=Ut,i.rand=function(){throw new Error("unsupported")},i.curve=se,i.curves=ae,i.ec=xo,i.eddsa=null}),mn=bo.ec;var gn="signing-key/5.7.0";var Qe=new z(gn),Ye=null;function nr(){return Ye||(Ye=new mn("secp256k1")),Ye}var ti=class{constructor(t){Dr(this,"curve","secp256k1"),Dr(this,"privateKey",Tt(t)),re(this.privateKey)!==32&&Qe.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");let i=nr().keyFromPrivate(_t(this.privateKey));Dr(this,"publicKey","0x"+i.getPublic(!1,"hex")),Dr(this,"compressedPublicKey","0x"+i.getPublic(!0,"hex")),Dr(this,"_isSigningKey",!0)}_addPoint(t){let i=nr().keyFromPublic(_t(this.publicKey)),s=nr().keyFromPublic(_t(t));return"0x"+i.pub.add(s.pub).encodeCompressed("hex")}signDigest(t){let i=nr().keyFromPrivate(_t(this.privateKey)),s=_t(t);s.length!==32&&Qe.throwArgumentError("bad digest length","digest",t);let n=i.sign(s,{canonical:!0});return ie({recoveryParam:n.recoveryParam,r:vr("0x"+n.r.toString(16),32),s:vr("0x"+n.s.toString(16),32)})}computeSharedSecret(t){let i=nr().keyFromPrivate(_t(this.privateKey)),s=nr().keyFromPublic(_t(ri(t)));return vr("0x"+i.derive(s.getPublic()).toString(16),32)}static isSigningKey(t){return!!(t&&t._isSigningKey)}};function xn(e,t){let i=ie(t),s={r:_t(i.r),s:_t(i.s)};return"0x"+nr().recoverPubKey(_t(e),s,i.recoveryParam).encode("hex",!1)}function ri(e,t){let i=_t(e);if(i.length===32){let s=new ti(i);return t?"0x"+nr().keyFromPrivate(i).getPublic(!0,"hex"):s.publicKey}else{if(i.length===33)return t?Tt(i):"0x"+nr().keyFromPublic(i).getPublic(!1,"hex");if(i.length===65)return t?"0x"+nr().keyFromPublic(i).getPublic(!0,"hex"):Tt(i)}return Qe.throwArgumentError("invalid public or private key","key","[REDACTED]")}var bn="transactions/5.7.0";var Z0=new z(bn),yn;(function(e){e[e.legacy=0]="legacy",e[e.eip2930=1]="eip2930",e[e.eip1559=2]="eip1559"})(yn||(yn={}));function wn(e){let t=ri(e);return Mi(ee(Lr(ee(t,1)),12))}function Mn(e,t){return wn(xn(_t(e),t))}var _n="wallet/5.7.0";var rs=new z(_n);function yo(e,t){return Mn(Te(e),t)}export{yo as verifyMessage}; -/** - * [js-sha3]{@link https://github.com/emn178/js-sha3} - * - * @version 0.8.0 - * @author Chen, Yi-Cyuan [emn178@gmail.com] - * @copyright Chen, Yi-Cyuan 2015-2018 - * @license MIT - */ +var br=Object.create;var xe=Object.defineProperty;var mr=Object.getOwnPropertyDescriptor;var wr=Object.getOwnPropertyNames;var Er=Object.getPrototypeOf,Ar=Object.prototype.hasOwnProperty;var Br=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Sr=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of wr(t))!Ar.call(e,s)&&s!==r&&xe(e,s,{get:()=>t[s],enumerable:!(n=mr(t,s))||n.enumerable});return e};var kr=(e,t,r)=>(r=e!=null?br(Er(e)):{},Sr(t||!e||!e.__esModule?xe(r,"default",{value:e,enumerable:!0}):r,e));var Ge=Br(()=>{});function qt(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function Ir(e){if(typeof e!="boolean")throw new Error(`Expected boolean, not ${e}`)}function ye(e,...t){if(!(e instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new TypeError(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function Ur(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");qt(e.outputLen),qt(e.blockLen)}function vr(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Hr(e,t){ye(e);let r=t.outputLen;if(e.lengthnew Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),gt=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),_=(e,t)=>e<<32-t|e>>>t,Cr=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!Cr)throw new Error("Non little-endian hardware is not supported");var Wn=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Rr(e){if(typeof e!="string")throw new TypeError(`utf8ToBytes expected string, got ${typeof e}`);return new TextEncoder().encode(e)}function j(e){if(typeof e=="string"&&(e=Rr(e)),!(e instanceof Uint8Array))throw new TypeError(`Expected input type is Uint8Array (got ${typeof e})`);return e}var G=class{clone(){return this._cloneInto()}};function W(e){let t=n=>e().update(j(n)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function be(e){let t=(n,s)=>e(s).update(j(n)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=n=>e(n),t}var Rt=class extends G{constructor(t,r){super(),this.finished=!1,this.destroyed=!1,v.hash(t);let n=j(r);if(this.iHash=t.create(),!(this.iHash instanceof G))throw new TypeError("Expected instance of class which extends utils.Hash");let s=this.blockLen=this.iHash.blockLen;this.outputLen=this.iHash.outputLen;let o=new Uint8Array(s);o.set(n.length>this.iHash.blockLen?t.create().update(n).digest():n);for(let i=0;inew Rt(e,t).update(r).digest();Tt.create=(e,t)=>new Rt(e,t);function Tr(e,t,r,n){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,r,n);let s=BigInt(32),o=BigInt(4294967295),i=Number(r>>s&o),c=Number(r&o),a=n?4:0,f=n?0:4;e.setUint32(t+a,i,n),e.setUint32(t+f,c,n)}var ct=class extends G{constructor(t,r,n,s){super(),this.blockLen=t,this.outputLen=r,this.padOffset=n,this.isLE=s,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=gt(this.buffer)}update(t){v.exists(this);let{view:r,buffer:n,blockLen:s}=this;t=j(t);let o=t.length;for(let i=0;is-i&&(this.process(n,0),i=0);for(let a=i;ac.setUint32(4*f,a,o))}digest(){let{buffer:t,outputLen:r}=this;this.digestInto(t);let n=t.slice(0,r);return this.destroy(),n}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());let{blockLen:r,buffer:n,length:s,finished:o,destroyed:i,pos:c}=this;return t.length=s,t.pos=c,t.finished=o,t.destroyed=i,s%r&&t.buffer.set(n),t}};var Pr=(e,t,r)=>e&t^~e&r,Or=(e,t,r)=>e&t^e&r^t&r,Fr=new Uint32Array([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]),X=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),q=new Uint32Array(64),Yt=class extends ct{constructor(){super(64,32,8,!1),this.A=X[0]|0,this.B=X[1]|0,this.C=X[2]|0,this.D=X[3]|0,this.E=X[4]|0,this.F=X[5]|0,this.G=X[6]|0,this.H=X[7]|0}get(){let{A:t,B:r,C:n,D:s,E:o,F:i,G:c,H:a}=this;return[t,r,n,s,o,i,c,a]}set(t,r,n,s,o,i,c,a){this.A=t|0,this.B=r|0,this.C=n|0,this.D=s|0,this.E=o|0,this.F=i|0,this.G=c|0,this.H=a|0}process(t,r){for(let h=0;h<16;h++,r+=4)q[h]=t.getUint32(r,!1);for(let h=16;h<64;h++){let l=q[h-15],x=q[h-2],b=_(l,7)^_(l,18)^l>>>3,B=_(x,17)^_(x,19)^x>>>10;q[h]=B+q[h-7]+b+q[h-16]|0}let{A:n,B:s,C:o,D:i,E:c,F:a,G:f,H:u}=this;for(let h=0;h<64;h++){let l=_(c,6)^_(c,11)^_(c,25),x=u+l+Pr(c,a,f)+Fr[h]+q[h]|0,B=(_(n,2)^_(n,13)^_(n,22))+Or(n,s,o)|0;u=f,f=a,a=c,c=i+x|0,i=o,o=s,s=n,n=x+B|0}n=n+this.A|0,s=s+this.B|0,o=o+this.C|0,i=i+this.D|0,c=c+this.E|0,a=a+this.F|0,f=f+this.G|0,u=u+this.H|0,this.set(n,s,o,i,c,a,f,u)}roundClean(){q.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}},me=W(()=>new Yt);var Pt=BigInt(4294967295),Qt=BigInt(32);function we(e,t=!1){return t?{h:Number(e&Pt),l:Number(e>>Qt&Pt)}:{h:Number(e>>Qt&Pt)|0,l:Number(e&Pt)|0}}function _r(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let s=0;sBigInt(e>>>0)<>>0),Dr=(e,t,r)=>e>>>r,Vr=(e,t,r)=>e<<32-r|t>>>r,$r=(e,t,r)=>e>>>r|t<<32-r,Mr=(e,t,r)=>e<<32-r|t>>>r,Gr=(e,t,r)=>e<<64-r|t>>>r-32,jr=(e,t,r)=>e>>>r-32|t<<64-r,Kr=(e,t)=>t,Zr=(e,t)=>e,Wr=(e,t,r)=>e<>>32-r,Xr=(e,t,r)=>t<>>32-r,qr=(e,t,r)=>t<>>64-r,Yr=(e,t,r)=>e<>>64-r;function Qr(e,t,r,n){let s=(t>>>0)+(n>>>0);return{h:e+r+(s/2**32|0)|0,l:s|0}}var Jr=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),tn=(e,t,r,n)=>t+r+n+(e/2**32|0)|0,en=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0),rn=(e,t,r,n,s)=>t+r+n+s+(e/2**32|0)|0,nn=(e,t,r,n,s)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(s>>>0),sn=(e,t,r,n,s,o)=>t+r+n+s+o+(e/2**32|0)|0,on={fromBig:we,split:_r,toBig:zr,shrSH:Dr,shrSL:Vr,rotrSH:$r,rotrSL:Mr,rotrBH:Gr,rotrBL:jr,rotr32H:Kr,rotr32L:Zr,rotlSH:Wr,rotlSL:Xr,rotlBH:qr,rotlBL:Yr,add:Qr,add3L:Jr,add3H:tn,add4L:en,add4H:rn,add5H:sn,add5L:nn},p=on;var[cn,fn]=p.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(e=>BigInt(e))),Y=new Uint32Array(80),Q=new Uint32Array(80),bt=class extends ct{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){let{Ah:t,Al:r,Bh:n,Bl:s,Ch:o,Cl:i,Dh:c,Dl:a,Eh:f,El:u,Fh:h,Fl:l,Gh:x,Gl:b,Hh:B,Hl:U}=this;return[t,r,n,s,o,i,c,a,f,u,h,l,x,b,B,U]}set(t,r,n,s,o,i,c,a,f,u,h,l,x,b,B,U){this.Ah=t|0,this.Al=r|0,this.Bh=n|0,this.Bl=s|0,this.Ch=o|0,this.Cl=i|0,this.Dh=c|0,this.Dl=a|0,this.Eh=f|0,this.El=u|0,this.Fh=h|0,this.Fl=l|0,this.Gh=x|0,this.Gl=b|0,this.Hh=B|0,this.Hl=U|0}process(t,r){for(let E=0;E<16;E++,r+=4)Y[E]=t.getUint32(r),Q[E]=t.getUint32(r+=4);for(let E=16;E<80;E++){let P=Y[E-15]|0,L=Q[E-15]|0,Lt=p.rotrSH(P,L,1)^p.rotrSH(P,L,8)^p.shrSH(P,L,7),Zt=p.rotrSL(P,L,1)^p.rotrSL(P,L,8)^p.shrSL(P,L,7),$=Y[E-2]|0,M=Q[E-2]|0,Nt=p.rotrSH($,M,19)^p.rotrBH($,M,61)^p.shrSH($,M,6),Wt=p.rotrSL($,M,19)^p.rotrBL($,M,61)^p.shrSL($,M,6),Ct=p.add4L(Zt,Wt,Q[E-7],Q[E-16]),Xt=p.add4H(Ct,Lt,Nt,Y[E-7],Y[E-16]);Y[E]=Xt|0,Q[E]=Ct|0}let{Ah:n,Al:s,Bh:o,Bl:i,Ch:c,Cl:a,Dh:f,Dl:u,Eh:h,El:l,Fh:x,Fl:b,Gh:B,Gl:U,Hh:R,Hl:T}=this;for(let E=0;E<80;E++){let P=p.rotrSH(h,l,14)^p.rotrSH(h,l,18)^p.rotrBH(h,l,41),L=p.rotrSL(h,l,14)^p.rotrSL(h,l,18)^p.rotrBL(h,l,41),Lt=h&x^~h&B,Zt=l&b^~l&U,$=p.add5L(T,L,Zt,fn[E],Q[E]),M=p.add5H($,R,P,Lt,cn[E],Y[E]),Nt=$|0,Wt=p.rotrSH(n,s,28)^p.rotrBH(n,s,34)^p.rotrBH(n,s,39),Ct=p.rotrSL(n,s,28)^p.rotrBL(n,s,34)^p.rotrBL(n,s,39),Xt=n&o^n&c^o&c,gr=s&i^s&a^i&a;R=B|0,T=U|0,B=x|0,U=b|0,x=h|0,b=l|0,{h,l}=p.add(f|0,u|0,M|0,Nt|0),f=c|0,u=a|0,c=o|0,a=i|0,o=n|0,i=s|0;let pe=p.add3L(Nt,Ct,gr);n=p.add3H(pe,M,Wt,Xt),s=pe|0}({h:n,l:s}=p.add(this.Ah|0,this.Al|0,n|0,s|0)),{h:o,l:i}=p.add(this.Bh|0,this.Bl|0,o|0,i|0),{h:c,l:a}=p.add(this.Ch|0,this.Cl|0,c|0,a|0),{h:f,l:u}=p.add(this.Dh|0,this.Dl|0,f|0,u|0),{h,l}=p.add(this.Eh|0,this.El|0,h|0,l|0),{h:x,l:b}=p.add(this.Fh|0,this.Fl|0,x|0,b|0),{h:B,l:U}=p.add(this.Gh|0,this.Gl|0,B|0,U|0),{h:R,l:T}=p.add(this.Hh|0,this.Hl|0,R|0,T|0),this.set(n,s,o,i,c,a,f,u,h,l,x,b,B,U,R,T)}roundClean(){Y.fill(0),Q.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}},Jt=class extends bt{constructor(){super(),this.Ah=573645204,this.Al=-64227540,this.Bh=-1621794909,this.Bl=-934517566,this.Ch=596883563,this.Cl=1867755857,this.Dh=-1774684391,this.Dl=1497426621,this.Eh=-1775747358,this.El=-1467023389,this.Fh=-1101128155,this.Fl=1401305490,this.Gh=721525244,this.Gl=746961066,this.Hh=246885852,this.Hl=-2117784414,this.outputLen=32}},te=class extends bt{constructor(){super(),this.Ah=-876896931,this.Al=-1056596264,this.Bh=1654270250,this.Bl=914150663,this.Ch=-1856437926,this.Cl=812702999,this.Dh=355462360,this.Dl=-150054599,this.Eh=1731405415,this.El=-4191439,this.Fh=-1900787065,this.Fl=1750603025,this.Gh=-619958771,this.Gl=1694076839,this.Hh=1203062813,this.Hl=-1090891868,this.outputLen=48}},Ee=W(()=>new bt),xs=W(()=>new Jt),ys=W(()=>new te);var Ae="6.1.0";function an(e,t,r){let n=t.split("|").map(o=>o.trim());for(let o=0;o>4],r+=t[e[n]&15];return r}if(typeof e=="object"&&typeof e.toJSON=="function")return ft(e.toJSON());switch(typeof e){case"boolean":case"symbol":return e.toString();case"bigint":return BigInt(e).toString();case"number":return e.toString();case"string":return JSON.stringify(e);case"object":{let t=Object.keys(e);return t.sort(),"{ "+t.map(r=>`${ft(r)}: ${ft(e[r])}`).join(", ")+" }"}}return"[ COULD NOT SERIALIZE ]"}function Se(e,t,r){{let s=[];if(r){if("message"in r||"code"in r||"name"in r)throw new Error(`value will overwrite populated values: ${ft(r)}`);for(let o in r){let i=r[o];s.push(o+"="+ft(i))}}s.push(`code=${t}`),s.push(`version=${Ae}`),s.length&&(e+=" ("+s.join(", ")+")")}let n;switch(t){case"INVALID_ARGUMENT":n=new TypeError(e);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":n=new RangeError(e);break;default:n=new Error(e)}return Be(n,{code:t}),r&&Object.assign(n,r),n}function V(e,t,r,n){if(!e)throw Se(t,r,n)}function y(e,t,r,n){V(e,t,"INVALID_ARGUMENT",{argument:r,value:n})}var hn=["NFD","NFC","NFKD","NFKC"].reduce((e,t)=>{try{if("test".normalize(t)!=="test")throw new Error("bad");if(t==="NFD"){let r=String.fromCharCode(233).normalize("NFD"),n=String.fromCharCode(101,769);if(r!==n)throw new Error("broken")}e.push(t)}catch{}return e},[]);function ee(e){V(hn.indexOf(e)>=0,"platform missing String.prototype.normalize","UNSUPPORTED_OPERATION",{operation:"String.prototype.normalize",info:{form:e}})}function re(e,t,r){if(r==null&&(r=""),e!==t){let n=r,s="new";r&&(n+=".",s+=" "+r),V(!1,`private constructor; use ${n}from* methods`,"UNSUPPORTED_OPERATION",{operation:s})}}function Ie(e,t,r){if(e instanceof Uint8Array)return r?new Uint8Array(e):e;if(typeof e=="string"&&e.match(/^0x([0-9a-f][0-9a-f])*$/i)){let n=new Uint8Array((e.length-2)/2),s=2;for(let o=0;o>4]+ke[s&15]}return r}function K(e){return"0x"+e.map(t=>S(t).substring(2)).join("")}function J(e){return mt(e,!0)?(e.length-2)/2:k(e).length}function un(e,t,r){let n=k(e);V(t>=n.length,"padding exceeds data length","BUFFER_OVERRUN",{buffer:new Uint8Array(n),length:t,offset:t+1});let s=new Uint8Array(t);return s.fill(0),r?s.set(n,t-n.length):s.set(n,0),S(s)}function ne(e,t){return un(e,t,!0)}var Ue=BigInt(0),Is=BigInt(1),at=9007199254740991;function ot(e,t){switch(typeof e){case"bigint":return e;case"number":return y(Number.isInteger(e),"underflow",t||"value",e),y(e>=-at&&e<=at,"overflow",t||"value",e),BigInt(e);case"string":try{if(e==="")throw new Error("empty string");return e[0]==="-"&&e[1]!=="-"?-BigInt(e.substring(1)):BigInt(e)}catch(r){y(!1,`invalid BigNumberish string: ${r.message}`,t||"value",e)}}y(!1,"invalid BigNumberish value",t||"value",e)}function se(e,t){let r=ot(e,t);return V(r>=Ue,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:e}),r}function wt(e,t){switch(typeof e){case"bigint":return y(e>=-at&&e<=at,"overflow",t||"value",e),Number(e);case"number":return y(Number.isInteger(e),"underflow",t||"value",e),y(e>=-at&&e<=at,"overflow",t||"value",e),e;case"string":try{if(e==="")throw new Error("empty string");return wt(BigInt(e),t)}catch(r){y(!1,`invalid numeric string: ${r.message}`,t||"value",e)}}y(!1,"invalid numeric value",t||"value",e)}function Ot(e,t){let n=se(e,"value").toString(16);if(t==null)n.length%2&&(n="0"+n);else{let s=wt(t,"width");for(V(s*2>=n.length,`value exceeds width (${s} bits)`,"NUMERIC_FAULT",{operation:"toBeHex",fault:"overflow",value:e});n.length>6===2;i++)o++;return o}return e==="OVERRUN"?r.length-t-1:0}function dn(e,t,r,n,s){return e==="OVERLONG"?(y(typeof s=="number","invalid bad code point for replacement","badCodepoint",s),n.push(s),0):(n.push(65533),ve(e,t,r,n,s))}var pn=Object.freeze({error:ln,ignore:ve,replace:dn});function Et(e,t){t!=null&&(ee(t),e=e.normalize(t));let r=[];for(let n=0;n>6|192),r.push(s&63|128);else if((s&64512)==55296){n++;let o=e.charCodeAt(n);y(n>18|240),r.push(i>>12&63|128),r.push(i>>6&63|128),r.push(i&63|128)}else r.push(s>>12|224),r.push(s>>6&63|128),r.push(s&63|128)}return new Uint8Array(r)}function xn(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("unable to locate global object")}var He=xn(),ro=He.crypto||He.msCrypto;function Le(e,t){let r={sha256:me,sha512:Ee}[e];return y(r!=null,"invalid hmac algorithm","algorithm",e),Tt.create(r,t)}var Ne=!1,Ce=function(e,t,r){return Le(e,t).update(r).digest()},Re=Ce;function ht(e,t,r){let n=k(t,"key"),s=k(r,"data");return S(Re(e,n,s))}ht._=Ce;ht.lock=function(){Ne=!0};ht.register=function(e){if(Ne)throw new Error("computeHmac is locked");Re=e};Object.freeze(ht);var[Oe,Fe,_e]=[[],[],[]],yn=BigInt(0),At=BigInt(1),gn=BigInt(2),bn=BigInt(7),mn=BigInt(256),wn=BigInt(113);for(let e=0,t=At,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],Oe.push(2*(5*n+r)),Fe.push((e+1)*(e+2)/2%64);let s=yn;for(let o=0;o<7;o++)t=(t<>bn)*wn)%mn,t&gn&&(s^=At<<(At<r>32?p.rotlBH(e,t,r):p.rotlSH(e,t,r),Pe=(e,t,r)=>r>32?p.rotlBL(e,t,r):p.rotlSL(e,t,r);function Bn(e,t=24){let r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let i=0;i<10;i++)r[i]=e[i]^e[i+10]^e[i+20]^e[i+30]^e[i+40];for(let i=0;i<10;i+=2){let c=(i+8)%10,a=(i+2)%10,f=r[a],u=r[a+1],h=Te(f,u,1)^r[c],l=Pe(f,u,1)^r[c+1];for(let x=0;x<50;x+=10)e[i+x]^=h,e[i+x+1]^=l}let s=e[2],o=e[3];for(let i=0;i<24;i++){let c=Fe[i],a=Te(s,o,c),f=Pe(s,o,c),u=Oe[i];s=e[u],o=e[u+1],e[u]=a,e[u+1]=f}for(let i=0;i<50;i+=10){for(let c=0;c<10;c++)r[c]=e[i+c];for(let c=0;c<10;c++)e[i+c]^=~r[(c+2)%10]&r[(c+4)%10]}e[0]^=En[n],e[1]^=An[n]}r.fill(0)}var ut=class extends G{constructor(t,r,n,s=!1,o=24){if(super(),this.blockLen=t,this.suffix=r,this.outputLen=n,this.enableXOF=s,this.rounds=o,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,v.number(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=ge(this.state)}keccak(){Bn(this.state32,this.rounds),this.posOut=0,this.pos=0}update(t){v.exists(this);let{blockLen:r,state:n}=this;t=j(t);let s=t.length;for(let o=0;o=n&&this.keccak();let i=Math.min(n-this.posOut,o-s);t.set(r.subarray(this.posOut,this.posOut+i),s),this.posOut+=i,s+=i}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return v.number(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(v.output(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){let{blockLen:r,suffix:n,outputLen:s,rounds:o,enableXOF:i}=this;return t||(t=new ut(r,n,s,i,o)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=o,t.suffix=n,t.outputLen=s,t.enableXOF=i,t.destroyed=this.destroyed,t}},tt=(e,t,r)=>W(()=>new ut(t,e,r)),ho=tt(6,144,224/8),uo=tt(6,136,256/8),lo=tt(6,104,384/8),po=tt(6,72,512/8),xo=tt(1,144,224/8),ze=tt(1,136,256/8),yo=tt(1,104,384/8),go=tt(1,72,512/8),De=(e,t,r)=>be((n={})=>new ut(t,e,n.dkLen===void 0?r:n.dkLen,!0)),bo=De(31,168,128/8),mo=De(31,136,256/8);var Ve=!1,$e=function(e){return ze(e)},Me=$e;function z(e){let t=k(e,"data");return S(Me(t))}z._=$e;z.lock=function(){Ve=!0};z.register=function(e){if(Ve)throw new TypeError("keccak256 is locked");Me=e};Object.freeze(z);var Sn=kr(Ge(),1);var g=BigInt(0),A=BigInt(1),rt=BigInt(2),St=BigInt(3),je=BigInt(8),I=Object.freeze({a:g,b:BigInt(7),P:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:A,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee")}),Ke=(e,t)=>(e+t/rt)/t,Ft={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar(e){let{n:t}=I,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-A*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),s=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=r,i=BigInt("0x100000000000000000000000000000000"),c=Ke(o*e,t),a=Ke(-n*e,t),f=d(e-c*r-a*s,t),u=d(-c*n-a*o,t),h=f>i,l=u>i;if(h&&(f=t-f),l&&(u=t-u),f>i||u>i)throw new Error("splitScalarEndo: Endomorphism failed, k="+e);return{k1neg:h,k1:f,k2neg:l,k2:u}}},D=32,pt=32,kn=32,Vt=D+1,$t=2*D+1;function Ze(e){let{a:t,b:r}=I,n=d(e*e),s=d(n*e);return d(s+t*e+r)}var _t=I.a===g,Mt=class extends Error{constructor(t){super(t)}};function We(e){if(!(e instanceof m))throw new TypeError("JacobianPoint expected")}var m=class{constructor(t,r,n){this.x=t,this.y=r,this.z=n}static fromAffine(t){if(!(t instanceof w))throw new TypeError("JacobianPoint#fromAffine: expected Point");return t.equals(w.ZERO)?m.ZERO:new m(t.x,t.y,A)}static toAffineBatch(t){let r=Ln(t.map(n=>n.z));return t.map((n,s)=>n.toAffine(r[s]))}static normalizeZ(t){return m.toAffineBatch(t).map(m.fromAffine)}equals(t){We(t);let{x:r,y:n,z:s}=this,{x:o,y:i,z:c}=t,a=d(s*s),f=d(c*c),u=d(r*f),h=d(o*a),l=d(d(n*c)*f),x=d(d(i*s)*a);return u===h&&l===x}negate(){return new m(this.x,d(-this.y),this.z)}double(){let{x:t,y:r,z:n}=this,s=d(t*t),o=d(r*r),i=d(o*o),c=t+o,a=d(rt*(d(c*c)-s-i)),f=d(St*s),u=d(f*f),h=d(u-rt*a),l=d(f*(a-h)-je*i),x=d(rt*r*n);return new m(h,l,x)}add(t){We(t);let{x:r,y:n,z:s}=this,{x:o,y:i,z:c}=t;if(o===g||i===g)return this;if(r===g||n===g)return t;let a=d(s*s),f=d(c*c),u=d(r*f),h=d(o*a),l=d(d(n*c)*f),x=d(d(i*s)*a),b=d(h-u),B=d(x-l);if(b===g)return B===g?this.double():m.ZERO;let U=d(b*b),R=d(b*U),T=d(u*U),E=d(B*B-R-rt*T),P=d(B*(T-E)-l*R),L=d(s*c*b);return new m(E,P,L)}subtract(t){return this.add(t.negate())}multiplyUnsafe(t){let r=m.ZERO;if(typeof t=="bigint"&&t===g)return r;let n=Ye(t);if(n===A)return this;if(!_t){let h=r,l=this;for(;n>g;)n&A&&(h=h.add(l)),l=l.double(),n>>=A;return h}let{k1neg:s,k1:o,k2neg:i,k2:c}=Ft.splitScalar(n),a=r,f=r,u=this;for(;o>g||c>g;)o&A&&(a=a.add(u)),c&A&&(f=f.add(u)),u=u.double(),o>>=A,c>>=A;return s&&(a=a.negate()),i&&(f=f.negate()),f=new m(d(f.x*Ft.beta),f.y,f.z),a.add(f)}precomputeWindow(t){let r=_t?128/t+1:256/t+1,n=[],s=this,o=s;for(let i=0;i>=h,b>a&&(b-=u,t+=A);let B=x,U=x+Math.abs(b)-1,R=l%2!==0,T=b<0;b===0?i=i.add(zt(R,s[B])):o=o.add(zt(T,s[U]))}return{p:o,f:i}}multiply(t,r){let n=Ye(t),s,o;if(_t){let{k1neg:i,k1:c,k2neg:a,k2:f}=Ft.splitScalar(n),{p:u,f:h}=this.wNAF(c,r),{p:l,f:x}=this.wNAF(f,r);u=zt(i,u),l=zt(a,l),l=new m(d(l.x*Ft.beta),l.y,l.z),s=u.add(l),o=h.add(x)}else{let{p:i,f:c}=this.wNAF(n,r);s=i,o=c}return m.normalizeZ([s,o])[0]}toAffine(t){let{x:r,y:n,z:s}=this,o=this.equals(m.ZERO);t==null&&(t=o?je:Ht(s));let i=t,c=d(i*i),a=d(c*i),f=d(r*c),u=d(n*a),h=d(s*i);if(o)return w.ZERO;if(h!==A)throw new Error("invZ was invalid");return new w(f,u)}};m.BASE=new m(I.Gx,I.Gy,A);m.ZERO=new m(g,A,g);function zt(e,t){let r=t.negate();return e?r:t}var ce=new WeakMap,w=class{constructor(t,r){this.x=t,this.y=r}_setWindowSize(t){this._WINDOW_SIZE=t,ce.delete(this)}hasEvenY(){return this.y%rt===g}static fromCompressedHex(t){let r=t.length===32,n=nt(r?t:t.subarray(1));if(!ie(n))throw new Error("Point is not on curve");let s=Ze(n),o=Hn(s),i=(o&A)===A;r?i&&(o=d(-o)):(t[0]&1)===1!==i&&(o=d(-o));let c=new w(n,o);return c.assertValidity(),c}static fromUncompressedHex(t){let r=nt(t.subarray(1,D+1)),n=nt(t.subarray(D+1,D*2+1)),s=new w(r,n);return s.assertValidity(),s}static fromHex(t){let r=It(t),n=r.length,s=r[0];if(n===D)return this.fromCompressedHex(r);if(n===Vt&&(s===2||s===3))return this.fromCompressedHex(r);if(n===$t&&s===4)return this.fromUncompressedHex(r);throw new Error(`Point.fromHex: received invalid point. Expected 32-${Vt} compressed bytes or ${$t} uncompressed bytes, not ${n}`)}static fromPrivateKey(t){return w.BASE.multiply(vt(t))}static fromSignature(t,r,n){let{r:s,s:o}=Tn(r);if(![0,1,2,3].includes(n))throw new Error("Cannot recover: invalid recovery bit");let i=Je(It(t)),{n:c}=I,a=n===2||n===3?s+c:s,f=Ht(a,c),u=d(-i*f,c),h=d(o*f,c),l=n&1?"03":"02",x=w.fromHex(l+lt(a)),b=w.BASE.multiplyAndAddUnsafe(x,u,h);if(!b)throw new Error("Cannot recover signature: point at infinify");return b.assertValidity(),b}toRawBytes(t=!1){return it(this.toHex(t))}toHex(t=!1){let r=lt(this.x);return t?`${this.hasEvenY()?"02":"03"}${r}`:`04${r}${lt(this.y)}`}toHexX(){return this.toHex(!0).slice(2)}toRawX(){return this.toRawBytes(!0).slice(1)}assertValidity(){let t="Point is not on elliptic curve",{x:r,y:n}=this;if(!ie(r)||!ie(n))throw new Error(t);let s=d(n*n),o=Ze(r);if(d(s-o)!==g)throw new Error(t)}equals(t){return this.x===t.x&&this.y===t.y}negate(){return new w(this.x,d(-this.y))}double(){return m.fromAffine(this).double().toAffine()}add(t){return m.fromAffine(this).add(m.fromAffine(t)).toAffine()}subtract(t){return this.add(t.negate())}multiply(t){return m.fromAffine(this).multiply(t,this).toAffine()}multiplyAndAddUnsafe(t,r,n){let s=m.fromAffine(this),o=r===g||r===A||this!==w.BASE?s.multiplyUnsafe(r):s.multiply(r),i=m.fromAffine(t).multiplyUnsafe(n),c=o.add(i);return c.equals(m.ZERO)?void 0:c.toAffine()}};w.BASE=new w(I.Gx,I.Gy);w.ZERO=new w(g,g);function Xe(e){return Number.parseInt(e[0],16)>=8?"00"+e:e}function qe(e){if(e.length<2||e[0]!==2)throw new Error(`Invalid signature integer tag: ${xt(e)}`);let t=e[1],r=e.subarray(2,t+2);if(!t||r.length!==t)throw new Error("Invalid signature integer: wrong length");if(r[0]===0&&r[1]<=127)throw new Error("Invalid signature integer: trailing length");return{data:nt(r),left:e.subarray(t+2)}}function In(e){if(e.length<2||e[0]!=48)throw new Error(`Invalid signature tag: ${xt(e)}`);if(e[1]!==e.length-2)throw new Error("Invalid signature: incorrect length");let{data:t,left:r}=qe(e.subarray(2)),{data:n,left:s}=qe(r);if(s.length)throw new Error(`Invalid signature: left bytes after parsing: ${xt(s)}`);return{r:t,s:n}}var C=class{constructor(t,r){this.r=t,this.s=r,this.assertValidity()}static fromCompact(t){let r=t instanceof Uint8Array,n="Signature.fromCompact";if(typeof t!="string"&&!r)throw new TypeError(`${n}: Expected string or Uint8Array`);let s=r?xt(t):t;if(s.length!==128)throw new Error(`${n}: Expected 64-byte hex`);return new C(Gt(s.slice(0,64)),Gt(s.slice(64,128)))}static fromDER(t){let r=t instanceof Uint8Array;if(typeof t!="string"&&!r)throw new TypeError("Signature.fromDER: Expected string or Uint8Array");let{r:n,s}=In(r?t:it(t));return new C(n,s)}static fromHex(t){return this.fromDER(t)}assertValidity(){let{r:t,s:r}=this;if(!Ut(t))throw new Error("Invalid Signature: r must be 0 < r < n");if(!Ut(r))throw new Error("Invalid Signature: s must be 0 < s < n")}hasHighS(){let t=I.n>>A;return this.s>t}normalizeS(){return this.hasHighS()?new C(this.r,d(-this.s,I.n)):this}toDERRawBytes(){return it(this.toDERHex())}toDERHex(){let t=Xe(Bt(this.s)),r=Xe(Bt(this.r)),n=t.length/2,s=r.length/2,o=Bt(n),i=Bt(s);return`30${Bt(s+n+4)}02${i}${r}02${o}${t}`}toRawBytes(){return this.toDERRawBytes()}toHex(){return this.toDERHex()}toCompactRawBytes(){return it(this.toCompactHex())}toCompactHex(){return lt(this.r)+lt(this.s)}};function et(...e){if(!e.every(n=>n instanceof Uint8Array))throw new Error("Uint8Array list expected");if(e.length===1)return e[0];let t=e.reduce((n,s)=>n+s.length,0),r=new Uint8Array(t);for(let n=0,s=0;nt.toString(16).padStart(2,"0"));function xt(e){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");let t="";for(let r=0;r0)return BigInt(e);if(typeof e=="bigint"&&Ut(e))return e;throw new TypeError("Expected valid private scalar: 0 < scalar < curve.n")}function d(e,t=I.P){let r=e%t;return r>=g?r:t+r}function O(e,t){let{P:r}=I,n=e;for(;t-- >g;)n*=n,n%=r;return n}function Hn(e){let{P:t}=I,r=BigInt(6),n=BigInt(11),s=BigInt(22),o=BigInt(23),i=BigInt(44),c=BigInt(88),a=e*e*e%t,f=a*a*e%t,u=O(f,St)*f%t,h=O(u,St)*f%t,l=O(h,rt)*a%t,x=O(l,n)*l%t,b=O(x,s)*x%t,B=O(b,i)*b%t,U=O(B,c)*B%t,R=O(U,i)*b%t,T=O(R,St)*f%t,E=O(T,o)*x%t,P=O(E,r)*a%t,L=O(P,rt);if(L*L%t!==e)throw new Error("Cannot find square root");return L}function Ht(e,t=I.P){if(e===g||t<=g)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let r=d(e,t),n=t,s=g,o=A,i=A,c=g;for(;r!==g;){let f=n/r,u=n%r,h=s-i*f,l=o-c*f;n=r,r=u,s=i,o=c,i=h,c=l}if(n!==A)throw new Error("invert: does not exist");return d(s,t)}function Ln(e,t=I.P){let r=new Array(e.length),n=e.reduce((o,i,c)=>i===g?o:(r[c]=o,d(o*i,t)),A),s=Ht(n,t);return e.reduceRight((o,i,c)=>i===g?o:(r[c]=d(o*r[c],t),d(o*i,t)),s),r}function Nn(e){let t=e.length*8-pt*8,r=nt(e);return t>0?r>>BigInt(t):r}function Je(e,t=!1){let r=Nn(e);if(t)return r;let{n}=I;return r>=n?r-n:r}var dt,kt,ae=class{constructor(t,r){if(this.hashLen=t,this.qByteLen=r,typeof t!="number"||t<2)throw new Error("hashLen must be a number");if(typeof r!="number"||r<2)throw new Error("qByteLen must be a number");this.v=new Uint8Array(t).fill(1),this.k=new Uint8Array(t).fill(0),this.counter=0}hmac(...t){return Z.hmacSha256(this.k,...t)}hmacSync(...t){return kt(this.k,...t)}checkSync(){if(typeof kt!="function")throw new Mt("hmacSha256Sync needs to be set")}incr(){if(this.counter>=1e3)throw new Error("Tried 1,000 k values for sign(), all were invalid");this.counter+=1}async reseed(t=new Uint8Array){this.k=await this.hmac(this.v,Uint8Array.from([0]),t),this.v=await this.hmac(this.v),t.length!==0&&(this.k=await this.hmac(this.v,Uint8Array.from([1]),t),this.v=await this.hmac(this.v))}reseedSync(t=new Uint8Array){this.checkSync(),this.k=this.hmacSync(this.v,Uint8Array.from([0]),t),this.v=this.hmacSync(this.v),t.length!==0&&(this.k=this.hmacSync(this.v,Uint8Array.from([1]),t),this.v=this.hmacSync(this.v))}async generate(){this.incr();let t=0,r=[];for(;t0)t=BigInt(e);else if(typeof e=="string"){if(e.length!==2*pt)throw new Error("Expected 32 bytes of private key");t=Gt(e)}else if(e instanceof Uint8Array){if(e.length!==pt)throw new Error("Expected 32 bytes of private key");t=nt(e)}else throw new TypeError("Expected valid private key");if(!Ut(t))throw new Error("Expected private key: 0 < key < n");return t}function Rn(e){return e instanceof w?(e.assertValidity(),e):w.fromHex(e)}function Tn(e){if(e instanceof C)return e.assertValidity(),e;try{return C.fromDER(e)}catch{return C.fromCompact(e)}}function tr(e,t=!1){return w.fromPrivateKey(e).toRawBytes(t)}function er(e,t,r,n=!1){return w.fromSignature(e,t,r).toRawBytes(n)}function Qe(e){let t=e instanceof Uint8Array,r=typeof e=="string",n=(t||r)&&e.length;return t?n===Vt||n===$t:r?n===Vt*2||n===$t*2:e instanceof w}function rr(e,t,r=!1){if(Qe(e))throw new TypeError("getSharedSecret: first arg must be private key");if(!Qe(t))throw new TypeError("getSharedSecret: second arg must be public key");let n=Rn(t);return n.assertValidity(),n.multiply(vt(e)).toRawBytes(r)}function nr(e){let t=e.length>D?e.slice(0,D):e;return nt(t)}function Pn(e){let t=nr(e),r=d(t,I.n);return sr(r{e=It(e);let t=pt+8;if(e.length1024)throw new Error("Expected valid bytes of private key as per FIPS 186");let r=d(nt(e),I.n-A)+A;return fe(r)},randomBytes:(e=32)=>{if(N.web)return N.web.getRandomValues(new Uint8Array(e));if(N.node){let{randomBytes:t}=N.node;return Uint8Array.from(t(e))}else throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:()=>Z.hashToPrivateKey(Z.randomBytes(pt+8)),precompute(e=8,t=w.BASE){let r=t===w.BASE?t:new w(t.x,t.y);return r._setWindowSize(e),r.multiply(St),r},sha256:async(...e)=>{if(N.web){let t=await N.web.subtle.digest("SHA-256",et(...e));return new Uint8Array(t)}else if(N.node){let{createHash:t}=N.node,r=t("sha256");return e.forEach(n=>r.update(n)),Uint8Array.from(r.digest())}else throw new Error("The environment doesn't have sha256 function")},hmacSha256:async(e,...t)=>{if(N.web){let r=await N.web.subtle.importKey("raw",e,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),n=et(...t),s=await N.web.subtle.sign("HMAC",r,n);return new Uint8Array(s)}else if(N.node){let{createHmac:r}=N.node,n=r("sha256",e);return t.forEach(s=>n.update(s)),Uint8Array.from(n.digest())}else throw new Error("The environment doesn't have hmac-sha256 function")},sha256Sync:void 0,hmacSha256Sync:void 0,taggedHash:async(e,...t)=>{let r=Dt[e];if(r===void 0){let n=await Z.sha256(Uint8Array.from(e,s=>s.charCodeAt(0)));r=et(n,n),Dt[e]=r}return Z.sha256(r,...t)},taggedHashSync:(e,...t)=>{if(typeof dt!="function")throw new Mt("sha256Sync is undefined, you need to set it");let r=Dt[e];if(r===void 0){let n=dt(Uint8Array.from(e,s=>s.charCodeAt(0)));r=et(n,n),Dt[e]=r}return dt(r,...t)},_JacobianPoint:m};Object.defineProperties(Z,{sha256Sync:{configurable:!1,get(){return dt},set(e){dt||(dt=e)}},hmacSha256Sync:{configurable:!1,get(){return kt},set(e){kt||(kt=e)}}});var jt="0x0000000000000000000000000000000000000000000000000000000000000000";var he=`Ethereum Signed Message: +`;var ir=BigInt(0),cr=BigInt(1),fr=BigInt(2),ar=BigInt(27),hr=BigInt(28),Kt=BigInt(35),yt={};function ur(e){return ne(oe(e),32)}var H=class{#t;#r;#n;#e;get r(){return this.#t}set r(t){y(J(t)===32,"invalid r","value",t),this.#t=S(t)}get s(){return this.#r}set s(t){y(J(t)===32,"invalid r","value",t);let r=S(t);y(parseInt(r.substring(0,3))<8,"non-canonical s","value",r),this.#r=r}get v(){return this.#n}set v(t){let r=wt(t,"value");y(r===27||r===28,"invalid v","v",t),this.#n=r}get networkV(){return this.#e}get legacyChainId(){let t=this.networkV;return t==null?null:H.getChainId(t)}get yParity(){return this.v===27?0:1}get yParityAndS(){let t=k(this.s);return this.yParity&&(t[0]|=128),S(t)}get compactSerialized(){return K([this.r,this.yParityAndS])}get serialized(){return K([this.r,this.s,this.yParity?"0x1c":"0x1b"])}constructor(t,r,n,s){re(t,yt,"Signature"),this.#t=r,this.#r=n,this.#n=s,this.#e=null}[Symbol.for("nodejs.util.inspect.custom")](){return`Signature { r: "${this.r}", s: "${this.s}", yParity: ${this.yParity}, networkV: ${this.networkV} }`}clone(){let t=new H(yt,this.r,this.s,this.v);return this.networkV&&(t.#e=this.networkV),t}toJSON(){let t=this.networkV;return{_type:"signature",networkV:t!=null?t.toString():null,r:this.r,s:this.s,v:this.v}}static getChainId(t){let r=ot(t,"v");return r==ar||r==hr?ir:(y(r>=Kt,"invalid EIP-155 v","v",t),(r-Kt)/fr)}static getChainIdV(t,r){return ot(t)*fr+BigInt(35+r-27)}static getNormalizedV(t){let r=ot(t);return r===ir||r===ar?27:r===cr||r===hr?28:(y(r>=Kt,"invalid v","v",t),r&cr?27:28)}static from(t){function r(f,u){y(f,u,"signature",t)}if(t==null)return new H(yt,jt,jt,27);if(typeof t=="string"){let f=k(t,"signature");if(f.length===64){let u=S(f.slice(0,32)),h=f.slice(32,64),l=h[0]&128?28:27;return h[0]&=127,new H(yt,u,S(h),l)}if(f.length===65){let u=S(f.slice(0,32)),h=f.slice(32,64);r((h[0]&128)===0,"non-canonical s");let l=H.getNormalizedV(f[64]);return new H(yt,u,S(h),l)}r(!1,"invalid raw signature length")}if(t instanceof H)return t.clone();let n=t.r;r(n!=null,"missing r");let s=ur(n),o=function(f,u){if(f!=null)return ur(f);if(u!=null){r(mt(u,32),"invalid yParityAndS");let h=k(u);return h[0]&=127,S(h)}r(!1,"missing s")}(t.s,t.yParityAndS);r((k(o)[0]&128)==0,"non-canonical s");let{networkV:i,v:c}=function(f,u,h){if(f!=null){let l=ot(f);return{networkV:l>=Kt?l:void 0,v:H.getNormalizedV(l)}}if(u!=null)return r(mt(u,32),"invalid yParityAndS"),{v:k(u)[0]&128?28:27};if(h!=null){switch(h){case 0:return{v:27};case 1:return{v:28}}r(!1,"invalid yParity")}r(!1,"missing v")}(t.v,t.yParityAndS,t.yParity),a=new H(yt,s,o,c);return i&&(a.#e=i),r(!("yParity"in t&&t.yParity!==a.yParity),"yParity mismatch"),r(!("yParityAndS"in t&&t.yParityAndS!==a.yParityAndS),"yParityAndS mismatch"),a}};Z.hmacSha256Sync=function(e,...t){return k(ht("sha256",e,K(t)))};var F=class{#t;constructor(t){y(J(t)===32,"invalid private key","privateKey","[REDACTED]"),this.#t=S(t)}get privateKey(){return this.#t}get publicKey(){return F.computePublicKey(this.#t)}get compressedPublicKey(){return F.computePublicKey(this.#t,!0)}sign(t){y(J(t)===32,"invalid digest length","digest",t);let[r,n]=or(st(t),st(this.#t),{recovered:!0,canonical:!0}),s=C.fromHex(r);return H.from({r:Ot("0x"+s.r.toString(16),32),s:Ot("0x"+s.s.toString(16),32),v:n?28:27})}computeSharedSecret(t){let r=F.computePublicKey(t);return console.log(r),S(rr(st(this.#t),k(r)))}static computePublicKey(t,r){let n=k(t,"key");if(n.length===32){let o=tr(n,!!r);return S(o)}if(n.length===64){let o=new Uint8Array(65);o[0]=4,o.set(n,1),n=o}let s=w.fromHex(n);return S(s.toRawBytes(r))}static recoverPublicKey(t,r){y(J(t)===32,"invalid digest length","digest",t);let n=H.from(r),s=C.fromCompact(st(K([n.r,n.s]))).toDERRawBytes(),o=er(st(t),s,n.yParity);if(o!=null)return S(o);y(!1,"invalid signautre for digest","signature",r)}static addPoints(t,r,n){let s=w.fromHex(F.computePublicKey(t).substring(2)),o=w.fromHex(F.computePublicKey(r).substring(2));return"0x"+s.add(o).toHex(!!n)}};var zn=BigInt(0),Dn=BigInt(36);function lr(e){e=e.toLowerCase();let t=e.substring(2).split(""),r=new Uint8Array(40);for(let s=0;s<40;s++)r[s]=t[s].charCodeAt(0);let n=k(z(r));for(let s=0;s<40;s+=2)n[s>>1]>>4>=8&&(t[s]=t[s].toUpperCase()),(n[s>>1]&15)>=8&&(t[s+1]=t[s+1].toUpperCase());return"0x"+t.join("")}var ue={};for(let e=0;e<10;e++)ue[String(e)]=String(e);for(let e=0;e<26;e++)ue[String.fromCharCode(65+e)]=String(10+e);var dr=15;function Vn(e){e=e.toUpperCase(),e=e.substring(4)+e.substring(0,2)+"00";let t=e.split("").map(n=>ue[n]).join("");for(;t.length>=dr;){let n=t.substring(0,dr);t=parseInt(n,10)%97+t.substring(n.length)}let r=String(98-parseInt(t,10)%97);for(;r.length<2;)r="0"+r;return r}var $n=function(){let e={};for(let t=0;t<36;t++){let r="0123456789abcdefghijklmnopqrstuvwxyz"[t];e[r]=BigInt(t)}return e}();function Mn(e){e=e.toLowerCase();let t=zn;for(let r=0;r