@privy-io/react-auth 1.24.0-beta.6 → 1.24.0-beta.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
- var Lu=Object.create;var Jo=Object.defineProperty;var ku=Object.getOwnPropertyDescriptor;var Ru=Object.getOwnPropertyNames;var Wu=Object.getPrototypeOf,Iu=Object.prototype.hasOwnProperty;var Nu=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var _s=(e,t)=>()=>(e&&(t=e(e=0)),t);var kt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ps=(e,t)=>{for(var r in t)Jo(e,r,{get:t[r],enumerable:!0})},As=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ru(t))!Iu.call(e,i)&&i!==r&&Jo(e,i,{get:()=>t[i],enumerable:!(n=ku(t,i))||n.enumerable});return e};var Ss=(e,t,r)=>(r=e!=null?Lu(Wu(e)):{},As(t||!e||!e.__esModule?Jo(r,"default",{value:e,enumerable:!0}):r,e)),Ts=e=>As(Jo({},"__esModule",{value:!0}),e);var al=kt((il,Ui)=>{(function(e,t){"use strict";function r(h,o){if(!h)throw new Error(o||"Assertion failed")}function n(h,o){h.super_=o;var s=function(){};s.prototype=o.prototype,h.prototype=new s,h.prototype.constructor=h}function i(h,o,s){if(i.isBN(h))return h;this.negative=0,this.words=null,this.length=0,this.red=null,h!==null&&((o==="le"||o==="be")&&(s=o,o=10),this._init(h||0,o||10,s||"be"))}typeof e=="object"?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26;var c;try{typeof window<"u"&&typeof window.Buffer<"u"?c=window.Buffer:c=Nu("buffer").Buffer}catch{}i.isBN=function(o){return o instanceof i?!0:o!==null&&typeof o=="object"&&o.constructor.wordSize===i.wordSize&&Array.isArray(o.words)},i.max=function(o,s){return o.cmp(s)>0?o:s},i.min=function(o,s){return o.cmp(s)<0?o:s},i.prototype._init=function(o,s,l){if(typeof o=="number")return this._initNumber(o,s,l);if(typeof o=="object")return this._initArray(o,s,l);s==="hex"&&(s=16),r(s===(s|0)&&s>=2&&s<=36),o=o.toString().replace(/\s+/g,"");var d=0;o[0]==="-"&&(d++,this.negative=1),d<o.length&&(s===16?this._parseHex(o,d,l):(this._parseBase(o,s,d),l==="le"&&this._initArray(this.toArray(),s,l)))},i.prototype._initNumber=function(o,s,l){o<0&&(this.negative=1,o=-o),o<67108864?(this.words=[o&67108863],this.length=1):o<4503599627370496?(this.words=[o&67108863,o/67108864&67108863],this.length=2):(r(o<9007199254740992),this.words=[o&67108863,o/67108864&67108863,1],this.length=3),l==="le"&&this._initArray(this.toArray(),s,l)},i.prototype._initArray=function(o,s,l){if(r(typeof o.length=="number"),o.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(o.length/3),this.words=new Array(this.length);for(var d=0;d<this.length;d++)this.words[d]=0;var u,v,b=0;if(l==="be")for(d=o.length-1,u=0;d>=0;d-=3)v=o[d]|o[d-1]<<8|o[d-2]<<16,this.words[u]|=v<<b&67108863,this.words[u+1]=v>>>26-b&67108863,b+=24,b>=26&&(b-=26,u++);else if(l==="le")for(d=0,u=0;d<o.length;d+=3)v=o[d]|o[d+1]<<8|o[d+2]<<16,this.words[u]|=v<<b&67108863,this.words[u+1]=v>>>26-b&67108863,b+=24,b>=26&&(b-=26,u++);return this._strip()};function f(h,o){var s=h.charCodeAt(o);if(s>=48&&s<=57)return s-48;if(s>=65&&s<=70)return s-55;if(s>=97&&s<=102)return s-87;r(!1,"Invalid character in "+h)}function g(h,o,s){var l=f(h,s);return s-1>=o&&(l|=f(h,s-1)<<4),l}i.prototype._parseHex=function(o,s,l){this.length=Math.ceil((o.length-s)/6),this.words=new Array(this.length);for(var d=0;d<this.length;d++)this.words[d]=0;var u=0,v=0,b;if(l==="be")for(d=o.length-1;d>=s;d-=2)b=g(o,s,d)<<u,this.words[v]|=b&67108863,u>=18?(u-=18,v+=1,this.words[v]|=b>>>26):u+=8;else{var p=o.length-s;for(d=p%2===0?s+1:s;d<o.length;d+=2)b=g(o,s,d)<<u,this.words[v]|=b&67108863,u>=18?(u-=18,v+=1,this.words[v]|=b>>>26):u+=8}this._strip()};function y(h,o,s,l){for(var d=0,u=0,v=Math.min(h.length,s),b=o;b<v;b++){var p=h.charCodeAt(b)-48;d*=l,p>=49?u=p-49+10:p>=17?u=p-17+10:u=p,r(p>=0&&u<l,"Invalid character"),d+=u}return d}i.prototype._parseBase=function(o,s,l){this.words=[0],this.length=1;for(var d=0,u=1;u<=67108863;u*=s)d++;d--,u=u/s|0;for(var v=o.length-l,b=v%d,p=Math.min(v,v-b)+l,a=0,m=l;m<p;m+=d)a=y(o,m,m+d,s),this.imuln(u),this.words[0]+a<67108864?this.words[0]+=a:this._iaddn(a);if(b!==0){var k=1;for(a=y(o,m,o.length,s),m=0;m<b;m++)k*=s;this.imuln(k),this.words[0]+a<67108864?this.words[0]+=a:this._iaddn(a)}this._strip()},i.prototype.copy=function(o){o.words=new Array(this.length);for(var s=0;s<this.length;s++)o.words[s]=this.words[s];o.length=this.length,o.negative=this.negative,o.red=this.red};function w(h,o){h.words=o.words,h.length=o.length,h.negative=o.negative,h.red=o.red}if(i.prototype._move=function(o){w(o,this)},i.prototype.clone=function(){var o=new i(null);return this.copy(o),o},i.prototype._expand=function(o){for(;this.length<o;)this.words[this.length++]=0;return this},i.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=A}catch{i.prototype.inspect=A}else i.prototype.inspect=A;function A(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var P=["","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"],_=[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],T=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(o,s){o=o||10,s=s|0||1;var l;if(o===16||o==="hex"){l="";for(var d=0,u=0,v=0;v<this.length;v++){var b=this.words[v],p=((b<<d|u)&16777215).toString(16);u=b>>>24-d&16777215,d+=2,d>=26&&(d-=26,v--),u!==0||v!==this.length-1?l=P[6-p.length]+p+l:l=p+l}for(u!==0&&(l=u.toString(16)+l);l.length%s!==0;)l="0"+l;return this.negative!==0&&(l="-"+l),l}if(o===(o|0)&&o>=2&&o<=36){var a=_[o],m=T[o];l="";var k=this.clone();for(k.negative=0;!k.isZero();){var R=k.modrn(m).toString(o);k=k.idivn(m),k.isZero()?l=R+l:l=P[a-R.length]+R+l}for(this.isZero()&&(l="0"+l);l.length%s!==0;)l="0"+l;return this.negative!==0&&(l="-"+l),l}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var o=this.words[0];return this.length===2?o+=this.words[1]*67108864:this.length===3&&this.words[2]===1?o+=4503599627370496+this.words[1]*67108864:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-o:o},i.prototype.toJSON=function(){return this.toString(16,2)},c&&(i.prototype.toBuffer=function(o,s){return this.toArrayLike(c,o,s)}),i.prototype.toArray=function(o,s){return this.toArrayLike(Array,o,s)};var M=function(o,s){return o.allocUnsafe?o.allocUnsafe(s):new o(s)};i.prototype.toArrayLike=function(o,s,l){this._strip();var d=this.byteLength(),u=l||Math.max(1,d);r(d<=u,"byte array longer than desired length"),r(u>0,"Requested array length <= 0");var v=M(o,u),b=s==="le"?"LE":"BE";return this["_toArrayLike"+b](v,d),v},i.prototype._toArrayLikeLE=function(o,s){for(var l=0,d=0,u=0,v=0;u<this.length;u++){var b=this.words[u]<<v|d;o[l++]=b&255,l<o.length&&(o[l++]=b>>8&255),l<o.length&&(o[l++]=b>>16&255),v===6?(l<o.length&&(o[l++]=b>>24&255),d=0,v=0):(d=b>>>24,v+=2)}if(l<o.length)for(o[l++]=d;l<o.length;)o[l++]=0},i.prototype._toArrayLikeBE=function(o,s){for(var l=o.length-1,d=0,u=0,v=0;u<this.length;u++){var b=this.words[u]<<v|d;o[l--]=b&255,l>=0&&(o[l--]=b>>8&255),l>=0&&(o[l--]=b>>16&255),v===6?(l>=0&&(o[l--]=b>>24&255),d=0,v=0):(d=b>>>24,v+=2)}if(l>=0)for(o[l--]=d;l>=0;)o[l--]=0},Math.clz32?i.prototype._countBits=function(o){return 32-Math.clz32(o)}:i.prototype._countBits=function(o){var s=o,l=0;return s>=4096&&(l+=13,s>>>=13),s>=64&&(l+=7,s>>>=7),s>=8&&(l+=4,s>>>=4),s>=2&&(l+=2,s>>>=2),l+s},i.prototype._zeroBits=function(o){if(o===0)return 26;var s=o,l=0;return(s&8191)===0&&(l+=13,s>>>=13),(s&127)===0&&(l+=7,s>>>=7),(s&15)===0&&(l+=4,s>>>=4),(s&3)===0&&(l+=2,s>>>=2),(s&1)===0&&l++,l},i.prototype.bitLength=function(){var o=this.words[this.length-1],s=this._countBits(o);return(this.length-1)*26+s};function E(h){for(var o=new Array(h.bitLength()),s=0;s<o.length;s++){var l=s/26|0,d=s%26;o[s]=h.words[l]>>>d&1}return o}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var o=0,s=0;s<this.length;s++){var l=this._zeroBits(this.words[s]);if(o+=l,l!==26)break}return o},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(o){return this.negative!==0?this.abs().inotn(o).iaddn(1):this.clone()},i.prototype.fromTwos=function(o){return this.testn(o-1)?this.notn(o).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return this.negative!==0},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(o){for(;this.length<o.length;)this.words[this.length++]=0;for(var s=0;s<o.length;s++)this.words[s]=this.words[s]|o.words[s];return this._strip()},i.prototype.ior=function(o){return r((this.negative|o.negative)===0),this.iuor(o)},i.prototype.or=function(o){return this.length>o.length?this.clone().ior(o):o.clone().ior(this)},i.prototype.uor=function(o){return this.length>o.length?this.clone().iuor(o):o.clone().iuor(this)},i.prototype.iuand=function(o){var s;this.length>o.length?s=o:s=this;for(var l=0;l<s.length;l++)this.words[l]=this.words[l]&o.words[l];return this.length=s.length,this._strip()},i.prototype.iand=function(o){return r((this.negative|o.negative)===0),this.iuand(o)},i.prototype.and=function(o){return this.length>o.length?this.clone().iand(o):o.clone().iand(this)},i.prototype.uand=function(o){return this.length>o.length?this.clone().iuand(o):o.clone().iuand(this)},i.prototype.iuxor=function(o){var s,l;this.length>o.length?(s=this,l=o):(s=o,l=this);for(var d=0;d<l.length;d++)this.words[d]=s.words[d]^l.words[d];if(this!==s)for(;d<s.length;d++)this.words[d]=s.words[d];return this.length=s.length,this._strip()},i.prototype.ixor=function(o){return r((this.negative|o.negative)===0),this.iuxor(o)},i.prototype.xor=function(o){return this.length>o.length?this.clone().ixor(o):o.clone().ixor(this)},i.prototype.uxor=function(o){return this.length>o.length?this.clone().iuxor(o):o.clone().iuxor(this)},i.prototype.inotn=function(o){r(typeof o=="number"&&o>=0);var s=Math.ceil(o/26)|0,l=o%26;this._expand(s),l>0&&s--;for(var d=0;d<s;d++)this.words[d]=~this.words[d]&67108863;return l>0&&(this.words[d]=~this.words[d]&67108863>>26-l),this._strip()},i.prototype.notn=function(o){return this.clone().inotn(o)},i.prototype.setn=function(o,s){r(typeof o=="number"&&o>=0);var l=o/26|0,d=o%26;return this._expand(l+1),s?this.words[l]=this.words[l]|1<<d:this.words[l]=this.words[l]&~(1<<d),this._strip()},i.prototype.iadd=function(o){var s;if(this.negative!==0&&o.negative===0)return this.negative=0,s=this.isub(o),this.negative^=1,this._normSign();if(this.negative===0&&o.negative!==0)return o.negative=0,s=this.isub(o),o.negative=1,s._normSign();var l,d;this.length>o.length?(l=this,d=o):(l=o,d=this);for(var u=0,v=0;v<d.length;v++)s=(l.words[v]|0)+(d.words[v]|0)+u,this.words[v]=s&67108863,u=s>>>26;for(;u!==0&&v<l.length;v++)s=(l.words[v]|0)+u,this.words[v]=s&67108863,u=s>>>26;if(this.length=l.length,u!==0)this.words[this.length]=u,this.length++;else if(l!==this)for(;v<l.length;v++)this.words[v]=l.words[v];return this},i.prototype.add=function(o){var s;return o.negative!==0&&this.negative===0?(o.negative=0,s=this.sub(o),o.negative^=1,s):o.negative===0&&this.negative!==0?(this.negative=0,s=o.sub(this),this.negative=1,s):this.length>o.length?this.clone().iadd(o):o.clone().iadd(this)},i.prototype.isub=function(o){if(o.negative!==0){o.negative=0;var s=this.iadd(o);return o.negative=1,s._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(o),this.negative=1,this._normSign();var l=this.cmp(o);if(l===0)return this.negative=0,this.length=1,this.words[0]=0,this;var d,u;l>0?(d=this,u=o):(d=o,u=this);for(var v=0,b=0;b<u.length;b++)s=(d.words[b]|0)-(u.words[b]|0)+v,v=s>>26,this.words[b]=s&67108863;for(;v!==0&&b<d.length;b++)s=(d.words[b]|0)+v,v=s>>26,this.words[b]=s&67108863;if(v===0&&b<d.length&&d!==this)for(;b<d.length;b++)this.words[b]=d.words[b];return this.length=Math.max(this.length,b),d!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(o){return this.clone().isub(o)};function S(h,o,s){s.negative=o.negative^h.negative;var l=h.length+o.length|0;s.length=l,l=l-1|0;var d=h.words[0]|0,u=o.words[0]|0,v=d*u,b=v&67108863,p=v/67108864|0;s.words[0]=b;for(var a=1;a<l;a++){for(var m=p>>>26,k=p&67108863,R=Math.min(a,o.length-1),N=Math.max(0,a-h.length+1);N<=R;N++){var H=a-N|0;d=h.words[H]|0,u=o.words[N]|0,v=d*u+k,m+=v/67108864|0,k=v&67108863}s.words[a]=k|0,p=m|0}return p!==0?s.words[a]=p|0:s.length--,s._strip()}var L=function(o,s,l){var d=o.words,u=s.words,v=l.words,b=0,p,a,m,k=d[0]|0,R=k&8191,N=k>>>13,H=d[1]|0,x=H&8191,C=H>>>13,V=d[2]|0,W=V&8191,oe=V>>>13,Ir=d[3]|0,se=Ir&8191,fe=Ir>>>13,ls=d[4]|0,pe=ls&8191,he=ls>>>13,cs=d[5]|0,me=cs&8191,ge=cs>>>13,ds=d[6]|0,ve=ds&8191,ye=ds>>>13,us=d[7]|0,be=us&8191,we=us>>>13,fs=d[8]|0,Ce=fs&8191,xe=fs>>>13,ps=d[9]|0,Ee=ps&8191,_e=ps>>>13,hs=u[0]|0,Pe=hs&8191,Ae=hs>>>13,ms=u[1]|0,Se=ms&8191,Te=ms>>>13,gs=u[2]|0,Me=gs&8191,Le=gs>>>13,vs=u[3]|0,ke=vs&8191,Re=vs>>>13,ys=u[4]|0,We=ys&8191,Ie=ys>>>13,bs=u[5]|0,Ne=bs&8191,Oe=bs>>>13,ws=u[6]|0,De=ws&8191,Ue=ws>>>13,Cs=u[7]|0,Be=Cs&8191,Fe=Cs>>>13,xs=u[8]|0,Ge=xs&8191,He=xs>>>13,Es=u[9]|0,Ve=Es&8191,qe=Es>>>13;l.negative=o.negative^s.negative,l.length=19,p=Math.imul(R,Pe),a=Math.imul(R,Ae),a=a+Math.imul(N,Pe)|0,m=Math.imul(N,Ae);var hi=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(hi>>>26)|0,hi&=67108863,p=Math.imul(x,Pe),a=Math.imul(x,Ae),a=a+Math.imul(C,Pe)|0,m=Math.imul(C,Ae),p=p+Math.imul(R,Se)|0,a=a+Math.imul(R,Te)|0,a=a+Math.imul(N,Se)|0,m=m+Math.imul(N,Te)|0;var mi=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(mi>>>26)|0,mi&=67108863,p=Math.imul(W,Pe),a=Math.imul(W,Ae),a=a+Math.imul(oe,Pe)|0,m=Math.imul(oe,Ae),p=p+Math.imul(x,Se)|0,a=a+Math.imul(x,Te)|0,a=a+Math.imul(C,Se)|0,m=m+Math.imul(C,Te)|0,p=p+Math.imul(R,Me)|0,a=a+Math.imul(R,Le)|0,a=a+Math.imul(N,Me)|0,m=m+Math.imul(N,Le)|0;var gi=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(gi>>>26)|0,gi&=67108863,p=Math.imul(se,Pe),a=Math.imul(se,Ae),a=a+Math.imul(fe,Pe)|0,m=Math.imul(fe,Ae),p=p+Math.imul(W,Se)|0,a=a+Math.imul(W,Te)|0,a=a+Math.imul(oe,Se)|0,m=m+Math.imul(oe,Te)|0,p=p+Math.imul(x,Me)|0,a=a+Math.imul(x,Le)|0,a=a+Math.imul(C,Me)|0,m=m+Math.imul(C,Le)|0,p=p+Math.imul(R,ke)|0,a=a+Math.imul(R,Re)|0,a=a+Math.imul(N,ke)|0,m=m+Math.imul(N,Re)|0;var vi=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(vi>>>26)|0,vi&=67108863,p=Math.imul(pe,Pe),a=Math.imul(pe,Ae),a=a+Math.imul(he,Pe)|0,m=Math.imul(he,Ae),p=p+Math.imul(se,Se)|0,a=a+Math.imul(se,Te)|0,a=a+Math.imul(fe,Se)|0,m=m+Math.imul(fe,Te)|0,p=p+Math.imul(W,Me)|0,a=a+Math.imul(W,Le)|0,a=a+Math.imul(oe,Me)|0,m=m+Math.imul(oe,Le)|0,p=p+Math.imul(x,ke)|0,a=a+Math.imul(x,Re)|0,a=a+Math.imul(C,ke)|0,m=m+Math.imul(C,Re)|0,p=p+Math.imul(R,We)|0,a=a+Math.imul(R,Ie)|0,a=a+Math.imul(N,We)|0,m=m+Math.imul(N,Ie)|0;var yi=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(yi>>>26)|0,yi&=67108863,p=Math.imul(me,Pe),a=Math.imul(me,Ae),a=a+Math.imul(ge,Pe)|0,m=Math.imul(ge,Ae),p=p+Math.imul(pe,Se)|0,a=a+Math.imul(pe,Te)|0,a=a+Math.imul(he,Se)|0,m=m+Math.imul(he,Te)|0,p=p+Math.imul(se,Me)|0,a=a+Math.imul(se,Le)|0,a=a+Math.imul(fe,Me)|0,m=m+Math.imul(fe,Le)|0,p=p+Math.imul(W,ke)|0,a=a+Math.imul(W,Re)|0,a=a+Math.imul(oe,ke)|0,m=m+Math.imul(oe,Re)|0,p=p+Math.imul(x,We)|0,a=a+Math.imul(x,Ie)|0,a=a+Math.imul(C,We)|0,m=m+Math.imul(C,Ie)|0,p=p+Math.imul(R,Ne)|0,a=a+Math.imul(R,Oe)|0,a=a+Math.imul(N,Ne)|0,m=m+Math.imul(N,Oe)|0;var bi=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(bi>>>26)|0,bi&=67108863,p=Math.imul(ve,Pe),a=Math.imul(ve,Ae),a=a+Math.imul(ye,Pe)|0,m=Math.imul(ye,Ae),p=p+Math.imul(me,Se)|0,a=a+Math.imul(me,Te)|0,a=a+Math.imul(ge,Se)|0,m=m+Math.imul(ge,Te)|0,p=p+Math.imul(pe,Me)|0,a=a+Math.imul(pe,Le)|0,a=a+Math.imul(he,Me)|0,m=m+Math.imul(he,Le)|0,p=p+Math.imul(se,ke)|0,a=a+Math.imul(se,Re)|0,a=a+Math.imul(fe,ke)|0,m=m+Math.imul(fe,Re)|0,p=p+Math.imul(W,We)|0,a=a+Math.imul(W,Ie)|0,a=a+Math.imul(oe,We)|0,m=m+Math.imul(oe,Ie)|0,p=p+Math.imul(x,Ne)|0,a=a+Math.imul(x,Oe)|0,a=a+Math.imul(C,Ne)|0,m=m+Math.imul(C,Oe)|0,p=p+Math.imul(R,De)|0,a=a+Math.imul(R,Ue)|0,a=a+Math.imul(N,De)|0,m=m+Math.imul(N,Ue)|0;var wi=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(wi>>>26)|0,wi&=67108863,p=Math.imul(be,Pe),a=Math.imul(be,Ae),a=a+Math.imul(we,Pe)|0,m=Math.imul(we,Ae),p=p+Math.imul(ve,Se)|0,a=a+Math.imul(ve,Te)|0,a=a+Math.imul(ye,Se)|0,m=m+Math.imul(ye,Te)|0,p=p+Math.imul(me,Me)|0,a=a+Math.imul(me,Le)|0,a=a+Math.imul(ge,Me)|0,m=m+Math.imul(ge,Le)|0,p=p+Math.imul(pe,ke)|0,a=a+Math.imul(pe,Re)|0,a=a+Math.imul(he,ke)|0,m=m+Math.imul(he,Re)|0,p=p+Math.imul(se,We)|0,a=a+Math.imul(se,Ie)|0,a=a+Math.imul(fe,We)|0,m=m+Math.imul(fe,Ie)|0,p=p+Math.imul(W,Ne)|0,a=a+Math.imul(W,Oe)|0,a=a+Math.imul(oe,Ne)|0,m=m+Math.imul(oe,Oe)|0,p=p+Math.imul(x,De)|0,a=a+Math.imul(x,Ue)|0,a=a+Math.imul(C,De)|0,m=m+Math.imul(C,Ue)|0,p=p+Math.imul(R,Be)|0,a=a+Math.imul(R,Fe)|0,a=a+Math.imul(N,Be)|0,m=m+Math.imul(N,Fe)|0;var Ci=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(Ci>>>26)|0,Ci&=67108863,p=Math.imul(Ce,Pe),a=Math.imul(Ce,Ae),a=a+Math.imul(xe,Pe)|0,m=Math.imul(xe,Ae),p=p+Math.imul(be,Se)|0,a=a+Math.imul(be,Te)|0,a=a+Math.imul(we,Se)|0,m=m+Math.imul(we,Te)|0,p=p+Math.imul(ve,Me)|0,a=a+Math.imul(ve,Le)|0,a=a+Math.imul(ye,Me)|0,m=m+Math.imul(ye,Le)|0,p=p+Math.imul(me,ke)|0,a=a+Math.imul(me,Re)|0,a=a+Math.imul(ge,ke)|0,m=m+Math.imul(ge,Re)|0,p=p+Math.imul(pe,We)|0,a=a+Math.imul(pe,Ie)|0,a=a+Math.imul(he,We)|0,m=m+Math.imul(he,Ie)|0,p=p+Math.imul(se,Ne)|0,a=a+Math.imul(se,Oe)|0,a=a+Math.imul(fe,Ne)|0,m=m+Math.imul(fe,Oe)|0,p=p+Math.imul(W,De)|0,a=a+Math.imul(W,Ue)|0,a=a+Math.imul(oe,De)|0,m=m+Math.imul(oe,Ue)|0,p=p+Math.imul(x,Be)|0,a=a+Math.imul(x,Fe)|0,a=a+Math.imul(C,Be)|0,m=m+Math.imul(C,Fe)|0,p=p+Math.imul(R,Ge)|0,a=a+Math.imul(R,He)|0,a=a+Math.imul(N,Ge)|0,m=m+Math.imul(N,He)|0;var xi=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(xi>>>26)|0,xi&=67108863,p=Math.imul(Ee,Pe),a=Math.imul(Ee,Ae),a=a+Math.imul(_e,Pe)|0,m=Math.imul(_e,Ae),p=p+Math.imul(Ce,Se)|0,a=a+Math.imul(Ce,Te)|0,a=a+Math.imul(xe,Se)|0,m=m+Math.imul(xe,Te)|0,p=p+Math.imul(be,Me)|0,a=a+Math.imul(be,Le)|0,a=a+Math.imul(we,Me)|0,m=m+Math.imul(we,Le)|0,p=p+Math.imul(ve,ke)|0,a=a+Math.imul(ve,Re)|0,a=a+Math.imul(ye,ke)|0,m=m+Math.imul(ye,Re)|0,p=p+Math.imul(me,We)|0,a=a+Math.imul(me,Ie)|0,a=a+Math.imul(ge,We)|0,m=m+Math.imul(ge,Ie)|0,p=p+Math.imul(pe,Ne)|0,a=a+Math.imul(pe,Oe)|0,a=a+Math.imul(he,Ne)|0,m=m+Math.imul(he,Oe)|0,p=p+Math.imul(se,De)|0,a=a+Math.imul(se,Ue)|0,a=a+Math.imul(fe,De)|0,m=m+Math.imul(fe,Ue)|0,p=p+Math.imul(W,Be)|0,a=a+Math.imul(W,Fe)|0,a=a+Math.imul(oe,Be)|0,m=m+Math.imul(oe,Fe)|0,p=p+Math.imul(x,Ge)|0,a=a+Math.imul(x,He)|0,a=a+Math.imul(C,Ge)|0,m=m+Math.imul(C,He)|0,p=p+Math.imul(R,Ve)|0,a=a+Math.imul(R,qe)|0,a=a+Math.imul(N,Ve)|0,m=m+Math.imul(N,qe)|0;var Ei=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(Ei>>>26)|0,Ei&=67108863,p=Math.imul(Ee,Se),a=Math.imul(Ee,Te),a=a+Math.imul(_e,Se)|0,m=Math.imul(_e,Te),p=p+Math.imul(Ce,Me)|0,a=a+Math.imul(Ce,Le)|0,a=a+Math.imul(xe,Me)|0,m=m+Math.imul(xe,Le)|0,p=p+Math.imul(be,ke)|0,a=a+Math.imul(be,Re)|0,a=a+Math.imul(we,ke)|0,m=m+Math.imul(we,Re)|0,p=p+Math.imul(ve,We)|0,a=a+Math.imul(ve,Ie)|0,a=a+Math.imul(ye,We)|0,m=m+Math.imul(ye,Ie)|0,p=p+Math.imul(me,Ne)|0,a=a+Math.imul(me,Oe)|0,a=a+Math.imul(ge,Ne)|0,m=m+Math.imul(ge,Oe)|0,p=p+Math.imul(pe,De)|0,a=a+Math.imul(pe,Ue)|0,a=a+Math.imul(he,De)|0,m=m+Math.imul(he,Ue)|0,p=p+Math.imul(se,Be)|0,a=a+Math.imul(se,Fe)|0,a=a+Math.imul(fe,Be)|0,m=m+Math.imul(fe,Fe)|0,p=p+Math.imul(W,Ge)|0,a=a+Math.imul(W,He)|0,a=a+Math.imul(oe,Ge)|0,m=m+Math.imul(oe,He)|0,p=p+Math.imul(x,Ve)|0,a=a+Math.imul(x,qe)|0,a=a+Math.imul(C,Ve)|0,m=m+Math.imul(C,qe)|0;var _i=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(_i>>>26)|0,_i&=67108863,p=Math.imul(Ee,Me),a=Math.imul(Ee,Le),a=a+Math.imul(_e,Me)|0,m=Math.imul(_e,Le),p=p+Math.imul(Ce,ke)|0,a=a+Math.imul(Ce,Re)|0,a=a+Math.imul(xe,ke)|0,m=m+Math.imul(xe,Re)|0,p=p+Math.imul(be,We)|0,a=a+Math.imul(be,Ie)|0,a=a+Math.imul(we,We)|0,m=m+Math.imul(we,Ie)|0,p=p+Math.imul(ve,Ne)|0,a=a+Math.imul(ve,Oe)|0,a=a+Math.imul(ye,Ne)|0,m=m+Math.imul(ye,Oe)|0,p=p+Math.imul(me,De)|0,a=a+Math.imul(me,Ue)|0,a=a+Math.imul(ge,De)|0,m=m+Math.imul(ge,Ue)|0,p=p+Math.imul(pe,Be)|0,a=a+Math.imul(pe,Fe)|0,a=a+Math.imul(he,Be)|0,m=m+Math.imul(he,Fe)|0,p=p+Math.imul(se,Ge)|0,a=a+Math.imul(se,He)|0,a=a+Math.imul(fe,Ge)|0,m=m+Math.imul(fe,He)|0,p=p+Math.imul(W,Ve)|0,a=a+Math.imul(W,qe)|0,a=a+Math.imul(oe,Ve)|0,m=m+Math.imul(oe,qe)|0;var Pi=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(Pi>>>26)|0,Pi&=67108863,p=Math.imul(Ee,ke),a=Math.imul(Ee,Re),a=a+Math.imul(_e,ke)|0,m=Math.imul(_e,Re),p=p+Math.imul(Ce,We)|0,a=a+Math.imul(Ce,Ie)|0,a=a+Math.imul(xe,We)|0,m=m+Math.imul(xe,Ie)|0,p=p+Math.imul(be,Ne)|0,a=a+Math.imul(be,Oe)|0,a=a+Math.imul(we,Ne)|0,m=m+Math.imul(we,Oe)|0,p=p+Math.imul(ve,De)|0,a=a+Math.imul(ve,Ue)|0,a=a+Math.imul(ye,De)|0,m=m+Math.imul(ye,Ue)|0,p=p+Math.imul(me,Be)|0,a=a+Math.imul(me,Fe)|0,a=a+Math.imul(ge,Be)|0,m=m+Math.imul(ge,Fe)|0,p=p+Math.imul(pe,Ge)|0,a=a+Math.imul(pe,He)|0,a=a+Math.imul(he,Ge)|0,m=m+Math.imul(he,He)|0,p=p+Math.imul(se,Ve)|0,a=a+Math.imul(se,qe)|0,a=a+Math.imul(fe,Ve)|0,m=m+Math.imul(fe,qe)|0;var Ai=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(Ai>>>26)|0,Ai&=67108863,p=Math.imul(Ee,We),a=Math.imul(Ee,Ie),a=a+Math.imul(_e,We)|0,m=Math.imul(_e,Ie),p=p+Math.imul(Ce,Ne)|0,a=a+Math.imul(Ce,Oe)|0,a=a+Math.imul(xe,Ne)|0,m=m+Math.imul(xe,Oe)|0,p=p+Math.imul(be,De)|0,a=a+Math.imul(be,Ue)|0,a=a+Math.imul(we,De)|0,m=m+Math.imul(we,Ue)|0,p=p+Math.imul(ve,Be)|0,a=a+Math.imul(ve,Fe)|0,a=a+Math.imul(ye,Be)|0,m=m+Math.imul(ye,Fe)|0,p=p+Math.imul(me,Ge)|0,a=a+Math.imul(me,He)|0,a=a+Math.imul(ge,Ge)|0,m=m+Math.imul(ge,He)|0,p=p+Math.imul(pe,Ve)|0,a=a+Math.imul(pe,qe)|0,a=a+Math.imul(he,Ve)|0,m=m+Math.imul(he,qe)|0;var Si=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(Si>>>26)|0,Si&=67108863,p=Math.imul(Ee,Ne),a=Math.imul(Ee,Oe),a=a+Math.imul(_e,Ne)|0,m=Math.imul(_e,Oe),p=p+Math.imul(Ce,De)|0,a=a+Math.imul(Ce,Ue)|0,a=a+Math.imul(xe,De)|0,m=m+Math.imul(xe,Ue)|0,p=p+Math.imul(be,Be)|0,a=a+Math.imul(be,Fe)|0,a=a+Math.imul(we,Be)|0,m=m+Math.imul(we,Fe)|0,p=p+Math.imul(ve,Ge)|0,a=a+Math.imul(ve,He)|0,a=a+Math.imul(ye,Ge)|0,m=m+Math.imul(ye,He)|0,p=p+Math.imul(me,Ve)|0,a=a+Math.imul(me,qe)|0,a=a+Math.imul(ge,Ve)|0,m=m+Math.imul(ge,qe)|0;var Ti=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(Ti>>>26)|0,Ti&=67108863,p=Math.imul(Ee,De),a=Math.imul(Ee,Ue),a=a+Math.imul(_e,De)|0,m=Math.imul(_e,Ue),p=p+Math.imul(Ce,Be)|0,a=a+Math.imul(Ce,Fe)|0,a=a+Math.imul(xe,Be)|0,m=m+Math.imul(xe,Fe)|0,p=p+Math.imul(be,Ge)|0,a=a+Math.imul(be,He)|0,a=a+Math.imul(we,Ge)|0,m=m+Math.imul(we,He)|0,p=p+Math.imul(ve,Ve)|0,a=a+Math.imul(ve,qe)|0,a=a+Math.imul(ye,Ve)|0,m=m+Math.imul(ye,qe)|0;var Mi=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(Mi>>>26)|0,Mi&=67108863,p=Math.imul(Ee,Be),a=Math.imul(Ee,Fe),a=a+Math.imul(_e,Be)|0,m=Math.imul(_e,Fe),p=p+Math.imul(Ce,Ge)|0,a=a+Math.imul(Ce,He)|0,a=a+Math.imul(xe,Ge)|0,m=m+Math.imul(xe,He)|0,p=p+Math.imul(be,Ve)|0,a=a+Math.imul(be,qe)|0,a=a+Math.imul(we,Ve)|0,m=m+Math.imul(we,qe)|0;var Li=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(Li>>>26)|0,Li&=67108863,p=Math.imul(Ee,Ge),a=Math.imul(Ee,He),a=a+Math.imul(_e,Ge)|0,m=Math.imul(_e,He),p=p+Math.imul(Ce,Ve)|0,a=a+Math.imul(Ce,qe)|0,a=a+Math.imul(xe,Ve)|0,m=m+Math.imul(xe,qe)|0;var ki=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(ki>>>26)|0,ki&=67108863,p=Math.imul(Ee,Ve),a=Math.imul(Ee,qe),a=a+Math.imul(_e,Ve)|0,m=Math.imul(_e,qe);var Ri=(b+p|0)+((a&8191)<<13)|0;return b=(m+(a>>>13)|0)+(Ri>>>26)|0,Ri&=67108863,v[0]=hi,v[1]=mi,v[2]=gi,v[3]=vi,v[4]=yi,v[5]=bi,v[6]=wi,v[7]=Ci,v[8]=xi,v[9]=Ei,v[10]=_i,v[11]=Pi,v[12]=Ai,v[13]=Si,v[14]=Ti,v[15]=Mi,v[16]=Li,v[17]=ki,v[18]=Ri,b!==0&&(v[19]=b,l.length++),l};Math.imul||(L=S);function G(h,o,s){s.negative=o.negative^h.negative,s.length=h.length+o.length;for(var l=0,d=0,u=0;u<s.length-1;u++){var v=d;d=0;for(var b=l&67108863,p=Math.min(u,o.length-1),a=Math.max(0,u-h.length+1);a<=p;a++){var m=u-a,k=h.words[m]|0,R=o.words[a]|0,N=k*R,H=N&67108863;v=v+(N/67108864|0)|0,H=H+b|0,b=H&67108863,v=v+(H>>>26)|0,d+=v>>>26,v&=67108863}s.words[u]=b,l=v,v=d}return l!==0?s.words[u]=l:s.length--,s._strip()}function q(h,o,s){return G(h,o,s)}i.prototype.mulTo=function(o,s){var l,d=this.length+o.length;return this.length===10&&o.length===10?l=L(this,o,s):d<63?l=S(this,o,s):d<1024?l=G(this,o,s):l=q(this,o,s),l};function $(h,o){this.x=h,this.y=o}$.prototype.makeRBT=function(o){for(var s=new Array(o),l=i.prototype._countBits(o)-1,d=0;d<o;d++)s[d]=this.revBin(d,l,o);return s},$.prototype.revBin=function(o,s,l){if(o===0||o===l-1)return o;for(var d=0,u=0;u<s;u++)d|=(o&1)<<s-u-1,o>>=1;return d},$.prototype.permute=function(o,s,l,d,u,v){for(var b=0;b<v;b++)d[b]=s[o[b]],u[b]=l[o[b]]},$.prototype.transform=function(o,s,l,d,u,v){this.permute(v,o,s,l,d,u);for(var b=1;b<u;b<<=1)for(var p=b<<1,a=Math.cos(2*Math.PI/p),m=Math.sin(2*Math.PI/p),k=0;k<u;k+=p)for(var R=a,N=m,H=0;H<b;H++){var x=l[k+H],C=d[k+H],V=l[k+H+b],W=d[k+H+b],oe=R*V-N*W;W=R*W+N*V,V=oe,l[k+H]=x+V,d[k+H]=C+W,l[k+H+b]=x-V,d[k+H+b]=C-W,H!==p&&(oe=a*R-m*N,N=a*N+m*R,R=oe)}},$.prototype.guessLen13b=function(o,s){var l=Math.max(s,o)|1,d=l&1,u=0;for(l=l/2|0;l;l=l>>>1)u++;return 1<<u+1+d},$.prototype.conjugate=function(o,s,l){if(!(l<=1))for(var d=0;d<l/2;d++){var u=o[d];o[d]=o[l-d-1],o[l-d-1]=u,u=s[d],s[d]=-s[l-d-1],s[l-d-1]=-u}},$.prototype.normalize13b=function(o,s){for(var l=0,d=0;d<s/2;d++){var u=Math.round(o[2*d+1]/s)*8192+Math.round(o[2*d]/s)+l;o[d]=u&67108863,u<67108864?l=0:l=u/67108864|0}return o},$.prototype.convert13b=function(o,s,l,d){for(var u=0,v=0;v<s;v++)u=u+(o[v]|0),l[2*v]=u&8191,u=u>>>13,l[2*v+1]=u&8191,u=u>>>13;for(v=2*s;v<d;++v)l[v]=0;r(u===0),r((u&-8192)===0)},$.prototype.stub=function(o){for(var s=new Array(o),l=0;l<o;l++)s[l]=0;return s},$.prototype.mulp=function(o,s,l){var d=2*this.guessLen13b(o.length,s.length),u=this.makeRBT(d),v=this.stub(d),b=new Array(d),p=new Array(d),a=new Array(d),m=new Array(d),k=new Array(d),R=new Array(d),N=l.words;N.length=d,this.convert13b(o.words,o.length,b,d),this.convert13b(s.words,s.length,m,d),this.transform(b,v,p,a,d,u),this.transform(m,v,k,R,d,u);for(var H=0;H<d;H++){var x=p[H]*k[H]-a[H]*R[H];a[H]=p[H]*R[H]+a[H]*k[H],p[H]=x}return this.conjugate(p,a,d),this.transform(p,a,N,v,d,u),this.conjugate(N,v,d),this.normalize13b(N,d),l.negative=o.negative^s.negative,l.length=o.length+s.length,l._strip()},i.prototype.mul=function(o){var s=new i(null);return s.words=new Array(this.length+o.length),this.mulTo(o,s)},i.prototype.mulf=function(o){var s=new i(null);return s.words=new Array(this.length+o.length),q(this,o,s)},i.prototype.imul=function(o){return this.clone().mulTo(o,this)},i.prototype.imuln=function(o){var s=o<0;s&&(o=-o),r(typeof o=="number"),r(o<67108864);for(var l=0,d=0;d<this.length;d++){var u=(this.words[d]|0)*o,v=(u&67108863)+(l&67108863);l>>=26,l+=u/67108864|0,l+=v>>>26,this.words[d]=v&67108863}return l!==0&&(this.words[d]=l,this.length++),s?this.ineg():this},i.prototype.muln=function(o){return this.clone().imuln(o)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(o){var s=E(o);if(s.length===0)return new i(1);for(var l=this,d=0;d<s.length&&s[d]===0;d++,l=l.sqr());if(++d<s.length)for(var u=l.sqr();d<s.length;d++,u=u.sqr())s[d]!==0&&(l=l.mul(u));return l},i.prototype.iushln=function(o){r(typeof o=="number"&&o>=0);var s=o%26,l=(o-s)/26,d=67108863>>>26-s<<26-s,u;if(s!==0){var v=0;for(u=0;u<this.length;u++){var b=this.words[u]&d,p=(this.words[u]|0)-b<<s;this.words[u]=p|v,v=b>>>26-s}v&&(this.words[u]=v,this.length++)}if(l!==0){for(u=this.length-1;u>=0;u--)this.words[u+l]=this.words[u];for(u=0;u<l;u++)this.words[u]=0;this.length+=l}return this._strip()},i.prototype.ishln=function(o){return r(this.negative===0),this.iushln(o)},i.prototype.iushrn=function(o,s,l){r(typeof o=="number"&&o>=0);var d;s?d=(s-s%26)/26:d=0;var u=o%26,v=Math.min((o-u)/26,this.length),b=67108863^67108863>>>u<<u,p=l;if(d-=v,d=Math.max(0,d),p){for(var a=0;a<v;a++)p.words[a]=this.words[a];p.length=v}if(v!==0)if(this.length>v)for(this.length-=v,a=0;a<this.length;a++)this.words[a]=this.words[a+v];else this.words[0]=0,this.length=1;var m=0;for(a=this.length-1;a>=0&&(m!==0||a>=d);a--){var k=this.words[a]|0;this.words[a]=m<<26-u|k>>>u,m=k&b}return p&&m!==0&&(p.words[p.length++]=m),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(o,s,l){return r(this.negative===0),this.iushrn(o,s,l)},i.prototype.shln=function(o){return this.clone().ishln(o)},i.prototype.ushln=function(o){return this.clone().iushln(o)},i.prototype.shrn=function(o){return this.clone().ishrn(o)},i.prototype.ushrn=function(o){return this.clone().iushrn(o)},i.prototype.testn=function(o){r(typeof o=="number"&&o>=0);var s=o%26,l=(o-s)/26,d=1<<s;if(this.length<=l)return!1;var u=this.words[l];return!!(u&d)},i.prototype.imaskn=function(o){r(typeof o=="number"&&o>=0);var s=o%26,l=(o-s)/26;if(r(this.negative===0,"imaskn works only with positive numbers"),this.length<=l)return this;if(s!==0&&l++,this.length=Math.min(l,this.length),s!==0){var d=67108863^67108863>>>s<<s;this.words[this.length-1]&=d}return this._strip()},i.prototype.maskn=function(o){return this.clone().imaskn(o)},i.prototype.iaddn=function(o){return r(typeof o=="number"),r(o<67108864),o<0?this.isubn(-o):this.negative!==0?this.length===1&&(this.words[0]|0)<=o?(this.words[0]=o-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(o),this.negative=1,this):this._iaddn(o)},i.prototype._iaddn=function(o){this.words[0]+=o;for(var s=0;s<this.length&&this.words[s]>=67108864;s++)this.words[s]-=67108864,s===this.length-1?this.words[s+1]=1:this.words[s+1]++;return this.length=Math.max(this.length,s+1),this},i.prototype.isubn=function(o){if(r(typeof o=="number"),r(o<67108864),o<0)return this.iaddn(-o);if(this.negative!==0)return this.negative=0,this.iaddn(o),this.negative=1,this;if(this.words[0]-=o,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var s=0;s<this.length&&this.words[s]<0;s++)this.words[s]+=67108864,this.words[s+1]-=1;return this._strip()},i.prototype.addn=function(o){return this.clone().iaddn(o)},i.prototype.subn=function(o){return this.clone().isubn(o)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(o,s,l){var d=o.length+l,u;this._expand(d);var v,b=0;for(u=0;u<o.length;u++){v=(this.words[u+l]|0)+b;var p=(o.words[u]|0)*s;v-=p&67108863,b=(v>>26)-(p/67108864|0),this.words[u+l]=v&67108863}for(;u<this.length-l;u++)v=(this.words[u+l]|0)+b,b=v>>26,this.words[u+l]=v&67108863;if(b===0)return this._strip();for(r(b===-1),b=0,u=0;u<this.length;u++)v=-(this.words[u]|0)+b,b=v>>26,this.words[u]=v&67108863;return this.negative=1,this._strip()},i.prototype._wordDiv=function(o,s){var l=this.length-o.length,d=this.clone(),u=o,v=u.words[u.length-1]|0,b=this._countBits(v);l=26-b,l!==0&&(u=u.ushln(l),d.iushln(l),v=u.words[u.length-1]|0);var p=d.length-u.length,a;if(s!=="mod"){a=new i(null),a.length=p+1,a.words=new Array(a.length);for(var m=0;m<a.length;m++)a.words[m]=0}var k=d.clone()._ishlnsubmul(u,1,p);k.negative===0&&(d=k,a&&(a.words[p]=1));for(var R=p-1;R>=0;R--){var N=(d.words[u.length+R]|0)*67108864+(d.words[u.length+R-1]|0);for(N=Math.min(N/v|0,67108863),d._ishlnsubmul(u,N,R);d.negative!==0;)N--,d.negative=0,d._ishlnsubmul(u,1,R),d.isZero()||(d.negative^=1);a&&(a.words[R]=N)}return a&&a._strip(),d._strip(),s!=="div"&&l!==0&&d.iushrn(l),{div:a||null,mod:d}},i.prototype.divmod=function(o,s,l){if(r(!o.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var d,u,v;return this.negative!==0&&o.negative===0?(v=this.neg().divmod(o,s),s!=="mod"&&(d=v.div.neg()),s!=="div"&&(u=v.mod.neg(),l&&u.negative!==0&&u.iadd(o)),{div:d,mod:u}):this.negative===0&&o.negative!==0?(v=this.divmod(o.neg(),s),s!=="mod"&&(d=v.div.neg()),{div:d,mod:v.mod}):(this.negative&o.negative)!==0?(v=this.neg().divmod(o.neg(),s),s!=="div"&&(u=v.mod.neg(),l&&u.negative!==0&&u.isub(o)),{div:v.div,mod:u}):o.length>this.length||this.cmp(o)<0?{div:new i(0),mod:this}:o.length===1?s==="div"?{div:this.divn(o.words[0]),mod:null}:s==="mod"?{div:null,mod:new i(this.modrn(o.words[0]))}:{div:this.divn(o.words[0]),mod:new i(this.modrn(o.words[0]))}:this._wordDiv(o,s)},i.prototype.div=function(o){return this.divmod(o,"div",!1).div},i.prototype.mod=function(o){return this.divmod(o,"mod",!1).mod},i.prototype.umod=function(o){return this.divmod(o,"mod",!0).mod},i.prototype.divRound=function(o){var s=this.divmod(o);if(s.mod.isZero())return s.div;var l=s.div.negative!==0?s.mod.isub(o):s.mod,d=o.ushrn(1),u=o.andln(1),v=l.cmp(d);return v<0||u===1&&v===0?s.div:s.div.negative!==0?s.div.isubn(1):s.div.iaddn(1)},i.prototype.modrn=function(o){var s=o<0;s&&(o=-o),r(o<=67108863);for(var l=(1<<26)%o,d=0,u=this.length-1;u>=0;u--)d=(l*d+(this.words[u]|0))%o;return s?-d:d},i.prototype.modn=function(o){return this.modrn(o)},i.prototype.idivn=function(o){var s=o<0;s&&(o=-o),r(o<=67108863);for(var l=0,d=this.length-1;d>=0;d--){var u=(this.words[d]|0)+l*67108864;this.words[d]=u/o|0,l=u%o}return this._strip(),s?this.ineg():this},i.prototype.divn=function(o){return this.clone().idivn(o)},i.prototype.egcd=function(o){r(o.negative===0),r(!o.isZero());var s=this,l=o.clone();s.negative!==0?s=s.umod(o):s=s.clone();for(var d=new i(1),u=new i(0),v=new i(0),b=new i(1),p=0;s.isEven()&&l.isEven();)s.iushrn(1),l.iushrn(1),++p;for(var a=l.clone(),m=s.clone();!s.isZero();){for(var k=0,R=1;(s.words[0]&R)===0&&k<26;++k,R<<=1);if(k>0)for(s.iushrn(k);k-- >0;)(d.isOdd()||u.isOdd())&&(d.iadd(a),u.isub(m)),d.iushrn(1),u.iushrn(1);for(var N=0,H=1;(l.words[0]&H)===0&&N<26;++N,H<<=1);if(N>0)for(l.iushrn(N);N-- >0;)(v.isOdd()||b.isOdd())&&(v.iadd(a),b.isub(m)),v.iushrn(1),b.iushrn(1);s.cmp(l)>=0?(s.isub(l),d.isub(v),u.isub(b)):(l.isub(s),v.isub(d),b.isub(u))}return{a:v,b,gcd:l.iushln(p)}},i.prototype._invmp=function(o){r(o.negative===0),r(!o.isZero());var s=this,l=o.clone();s.negative!==0?s=s.umod(o):s=s.clone();for(var d=new i(1),u=new i(0),v=l.clone();s.cmpn(1)>0&&l.cmpn(1)>0;){for(var b=0,p=1;(s.words[0]&p)===0&&b<26;++b,p<<=1);if(b>0)for(s.iushrn(b);b-- >0;)d.isOdd()&&d.iadd(v),d.iushrn(1);for(var a=0,m=1;(l.words[0]&m)===0&&a<26;++a,m<<=1);if(a>0)for(l.iushrn(a);a-- >0;)u.isOdd()&&u.iadd(v),u.iushrn(1);s.cmp(l)>=0?(s.isub(l),d.isub(u)):(l.isub(s),u.isub(d))}var k;return s.cmpn(1)===0?k=d:k=u,k.cmpn(0)<0&&k.iadd(o),k},i.prototype.gcd=function(o){if(this.isZero())return o.abs();if(o.isZero())return this.abs();var s=this.clone(),l=o.clone();s.negative=0,l.negative=0;for(var d=0;s.isEven()&&l.isEven();d++)s.iushrn(1),l.iushrn(1);do{for(;s.isEven();)s.iushrn(1);for(;l.isEven();)l.iushrn(1);var u=s.cmp(l);if(u<0){var v=s;s=l,l=v}else if(u===0||l.cmpn(1)===0)break;s.isub(l)}while(!0);return l.iushln(d)},i.prototype.invm=function(o){return this.egcd(o).a.umod(o)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(o){return this.words[0]&o},i.prototype.bincn=function(o){r(typeof o=="number");var s=o%26,l=(o-s)/26,d=1<<s;if(this.length<=l)return this._expand(l+1),this.words[l]|=d,this;for(var u=d,v=l;u!==0&&v<this.length;v++){var b=this.words[v]|0;b+=u,u=b>>>26,b&=67108863,this.words[v]=b}return u!==0&&(this.words[v]=u,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(o){var s=o<0;if(this.negative!==0&&!s)return-1;if(this.negative===0&&s)return 1;this._strip();var l;if(this.length>1)l=1;else{s&&(o=-o),r(o<=67108863,"Number is too big");var d=this.words[0]|0;l=d===o?0:d<o?-1:1}return this.negative!==0?-l|0:l},i.prototype.cmp=function(o){if(this.negative!==0&&o.negative===0)return-1;if(this.negative===0&&o.negative!==0)return 1;var s=this.ucmp(o);return this.negative!==0?-s|0:s},i.prototype.ucmp=function(o){if(this.length>o.length)return 1;if(this.length<o.length)return-1;for(var s=0,l=this.length-1;l>=0;l--){var d=this.words[l]|0,u=o.words[l]|0;if(d!==u){d<u?s=-1:d>u&&(s=1);break}}return s},i.prototype.gtn=function(o){return this.cmpn(o)===1},i.prototype.gt=function(o){return this.cmp(o)===1},i.prototype.gten=function(o){return this.cmpn(o)>=0},i.prototype.gte=function(o){return this.cmp(o)>=0},i.prototype.ltn=function(o){return this.cmpn(o)===-1},i.prototype.lt=function(o){return this.cmp(o)===-1},i.prototype.lten=function(o){return this.cmpn(o)<=0},i.prototype.lte=function(o){return this.cmp(o)<=0},i.prototype.eqn=function(o){return this.cmpn(o)===0},i.prototype.eq=function(o){return this.cmp(o)===0},i.red=function(o){return new F(o)},i.prototype.toRed=function(o){return r(!this.red,"Already a number in reduction context"),r(this.negative===0,"red works only with positives"),o.convertTo(this)._forceRed(o)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(o){return this.red=o,this},i.prototype.forceRed=function(o){return r(!this.red,"Already a number in reduction context"),this._forceRed(o)},i.prototype.redAdd=function(o){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,o)},i.prototype.redIAdd=function(o){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,o)},i.prototype.redSub=function(o){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,o)},i.prototype.redISub=function(o){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,o)},i.prototype.redShl=function(o){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,o)},i.prototype.redMul=function(o){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.mul(this,o)},i.prototype.redIMul=function(o){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.imul(this,o)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(o){return r(this.red&&!o.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,o)};var K={k256:null,p224:null,p192:null,p25519:null};function Y(h,o){this.name=h,this.p=new i(o,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}Y.prototype._tmp=function(){var o=new i(null);return o.words=new Array(Math.ceil(this.n/13)),o},Y.prototype.ireduce=function(o){var s=o,l;do this.split(s,this.tmp),s=this.imulK(s),s=s.iadd(this.tmp),l=s.bitLength();while(l>this.n);var d=l<this.n?-1:s.ucmp(this.p);return d===0?(s.words[0]=0,s.length=1):d>0?s.isub(this.p):s.strip!==void 0?s.strip():s._strip(),s},Y.prototype.split=function(o,s){o.iushrn(this.n,0,s)},Y.prototype.imulK=function(o){return o.imul(this.k)};function ee(){Y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}n(ee,Y),ee.prototype.split=function(o,s){for(var l=4194303,d=Math.min(o.length,9),u=0;u<d;u++)s.words[u]=o.words[u];if(s.length=d,o.length<=9){o.words[0]=0,o.length=1;return}var v=o.words[9];for(s.words[s.length++]=v&l,u=10;u<o.length;u++){var b=o.words[u]|0;o.words[u-10]=(b&l)<<4|v>>>22,v=b}v>>>=22,o.words[u-10]=v,v===0&&o.length>10?o.length-=10:o.length-=9},ee.prototype.imulK=function(o){o.words[o.length]=0,o.words[o.length+1]=0,o.length+=2;for(var s=0,l=0;l<o.length;l++){var d=o.words[l]|0;s+=d*977,o.words[l]=s&67108863,s=d*64+(s/67108864|0)}return o.words[o.length-1]===0&&(o.length--,o.words[o.length-1]===0&&o.length--),o};function ze(){Y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}n(ze,Y);function Ze(){Y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}n(Ze,Y);function ie(){Y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}n(ie,Y),ie.prototype.imulK=function(o){for(var s=0,l=0;l<o.length;l++){var d=(o.words[l]|0)*19+s,u=d&67108863;d>>>=26,o.words[l]=u,s=d}return s!==0&&(o.words[o.length++]=s),o},i._prime=function(o){if(K[o])return K[o];var s;if(o==="k256")s=new ee;else if(o==="p224")s=new ze;else if(o==="p192")s=new Ze;else if(o==="p25519")s=new ie;else throw new Error("Unknown prime "+o);return K[o]=s,s};function F(h){if(typeof h=="string"){var o=i._prime(h);this.m=o.p,this.prime=o}else r(h.gtn(1),"modulus must be greater than 1"),this.m=h,this.prime=null}F.prototype._verify1=function(o){r(o.negative===0,"red works only with positives"),r(o.red,"red works only with red numbers")},F.prototype._verify2=function(o,s){r((o.negative|s.negative)===0,"red works only with positives"),r(o.red&&o.red===s.red,"red works only with red numbers")},F.prototype.imod=function(o){return this.prime?this.prime.ireduce(o)._forceRed(this):(w(o,o.umod(this.m)._forceRed(this)),o)},F.prototype.neg=function(o){return o.isZero()?o.clone():this.m.sub(o)._forceRed(this)},F.prototype.add=function(o,s){this._verify2(o,s);var l=o.add(s);return l.cmp(this.m)>=0&&l.isub(this.m),l._forceRed(this)},F.prototype.iadd=function(o,s){this._verify2(o,s);var l=o.iadd(s);return l.cmp(this.m)>=0&&l.isub(this.m),l},F.prototype.sub=function(o,s){this._verify2(o,s);var l=o.sub(s);return l.cmpn(0)<0&&l.iadd(this.m),l._forceRed(this)},F.prototype.isub=function(o,s){this._verify2(o,s);var l=o.isub(s);return l.cmpn(0)<0&&l.iadd(this.m),l},F.prototype.shl=function(o,s){return this._verify1(o),this.imod(o.ushln(s))},F.prototype.imul=function(o,s){return this._verify2(o,s),this.imod(o.imul(s))},F.prototype.mul=function(o,s){return this._verify2(o,s),this.imod(o.mul(s))},F.prototype.isqr=function(o){return this.imul(o,o.clone())},F.prototype.sqr=function(o){return this.mul(o,o)},F.prototype.sqrt=function(o){if(o.isZero())return o.clone();var s=this.m.andln(3);if(r(s%2===1),s===3){var l=this.m.add(new i(1)).iushrn(2);return this.pow(o,l)}for(var d=this.m.subn(1),u=0;!d.isZero()&&d.andln(1)===0;)u++,d.iushrn(1);r(!d.isZero());var v=new i(1).toRed(this),b=v.redNeg(),p=this.m.subn(1).iushrn(1),a=this.m.bitLength();for(a=new i(2*a*a).toRed(this);this.pow(a,p).cmp(b)!==0;)a.redIAdd(b);for(var m=this.pow(a,d),k=this.pow(o,d.addn(1).iushrn(1)),R=this.pow(o,d),N=u;R.cmp(v)!==0;){for(var H=R,x=0;H.cmp(v)!==0;x++)H=H.redSqr();r(x<N);var C=this.pow(m,new i(1).iushln(N-x-1));k=k.redMul(C),m=C.redSqr(),R=R.redMul(m),N=x}return k},F.prototype.invm=function(o){var s=o._invmp(this.m);return s.negative!==0?(s.negative=0,this.imod(s).redNeg()):this.imod(s)},F.prototype.pow=function(o,s){if(s.isZero())return new i(1).toRed(this);if(s.cmpn(1)===0)return o.clone();var l=4,d=new Array(1<<l);d[0]=new i(1).toRed(this),d[1]=o;for(var u=2;u<d.length;u++)d[u]=this.mul(d[u-1],o);var v=d[0],b=0,p=0,a=s.bitLength()%26;for(a===0&&(a=26),u=s.length-1;u>=0;u--){for(var m=s.words[u],k=a-1;k>=0;k--){var R=m>>k&1;if(v!==d[0]&&(v=this.sqr(v)),R===0&&b===0){p=0;continue}b<<=1,b|=R,p++,!(p!==l&&(u!==0||k!==0))&&(v=this.mul(v,d[b]),p=0,b=0)}a=26}return v},F.prototype.convertTo=function(o){var s=o.umod(this.m);return s===o?s.clone():s},F.prototype.convertFrom=function(o){var s=o.clone();return s.red=null,s},i.mont=function(o){return new z(o)};function z(h){F.call(this,h),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}n(z,F),z.prototype.convertTo=function(o){return this.imod(o.ushln(this.shift))},z.prototype.convertFrom=function(o){var s=this.imod(o.mul(this.rinv));return s.red=null,s},z.prototype.imul=function(o,s){if(o.isZero()||s.isZero())return o.words[0]=0,o.length=1,o;var l=o.imul(s),d=l.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),u=l.isub(d).iushrn(this.shift),v=u;return u.cmp(this.m)>=0?v=u.isub(this.m):u.cmpn(0)<0&&(v=u.iadd(this.m)),v._forceRed(this)},z.prototype.mul=function(o,s){if(o.isZero()||s.isZero())return new i(0)._forceRed(this);var l=o.mul(s),d=l.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),u=l.isub(d).iushrn(this.shift),v=u;return u.cmp(this.m)>=0?v=u.isub(this.m):u.cmpn(0)<0&&(v=u.iadd(this.m)),v._forceRed(this)},z.prototype.invm=function(o){var s=this.imod(o._invmp(this.m).mul(this.r2));return s._forceRed(this)}})(typeof Ui>"u"||Ui,il)});var gn=kt((Jg,mn)=>{var Ll,kl,Rl,Wl,Il,Nl,Ol,Dl,Ul,pn,Ki,Bl,Fl,Gl,qr,Hl,Vl,ql,$l,zl,Zl,jl,Kl,Jl,hn;(function(e){var t=typeof global=="object"?global:typeof self=="object"?self:typeof this=="object"?this:{};typeof define=="function"&&define.amd?define("tslib",["exports"],function(n){e(r(t,r(n)))}):typeof mn=="object"&&typeof mn.exports=="object"?e(r(t,r(mn.exports))):e(r(t));function r(n,i){return n!==t&&(typeof Object.create=="function"?Object.defineProperty(n,"__esModule",{value:!0}):n.__esModule=!0),function(c,f){return n[c]=i?i(c,f):f}}})(function(e){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var c in i)Object.prototype.hasOwnProperty.call(i,c)&&(n[c]=i[c])};Ll=function(n,i){if(typeof i!="function"&&i!==null)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");t(n,i);function c(){this.constructor=n}n.prototype=i===null?Object.create(i):(c.prototype=i.prototype,new c)},kl=Object.assign||function(n){for(var i,c=1,f=arguments.length;c<f;c++){i=arguments[c];for(var g in i)Object.prototype.hasOwnProperty.call(i,g)&&(n[g]=i[g])}return n},Rl=function(n,i){var c={};for(var f in n)Object.prototype.hasOwnProperty.call(n,f)&&i.indexOf(f)<0&&(c[f]=n[f]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var g=0,f=Object.getOwnPropertySymbols(n);g<f.length;g++)i.indexOf(f[g])<0&&Object.prototype.propertyIsEnumerable.call(n,f[g])&&(c[f[g]]=n[f[g]]);return c},Wl=function(n,i,c,f){var g=arguments.length,y=g<3?i:f===null?f=Object.getOwnPropertyDescriptor(i,c):f,w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(n,i,c,f);else for(var A=n.length-1;A>=0;A--)(w=n[A])&&(y=(g<3?w(y):g>3?w(i,c,y):w(i,c))||y);return g>3&&y&&Object.defineProperty(i,c,y),y},Il=function(n,i){return function(c,f){i(c,f,n)}},Nl=function(n,i){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,i)},Ol=function(n,i,c,f){function g(y){return y instanceof c?y:new c(function(w){w(y)})}return new(c||(c=Promise))(function(y,w){function A(T){try{_(f.next(T))}catch(M){w(M)}}function P(T){try{_(f.throw(T))}catch(M){w(M)}}function _(T){T.done?y(T.value):g(T.value).then(A,P)}_((f=f.apply(n,i||[])).next())})},Dl=function(n,i){var c={label:0,sent:function(){if(y[0]&1)throw y[1];return y[1]},trys:[],ops:[]},f,g,y,w;return w={next:A(0),throw:A(1),return:A(2)},typeof Symbol=="function"&&(w[Symbol.iterator]=function(){return this}),w;function A(_){return function(T){return P([_,T])}}function P(_){if(f)throw new TypeError("Generator is already executing.");for(;c;)try{if(f=1,g&&(y=_[0]&2?g.return:_[0]?g.throw||((y=g.return)&&y.call(g),0):g.next)&&!(y=y.call(g,_[1])).done)return y;switch(g=0,y&&(_=[_[0]&2,y.value]),_[0]){case 0:case 1:y=_;break;case 4:return c.label++,{value:_[1],done:!1};case 5:c.label++,g=_[1],_=[0];continue;case 7:_=c.ops.pop(),c.trys.pop();continue;default:if(y=c.trys,!(y=y.length>0&&y[y.length-1])&&(_[0]===6||_[0]===2)){c=0;continue}if(_[0]===3&&(!y||_[1]>y[0]&&_[1]<y[3])){c.label=_[1];break}if(_[0]===6&&c.label<y[1]){c.label=y[1],y=_;break}if(y&&c.label<y[2]){c.label=y[2],c.ops.push(_);break}y[2]&&c.ops.pop(),c.trys.pop();continue}_=i.call(n,c)}catch(T){_=[6,T],g=0}finally{f=y=0}if(_[0]&5)throw _[1];return{value:_[0]?_[1]:void 0,done:!0}}},Ul=function(n,i){for(var c in n)c!=="default"&&!Object.prototype.hasOwnProperty.call(i,c)&&hn(i,n,c)},hn=Object.create?function(n,i,c,f){f===void 0&&(f=c);var g=Object.getOwnPropertyDescriptor(i,c);(!g||("get"in g?!i.__esModule:g.writable||g.configurable))&&(g={enumerable:!0,get:function(){return i[c]}}),Object.defineProperty(n,f,g)}:function(n,i,c,f){f===void 0&&(f=c),n[f]=i[c]},pn=function(n){var i=typeof Symbol=="function"&&Symbol.iterator,c=i&&n[i],f=0;if(c)return c.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&f>=n.length&&(n=void 0),{value:n&&n[f++],done:!n}}};throw new TypeError(i?"Object is not iterable.":"Symbol.iterator is not defined.")},Ki=function(n,i){var c=typeof Symbol=="function"&&n[Symbol.iterator];if(!c)return n;var f=c.call(n),g,y=[],w;try{for(;(i===void 0||i-- >0)&&!(g=f.next()).done;)y.push(g.value)}catch(A){w={error:A}}finally{try{g&&!g.done&&(c=f.return)&&c.call(f)}finally{if(w)throw w.error}}return y},Bl=function(){for(var n=[],i=0;i<arguments.length;i++)n=n.concat(Ki(arguments[i]));return n},Fl=function(){for(var n=0,i=0,c=arguments.length;i<c;i++)n+=arguments[i].length;for(var f=Array(n),g=0,i=0;i<c;i++)for(var y=arguments[i],w=0,A=y.length;w<A;w++,g++)f[g]=y[w];return f},Gl=function(n,i,c){if(c||arguments.length===2)for(var f=0,g=i.length,y;f<g;f++)(y||!(f in i))&&(y||(y=Array.prototype.slice.call(i,0,f)),y[f]=i[f]);return n.concat(y||Array.prototype.slice.call(i))},qr=function(n){return this instanceof qr?(this.v=n,this):new qr(n)},Hl=function(n,i,c){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var f=c.apply(n,i||[]),g,y=[];return g={},w("next"),w("throw"),w("return"),g[Symbol.asyncIterator]=function(){return this},g;function w(E){f[E]&&(g[E]=function(S){return new Promise(function(L,G){y.push([E,S,L,G])>1||A(E,S)})})}function A(E,S){try{P(f[E](S))}catch(L){M(y[0][3],L)}}function P(E){E.value instanceof qr?Promise.resolve(E.value.v).then(_,T):M(y[0][2],E)}function _(E){A("next",E)}function T(E){A("throw",E)}function M(E,S){E(S),y.shift(),y.length&&A(y[0][0],y[0][1])}},Vl=function(n){var i,c;return i={},f("next"),f("throw",function(g){throw g}),f("return"),i[Symbol.iterator]=function(){return this},i;function f(g,y){i[g]=n[g]?function(w){return(c=!c)?{value:qr(n[g](w)),done:g==="return"}:y?y(w):w}:y}},ql=function(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=n[Symbol.asyncIterator],c;return i?i.call(n):(n=typeof pn=="function"?pn(n):n[Symbol.iterator](),c={},f("next"),f("throw"),f("return"),c[Symbol.asyncIterator]=function(){return this},c);function f(y){c[y]=n[y]&&function(w){return new Promise(function(A,P){w=n[y](w),g(A,P,w.done,w.value)})}}function g(y,w,A,P){Promise.resolve(P).then(function(_){y({value:_,done:A})},w)}},$l=function(n,i){return Object.defineProperty?Object.defineProperty(n,"raw",{value:i}):n.raw=i,n};var r=Object.create?function(n,i){Object.defineProperty(n,"default",{enumerable:!0,value:i})}:function(n,i){n.default=i};zl=function(n){if(n&&n.__esModule)return n;var i={};if(n!=null)for(var c in n)c!=="default"&&Object.prototype.hasOwnProperty.call(n,c)&&hn(i,n,c);return r(i,n),i},Zl=function(n){return n&&n.__esModule?n:{default:n}},jl=function(n,i,c,f){if(c==="a"&&!f)throw new TypeError("Private accessor was defined without a getter");if(typeof i=="function"?n!==i||!f:!i.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return c==="m"?f:c==="a"?f.call(n):f?f.value:i.get(n)},Kl=function(n,i,c,f,g){if(f==="m")throw new TypeError("Private method is not writable");if(f==="a"&&!g)throw new TypeError("Private accessor was defined without a setter");if(typeof i=="function"?n!==i||!g:!i.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return f==="a"?g.call(n,c):g?g.value=c:i.set(n,c),c},Jl=function(n,i){if(i===null||typeof i!="object"&&typeof i!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof n=="function"?i===n:n.has(i)},e("__extends",Ll),e("__assign",kl),e("__rest",Rl),e("__decorate",Wl),e("__param",Il),e("__metadata",Nl),e("__awaiter",Ol),e("__generator",Dl),e("__exportStar",Ul),e("__createBinding",hn),e("__values",pn),e("__read",Ki),e("__spread",Bl),e("__spreadArrays",Fl),e("__spreadArray",Gl),e("__await",qr),e("__asyncGenerator",Hl),e("__asyncDelegator",Vl),e("__asyncValues",ql),e("__makeTemplateObject",$l),e("__importStar",zl),e("__importDefault",Zl),e("__classPrivateFieldGet",jl),e("__classPrivateFieldSet",Kl),e("__classPrivateFieldIn",Jl)})});var Ji=kt(ae=>{"use strict";Object.defineProperty(ae,"__esModule",{value:!0});ae.getLocalStorage=ae.getLocalStorageOrThrow=ae.getCrypto=ae.getCryptoOrThrow=ae.getLocation=ae.getLocationOrThrow=ae.getNavigator=ae.getNavigatorOrThrow=ae.getDocument=ae.getDocumentOrThrow=ae.getFromWindowOrThrow=ae.getFromWindow=void 0;function br(e){let t;return typeof window<"u"&&typeof window[e]<"u"&&(t=window[e]),t}ae.getFromWindow=br;function $r(e){let t=br(e);if(!t)throw new Error(`${e} is not defined in Window`);return t}ae.getFromWindowOrThrow=$r;function v0(){return $r("document")}ae.getDocumentOrThrow=v0;function y0(){return br("document")}ae.getDocument=y0;function b0(){return $r("navigator")}ae.getNavigatorOrThrow=b0;function w0(){return br("navigator")}ae.getNavigator=w0;function C0(){return $r("location")}ae.getLocationOrThrow=C0;function x0(){return br("location")}ae.getLocation=x0;function E0(){return $r("crypto")}ae.getCryptoOrThrow=E0;function _0(){return br("crypto")}ae.getCrypto=_0;function P0(){return $r("localStorage")}ae.getLocalStorageOrThrow=P0;function A0(){return br("localStorage")}ae.getLocalStorage=A0});var Ql=kt(vn=>{"use strict";Object.defineProperty(vn,"__esModule",{value:!0});vn.getWindowMetadata=void 0;var Yl=Ji();function S0(){let e,t;try{e=Yl.getDocumentOrThrow(),t=Yl.getLocationOrThrow()}catch{return null}function r(){let P=e.getElementsByTagName("link"),_=[];for(let T=0;T<P.length;T++){let M=P[T],E=M.getAttribute("rel");if(E&&E.toLowerCase().indexOf("icon")>-1){let S=M.getAttribute("href");if(S)if(S.toLowerCase().indexOf("https:")===-1&&S.toLowerCase().indexOf("http:")===-1&&S.indexOf("//")!==0){let L=t.protocol+"//"+t.host;if(S.indexOf("/")===0)L+=S;else{let G=t.pathname.split("/");G.pop(),L+=G.join("/")+"/"+S}_.push(L)}else if(S.indexOf("//")===0){let L=t.protocol+S;_.push(L)}else _.push(S)}}return _}function n(...P){let _=e.getElementsByTagName("meta");for(let T=0;T<_.length;T++){let M=_[T],E=["itemprop","property","name"].map(S=>M.getAttribute(S)).filter(S=>S?P.includes(S):!1);if(E.length&&E){let S=M.getAttribute("content");if(S)return S}}return""}function i(){let P=n("name","og:site_name","og:title","twitter:title");return P||(P=e.title),P}function c(){return n("description","og:description","twitter:description","keywords")}let f=i(),g=c(),y=t.origin,w=r();return{description:g,url:y,icons:w,name:f}}vn.getWindowMetadata=S0});var cc={};Ps(cc,{BotInfo:()=>nc,BrowserInfo:()=>tc,NodeInfo:()=>rc,ReactNativeInfo:()=>ic,SearchBotDeviceInfo:()=>oc,browserName:()=>W0,detect:()=>R0,detectOS:()=>sc,getNodeVersion:()=>lc,parseUserAgent:()=>Yi});function R0(e){return e?Yi(e):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new ic:typeof navigator<"u"?Yi(navigator.userAgent):lc()}function ac(e){return e!==""&&k0.reduce(function(t,r){var n=r[0],i=r[1];if(t)return t;var c=i.exec(e);return!!c&&[n,c]},!1)}function W0(e){var t=ac(e);return t?t[0]:null}function Yi(e){var t=ac(e);if(!t)return null;var r=t[0],n=t[1];if(r==="searchbot")return new nc;var i=n[1]&&n[1].split(/[._]/).slice(0,3);i?i.length<Xl&&(i=T0(i,I0(Xl-i.length))):i=[];var c=i.join("."),f=sc(e),g=L0.exec(e);return g&&g[1]?new oc(r,c,f,g[1]):new tc(r,c,f)}function sc(e){for(var t=0,r=ec.length;t<r;t++){var n=ec[t],i=n[0],c=n[1],f=c.exec(e);if(f)return i}return null}function lc(){var e=typeof process<"u"&&process.version;return e?new rc(process.version.slice(1)):null}function I0(e){for(var t=[],r=0;r<e;r++)t.push("0");return t}var T0,tc,rc,oc,nc,ic,M0,L0,Xl,k0,ec,dc=_s(()=>{T0=function(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;for(var n=Array(e),i=0,t=0;t<r;t++)for(var c=arguments[t],f=0,g=c.length;f<g;f++,i++)n[i]=c[f];return n},tc=function(){function e(t,r,n){this.name=t,this.version=r,this.os=n,this.type="browser"}return e}(),rc=function(){function e(t){this.version=t,this.type="node",this.name="node",this.os=process.platform}return e}(),oc=function(){function e(t,r,n,i){this.name=t,this.version=r,this.os=n,this.bot=i,this.type="bot-device"}return e}(),nc=function(){function e(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return e}(),ic=function(){function e(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return e}(),M0=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,L0=/(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,Xl=3,k0=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/EdgA?\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FBAV\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["searchbot",M0]],ec=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]]});var Xi=kt(j=>{"use strict";Object.defineProperty(j,"__esModule",{value:!0});j.getClientMeta=j.getLocalStorage=j.getLocalStorageOrThrow=j.getCrypto=j.getCryptoOrThrow=j.getLocation=j.getLocationOrThrow=j.getNavigator=j.getNavigatorOrThrow=j.getDocument=j.getDocumentOrThrow=j.getFromWindowOrThrow=j.getFromWindow=j.isBrowser=j.isNode=j.isMobile=j.isIOS=j.isAndroid=j.detectOS=j.detectEnv=void 0;var uc=gn(),N0=uc.__importStar(Ql()),Pt=uc.__importStar(Ji()),O0=(dc(),Ts(cc));function Qi(e){return(0,O0.detect)(e)}j.detectEnv=Qi;function yn(){let e=Qi();return e&&e.os?e.os:void 0}j.detectOS=yn;function fc(){let e=yn();return e?e.toLowerCase().includes("android"):!1}j.isAndroid=fc;function pc(){let e=yn();return e?e.toLowerCase().includes("ios")||e.toLowerCase().includes("mac")&&navigator.maxTouchPoints>1:!1}j.isIOS=pc;function D0(){return yn()?fc()||pc():!1}j.isMobile=D0;function hc(){let e=Qi();return e&&e.name?e.name.toLowerCase()==="node":!1}j.isNode=hc;function U0(){return!hc()&&!!(0,j.getNavigator)()}j.isBrowser=U0;j.getFromWindow=Pt.getFromWindow;j.getFromWindowOrThrow=Pt.getFromWindowOrThrow;j.getDocumentOrThrow=Pt.getDocumentOrThrow;j.getDocument=Pt.getDocument;j.getNavigatorOrThrow=Pt.getNavigatorOrThrow;j.getNavigator=Pt.getNavigator;j.getLocationOrThrow=Pt.getLocationOrThrow;j.getLocation=Pt.getLocation;j.getCryptoOrThrow=Pt.getCryptoOrThrow;j.getCrypto=Pt.getCrypto;j.getLocalStorageOrThrow=Pt.getLocalStorageOrThrow;j.getLocalStorage=Pt.getLocalStorage;function B0(){return N0.getWindowMetadata()}j.getClientMeta=B0});var mc={};Ps(mc,{safeJsonParse:()=>F0,safeJsonStringify:()=>G0});function F0(e){if(typeof e!="string")throw new Error(`Cannot safe json parse value of type ${typeof e}`);try{return JSON.parse(e)}catch{return e}}function G0(e){return typeof e=="string"?e:JSON.stringify(e)}var gc=_s(()=>{});var ea=kt(zr=>{"use strict";Object.defineProperty(zr,"__esModule",{value:!0});zr.safeJsonStringify=zr.safeJsonParse=void 0;var H0=gn(),vc=H0.__importStar((gc(),Ts(mc)));zr.safeJsonParse=vc.safeJsonParse;zr.safeJsonStringify=vc.safeJsonStringify});var ra=kt(ir=>{"use strict";Object.defineProperty(ir,"__esModule",{value:!0});ir.removeLocal=ir.getLocal=ir.setLocal=void 0;var yc=ea(),ta=Xi();function V0(e,t){let r=(0,yc.safeJsonStringify)(t),n=(0,ta.getLocalStorage)();n&&n.setItem(e,r)}ir.setLocal=V0;function q0(e){let t=null,r=null,n=(0,ta.getLocalStorage)();return n&&(r=n.getItem(e)),t=r&&(0,yc.safeJsonParse)(r),t}ir.getLocal=q0;function $0(e){let t=(0,ta.getLocalStorage)();t&&t.removeItem(e)}ir.removeLocal=$0});var wc=kt(pt=>{"use strict";Object.defineProperty(pt,"__esModule",{value:!0});pt.getMobileLinkRegistry=pt.getMobileRegistryEntry=pt.saveMobileLinkInfo=pt.formatIOSMobile=pt.mobileLinkChoiceKey=void 0;var z0=ra();pt.mobileLinkChoiceKey="WALLETCONNECT_DEEPLINK_CHOICE";function Z0(e,t){let r=encodeURIComponent(e);return t.universalLink?`${t.universalLink}/wc?uri=${r}`:t.deepLink?`${t.deepLink}${t.deepLink.endsWith(":")?"//":"/"}wc?uri=${r}`:""}pt.formatIOSMobile=Z0;function j0(e){let t=e.href.split("?")[0];(0,z0.setLocal)(pt.mobileLinkChoiceKey,Object.assign(Object.assign({},e),{href:t}))}pt.saveMobileLinkInfo=j0;function bc(e,t){return e.filter(r=>r.name.toLowerCase().includes(t.toLowerCase()))[0]}pt.getMobileRegistryEntry=bc;function K0(e,t){let r=e;return t&&(r=t.map(n=>bc(e,n)).filter(Boolean)),r}pt.getMobileLinkRegistry=K0});var Ec=kt(It=>{"use strict";Object.defineProperty(It,"__esModule",{value:!0});It.formatMobileRegistry=It.formatMobileRegistryEntry=It.getDappRegistryUrl=It.getWalletRegistryUrl=void 0;var Cc="https://registry.walletconnect.com";function J0(){return Cc+"/api/v2/wallets"}It.getWalletRegistryUrl=J0;function Y0(){return Cc+"/api/v2/dapps"}It.getDappRegistryUrl=Y0;function xc(e,t="mobile"){var r;return{name:e.name||"",shortName:e.metadata.shortName||"",color:e.metadata.colors.primary||"",logo:(r=e.image_url.sm)!==null&&r!==void 0?r:"",universalLink:e[t].universal||"",deepLink:e[t].native||""}}It.formatMobileRegistryEntry=xc;function Q0(e,t="mobile"){return Object.values(e).filter(r=>!!r[t].universal||!!r[t].native).map(r=>xc(r,t))}It.formatMobileRegistry=Q0});var _c=kt(wr=>{"use strict";Object.defineProperty(wr,"__esModule",{value:!0});var Co=gn();Co.__exportStar(Xi(),wr);Co.__exportStar(ea(),wr);Co.__exportStar(ra(),wr);Co.__exportStar(wc(),wr);Co.__exportStar(Ec(),wr)});import{Web3Provider as F2}from"@ethersproject/providers";import{useEffect as pi,useState as rt}from"react";var O=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};import Ou from"axios";var St=class extends Error{constructor(r,n,i){super(r);n instanceof Error&&(this.cause=n),this.privyErrorCode=i}toString(){return`${this.type}${this.privyErrorCode?`-${this.privyErrorCode}`:""}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}},Nr=class extends St{constructor(r,n,i,c,f){super(i,c,f);this.type=r;this.status=n}},D=class extends St{constructor(r,n,i){super(r,n,i);this.type="client_error"}};var de=class extends St{constructor(r,n,i){super(r,n,i);this.type="connector_error"}},je=e=>{if(e instanceof St)return e;if(!Ou.isAxiosError(e))return yt(e);if(!e.response)return new Nr("api_error",null,e.message,e);let{type:t,message:r,error:n,code:i}=e.response.data;return new Nr(t||"ApiError",e.response.status,r||n,e,i)},yt=e=>e instanceof St?e:e instanceof Error?new D(e.message,e):new D(`Internal error: ${e}`);var Ms=()=>"/api/v1/sessions",Ls=()=>"/api/v1/sessions/logout",ks=()=>"/api/v1/sessions/fork",Rs=()=>"/api/v1/sessions/fork/recover",Ws=()=>"/api/v1/siwe/init",Is=()=>"/api/v1/siwe/authenticate",Ns=()=>"/api/v1/siwe/link",Os=()=>"/api/v1/passwordless/init",Ds=()=>"/api/v1/passwordless/authenticate",Us=()=>"/api/v1/passwordless/link",Bs=()=>"/api/v1/passwordless_sms/init",Fs=()=>"/api/v1/passwordless_sms/authenticate",Gs=()=>"/api/v1/passwordless_sms/link",Hs=()=>"/api/v1/oauth/init",Vs=()=>"/api/v1/oauth/authenticate",qs=()=>"/api/v1/oauth/link",$s=()=>"/api/v1/siwe/unlink",zs=()=>"/api/v1/passwordless/unlink",Zs=()=>"/api/v1/passwordless_sms/unlink",js=()=>"/api/v1/oauth/unlink",Ks=()=>"/api/v1/analytics_events";var pr=class{constructor(t){this.meta={email:t}}async authenticate(){if(!this.api)throw new D("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new D("Email and email code must be set prior to calling authenticate.");try{let t=Ds(),r=await this.api.post(t,{email:this.meta.email,code:this.meta.emailCode});return{user:r.data.user,token:r.data.token,refresh_token:r.data.refresh_token,is_new_user:r.data.is_new_user}}catch(t){throw je(t)}}async link(){if(!this.api)throw new D("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new D("Email and email code must be set prior to calling authenticate.");try{let t=Us();return(await this.api.post(t,{email:this.meta.email,code:this.meta.emailCode})).data}catch(t){throw je(t)}}async sendCodeEmail(t){if(!this.api)throw new D("Auth flow has no API instance");if(t&&(this.meta.email=t),!this.meta.email)throw new D("Email must be set when initialzing authentication.");try{let r=Os();return(await this.api.post(r,{email:this.meta.email})).data}catch(r){throw je(r)}}};var tr=class{constructor(t,r,n){this.meta={provider:t},this.meta.authorizationCode=r,this.meta.stateCode=n}isActive(){return!!(this.meta.authorizationCode&&this.meta.stateCode&&this.meta.provider)}async authenticate(){if(!this.api)throw new D("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new D("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new D("User denied confirmation during OAuth flow");try{let t=Vs(),r=await this.api.post(t,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode});return{user:r.data.user,token:r.data.token,refresh_token:r.data.refresh_token,is_new_user:r.data.is_new_user}}catch(t){throw je(t)}}async link(){if(!this.api)throw new D("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new D("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new D("User denied confirmation during OAuth flow");try{let t=qs();return(await this.api.post(t,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode})).data}catch(t){throw je(t)}}async getAuthorizationUrl(){var t;if(!this.api)throw new D("Auth flow has no API instance");if(!this.meta.provider)throw new D("Provider must be set when initialzing OAuth authentication.");try{let r=Hs();return(await this.api.post(r,{provider:this.meta.provider,redirect_to:window.location.href},{baseURL:(t=this.api)==null?void 0:t.fallbackApiUrl})).data}catch(r){throw je(r)}}};var rr=class{constructor(t,r,n){this._meta={walletType:r,walletId:n},this.connectors=t,this.walletConnector=this.connectors.createWalletConnector(r,null,n)}get meta(){return{...this._meta,walletName:this.walletConnector.walletBranding.name,walletIcon:this.walletConnector.walletBranding.icon}}async authenticate(){if(!this.api)throw new D("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign(),n=await this.api.post(Is(),{message:t,signature:r});return this.connectors.addWalletConnector(this.walletConnector),await this.connectors.setActiveWallet(this.walletConnector.address)||console.warn("Failed to set active wallet"),{user:n.data.user,token:n.data.token,refresh_token:n.data.refresh_token,is_new_user:n.data.is_new_user}}catch(t){throw je(t)}}async link(){if(!this.api)throw new D("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign(),n=await this.api.post(Ns(),{message:t,signature:r});return this.connectors.addWalletConnector(this.walletConnector),await this.connectors.setActiveWallet(this.walletConnector.address)||console.warn("Failed to set active wallet"),n.data}catch(t){throw je(t)}}async promptConnect(){if(!this.api)throw new D("Auth flow has no API instance");let t=await this.walletConnector.connect({showPrompt:!0});return await this.buildSiweMessage(t),t}async sign(){if(!this.api)throw new D("Auth flow has no API instance");if(!this.preparedMessage){let r=await this.walletConnector.connect({showPrompt:!1});await this.buildSiweMessage(r)}if(!this.preparedMessage)throw new D("Could not prepare SIWE message");let t=await this.walletConnector.sign(this.preparedMessage);return{message:this.preparedMessage,signature:t}}async buildSiweMessage(t){if(!this.api)throw new D("Auth flow has no API instance");let r=t.address,n=t.chainId,i=await this.api.post(Ws(),{address:r});return this.preparedMessage=this.walletConnector.prepareMessage(n,r,i.data.nonce),this.preparedMessage}};var hr=class{constructor(t){this.meta={phoneNumber:t}}async authenticate(){if(!this.api)throw new D("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new D("phone number and sms code must be set prior to calling authenticate.");try{let t=Fs(),r=await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return{user:r.data.user,token:r.data.token,refresh_token:r.data.refresh_token,is_new_user:r.data.is_new_user}}catch(t){throw je(t)}}async link(){if(!this.api)throw new D("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new D("phone number and sms code must be set prior to calling authenticate.");try{let t=Gs();return(await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})).data}catch(t){throw je(t)}}async sendSmsCode(t){if(!this.api)throw new D("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),!this.meta.phoneNumber)throw new D("phone nNumber must be set when initialzing authentication.");try{let r=Bs();return(await this.api.post(r,{phoneNumber:this.meta.phoneNumber})).data}catch(r){throw je(r)}}};import{getAddress as ef}from"@ethersproject/address";var Js="1.24.0-beta.6";var Rt="4df5e2316331463a9130964bd6078dfa",Yo="https://auth.privy.io",Ys=1e4,bt=1400,Wi=Js;var Or="privy:token",Qo="privy:refresh_token",vo="privy:session_transfer_token",Xo="privy:connectors",Ii="walletconnect",Qs=3e4,wt=1;var Ni=class{constructor(){this._cache={}}get(t){return this._cache[t]}put(t,r){r!==void 0?this._cache[t]=r:this.del(t)}del(t){delete this._cache[t]}getKeys(){return Object.keys(this._cache)}},Oi=class{get(t){let r=localStorage.getItem(t);return r===null?void 0:JSON.parse(r)}put(t,r){r!==void 0?localStorage.setItem(t,JSON.stringify(r)):this.del(t)}del(t){localStorage.removeItem(t)}getKeys(){return Object.entries(localStorage).map(([t])=>t)}};function Uu(){return typeof window<"u"&&window.localStorage?new Oi:new Ni}var le=Uu();import i0 from"@coinbase/wallet-sdk";import{getAddress as a0}from"@ethersproject/address";import{jsx as Xs,jsxs as Bu}from"react/jsx-runtime";var Ct=({style:e,...t})=>Bu("svg",{width:"1024",height:"1024",viewBox:"0 0 1024 1024",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...e},...t,children:[Xs("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),Xs("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z",fill:"white"})]});import{getAddress as o0}from"@ethersproject/address";import{Web3Provider as n0}from"@ethersproject/providers";import{Logger as Fu}from"@ethersproject/logger";var el="bytes/5.7.0";var Dr=new Fu(el);function rl(e){return!!e.toHexString}function en(e){return e.slice||(e.slice=function(){let t=Array.prototype.slice.call(arguments);return en(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function tl(e){return typeof e=="number"&&e==e&&e%1===0}function tn(e){if(e==null)return!1;if(e.constructor===Uint8Array)return!0;if(typeof e=="string"||!tl(e.length)||e.length<0)return!1;for(let t=0;t<e.length;t++){let r=e[t];if(!tl(r)||r<0||r>=256)return!1}return!0}function ol(e,t){if(t||(t={}),typeof e=="number"){Dr.checkSafeUint53(e,"invalid arrayify value");let r=[];for(;e;)r.unshift(e&255),e=parseInt(String(e/256));return r.length===0&&r.push(0),en(new Uint8Array(r))}if(t.allowMissingPrefix&&typeof e=="string"&&e.substring(0,2)!=="0x"&&(e="0x"+e),rl(e)&&(e=e.toHexString()),qt(e)){let r=e.substring(2);r.length%2&&(t.hexPad==="left"?r="0"+r:t.hexPad==="right"?r+="0":Dr.throwArgumentError("hex data is odd-length","value",e));let n=[];for(let i=0;i<r.length;i+=2)n.push(parseInt(r.substring(i,i+2),16));return en(new Uint8Array(n))}return tn(e)?en(new Uint8Array(e)):Dr.throwArgumentError("invalid arrayify value","value",e)}function qt(e,t){return!(typeof e!="string"||!e.match(/^0x[0-9A-Fa-f]*$/)||t&&e.length!==2+2*t)}var Di="0123456789abcdef";function nl(e,t){if(t||(t={}),typeof e=="number"){Dr.checkSafeUint53(e,"invalid hexlify value");let r="";for(;e;)r=Di[e&15]+r,e=Math.floor(e/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"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),rl(e))return e.toHexString();if(qt(e))return e.length%2&&(t.hexPad==="left"?e="0x0"+e.substring(2):t.hexPad==="right"?e+="0":Dr.throwArgumentError("hex data is odd-length","value",e)),e.toLowerCase();if(tn(e)){let r="0x";for(let n=0;n<e.length;n++){let i=e[n];r+=Di[(i&240)>>4]+Di[i&15]}return r}return Dr.throwArgumentError("invalid hexlify value","value",e)}import{InfuraProvider as e0}from"@ethersproject/providers";var dl=Ss(al());import{Logger as Ur}from"@ethersproject/logger";var sl="bignumber/5.7.0";var Fi=dl.default.BN,$t=new Ur(sl),Bi={},ll=9007199254740991;var cl=!1,Ye=class{constructor(t,r){t!==Bi&&$t.throwError("cannot call constructor directly; use BigNumber.from",Ur.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=r,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return at(Q(this).fromTwos(t))}toTwos(t){return at(Q(this).toTwos(t))}abs(){return this._hex[0]==="-"?Ye.from(this._hex.substring(1)):this}add(t){return at(Q(this).add(Q(t)))}sub(t){return at(Q(this).sub(Q(t)))}div(t){return Ye.from(t).isZero()&&xt("division-by-zero","div"),at(Q(this).div(Q(t)))}mul(t){return at(Q(this).mul(Q(t)))}mod(t){let r=Q(t);return r.isNeg()&&xt("division-by-zero","mod"),at(Q(this).umod(r))}pow(t){let r=Q(t);return r.isNeg()&&xt("negative-power","pow"),at(Q(this).pow(r))}and(t){let r=Q(t);return(this.isNegative()||r.isNeg())&&xt("unbound-bitwise-result","and"),at(Q(this).and(r))}or(t){let r=Q(t);return(this.isNegative()||r.isNeg())&&xt("unbound-bitwise-result","or"),at(Q(this).or(r))}xor(t){let r=Q(t);return(this.isNegative()||r.isNeg())&&xt("unbound-bitwise-result","xor"),at(Q(this).xor(r))}mask(t){return(this.isNegative()||t<0)&&xt("negative-width","mask"),at(Q(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&xt("negative-width","shl"),at(Q(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&xt("negative-width","shr"),at(Q(this).shrn(t))}eq(t){return Q(this).eq(Q(t))}lt(t){return Q(this).lt(Q(t))}lte(t){return Q(this).lte(Q(t))}gt(t){return Q(this).gt(Q(t))}gte(t){return Q(this).gte(Q(t))}isNegative(){return this._hex[0]==="-"}isZero(){return Q(this).isZero()}toNumber(){try{return Q(this).toNumber()}catch{xt("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return $t.throwError("this platform does not support BigInt",Ur.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?cl||(cl=!0,$t.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?$t.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",Ur.errors.UNEXPECTED_ARGUMENT,{}):$t.throwError("BigNumber.toString does not accept parameters",Ur.errors.UNEXPECTED_ARGUMENT,{})),Q(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof Ye)return t;if(typeof t=="string")return t.match(/^-?0x[0-9a-f]+$/i)?new Ye(Bi,yo(t)):t.match(/^-?[0-9]+$/)?new Ye(Bi,yo(new Fi(t))):$t.throwArgumentError("invalid BigNumber string","value",t);if(typeof t=="number")return t%1&&xt("underflow","BigNumber.from",t),(t>=ll||t<=-ll)&&xt("overflow","BigNumber.from",t),Ye.from(String(t));let r=t;if(typeof r=="bigint")return Ye.from(r.toString());if(tn(r))return Ye.from(nl(r));if(r)if(r.toHexString){let n=r.toHexString();if(typeof n=="string")return Ye.from(n)}else{let n=r._hex;if(n==null&&r.type==="BigNumber"&&(n=r.hex),typeof n=="string"&&(qt(n)||n[0]==="-"&&qt(n.substring(1))))return Ye.from(n)}return $t.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!!(t&&t._isBigNumber)}};function yo(e){if(typeof e!="string")return yo(e.toString(16));if(e[0]==="-")return e=e.substring(1),e[0]==="-"&&$t.throwArgumentError("invalid hex","value",e),e=yo(e),e==="0x00"?e:"-"+e;if(e.substring(0,2)!=="0x"&&(e="0x"+e),e==="0x")return"0x00";for(e.length%2&&(e="0x0"+e.substring(2));e.length>4&&e.substring(0,4)==="0x00";)e="0x"+e.substring(4);return e}function at(e){return Ye.from(yo(e))}function Q(e){let t=Ye.from(e).toHexString();return t[0]==="-"?new Fi("-"+t.substring(3),16):new Fi(t.substring(2),16)}function xt(e,t,r){let n={fault:e,operation:t};return r!=null&&(n.value=r),$t.throwError(e,Ur.errors.NUMERIC_FAULT,n)}import{Logger as Gu}from"@ethersproject/logger";var ul="strings/5.7.0";var Hu=new Gu(ul),Gi;(function(e){e.current="",e.NFC="NFC",e.NFD="NFD",e.NFKC="NFKC",e.NFKD="NFKD"})(Gi||(Gi={}));var st;(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"})(st||(st={}));function Vu(e,t,r,n,i){return Hu.throwArgumentError(`invalid codepoint at offset ${t}; ${e}`,"bytes",r)}function fl(e,t,r,n,i){if(e===st.BAD_PREFIX||e===st.UNEXPECTED_CONTINUE){let c=0;for(let f=t+1;f<r.length&&r[f]>>6===2;f++)c++;return c}return e===st.OVERRUN?r.length-t-1:0}function qu(e,t,r,n,i){return e===st.OVERLONG?(n.push(i),0):(n.push(65533),fl(e,t,r,n,i))}var pl=Object.freeze({error:Vu,ignore:fl,replace:qu});function $u(e,t){t==null&&(t=pl.error),e=ol(e);let r=[],n=0;for(;n<e.length;){let i=e[n++];if(i>>7===0){r.push(i);continue}let c=null,f=null;if((i&224)===192)c=1,f=127;else if((i&240)===224)c=2,f=2047;else if((i&248)===240)c=3,f=65535;else{(i&192)===128?n+=t(st.UNEXPECTED_CONTINUE,n-1,e,r):n+=t(st.BAD_PREFIX,n-1,e,r);continue}if(n-1+c>=e.length){n+=t(st.OVERRUN,n-1,e,r);continue}let g=i&(1<<8-c-1)-1;for(let y=0;y<c;y++){let w=e[n];if((w&192)!=128){n+=t(st.MISSING_CONTINUE,n,e,r),g=null;break}g=g<<6|w&63,n++}if(g!==null){if(g>1114111){n+=t(st.OUT_OF_RANGE,n-1-c,e,r,g);continue}if(g>=55296&&g<=57343){n+=t(st.UTF16_SURROGATE,n-1-c,e,r,g);continue}if(g<=f){n+=t(st.OVERLONG,n-1-c,e,r,g);continue}r.push(g)}}return r}function zu(e){return e.map(t=>t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10&1023)+55296,(t&1023)+56320))).join("")}function Hi(e,t){return zu($u(e,t))}import t0 from"eventemitter3";var Zu=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign"],hl=e=>Zu.includes(e);import{isPossiblePhoneNumber as ju}from"libphonenumber-js/min";var ml=e=>!!String(e).toLowerCase().match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/),gl=e=>ju(String(e),"US"),vl=(e,t)=>{let r=e.slice(0),n=[];for(;r.length;)n.push(r.splice(0,t));return n},Tt=(e,t=3,r=4)=>{if(!e)return"";let n=2,i=3;if(t+r+n+i>=e.length)return e;let c=e.slice(0,n+t),f=e.slice(e.length-r,e.length);return`${c}...${f}`},Vi=e=>new Promise(t=>setTimeout(t,e)),yl=(e,t={})=>{let r=t.delayMs||40,n=t.maxAttempts||1e3;return new Promise(async(i,c)=>{let f=!1,g=0;for(;!f&&g<n;)e().then(()=>{f=!0,i()},(...y)=>{f=!0,c(...y)}),g+=1,await Vi(r);f||c(new Error("Exceeded max attempts before resolving function"))})},rn=(e,t,r={})=>{let n=new URL(t,e);for(let[i,c]of Object.entries(r))n.searchParams.set(i,c);return n.href},Ku=(e,t)=>e.toLowerCase()===t.toLowerCase(),qi=(e,t)=>{for(let r of e)if(Ku(r,t))return!0;return!1},on=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),bo=e=>typeof e=="string"?e:"0x"+e.toString(16);import{ErrorCode as Ju}from"@ethersproject/logger";var Br=class extends de{constructor(){super("Wallet timeout");this.type="wallet_error"}},gr=class extends de{constructor(){super("User rejected connection");this.type="wallet_error"}},Et=e=>{if(e instanceof de)return e;if((e==null?void 0:e.code)&&(e==null?void 0:e.reason)){let t=new Fr(e);return e.code===Ju.ACTION_REJECTED&&(t.details=mr.E4001_USER_REJECTED_REQUEST),t}return e!=null&&e.code?new Fr(e):new de("Unknown connector error",e)},$i=class extends St{constructor(r,n,i){super(r);this.type="provider_error";this.code=n,this.data=i}},Fr=class extends $i{constructor(r){var c,f,g;let n=r;super(n.message,n.code,n.data);let i=Object.values(mr).find(y=>y.eipCode===n.code);this.details=i||mr.UNKNOWN_ERROR,n.code===-32002&&((c=n.message)!=null&&c.includes("already pending for origin")?(f=n.message)!=null&&f.includes("wallet_requestPermissions")?this.details=mr.E32002_CONNECTION_ALREADY_PENDING:this.details=mr.E32002_REQUEST_ALREADY_PENDING:(g=n.message)!=null&&g.includes("Already processing")&&n.message.includes("eth_requestAccounts")&&(this.details=mr.E32002_WALLET_LOCKED))}},Yu={ERROR_USER_EXISTS:{message:"User already exists for this address",detail:"Try another address!",retryable:!1},ERROR_TIMED_OUT:{message:"Wallet request timed out",detail:"Please try connecting again.",retryable:!0},ERROR_WALLET_CONNECTION:{message:"Could not log in with wallet",detail:"Please try connecting again.",retryable:!0},ERROR_USER_REJECTED_CONNECTION:{message:"You rejected the request",detail:"Please try connecting again.",retryable:!0}},Qu={E32002_CONNECTION_ALREADY_PENDING:{eipCode:-32002,message:"Connection request already pending",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E32002_REQUEST_ALREADY_PENDING:{eipCode:-32002,message:"Resource request already pending",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E32002_WALLET_LOCKED:{eipCode:-32002,message:"Wallet might be locked",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E4001_USER_REJECTED_REQUEST:{eipCode:4001,message:"Signature rejected",detail:"Please try signing again.",retryable:!0}},Xu={E4001_DEFAULT_USER_REJECTED_REQUEST:{eipCode:4001,message:"User Rejected Request",detail:"The user rejected the request.",default:!0,retryable:!0},E4100_DEFAULT_UNAUTHORIZED:{eipCode:4100,message:"Unauthorized",detail:"The requested method and/or account has not been authorized by the user.",default:!0,retryable:!1},E4200_DEFAULT_UNSUPPORTED_METHOD:{eipCode:4200,message:"Unsupported Method",detail:"The Provider does not support the requested method.",default:!0,retryable:!1},E4900_DEFAULT_DISCONNECTED:{eipCode:4900,message:"Disconnected",detail:"The Provider is disconnected from all chains.",default:!0,retryable:!0},E4901_DEFAULT_CHAIN_DISCONNECTED:{eipCode:4901,message:"Chain Disconnected",detail:"The Provider is not connected to the requested chain.",default:!0,retryable:!0},E32700_DEFAULT_PARSE_ERROR:{eipCode:-32700,message:"Parse error",detail:"Invalid JSON",default:!0,retryable:!1},E32600_DEFAULT_INVALID_REQUEST:{eipCode:-32600,message:"Invalid request",detail:"JSON is not a valid request object",default:!0,retryable:!1},E32601_DEFAULT_METHOD_NOT_FOUND:{eipCode:-32601,message:"Method not found",detail:"Method does not exist",default:!0,retryable:!1},E32602_DEFAULT_INVALID_PARAMS:{eipCode:-32602,message:"Invalid params",detail:"Invalid method parameters",default:!0,retryable:!1},E32603_DEFAULT_INTERNAL_ERROR:{eipCode:-32603,message:"Internal error",detail:"Internal JSON-RPC error",default:!0,retryable:!0},E32000_DEFAULT_INVALID_INPUT:{eipCode:-32e3,message:"Invalid input",detail:"Missing or invalid parameters",default:!0,retryable:!1},E32001_DEFAULT_RESOURCE_NOT_FOUND:{eipCode:-32001,message:"Resource not found",detail:"Requested resource not found",default:!0,retryable:!1},E32002_DEFAULT_RESOURCE_UNAVAILABLE:{eipCode:-32002,message:"Resource unavailable",detail:"Requested resource not available",default:!0,retryable:!0},E32003_DEFAULT_TRANSACTION_REJECTED:{eipCode:-32003,message:"Transaction rejected",detail:"Transaction creation failed",default:!0,retryable:!0},E32004_DEFAULT_METHOD_NOT_SUPPORTED:{eipCode:-32004,message:"Method not supported",detail:"Method is not implemented",default:!0,retryable:!1},E32005_DEFAULT_LIMIT_EXCEEDED:{eipCode:-32005,message:"Limit exceeded",detail:"Request exceeds defined limit",default:!0,retryable:!1},E32006_DEFAULT_JSON_RPC_VERSION_NOT_SUPPORTED:{eipCode:-32006,message:"JSON-RPC version not supported",detail:"Version of JSON-RPC protocol is not supported",default:!0,retryable:!1}},mr={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...Xu,...Qu},vr={...Yu,...mr};var r0=12e4,zi=(e=new Br,t=r0)=>new Promise((r,n)=>setTimeout(()=>{n(e)},t)),Mt=class{constructor(t){this.removeListener=(t,r)=>{if(this.walletProvider)return this.walletProvider.removeListener(t,r)};this.setWalletProvider=t=>{this.walletProvider=t,this._subscriptions.forEach(r=>{var n;(n=this.walletProvider)==null||n.on(r.eventName,r.listener)})};this.walletProvider=t,this._subscriptions=[]}on(t,r){if(this.walletProvider)return this.walletProvider.on(t,r);this._subscriptions.push({eventName:t,listener:r})}async request(t){if(!this.walletProvider)throw new de(`A wallet request of type ${t.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(t),zi()]).catch(r=>{throw Et(r)})}},or=class extends Error{constructor(r,n,i){super(r);this.code=n,this.data=i}},nn=class extends t0{constructor(r,n,i=1){super();this.walletProxy=r,this.address=n,this.chainId=i,this.infuraProvider=new e0(i,Rt)}async handleSendTransaction(r){if(!r.params||!Array.isArray(r.params))throw new or(`Invalid params for ${r.method}`,4200);let n=r.params[0],i=n.chainId;if(i&&Number(i)!==this.chainId)throw new or(`Chain disconnected. Currently connected to ${this.chainId}, attempting to send to ${Number(i)}`,4901);if(!await wo()||!this.address)throw new or("Disconnected",4900);return(await wl(n)).transactionHash}handleSwitchEthereumChain(r){if(!r.params||!Array.isArray(r.params))throw new or(`Invalid params for ${r.method}`,4200);let n=r.params[0];this.chainId=Number(n),this.emit("chainChanged",n)}async handlePersonalSign(r){if(!r.params||!Array.isArray(r.params))throw new Error("Invalid params for eth_estimateGas");let n=r.params[0],i=qt(n)?Hi(n):n;return await bl(i)}async handleEstimateGas(r){if(!r.params||!Array.isArray(r.params))throw new Error("Invalid params for eth_estimateGas");let n={...r.params[0],chainId:bo(this.chainId)};return delete n.from,this.infuraProvider.send("eth_estimateGas",[n])}async request(r){switch(console.debug("Embedded1193Provider.request() called with args",r),r.method){case"eth_accounts":return this.address?[this.address]:[];case"eth_chainId":return bo(this.chainId);case"eth_estimateGas":return this.handleEstimateGas(r);case"eth_sendTransaction":return this.handleSendTransaction(r);case"wallet_switchEthereumChain":return this.handleSwitchEthereumChain(r);case"personal_sign":return this.handlePersonalSign(r);default:break}if(hl(r.method)){let n=await wo();if(!n||!this.address)throw new or("Disconnected",4900);try{return(await this.walletProxy.rpc({address:this.address,accessToken:n,request:{method:r.method,params:r.params}})).response.data}catch(i){throw console.error(i),new or("Disconnected",4900)}}else return this.infuraProvider.send(r.method,r.params)}async connect(){let r=await wo();if(!r||!this.address)return null;try{return(await this.walletProxy.connect({address:this.address,accessToken:r})).address}catch(n){return console.error(n),null}}},yr=class extends Mt{constructor(r){super(r)}},an=class extends Mt{constructor(t){super(t)}sendAsync(t,r){throw new Error("sendAsync is no longer supported by EIP-1193. Use the request method instead.")}};var ut=class{constructor(t,r,n){this.createSiweMessage=(t,r,n,i,c,f,g)=>`${n} wants you to sign in with your Ethereum account:
1
+ var Lu=Object.create;var Jo=Object.defineProperty;var ku=Object.getOwnPropertyDescriptor;var Ru=Object.getOwnPropertyNames;var Wu=Object.getPrototypeOf,Iu=Object.prototype.hasOwnProperty;var Nu=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var _s=(e,t)=>()=>(e&&(t=e(e=0)),t);var kt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ps=(e,t)=>{for(var r in t)Jo(e,r,{get:t[r],enumerable:!0})},As=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ru(t))!Iu.call(e,i)&&i!==r&&Jo(e,i,{get:()=>t[i],enumerable:!(n=ku(t,i))||n.enumerable});return e};var Ss=(e,t,r)=>(r=e!=null?Lu(Wu(e)):{},As(t||!e||!e.__esModule?Jo(r,"default",{value:e,enumerable:!0}):r,e)),Ts=e=>As(Jo({},"__esModule",{value:!0}),e);var al=kt((il,Ui)=>{(function(e,t){"use strict";function r(h,o){if(!h)throw new Error(o||"Assertion failed")}function n(h,o){h.super_=o;var s=function(){};s.prototype=o.prototype,h.prototype=new s,h.prototype.constructor=h}function i(h,o,s){if(i.isBN(h))return h;this.negative=0,this.words=null,this.length=0,this.red=null,h!==null&&((o==="le"||o==="be")&&(s=o,o=10),this._init(h||0,o||10,s||"be"))}typeof e=="object"?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26;var c;try{typeof window<"u"&&typeof window.Buffer<"u"?c=window.Buffer:c=Nu("buffer").Buffer}catch{}i.isBN=function(o){return o instanceof i?!0:o!==null&&typeof o=="object"&&o.constructor.wordSize===i.wordSize&&Array.isArray(o.words)},i.max=function(o,s){return o.cmp(s)>0?o:s},i.min=function(o,s){return o.cmp(s)<0?o:s},i.prototype._init=function(o,s,l){if(typeof o=="number")return this._initNumber(o,s,l);if(typeof o=="object")return this._initArray(o,s,l);s==="hex"&&(s=16),r(s===(s|0)&&s>=2&&s<=36),o=o.toString().replace(/\s+/g,"");var d=0;o[0]==="-"&&(d++,this.negative=1),d<o.length&&(s===16?this._parseHex(o,d,l):(this._parseBase(o,s,d),l==="le"&&this._initArray(this.toArray(),s,l)))},i.prototype._initNumber=function(o,s,l){o<0&&(this.negative=1,o=-o),o<67108864?(this.words=[o&67108863],this.length=1):o<4503599627370496?(this.words=[o&67108863,o/67108864&67108863],this.length=2):(r(o<9007199254740992),this.words=[o&67108863,o/67108864&67108863,1],this.length=3),l==="le"&&this._initArray(this.toArray(),s,l)},i.prototype._initArray=function(o,s,l){if(r(typeof o.length=="number"),o.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(o.length/3),this.words=new Array(this.length);for(var d=0;d<this.length;d++)this.words[d]=0;var u,v,b=0;if(l==="be")for(d=o.length-1,u=0;d>=0;d-=3)v=o[d]|o[d-1]<<8|o[d-2]<<16,this.words[u]|=v<<b&67108863,this.words[u+1]=v>>>26-b&67108863,b+=24,b>=26&&(b-=26,u++);else if(l==="le")for(d=0,u=0;d<o.length;d+=3)v=o[d]|o[d+1]<<8|o[d+2]<<16,this.words[u]|=v<<b&67108863,this.words[u+1]=v>>>26-b&67108863,b+=24,b>=26&&(b-=26,u++);return this._strip()};function f(h,o){var s=h.charCodeAt(o);if(s>=48&&s<=57)return s-48;if(s>=65&&s<=70)return s-55;if(s>=97&&s<=102)return s-87;r(!1,"Invalid character in "+h)}function g(h,o,s){var l=f(h,s);return s-1>=o&&(l|=f(h,s-1)<<4),l}i.prototype._parseHex=function(o,s,l){this.length=Math.ceil((o.length-s)/6),this.words=new Array(this.length);for(var d=0;d<this.length;d++)this.words[d]=0;var u=0,v=0,b;if(l==="be")for(d=o.length-1;d>=s;d-=2)b=g(o,s,d)<<u,this.words[v]|=b&67108863,u>=18?(u-=18,v+=1,this.words[v]|=b>>>26):u+=8;else{var p=o.length-s;for(d=p%2===0?s+1:s;d<o.length;d+=2)b=g(o,s,d)<<u,this.words[v]|=b&67108863,u>=18?(u-=18,v+=1,this.words[v]|=b>>>26):u+=8}this._strip()};function y(h,o,s,l){for(var d=0,u=0,v=Math.min(h.length,s),b=o;b<v;b++){var p=h.charCodeAt(b)-48;d*=l,p>=49?u=p-49+10:p>=17?u=p-17+10:u=p,r(p>=0&&u<l,"Invalid character"),d+=u}return d}i.prototype._parseBase=function(o,s,l){this.words=[0],this.length=1;for(var d=0,u=1;u<=67108863;u*=s)d++;d--,u=u/s|0;for(var v=o.length-l,b=v%d,p=Math.min(v,v-b)+l,a=0,m=l;m<p;m+=d)a=y(o,m,m+d,s),this.imuln(u),this.words[0]+a<67108864?this.words[0]+=a:this._iaddn(a);if(b!==0){var k=1;for(a=y(o,m,o.length,s),m=0;m<b;m++)k*=s;this.imuln(k),this.words[0]+a<67108864?this.words[0]+=a:this._iaddn(a)}this._strip()},i.prototype.copy=function(o){o.words=new Array(this.length);for(var s=0;s<this.length;s++)o.words[s]=this.words[s];o.length=this.length,o.negative=this.negative,o.red=this.red};function w(h,o){h.words=o.words,h.length=o.length,h.negative=o.negative,h.red=o.red}if(i.prototype._move=function(o){w(o,this)},i.prototype.clone=function(){var o=new i(null);return this.copy(o),o},i.prototype._expand=function(o){for(;this.length<o;)this.words[this.length++]=0;return this},i.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=A}catch{i.prototype.inspect=A}else i.prototype.inspect=A;function A(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var P=["","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"],_=[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],T=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(o,s){o=o||10,s=s|0||1;var l;if(o===16||o==="hex"){l="";for(var d=0,u=0,v=0;v<this.length;v++){var b=this.words[v],p=((b<<d|u)&16777215).toString(16);u=b>>>24-d&16777215,d+=2,d>=26&&(d-=26,v--),u!==0||v!==this.length-1?l=P[6-p.length]+p+l:l=p+l}for(u!==0&&(l=u.toString(16)+l);l.length%s!==0;)l="0"+l;return this.negative!==0&&(l="-"+l),l}if(o===(o|0)&&o>=2&&o<=36){var a=_[o],m=T[o];l="";var k=this.clone();for(k.negative=0;!k.isZero();){var R=k.modrn(m).toString(o);k=k.idivn(m),k.isZero()?l=R+l:l=P[a-R.length]+R+l}for(this.isZero()&&(l="0"+l);l.length%s!==0;)l="0"+l;return this.negative!==0&&(l="-"+l),l}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var o=this.words[0];return this.length===2?o+=this.words[1]*67108864:this.length===3&&this.words[2]===1?o+=4503599627370496+this.words[1]*67108864:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-o:o},i.prototype.toJSON=function(){return this.toString(16,2)},c&&(i.prototype.toBuffer=function(o,s){return this.toArrayLike(c,o,s)}),i.prototype.toArray=function(o,s){return this.toArrayLike(Array,o,s)};var M=function(o,s){return o.allocUnsafe?o.allocUnsafe(s):new o(s)};i.prototype.toArrayLike=function(o,s,l){this._strip();var d=this.byteLength(),u=l||Math.max(1,d);r(d<=u,"byte array longer than desired length"),r(u>0,"Requested array length <= 0");var v=M(o,u),b=s==="le"?"LE":"BE";return this["_toArrayLike"+b](v,d),v},i.prototype._toArrayLikeLE=function(o,s){for(var l=0,d=0,u=0,v=0;u<this.length;u++){var b=this.words[u]<<v|d;o[l++]=b&255,l<o.length&&(o[l++]=b>>8&255),l<o.length&&(o[l++]=b>>16&255),v===6?(l<o.length&&(o[l++]=b>>24&255),d=0,v=0):(d=b>>>24,v+=2)}if(l<o.length)for(o[l++]=d;l<o.length;)o[l++]=0},i.prototype._toArrayLikeBE=function(o,s){for(var l=o.length-1,d=0,u=0,v=0;u<this.length;u++){var b=this.words[u]<<v|d;o[l--]=b&255,l>=0&&(o[l--]=b>>8&255),l>=0&&(o[l--]=b>>16&255),v===6?(l>=0&&(o[l--]=b>>24&255),d=0,v=0):(d=b>>>24,v+=2)}if(l>=0)for(o[l--]=d;l>=0;)o[l--]=0},Math.clz32?i.prototype._countBits=function(o){return 32-Math.clz32(o)}:i.prototype._countBits=function(o){var s=o,l=0;return s>=4096&&(l+=13,s>>>=13),s>=64&&(l+=7,s>>>=7),s>=8&&(l+=4,s>>>=4),s>=2&&(l+=2,s>>>=2),l+s},i.prototype._zeroBits=function(o){if(o===0)return 26;var s=o,l=0;return(s&8191)===0&&(l+=13,s>>>=13),(s&127)===0&&(l+=7,s>>>=7),(s&15)===0&&(l+=4,s>>>=4),(s&3)===0&&(l+=2,s>>>=2),(s&1)===0&&l++,l},i.prototype.bitLength=function(){var o=this.words[this.length-1],s=this._countBits(o);return(this.length-1)*26+s};function E(h){for(var o=new Array(h.bitLength()),s=0;s<o.length;s++){var l=s/26|0,d=s%26;o[s]=h.words[l]>>>d&1}return o}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var o=0,s=0;s<this.length;s++){var l=this._zeroBits(this.words[s]);if(o+=l,l!==26)break}return o},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(o){return this.negative!==0?this.abs().inotn(o).iaddn(1):this.clone()},i.prototype.fromTwos=function(o){return this.testn(o-1)?this.notn(o).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return this.negative!==0},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(o){for(;this.length<o.length;)this.words[this.length++]=0;for(var s=0;s<o.length;s++)this.words[s]=this.words[s]|o.words[s];return this._strip()},i.prototype.ior=function(o){return r((this.negative|o.negative)===0),this.iuor(o)},i.prototype.or=function(o){return this.length>o.length?this.clone().ior(o):o.clone().ior(this)},i.prototype.uor=function(o){return this.length>o.length?this.clone().iuor(o):o.clone().iuor(this)},i.prototype.iuand=function(o){var s;this.length>o.length?s=o:s=this;for(var l=0;l<s.length;l++)this.words[l]=this.words[l]&o.words[l];return this.length=s.length,this._strip()},i.prototype.iand=function(o){return r((this.negative|o.negative)===0),this.iuand(o)},i.prototype.and=function(o){return this.length>o.length?this.clone().iand(o):o.clone().iand(this)},i.prototype.uand=function(o){return this.length>o.length?this.clone().iuand(o):o.clone().iuand(this)},i.prototype.iuxor=function(o){var s,l;this.length>o.length?(s=this,l=o):(s=o,l=this);for(var d=0;d<l.length;d++)this.words[d]=s.words[d]^l.words[d];if(this!==s)for(;d<s.length;d++)this.words[d]=s.words[d];return this.length=s.length,this._strip()},i.prototype.ixor=function(o){return r((this.negative|o.negative)===0),this.iuxor(o)},i.prototype.xor=function(o){return this.length>o.length?this.clone().ixor(o):o.clone().ixor(this)},i.prototype.uxor=function(o){return this.length>o.length?this.clone().iuxor(o):o.clone().iuxor(this)},i.prototype.inotn=function(o){r(typeof o=="number"&&o>=0);var s=Math.ceil(o/26)|0,l=o%26;this._expand(s),l>0&&s--;for(var d=0;d<s;d++)this.words[d]=~this.words[d]&67108863;return l>0&&(this.words[d]=~this.words[d]&67108863>>26-l),this._strip()},i.prototype.notn=function(o){return this.clone().inotn(o)},i.prototype.setn=function(o,s){r(typeof o=="number"&&o>=0);var l=o/26|0,d=o%26;return this._expand(l+1),s?this.words[l]=this.words[l]|1<<d:this.words[l]=this.words[l]&~(1<<d),this._strip()},i.prototype.iadd=function(o){var s;if(this.negative!==0&&o.negative===0)return this.negative=0,s=this.isub(o),this.negative^=1,this._normSign();if(this.negative===0&&o.negative!==0)return o.negative=0,s=this.isub(o),o.negative=1,s._normSign();var l,d;this.length>o.length?(l=this,d=o):(l=o,d=this);for(var u=0,v=0;v<d.length;v++)s=(l.words[v]|0)+(d.words[v]|0)+u,this.words[v]=s&67108863,u=s>>>26;for(;u!==0&&v<l.length;v++)s=(l.words[v]|0)+u,this.words[v]=s&67108863,u=s>>>26;if(this.length=l.length,u!==0)this.words[this.length]=u,this.length++;else if(l!==this)for(;v<l.length;v++)this.words[v]=l.words[v];return this},i.prototype.add=function(o){var s;return o.negative!==0&&this.negative===0?(o.negative=0,s=this.sub(o),o.negative^=1,s):o.negative===0&&this.negative!==0?(this.negative=0,s=o.sub(this),this.negative=1,s):this.length>o.length?this.clone().iadd(o):o.clone().iadd(this)},i.prototype.isub=function(o){if(o.negative!==0){o.negative=0;var s=this.iadd(o);return o.negative=1,s._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(o),this.negative=1,this._normSign();var l=this.cmp(o);if(l===0)return this.negative=0,this.length=1,this.words[0]=0,this;var d,u;l>0?(d=this,u=o):(d=o,u=this);for(var v=0,b=0;b<u.length;b++)s=(d.words[b]|0)-(u.words[b]|0)+v,v=s>>26,this.words[b]=s&67108863;for(;v!==0&&b<d.length;b++)s=(d.words[b]|0)+v,v=s>>26,this.words[b]=s&67108863;if(v===0&&b<d.length&&d!==this)for(;b<d.length;b++)this.words[b]=d.words[b];return this.length=Math.max(this.length,b),d!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(o){return this.clone().isub(o)};function S(h,o,s){s.negative=o.negative^h.negative;var l=h.length+o.length|0;s.length=l,l=l-1|0;var d=h.words[0]|0,u=o.words[0]|0,v=d*u,b=v&67108863,p=v/67108864|0;s.words[0]=b;for(var a=1;a<l;a++){for(var m=p>>>26,k=p&67108863,R=Math.min(a,o.length-1),N=Math.max(0,a-h.length+1);N<=R;N++){var H=a-N|0;d=h.words[H]|0,u=o.words[N]|0,v=d*u+k,m+=v/67108864|0,k=v&67108863}s.words[a]=k|0,p=m|0}return p!==0?s.words[a]=p|0:s.length--,s._strip()}var L=function(o,s,l){var d=o.words,u=s.words,v=l.words,b=0,p,a,m,k=d[0]|0,R=k&8191,N=k>>>13,H=d[1]|0,x=H&8191,C=H>>>13,V=d[2]|0,W=V&8191,oe=V>>>13,Ir=d[3]|0,se=Ir&8191,fe=Ir>>>13,ls=d[4]|0,pe=ls&8191,he=ls>>>13,cs=d[5]|0,me=cs&8191,ge=cs>>>13,ds=d[6]|0,ve=ds&8191,ye=ds>>>13,us=d[7]|0,be=us&8191,we=us>>>13,fs=d[8]|0,Ce=fs&8191,xe=fs>>>13,ps=d[9]|0,Ee=ps&8191,_e=ps>>>13,hs=u[0]|0,Pe=hs&8191,Ae=hs>>>13,ms=u[1]|0,Se=ms&8191,Te=ms>>>13,gs=u[2]|0,Me=gs&8191,Le=gs>>>13,vs=u[3]|0,ke=vs&8191,Re=vs>>>13,ys=u[4]|0,We=ys&8191,Ie=ys>>>13,bs=u[5]|0,Ne=bs&8191,Oe=bs>>>13,ws=u[6]|0,De=ws&8191,Ue=ws>>>13,Cs=u[7]|0,Be=Cs&8191,Fe=Cs>>>13,xs=u[8]|0,Ge=xs&8191,He=xs>>>13,Es=u[9]|0,Ve=Es&8191,qe=Es>>>13;l.negative=o.negative^s.negative,l.length=19,p=Math.imul(R,Pe),a=Math.imul(R,Ae),a=a+Math.imul(N,Pe)|0,m=Math.imul(N,Ae);var hi=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(hi>>>26)|0,hi&=67108863,p=Math.imul(x,Pe),a=Math.imul(x,Ae),a=a+Math.imul(C,Pe)|0,m=Math.imul(C,Ae),p=p+Math.imul(R,Se)|0,a=a+Math.imul(R,Te)|0,a=a+Math.imul(N,Se)|0,m=m+Math.imul(N,Te)|0;var mi=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(mi>>>26)|0,mi&=67108863,p=Math.imul(W,Pe),a=Math.imul(W,Ae),a=a+Math.imul(oe,Pe)|0,m=Math.imul(oe,Ae),p=p+Math.imul(x,Se)|0,a=a+Math.imul(x,Te)|0,a=a+Math.imul(C,Se)|0,m=m+Math.imul(C,Te)|0,p=p+Math.imul(R,Me)|0,a=a+Math.imul(R,Le)|0,a=a+Math.imul(N,Me)|0,m=m+Math.imul(N,Le)|0;var gi=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(gi>>>26)|0,gi&=67108863,p=Math.imul(se,Pe),a=Math.imul(se,Ae),a=a+Math.imul(fe,Pe)|0,m=Math.imul(fe,Ae),p=p+Math.imul(W,Se)|0,a=a+Math.imul(W,Te)|0,a=a+Math.imul(oe,Se)|0,m=m+Math.imul(oe,Te)|0,p=p+Math.imul(x,Me)|0,a=a+Math.imul(x,Le)|0,a=a+Math.imul(C,Me)|0,m=m+Math.imul(C,Le)|0,p=p+Math.imul(R,ke)|0,a=a+Math.imul(R,Re)|0,a=a+Math.imul(N,ke)|0,m=m+Math.imul(N,Re)|0;var vi=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(vi>>>26)|0,vi&=67108863,p=Math.imul(pe,Pe),a=Math.imul(pe,Ae),a=a+Math.imul(he,Pe)|0,m=Math.imul(he,Ae),p=p+Math.imul(se,Se)|0,a=a+Math.imul(se,Te)|0,a=a+Math.imul(fe,Se)|0,m=m+Math.imul(fe,Te)|0,p=p+Math.imul(W,Me)|0,a=a+Math.imul(W,Le)|0,a=a+Math.imul(oe,Me)|0,m=m+Math.imul(oe,Le)|0,p=p+Math.imul(x,ke)|0,a=a+Math.imul(x,Re)|0,a=a+Math.imul(C,ke)|0,m=m+Math.imul(C,Re)|0,p=p+Math.imul(R,We)|0,a=a+Math.imul(R,Ie)|0,a=a+Math.imul(N,We)|0,m=m+Math.imul(N,Ie)|0;var yi=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(yi>>>26)|0,yi&=67108863,p=Math.imul(me,Pe),a=Math.imul(me,Ae),a=a+Math.imul(ge,Pe)|0,m=Math.imul(ge,Ae),p=p+Math.imul(pe,Se)|0,a=a+Math.imul(pe,Te)|0,a=a+Math.imul(he,Se)|0,m=m+Math.imul(he,Te)|0,p=p+Math.imul(se,Me)|0,a=a+Math.imul(se,Le)|0,a=a+Math.imul(fe,Me)|0,m=m+Math.imul(fe,Le)|0,p=p+Math.imul(W,ke)|0,a=a+Math.imul(W,Re)|0,a=a+Math.imul(oe,ke)|0,m=m+Math.imul(oe,Re)|0,p=p+Math.imul(x,We)|0,a=a+Math.imul(x,Ie)|0,a=a+Math.imul(C,We)|0,m=m+Math.imul(C,Ie)|0,p=p+Math.imul(R,Ne)|0,a=a+Math.imul(R,Oe)|0,a=a+Math.imul(N,Ne)|0,m=m+Math.imul(N,Oe)|0;var bi=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(bi>>>26)|0,bi&=67108863,p=Math.imul(ve,Pe),a=Math.imul(ve,Ae),a=a+Math.imul(ye,Pe)|0,m=Math.imul(ye,Ae),p=p+Math.imul(me,Se)|0,a=a+Math.imul(me,Te)|0,a=a+Math.imul(ge,Se)|0,m=m+Math.imul(ge,Te)|0,p=p+Math.imul(pe,Me)|0,a=a+Math.imul(pe,Le)|0,a=a+Math.imul(he,Me)|0,m=m+Math.imul(he,Le)|0,p=p+Math.imul(se,ke)|0,a=a+Math.imul(se,Re)|0,a=a+Math.imul(fe,ke)|0,m=m+Math.imul(fe,Re)|0,p=p+Math.imul(W,We)|0,a=a+Math.imul(W,Ie)|0,a=a+Math.imul(oe,We)|0,m=m+Math.imul(oe,Ie)|0,p=p+Math.imul(x,Ne)|0,a=a+Math.imul(x,Oe)|0,a=a+Math.imul(C,Ne)|0,m=m+Math.imul(C,Oe)|0,p=p+Math.imul(R,De)|0,a=a+Math.imul(R,Ue)|0,a=a+Math.imul(N,De)|0,m=m+Math.imul(N,Ue)|0;var wi=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(wi>>>26)|0,wi&=67108863,p=Math.imul(be,Pe),a=Math.imul(be,Ae),a=a+Math.imul(we,Pe)|0,m=Math.imul(we,Ae),p=p+Math.imul(ve,Se)|0,a=a+Math.imul(ve,Te)|0,a=a+Math.imul(ye,Se)|0,m=m+Math.imul(ye,Te)|0,p=p+Math.imul(me,Me)|0,a=a+Math.imul(me,Le)|0,a=a+Math.imul(ge,Me)|0,m=m+Math.imul(ge,Le)|0,p=p+Math.imul(pe,ke)|0,a=a+Math.imul(pe,Re)|0,a=a+Math.imul(he,ke)|0,m=m+Math.imul(he,Re)|0,p=p+Math.imul(se,We)|0,a=a+Math.imul(se,Ie)|0,a=a+Math.imul(fe,We)|0,m=m+Math.imul(fe,Ie)|0,p=p+Math.imul(W,Ne)|0,a=a+Math.imul(W,Oe)|0,a=a+Math.imul(oe,Ne)|0,m=m+Math.imul(oe,Oe)|0,p=p+Math.imul(x,De)|0,a=a+Math.imul(x,Ue)|0,a=a+Math.imul(C,De)|0,m=m+Math.imul(C,Ue)|0,p=p+Math.imul(R,Be)|0,a=a+Math.imul(R,Fe)|0,a=a+Math.imul(N,Be)|0,m=m+Math.imul(N,Fe)|0;var Ci=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(Ci>>>26)|0,Ci&=67108863,p=Math.imul(Ce,Pe),a=Math.imul(Ce,Ae),a=a+Math.imul(xe,Pe)|0,m=Math.imul(xe,Ae),p=p+Math.imul(be,Se)|0,a=a+Math.imul(be,Te)|0,a=a+Math.imul(we,Se)|0,m=m+Math.imul(we,Te)|0,p=p+Math.imul(ve,Me)|0,a=a+Math.imul(ve,Le)|0,a=a+Math.imul(ye,Me)|0,m=m+Math.imul(ye,Le)|0,p=p+Math.imul(me,ke)|0,a=a+Math.imul(me,Re)|0,a=a+Math.imul(ge,ke)|0,m=m+Math.imul(ge,Re)|0,p=p+Math.imul(pe,We)|0,a=a+Math.imul(pe,Ie)|0,a=a+Math.imul(he,We)|0,m=m+Math.imul(he,Ie)|0,p=p+Math.imul(se,Ne)|0,a=a+Math.imul(se,Oe)|0,a=a+Math.imul(fe,Ne)|0,m=m+Math.imul(fe,Oe)|0,p=p+Math.imul(W,De)|0,a=a+Math.imul(W,Ue)|0,a=a+Math.imul(oe,De)|0,m=m+Math.imul(oe,Ue)|0,p=p+Math.imul(x,Be)|0,a=a+Math.imul(x,Fe)|0,a=a+Math.imul(C,Be)|0,m=m+Math.imul(C,Fe)|0,p=p+Math.imul(R,Ge)|0,a=a+Math.imul(R,He)|0,a=a+Math.imul(N,Ge)|0,m=m+Math.imul(N,He)|0;var xi=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(xi>>>26)|0,xi&=67108863,p=Math.imul(Ee,Pe),a=Math.imul(Ee,Ae),a=a+Math.imul(_e,Pe)|0,m=Math.imul(_e,Ae),p=p+Math.imul(Ce,Se)|0,a=a+Math.imul(Ce,Te)|0,a=a+Math.imul(xe,Se)|0,m=m+Math.imul(xe,Te)|0,p=p+Math.imul(be,Me)|0,a=a+Math.imul(be,Le)|0,a=a+Math.imul(we,Me)|0,m=m+Math.imul(we,Le)|0,p=p+Math.imul(ve,ke)|0,a=a+Math.imul(ve,Re)|0,a=a+Math.imul(ye,ke)|0,m=m+Math.imul(ye,Re)|0,p=p+Math.imul(me,We)|0,a=a+Math.imul(me,Ie)|0,a=a+Math.imul(ge,We)|0,m=m+Math.imul(ge,Ie)|0,p=p+Math.imul(pe,Ne)|0,a=a+Math.imul(pe,Oe)|0,a=a+Math.imul(he,Ne)|0,m=m+Math.imul(he,Oe)|0,p=p+Math.imul(se,De)|0,a=a+Math.imul(se,Ue)|0,a=a+Math.imul(fe,De)|0,m=m+Math.imul(fe,Ue)|0,p=p+Math.imul(W,Be)|0,a=a+Math.imul(W,Fe)|0,a=a+Math.imul(oe,Be)|0,m=m+Math.imul(oe,Fe)|0,p=p+Math.imul(x,Ge)|0,a=a+Math.imul(x,He)|0,a=a+Math.imul(C,Ge)|0,m=m+Math.imul(C,He)|0,p=p+Math.imul(R,Ve)|0,a=a+Math.imul(R,qe)|0,a=a+Math.imul(N,Ve)|0,m=m+Math.imul(N,qe)|0;var Ei=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(Ei>>>26)|0,Ei&=67108863,p=Math.imul(Ee,Se),a=Math.imul(Ee,Te),a=a+Math.imul(_e,Se)|0,m=Math.imul(_e,Te),p=p+Math.imul(Ce,Me)|0,a=a+Math.imul(Ce,Le)|0,a=a+Math.imul(xe,Me)|0,m=m+Math.imul(xe,Le)|0,p=p+Math.imul(be,ke)|0,a=a+Math.imul(be,Re)|0,a=a+Math.imul(we,ke)|0,m=m+Math.imul(we,Re)|0,p=p+Math.imul(ve,We)|0,a=a+Math.imul(ve,Ie)|0,a=a+Math.imul(ye,We)|0,m=m+Math.imul(ye,Ie)|0,p=p+Math.imul(me,Ne)|0,a=a+Math.imul(me,Oe)|0,a=a+Math.imul(ge,Ne)|0,m=m+Math.imul(ge,Oe)|0,p=p+Math.imul(pe,De)|0,a=a+Math.imul(pe,Ue)|0,a=a+Math.imul(he,De)|0,m=m+Math.imul(he,Ue)|0,p=p+Math.imul(se,Be)|0,a=a+Math.imul(se,Fe)|0,a=a+Math.imul(fe,Be)|0,m=m+Math.imul(fe,Fe)|0,p=p+Math.imul(W,Ge)|0,a=a+Math.imul(W,He)|0,a=a+Math.imul(oe,Ge)|0,m=m+Math.imul(oe,He)|0,p=p+Math.imul(x,Ve)|0,a=a+Math.imul(x,qe)|0,a=a+Math.imul(C,Ve)|0,m=m+Math.imul(C,qe)|0;var _i=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(_i>>>26)|0,_i&=67108863,p=Math.imul(Ee,Me),a=Math.imul(Ee,Le),a=a+Math.imul(_e,Me)|0,m=Math.imul(_e,Le),p=p+Math.imul(Ce,ke)|0,a=a+Math.imul(Ce,Re)|0,a=a+Math.imul(xe,ke)|0,m=m+Math.imul(xe,Re)|0,p=p+Math.imul(be,We)|0,a=a+Math.imul(be,Ie)|0,a=a+Math.imul(we,We)|0,m=m+Math.imul(we,Ie)|0,p=p+Math.imul(ve,Ne)|0,a=a+Math.imul(ve,Oe)|0,a=a+Math.imul(ye,Ne)|0,m=m+Math.imul(ye,Oe)|0,p=p+Math.imul(me,De)|0,a=a+Math.imul(me,Ue)|0,a=a+Math.imul(ge,De)|0,m=m+Math.imul(ge,Ue)|0,p=p+Math.imul(pe,Be)|0,a=a+Math.imul(pe,Fe)|0,a=a+Math.imul(he,Be)|0,m=m+Math.imul(he,Fe)|0,p=p+Math.imul(se,Ge)|0,a=a+Math.imul(se,He)|0,a=a+Math.imul(fe,Ge)|0,m=m+Math.imul(fe,He)|0,p=p+Math.imul(W,Ve)|0,a=a+Math.imul(W,qe)|0,a=a+Math.imul(oe,Ve)|0,m=m+Math.imul(oe,qe)|0;var Pi=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(Pi>>>26)|0,Pi&=67108863,p=Math.imul(Ee,ke),a=Math.imul(Ee,Re),a=a+Math.imul(_e,ke)|0,m=Math.imul(_e,Re),p=p+Math.imul(Ce,We)|0,a=a+Math.imul(Ce,Ie)|0,a=a+Math.imul(xe,We)|0,m=m+Math.imul(xe,Ie)|0,p=p+Math.imul(be,Ne)|0,a=a+Math.imul(be,Oe)|0,a=a+Math.imul(we,Ne)|0,m=m+Math.imul(we,Oe)|0,p=p+Math.imul(ve,De)|0,a=a+Math.imul(ve,Ue)|0,a=a+Math.imul(ye,De)|0,m=m+Math.imul(ye,Ue)|0,p=p+Math.imul(me,Be)|0,a=a+Math.imul(me,Fe)|0,a=a+Math.imul(ge,Be)|0,m=m+Math.imul(ge,Fe)|0,p=p+Math.imul(pe,Ge)|0,a=a+Math.imul(pe,He)|0,a=a+Math.imul(he,Ge)|0,m=m+Math.imul(he,He)|0,p=p+Math.imul(se,Ve)|0,a=a+Math.imul(se,qe)|0,a=a+Math.imul(fe,Ve)|0,m=m+Math.imul(fe,qe)|0;var Ai=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(Ai>>>26)|0,Ai&=67108863,p=Math.imul(Ee,We),a=Math.imul(Ee,Ie),a=a+Math.imul(_e,We)|0,m=Math.imul(_e,Ie),p=p+Math.imul(Ce,Ne)|0,a=a+Math.imul(Ce,Oe)|0,a=a+Math.imul(xe,Ne)|0,m=m+Math.imul(xe,Oe)|0,p=p+Math.imul(be,De)|0,a=a+Math.imul(be,Ue)|0,a=a+Math.imul(we,De)|0,m=m+Math.imul(we,Ue)|0,p=p+Math.imul(ve,Be)|0,a=a+Math.imul(ve,Fe)|0,a=a+Math.imul(ye,Be)|0,m=m+Math.imul(ye,Fe)|0,p=p+Math.imul(me,Ge)|0,a=a+Math.imul(me,He)|0,a=a+Math.imul(ge,Ge)|0,m=m+Math.imul(ge,He)|0,p=p+Math.imul(pe,Ve)|0,a=a+Math.imul(pe,qe)|0,a=a+Math.imul(he,Ve)|0,m=m+Math.imul(he,qe)|0;var Si=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(Si>>>26)|0,Si&=67108863,p=Math.imul(Ee,Ne),a=Math.imul(Ee,Oe),a=a+Math.imul(_e,Ne)|0,m=Math.imul(_e,Oe),p=p+Math.imul(Ce,De)|0,a=a+Math.imul(Ce,Ue)|0,a=a+Math.imul(xe,De)|0,m=m+Math.imul(xe,Ue)|0,p=p+Math.imul(be,Be)|0,a=a+Math.imul(be,Fe)|0,a=a+Math.imul(we,Be)|0,m=m+Math.imul(we,Fe)|0,p=p+Math.imul(ve,Ge)|0,a=a+Math.imul(ve,He)|0,a=a+Math.imul(ye,Ge)|0,m=m+Math.imul(ye,He)|0,p=p+Math.imul(me,Ve)|0,a=a+Math.imul(me,qe)|0,a=a+Math.imul(ge,Ve)|0,m=m+Math.imul(ge,qe)|0;var Ti=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(Ti>>>26)|0,Ti&=67108863,p=Math.imul(Ee,De),a=Math.imul(Ee,Ue),a=a+Math.imul(_e,De)|0,m=Math.imul(_e,Ue),p=p+Math.imul(Ce,Be)|0,a=a+Math.imul(Ce,Fe)|0,a=a+Math.imul(xe,Be)|0,m=m+Math.imul(xe,Fe)|0,p=p+Math.imul(be,Ge)|0,a=a+Math.imul(be,He)|0,a=a+Math.imul(we,Ge)|0,m=m+Math.imul(we,He)|0,p=p+Math.imul(ve,Ve)|0,a=a+Math.imul(ve,qe)|0,a=a+Math.imul(ye,Ve)|0,m=m+Math.imul(ye,qe)|0;var Mi=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(Mi>>>26)|0,Mi&=67108863,p=Math.imul(Ee,Be),a=Math.imul(Ee,Fe),a=a+Math.imul(_e,Be)|0,m=Math.imul(_e,Fe),p=p+Math.imul(Ce,Ge)|0,a=a+Math.imul(Ce,He)|0,a=a+Math.imul(xe,Ge)|0,m=m+Math.imul(xe,He)|0,p=p+Math.imul(be,Ve)|0,a=a+Math.imul(be,qe)|0,a=a+Math.imul(we,Ve)|0,m=m+Math.imul(we,qe)|0;var Li=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(Li>>>26)|0,Li&=67108863,p=Math.imul(Ee,Ge),a=Math.imul(Ee,He),a=a+Math.imul(_e,Ge)|0,m=Math.imul(_e,He),p=p+Math.imul(Ce,Ve)|0,a=a+Math.imul(Ce,qe)|0,a=a+Math.imul(xe,Ve)|0,m=m+Math.imul(xe,qe)|0;var ki=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(ki>>>26)|0,ki&=67108863,p=Math.imul(Ee,Ve),a=Math.imul(Ee,qe),a=a+Math.imul(_e,Ve)|0,m=Math.imul(_e,qe);var Ri=(b+p|0)+((a&8191)<<13)|0;return b=(m+(a>>>13)|0)+(Ri>>>26)|0,Ri&=67108863,v[0]=hi,v[1]=mi,v[2]=gi,v[3]=vi,v[4]=yi,v[5]=bi,v[6]=wi,v[7]=Ci,v[8]=xi,v[9]=Ei,v[10]=_i,v[11]=Pi,v[12]=Ai,v[13]=Si,v[14]=Ti,v[15]=Mi,v[16]=Li,v[17]=ki,v[18]=Ri,b!==0&&(v[19]=b,l.length++),l};Math.imul||(L=S);function G(h,o,s){s.negative=o.negative^h.negative,s.length=h.length+o.length;for(var l=0,d=0,u=0;u<s.length-1;u++){var v=d;d=0;for(var b=l&67108863,p=Math.min(u,o.length-1),a=Math.max(0,u-h.length+1);a<=p;a++){var m=u-a,k=h.words[m]|0,R=o.words[a]|0,N=k*R,H=N&67108863;v=v+(N/67108864|0)|0,H=H+b|0,b=H&67108863,v=v+(H>>>26)|0,d+=v>>>26,v&=67108863}s.words[u]=b,l=v,v=d}return l!==0?s.words[u]=l:s.length--,s._strip()}function q(h,o,s){return G(h,o,s)}i.prototype.mulTo=function(o,s){var l,d=this.length+o.length;return this.length===10&&o.length===10?l=L(this,o,s):d<63?l=S(this,o,s):d<1024?l=G(this,o,s):l=q(this,o,s),l};function $(h,o){this.x=h,this.y=o}$.prototype.makeRBT=function(o){for(var s=new Array(o),l=i.prototype._countBits(o)-1,d=0;d<o;d++)s[d]=this.revBin(d,l,o);return s},$.prototype.revBin=function(o,s,l){if(o===0||o===l-1)return o;for(var d=0,u=0;u<s;u++)d|=(o&1)<<s-u-1,o>>=1;return d},$.prototype.permute=function(o,s,l,d,u,v){for(var b=0;b<v;b++)d[b]=s[o[b]],u[b]=l[o[b]]},$.prototype.transform=function(o,s,l,d,u,v){this.permute(v,o,s,l,d,u);for(var b=1;b<u;b<<=1)for(var p=b<<1,a=Math.cos(2*Math.PI/p),m=Math.sin(2*Math.PI/p),k=0;k<u;k+=p)for(var R=a,N=m,H=0;H<b;H++){var x=l[k+H],C=d[k+H],V=l[k+H+b],W=d[k+H+b],oe=R*V-N*W;W=R*W+N*V,V=oe,l[k+H]=x+V,d[k+H]=C+W,l[k+H+b]=x-V,d[k+H+b]=C-W,H!==p&&(oe=a*R-m*N,N=a*N+m*R,R=oe)}},$.prototype.guessLen13b=function(o,s){var l=Math.max(s,o)|1,d=l&1,u=0;for(l=l/2|0;l;l=l>>>1)u++;return 1<<u+1+d},$.prototype.conjugate=function(o,s,l){if(!(l<=1))for(var d=0;d<l/2;d++){var u=o[d];o[d]=o[l-d-1],o[l-d-1]=u,u=s[d],s[d]=-s[l-d-1],s[l-d-1]=-u}},$.prototype.normalize13b=function(o,s){for(var l=0,d=0;d<s/2;d++){var u=Math.round(o[2*d+1]/s)*8192+Math.round(o[2*d]/s)+l;o[d]=u&67108863,u<67108864?l=0:l=u/67108864|0}return o},$.prototype.convert13b=function(o,s,l,d){for(var u=0,v=0;v<s;v++)u=u+(o[v]|0),l[2*v]=u&8191,u=u>>>13,l[2*v+1]=u&8191,u=u>>>13;for(v=2*s;v<d;++v)l[v]=0;r(u===0),r((u&-8192)===0)},$.prototype.stub=function(o){for(var s=new Array(o),l=0;l<o;l++)s[l]=0;return s},$.prototype.mulp=function(o,s,l){var d=2*this.guessLen13b(o.length,s.length),u=this.makeRBT(d),v=this.stub(d),b=new Array(d),p=new Array(d),a=new Array(d),m=new Array(d),k=new Array(d),R=new Array(d),N=l.words;N.length=d,this.convert13b(o.words,o.length,b,d),this.convert13b(s.words,s.length,m,d),this.transform(b,v,p,a,d,u),this.transform(m,v,k,R,d,u);for(var H=0;H<d;H++){var x=p[H]*k[H]-a[H]*R[H];a[H]=p[H]*R[H]+a[H]*k[H],p[H]=x}return this.conjugate(p,a,d),this.transform(p,a,N,v,d,u),this.conjugate(N,v,d),this.normalize13b(N,d),l.negative=o.negative^s.negative,l.length=o.length+s.length,l._strip()},i.prototype.mul=function(o){var s=new i(null);return s.words=new Array(this.length+o.length),this.mulTo(o,s)},i.prototype.mulf=function(o){var s=new i(null);return s.words=new Array(this.length+o.length),q(this,o,s)},i.prototype.imul=function(o){return this.clone().mulTo(o,this)},i.prototype.imuln=function(o){var s=o<0;s&&(o=-o),r(typeof o=="number"),r(o<67108864);for(var l=0,d=0;d<this.length;d++){var u=(this.words[d]|0)*o,v=(u&67108863)+(l&67108863);l>>=26,l+=u/67108864|0,l+=v>>>26,this.words[d]=v&67108863}return l!==0&&(this.words[d]=l,this.length++),s?this.ineg():this},i.prototype.muln=function(o){return this.clone().imuln(o)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(o){var s=E(o);if(s.length===0)return new i(1);for(var l=this,d=0;d<s.length&&s[d]===0;d++,l=l.sqr());if(++d<s.length)for(var u=l.sqr();d<s.length;d++,u=u.sqr())s[d]!==0&&(l=l.mul(u));return l},i.prototype.iushln=function(o){r(typeof o=="number"&&o>=0);var s=o%26,l=(o-s)/26,d=67108863>>>26-s<<26-s,u;if(s!==0){var v=0;for(u=0;u<this.length;u++){var b=this.words[u]&d,p=(this.words[u]|0)-b<<s;this.words[u]=p|v,v=b>>>26-s}v&&(this.words[u]=v,this.length++)}if(l!==0){for(u=this.length-1;u>=0;u--)this.words[u+l]=this.words[u];for(u=0;u<l;u++)this.words[u]=0;this.length+=l}return this._strip()},i.prototype.ishln=function(o){return r(this.negative===0),this.iushln(o)},i.prototype.iushrn=function(o,s,l){r(typeof o=="number"&&o>=0);var d;s?d=(s-s%26)/26:d=0;var u=o%26,v=Math.min((o-u)/26,this.length),b=67108863^67108863>>>u<<u,p=l;if(d-=v,d=Math.max(0,d),p){for(var a=0;a<v;a++)p.words[a]=this.words[a];p.length=v}if(v!==0)if(this.length>v)for(this.length-=v,a=0;a<this.length;a++)this.words[a]=this.words[a+v];else this.words[0]=0,this.length=1;var m=0;for(a=this.length-1;a>=0&&(m!==0||a>=d);a--){var k=this.words[a]|0;this.words[a]=m<<26-u|k>>>u,m=k&b}return p&&m!==0&&(p.words[p.length++]=m),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(o,s,l){return r(this.negative===0),this.iushrn(o,s,l)},i.prototype.shln=function(o){return this.clone().ishln(o)},i.prototype.ushln=function(o){return this.clone().iushln(o)},i.prototype.shrn=function(o){return this.clone().ishrn(o)},i.prototype.ushrn=function(o){return this.clone().iushrn(o)},i.prototype.testn=function(o){r(typeof o=="number"&&o>=0);var s=o%26,l=(o-s)/26,d=1<<s;if(this.length<=l)return!1;var u=this.words[l];return!!(u&d)},i.prototype.imaskn=function(o){r(typeof o=="number"&&o>=0);var s=o%26,l=(o-s)/26;if(r(this.negative===0,"imaskn works only with positive numbers"),this.length<=l)return this;if(s!==0&&l++,this.length=Math.min(l,this.length),s!==0){var d=67108863^67108863>>>s<<s;this.words[this.length-1]&=d}return this._strip()},i.prototype.maskn=function(o){return this.clone().imaskn(o)},i.prototype.iaddn=function(o){return r(typeof o=="number"),r(o<67108864),o<0?this.isubn(-o):this.negative!==0?this.length===1&&(this.words[0]|0)<=o?(this.words[0]=o-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(o),this.negative=1,this):this._iaddn(o)},i.prototype._iaddn=function(o){this.words[0]+=o;for(var s=0;s<this.length&&this.words[s]>=67108864;s++)this.words[s]-=67108864,s===this.length-1?this.words[s+1]=1:this.words[s+1]++;return this.length=Math.max(this.length,s+1),this},i.prototype.isubn=function(o){if(r(typeof o=="number"),r(o<67108864),o<0)return this.iaddn(-o);if(this.negative!==0)return this.negative=0,this.iaddn(o),this.negative=1,this;if(this.words[0]-=o,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var s=0;s<this.length&&this.words[s]<0;s++)this.words[s]+=67108864,this.words[s+1]-=1;return this._strip()},i.prototype.addn=function(o){return this.clone().iaddn(o)},i.prototype.subn=function(o){return this.clone().isubn(o)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(o,s,l){var d=o.length+l,u;this._expand(d);var v,b=0;for(u=0;u<o.length;u++){v=(this.words[u+l]|0)+b;var p=(o.words[u]|0)*s;v-=p&67108863,b=(v>>26)-(p/67108864|0),this.words[u+l]=v&67108863}for(;u<this.length-l;u++)v=(this.words[u+l]|0)+b,b=v>>26,this.words[u+l]=v&67108863;if(b===0)return this._strip();for(r(b===-1),b=0,u=0;u<this.length;u++)v=-(this.words[u]|0)+b,b=v>>26,this.words[u]=v&67108863;return this.negative=1,this._strip()},i.prototype._wordDiv=function(o,s){var l=this.length-o.length,d=this.clone(),u=o,v=u.words[u.length-1]|0,b=this._countBits(v);l=26-b,l!==0&&(u=u.ushln(l),d.iushln(l),v=u.words[u.length-1]|0);var p=d.length-u.length,a;if(s!=="mod"){a=new i(null),a.length=p+1,a.words=new Array(a.length);for(var m=0;m<a.length;m++)a.words[m]=0}var k=d.clone()._ishlnsubmul(u,1,p);k.negative===0&&(d=k,a&&(a.words[p]=1));for(var R=p-1;R>=0;R--){var N=(d.words[u.length+R]|0)*67108864+(d.words[u.length+R-1]|0);for(N=Math.min(N/v|0,67108863),d._ishlnsubmul(u,N,R);d.negative!==0;)N--,d.negative=0,d._ishlnsubmul(u,1,R),d.isZero()||(d.negative^=1);a&&(a.words[R]=N)}return a&&a._strip(),d._strip(),s!=="div"&&l!==0&&d.iushrn(l),{div:a||null,mod:d}},i.prototype.divmod=function(o,s,l){if(r(!o.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var d,u,v;return this.negative!==0&&o.negative===0?(v=this.neg().divmod(o,s),s!=="mod"&&(d=v.div.neg()),s!=="div"&&(u=v.mod.neg(),l&&u.negative!==0&&u.iadd(o)),{div:d,mod:u}):this.negative===0&&o.negative!==0?(v=this.divmod(o.neg(),s),s!=="mod"&&(d=v.div.neg()),{div:d,mod:v.mod}):(this.negative&o.negative)!==0?(v=this.neg().divmod(o.neg(),s),s!=="div"&&(u=v.mod.neg(),l&&u.negative!==0&&u.isub(o)),{div:v.div,mod:u}):o.length>this.length||this.cmp(o)<0?{div:new i(0),mod:this}:o.length===1?s==="div"?{div:this.divn(o.words[0]),mod:null}:s==="mod"?{div:null,mod:new i(this.modrn(o.words[0]))}:{div:this.divn(o.words[0]),mod:new i(this.modrn(o.words[0]))}:this._wordDiv(o,s)},i.prototype.div=function(o){return this.divmod(o,"div",!1).div},i.prototype.mod=function(o){return this.divmod(o,"mod",!1).mod},i.prototype.umod=function(o){return this.divmod(o,"mod",!0).mod},i.prototype.divRound=function(o){var s=this.divmod(o);if(s.mod.isZero())return s.div;var l=s.div.negative!==0?s.mod.isub(o):s.mod,d=o.ushrn(1),u=o.andln(1),v=l.cmp(d);return v<0||u===1&&v===0?s.div:s.div.negative!==0?s.div.isubn(1):s.div.iaddn(1)},i.prototype.modrn=function(o){var s=o<0;s&&(o=-o),r(o<=67108863);for(var l=(1<<26)%o,d=0,u=this.length-1;u>=0;u--)d=(l*d+(this.words[u]|0))%o;return s?-d:d},i.prototype.modn=function(o){return this.modrn(o)},i.prototype.idivn=function(o){var s=o<0;s&&(o=-o),r(o<=67108863);for(var l=0,d=this.length-1;d>=0;d--){var u=(this.words[d]|0)+l*67108864;this.words[d]=u/o|0,l=u%o}return this._strip(),s?this.ineg():this},i.prototype.divn=function(o){return this.clone().idivn(o)},i.prototype.egcd=function(o){r(o.negative===0),r(!o.isZero());var s=this,l=o.clone();s.negative!==0?s=s.umod(o):s=s.clone();for(var d=new i(1),u=new i(0),v=new i(0),b=new i(1),p=0;s.isEven()&&l.isEven();)s.iushrn(1),l.iushrn(1),++p;for(var a=l.clone(),m=s.clone();!s.isZero();){for(var k=0,R=1;(s.words[0]&R)===0&&k<26;++k,R<<=1);if(k>0)for(s.iushrn(k);k-- >0;)(d.isOdd()||u.isOdd())&&(d.iadd(a),u.isub(m)),d.iushrn(1),u.iushrn(1);for(var N=0,H=1;(l.words[0]&H)===0&&N<26;++N,H<<=1);if(N>0)for(l.iushrn(N);N-- >0;)(v.isOdd()||b.isOdd())&&(v.iadd(a),b.isub(m)),v.iushrn(1),b.iushrn(1);s.cmp(l)>=0?(s.isub(l),d.isub(v),u.isub(b)):(l.isub(s),v.isub(d),b.isub(u))}return{a:v,b,gcd:l.iushln(p)}},i.prototype._invmp=function(o){r(o.negative===0),r(!o.isZero());var s=this,l=o.clone();s.negative!==0?s=s.umod(o):s=s.clone();for(var d=new i(1),u=new i(0),v=l.clone();s.cmpn(1)>0&&l.cmpn(1)>0;){for(var b=0,p=1;(s.words[0]&p)===0&&b<26;++b,p<<=1);if(b>0)for(s.iushrn(b);b-- >0;)d.isOdd()&&d.iadd(v),d.iushrn(1);for(var a=0,m=1;(l.words[0]&m)===0&&a<26;++a,m<<=1);if(a>0)for(l.iushrn(a);a-- >0;)u.isOdd()&&u.iadd(v),u.iushrn(1);s.cmp(l)>=0?(s.isub(l),d.isub(u)):(l.isub(s),u.isub(d))}var k;return s.cmpn(1)===0?k=d:k=u,k.cmpn(0)<0&&k.iadd(o),k},i.prototype.gcd=function(o){if(this.isZero())return o.abs();if(o.isZero())return this.abs();var s=this.clone(),l=o.clone();s.negative=0,l.negative=0;for(var d=0;s.isEven()&&l.isEven();d++)s.iushrn(1),l.iushrn(1);do{for(;s.isEven();)s.iushrn(1);for(;l.isEven();)l.iushrn(1);var u=s.cmp(l);if(u<0){var v=s;s=l,l=v}else if(u===0||l.cmpn(1)===0)break;s.isub(l)}while(!0);return l.iushln(d)},i.prototype.invm=function(o){return this.egcd(o).a.umod(o)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(o){return this.words[0]&o},i.prototype.bincn=function(o){r(typeof o=="number");var s=o%26,l=(o-s)/26,d=1<<s;if(this.length<=l)return this._expand(l+1),this.words[l]|=d,this;for(var u=d,v=l;u!==0&&v<this.length;v++){var b=this.words[v]|0;b+=u,u=b>>>26,b&=67108863,this.words[v]=b}return u!==0&&(this.words[v]=u,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(o){var s=o<0;if(this.negative!==0&&!s)return-1;if(this.negative===0&&s)return 1;this._strip();var l;if(this.length>1)l=1;else{s&&(o=-o),r(o<=67108863,"Number is too big");var d=this.words[0]|0;l=d===o?0:d<o?-1:1}return this.negative!==0?-l|0:l},i.prototype.cmp=function(o){if(this.negative!==0&&o.negative===0)return-1;if(this.negative===0&&o.negative!==0)return 1;var s=this.ucmp(o);return this.negative!==0?-s|0:s},i.prototype.ucmp=function(o){if(this.length>o.length)return 1;if(this.length<o.length)return-1;for(var s=0,l=this.length-1;l>=0;l--){var d=this.words[l]|0,u=o.words[l]|0;if(d!==u){d<u?s=-1:d>u&&(s=1);break}}return s},i.prototype.gtn=function(o){return this.cmpn(o)===1},i.prototype.gt=function(o){return this.cmp(o)===1},i.prototype.gten=function(o){return this.cmpn(o)>=0},i.prototype.gte=function(o){return this.cmp(o)>=0},i.prototype.ltn=function(o){return this.cmpn(o)===-1},i.prototype.lt=function(o){return this.cmp(o)===-1},i.prototype.lten=function(o){return this.cmpn(o)<=0},i.prototype.lte=function(o){return this.cmp(o)<=0},i.prototype.eqn=function(o){return this.cmpn(o)===0},i.prototype.eq=function(o){return this.cmp(o)===0},i.red=function(o){return new F(o)},i.prototype.toRed=function(o){return r(!this.red,"Already a number in reduction context"),r(this.negative===0,"red works only with positives"),o.convertTo(this)._forceRed(o)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(o){return this.red=o,this},i.prototype.forceRed=function(o){return r(!this.red,"Already a number in reduction context"),this._forceRed(o)},i.prototype.redAdd=function(o){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,o)},i.prototype.redIAdd=function(o){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,o)},i.prototype.redSub=function(o){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,o)},i.prototype.redISub=function(o){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,o)},i.prototype.redShl=function(o){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,o)},i.prototype.redMul=function(o){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.mul(this,o)},i.prototype.redIMul=function(o){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.imul(this,o)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(o){return r(this.red&&!o.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,o)};var K={k256:null,p224:null,p192:null,p25519:null};function Y(h,o){this.name=h,this.p=new i(o,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}Y.prototype._tmp=function(){var o=new i(null);return o.words=new Array(Math.ceil(this.n/13)),o},Y.prototype.ireduce=function(o){var s=o,l;do this.split(s,this.tmp),s=this.imulK(s),s=s.iadd(this.tmp),l=s.bitLength();while(l>this.n);var d=l<this.n?-1:s.ucmp(this.p);return d===0?(s.words[0]=0,s.length=1):d>0?s.isub(this.p):s.strip!==void 0?s.strip():s._strip(),s},Y.prototype.split=function(o,s){o.iushrn(this.n,0,s)},Y.prototype.imulK=function(o){return o.imul(this.k)};function ee(){Y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}n(ee,Y),ee.prototype.split=function(o,s){for(var l=4194303,d=Math.min(o.length,9),u=0;u<d;u++)s.words[u]=o.words[u];if(s.length=d,o.length<=9){o.words[0]=0,o.length=1;return}var v=o.words[9];for(s.words[s.length++]=v&l,u=10;u<o.length;u++){var b=o.words[u]|0;o.words[u-10]=(b&l)<<4|v>>>22,v=b}v>>>=22,o.words[u-10]=v,v===0&&o.length>10?o.length-=10:o.length-=9},ee.prototype.imulK=function(o){o.words[o.length]=0,o.words[o.length+1]=0,o.length+=2;for(var s=0,l=0;l<o.length;l++){var d=o.words[l]|0;s+=d*977,o.words[l]=s&67108863,s=d*64+(s/67108864|0)}return o.words[o.length-1]===0&&(o.length--,o.words[o.length-1]===0&&o.length--),o};function ze(){Y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}n(ze,Y);function Ze(){Y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}n(Ze,Y);function ie(){Y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}n(ie,Y),ie.prototype.imulK=function(o){for(var s=0,l=0;l<o.length;l++){var d=(o.words[l]|0)*19+s,u=d&67108863;d>>>=26,o.words[l]=u,s=d}return s!==0&&(o.words[o.length++]=s),o},i._prime=function(o){if(K[o])return K[o];var s;if(o==="k256")s=new ee;else if(o==="p224")s=new ze;else if(o==="p192")s=new Ze;else if(o==="p25519")s=new ie;else throw new Error("Unknown prime "+o);return K[o]=s,s};function F(h){if(typeof h=="string"){var o=i._prime(h);this.m=o.p,this.prime=o}else r(h.gtn(1),"modulus must be greater than 1"),this.m=h,this.prime=null}F.prototype._verify1=function(o){r(o.negative===0,"red works only with positives"),r(o.red,"red works only with red numbers")},F.prototype._verify2=function(o,s){r((o.negative|s.negative)===0,"red works only with positives"),r(o.red&&o.red===s.red,"red works only with red numbers")},F.prototype.imod=function(o){return this.prime?this.prime.ireduce(o)._forceRed(this):(w(o,o.umod(this.m)._forceRed(this)),o)},F.prototype.neg=function(o){return o.isZero()?o.clone():this.m.sub(o)._forceRed(this)},F.prototype.add=function(o,s){this._verify2(o,s);var l=o.add(s);return l.cmp(this.m)>=0&&l.isub(this.m),l._forceRed(this)},F.prototype.iadd=function(o,s){this._verify2(o,s);var l=o.iadd(s);return l.cmp(this.m)>=0&&l.isub(this.m),l},F.prototype.sub=function(o,s){this._verify2(o,s);var l=o.sub(s);return l.cmpn(0)<0&&l.iadd(this.m),l._forceRed(this)},F.prototype.isub=function(o,s){this._verify2(o,s);var l=o.isub(s);return l.cmpn(0)<0&&l.iadd(this.m),l},F.prototype.shl=function(o,s){return this._verify1(o),this.imod(o.ushln(s))},F.prototype.imul=function(o,s){return this._verify2(o,s),this.imod(o.imul(s))},F.prototype.mul=function(o,s){return this._verify2(o,s),this.imod(o.mul(s))},F.prototype.isqr=function(o){return this.imul(o,o.clone())},F.prototype.sqr=function(o){return this.mul(o,o)},F.prototype.sqrt=function(o){if(o.isZero())return o.clone();var s=this.m.andln(3);if(r(s%2===1),s===3){var l=this.m.add(new i(1)).iushrn(2);return this.pow(o,l)}for(var d=this.m.subn(1),u=0;!d.isZero()&&d.andln(1)===0;)u++,d.iushrn(1);r(!d.isZero());var v=new i(1).toRed(this),b=v.redNeg(),p=this.m.subn(1).iushrn(1),a=this.m.bitLength();for(a=new i(2*a*a).toRed(this);this.pow(a,p).cmp(b)!==0;)a.redIAdd(b);for(var m=this.pow(a,d),k=this.pow(o,d.addn(1).iushrn(1)),R=this.pow(o,d),N=u;R.cmp(v)!==0;){for(var H=R,x=0;H.cmp(v)!==0;x++)H=H.redSqr();r(x<N);var C=this.pow(m,new i(1).iushln(N-x-1));k=k.redMul(C),m=C.redSqr(),R=R.redMul(m),N=x}return k},F.prototype.invm=function(o){var s=o._invmp(this.m);return s.negative!==0?(s.negative=0,this.imod(s).redNeg()):this.imod(s)},F.prototype.pow=function(o,s){if(s.isZero())return new i(1).toRed(this);if(s.cmpn(1)===0)return o.clone();var l=4,d=new Array(1<<l);d[0]=new i(1).toRed(this),d[1]=o;for(var u=2;u<d.length;u++)d[u]=this.mul(d[u-1],o);var v=d[0],b=0,p=0,a=s.bitLength()%26;for(a===0&&(a=26),u=s.length-1;u>=0;u--){for(var m=s.words[u],k=a-1;k>=0;k--){var R=m>>k&1;if(v!==d[0]&&(v=this.sqr(v)),R===0&&b===0){p=0;continue}b<<=1,b|=R,p++,!(p!==l&&(u!==0||k!==0))&&(v=this.mul(v,d[b]),p=0,b=0)}a=26}return v},F.prototype.convertTo=function(o){var s=o.umod(this.m);return s===o?s.clone():s},F.prototype.convertFrom=function(o){var s=o.clone();return s.red=null,s},i.mont=function(o){return new z(o)};function z(h){F.call(this,h),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}n(z,F),z.prototype.convertTo=function(o){return this.imod(o.ushln(this.shift))},z.prototype.convertFrom=function(o){var s=this.imod(o.mul(this.rinv));return s.red=null,s},z.prototype.imul=function(o,s){if(o.isZero()||s.isZero())return o.words[0]=0,o.length=1,o;var l=o.imul(s),d=l.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),u=l.isub(d).iushrn(this.shift),v=u;return u.cmp(this.m)>=0?v=u.isub(this.m):u.cmpn(0)<0&&(v=u.iadd(this.m)),v._forceRed(this)},z.prototype.mul=function(o,s){if(o.isZero()||s.isZero())return new i(0)._forceRed(this);var l=o.mul(s),d=l.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),u=l.isub(d).iushrn(this.shift),v=u;return u.cmp(this.m)>=0?v=u.isub(this.m):u.cmpn(0)<0&&(v=u.iadd(this.m)),v._forceRed(this)},z.prototype.invm=function(o){var s=this.imod(o._invmp(this.m).mul(this.r2));return s._forceRed(this)}})(typeof Ui>"u"||Ui,il)});var gn=kt((Jg,mn)=>{var Ll,kl,Rl,Wl,Il,Nl,Ol,Dl,Ul,pn,Ki,Bl,Fl,Gl,qr,Hl,Vl,ql,$l,zl,Zl,jl,Kl,Jl,hn;(function(e){var t=typeof global=="object"?global:typeof self=="object"?self:typeof this=="object"?this:{};typeof define=="function"&&define.amd?define("tslib",["exports"],function(n){e(r(t,r(n)))}):typeof mn=="object"&&typeof mn.exports=="object"?e(r(t,r(mn.exports))):e(r(t));function r(n,i){return n!==t&&(typeof Object.create=="function"?Object.defineProperty(n,"__esModule",{value:!0}):n.__esModule=!0),function(c,f){return n[c]=i?i(c,f):f}}})(function(e){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var c in i)Object.prototype.hasOwnProperty.call(i,c)&&(n[c]=i[c])};Ll=function(n,i){if(typeof i!="function"&&i!==null)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");t(n,i);function c(){this.constructor=n}n.prototype=i===null?Object.create(i):(c.prototype=i.prototype,new c)},kl=Object.assign||function(n){for(var i,c=1,f=arguments.length;c<f;c++){i=arguments[c];for(var g in i)Object.prototype.hasOwnProperty.call(i,g)&&(n[g]=i[g])}return n},Rl=function(n,i){var c={};for(var f in n)Object.prototype.hasOwnProperty.call(n,f)&&i.indexOf(f)<0&&(c[f]=n[f]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var g=0,f=Object.getOwnPropertySymbols(n);g<f.length;g++)i.indexOf(f[g])<0&&Object.prototype.propertyIsEnumerable.call(n,f[g])&&(c[f[g]]=n[f[g]]);return c},Wl=function(n,i,c,f){var g=arguments.length,y=g<3?i:f===null?f=Object.getOwnPropertyDescriptor(i,c):f,w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(n,i,c,f);else for(var A=n.length-1;A>=0;A--)(w=n[A])&&(y=(g<3?w(y):g>3?w(i,c,y):w(i,c))||y);return g>3&&y&&Object.defineProperty(i,c,y),y},Il=function(n,i){return function(c,f){i(c,f,n)}},Nl=function(n,i){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,i)},Ol=function(n,i,c,f){function g(y){return y instanceof c?y:new c(function(w){w(y)})}return new(c||(c=Promise))(function(y,w){function A(T){try{_(f.next(T))}catch(M){w(M)}}function P(T){try{_(f.throw(T))}catch(M){w(M)}}function _(T){T.done?y(T.value):g(T.value).then(A,P)}_((f=f.apply(n,i||[])).next())})},Dl=function(n,i){var c={label:0,sent:function(){if(y[0]&1)throw y[1];return y[1]},trys:[],ops:[]},f,g,y,w;return w={next:A(0),throw:A(1),return:A(2)},typeof Symbol=="function"&&(w[Symbol.iterator]=function(){return this}),w;function A(_){return function(T){return P([_,T])}}function P(_){if(f)throw new TypeError("Generator is already executing.");for(;c;)try{if(f=1,g&&(y=_[0]&2?g.return:_[0]?g.throw||((y=g.return)&&y.call(g),0):g.next)&&!(y=y.call(g,_[1])).done)return y;switch(g=0,y&&(_=[_[0]&2,y.value]),_[0]){case 0:case 1:y=_;break;case 4:return c.label++,{value:_[1],done:!1};case 5:c.label++,g=_[1],_=[0];continue;case 7:_=c.ops.pop(),c.trys.pop();continue;default:if(y=c.trys,!(y=y.length>0&&y[y.length-1])&&(_[0]===6||_[0]===2)){c=0;continue}if(_[0]===3&&(!y||_[1]>y[0]&&_[1]<y[3])){c.label=_[1];break}if(_[0]===6&&c.label<y[1]){c.label=y[1],y=_;break}if(y&&c.label<y[2]){c.label=y[2],c.ops.push(_);break}y[2]&&c.ops.pop(),c.trys.pop();continue}_=i.call(n,c)}catch(T){_=[6,T],g=0}finally{f=y=0}if(_[0]&5)throw _[1];return{value:_[0]?_[1]:void 0,done:!0}}},Ul=function(n,i){for(var c in n)c!=="default"&&!Object.prototype.hasOwnProperty.call(i,c)&&hn(i,n,c)},hn=Object.create?function(n,i,c,f){f===void 0&&(f=c);var g=Object.getOwnPropertyDescriptor(i,c);(!g||("get"in g?!i.__esModule:g.writable||g.configurable))&&(g={enumerable:!0,get:function(){return i[c]}}),Object.defineProperty(n,f,g)}:function(n,i,c,f){f===void 0&&(f=c),n[f]=i[c]},pn=function(n){var i=typeof Symbol=="function"&&Symbol.iterator,c=i&&n[i],f=0;if(c)return c.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&f>=n.length&&(n=void 0),{value:n&&n[f++],done:!n}}};throw new TypeError(i?"Object is not iterable.":"Symbol.iterator is not defined.")},Ki=function(n,i){var c=typeof Symbol=="function"&&n[Symbol.iterator];if(!c)return n;var f=c.call(n),g,y=[],w;try{for(;(i===void 0||i-- >0)&&!(g=f.next()).done;)y.push(g.value)}catch(A){w={error:A}}finally{try{g&&!g.done&&(c=f.return)&&c.call(f)}finally{if(w)throw w.error}}return y},Bl=function(){for(var n=[],i=0;i<arguments.length;i++)n=n.concat(Ki(arguments[i]));return n},Fl=function(){for(var n=0,i=0,c=arguments.length;i<c;i++)n+=arguments[i].length;for(var f=Array(n),g=0,i=0;i<c;i++)for(var y=arguments[i],w=0,A=y.length;w<A;w++,g++)f[g]=y[w];return f},Gl=function(n,i,c){if(c||arguments.length===2)for(var f=0,g=i.length,y;f<g;f++)(y||!(f in i))&&(y||(y=Array.prototype.slice.call(i,0,f)),y[f]=i[f]);return n.concat(y||Array.prototype.slice.call(i))},qr=function(n){return this instanceof qr?(this.v=n,this):new qr(n)},Hl=function(n,i,c){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var f=c.apply(n,i||[]),g,y=[];return g={},w("next"),w("throw"),w("return"),g[Symbol.asyncIterator]=function(){return this},g;function w(E){f[E]&&(g[E]=function(S){return new Promise(function(L,G){y.push([E,S,L,G])>1||A(E,S)})})}function A(E,S){try{P(f[E](S))}catch(L){M(y[0][3],L)}}function P(E){E.value instanceof qr?Promise.resolve(E.value.v).then(_,T):M(y[0][2],E)}function _(E){A("next",E)}function T(E){A("throw",E)}function M(E,S){E(S),y.shift(),y.length&&A(y[0][0],y[0][1])}},Vl=function(n){var i,c;return i={},f("next"),f("throw",function(g){throw g}),f("return"),i[Symbol.iterator]=function(){return this},i;function f(g,y){i[g]=n[g]?function(w){return(c=!c)?{value:qr(n[g](w)),done:g==="return"}:y?y(w):w}:y}},ql=function(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=n[Symbol.asyncIterator],c;return i?i.call(n):(n=typeof pn=="function"?pn(n):n[Symbol.iterator](),c={},f("next"),f("throw"),f("return"),c[Symbol.asyncIterator]=function(){return this},c);function f(y){c[y]=n[y]&&function(w){return new Promise(function(A,P){w=n[y](w),g(A,P,w.done,w.value)})}}function g(y,w,A,P){Promise.resolve(P).then(function(_){y({value:_,done:A})},w)}},$l=function(n,i){return Object.defineProperty?Object.defineProperty(n,"raw",{value:i}):n.raw=i,n};var r=Object.create?function(n,i){Object.defineProperty(n,"default",{enumerable:!0,value:i})}:function(n,i){n.default=i};zl=function(n){if(n&&n.__esModule)return n;var i={};if(n!=null)for(var c in n)c!=="default"&&Object.prototype.hasOwnProperty.call(n,c)&&hn(i,n,c);return r(i,n),i},Zl=function(n){return n&&n.__esModule?n:{default:n}},jl=function(n,i,c,f){if(c==="a"&&!f)throw new TypeError("Private accessor was defined without a getter");if(typeof i=="function"?n!==i||!f:!i.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return c==="m"?f:c==="a"?f.call(n):f?f.value:i.get(n)},Kl=function(n,i,c,f,g){if(f==="m")throw new TypeError("Private method is not writable");if(f==="a"&&!g)throw new TypeError("Private accessor was defined without a setter");if(typeof i=="function"?n!==i||!g:!i.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return f==="a"?g.call(n,c):g?g.value=c:i.set(n,c),c},Jl=function(n,i){if(i===null||typeof i!="object"&&typeof i!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof n=="function"?i===n:n.has(i)},e("__extends",Ll),e("__assign",kl),e("__rest",Rl),e("__decorate",Wl),e("__param",Il),e("__metadata",Nl),e("__awaiter",Ol),e("__generator",Dl),e("__exportStar",Ul),e("__createBinding",hn),e("__values",pn),e("__read",Ki),e("__spread",Bl),e("__spreadArrays",Fl),e("__spreadArray",Gl),e("__await",qr),e("__asyncGenerator",Hl),e("__asyncDelegator",Vl),e("__asyncValues",ql),e("__makeTemplateObject",$l),e("__importStar",zl),e("__importDefault",Zl),e("__classPrivateFieldGet",jl),e("__classPrivateFieldSet",Kl),e("__classPrivateFieldIn",Jl)})});var Ji=kt(ae=>{"use strict";Object.defineProperty(ae,"__esModule",{value:!0});ae.getLocalStorage=ae.getLocalStorageOrThrow=ae.getCrypto=ae.getCryptoOrThrow=ae.getLocation=ae.getLocationOrThrow=ae.getNavigator=ae.getNavigatorOrThrow=ae.getDocument=ae.getDocumentOrThrow=ae.getFromWindowOrThrow=ae.getFromWindow=void 0;function br(e){let t;return typeof window<"u"&&typeof window[e]<"u"&&(t=window[e]),t}ae.getFromWindow=br;function $r(e){let t=br(e);if(!t)throw new Error(`${e} is not defined in Window`);return t}ae.getFromWindowOrThrow=$r;function v0(){return $r("document")}ae.getDocumentOrThrow=v0;function y0(){return br("document")}ae.getDocument=y0;function b0(){return $r("navigator")}ae.getNavigatorOrThrow=b0;function w0(){return br("navigator")}ae.getNavigator=w0;function C0(){return $r("location")}ae.getLocationOrThrow=C0;function x0(){return br("location")}ae.getLocation=x0;function E0(){return $r("crypto")}ae.getCryptoOrThrow=E0;function _0(){return br("crypto")}ae.getCrypto=_0;function P0(){return $r("localStorage")}ae.getLocalStorageOrThrow=P0;function A0(){return br("localStorage")}ae.getLocalStorage=A0});var Ql=kt(vn=>{"use strict";Object.defineProperty(vn,"__esModule",{value:!0});vn.getWindowMetadata=void 0;var Yl=Ji();function S0(){let e,t;try{e=Yl.getDocumentOrThrow(),t=Yl.getLocationOrThrow()}catch{return null}function r(){let P=e.getElementsByTagName("link"),_=[];for(let T=0;T<P.length;T++){let M=P[T],E=M.getAttribute("rel");if(E&&E.toLowerCase().indexOf("icon")>-1){let S=M.getAttribute("href");if(S)if(S.toLowerCase().indexOf("https:")===-1&&S.toLowerCase().indexOf("http:")===-1&&S.indexOf("//")!==0){let L=t.protocol+"//"+t.host;if(S.indexOf("/")===0)L+=S;else{let G=t.pathname.split("/");G.pop(),L+=G.join("/")+"/"+S}_.push(L)}else if(S.indexOf("//")===0){let L=t.protocol+S;_.push(L)}else _.push(S)}}return _}function n(...P){let _=e.getElementsByTagName("meta");for(let T=0;T<_.length;T++){let M=_[T],E=["itemprop","property","name"].map(S=>M.getAttribute(S)).filter(S=>S?P.includes(S):!1);if(E.length&&E){let S=M.getAttribute("content");if(S)return S}}return""}function i(){let P=n("name","og:site_name","og:title","twitter:title");return P||(P=e.title),P}function c(){return n("description","og:description","twitter:description","keywords")}let f=i(),g=c(),y=t.origin,w=r();return{description:g,url:y,icons:w,name:f}}vn.getWindowMetadata=S0});var cc={};Ps(cc,{BotInfo:()=>nc,BrowserInfo:()=>tc,NodeInfo:()=>rc,ReactNativeInfo:()=>ic,SearchBotDeviceInfo:()=>oc,browserName:()=>W0,detect:()=>R0,detectOS:()=>sc,getNodeVersion:()=>lc,parseUserAgent:()=>Yi});function R0(e){return e?Yi(e):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new ic:typeof navigator<"u"?Yi(navigator.userAgent):lc()}function ac(e){return e!==""&&k0.reduce(function(t,r){var n=r[0],i=r[1];if(t)return t;var c=i.exec(e);return!!c&&[n,c]},!1)}function W0(e){var t=ac(e);return t?t[0]:null}function Yi(e){var t=ac(e);if(!t)return null;var r=t[0],n=t[1];if(r==="searchbot")return new nc;var i=n[1]&&n[1].split(/[._]/).slice(0,3);i?i.length<Xl&&(i=T0(i,I0(Xl-i.length))):i=[];var c=i.join("."),f=sc(e),g=L0.exec(e);return g&&g[1]?new oc(r,c,f,g[1]):new tc(r,c,f)}function sc(e){for(var t=0,r=ec.length;t<r;t++){var n=ec[t],i=n[0],c=n[1],f=c.exec(e);if(f)return i}return null}function lc(){var e=typeof process<"u"&&process.version;return e?new rc(process.version.slice(1)):null}function I0(e){for(var t=[],r=0;r<e;r++)t.push("0");return t}var T0,tc,rc,oc,nc,ic,M0,L0,Xl,k0,ec,dc=_s(()=>{T0=function(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;for(var n=Array(e),i=0,t=0;t<r;t++)for(var c=arguments[t],f=0,g=c.length;f<g;f++,i++)n[i]=c[f];return n},tc=function(){function e(t,r,n){this.name=t,this.version=r,this.os=n,this.type="browser"}return e}(),rc=function(){function e(t){this.version=t,this.type="node",this.name="node",this.os=process.platform}return e}(),oc=function(){function e(t,r,n,i){this.name=t,this.version=r,this.os=n,this.bot=i,this.type="bot-device"}return e}(),nc=function(){function e(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return e}(),ic=function(){function e(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return e}(),M0=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,L0=/(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,Xl=3,k0=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/EdgA?\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FBAV\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["searchbot",M0]],ec=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]]});var Xi=kt(j=>{"use strict";Object.defineProperty(j,"__esModule",{value:!0});j.getClientMeta=j.getLocalStorage=j.getLocalStorageOrThrow=j.getCrypto=j.getCryptoOrThrow=j.getLocation=j.getLocationOrThrow=j.getNavigator=j.getNavigatorOrThrow=j.getDocument=j.getDocumentOrThrow=j.getFromWindowOrThrow=j.getFromWindow=j.isBrowser=j.isNode=j.isMobile=j.isIOS=j.isAndroid=j.detectOS=j.detectEnv=void 0;var uc=gn(),N0=uc.__importStar(Ql()),Pt=uc.__importStar(Ji()),O0=(dc(),Ts(cc));function Qi(e){return(0,O0.detect)(e)}j.detectEnv=Qi;function yn(){let e=Qi();return e&&e.os?e.os:void 0}j.detectOS=yn;function fc(){let e=yn();return e?e.toLowerCase().includes("android"):!1}j.isAndroid=fc;function pc(){let e=yn();return e?e.toLowerCase().includes("ios")||e.toLowerCase().includes("mac")&&navigator.maxTouchPoints>1:!1}j.isIOS=pc;function D0(){return yn()?fc()||pc():!1}j.isMobile=D0;function hc(){let e=Qi();return e&&e.name?e.name.toLowerCase()==="node":!1}j.isNode=hc;function U0(){return!hc()&&!!(0,j.getNavigator)()}j.isBrowser=U0;j.getFromWindow=Pt.getFromWindow;j.getFromWindowOrThrow=Pt.getFromWindowOrThrow;j.getDocumentOrThrow=Pt.getDocumentOrThrow;j.getDocument=Pt.getDocument;j.getNavigatorOrThrow=Pt.getNavigatorOrThrow;j.getNavigator=Pt.getNavigator;j.getLocationOrThrow=Pt.getLocationOrThrow;j.getLocation=Pt.getLocation;j.getCryptoOrThrow=Pt.getCryptoOrThrow;j.getCrypto=Pt.getCrypto;j.getLocalStorageOrThrow=Pt.getLocalStorageOrThrow;j.getLocalStorage=Pt.getLocalStorage;function B0(){return N0.getWindowMetadata()}j.getClientMeta=B0});var mc={};Ps(mc,{safeJsonParse:()=>F0,safeJsonStringify:()=>G0});function F0(e){if(typeof e!="string")throw new Error(`Cannot safe json parse value of type ${typeof e}`);try{return JSON.parse(e)}catch{return e}}function G0(e){return typeof e=="string"?e:JSON.stringify(e)}var gc=_s(()=>{});var ea=kt(zr=>{"use strict";Object.defineProperty(zr,"__esModule",{value:!0});zr.safeJsonStringify=zr.safeJsonParse=void 0;var H0=gn(),vc=H0.__importStar((gc(),Ts(mc)));zr.safeJsonParse=vc.safeJsonParse;zr.safeJsonStringify=vc.safeJsonStringify});var ra=kt(ir=>{"use strict";Object.defineProperty(ir,"__esModule",{value:!0});ir.removeLocal=ir.getLocal=ir.setLocal=void 0;var yc=ea(),ta=Xi();function V0(e,t){let r=(0,yc.safeJsonStringify)(t),n=(0,ta.getLocalStorage)();n&&n.setItem(e,r)}ir.setLocal=V0;function q0(e){let t=null,r=null,n=(0,ta.getLocalStorage)();return n&&(r=n.getItem(e)),t=r&&(0,yc.safeJsonParse)(r),t}ir.getLocal=q0;function $0(e){let t=(0,ta.getLocalStorage)();t&&t.removeItem(e)}ir.removeLocal=$0});var wc=kt(pt=>{"use strict";Object.defineProperty(pt,"__esModule",{value:!0});pt.getMobileLinkRegistry=pt.getMobileRegistryEntry=pt.saveMobileLinkInfo=pt.formatIOSMobile=pt.mobileLinkChoiceKey=void 0;var z0=ra();pt.mobileLinkChoiceKey="WALLETCONNECT_DEEPLINK_CHOICE";function Z0(e,t){let r=encodeURIComponent(e);return t.universalLink?`${t.universalLink}/wc?uri=${r}`:t.deepLink?`${t.deepLink}${t.deepLink.endsWith(":")?"//":"/"}wc?uri=${r}`:""}pt.formatIOSMobile=Z0;function j0(e){let t=e.href.split("?")[0];(0,z0.setLocal)(pt.mobileLinkChoiceKey,Object.assign(Object.assign({},e),{href:t}))}pt.saveMobileLinkInfo=j0;function bc(e,t){return e.filter(r=>r.name.toLowerCase().includes(t.toLowerCase()))[0]}pt.getMobileRegistryEntry=bc;function K0(e,t){let r=e;return t&&(r=t.map(n=>bc(e,n)).filter(Boolean)),r}pt.getMobileLinkRegistry=K0});var Ec=kt(It=>{"use strict";Object.defineProperty(It,"__esModule",{value:!0});It.formatMobileRegistry=It.formatMobileRegistryEntry=It.getDappRegistryUrl=It.getWalletRegistryUrl=void 0;var Cc="https://registry.walletconnect.com";function J0(){return Cc+"/api/v2/wallets"}It.getWalletRegistryUrl=J0;function Y0(){return Cc+"/api/v2/dapps"}It.getDappRegistryUrl=Y0;function xc(e,t="mobile"){var r;return{name:e.name||"",shortName:e.metadata.shortName||"",color:e.metadata.colors.primary||"",logo:(r=e.image_url.sm)!==null&&r!==void 0?r:"",universalLink:e[t].universal||"",deepLink:e[t].native||""}}It.formatMobileRegistryEntry=xc;function Q0(e,t="mobile"){return Object.values(e).filter(r=>!!r[t].universal||!!r[t].native).map(r=>xc(r,t))}It.formatMobileRegistry=Q0});var _c=kt(wr=>{"use strict";Object.defineProperty(wr,"__esModule",{value:!0});var Co=gn();Co.__exportStar(Xi(),wr);Co.__exportStar(ea(),wr);Co.__exportStar(ra(),wr);Co.__exportStar(wc(),wr);Co.__exportStar(Ec(),wr)});import{Web3Provider as F2}from"@ethersproject/providers";import{useEffect as pi,useState as rt}from"react";var O=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};import Ou from"axios";var St=class extends Error{constructor(r,n,i){super(r);n instanceof Error&&(this.cause=n),this.privyErrorCode=i}toString(){return`${this.type}${this.privyErrorCode?`-${this.privyErrorCode}`:""}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}},Nr=class extends St{constructor(r,n,i,c,f){super(i,c,f);this.type=r;this.status=n}},D=class extends St{constructor(r,n,i){super(r,n,i);this.type="client_error"}};var de=class extends St{constructor(r,n,i){super(r,n,i);this.type="connector_error"}},je=e=>{if(e instanceof St)return e;if(!Ou.isAxiosError(e))return yt(e);if(!e.response)return new Nr("api_error",null,e.message,e);let{type:t,message:r,error:n,code:i}=e.response.data;return new Nr(t||"ApiError",e.response.status,r||n,e,i)},yt=e=>e instanceof St?e:e instanceof Error?new D(e.message,e):new D(`Internal error: ${e}`);var Ms=()=>"/api/v1/sessions",Ls=()=>"/api/v1/sessions/logout",ks=()=>"/api/v1/sessions/fork",Rs=()=>"/api/v1/sessions/fork/recover",Ws=()=>"/api/v1/siwe/init",Is=()=>"/api/v1/siwe/authenticate",Ns=()=>"/api/v1/siwe/link",Os=()=>"/api/v1/passwordless/init",Ds=()=>"/api/v1/passwordless/authenticate",Us=()=>"/api/v1/passwordless/link",Bs=()=>"/api/v1/passwordless_sms/init",Fs=()=>"/api/v1/passwordless_sms/authenticate",Gs=()=>"/api/v1/passwordless_sms/link",Hs=()=>"/api/v1/oauth/init",Vs=()=>"/api/v1/oauth/authenticate",qs=()=>"/api/v1/oauth/link",$s=()=>"/api/v1/siwe/unlink",zs=()=>"/api/v1/passwordless/unlink",Zs=()=>"/api/v1/passwordless_sms/unlink",js=()=>"/api/v1/oauth/unlink",Ks=()=>"/api/v1/analytics_events";var pr=class{constructor(t){this.meta={email:t}}async authenticate(){if(!this.api)throw new D("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new D("Email and email code must be set prior to calling authenticate.");try{let t=Ds(),r=await this.api.post(t,{email:this.meta.email,code:this.meta.emailCode});return{user:r.data.user,token:r.data.token,refresh_token:r.data.refresh_token,is_new_user:r.data.is_new_user}}catch(t){throw je(t)}}async link(){if(!this.api)throw new D("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new D("Email and email code must be set prior to calling authenticate.");try{let t=Us();return(await this.api.post(t,{email:this.meta.email,code:this.meta.emailCode})).data}catch(t){throw je(t)}}async sendCodeEmail(t){if(!this.api)throw new D("Auth flow has no API instance");if(t&&(this.meta.email=t),!this.meta.email)throw new D("Email must be set when initialzing authentication.");try{let r=Os();return(await this.api.post(r,{email:this.meta.email})).data}catch(r){throw je(r)}}};var tr=class{constructor(t,r,n){this.meta={provider:t},this.meta.authorizationCode=r,this.meta.stateCode=n}isActive(){return!!(this.meta.authorizationCode&&this.meta.stateCode&&this.meta.provider)}async authenticate(){if(!this.api)throw new D("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new D("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new D("User denied confirmation during OAuth flow");try{let t=Vs(),r=await this.api.post(t,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode});return{user:r.data.user,token:r.data.token,refresh_token:r.data.refresh_token,is_new_user:r.data.is_new_user}}catch(t){throw je(t)}}async link(){if(!this.api)throw new D("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new D("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new D("User denied confirmation during OAuth flow");try{let t=qs();return(await this.api.post(t,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode})).data}catch(t){throw je(t)}}async getAuthorizationUrl(){var t;if(!this.api)throw new D("Auth flow has no API instance");if(!this.meta.provider)throw new D("Provider must be set when initialzing OAuth authentication.");try{let r=Hs();return(await this.api.post(r,{provider:this.meta.provider,redirect_to:window.location.href},{baseURL:(t=this.api)==null?void 0:t.fallbackApiUrl})).data}catch(r){throw je(r)}}};var rr=class{constructor(t,r,n){this._meta={walletType:r,walletId:n},this.connectors=t,this.walletConnector=this.connectors.createWalletConnector(r,null,n)}get meta(){return{...this._meta,walletName:this.walletConnector.walletBranding.name,walletIcon:this.walletConnector.walletBranding.icon}}async authenticate(){if(!this.api)throw new D("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign(),n=await this.api.post(Is(),{message:t,signature:r});return this.connectors.addWalletConnector(this.walletConnector),await this.connectors.setActiveWallet(this.walletConnector.address)||console.warn("Failed to set active wallet"),{user:n.data.user,token:n.data.token,refresh_token:n.data.refresh_token,is_new_user:n.data.is_new_user}}catch(t){throw je(t)}}async link(){if(!this.api)throw new D("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign(),n=await this.api.post(Ns(),{message:t,signature:r});return this.connectors.addWalletConnector(this.walletConnector),await this.connectors.setActiveWallet(this.walletConnector.address)||console.warn("Failed to set active wallet"),n.data}catch(t){throw je(t)}}async promptConnect(){if(!this.api)throw new D("Auth flow has no API instance");let t=await this.walletConnector.connect({showPrompt:!0});return await this.buildSiweMessage(t),t}async sign(){if(!this.api)throw new D("Auth flow has no API instance");if(!this.preparedMessage){let r=await this.walletConnector.connect({showPrompt:!1});await this.buildSiweMessage(r)}if(!this.preparedMessage)throw new D("Could not prepare SIWE message");let t=await this.walletConnector.sign(this.preparedMessage);return{message:this.preparedMessage,signature:t}}async buildSiweMessage(t){if(!this.api)throw new D("Auth flow has no API instance");let r=t.address,n=t.chainId,i=await this.api.post(Ws(),{address:r});return this.preparedMessage=this.walletConnector.prepareMessage(n,r,i.data.nonce),this.preparedMessage}};var hr=class{constructor(t){this.meta={phoneNumber:t}}async authenticate(){if(!this.api)throw new D("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new D("phone number and sms code must be set prior to calling authenticate.");try{let t=Fs(),r=await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return{user:r.data.user,token:r.data.token,refresh_token:r.data.refresh_token,is_new_user:r.data.is_new_user}}catch(t){throw je(t)}}async link(){if(!this.api)throw new D("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new D("phone number and sms code must be set prior to calling authenticate.");try{let t=Gs();return(await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})).data}catch(t){throw je(t)}}async sendSmsCode(t){if(!this.api)throw new D("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),!this.meta.phoneNumber)throw new D("phone nNumber must be set when initialzing authentication.");try{let r=Bs();return(await this.api.post(r,{phoneNumber:this.meta.phoneNumber})).data}catch(r){throw je(r)}}};import{getAddress as ef}from"@ethersproject/address";var Js="1.24.0-beta.7";var Rt="4df5e2316331463a9130964bd6078dfa",Yo="https://auth.privy.io",Ys=1e4,bt=1400,Wi=Js;var Or="privy:token",Qo="privy:refresh_token",vo="privy:session_transfer_token",Xo="privy:connectors",Ii="walletconnect",Qs=3e4,wt=1;var Ni=class{constructor(){this._cache={}}get(t){return this._cache[t]}put(t,r){r!==void 0?this._cache[t]=r:this.del(t)}del(t){delete this._cache[t]}getKeys(){return Object.keys(this._cache)}},Oi=class{get(t){let r=localStorage.getItem(t);return r===null?void 0:JSON.parse(r)}put(t,r){r!==void 0?localStorage.setItem(t,JSON.stringify(r)):this.del(t)}del(t){localStorage.removeItem(t)}getKeys(){return Object.entries(localStorage).map(([t])=>t)}};function Uu(){return typeof window<"u"&&window.localStorage?new Oi:new Ni}var le=Uu();import i0 from"@coinbase/wallet-sdk";import{getAddress as a0}from"@ethersproject/address";import{jsx as Xs,jsxs as Bu}from"react/jsx-runtime";var Ct=({style:e,...t})=>Bu("svg",{width:"1024",height:"1024",viewBox:"0 0 1024 1024",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...e},...t,children:[Xs("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),Xs("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z",fill:"white"})]});import{getAddress as o0}from"@ethersproject/address";import{Web3Provider as n0}from"@ethersproject/providers";import{Logger as Fu}from"@ethersproject/logger";var el="bytes/5.7.0";var Dr=new Fu(el);function rl(e){return!!e.toHexString}function en(e){return e.slice||(e.slice=function(){let t=Array.prototype.slice.call(arguments);return en(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function tl(e){return typeof e=="number"&&e==e&&e%1===0}function tn(e){if(e==null)return!1;if(e.constructor===Uint8Array)return!0;if(typeof e=="string"||!tl(e.length)||e.length<0)return!1;for(let t=0;t<e.length;t++){let r=e[t];if(!tl(r)||r<0||r>=256)return!1}return!0}function ol(e,t){if(t||(t={}),typeof e=="number"){Dr.checkSafeUint53(e,"invalid arrayify value");let r=[];for(;e;)r.unshift(e&255),e=parseInt(String(e/256));return r.length===0&&r.push(0),en(new Uint8Array(r))}if(t.allowMissingPrefix&&typeof e=="string"&&e.substring(0,2)!=="0x"&&(e="0x"+e),rl(e)&&(e=e.toHexString()),qt(e)){let r=e.substring(2);r.length%2&&(t.hexPad==="left"?r="0"+r:t.hexPad==="right"?r+="0":Dr.throwArgumentError("hex data is odd-length","value",e));let n=[];for(let i=0;i<r.length;i+=2)n.push(parseInt(r.substring(i,i+2),16));return en(new Uint8Array(n))}return tn(e)?en(new Uint8Array(e)):Dr.throwArgumentError("invalid arrayify value","value",e)}function qt(e,t){return!(typeof e!="string"||!e.match(/^0x[0-9A-Fa-f]*$/)||t&&e.length!==2+2*t)}var Di="0123456789abcdef";function nl(e,t){if(t||(t={}),typeof e=="number"){Dr.checkSafeUint53(e,"invalid hexlify value");let r="";for(;e;)r=Di[e&15]+r,e=Math.floor(e/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"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),rl(e))return e.toHexString();if(qt(e))return e.length%2&&(t.hexPad==="left"?e="0x0"+e.substring(2):t.hexPad==="right"?e+="0":Dr.throwArgumentError("hex data is odd-length","value",e)),e.toLowerCase();if(tn(e)){let r="0x";for(let n=0;n<e.length;n++){let i=e[n];r+=Di[(i&240)>>4]+Di[i&15]}return r}return Dr.throwArgumentError("invalid hexlify value","value",e)}import{InfuraProvider as e0}from"@ethersproject/providers";var dl=Ss(al());import{Logger as Ur}from"@ethersproject/logger";var sl="bignumber/5.7.0";var Fi=dl.default.BN,$t=new Ur(sl),Bi={},ll=9007199254740991;var cl=!1,Ye=class{constructor(t,r){t!==Bi&&$t.throwError("cannot call constructor directly; use BigNumber.from",Ur.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=r,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return at(Q(this).fromTwos(t))}toTwos(t){return at(Q(this).toTwos(t))}abs(){return this._hex[0]==="-"?Ye.from(this._hex.substring(1)):this}add(t){return at(Q(this).add(Q(t)))}sub(t){return at(Q(this).sub(Q(t)))}div(t){return Ye.from(t).isZero()&&xt("division-by-zero","div"),at(Q(this).div(Q(t)))}mul(t){return at(Q(this).mul(Q(t)))}mod(t){let r=Q(t);return r.isNeg()&&xt("division-by-zero","mod"),at(Q(this).umod(r))}pow(t){let r=Q(t);return r.isNeg()&&xt("negative-power","pow"),at(Q(this).pow(r))}and(t){let r=Q(t);return(this.isNegative()||r.isNeg())&&xt("unbound-bitwise-result","and"),at(Q(this).and(r))}or(t){let r=Q(t);return(this.isNegative()||r.isNeg())&&xt("unbound-bitwise-result","or"),at(Q(this).or(r))}xor(t){let r=Q(t);return(this.isNegative()||r.isNeg())&&xt("unbound-bitwise-result","xor"),at(Q(this).xor(r))}mask(t){return(this.isNegative()||t<0)&&xt("negative-width","mask"),at(Q(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&xt("negative-width","shl"),at(Q(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&xt("negative-width","shr"),at(Q(this).shrn(t))}eq(t){return Q(this).eq(Q(t))}lt(t){return Q(this).lt(Q(t))}lte(t){return Q(this).lte(Q(t))}gt(t){return Q(this).gt(Q(t))}gte(t){return Q(this).gte(Q(t))}isNegative(){return this._hex[0]==="-"}isZero(){return Q(this).isZero()}toNumber(){try{return Q(this).toNumber()}catch{xt("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return $t.throwError("this platform does not support BigInt",Ur.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?cl||(cl=!0,$t.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?$t.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",Ur.errors.UNEXPECTED_ARGUMENT,{}):$t.throwError("BigNumber.toString does not accept parameters",Ur.errors.UNEXPECTED_ARGUMENT,{})),Q(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof Ye)return t;if(typeof t=="string")return t.match(/^-?0x[0-9a-f]+$/i)?new Ye(Bi,yo(t)):t.match(/^-?[0-9]+$/)?new Ye(Bi,yo(new Fi(t))):$t.throwArgumentError("invalid BigNumber string","value",t);if(typeof t=="number")return t%1&&xt("underflow","BigNumber.from",t),(t>=ll||t<=-ll)&&xt("overflow","BigNumber.from",t),Ye.from(String(t));let r=t;if(typeof r=="bigint")return Ye.from(r.toString());if(tn(r))return Ye.from(nl(r));if(r)if(r.toHexString){let n=r.toHexString();if(typeof n=="string")return Ye.from(n)}else{let n=r._hex;if(n==null&&r.type==="BigNumber"&&(n=r.hex),typeof n=="string"&&(qt(n)||n[0]==="-"&&qt(n.substring(1))))return Ye.from(n)}return $t.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!!(t&&t._isBigNumber)}};function yo(e){if(typeof e!="string")return yo(e.toString(16));if(e[0]==="-")return e=e.substring(1),e[0]==="-"&&$t.throwArgumentError("invalid hex","value",e),e=yo(e),e==="0x00"?e:"-"+e;if(e.substring(0,2)!=="0x"&&(e="0x"+e),e==="0x")return"0x00";for(e.length%2&&(e="0x0"+e.substring(2));e.length>4&&e.substring(0,4)==="0x00";)e="0x"+e.substring(4);return e}function at(e){return Ye.from(yo(e))}function Q(e){let t=Ye.from(e).toHexString();return t[0]==="-"?new Fi("-"+t.substring(3),16):new Fi(t.substring(2),16)}function xt(e,t,r){let n={fault:e,operation:t};return r!=null&&(n.value=r),$t.throwError(e,Ur.errors.NUMERIC_FAULT,n)}import{Logger as Gu}from"@ethersproject/logger";var ul="strings/5.7.0";var Hu=new Gu(ul),Gi;(function(e){e.current="",e.NFC="NFC",e.NFD="NFD",e.NFKC="NFKC",e.NFKD="NFKD"})(Gi||(Gi={}));var st;(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"})(st||(st={}));function Vu(e,t,r,n,i){return Hu.throwArgumentError(`invalid codepoint at offset ${t}; ${e}`,"bytes",r)}function fl(e,t,r,n,i){if(e===st.BAD_PREFIX||e===st.UNEXPECTED_CONTINUE){let c=0;for(let f=t+1;f<r.length&&r[f]>>6===2;f++)c++;return c}return e===st.OVERRUN?r.length-t-1:0}function qu(e,t,r,n,i){return e===st.OVERLONG?(n.push(i),0):(n.push(65533),fl(e,t,r,n,i))}var pl=Object.freeze({error:Vu,ignore:fl,replace:qu});function $u(e,t){t==null&&(t=pl.error),e=ol(e);let r=[],n=0;for(;n<e.length;){let i=e[n++];if(i>>7===0){r.push(i);continue}let c=null,f=null;if((i&224)===192)c=1,f=127;else if((i&240)===224)c=2,f=2047;else if((i&248)===240)c=3,f=65535;else{(i&192)===128?n+=t(st.UNEXPECTED_CONTINUE,n-1,e,r):n+=t(st.BAD_PREFIX,n-1,e,r);continue}if(n-1+c>=e.length){n+=t(st.OVERRUN,n-1,e,r);continue}let g=i&(1<<8-c-1)-1;for(let y=0;y<c;y++){let w=e[n];if((w&192)!=128){n+=t(st.MISSING_CONTINUE,n,e,r),g=null;break}g=g<<6|w&63,n++}if(g!==null){if(g>1114111){n+=t(st.OUT_OF_RANGE,n-1-c,e,r,g);continue}if(g>=55296&&g<=57343){n+=t(st.UTF16_SURROGATE,n-1-c,e,r,g);continue}if(g<=f){n+=t(st.OVERLONG,n-1-c,e,r,g);continue}r.push(g)}}return r}function zu(e){return e.map(t=>t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10&1023)+55296,(t&1023)+56320))).join("")}function Hi(e,t){return zu($u(e,t))}import t0 from"eventemitter3";var Zu=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign"],hl=e=>Zu.includes(e);import{isPossiblePhoneNumber as ju}from"libphonenumber-js/min";var ml=e=>!!String(e).toLowerCase().match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/),gl=e=>ju(String(e),"US"),vl=(e,t)=>{let r=e.slice(0),n=[];for(;r.length;)n.push(r.splice(0,t));return n},Tt=(e,t=3,r=4)=>{if(!e)return"";let n=2,i=3;if(t+r+n+i>=e.length)return e;let c=e.slice(0,n+t),f=e.slice(e.length-r,e.length);return`${c}...${f}`},Vi=e=>new Promise(t=>setTimeout(t,e)),yl=(e,t={})=>{let r=t.delayMs||40,n=t.maxAttempts||1e3;return new Promise(async(i,c)=>{let f=!1,g=0;for(;!f&&g<n;)e().then(()=>{f=!0,i()},(...y)=>{f=!0,c(...y)}),g+=1,await Vi(r);f||c(new Error("Exceeded max attempts before resolving function"))})},rn=(e,t,r={})=>{let n=new URL(t,e);for(let[i,c]of Object.entries(r))n.searchParams.set(i,c);return n.href},Ku=(e,t)=>e.toLowerCase()===t.toLowerCase(),qi=(e,t)=>{for(let r of e)if(Ku(r,t))return!0;return!1},on=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),bo=e=>typeof e=="string"?e:"0x"+e.toString(16);import{ErrorCode as Ju}from"@ethersproject/logger";var Br=class extends de{constructor(){super("Wallet timeout");this.type="wallet_error"}},gr=class extends de{constructor(){super("User rejected connection");this.type="wallet_error"}},Et=e=>{if(e instanceof de)return e;if((e==null?void 0:e.code)&&(e==null?void 0:e.reason)){let t=new Fr(e);return e.code===Ju.ACTION_REJECTED&&(t.details=mr.E4001_USER_REJECTED_REQUEST),t}return e!=null&&e.code?new Fr(e):new de("Unknown connector error",e)},$i=class extends St{constructor(r,n,i){super(r);this.type="provider_error";this.code=n,this.data=i}},Fr=class extends $i{constructor(r){var c,f,g;let n=r;super(n.message,n.code,n.data);let i=Object.values(mr).find(y=>y.eipCode===n.code);this.details=i||mr.UNKNOWN_ERROR,n.code===-32002&&((c=n.message)!=null&&c.includes("already pending for origin")?(f=n.message)!=null&&f.includes("wallet_requestPermissions")?this.details=mr.E32002_CONNECTION_ALREADY_PENDING:this.details=mr.E32002_REQUEST_ALREADY_PENDING:(g=n.message)!=null&&g.includes("Already processing")&&n.message.includes("eth_requestAccounts")&&(this.details=mr.E32002_WALLET_LOCKED))}},Yu={ERROR_USER_EXISTS:{message:"User already exists for this address",detail:"Try another address!",retryable:!1},ERROR_TIMED_OUT:{message:"Wallet request timed out",detail:"Please try connecting again.",retryable:!0},ERROR_WALLET_CONNECTION:{message:"Could not log in with wallet",detail:"Please try connecting again.",retryable:!0},ERROR_USER_REJECTED_CONNECTION:{message:"You rejected the request",detail:"Please try connecting again.",retryable:!0}},Qu={E32002_CONNECTION_ALREADY_PENDING:{eipCode:-32002,message:"Connection request already pending",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E32002_REQUEST_ALREADY_PENDING:{eipCode:-32002,message:"Resource request already pending",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E32002_WALLET_LOCKED:{eipCode:-32002,message:"Wallet might be locked",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E4001_USER_REJECTED_REQUEST:{eipCode:4001,message:"Signature rejected",detail:"Please try signing again.",retryable:!0}},Xu={E4001_DEFAULT_USER_REJECTED_REQUEST:{eipCode:4001,message:"User Rejected Request",detail:"The user rejected the request.",default:!0,retryable:!0},E4100_DEFAULT_UNAUTHORIZED:{eipCode:4100,message:"Unauthorized",detail:"The requested method and/or account has not been authorized by the user.",default:!0,retryable:!1},E4200_DEFAULT_UNSUPPORTED_METHOD:{eipCode:4200,message:"Unsupported Method",detail:"The Provider does not support the requested method.",default:!0,retryable:!1},E4900_DEFAULT_DISCONNECTED:{eipCode:4900,message:"Disconnected",detail:"The Provider is disconnected from all chains.",default:!0,retryable:!0},E4901_DEFAULT_CHAIN_DISCONNECTED:{eipCode:4901,message:"Chain Disconnected",detail:"The Provider is not connected to the requested chain.",default:!0,retryable:!0},E32700_DEFAULT_PARSE_ERROR:{eipCode:-32700,message:"Parse error",detail:"Invalid JSON",default:!0,retryable:!1},E32600_DEFAULT_INVALID_REQUEST:{eipCode:-32600,message:"Invalid request",detail:"JSON is not a valid request object",default:!0,retryable:!1},E32601_DEFAULT_METHOD_NOT_FOUND:{eipCode:-32601,message:"Method not found",detail:"Method does not exist",default:!0,retryable:!1},E32602_DEFAULT_INVALID_PARAMS:{eipCode:-32602,message:"Invalid params",detail:"Invalid method parameters",default:!0,retryable:!1},E32603_DEFAULT_INTERNAL_ERROR:{eipCode:-32603,message:"Internal error",detail:"Internal JSON-RPC error",default:!0,retryable:!0},E32000_DEFAULT_INVALID_INPUT:{eipCode:-32e3,message:"Invalid input",detail:"Missing or invalid parameters",default:!0,retryable:!1},E32001_DEFAULT_RESOURCE_NOT_FOUND:{eipCode:-32001,message:"Resource not found",detail:"Requested resource not found",default:!0,retryable:!1},E32002_DEFAULT_RESOURCE_UNAVAILABLE:{eipCode:-32002,message:"Resource unavailable",detail:"Requested resource not available",default:!0,retryable:!0},E32003_DEFAULT_TRANSACTION_REJECTED:{eipCode:-32003,message:"Transaction rejected",detail:"Transaction creation failed",default:!0,retryable:!0},E32004_DEFAULT_METHOD_NOT_SUPPORTED:{eipCode:-32004,message:"Method not supported",detail:"Method is not implemented",default:!0,retryable:!1},E32005_DEFAULT_LIMIT_EXCEEDED:{eipCode:-32005,message:"Limit exceeded",detail:"Request exceeds defined limit",default:!0,retryable:!1},E32006_DEFAULT_JSON_RPC_VERSION_NOT_SUPPORTED:{eipCode:-32006,message:"JSON-RPC version not supported",detail:"Version of JSON-RPC protocol is not supported",default:!0,retryable:!1}},mr={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...Xu,...Qu},vr={...Yu,...mr};var r0=12e4,zi=(e=new Br,t=r0)=>new Promise((r,n)=>setTimeout(()=>{n(e)},t)),Mt=class{constructor(t){this.removeListener=(t,r)=>{if(this.walletProvider)return this.walletProvider.removeListener(t,r)};this.setWalletProvider=t=>{this.walletProvider=t,this._subscriptions.forEach(r=>{var n;(n=this.walletProvider)==null||n.on(r.eventName,r.listener)})};this.walletProvider=t,this._subscriptions=[]}on(t,r){if(this.walletProvider)return this.walletProvider.on(t,r);this._subscriptions.push({eventName:t,listener:r})}async request(t){if(!this.walletProvider)throw new de(`A wallet request of type ${t.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(t),zi()]).catch(r=>{throw Et(r)})}},or=class extends Error{constructor(r,n,i){super(r);this.code=n,this.data=i}},nn=class extends t0{constructor(r,n,i=1){super();this.walletProxy=r,this.address=n,this.chainId=i,this.infuraProvider=new e0(i,Rt)}async handleSendTransaction(r){if(!r.params||!Array.isArray(r.params))throw new or(`Invalid params for ${r.method}`,4200);let n=r.params[0],i=n.chainId;if(i&&Number(i)!==this.chainId)throw new or(`Chain disconnected. Currently connected to ${this.chainId}, attempting to send to ${Number(i)}`,4901);if(!await wo()||!this.address)throw new or("Disconnected",4900);return(await wl(n)).transactionHash}handleSwitchEthereumChain(r){if(!r.params||!Array.isArray(r.params))throw new or(`Invalid params for ${r.method}`,4200);let n=r.params[0];this.chainId=Number(n),this.emit("chainChanged",n)}async handlePersonalSign(r){if(!r.params||!Array.isArray(r.params))throw new Error("Invalid params for eth_estimateGas");let n=r.params[0],i=qt(n)?Hi(n):n;return await bl(i)}async handleEstimateGas(r){if(!r.params||!Array.isArray(r.params))throw new Error("Invalid params for eth_estimateGas");let n={...r.params[0],chainId:bo(this.chainId)};return delete n.from,this.infuraProvider.send("eth_estimateGas",[n])}async request(r){switch(console.debug("Embedded1193Provider.request() called with args",r),r.method){case"eth_accounts":return this.address?[this.address]:[];case"eth_chainId":return bo(this.chainId);case"eth_estimateGas":return this.handleEstimateGas(r);case"eth_sendTransaction":return this.handleSendTransaction(r);case"wallet_switchEthereumChain":return this.handleSwitchEthereumChain(r);case"personal_sign":return this.handlePersonalSign(r);default:break}if(hl(r.method)){let n=await wo();if(!n||!this.address)throw new or("Disconnected",4900);try{return(await this.walletProxy.rpc({address:this.address,accessToken:n,request:{method:r.method,params:r.params}})).response.data}catch(i){throw console.error(i),new or("Disconnected",4900)}}else return this.infuraProvider.send(r.method,r.params)}async connect(){let r=await wo();if(!r||!this.address)return null;try{return(await this.walletProxy.connect({address:this.address,accessToken:r})).address}catch(n){return console.error(n),null}}},yr=class extends Mt{constructor(r){super(r)}},an=class extends Mt{constructor(t){super(t)}sendAsync(t,r){throw new Error("sendAsync is no longer supported by EIP-1193. Use the request method instead.")}};var ut=class{constructor(t,r,n){this.createSiweMessage=(t,r,n,i,c,f,g)=>`${n} wants you to sign in with your Ethereum account:
2
2
  ${r}
3
3
 
4
4
  ${g}
@@ -2117,7 +2117,7 @@ Resources:
2117
2117
  padding: 24px;
2118
2118
 
2119
2119
  &&[data-height='full'] {
2120
- min-height: 620px;
2120
+ height: 620px;
2121
2121
  }
2122
2122
 
2123
2123
  &&[data-height='medium'] {
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var _u=Object.create;var Cn=Object.defineProperty;var Pu=Object.getOwnPropertyDescriptor;var Au=Object.getOwnPropertyNames;var Su=Object.getPrototypeOf,Tu=Object.prototype.hasOwnProperty;var qs=(e,t)=>()=>(e&&(t=e(e=0)),t);var nr=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),la=(e,t)=>{for(var r in t)Cn(e,r,{get:t[r],enumerable:!0})},$s=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Au(t))!Tu.call(e,i)&&i!==r&&Cn(e,i,{get:()=>t[i],enumerable:!(n=Pu(t,i))||n.enumerable});return e};var N=(e,t,r)=>(r=e!=null?_u(Su(e)):{},$s(t||!e||!e.__esModule?Cn(r,"default",{value:e,enumerable:!0}):r,e)),ca=e=>$s(Cn({},"__esModule",{value:!0}),e);var _l=nr((El,ha)=>{(function(e,t){"use strict";function r(h,o){if(!h)throw new Error(o||"Assertion failed")}function n(h,o){h.super_=o;var s=function(){};s.prototype=o.prototype,h.prototype=new s,h.prototype.constructor=h}function i(h,o,s){if(i.isBN(h))return h;this.negative=0,this.words=null,this.length=0,this.red=null,h!==null&&((o==="le"||o==="be")&&(s=o,o=10),this._init(h||0,o||10,s||"be"))}typeof e=="object"?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26;var c;try{typeof window<"u"&&typeof window.Buffer<"u"?c=window.Buffer:c=require("buffer").Buffer}catch{}i.isBN=function(o){return o instanceof i?!0:o!==null&&typeof o=="object"&&o.constructor.wordSize===i.wordSize&&Array.isArray(o.words)},i.max=function(o,s){return o.cmp(s)>0?o:s},i.min=function(o,s){return o.cmp(s)<0?o:s},i.prototype._init=function(o,s,l){if(typeof o=="number")return this._initNumber(o,s,l);if(typeof o=="object")return this._initArray(o,s,l);s==="hex"&&(s=16),r(s===(s|0)&&s>=2&&s<=36),o=o.toString().replace(/\s+/g,"");var d=0;o[0]==="-"&&(d++,this.negative=1),d<o.length&&(s===16?this._parseHex(o,d,l):(this._parseBase(o,s,d),l==="le"&&this._initArray(this.toArray(),s,l)))},i.prototype._initNumber=function(o,s,l){o<0&&(this.negative=1,o=-o),o<67108864?(this.words=[o&67108863],this.length=1):o<4503599627370496?(this.words=[o&67108863,o/67108864&67108863],this.length=2):(r(o<9007199254740992),this.words=[o&67108863,o/67108864&67108863,1],this.length=3),l==="le"&&this._initArray(this.toArray(),s,l)},i.prototype._initArray=function(o,s,l){if(r(typeof o.length=="number"),o.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(o.length/3),this.words=new Array(this.length);for(var d=0;d<this.length;d++)this.words[d]=0;var u,v,b=0;if(l==="be")for(d=o.length-1,u=0;d>=0;d-=3)v=o[d]|o[d-1]<<8|o[d-2]<<16,this.words[u]|=v<<b&67108863,this.words[u+1]=v>>>26-b&67108863,b+=24,b>=26&&(b-=26,u++);else if(l==="le")for(d=0,u=0;d<o.length;d+=3)v=o[d]|o[d+1]<<8|o[d+2]<<16,this.words[u]|=v<<b&67108863,this.words[u+1]=v>>>26-b&67108863,b+=24,b>=26&&(b-=26,u++);return this._strip()};function f(h,o){var s=h.charCodeAt(o);if(s>=48&&s<=57)return s-48;if(s>=65&&s<=70)return s-55;if(s>=97&&s<=102)return s-87;r(!1,"Invalid character in "+h)}function g(h,o,s){var l=f(h,s);return s-1>=o&&(l|=f(h,s-1)<<4),l}i.prototype._parseHex=function(o,s,l){this.length=Math.ceil((o.length-s)/6),this.words=new Array(this.length);for(var d=0;d<this.length;d++)this.words[d]=0;var u=0,v=0,b;if(l==="be")for(d=o.length-1;d>=s;d-=2)b=g(o,s,d)<<u,this.words[v]|=b&67108863,u>=18?(u-=18,v+=1,this.words[v]|=b>>>26):u+=8;else{var p=o.length-s;for(d=p%2===0?s+1:s;d<o.length;d+=2)b=g(o,s,d)<<u,this.words[v]|=b&67108863,u>=18?(u-=18,v+=1,this.words[v]|=b>>>26):u+=8}this._strip()};function y(h,o,s,l){for(var d=0,u=0,v=Math.min(h.length,s),b=o;b<v;b++){var p=h.charCodeAt(b)-48;d*=l,p>=49?u=p-49+10:p>=17?u=p-17+10:u=p,r(p>=0&&u<l,"Invalid character"),d+=u}return d}i.prototype._parseBase=function(o,s,l){this.words=[0],this.length=1;for(var d=0,u=1;u<=67108863;u*=s)d++;d--,u=u/s|0;for(var v=o.length-l,b=v%d,p=Math.min(v,v-b)+l,a=0,m=l;m<p;m+=d)a=y(o,m,m+d,s),this.imuln(u),this.words[0]+a<67108864?this.words[0]+=a:this._iaddn(a);if(b!==0){var R=1;for(a=y(o,m,o.length,s),m=0;m<b;m++)R*=s;this.imuln(R),this.words[0]+a<67108864?this.words[0]+=a:this._iaddn(a)}this._strip()},i.prototype.copy=function(o){o.words=new Array(this.length);for(var s=0;s<this.length;s++)o.words[s]=this.words[s];o.length=this.length,o.negative=this.negative,o.red=this.red};function w(h,o){h.words=o.words,h.length=o.length,h.negative=o.negative,h.red=o.red}if(i.prototype._move=function(o){w(o,this)},i.prototype.clone=function(){var o=new i(null);return this.copy(o),o},i.prototype._expand=function(o){for(;this.length<o;)this.words[this.length++]=0;return this},i.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=A}catch{i.prototype.inspect=A}else i.prototype.inspect=A;function A(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var P=["","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"],_=[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],T=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(o,s){o=o||10,s=s|0||1;var l;if(o===16||o==="hex"){l="";for(var d=0,u=0,v=0;v<this.length;v++){var b=this.words[v],p=((b<<d|u)&16777215).toString(16);u=b>>>24-d&16777215,d+=2,d>=26&&(d-=26,v--),u!==0||v!==this.length-1?l=P[6-p.length]+p+l:l=p+l}for(u!==0&&(l=u.toString(16)+l);l.length%s!==0;)l="0"+l;return this.negative!==0&&(l="-"+l),l}if(o===(o|0)&&o>=2&&o<=36){var a=_[o],m=T[o];l="";var R=this.clone();for(R.negative=0;!R.isZero();){var W=R.modrn(m).toString(o);R=R.idivn(m),R.isZero()?l=W+l:l=P[a-W.length]+W+l}for(this.isZero()&&(l="0"+l);l.length%s!==0;)l="0"+l;return this.negative!==0&&(l="-"+l),l}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var o=this.words[0];return this.length===2?o+=this.words[1]*67108864:this.length===3&&this.words[2]===1?o+=4503599627370496+this.words[1]*67108864:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-o:o},i.prototype.toJSON=function(){return this.toString(16,2)},c&&(i.prototype.toBuffer=function(o,s){return this.toArrayLike(c,o,s)}),i.prototype.toArray=function(o,s){return this.toArrayLike(Array,o,s)};var M=function(o,s){return o.allocUnsafe?o.allocUnsafe(s):new o(s)};i.prototype.toArrayLike=function(o,s,l){this._strip();var d=this.byteLength(),u=l||Math.max(1,d);r(d<=u,"byte array longer than desired length"),r(u>0,"Requested array length <= 0");var v=M(o,u),b=s==="le"?"LE":"BE";return this["_toArrayLike"+b](v,d),v},i.prototype._toArrayLikeLE=function(o,s){for(var l=0,d=0,u=0,v=0;u<this.length;u++){var b=this.words[u]<<v|d;o[l++]=b&255,l<o.length&&(o[l++]=b>>8&255),l<o.length&&(o[l++]=b>>16&255),v===6?(l<o.length&&(o[l++]=b>>24&255),d=0,v=0):(d=b>>>24,v+=2)}if(l<o.length)for(o[l++]=d;l<o.length;)o[l++]=0},i.prototype._toArrayLikeBE=function(o,s){for(var l=o.length-1,d=0,u=0,v=0;u<this.length;u++){var b=this.words[u]<<v|d;o[l--]=b&255,l>=0&&(o[l--]=b>>8&255),l>=0&&(o[l--]=b>>16&255),v===6?(l>=0&&(o[l--]=b>>24&255),d=0,v=0):(d=b>>>24,v+=2)}if(l>=0)for(o[l--]=d;l>=0;)o[l--]=0},Math.clz32?i.prototype._countBits=function(o){return 32-Math.clz32(o)}:i.prototype._countBits=function(o){var s=o,l=0;return s>=4096&&(l+=13,s>>>=13),s>=64&&(l+=7,s>>>=7),s>=8&&(l+=4,s>>>=4),s>=2&&(l+=2,s>>>=2),l+s},i.prototype._zeroBits=function(o){if(o===0)return 26;var s=o,l=0;return(s&8191)===0&&(l+=13,s>>>=13),(s&127)===0&&(l+=7,s>>>=7),(s&15)===0&&(l+=4,s>>>=4),(s&3)===0&&(l+=2,s>>>=2),(s&1)===0&&l++,l},i.prototype.bitLength=function(){var o=this.words[this.length-1],s=this._countBits(o);return(this.length-1)*26+s};function E(h){for(var o=new Array(h.bitLength()),s=0;s<o.length;s++){var l=s/26|0,d=s%26;o[s]=h.words[l]>>>d&1}return o}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var o=0,s=0;s<this.length;s++){var l=this._zeroBits(this.words[s]);if(o+=l,l!==26)break}return o},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(o){return this.negative!==0?this.abs().inotn(o).iaddn(1):this.clone()},i.prototype.fromTwos=function(o){return this.testn(o-1)?this.notn(o).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return this.negative!==0},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(o){for(;this.length<o.length;)this.words[this.length++]=0;for(var s=0;s<o.length;s++)this.words[s]=this.words[s]|o.words[s];return this._strip()},i.prototype.ior=function(o){return r((this.negative|o.negative)===0),this.iuor(o)},i.prototype.or=function(o){return this.length>o.length?this.clone().ior(o):o.clone().ior(this)},i.prototype.uor=function(o){return this.length>o.length?this.clone().iuor(o):o.clone().iuor(this)},i.prototype.iuand=function(o){var s;this.length>o.length?s=o:s=this;for(var l=0;l<s.length;l++)this.words[l]=this.words[l]&o.words[l];return this.length=s.length,this._strip()},i.prototype.iand=function(o){return r((this.negative|o.negative)===0),this.iuand(o)},i.prototype.and=function(o){return this.length>o.length?this.clone().iand(o):o.clone().iand(this)},i.prototype.uand=function(o){return this.length>o.length?this.clone().iuand(o):o.clone().iuand(this)},i.prototype.iuxor=function(o){var s,l;this.length>o.length?(s=this,l=o):(s=o,l=this);for(var d=0;d<l.length;d++)this.words[d]=s.words[d]^l.words[d];if(this!==s)for(;d<s.length;d++)this.words[d]=s.words[d];return this.length=s.length,this._strip()},i.prototype.ixor=function(o){return r((this.negative|o.negative)===0),this.iuxor(o)},i.prototype.xor=function(o){return this.length>o.length?this.clone().ixor(o):o.clone().ixor(this)},i.prototype.uxor=function(o){return this.length>o.length?this.clone().iuxor(o):o.clone().iuxor(this)},i.prototype.inotn=function(o){r(typeof o=="number"&&o>=0);var s=Math.ceil(o/26)|0,l=o%26;this._expand(s),l>0&&s--;for(var d=0;d<s;d++)this.words[d]=~this.words[d]&67108863;return l>0&&(this.words[d]=~this.words[d]&67108863>>26-l),this._strip()},i.prototype.notn=function(o){return this.clone().inotn(o)},i.prototype.setn=function(o,s){r(typeof o=="number"&&o>=0);var l=o/26|0,d=o%26;return this._expand(l+1),s?this.words[l]=this.words[l]|1<<d:this.words[l]=this.words[l]&~(1<<d),this._strip()},i.prototype.iadd=function(o){var s;if(this.negative!==0&&o.negative===0)return this.negative=0,s=this.isub(o),this.negative^=1,this._normSign();if(this.negative===0&&o.negative!==0)return o.negative=0,s=this.isub(o),o.negative=1,s._normSign();var l,d;this.length>o.length?(l=this,d=o):(l=o,d=this);for(var u=0,v=0;v<d.length;v++)s=(l.words[v]|0)+(d.words[v]|0)+u,this.words[v]=s&67108863,u=s>>>26;for(;u!==0&&v<l.length;v++)s=(l.words[v]|0)+u,this.words[v]=s&67108863,u=s>>>26;if(this.length=l.length,u!==0)this.words[this.length]=u,this.length++;else if(l!==this)for(;v<l.length;v++)this.words[v]=l.words[v];return this},i.prototype.add=function(o){var s;return o.negative!==0&&this.negative===0?(o.negative=0,s=this.sub(o),o.negative^=1,s):o.negative===0&&this.negative!==0?(this.negative=0,s=o.sub(this),this.negative=1,s):this.length>o.length?this.clone().iadd(o):o.clone().iadd(this)},i.prototype.isub=function(o){if(o.negative!==0){o.negative=0;var s=this.iadd(o);return o.negative=1,s._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(o),this.negative=1,this._normSign();var l=this.cmp(o);if(l===0)return this.negative=0,this.length=1,this.words[0]=0,this;var d,u;l>0?(d=this,u=o):(d=o,u=this);for(var v=0,b=0;b<u.length;b++)s=(d.words[b]|0)-(u.words[b]|0)+v,v=s>>26,this.words[b]=s&67108863;for(;v!==0&&b<d.length;b++)s=(d.words[b]|0)+v,v=s>>26,this.words[b]=s&67108863;if(v===0&&b<d.length&&d!==this)for(;b<d.length;b++)this.words[b]=d.words[b];return this.length=Math.max(this.length,b),d!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(o){return this.clone().isub(o)};function S(h,o,s){s.negative=o.negative^h.negative;var l=h.length+o.length|0;s.length=l,l=l-1|0;var d=h.words[0]|0,u=o.words[0]|0,v=d*u,b=v&67108863,p=v/67108864|0;s.words[0]=b;for(var a=1;a<l;a++){for(var m=p>>>26,R=p&67108863,W=Math.min(a,o.length-1),U=Math.max(0,a-h.length+1);U<=W;U++){var q=a-U|0;d=h.words[q]|0,u=o.words[U]|0,v=d*u+R,m+=v/67108864|0,R=v&67108863}s.words[a]=R|0,p=m|0}return p!==0?s.words[a]=p|0:s.length--,s._strip()}var k=function(o,s,l){var d=o.words,u=s.words,v=l.words,b=0,p,a,m,R=d[0]|0,W=R&8191,U=R>>>13,q=d[1]|0,x=q&8191,C=q>>>13,$=d[2]|0,I=$&8191,ae=$>>>13,ho=d[3]|0,pe=ho&8191,Ce=ho>>>13,Ts=d[4]|0,xe=Ts&8191,Ee=Ts>>>13,Ms=d[5]|0,_e=Ms&8191,Pe=Ms>>>13,Ls=d[6]|0,Ae=Ls&8191,Se=Ls>>>13,ks=d[7]|0,Te=ks&8191,Me=ks>>>13,Rs=d[8]|0,Le=Rs&8191,ke=Rs>>>13,Ws=d[9]|0,Re=Ws&8191,We=Ws>>>13,Is=u[0]|0,Ie=Is&8191,Ne=Is>>>13,Ns=u[1]|0,Oe=Ns&8191,De=Ns>>>13,Os=u[2]|0,Ue=Os&8191,Be=Os>>>13,Ds=u[3]|0,Fe=Ds&8191,Ge=Ds>>>13,Us=u[4]|0,He=Us&8191,Ve=Us>>>13,Bs=u[5]|0,qe=Bs&8191,$e=Bs>>>13,Fs=u[6]|0,ze=Fs&8191,Ze=Fs>>>13,Gs=u[7]|0,je=Gs&8191,Ke=Gs>>>13,Hs=u[8]|0,Je=Hs&8191,Ye=Hs>>>13,Vs=u[9]|0,Qe=Vs&8191,Xe=Vs>>>13;l.negative=o.negative^s.negative,l.length=19,p=Math.imul(W,Ie),a=Math.imul(W,Ne),a=a+Math.imul(U,Ie)|0,m=Math.imul(U,Ne);var Vi=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(Vi>>>26)|0,Vi&=67108863,p=Math.imul(x,Ie),a=Math.imul(x,Ne),a=a+Math.imul(C,Ie)|0,m=Math.imul(C,Ne),p=p+Math.imul(W,Oe)|0,a=a+Math.imul(W,De)|0,a=a+Math.imul(U,Oe)|0,m=m+Math.imul(U,De)|0;var qi=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(qi>>>26)|0,qi&=67108863,p=Math.imul(I,Ie),a=Math.imul(I,Ne),a=a+Math.imul(ae,Ie)|0,m=Math.imul(ae,Ne),p=p+Math.imul(x,Oe)|0,a=a+Math.imul(x,De)|0,a=a+Math.imul(C,Oe)|0,m=m+Math.imul(C,De)|0,p=p+Math.imul(W,Ue)|0,a=a+Math.imul(W,Be)|0,a=a+Math.imul(U,Ue)|0,m=m+Math.imul(U,Be)|0;var $i=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+($i>>>26)|0,$i&=67108863,p=Math.imul(pe,Ie),a=Math.imul(pe,Ne),a=a+Math.imul(Ce,Ie)|0,m=Math.imul(Ce,Ne),p=p+Math.imul(I,Oe)|0,a=a+Math.imul(I,De)|0,a=a+Math.imul(ae,Oe)|0,m=m+Math.imul(ae,De)|0,p=p+Math.imul(x,Ue)|0,a=a+Math.imul(x,Be)|0,a=a+Math.imul(C,Ue)|0,m=m+Math.imul(C,Be)|0,p=p+Math.imul(W,Fe)|0,a=a+Math.imul(W,Ge)|0,a=a+Math.imul(U,Fe)|0,m=m+Math.imul(U,Ge)|0;var zi=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(zi>>>26)|0,zi&=67108863,p=Math.imul(xe,Ie),a=Math.imul(xe,Ne),a=a+Math.imul(Ee,Ie)|0,m=Math.imul(Ee,Ne),p=p+Math.imul(pe,Oe)|0,a=a+Math.imul(pe,De)|0,a=a+Math.imul(Ce,Oe)|0,m=m+Math.imul(Ce,De)|0,p=p+Math.imul(I,Ue)|0,a=a+Math.imul(I,Be)|0,a=a+Math.imul(ae,Ue)|0,m=m+Math.imul(ae,Be)|0,p=p+Math.imul(x,Fe)|0,a=a+Math.imul(x,Ge)|0,a=a+Math.imul(C,Fe)|0,m=m+Math.imul(C,Ge)|0,p=p+Math.imul(W,He)|0,a=a+Math.imul(W,Ve)|0,a=a+Math.imul(U,He)|0,m=m+Math.imul(U,Ve)|0;var Zi=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(Zi>>>26)|0,Zi&=67108863,p=Math.imul(_e,Ie),a=Math.imul(_e,Ne),a=a+Math.imul(Pe,Ie)|0,m=Math.imul(Pe,Ne),p=p+Math.imul(xe,Oe)|0,a=a+Math.imul(xe,De)|0,a=a+Math.imul(Ee,Oe)|0,m=m+Math.imul(Ee,De)|0,p=p+Math.imul(pe,Ue)|0,a=a+Math.imul(pe,Be)|0,a=a+Math.imul(Ce,Ue)|0,m=m+Math.imul(Ce,Be)|0,p=p+Math.imul(I,Fe)|0,a=a+Math.imul(I,Ge)|0,a=a+Math.imul(ae,Fe)|0,m=m+Math.imul(ae,Ge)|0,p=p+Math.imul(x,He)|0,a=a+Math.imul(x,Ve)|0,a=a+Math.imul(C,He)|0,m=m+Math.imul(C,Ve)|0,p=p+Math.imul(W,qe)|0,a=a+Math.imul(W,$e)|0,a=a+Math.imul(U,qe)|0,m=m+Math.imul(U,$e)|0;var ji=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(ji>>>26)|0,ji&=67108863,p=Math.imul(Ae,Ie),a=Math.imul(Ae,Ne),a=a+Math.imul(Se,Ie)|0,m=Math.imul(Se,Ne),p=p+Math.imul(_e,Oe)|0,a=a+Math.imul(_e,De)|0,a=a+Math.imul(Pe,Oe)|0,m=m+Math.imul(Pe,De)|0,p=p+Math.imul(xe,Ue)|0,a=a+Math.imul(xe,Be)|0,a=a+Math.imul(Ee,Ue)|0,m=m+Math.imul(Ee,Be)|0,p=p+Math.imul(pe,Fe)|0,a=a+Math.imul(pe,Ge)|0,a=a+Math.imul(Ce,Fe)|0,m=m+Math.imul(Ce,Ge)|0,p=p+Math.imul(I,He)|0,a=a+Math.imul(I,Ve)|0,a=a+Math.imul(ae,He)|0,m=m+Math.imul(ae,Ve)|0,p=p+Math.imul(x,qe)|0,a=a+Math.imul(x,$e)|0,a=a+Math.imul(C,qe)|0,m=m+Math.imul(C,$e)|0,p=p+Math.imul(W,ze)|0,a=a+Math.imul(W,Ze)|0,a=a+Math.imul(U,ze)|0,m=m+Math.imul(U,Ze)|0;var Ki=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(Ki>>>26)|0,Ki&=67108863,p=Math.imul(Te,Ie),a=Math.imul(Te,Ne),a=a+Math.imul(Me,Ie)|0,m=Math.imul(Me,Ne),p=p+Math.imul(Ae,Oe)|0,a=a+Math.imul(Ae,De)|0,a=a+Math.imul(Se,Oe)|0,m=m+Math.imul(Se,De)|0,p=p+Math.imul(_e,Ue)|0,a=a+Math.imul(_e,Be)|0,a=a+Math.imul(Pe,Ue)|0,m=m+Math.imul(Pe,Be)|0,p=p+Math.imul(xe,Fe)|0,a=a+Math.imul(xe,Ge)|0,a=a+Math.imul(Ee,Fe)|0,m=m+Math.imul(Ee,Ge)|0,p=p+Math.imul(pe,He)|0,a=a+Math.imul(pe,Ve)|0,a=a+Math.imul(Ce,He)|0,m=m+Math.imul(Ce,Ve)|0,p=p+Math.imul(I,qe)|0,a=a+Math.imul(I,$e)|0,a=a+Math.imul(ae,qe)|0,m=m+Math.imul(ae,$e)|0,p=p+Math.imul(x,ze)|0,a=a+Math.imul(x,Ze)|0,a=a+Math.imul(C,ze)|0,m=m+Math.imul(C,Ze)|0,p=p+Math.imul(W,je)|0,a=a+Math.imul(W,Ke)|0,a=a+Math.imul(U,je)|0,m=m+Math.imul(U,Ke)|0;var Ji=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(Ji>>>26)|0,Ji&=67108863,p=Math.imul(Le,Ie),a=Math.imul(Le,Ne),a=a+Math.imul(ke,Ie)|0,m=Math.imul(ke,Ne),p=p+Math.imul(Te,Oe)|0,a=a+Math.imul(Te,De)|0,a=a+Math.imul(Me,Oe)|0,m=m+Math.imul(Me,De)|0,p=p+Math.imul(Ae,Ue)|0,a=a+Math.imul(Ae,Be)|0,a=a+Math.imul(Se,Ue)|0,m=m+Math.imul(Se,Be)|0,p=p+Math.imul(_e,Fe)|0,a=a+Math.imul(_e,Ge)|0,a=a+Math.imul(Pe,Fe)|0,m=m+Math.imul(Pe,Ge)|0,p=p+Math.imul(xe,He)|0,a=a+Math.imul(xe,Ve)|0,a=a+Math.imul(Ee,He)|0,m=m+Math.imul(Ee,Ve)|0,p=p+Math.imul(pe,qe)|0,a=a+Math.imul(pe,$e)|0,a=a+Math.imul(Ce,qe)|0,m=m+Math.imul(Ce,$e)|0,p=p+Math.imul(I,ze)|0,a=a+Math.imul(I,Ze)|0,a=a+Math.imul(ae,ze)|0,m=m+Math.imul(ae,Ze)|0,p=p+Math.imul(x,je)|0,a=a+Math.imul(x,Ke)|0,a=a+Math.imul(C,je)|0,m=m+Math.imul(C,Ke)|0,p=p+Math.imul(W,Je)|0,a=a+Math.imul(W,Ye)|0,a=a+Math.imul(U,Je)|0,m=m+Math.imul(U,Ye)|0;var Yi=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(Yi>>>26)|0,Yi&=67108863,p=Math.imul(Re,Ie),a=Math.imul(Re,Ne),a=a+Math.imul(We,Ie)|0,m=Math.imul(We,Ne),p=p+Math.imul(Le,Oe)|0,a=a+Math.imul(Le,De)|0,a=a+Math.imul(ke,Oe)|0,m=m+Math.imul(ke,De)|0,p=p+Math.imul(Te,Ue)|0,a=a+Math.imul(Te,Be)|0,a=a+Math.imul(Me,Ue)|0,m=m+Math.imul(Me,Be)|0,p=p+Math.imul(Ae,Fe)|0,a=a+Math.imul(Ae,Ge)|0,a=a+Math.imul(Se,Fe)|0,m=m+Math.imul(Se,Ge)|0,p=p+Math.imul(_e,He)|0,a=a+Math.imul(_e,Ve)|0,a=a+Math.imul(Pe,He)|0,m=m+Math.imul(Pe,Ve)|0,p=p+Math.imul(xe,qe)|0,a=a+Math.imul(xe,$e)|0,a=a+Math.imul(Ee,qe)|0,m=m+Math.imul(Ee,$e)|0,p=p+Math.imul(pe,ze)|0,a=a+Math.imul(pe,Ze)|0,a=a+Math.imul(Ce,ze)|0,m=m+Math.imul(Ce,Ze)|0,p=p+Math.imul(I,je)|0,a=a+Math.imul(I,Ke)|0,a=a+Math.imul(ae,je)|0,m=m+Math.imul(ae,Ke)|0,p=p+Math.imul(x,Je)|0,a=a+Math.imul(x,Ye)|0,a=a+Math.imul(C,Je)|0,m=m+Math.imul(C,Ye)|0,p=p+Math.imul(W,Qe)|0,a=a+Math.imul(W,Xe)|0,a=a+Math.imul(U,Qe)|0,m=m+Math.imul(U,Xe)|0;var Qi=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(Qi>>>26)|0,Qi&=67108863,p=Math.imul(Re,Oe),a=Math.imul(Re,De),a=a+Math.imul(We,Oe)|0,m=Math.imul(We,De),p=p+Math.imul(Le,Ue)|0,a=a+Math.imul(Le,Be)|0,a=a+Math.imul(ke,Ue)|0,m=m+Math.imul(ke,Be)|0,p=p+Math.imul(Te,Fe)|0,a=a+Math.imul(Te,Ge)|0,a=a+Math.imul(Me,Fe)|0,m=m+Math.imul(Me,Ge)|0,p=p+Math.imul(Ae,He)|0,a=a+Math.imul(Ae,Ve)|0,a=a+Math.imul(Se,He)|0,m=m+Math.imul(Se,Ve)|0,p=p+Math.imul(_e,qe)|0,a=a+Math.imul(_e,$e)|0,a=a+Math.imul(Pe,qe)|0,m=m+Math.imul(Pe,$e)|0,p=p+Math.imul(xe,ze)|0,a=a+Math.imul(xe,Ze)|0,a=a+Math.imul(Ee,ze)|0,m=m+Math.imul(Ee,Ze)|0,p=p+Math.imul(pe,je)|0,a=a+Math.imul(pe,Ke)|0,a=a+Math.imul(Ce,je)|0,m=m+Math.imul(Ce,Ke)|0,p=p+Math.imul(I,Je)|0,a=a+Math.imul(I,Ye)|0,a=a+Math.imul(ae,Je)|0,m=m+Math.imul(ae,Ye)|0,p=p+Math.imul(x,Qe)|0,a=a+Math.imul(x,Xe)|0,a=a+Math.imul(C,Qe)|0,m=m+Math.imul(C,Xe)|0;var Xi=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(Xi>>>26)|0,Xi&=67108863,p=Math.imul(Re,Ue),a=Math.imul(Re,Be),a=a+Math.imul(We,Ue)|0,m=Math.imul(We,Be),p=p+Math.imul(Le,Fe)|0,a=a+Math.imul(Le,Ge)|0,a=a+Math.imul(ke,Fe)|0,m=m+Math.imul(ke,Ge)|0,p=p+Math.imul(Te,He)|0,a=a+Math.imul(Te,Ve)|0,a=a+Math.imul(Me,He)|0,m=m+Math.imul(Me,Ve)|0,p=p+Math.imul(Ae,qe)|0,a=a+Math.imul(Ae,$e)|0,a=a+Math.imul(Se,qe)|0,m=m+Math.imul(Se,$e)|0,p=p+Math.imul(_e,ze)|0,a=a+Math.imul(_e,Ze)|0,a=a+Math.imul(Pe,ze)|0,m=m+Math.imul(Pe,Ze)|0,p=p+Math.imul(xe,je)|0,a=a+Math.imul(xe,Ke)|0,a=a+Math.imul(Ee,je)|0,m=m+Math.imul(Ee,Ke)|0,p=p+Math.imul(pe,Je)|0,a=a+Math.imul(pe,Ye)|0,a=a+Math.imul(Ce,Je)|0,m=m+Math.imul(Ce,Ye)|0,p=p+Math.imul(I,Qe)|0,a=a+Math.imul(I,Xe)|0,a=a+Math.imul(ae,Qe)|0,m=m+Math.imul(ae,Xe)|0;var ea=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(ea>>>26)|0,ea&=67108863,p=Math.imul(Re,Fe),a=Math.imul(Re,Ge),a=a+Math.imul(We,Fe)|0,m=Math.imul(We,Ge),p=p+Math.imul(Le,He)|0,a=a+Math.imul(Le,Ve)|0,a=a+Math.imul(ke,He)|0,m=m+Math.imul(ke,Ve)|0,p=p+Math.imul(Te,qe)|0,a=a+Math.imul(Te,$e)|0,a=a+Math.imul(Me,qe)|0,m=m+Math.imul(Me,$e)|0,p=p+Math.imul(Ae,ze)|0,a=a+Math.imul(Ae,Ze)|0,a=a+Math.imul(Se,ze)|0,m=m+Math.imul(Se,Ze)|0,p=p+Math.imul(_e,je)|0,a=a+Math.imul(_e,Ke)|0,a=a+Math.imul(Pe,je)|0,m=m+Math.imul(Pe,Ke)|0,p=p+Math.imul(xe,Je)|0,a=a+Math.imul(xe,Ye)|0,a=a+Math.imul(Ee,Je)|0,m=m+Math.imul(Ee,Ye)|0,p=p+Math.imul(pe,Qe)|0,a=a+Math.imul(pe,Xe)|0,a=a+Math.imul(Ce,Qe)|0,m=m+Math.imul(Ce,Xe)|0;var ta=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(ta>>>26)|0,ta&=67108863,p=Math.imul(Re,He),a=Math.imul(Re,Ve),a=a+Math.imul(We,He)|0,m=Math.imul(We,Ve),p=p+Math.imul(Le,qe)|0,a=a+Math.imul(Le,$e)|0,a=a+Math.imul(ke,qe)|0,m=m+Math.imul(ke,$e)|0,p=p+Math.imul(Te,ze)|0,a=a+Math.imul(Te,Ze)|0,a=a+Math.imul(Me,ze)|0,m=m+Math.imul(Me,Ze)|0,p=p+Math.imul(Ae,je)|0,a=a+Math.imul(Ae,Ke)|0,a=a+Math.imul(Se,je)|0,m=m+Math.imul(Se,Ke)|0,p=p+Math.imul(_e,Je)|0,a=a+Math.imul(_e,Ye)|0,a=a+Math.imul(Pe,Je)|0,m=m+Math.imul(Pe,Ye)|0,p=p+Math.imul(xe,Qe)|0,a=a+Math.imul(xe,Xe)|0,a=a+Math.imul(Ee,Qe)|0,m=m+Math.imul(Ee,Xe)|0;var ra=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(ra>>>26)|0,ra&=67108863,p=Math.imul(Re,qe),a=Math.imul(Re,$e),a=a+Math.imul(We,qe)|0,m=Math.imul(We,$e),p=p+Math.imul(Le,ze)|0,a=a+Math.imul(Le,Ze)|0,a=a+Math.imul(ke,ze)|0,m=m+Math.imul(ke,Ze)|0,p=p+Math.imul(Te,je)|0,a=a+Math.imul(Te,Ke)|0,a=a+Math.imul(Me,je)|0,m=m+Math.imul(Me,Ke)|0,p=p+Math.imul(Ae,Je)|0,a=a+Math.imul(Ae,Ye)|0,a=a+Math.imul(Se,Je)|0,m=m+Math.imul(Se,Ye)|0,p=p+Math.imul(_e,Qe)|0,a=a+Math.imul(_e,Xe)|0,a=a+Math.imul(Pe,Qe)|0,m=m+Math.imul(Pe,Xe)|0;var oa=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(oa>>>26)|0,oa&=67108863,p=Math.imul(Re,ze),a=Math.imul(Re,Ze),a=a+Math.imul(We,ze)|0,m=Math.imul(We,Ze),p=p+Math.imul(Le,je)|0,a=a+Math.imul(Le,Ke)|0,a=a+Math.imul(ke,je)|0,m=m+Math.imul(ke,Ke)|0,p=p+Math.imul(Te,Je)|0,a=a+Math.imul(Te,Ye)|0,a=a+Math.imul(Me,Je)|0,m=m+Math.imul(Me,Ye)|0,p=p+Math.imul(Ae,Qe)|0,a=a+Math.imul(Ae,Xe)|0,a=a+Math.imul(Se,Qe)|0,m=m+Math.imul(Se,Xe)|0;var na=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(na>>>26)|0,na&=67108863,p=Math.imul(Re,je),a=Math.imul(Re,Ke),a=a+Math.imul(We,je)|0,m=Math.imul(We,Ke),p=p+Math.imul(Le,Je)|0,a=a+Math.imul(Le,Ye)|0,a=a+Math.imul(ke,Je)|0,m=m+Math.imul(ke,Ye)|0,p=p+Math.imul(Te,Qe)|0,a=a+Math.imul(Te,Xe)|0,a=a+Math.imul(Me,Qe)|0,m=m+Math.imul(Me,Xe)|0;var ia=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(ia>>>26)|0,ia&=67108863,p=Math.imul(Re,Je),a=Math.imul(Re,Ye),a=a+Math.imul(We,Je)|0,m=Math.imul(We,Ye),p=p+Math.imul(Le,Qe)|0,a=a+Math.imul(Le,Xe)|0,a=a+Math.imul(ke,Qe)|0,m=m+Math.imul(ke,Xe)|0;var aa=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(aa>>>26)|0,aa&=67108863,p=Math.imul(Re,Qe),a=Math.imul(Re,Xe),a=a+Math.imul(We,Qe)|0,m=Math.imul(We,Xe);var sa=(b+p|0)+((a&8191)<<13)|0;return b=(m+(a>>>13)|0)+(sa>>>26)|0,sa&=67108863,v[0]=Vi,v[1]=qi,v[2]=$i,v[3]=zi,v[4]=Zi,v[5]=ji,v[6]=Ki,v[7]=Ji,v[8]=Yi,v[9]=Qi,v[10]=Xi,v[11]=ea,v[12]=ta,v[13]=ra,v[14]=oa,v[15]=na,v[16]=ia,v[17]=aa,v[18]=sa,b!==0&&(v[19]=b,l.length++),l};Math.imul||(k=S);function V(h,o,s){s.negative=o.negative^h.negative,s.length=h.length+o.length;for(var l=0,d=0,u=0;u<s.length-1;u++){var v=d;d=0;for(var b=l&67108863,p=Math.min(u,o.length-1),a=Math.max(0,u-h.length+1);a<=p;a++){var m=u-a,R=h.words[m]|0,W=o.words[a]|0,U=R*W,q=U&67108863;v=v+(U/67108864|0)|0,q=q+b|0,b=q&67108863,v=v+(q>>>26)|0,d+=v>>>26,v&=67108863}s.words[u]=b,l=v,v=d}return l!==0?s.words[u]=l:s.length--,s._strip()}function z(h,o,s){return V(h,o,s)}i.prototype.mulTo=function(o,s){var l,d=this.length+o.length;return this.length===10&&o.length===10?l=k(this,o,s):d<63?l=S(this,o,s):d<1024?l=V(this,o,s):l=z(this,o,s),l};function Z(h,o){this.x=h,this.y=o}Z.prototype.makeRBT=function(o){for(var s=new Array(o),l=i.prototype._countBits(o)-1,d=0;d<o;d++)s[d]=this.revBin(d,l,o);return s},Z.prototype.revBin=function(o,s,l){if(o===0||o===l-1)return o;for(var d=0,u=0;u<s;u++)d|=(o&1)<<s-u-1,o>>=1;return d},Z.prototype.permute=function(o,s,l,d,u,v){for(var b=0;b<v;b++)d[b]=s[o[b]],u[b]=l[o[b]]},Z.prototype.transform=function(o,s,l,d,u,v){this.permute(v,o,s,l,d,u);for(var b=1;b<u;b<<=1)for(var p=b<<1,a=Math.cos(2*Math.PI/p),m=Math.sin(2*Math.PI/p),R=0;R<u;R+=p)for(var W=a,U=m,q=0;q<b;q++){var x=l[R+q],C=d[R+q],$=l[R+q+b],I=d[R+q+b],ae=W*$-U*I;I=W*I+U*$,$=ae,l[R+q]=x+$,d[R+q]=C+I,l[R+q+b]=x-$,d[R+q+b]=C-I,q!==p&&(ae=a*W-m*U,U=a*U+m*W,W=ae)}},Z.prototype.guessLen13b=function(o,s){var l=Math.max(s,o)|1,d=l&1,u=0;for(l=l/2|0;l;l=l>>>1)u++;return 1<<u+1+d},Z.prototype.conjugate=function(o,s,l){if(!(l<=1))for(var d=0;d<l/2;d++){var u=o[d];o[d]=o[l-d-1],o[l-d-1]=u,u=s[d],s[d]=-s[l-d-1],s[l-d-1]=-u}},Z.prototype.normalize13b=function(o,s){for(var l=0,d=0;d<s/2;d++){var u=Math.round(o[2*d+1]/s)*8192+Math.round(o[2*d]/s)+l;o[d]=u&67108863,u<67108864?l=0:l=u/67108864|0}return o},Z.prototype.convert13b=function(o,s,l,d){for(var u=0,v=0;v<s;v++)u=u+(o[v]|0),l[2*v]=u&8191,u=u>>>13,l[2*v+1]=u&8191,u=u>>>13;for(v=2*s;v<d;++v)l[v]=0;r(u===0),r((u&-8192)===0)},Z.prototype.stub=function(o){for(var s=new Array(o),l=0;l<o;l++)s[l]=0;return s},Z.prototype.mulp=function(o,s,l){var d=2*this.guessLen13b(o.length,s.length),u=this.makeRBT(d),v=this.stub(d),b=new Array(d),p=new Array(d),a=new Array(d),m=new Array(d),R=new Array(d),W=new Array(d),U=l.words;U.length=d,this.convert13b(o.words,o.length,b,d),this.convert13b(s.words,s.length,m,d),this.transform(b,v,p,a,d,u),this.transform(m,v,R,W,d,u);for(var q=0;q<d;q++){var x=p[q]*R[q]-a[q]*W[q];a[q]=p[q]*W[q]+a[q]*R[q],p[q]=x}return this.conjugate(p,a,d),this.transform(p,a,U,v,d,u),this.conjugate(U,v,d),this.normalize13b(U,d),l.negative=o.negative^s.negative,l.length=o.length+s.length,l._strip()},i.prototype.mul=function(o){var s=new i(null);return s.words=new Array(this.length+o.length),this.mulTo(o,s)},i.prototype.mulf=function(o){var s=new i(null);return s.words=new Array(this.length+o.length),z(this,o,s)},i.prototype.imul=function(o){return this.clone().mulTo(o,this)},i.prototype.imuln=function(o){var s=o<0;s&&(o=-o),r(typeof o=="number"),r(o<67108864);for(var l=0,d=0;d<this.length;d++){var u=(this.words[d]|0)*o,v=(u&67108863)+(l&67108863);l>>=26,l+=u/67108864|0,l+=v>>>26,this.words[d]=v&67108863}return l!==0&&(this.words[d]=l,this.length++),s?this.ineg():this},i.prototype.muln=function(o){return this.clone().imuln(o)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(o){var s=E(o);if(s.length===0)return new i(1);for(var l=this,d=0;d<s.length&&s[d]===0;d++,l=l.sqr());if(++d<s.length)for(var u=l.sqr();d<s.length;d++,u=u.sqr())s[d]!==0&&(l=l.mul(u));return l},i.prototype.iushln=function(o){r(typeof o=="number"&&o>=0);var s=o%26,l=(o-s)/26,d=67108863>>>26-s<<26-s,u;if(s!==0){var v=0;for(u=0;u<this.length;u++){var b=this.words[u]&d,p=(this.words[u]|0)-b<<s;this.words[u]=p|v,v=b>>>26-s}v&&(this.words[u]=v,this.length++)}if(l!==0){for(u=this.length-1;u>=0;u--)this.words[u+l]=this.words[u];for(u=0;u<l;u++)this.words[u]=0;this.length+=l}return this._strip()},i.prototype.ishln=function(o){return r(this.negative===0),this.iushln(o)},i.prototype.iushrn=function(o,s,l){r(typeof o=="number"&&o>=0);var d;s?d=(s-s%26)/26:d=0;var u=o%26,v=Math.min((o-u)/26,this.length),b=67108863^67108863>>>u<<u,p=l;if(d-=v,d=Math.max(0,d),p){for(var a=0;a<v;a++)p.words[a]=this.words[a];p.length=v}if(v!==0)if(this.length>v)for(this.length-=v,a=0;a<this.length;a++)this.words[a]=this.words[a+v];else this.words[0]=0,this.length=1;var m=0;for(a=this.length-1;a>=0&&(m!==0||a>=d);a--){var R=this.words[a]|0;this.words[a]=m<<26-u|R>>>u,m=R&b}return p&&m!==0&&(p.words[p.length++]=m),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(o,s,l){return r(this.negative===0),this.iushrn(o,s,l)},i.prototype.shln=function(o){return this.clone().ishln(o)},i.prototype.ushln=function(o){return this.clone().iushln(o)},i.prototype.shrn=function(o){return this.clone().ishrn(o)},i.prototype.ushrn=function(o){return this.clone().iushrn(o)},i.prototype.testn=function(o){r(typeof o=="number"&&o>=0);var s=o%26,l=(o-s)/26,d=1<<s;if(this.length<=l)return!1;var u=this.words[l];return!!(u&d)},i.prototype.imaskn=function(o){r(typeof o=="number"&&o>=0);var s=o%26,l=(o-s)/26;if(r(this.negative===0,"imaskn works only with positive numbers"),this.length<=l)return this;if(s!==0&&l++,this.length=Math.min(l,this.length),s!==0){var d=67108863^67108863>>>s<<s;this.words[this.length-1]&=d}return this._strip()},i.prototype.maskn=function(o){return this.clone().imaskn(o)},i.prototype.iaddn=function(o){return r(typeof o=="number"),r(o<67108864),o<0?this.isubn(-o):this.negative!==0?this.length===1&&(this.words[0]|0)<=o?(this.words[0]=o-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(o),this.negative=1,this):this._iaddn(o)},i.prototype._iaddn=function(o){this.words[0]+=o;for(var s=0;s<this.length&&this.words[s]>=67108864;s++)this.words[s]-=67108864,s===this.length-1?this.words[s+1]=1:this.words[s+1]++;return this.length=Math.max(this.length,s+1),this},i.prototype.isubn=function(o){if(r(typeof o=="number"),r(o<67108864),o<0)return this.iaddn(-o);if(this.negative!==0)return this.negative=0,this.iaddn(o),this.negative=1,this;if(this.words[0]-=o,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var s=0;s<this.length&&this.words[s]<0;s++)this.words[s]+=67108864,this.words[s+1]-=1;return this._strip()},i.prototype.addn=function(o){return this.clone().iaddn(o)},i.prototype.subn=function(o){return this.clone().isubn(o)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(o,s,l){var d=o.length+l,u;this._expand(d);var v,b=0;for(u=0;u<o.length;u++){v=(this.words[u+l]|0)+b;var p=(o.words[u]|0)*s;v-=p&67108863,b=(v>>26)-(p/67108864|0),this.words[u+l]=v&67108863}for(;u<this.length-l;u++)v=(this.words[u+l]|0)+b,b=v>>26,this.words[u+l]=v&67108863;if(b===0)return this._strip();for(r(b===-1),b=0,u=0;u<this.length;u++)v=-(this.words[u]|0)+b,b=v>>26,this.words[u]=v&67108863;return this.negative=1,this._strip()},i.prototype._wordDiv=function(o,s){var l=this.length-o.length,d=this.clone(),u=o,v=u.words[u.length-1]|0,b=this._countBits(v);l=26-b,l!==0&&(u=u.ushln(l),d.iushln(l),v=u.words[u.length-1]|0);var p=d.length-u.length,a;if(s!=="mod"){a=new i(null),a.length=p+1,a.words=new Array(a.length);for(var m=0;m<a.length;m++)a.words[m]=0}var R=d.clone()._ishlnsubmul(u,1,p);R.negative===0&&(d=R,a&&(a.words[p]=1));for(var W=p-1;W>=0;W--){var U=(d.words[u.length+W]|0)*67108864+(d.words[u.length+W-1]|0);for(U=Math.min(U/v|0,67108863),d._ishlnsubmul(u,U,W);d.negative!==0;)U--,d.negative=0,d._ishlnsubmul(u,1,W),d.isZero()||(d.negative^=1);a&&(a.words[W]=U)}return a&&a._strip(),d._strip(),s!=="div"&&l!==0&&d.iushrn(l),{div:a||null,mod:d}},i.prototype.divmod=function(o,s,l){if(r(!o.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var d,u,v;return this.negative!==0&&o.negative===0?(v=this.neg().divmod(o,s),s!=="mod"&&(d=v.div.neg()),s!=="div"&&(u=v.mod.neg(),l&&u.negative!==0&&u.iadd(o)),{div:d,mod:u}):this.negative===0&&o.negative!==0?(v=this.divmod(o.neg(),s),s!=="mod"&&(d=v.div.neg()),{div:d,mod:v.mod}):(this.negative&o.negative)!==0?(v=this.neg().divmod(o.neg(),s),s!=="div"&&(u=v.mod.neg(),l&&u.negative!==0&&u.isub(o)),{div:v.div,mod:u}):o.length>this.length||this.cmp(o)<0?{div:new i(0),mod:this}:o.length===1?s==="div"?{div:this.divn(o.words[0]),mod:null}:s==="mod"?{div:null,mod:new i(this.modrn(o.words[0]))}:{div:this.divn(o.words[0]),mod:new i(this.modrn(o.words[0]))}:this._wordDiv(o,s)},i.prototype.div=function(o){return this.divmod(o,"div",!1).div},i.prototype.mod=function(o){return this.divmod(o,"mod",!1).mod},i.prototype.umod=function(o){return this.divmod(o,"mod",!0).mod},i.prototype.divRound=function(o){var s=this.divmod(o);if(s.mod.isZero())return s.div;var l=s.div.negative!==0?s.mod.isub(o):s.mod,d=o.ushrn(1),u=o.andln(1),v=l.cmp(d);return v<0||u===1&&v===0?s.div:s.div.negative!==0?s.div.isubn(1):s.div.iaddn(1)},i.prototype.modrn=function(o){var s=o<0;s&&(o=-o),r(o<=67108863);for(var l=(1<<26)%o,d=0,u=this.length-1;u>=0;u--)d=(l*d+(this.words[u]|0))%o;return s?-d:d},i.prototype.modn=function(o){return this.modrn(o)},i.prototype.idivn=function(o){var s=o<0;s&&(o=-o),r(o<=67108863);for(var l=0,d=this.length-1;d>=0;d--){var u=(this.words[d]|0)+l*67108864;this.words[d]=u/o|0,l=u%o}return this._strip(),s?this.ineg():this},i.prototype.divn=function(o){return this.clone().idivn(o)},i.prototype.egcd=function(o){r(o.negative===0),r(!o.isZero());var s=this,l=o.clone();s.negative!==0?s=s.umod(o):s=s.clone();for(var d=new i(1),u=new i(0),v=new i(0),b=new i(1),p=0;s.isEven()&&l.isEven();)s.iushrn(1),l.iushrn(1),++p;for(var a=l.clone(),m=s.clone();!s.isZero();){for(var R=0,W=1;(s.words[0]&W)===0&&R<26;++R,W<<=1);if(R>0)for(s.iushrn(R);R-- >0;)(d.isOdd()||u.isOdd())&&(d.iadd(a),u.isub(m)),d.iushrn(1),u.iushrn(1);for(var U=0,q=1;(l.words[0]&q)===0&&U<26;++U,q<<=1);if(U>0)for(l.iushrn(U);U-- >0;)(v.isOdd()||b.isOdd())&&(v.iadd(a),b.isub(m)),v.iushrn(1),b.iushrn(1);s.cmp(l)>=0?(s.isub(l),d.isub(v),u.isub(b)):(l.isub(s),v.isub(d),b.isub(u))}return{a:v,b,gcd:l.iushln(p)}},i.prototype._invmp=function(o){r(o.negative===0),r(!o.isZero());var s=this,l=o.clone();s.negative!==0?s=s.umod(o):s=s.clone();for(var d=new i(1),u=new i(0),v=l.clone();s.cmpn(1)>0&&l.cmpn(1)>0;){for(var b=0,p=1;(s.words[0]&p)===0&&b<26;++b,p<<=1);if(b>0)for(s.iushrn(b);b-- >0;)d.isOdd()&&d.iadd(v),d.iushrn(1);for(var a=0,m=1;(l.words[0]&m)===0&&a<26;++a,m<<=1);if(a>0)for(l.iushrn(a);a-- >0;)u.isOdd()&&u.iadd(v),u.iushrn(1);s.cmp(l)>=0?(s.isub(l),d.isub(u)):(l.isub(s),u.isub(d))}var R;return s.cmpn(1)===0?R=d:R=u,R.cmpn(0)<0&&R.iadd(o),R},i.prototype.gcd=function(o){if(this.isZero())return o.abs();if(o.isZero())return this.abs();var s=this.clone(),l=o.clone();s.negative=0,l.negative=0;for(var d=0;s.isEven()&&l.isEven();d++)s.iushrn(1),l.iushrn(1);do{for(;s.isEven();)s.iushrn(1);for(;l.isEven();)l.iushrn(1);var u=s.cmp(l);if(u<0){var v=s;s=l,l=v}else if(u===0||l.cmpn(1)===0)break;s.isub(l)}while(!0);return l.iushln(d)},i.prototype.invm=function(o){return this.egcd(o).a.umod(o)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(o){return this.words[0]&o},i.prototype.bincn=function(o){r(typeof o=="number");var s=o%26,l=(o-s)/26,d=1<<s;if(this.length<=l)return this._expand(l+1),this.words[l]|=d,this;for(var u=d,v=l;u!==0&&v<this.length;v++){var b=this.words[v]|0;b+=u,u=b>>>26,b&=67108863,this.words[v]=b}return u!==0&&(this.words[v]=u,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(o){var s=o<0;if(this.negative!==0&&!s)return-1;if(this.negative===0&&s)return 1;this._strip();var l;if(this.length>1)l=1;else{s&&(o=-o),r(o<=67108863,"Number is too big");var d=this.words[0]|0;l=d===o?0:d<o?-1:1}return this.negative!==0?-l|0:l},i.prototype.cmp=function(o){if(this.negative!==0&&o.negative===0)return-1;if(this.negative===0&&o.negative!==0)return 1;var s=this.ucmp(o);return this.negative!==0?-s|0:s},i.prototype.ucmp=function(o){if(this.length>o.length)return 1;if(this.length<o.length)return-1;for(var s=0,l=this.length-1;l>=0;l--){var d=this.words[l]|0,u=o.words[l]|0;if(d!==u){d<u?s=-1:d>u&&(s=1);break}}return s},i.prototype.gtn=function(o){return this.cmpn(o)===1},i.prototype.gt=function(o){return this.cmp(o)===1},i.prototype.gten=function(o){return this.cmpn(o)>=0},i.prototype.gte=function(o){return this.cmp(o)>=0},i.prototype.ltn=function(o){return this.cmpn(o)===-1},i.prototype.lt=function(o){return this.cmp(o)===-1},i.prototype.lten=function(o){return this.cmpn(o)<=0},i.prototype.lte=function(o){return this.cmp(o)<=0},i.prototype.eqn=function(o){return this.cmpn(o)===0},i.prototype.eq=function(o){return this.cmp(o)===0},i.red=function(o){return new H(o)},i.prototype.toRed=function(o){return r(!this.red,"Already a number in reduction context"),r(this.negative===0,"red works only with positives"),o.convertTo(this)._forceRed(o)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(o){return this.red=o,this},i.prototype.forceRed=function(o){return r(!this.red,"Already a number in reduction context"),this._forceRed(o)},i.prototype.redAdd=function(o){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,o)},i.prototype.redIAdd=function(o){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,o)},i.prototype.redSub=function(o){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,o)},i.prototype.redISub=function(o){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,o)},i.prototype.redShl=function(o){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,o)},i.prototype.redMul=function(o){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.mul(this,o)},i.prototype.redIMul=function(o){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.imul(this,o)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(o){return r(this.red&&!o.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,o)};var Y={k256:null,p224:null,p192:null,p25519:null};function Q(h,o){this.name=h,this.p=new i(o,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}Q.prototype._tmp=function(){var o=new i(null);return o.words=new Array(Math.ceil(this.n/13)),o},Q.prototype.ireduce=function(o){var s=o,l;do this.split(s,this.tmp),s=this.imulK(s),s=s.iadd(this.tmp),l=s.bitLength();while(l>this.n);var d=l<this.n?-1:s.ucmp(this.p);return d===0?(s.words[0]=0,s.length=1):d>0?s.isub(this.p):s.strip!==void 0?s.strip():s._strip(),s},Q.prototype.split=function(o,s){o.iushrn(this.n,0,s)},Q.prototype.imulK=function(o){return o.imul(this.k)};function ne(){Q.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}n(ne,Q),ne.prototype.split=function(o,s){for(var l=4194303,d=Math.min(o.length,9),u=0;u<d;u++)s.words[u]=o.words[u];if(s.length=d,o.length<=9){o.words[0]=0,o.length=1;return}var v=o.words[9];for(s.words[s.length++]=v&l,u=10;u<o.length;u++){var b=o.words[u]|0;o.words[u-10]=(b&l)<<4|v>>>22,v=b}v>>>=22,o.words[u-10]=v,v===0&&o.length>10?o.length-=10:o.length-=9},ne.prototype.imulK=function(o){o.words[o.length]=0,o.words[o.length+1]=0,o.length+=2;for(var s=0,l=0;l<o.length;l++){var d=o.words[l]|0;s+=d*977,o.words[l]=s&67108863,s=d*64+(s/67108864|0)}return o.words[o.length-1]===0&&(o.length--,o.words[o.length-1]===0&&o.length--),o};function it(){Q.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}n(it,Q);function at(){Q.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}n(at,Q);function ce(){Q.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}n(ce,Q),ce.prototype.imulK=function(o){for(var s=0,l=0;l<o.length;l++){var d=(o.words[l]|0)*19+s,u=d&67108863;d>>>=26,o.words[l]=u,s=d}return s!==0&&(o.words[o.length++]=s),o},i._prime=function(o){if(Y[o])return Y[o];var s;if(o==="k256")s=new ne;else if(o==="p224")s=new it;else if(o==="p192")s=new at;else if(o==="p25519")s=new ce;else throw new Error("Unknown prime "+o);return Y[o]=s,s};function H(h){if(typeof h=="string"){var o=i._prime(h);this.m=o.p,this.prime=o}else r(h.gtn(1),"modulus must be greater than 1"),this.m=h,this.prime=null}H.prototype._verify1=function(o){r(o.negative===0,"red works only with positives"),r(o.red,"red works only with red numbers")},H.prototype._verify2=function(o,s){r((o.negative|s.negative)===0,"red works only with positives"),r(o.red&&o.red===s.red,"red works only with red numbers")},H.prototype.imod=function(o){return this.prime?this.prime.ireduce(o)._forceRed(this):(w(o,o.umod(this.m)._forceRed(this)),o)},H.prototype.neg=function(o){return o.isZero()?o.clone():this.m.sub(o)._forceRed(this)},H.prototype.add=function(o,s){this._verify2(o,s);var l=o.add(s);return l.cmp(this.m)>=0&&l.isub(this.m),l._forceRed(this)},H.prototype.iadd=function(o,s){this._verify2(o,s);var l=o.iadd(s);return l.cmp(this.m)>=0&&l.isub(this.m),l},H.prototype.sub=function(o,s){this._verify2(o,s);var l=o.sub(s);return l.cmpn(0)<0&&l.iadd(this.m),l._forceRed(this)},H.prototype.isub=function(o,s){this._verify2(o,s);var l=o.isub(s);return l.cmpn(0)<0&&l.iadd(this.m),l},H.prototype.shl=function(o,s){return this._verify1(o),this.imod(o.ushln(s))},H.prototype.imul=function(o,s){return this._verify2(o,s),this.imod(o.imul(s))},H.prototype.mul=function(o,s){return this._verify2(o,s),this.imod(o.mul(s))},H.prototype.isqr=function(o){return this.imul(o,o.clone())},H.prototype.sqr=function(o){return this.mul(o,o)},H.prototype.sqrt=function(o){if(o.isZero())return o.clone();var s=this.m.andln(3);if(r(s%2===1),s===3){var l=this.m.add(new i(1)).iushrn(2);return this.pow(o,l)}for(var d=this.m.subn(1),u=0;!d.isZero()&&d.andln(1)===0;)u++,d.iushrn(1);r(!d.isZero());var v=new i(1).toRed(this),b=v.redNeg(),p=this.m.subn(1).iushrn(1),a=this.m.bitLength();for(a=new i(2*a*a).toRed(this);this.pow(a,p).cmp(b)!==0;)a.redIAdd(b);for(var m=this.pow(a,d),R=this.pow(o,d.addn(1).iushrn(1)),W=this.pow(o,d),U=u;W.cmp(v)!==0;){for(var q=W,x=0;q.cmp(v)!==0;x++)q=q.redSqr();r(x<U);var C=this.pow(m,new i(1).iushln(U-x-1));R=R.redMul(C),m=C.redSqr(),W=W.redMul(m),U=x}return R},H.prototype.invm=function(o){var s=o._invmp(this.m);return s.negative!==0?(s.negative=0,this.imod(s).redNeg()):this.imod(s)},H.prototype.pow=function(o,s){if(s.isZero())return new i(1).toRed(this);if(s.cmpn(1)===0)return o.clone();var l=4,d=new Array(1<<l);d[0]=new i(1).toRed(this),d[1]=o;for(var u=2;u<d.length;u++)d[u]=this.mul(d[u-1],o);var v=d[0],b=0,p=0,a=s.bitLength()%26;for(a===0&&(a=26),u=s.length-1;u>=0;u--){for(var m=s.words[u],R=a-1;R>=0;R--){var W=m>>R&1;if(v!==d[0]&&(v=this.sqr(v)),W===0&&b===0){p=0;continue}b<<=1,b|=W,p++,!(p!==l&&(u!==0||R!==0))&&(v=this.mul(v,d[b]),p=0,b=0)}a=26}return v},H.prototype.convertTo=function(o){var s=o.umod(this.m);return s===o?s.clone():s},H.prototype.convertFrom=function(o){var s=o.clone();return s.red=null,s},i.mont=function(o){return new j(o)};function j(h){H.call(this,h),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}n(j,H),j.prototype.convertTo=function(o){return this.imod(o.ushln(this.shift))},j.prototype.convertFrom=function(o){var s=this.imod(o.mul(this.rinv));return s.red=null,s},j.prototype.imul=function(o,s){if(o.isZero()||s.isZero())return o.words[0]=0,o.length=1,o;var l=o.imul(s),d=l.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),u=l.isub(d).iushrn(this.shift),v=u;return u.cmp(this.m)>=0?v=u.isub(this.m):u.cmpn(0)<0&&(v=u.iadd(this.m)),v._forceRed(this)},j.prototype.mul=function(o,s){if(o.isZero()||s.isZero())return new i(0)._forceRed(this);var l=o.mul(s),d=l.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),u=l.isub(d).iushrn(this.shift),v=u;return u.cmp(this.m)>=0?v=u.isub(this.m):u.cmpn(0)<0&&(v=u.iadd(this.m)),v._forceRed(this)},j.prototype.invm=function(o){var s=this.imod(o._invmp(this.m).mul(this.r2));return s._forceRed(this)}})(typeof ha>"u"||ha,El)});var Hn=nr((s2,Gn)=>{var rc,oc,nc,ic,ac,sc,lc,cc,dc,Bn,Aa,uc,fc,pc,xo,hc,mc,gc,vc,yc,bc,wc,Cc,xc,Fn;(function(e){var t=typeof global=="object"?global:typeof self=="object"?self:typeof this=="object"?this:{};typeof define=="function"&&define.amd?define("tslib",["exports"],function(n){e(r(t,r(n)))}):typeof Gn=="object"&&typeof Gn.exports=="object"?e(r(t,r(Gn.exports))):e(r(t));function r(n,i){return n!==t&&(typeof Object.create=="function"?Object.defineProperty(n,"__esModule",{value:!0}):n.__esModule=!0),function(c,f){return n[c]=i?i(c,f):f}}})(function(e){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var c in i)Object.prototype.hasOwnProperty.call(i,c)&&(n[c]=i[c])};rc=function(n,i){if(typeof i!="function"&&i!==null)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");t(n,i);function c(){this.constructor=n}n.prototype=i===null?Object.create(i):(c.prototype=i.prototype,new c)},oc=Object.assign||function(n){for(var i,c=1,f=arguments.length;c<f;c++){i=arguments[c];for(var g in i)Object.prototype.hasOwnProperty.call(i,g)&&(n[g]=i[g])}return n},nc=function(n,i){var c={};for(var f in n)Object.prototype.hasOwnProperty.call(n,f)&&i.indexOf(f)<0&&(c[f]=n[f]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var g=0,f=Object.getOwnPropertySymbols(n);g<f.length;g++)i.indexOf(f[g])<0&&Object.prototype.propertyIsEnumerable.call(n,f[g])&&(c[f[g]]=n[f[g]]);return c},ic=function(n,i,c,f){var g=arguments.length,y=g<3?i:f===null?f=Object.getOwnPropertyDescriptor(i,c):f,w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(n,i,c,f);else for(var A=n.length-1;A>=0;A--)(w=n[A])&&(y=(g<3?w(y):g>3?w(i,c,y):w(i,c))||y);return g>3&&y&&Object.defineProperty(i,c,y),y},ac=function(n,i){return function(c,f){i(c,f,n)}},sc=function(n,i){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,i)},lc=function(n,i,c,f){function g(y){return y instanceof c?y:new c(function(w){w(y)})}return new(c||(c=Promise))(function(y,w){function A(T){try{_(f.next(T))}catch(M){w(M)}}function P(T){try{_(f.throw(T))}catch(M){w(M)}}function _(T){T.done?y(T.value):g(T.value).then(A,P)}_((f=f.apply(n,i||[])).next())})},cc=function(n,i){var c={label:0,sent:function(){if(y[0]&1)throw y[1];return y[1]},trys:[],ops:[]},f,g,y,w;return w={next:A(0),throw:A(1),return:A(2)},typeof Symbol=="function"&&(w[Symbol.iterator]=function(){return this}),w;function A(_){return function(T){return P([_,T])}}function P(_){if(f)throw new TypeError("Generator is already executing.");for(;c;)try{if(f=1,g&&(y=_[0]&2?g.return:_[0]?g.throw||((y=g.return)&&y.call(g),0):g.next)&&!(y=y.call(g,_[1])).done)return y;switch(g=0,y&&(_=[_[0]&2,y.value]),_[0]){case 0:case 1:y=_;break;case 4:return c.label++,{value:_[1],done:!1};case 5:c.label++,g=_[1],_=[0];continue;case 7:_=c.ops.pop(),c.trys.pop();continue;default:if(y=c.trys,!(y=y.length>0&&y[y.length-1])&&(_[0]===6||_[0]===2)){c=0;continue}if(_[0]===3&&(!y||_[1]>y[0]&&_[1]<y[3])){c.label=_[1];break}if(_[0]===6&&c.label<y[1]){c.label=y[1],y=_;break}if(y&&c.label<y[2]){c.label=y[2],c.ops.push(_);break}y[2]&&c.ops.pop(),c.trys.pop();continue}_=i.call(n,c)}catch(T){_=[6,T],g=0}finally{f=y=0}if(_[0]&5)throw _[1];return{value:_[0]?_[1]:void 0,done:!0}}},dc=function(n,i){for(var c in n)c!=="default"&&!Object.prototype.hasOwnProperty.call(i,c)&&Fn(i,n,c)},Fn=Object.create?function(n,i,c,f){f===void 0&&(f=c);var g=Object.getOwnPropertyDescriptor(i,c);(!g||("get"in g?!i.__esModule:g.writable||g.configurable))&&(g={enumerable:!0,get:function(){return i[c]}}),Object.defineProperty(n,f,g)}:function(n,i,c,f){f===void 0&&(f=c),n[f]=i[c]},Bn=function(n){var i=typeof Symbol=="function"&&Symbol.iterator,c=i&&n[i],f=0;if(c)return c.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&f>=n.length&&(n=void 0),{value:n&&n[f++],done:!n}}};throw new TypeError(i?"Object is not iterable.":"Symbol.iterator is not defined.")},Aa=function(n,i){var c=typeof Symbol=="function"&&n[Symbol.iterator];if(!c)return n;var f=c.call(n),g,y=[],w;try{for(;(i===void 0||i-- >0)&&!(g=f.next()).done;)y.push(g.value)}catch(A){w={error:A}}finally{try{g&&!g.done&&(c=f.return)&&c.call(f)}finally{if(w)throw w.error}}return y},uc=function(){for(var n=[],i=0;i<arguments.length;i++)n=n.concat(Aa(arguments[i]));return n},fc=function(){for(var n=0,i=0,c=arguments.length;i<c;i++)n+=arguments[i].length;for(var f=Array(n),g=0,i=0;i<c;i++)for(var y=arguments[i],w=0,A=y.length;w<A;w++,g++)f[g]=y[w];return f},pc=function(n,i,c){if(c||arguments.length===2)for(var f=0,g=i.length,y;f<g;f++)(y||!(f in i))&&(y||(y=Array.prototype.slice.call(i,0,f)),y[f]=i[f]);return n.concat(y||Array.prototype.slice.call(i))},xo=function(n){return this instanceof xo?(this.v=n,this):new xo(n)},hc=function(n,i,c){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var f=c.apply(n,i||[]),g,y=[];return g={},w("next"),w("throw"),w("return"),g[Symbol.asyncIterator]=function(){return this},g;function w(E){f[E]&&(g[E]=function(S){return new Promise(function(k,V){y.push([E,S,k,V])>1||A(E,S)})})}function A(E,S){try{P(f[E](S))}catch(k){M(y[0][3],k)}}function P(E){E.value instanceof xo?Promise.resolve(E.value.v).then(_,T):M(y[0][2],E)}function _(E){A("next",E)}function T(E){A("throw",E)}function M(E,S){E(S),y.shift(),y.length&&A(y[0][0],y[0][1])}},mc=function(n){var i,c;return i={},f("next"),f("throw",function(g){throw g}),f("return"),i[Symbol.iterator]=function(){return this},i;function f(g,y){i[g]=n[g]?function(w){return(c=!c)?{value:xo(n[g](w)),done:g==="return"}:y?y(w):w}:y}},gc=function(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=n[Symbol.asyncIterator],c;return i?i.call(n):(n=typeof Bn=="function"?Bn(n):n[Symbol.iterator](),c={},f("next"),f("throw"),f("return"),c[Symbol.asyncIterator]=function(){return this},c);function f(y){c[y]=n[y]&&function(w){return new Promise(function(A,P){w=n[y](w),g(A,P,w.done,w.value)})}}function g(y,w,A,P){Promise.resolve(P).then(function(_){y({value:_,done:A})},w)}},vc=function(n,i){return Object.defineProperty?Object.defineProperty(n,"raw",{value:i}):n.raw=i,n};var r=Object.create?function(n,i){Object.defineProperty(n,"default",{enumerable:!0,value:i})}:function(n,i){n.default=i};yc=function(n){if(n&&n.__esModule)return n;var i={};if(n!=null)for(var c in n)c!=="default"&&Object.prototype.hasOwnProperty.call(n,c)&&Fn(i,n,c);return r(i,n),i},bc=function(n){return n&&n.__esModule?n:{default:n}},wc=function(n,i,c,f){if(c==="a"&&!f)throw new TypeError("Private accessor was defined without a getter");if(typeof i=="function"?n!==i||!f:!i.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return c==="m"?f:c==="a"?f.call(n):f?f.value:i.get(n)},Cc=function(n,i,c,f,g){if(f==="m")throw new TypeError("Private method is not writable");if(f==="a"&&!g)throw new TypeError("Private accessor was defined without a setter");if(typeof i=="function"?n!==i||!g:!i.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return f==="a"?g.call(n,c):g?g.value=c:i.set(n,c),c},xc=function(n,i){if(i===null||typeof i!="object"&&typeof i!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof n=="function"?i===n:n.has(i)},e("__extends",rc),e("__assign",oc),e("__rest",nc),e("__decorate",ic),e("__param",ac),e("__metadata",sc),e("__awaiter",lc),e("__generator",cc),e("__exportStar",dc),e("__createBinding",Fn),e("__values",Bn),e("__read",Aa),e("__spread",uc),e("__spreadArrays",fc),e("__spreadArray",pc),e("__await",xo),e("__asyncGenerator",hc),e("__asyncDelegator",mc),e("__asyncValues",gc),e("__makeTemplateObject",vc),e("__importStar",yc),e("__importDefault",bc),e("__classPrivateFieldGet",wc),e("__classPrivateFieldSet",Cc),e("__classPrivateFieldIn",xc)})});var Sa=nr(de=>{"use strict";Object.defineProperty(de,"__esModule",{value:!0});de.getLocalStorage=de.getLocalStorageOrThrow=de.getCrypto=de.getCryptoOrThrow=de.getLocation=de.getLocationOrThrow=de.getNavigator=de.getNavigatorOrThrow=de.getDocument=de.getDocumentOrThrow=de.getFromWindowOrThrow=de.getFromWindow=void 0;function eo(e){let t;return typeof window<"u"&&typeof window[e]<"u"&&(t=window[e]),t}de.getFromWindow=eo;function Eo(e){let t=eo(e);if(!t)throw new Error(`${e} is not defined in Window`);return t}de.getFromWindowOrThrow=Eo;function Vu(){return Eo("document")}de.getDocumentOrThrow=Vu;function qu(){return eo("document")}de.getDocument=qu;function $u(){return Eo("navigator")}de.getNavigatorOrThrow=$u;function zu(){return eo("navigator")}de.getNavigator=zu;function Zu(){return Eo("location")}de.getLocationOrThrow=Zu;function ju(){return eo("location")}de.getLocation=ju;function Ku(){return Eo("crypto")}de.getCryptoOrThrow=Ku;function Ju(){return eo("crypto")}de.getCrypto=Ju;function Yu(){return Eo("localStorage")}de.getLocalStorageOrThrow=Yu;function Qu(){return eo("localStorage")}de.getLocalStorage=Qu});var _c=nr(Vn=>{"use strict";Object.defineProperty(Vn,"__esModule",{value:!0});Vn.getWindowMetadata=void 0;var Ec=Sa();function Xu(){let e,t;try{e=Ec.getDocumentOrThrow(),t=Ec.getLocationOrThrow()}catch{return null}function r(){let P=e.getElementsByTagName("link"),_=[];for(let T=0;T<P.length;T++){let M=P[T],E=M.getAttribute("rel");if(E&&E.toLowerCase().indexOf("icon")>-1){let S=M.getAttribute("href");if(S)if(S.toLowerCase().indexOf("https:")===-1&&S.toLowerCase().indexOf("http:")===-1&&S.indexOf("//")!==0){let k=t.protocol+"//"+t.host;if(S.indexOf("/")===0)k+=S;else{let V=t.pathname.split("/");V.pop(),k+=V.join("/")+"/"+S}_.push(k)}else if(S.indexOf("//")===0){let k=t.protocol+S;_.push(k)}else _.push(S)}}return _}function n(...P){let _=e.getElementsByTagName("meta");for(let T=0;T<_.length;T++){let M=_[T],E=["itemprop","property","name"].map(S=>M.getAttribute(S)).filter(S=>S?P.includes(S):!1);if(E.length&&E){let S=M.getAttribute("content");if(S)return S}}return""}function i(){let P=n("name","og:site_name","og:title","twitter:title");return P||(P=e.title),P}function c(){return n("description","og:description","twitter:description","keywords")}let f=i(),g=c(),y=t.origin,w=r();return{description:g,url:y,icons:w,name:f}}Vn.getWindowMetadata=Xu});var Nc={};la(Nc,{BotInfo:()=>Lc,BrowserInfo:()=>Sc,NodeInfo:()=>Tc,ReactNativeInfo:()=>kc,SearchBotDeviceInfo:()=>Mc,browserName:()=>i0,detect:()=>n0,detectOS:()=>Wc,getNodeVersion:()=>Ic,parseUserAgent:()=>Ta});function n0(e){return e?Ta(e):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new kc:typeof navigator<"u"?Ta(navigator.userAgent):Ic()}function Rc(e){return e!==""&&o0.reduce(function(t,r){var n=r[0],i=r[1];if(t)return t;var c=i.exec(e);return!!c&&[n,c]},!1)}function i0(e){var t=Rc(e);return t?t[0]:null}function Ta(e){var t=Rc(e);if(!t)return null;var r=t[0],n=t[1];if(r==="searchbot")return new Lc;var i=n[1]&&n[1].split(/[._]/).slice(0,3);i?i.length<Pc&&(i=e0(i,a0(Pc-i.length))):i=[];var c=i.join("."),f=Wc(e),g=r0.exec(e);return g&&g[1]?new Mc(r,c,f,g[1]):new Sc(r,c,f)}function Wc(e){for(var t=0,r=Ac.length;t<r;t++){var n=Ac[t],i=n[0],c=n[1],f=c.exec(e);if(f)return i}return null}function Ic(){var e=typeof process<"u"&&process.version;return e?new Tc(process.version.slice(1)):null}function a0(e){for(var t=[],r=0;r<e;r++)t.push("0");return t}var e0,Sc,Tc,Mc,Lc,kc,t0,r0,Pc,o0,Ac,Oc=qs(()=>{e0=function(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;for(var n=Array(e),i=0,t=0;t<r;t++)for(var c=arguments[t],f=0,g=c.length;f<g;f++,i++)n[i]=c[f];return n},Sc=function(){function e(t,r,n){this.name=t,this.version=r,this.os=n,this.type="browser"}return e}(),Tc=function(){function e(t){this.version=t,this.type="node",this.name="node",this.os=process.platform}return e}(),Mc=function(){function e(t,r,n,i){this.name=t,this.version=r,this.os=n,this.bot=i,this.type="bot-device"}return e}(),Lc=function(){function e(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return e}(),kc=function(){function e(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return e}(),t0=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,r0=/(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,Pc=3,o0=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/EdgA?\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FBAV\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["searchbot",t0]],Ac=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]]});var La=nr(J=>{"use strict";Object.defineProperty(J,"__esModule",{value:!0});J.getClientMeta=J.getLocalStorage=J.getLocalStorageOrThrow=J.getCrypto=J.getCryptoOrThrow=J.getLocation=J.getLocationOrThrow=J.getNavigator=J.getNavigatorOrThrow=J.getDocument=J.getDocumentOrThrow=J.getFromWindowOrThrow=J.getFromWindow=J.isBrowser=J.isNode=J.isMobile=J.isIOS=J.isAndroid=J.detectOS=J.detectEnv=void 0;var Dc=Hn(),s0=Dc.__importStar(_c()),qt=Dc.__importStar(Sa()),l0=(Oc(),ca(Nc));function Ma(e){return(0,l0.detect)(e)}J.detectEnv=Ma;function qn(){let e=Ma();return e&&e.os?e.os:void 0}J.detectOS=qn;function Uc(){let e=qn();return e?e.toLowerCase().includes("android"):!1}J.isAndroid=Uc;function Bc(){let e=qn();return e?e.toLowerCase().includes("ios")||e.toLowerCase().includes("mac")&&navigator.maxTouchPoints>1:!1}J.isIOS=Bc;function c0(){return qn()?Uc()||Bc():!1}J.isMobile=c0;function Fc(){let e=Ma();return e&&e.name?e.name.toLowerCase()==="node":!1}J.isNode=Fc;function d0(){return!Fc()&&!!(0,J.getNavigator)()}J.isBrowser=d0;J.getFromWindow=qt.getFromWindow;J.getFromWindowOrThrow=qt.getFromWindowOrThrow;J.getDocumentOrThrow=qt.getDocumentOrThrow;J.getDocument=qt.getDocument;J.getNavigatorOrThrow=qt.getNavigatorOrThrow;J.getNavigator=qt.getNavigator;J.getLocationOrThrow=qt.getLocationOrThrow;J.getLocation=qt.getLocation;J.getCryptoOrThrow=qt.getCryptoOrThrow;J.getCrypto=qt.getCrypto;J.getLocalStorageOrThrow=qt.getLocalStorageOrThrow;J.getLocalStorage=qt.getLocalStorage;function u0(){return s0.getWindowMetadata()}J.getClientMeta=u0});var Gc={};la(Gc,{safeJsonParse:()=>f0,safeJsonStringify:()=>p0});function f0(e){if(typeof e!="string")throw new Error(`Cannot safe json parse value of type ${typeof e}`);try{return JSON.parse(e)}catch{return e}}function p0(e){return typeof e=="string"?e:JSON.stringify(e)}var Hc=qs(()=>{});var ka=nr(_o=>{"use strict";Object.defineProperty(_o,"__esModule",{value:!0});_o.safeJsonStringify=_o.safeJsonParse=void 0;var h0=Hn(),Vc=h0.__importStar((Hc(),ca(Gc)));_o.safeJsonParse=Vc.safeJsonParse;_o.safeJsonStringify=Vc.safeJsonStringify});var Wa=nr(Ir=>{"use strict";Object.defineProperty(Ir,"__esModule",{value:!0});Ir.removeLocal=Ir.getLocal=Ir.setLocal=void 0;var qc=ka(),Ra=La();function m0(e,t){let r=(0,qc.safeJsonStringify)(t),n=(0,Ra.getLocalStorage)();n&&n.setItem(e,r)}Ir.setLocal=m0;function g0(e){let t=null,r=null,n=(0,Ra.getLocalStorage)();return n&&(r=n.getItem(e)),t=r&&(0,qc.safeJsonParse)(r),t}Ir.getLocal=g0;function v0(e){let t=(0,Ra.getLocalStorage)();t&&t.removeItem(e)}Ir.removeLocal=v0});var zc=nr(_t=>{"use strict";Object.defineProperty(_t,"__esModule",{value:!0});_t.getMobileLinkRegistry=_t.getMobileRegistryEntry=_t.saveMobileLinkInfo=_t.formatIOSMobile=_t.mobileLinkChoiceKey=void 0;var y0=Wa();_t.mobileLinkChoiceKey="WALLETCONNECT_DEEPLINK_CHOICE";function b0(e,t){let r=encodeURIComponent(e);return t.universalLink?`${t.universalLink}/wc?uri=${r}`:t.deepLink?`${t.deepLink}${t.deepLink.endsWith(":")?"//":"/"}wc?uri=${r}`:""}_t.formatIOSMobile=b0;function w0(e){let t=e.href.split("?")[0];(0,y0.setLocal)(_t.mobileLinkChoiceKey,Object.assign(Object.assign({},e),{href:t}))}_t.saveMobileLinkInfo=w0;function $c(e,t){return e.filter(r=>r.name.toLowerCase().includes(t.toLowerCase()))[0]}_t.getMobileRegistryEntry=$c;function C0(e,t){let r=e;return t&&(r=t.map(n=>$c(e,n)).filter(Boolean)),r}_t.getMobileLinkRegistry=C0});var Kc=nr(sr=>{"use strict";Object.defineProperty(sr,"__esModule",{value:!0});sr.formatMobileRegistry=sr.formatMobileRegistryEntry=sr.getDappRegistryUrl=sr.getWalletRegistryUrl=void 0;var Zc="https://registry.walletconnect.com";function x0(){return Zc+"/api/v2/wallets"}sr.getWalletRegistryUrl=x0;function E0(){return Zc+"/api/v2/dapps"}sr.getDappRegistryUrl=E0;function jc(e,t="mobile"){var r;return{name:e.name||"",shortName:e.metadata.shortName||"",color:e.metadata.colors.primary||"",logo:(r=e.image_url.sm)!==null&&r!==void 0?r:"",universalLink:e[t].universal||"",deepLink:e[t].native||""}}sr.formatMobileRegistryEntry=jc;function _0(e,t="mobile"){return Object.values(e).filter(r=>!!r[t].universal||!!r[t].native).map(r=>jc(r,t))}sr.formatMobileRegistry=_0});var Jc=nr(to=>{"use strict";Object.defineProperty(to,"__esModule",{value:!0});var Ko=Hn();Ko.__exportStar(La(),to);Ko.__exportStar(ka(),to);Ko.__exportStar(Wa(),to);Ko.__exportStar(zc(),to);Ko.__exportStar(Kc(),to)});var Ah={};la(Ah,{AsExternalProvider:()=>Rr,ConnectorManager:()=>Po,PrivyClient:()=>So,PrivyProvider:()=>Eu,PrivyProxyProvider:()=>Gt,VERSION:()=>En,WalletConnector:()=>wt,getAccessToken:()=>wo,usePrivy:()=>ie});module.exports=ca(Ah);var wu=require("@ethersproject/providers"),ve=require("react");var B=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};var zs=N(require("axios")),Kt=class extends Error{constructor(r,n,i){super(r);n instanceof Error&&(this.cause=n),this.privyErrorCode=i}toString(){return`${this.type}${this.privyErrorCode?`-${this.privyErrorCode}`:""}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}},mo=class extends Kt{constructor(r,n,i,c,f){super(i,c,f);this.type=r;this.status=n}},F=class extends Kt{constructor(r,n,i){super(r,n,i);this.type="client_error"}};var ye=class extends Kt{constructor(r,n,i){super(r,n,i);this.type="connector_error"}},st=e=>{if(e instanceof Kt)return e;if(!zs.default.isAxiosError(e))return Nt(e);if(!e.response)return new mo("api_error",null,e.message,e);let{type:t,message:r,error:n,code:i}=e.response.data;return new mo(t||"ApiError",e.response.status,r||n,e,i)},Nt=e=>e instanceof Kt?e:e instanceof Error?new F(e.message,e):new F(`Internal error: ${e}`);var Zs=()=>"/api/v1/sessions",js=()=>"/api/v1/sessions/logout",Ks=()=>"/api/v1/sessions/fork",Js=()=>"/api/v1/sessions/fork/recover",Ys=()=>"/api/v1/siwe/init",Qs=()=>"/api/v1/siwe/authenticate",Xs=()=>"/api/v1/siwe/link",el=()=>"/api/v1/passwordless/init",tl=()=>"/api/v1/passwordless/authenticate",rl=()=>"/api/v1/passwordless/link",ol=()=>"/api/v1/passwordless_sms/init",nl=()=>"/api/v1/passwordless_sms/authenticate",il=()=>"/api/v1/passwordless_sms/link",al=()=>"/api/v1/oauth/init",sl=()=>"/api/v1/oauth/authenticate",ll=()=>"/api/v1/oauth/link",cl=()=>"/api/v1/siwe/unlink",dl=()=>"/api/v1/passwordless/unlink",ul=()=>"/api/v1/passwordless_sms/unlink",fl=()=>"/api/v1/oauth/unlink",pl=()=>"/api/v1/analytics_events";var jr=class{constructor(t){this.meta={email:t}}async authenticate(){if(!this.api)throw new F("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new F("Email and email code must be set prior to calling authenticate.");try{let t=tl(),r=await this.api.post(t,{email:this.meta.email,code:this.meta.emailCode});return{user:r.data.user,token:r.data.token,refresh_token:r.data.refresh_token,is_new_user:r.data.is_new_user}}catch(t){throw st(t)}}async link(){if(!this.api)throw new F("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new F("Email and email code must be set prior to calling authenticate.");try{let t=rl();return(await this.api.post(t,{email:this.meta.email,code:this.meta.emailCode})).data}catch(t){throw st(t)}}async sendCodeEmail(t){if(!this.api)throw new F("Auth flow has no API instance");if(t&&(this.meta.email=t),!this.meta.email)throw new F("Email must be set when initialzing authentication.");try{let r=el();return(await this.api.post(r,{email:this.meta.email})).data}catch(r){throw st(r)}}};var Mr=class{constructor(t,r,n){this.meta={provider:t},this.meta.authorizationCode=r,this.meta.stateCode=n}isActive(){return!!(this.meta.authorizationCode&&this.meta.stateCode&&this.meta.provider)}async authenticate(){if(!this.api)throw new F("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new F("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new F("User denied confirmation during OAuth flow");try{let t=sl(),r=await this.api.post(t,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode});return{user:r.data.user,token:r.data.token,refresh_token:r.data.refresh_token,is_new_user:r.data.is_new_user}}catch(t){throw st(t)}}async link(){if(!this.api)throw new F("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new F("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new F("User denied confirmation during OAuth flow");try{let t=ll();return(await this.api.post(t,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode})).data}catch(t){throw st(t)}}async getAuthorizationUrl(){var t;if(!this.api)throw new F("Auth flow has no API instance");if(!this.meta.provider)throw new F("Provider must be set when initialzing OAuth authentication.");try{let r=al();return(await this.api.post(r,{provider:this.meta.provider,redirect_to:window.location.href},{baseURL:(t=this.api)==null?void 0:t.fallbackApiUrl})).data}catch(r){throw st(r)}}};var Lr=class{constructor(t,r,n){this._meta={walletType:r,walletId:n},this.connectors=t,this.walletConnector=this.connectors.createWalletConnector(r,null,n)}get meta(){return{...this._meta,walletName:this.walletConnector.walletBranding.name,walletIcon:this.walletConnector.walletBranding.icon}}async authenticate(){if(!this.api)throw new F("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign(),n=await this.api.post(Qs(),{message:t,signature:r});return this.connectors.addWalletConnector(this.walletConnector),await this.connectors.setActiveWallet(this.walletConnector.address)||console.warn("Failed to set active wallet"),{user:n.data.user,token:n.data.token,refresh_token:n.data.refresh_token,is_new_user:n.data.is_new_user}}catch(t){throw st(t)}}async link(){if(!this.api)throw new F("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign(),n=await this.api.post(Xs(),{message:t,signature:r});return this.connectors.addWalletConnector(this.walletConnector),await this.connectors.setActiveWallet(this.walletConnector.address)||console.warn("Failed to set active wallet"),n.data}catch(t){throw st(t)}}async promptConnect(){if(!this.api)throw new F("Auth flow has no API instance");let t=await this.walletConnector.connect({showPrompt:!0});return await this.buildSiweMessage(t),t}async sign(){if(!this.api)throw new F("Auth flow has no API instance");if(!this.preparedMessage){let r=await this.walletConnector.connect({showPrompt:!1});await this.buildSiweMessage(r)}if(!this.preparedMessage)throw new F("Could not prepare SIWE message");let t=await this.walletConnector.sign(this.preparedMessage);return{message:this.preparedMessage,signature:t}}async buildSiweMessage(t){if(!this.api)throw new F("Auth flow has no API instance");let r=t.address,n=t.chainId,i=await this.api.post(Ys(),{address:r});return this.preparedMessage=this.walletConnector.prepareMessage(n,r,i.data.nonce),this.preparedMessage}};var Kr=class{constructor(t){this.meta={phoneNumber:t}}async authenticate(){if(!this.api)throw new F("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new F("phone number and sms code must be set prior to calling authenticate.");try{let t=nl(),r=await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return{user:r.data.user,token:r.data.token,refresh_token:r.data.refresh_token,is_new_user:r.data.is_new_user}}catch(t){throw st(t)}}async link(){if(!this.api)throw new F("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new F("phone number and sms code must be set prior to calling authenticate.");try{let t=il();return(await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})).data}catch(t){throw st(t)}}async sendSmsCode(t){if(!this.api)throw new F("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),!this.meta.phoneNumber)throw new F("phone nNumber must be set when initialzing authentication.");try{let r=ol();return(await this.api.post(r,{phoneNumber:this.meta.phoneNumber})).data}catch(r){throw st(r)}}};var od=require("@ethersproject/address");var hl="1.24.0-beta.6";var ir="4df5e2316331463a9130964bd6078dfa",xn="https://auth.privy.io",ml=1e4,Ot=1400,En=hl;var go="privy:token",_n="privy:refresh_token",$o="privy:session_transfer_token",Pn="privy:connectors",da="walletconnect",gl=3e4,Dt=1;var ua=class{constructor(){this._cache={}}get(t){return this._cache[t]}put(t,r){r!==void 0?this._cache[t]=r:this.del(t)}del(t){delete this._cache[t]}getKeys(){return Object.keys(this._cache)}},fa=class{get(t){let r=localStorage.getItem(t);return r===null?void 0:JSON.parse(r)}put(t,r){r!==void 0?localStorage.setItem(t,JSON.stringify(r)):this.del(t)}del(t){localStorage.removeItem(t)}getKeys(){return Object.entries(localStorage).map(([t])=>t)}};function Lu(){return typeof window<"u"&&window.localStorage?new fa:new ua}var me=Lu();var zl=N(require("@coinbase/wallet-sdk")),Zl=require("@ethersproject/address");var zo=require("react/jsx-runtime"),Ut=({style:e,...t})=>(0,zo.jsxs)("svg",{width:"1024",height:"1024",viewBox:"0 0 1024 1024",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...e},...t,children:[(0,zo.jsx)("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),(0,zo.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z",fill:"white"})]});var ql=require("@ethersproject/address"),$l=require("@ethersproject/providers");var bl=require("@ethersproject/logger");var vl="bytes/5.7.0";var vo=new bl.Logger(vl);function wl(e){return!!e.toHexString}function An(e){return e.slice||(e.slice=function(){let t=Array.prototype.slice.call(arguments);return An(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function yl(e){return typeof e=="number"&&e==e&&e%1===0}function Sn(e){if(e==null)return!1;if(e.constructor===Uint8Array)return!0;if(typeof e=="string"||!yl(e.length)||e.length<0)return!1;for(let t=0;t<e.length;t++){let r=e[t];if(!yl(r)||r<0||r>=256)return!1}return!0}function Cl(e,t){if(t||(t={}),typeof e=="number"){vo.checkSafeUint53(e,"invalid arrayify value");let r=[];for(;e;)r.unshift(e&255),e=parseInt(String(e/256));return r.length===0&&r.push(0),An(new Uint8Array(r))}if(t.allowMissingPrefix&&typeof e=="string"&&e.substring(0,2)!=="0x"&&(e="0x"+e),wl(e)&&(e=e.toHexString()),gr(e)){let r=e.substring(2);r.length%2&&(t.hexPad==="left"?r="0"+r:t.hexPad==="right"?r+="0":vo.throwArgumentError("hex data is odd-length","value",e));let n=[];for(let i=0;i<r.length;i+=2)n.push(parseInt(r.substring(i,i+2),16));return An(new Uint8Array(n))}return Sn(e)?An(new Uint8Array(e)):vo.throwArgumentError("invalid arrayify value","value",e)}function gr(e,t){return!(typeof e!="string"||!e.match(/^0x[0-9A-Fa-f]*$/)||t&&e.length!==2+2*t)}var pa="0123456789abcdef";function xl(e,t){if(t||(t={}),typeof e=="number"){vo.checkSafeUint53(e,"invalid hexlify value");let r="";for(;e;)r=pa[e&15]+r,e=Math.floor(e/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"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),wl(e))return e.toHexString();if(gr(e))return e.length%2&&(t.hexPad==="left"?e="0x0"+e.substring(2):t.hexPad==="right"?e+="0":vo.throwArgumentError("hex data is odd-length","value",e)),e.toLowerCase();if(Sn(e)){let r="0x";for(let n=0;n<e.length;n++){let i=e[n];r+=pa[(i&240)>>4]+pa[i&15]}return r}return vo.throwArgumentError("invalid hexlify value","value",e)}var Fl=require("@ethersproject/providers");var Tl=N(_l());var Jr=require("@ethersproject/logger");var Pl="bignumber/5.7.0";var ga=Tl.default.BN,vr=new Jr.Logger(Pl),ma={},Al=9007199254740991;var Sl=!1,lt=class{constructor(t,r){t!==ma&&vr.throwError("cannot call constructor directly; use BigNumber.from",Jr.Logger.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=r,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return yt(ee(this).fromTwos(t))}toTwos(t){return yt(ee(this).toTwos(t))}abs(){return this._hex[0]==="-"?lt.from(this._hex.substring(1)):this}add(t){return yt(ee(this).add(ee(t)))}sub(t){return yt(ee(this).sub(ee(t)))}div(t){return lt.from(t).isZero()&&Bt("division-by-zero","div"),yt(ee(this).div(ee(t)))}mul(t){return yt(ee(this).mul(ee(t)))}mod(t){let r=ee(t);return r.isNeg()&&Bt("division-by-zero","mod"),yt(ee(this).umod(r))}pow(t){let r=ee(t);return r.isNeg()&&Bt("negative-power","pow"),yt(ee(this).pow(r))}and(t){let r=ee(t);return(this.isNegative()||r.isNeg())&&Bt("unbound-bitwise-result","and"),yt(ee(this).and(r))}or(t){let r=ee(t);return(this.isNegative()||r.isNeg())&&Bt("unbound-bitwise-result","or"),yt(ee(this).or(r))}xor(t){let r=ee(t);return(this.isNegative()||r.isNeg())&&Bt("unbound-bitwise-result","xor"),yt(ee(this).xor(r))}mask(t){return(this.isNegative()||t<0)&&Bt("negative-width","mask"),yt(ee(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&Bt("negative-width","shl"),yt(ee(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&Bt("negative-width","shr"),yt(ee(this).shrn(t))}eq(t){return ee(this).eq(ee(t))}lt(t){return ee(this).lt(ee(t))}lte(t){return ee(this).lte(ee(t))}gt(t){return ee(this).gt(ee(t))}gte(t){return ee(this).gte(ee(t))}isNegative(){return this._hex[0]==="-"}isZero(){return ee(this).isZero()}toNumber(){try{return ee(this).toNumber()}catch{Bt("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return vr.throwError("this platform does not support BigInt",Jr.Logger.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?Sl||(Sl=!0,vr.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?vr.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",Jr.Logger.errors.UNEXPECTED_ARGUMENT,{}):vr.throwError("BigNumber.toString does not accept parameters",Jr.Logger.errors.UNEXPECTED_ARGUMENT,{})),ee(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof lt)return t;if(typeof t=="string")return t.match(/^-?0x[0-9a-f]+$/i)?new lt(ma,Zo(t)):t.match(/^-?[0-9]+$/)?new lt(ma,Zo(new ga(t))):vr.throwArgumentError("invalid BigNumber string","value",t);if(typeof t=="number")return t%1&&Bt("underflow","BigNumber.from",t),(t>=Al||t<=-Al)&&Bt("overflow","BigNumber.from",t),lt.from(String(t));let r=t;if(typeof r=="bigint")return lt.from(r.toString());if(Sn(r))return lt.from(xl(r));if(r)if(r.toHexString){let n=r.toHexString();if(typeof n=="string")return lt.from(n)}else{let n=r._hex;if(n==null&&r.type==="BigNumber"&&(n=r.hex),typeof n=="string"&&(gr(n)||n[0]==="-"&&gr(n.substring(1))))return lt.from(n)}return vr.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!!(t&&t._isBigNumber)}};function Zo(e){if(typeof e!="string")return Zo(e.toString(16));if(e[0]==="-")return e=e.substring(1),e[0]==="-"&&vr.throwArgumentError("invalid hex","value",e),e=Zo(e),e==="0x00"?e:"-"+e;if(e.substring(0,2)!=="0x"&&(e="0x"+e),e==="0x")return"0x00";for(e.length%2&&(e="0x0"+e.substring(2));e.length>4&&e.substring(0,4)==="0x00";)e="0x"+e.substring(4);return e}function yt(e){return lt.from(Zo(e))}function ee(e){let t=lt.from(e).toHexString();return t[0]==="-"?new ga("-"+t.substring(3),16):new ga(t.substring(2),16)}function Bt(e,t,r){let n={fault:e,operation:t};return r!=null&&(n.value=r),vr.throwError(e,Jr.Logger.errors.NUMERIC_FAULT,n)}var Ll=require("@ethersproject/logger");var Ml="strings/5.7.0";var ku=new Ll.Logger(Ml),va;(function(e){e.current="",e.NFC="NFC",e.NFD="NFD",e.NFKC="NFKC",e.NFKD="NFKD"})(va||(va={}));var bt;(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"})(bt||(bt={}));function Ru(e,t,r,n,i){return ku.throwArgumentError(`invalid codepoint at offset ${t}; ${e}`,"bytes",r)}function kl(e,t,r,n,i){if(e===bt.BAD_PREFIX||e===bt.UNEXPECTED_CONTINUE){let c=0;for(let f=t+1;f<r.length&&r[f]>>6===2;f++)c++;return c}return e===bt.OVERRUN?r.length-t-1:0}function Wu(e,t,r,n,i){return e===bt.OVERLONG?(n.push(i),0):(n.push(65533),kl(e,t,r,n,i))}var Rl=Object.freeze({error:Ru,ignore:kl,replace:Wu});function Iu(e,t){t==null&&(t=Rl.error),e=Cl(e);let r=[],n=0;for(;n<e.length;){let i=e[n++];if(i>>7===0){r.push(i);continue}let c=null,f=null;if((i&224)===192)c=1,f=127;else if((i&240)===224)c=2,f=2047;else if((i&248)===240)c=3,f=65535;else{(i&192)===128?n+=t(bt.UNEXPECTED_CONTINUE,n-1,e,r):n+=t(bt.BAD_PREFIX,n-1,e,r);continue}if(n-1+c>=e.length){n+=t(bt.OVERRUN,n-1,e,r);continue}let g=i&(1<<8-c-1)-1;for(let y=0;y<c;y++){let w=e[n];if((w&192)!=128){n+=t(bt.MISSING_CONTINUE,n,e,r),g=null;break}g=g<<6|w&63,n++}if(g!==null){if(g>1114111){n+=t(bt.OUT_OF_RANGE,n-1-c,e,r,g);continue}if(g>=55296&&g<=57343){n+=t(bt.UTF16_SURROGATE,n-1-c,e,r,g);continue}if(g<=f){n+=t(bt.OVERLONG,n-1-c,e,r,g);continue}r.push(g)}}return r}function Nu(e){return e.map(t=>t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10&1023)+55296,(t&1023)+56320))).join("")}function ya(e,t){return Nu(Iu(e,t))}var Gl=N(require("eventemitter3"));var Ou=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign"],Wl=e=>Ou.includes(e);var Il=require("libphonenumber-js/min");var Nl=e=>!!String(e).toLowerCase().match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/),Ol=e=>(0,Il.isPossiblePhoneNumber)(String(e),"US"),Dl=(e,t)=>{let r=e.slice(0),n=[];for(;r.length;)n.push(r.splice(0,t));return n},Jt=(e,t=3,r=4)=>{if(!e)return"";let n=2,i=3;if(t+r+n+i>=e.length)return e;let c=e.slice(0,n+t),f=e.slice(e.length-r,e.length);return`${c}...${f}`},ba=e=>new Promise(t=>setTimeout(t,e)),Ul=(e,t={})=>{let r=t.delayMs||40,n=t.maxAttempts||1e3;return new Promise(async(i,c)=>{let f=!1,g=0;for(;!f&&g<n;)e().then(()=>{f=!0,i()},(...y)=>{f=!0,c(...y)}),g+=1,await ba(r);f||c(new Error("Exceeded max attempts before resolving function"))})},Tn=(e,t,r={})=>{let n=new URL(t,e);for(let[i,c]of Object.entries(r))n.searchParams.set(i,c);return n.href},Du=(e,t)=>e.toLowerCase()===t.toLowerCase(),wa=(e,t)=>{for(let r of e)if(Du(r,t))return!0;return!1},Mn=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),jo=e=>typeof e=="string"?e:"0x"+e.toString(16);var Bl=require("@ethersproject/logger");var yo=class extends ye{constructor(){super("Wallet timeout");this.type="wallet_error"}},Qr=class extends ye{constructor(){super("User rejected connection");this.type="wallet_error"}},Ft=e=>{if(e instanceof ye)return e;if((e==null?void 0:e.code)&&(e==null?void 0:e.reason)){let t=new bo(e);return e.code===Bl.ErrorCode.ACTION_REJECTED&&(t.details=Yr.E4001_USER_REJECTED_REQUEST),t}return e!=null&&e.code?new bo(e):new ye("Unknown connector error",e)},Ca=class extends Kt{constructor(r,n,i){super(r);this.type="provider_error";this.code=n,this.data=i}},bo=class extends Ca{constructor(r){var c,f,g;let n=r;super(n.message,n.code,n.data);let i=Object.values(Yr).find(y=>y.eipCode===n.code);this.details=i||Yr.UNKNOWN_ERROR,n.code===-32002&&((c=n.message)!=null&&c.includes("already pending for origin")?(f=n.message)!=null&&f.includes("wallet_requestPermissions")?this.details=Yr.E32002_CONNECTION_ALREADY_PENDING:this.details=Yr.E32002_REQUEST_ALREADY_PENDING:(g=n.message)!=null&&g.includes("Already processing")&&n.message.includes("eth_requestAccounts")&&(this.details=Yr.E32002_WALLET_LOCKED))}},Uu={ERROR_USER_EXISTS:{message:"User already exists for this address",detail:"Try another address!",retryable:!1},ERROR_TIMED_OUT:{message:"Wallet request timed out",detail:"Please try connecting again.",retryable:!0},ERROR_WALLET_CONNECTION:{message:"Could not log in with wallet",detail:"Please try connecting again.",retryable:!0},ERROR_USER_REJECTED_CONNECTION:{message:"You rejected the request",detail:"Please try connecting again.",retryable:!0}},Bu={E32002_CONNECTION_ALREADY_PENDING:{eipCode:-32002,message:"Connection request already pending",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E32002_REQUEST_ALREADY_PENDING:{eipCode:-32002,message:"Resource request already pending",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E32002_WALLET_LOCKED:{eipCode:-32002,message:"Wallet might be locked",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E4001_USER_REJECTED_REQUEST:{eipCode:4001,message:"Signature rejected",detail:"Please try signing again.",retryable:!0}},Fu={E4001_DEFAULT_USER_REJECTED_REQUEST:{eipCode:4001,message:"User Rejected Request",detail:"The user rejected the request.",default:!0,retryable:!0},E4100_DEFAULT_UNAUTHORIZED:{eipCode:4100,message:"Unauthorized",detail:"The requested method and/or account has not been authorized by the user.",default:!0,retryable:!1},E4200_DEFAULT_UNSUPPORTED_METHOD:{eipCode:4200,message:"Unsupported Method",detail:"The Provider does not support the requested method.",default:!0,retryable:!1},E4900_DEFAULT_DISCONNECTED:{eipCode:4900,message:"Disconnected",detail:"The Provider is disconnected from all chains.",default:!0,retryable:!0},E4901_DEFAULT_CHAIN_DISCONNECTED:{eipCode:4901,message:"Chain Disconnected",detail:"The Provider is not connected to the requested chain.",default:!0,retryable:!0},E32700_DEFAULT_PARSE_ERROR:{eipCode:-32700,message:"Parse error",detail:"Invalid JSON",default:!0,retryable:!1},E32600_DEFAULT_INVALID_REQUEST:{eipCode:-32600,message:"Invalid request",detail:"JSON is not a valid request object",default:!0,retryable:!1},E32601_DEFAULT_METHOD_NOT_FOUND:{eipCode:-32601,message:"Method not found",detail:"Method does not exist",default:!0,retryable:!1},E32602_DEFAULT_INVALID_PARAMS:{eipCode:-32602,message:"Invalid params",detail:"Invalid method parameters",default:!0,retryable:!1},E32603_DEFAULT_INTERNAL_ERROR:{eipCode:-32603,message:"Internal error",detail:"Internal JSON-RPC error",default:!0,retryable:!0},E32000_DEFAULT_INVALID_INPUT:{eipCode:-32e3,message:"Invalid input",detail:"Missing or invalid parameters",default:!0,retryable:!1},E32001_DEFAULT_RESOURCE_NOT_FOUND:{eipCode:-32001,message:"Resource not found",detail:"Requested resource not found",default:!0,retryable:!1},E32002_DEFAULT_RESOURCE_UNAVAILABLE:{eipCode:-32002,message:"Resource unavailable",detail:"Requested resource not available",default:!0,retryable:!0},E32003_DEFAULT_TRANSACTION_REJECTED:{eipCode:-32003,message:"Transaction rejected",detail:"Transaction creation failed",default:!0,retryable:!0},E32004_DEFAULT_METHOD_NOT_SUPPORTED:{eipCode:-32004,message:"Method not supported",detail:"Method is not implemented",default:!0,retryable:!1},E32005_DEFAULT_LIMIT_EXCEEDED:{eipCode:-32005,message:"Limit exceeded",detail:"Request exceeds defined limit",default:!0,retryable:!1},E32006_DEFAULT_JSON_RPC_VERSION_NOT_SUPPORTED:{eipCode:-32006,message:"JSON-RPC version not supported",detail:"Version of JSON-RPC protocol is not supported",default:!0,retryable:!1}},Yr={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...Fu,...Bu},Xr={...Uu,...Yr};var Gu=12e4,xa=(e=new yo,t=Gu)=>new Promise((r,n)=>setTimeout(()=>{n(e)},t)),Gt=class{constructor(t){this.removeListener=(t,r)=>{if(this.walletProvider)return this.walletProvider.removeListener(t,r)};this.setWalletProvider=t=>{this.walletProvider=t,this._subscriptions.forEach(r=>{var n;(n=this.walletProvider)==null||n.on(r.eventName,r.listener)})};this.walletProvider=t,this._subscriptions=[]}on(t,r){if(this.walletProvider)return this.walletProvider.on(t,r);this._subscriptions.push({eventName:t,listener:r})}async request(t){if(!this.walletProvider)throw new ye(`A wallet request of type ${t.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(t),xa()]).catch(r=>{throw Ft(r)})}},kr=class extends Error{constructor(r,n,i){super(r);this.code=n,this.data=i}},Ln=class extends Gl.default{constructor(r,n,i=1){super();this.walletProxy=r,this.address=n,this.chainId=i,this.infuraProvider=new Fl.InfuraProvider(i,ir)}async handleSendTransaction(r){if(!r.params||!Array.isArray(r.params))throw new kr(`Invalid params for ${r.method}`,4200);let n=r.params[0],i=n.chainId;if(i&&Number(i)!==this.chainId)throw new kr(`Chain disconnected. Currently connected to ${this.chainId}, attempting to send to ${Number(i)}`,4901);if(!await wo()||!this.address)throw new kr("Disconnected",4900);return(await Vl(n)).transactionHash}handleSwitchEthereumChain(r){if(!r.params||!Array.isArray(r.params))throw new kr(`Invalid params for ${r.method}`,4200);let n=r.params[0];this.chainId=Number(n),this.emit("chainChanged",n)}async handlePersonalSign(r){if(!r.params||!Array.isArray(r.params))throw new Error("Invalid params for eth_estimateGas");let n=r.params[0],i=gr(n)?ya(n):n;return await Hl(i)}async handleEstimateGas(r){if(!r.params||!Array.isArray(r.params))throw new Error("Invalid params for eth_estimateGas");let n={...r.params[0],chainId:jo(this.chainId)};return delete n.from,this.infuraProvider.send("eth_estimateGas",[n])}async request(r){switch(console.debug("Embedded1193Provider.request() called with args",r),r.method){case"eth_accounts":return this.address?[this.address]:[];case"eth_chainId":return jo(this.chainId);case"eth_estimateGas":return this.handleEstimateGas(r);case"eth_sendTransaction":return this.handleSendTransaction(r);case"wallet_switchEthereumChain":return this.handleSwitchEthereumChain(r);case"personal_sign":return this.handlePersonalSign(r);default:break}if(Wl(r.method)){let n=await wo();if(!n||!this.address)throw new kr("Disconnected",4900);try{return(await this.walletProxy.rpc({address:this.address,accessToken:n,request:{method:r.method,params:r.params}})).response.data}catch(i){throw console.error(i),new kr("Disconnected",4900)}}else return this.infuraProvider.send(r.method,r.params)}async connect(){let r=await wo();if(!r||!this.address)return null;try{return(await this.walletProxy.connect({address:this.address,accessToken:r})).address}catch(n){return console.error(n),null}}},Rr=class extends Gt{constructor(r){super(r)}},kn=class extends Gt{constructor(t){super(t)}sendAsync(t,r){throw new Error("sendAsync is no longer supported by EIP-1193. Use the request method instead.")}};var wt=class{constructor(t,r,n){this.createSiweMessage=(t,r,n,i,c,f,g)=>`${n} wants you to sign in with your Ethereum account:
1
+ "use strict";var _u=Object.create;var Cn=Object.defineProperty;var Pu=Object.getOwnPropertyDescriptor;var Au=Object.getOwnPropertyNames;var Su=Object.getPrototypeOf,Tu=Object.prototype.hasOwnProperty;var qs=(e,t)=>()=>(e&&(t=e(e=0)),t);var nr=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),la=(e,t)=>{for(var r in t)Cn(e,r,{get:t[r],enumerable:!0})},$s=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Au(t))!Tu.call(e,i)&&i!==r&&Cn(e,i,{get:()=>t[i],enumerable:!(n=Pu(t,i))||n.enumerable});return e};var N=(e,t,r)=>(r=e!=null?_u(Su(e)):{},$s(t||!e||!e.__esModule?Cn(r,"default",{value:e,enumerable:!0}):r,e)),ca=e=>$s(Cn({},"__esModule",{value:!0}),e);var _l=nr((El,ha)=>{(function(e,t){"use strict";function r(h,o){if(!h)throw new Error(o||"Assertion failed")}function n(h,o){h.super_=o;var s=function(){};s.prototype=o.prototype,h.prototype=new s,h.prototype.constructor=h}function i(h,o,s){if(i.isBN(h))return h;this.negative=0,this.words=null,this.length=0,this.red=null,h!==null&&((o==="le"||o==="be")&&(s=o,o=10),this._init(h||0,o||10,s||"be"))}typeof e=="object"?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26;var c;try{typeof window<"u"&&typeof window.Buffer<"u"?c=window.Buffer:c=require("buffer").Buffer}catch{}i.isBN=function(o){return o instanceof i?!0:o!==null&&typeof o=="object"&&o.constructor.wordSize===i.wordSize&&Array.isArray(o.words)},i.max=function(o,s){return o.cmp(s)>0?o:s},i.min=function(o,s){return o.cmp(s)<0?o:s},i.prototype._init=function(o,s,l){if(typeof o=="number")return this._initNumber(o,s,l);if(typeof o=="object")return this._initArray(o,s,l);s==="hex"&&(s=16),r(s===(s|0)&&s>=2&&s<=36),o=o.toString().replace(/\s+/g,"");var d=0;o[0]==="-"&&(d++,this.negative=1),d<o.length&&(s===16?this._parseHex(o,d,l):(this._parseBase(o,s,d),l==="le"&&this._initArray(this.toArray(),s,l)))},i.prototype._initNumber=function(o,s,l){o<0&&(this.negative=1,o=-o),o<67108864?(this.words=[o&67108863],this.length=1):o<4503599627370496?(this.words=[o&67108863,o/67108864&67108863],this.length=2):(r(o<9007199254740992),this.words=[o&67108863,o/67108864&67108863,1],this.length=3),l==="le"&&this._initArray(this.toArray(),s,l)},i.prototype._initArray=function(o,s,l){if(r(typeof o.length=="number"),o.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(o.length/3),this.words=new Array(this.length);for(var d=0;d<this.length;d++)this.words[d]=0;var u,v,b=0;if(l==="be")for(d=o.length-1,u=0;d>=0;d-=3)v=o[d]|o[d-1]<<8|o[d-2]<<16,this.words[u]|=v<<b&67108863,this.words[u+1]=v>>>26-b&67108863,b+=24,b>=26&&(b-=26,u++);else if(l==="le")for(d=0,u=0;d<o.length;d+=3)v=o[d]|o[d+1]<<8|o[d+2]<<16,this.words[u]|=v<<b&67108863,this.words[u+1]=v>>>26-b&67108863,b+=24,b>=26&&(b-=26,u++);return this._strip()};function f(h,o){var s=h.charCodeAt(o);if(s>=48&&s<=57)return s-48;if(s>=65&&s<=70)return s-55;if(s>=97&&s<=102)return s-87;r(!1,"Invalid character in "+h)}function g(h,o,s){var l=f(h,s);return s-1>=o&&(l|=f(h,s-1)<<4),l}i.prototype._parseHex=function(o,s,l){this.length=Math.ceil((o.length-s)/6),this.words=new Array(this.length);for(var d=0;d<this.length;d++)this.words[d]=0;var u=0,v=0,b;if(l==="be")for(d=o.length-1;d>=s;d-=2)b=g(o,s,d)<<u,this.words[v]|=b&67108863,u>=18?(u-=18,v+=1,this.words[v]|=b>>>26):u+=8;else{var p=o.length-s;for(d=p%2===0?s+1:s;d<o.length;d+=2)b=g(o,s,d)<<u,this.words[v]|=b&67108863,u>=18?(u-=18,v+=1,this.words[v]|=b>>>26):u+=8}this._strip()};function y(h,o,s,l){for(var d=0,u=0,v=Math.min(h.length,s),b=o;b<v;b++){var p=h.charCodeAt(b)-48;d*=l,p>=49?u=p-49+10:p>=17?u=p-17+10:u=p,r(p>=0&&u<l,"Invalid character"),d+=u}return d}i.prototype._parseBase=function(o,s,l){this.words=[0],this.length=1;for(var d=0,u=1;u<=67108863;u*=s)d++;d--,u=u/s|0;for(var v=o.length-l,b=v%d,p=Math.min(v,v-b)+l,a=0,m=l;m<p;m+=d)a=y(o,m,m+d,s),this.imuln(u),this.words[0]+a<67108864?this.words[0]+=a:this._iaddn(a);if(b!==0){var R=1;for(a=y(o,m,o.length,s),m=0;m<b;m++)R*=s;this.imuln(R),this.words[0]+a<67108864?this.words[0]+=a:this._iaddn(a)}this._strip()},i.prototype.copy=function(o){o.words=new Array(this.length);for(var s=0;s<this.length;s++)o.words[s]=this.words[s];o.length=this.length,o.negative=this.negative,o.red=this.red};function w(h,o){h.words=o.words,h.length=o.length,h.negative=o.negative,h.red=o.red}if(i.prototype._move=function(o){w(o,this)},i.prototype.clone=function(){var o=new i(null);return this.copy(o),o},i.prototype._expand=function(o){for(;this.length<o;)this.words[this.length++]=0;return this},i.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=A}catch{i.prototype.inspect=A}else i.prototype.inspect=A;function A(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var P=["","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"],_=[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],T=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(o,s){o=o||10,s=s|0||1;var l;if(o===16||o==="hex"){l="";for(var d=0,u=0,v=0;v<this.length;v++){var b=this.words[v],p=((b<<d|u)&16777215).toString(16);u=b>>>24-d&16777215,d+=2,d>=26&&(d-=26,v--),u!==0||v!==this.length-1?l=P[6-p.length]+p+l:l=p+l}for(u!==0&&(l=u.toString(16)+l);l.length%s!==0;)l="0"+l;return this.negative!==0&&(l="-"+l),l}if(o===(o|0)&&o>=2&&o<=36){var a=_[o],m=T[o];l="";var R=this.clone();for(R.negative=0;!R.isZero();){var W=R.modrn(m).toString(o);R=R.idivn(m),R.isZero()?l=W+l:l=P[a-W.length]+W+l}for(this.isZero()&&(l="0"+l);l.length%s!==0;)l="0"+l;return this.negative!==0&&(l="-"+l),l}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var o=this.words[0];return this.length===2?o+=this.words[1]*67108864:this.length===3&&this.words[2]===1?o+=4503599627370496+this.words[1]*67108864:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-o:o},i.prototype.toJSON=function(){return this.toString(16,2)},c&&(i.prototype.toBuffer=function(o,s){return this.toArrayLike(c,o,s)}),i.prototype.toArray=function(o,s){return this.toArrayLike(Array,o,s)};var M=function(o,s){return o.allocUnsafe?o.allocUnsafe(s):new o(s)};i.prototype.toArrayLike=function(o,s,l){this._strip();var d=this.byteLength(),u=l||Math.max(1,d);r(d<=u,"byte array longer than desired length"),r(u>0,"Requested array length <= 0");var v=M(o,u),b=s==="le"?"LE":"BE";return this["_toArrayLike"+b](v,d),v},i.prototype._toArrayLikeLE=function(o,s){for(var l=0,d=0,u=0,v=0;u<this.length;u++){var b=this.words[u]<<v|d;o[l++]=b&255,l<o.length&&(o[l++]=b>>8&255),l<o.length&&(o[l++]=b>>16&255),v===6?(l<o.length&&(o[l++]=b>>24&255),d=0,v=0):(d=b>>>24,v+=2)}if(l<o.length)for(o[l++]=d;l<o.length;)o[l++]=0},i.prototype._toArrayLikeBE=function(o,s){for(var l=o.length-1,d=0,u=0,v=0;u<this.length;u++){var b=this.words[u]<<v|d;o[l--]=b&255,l>=0&&(o[l--]=b>>8&255),l>=0&&(o[l--]=b>>16&255),v===6?(l>=0&&(o[l--]=b>>24&255),d=0,v=0):(d=b>>>24,v+=2)}if(l>=0)for(o[l--]=d;l>=0;)o[l--]=0},Math.clz32?i.prototype._countBits=function(o){return 32-Math.clz32(o)}:i.prototype._countBits=function(o){var s=o,l=0;return s>=4096&&(l+=13,s>>>=13),s>=64&&(l+=7,s>>>=7),s>=8&&(l+=4,s>>>=4),s>=2&&(l+=2,s>>>=2),l+s},i.prototype._zeroBits=function(o){if(o===0)return 26;var s=o,l=0;return(s&8191)===0&&(l+=13,s>>>=13),(s&127)===0&&(l+=7,s>>>=7),(s&15)===0&&(l+=4,s>>>=4),(s&3)===0&&(l+=2,s>>>=2),(s&1)===0&&l++,l},i.prototype.bitLength=function(){var o=this.words[this.length-1],s=this._countBits(o);return(this.length-1)*26+s};function E(h){for(var o=new Array(h.bitLength()),s=0;s<o.length;s++){var l=s/26|0,d=s%26;o[s]=h.words[l]>>>d&1}return o}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var o=0,s=0;s<this.length;s++){var l=this._zeroBits(this.words[s]);if(o+=l,l!==26)break}return o},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(o){return this.negative!==0?this.abs().inotn(o).iaddn(1):this.clone()},i.prototype.fromTwos=function(o){return this.testn(o-1)?this.notn(o).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return this.negative!==0},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(o){for(;this.length<o.length;)this.words[this.length++]=0;for(var s=0;s<o.length;s++)this.words[s]=this.words[s]|o.words[s];return this._strip()},i.prototype.ior=function(o){return r((this.negative|o.negative)===0),this.iuor(o)},i.prototype.or=function(o){return this.length>o.length?this.clone().ior(o):o.clone().ior(this)},i.prototype.uor=function(o){return this.length>o.length?this.clone().iuor(o):o.clone().iuor(this)},i.prototype.iuand=function(o){var s;this.length>o.length?s=o:s=this;for(var l=0;l<s.length;l++)this.words[l]=this.words[l]&o.words[l];return this.length=s.length,this._strip()},i.prototype.iand=function(o){return r((this.negative|o.negative)===0),this.iuand(o)},i.prototype.and=function(o){return this.length>o.length?this.clone().iand(o):o.clone().iand(this)},i.prototype.uand=function(o){return this.length>o.length?this.clone().iuand(o):o.clone().iuand(this)},i.prototype.iuxor=function(o){var s,l;this.length>o.length?(s=this,l=o):(s=o,l=this);for(var d=0;d<l.length;d++)this.words[d]=s.words[d]^l.words[d];if(this!==s)for(;d<s.length;d++)this.words[d]=s.words[d];return this.length=s.length,this._strip()},i.prototype.ixor=function(o){return r((this.negative|o.negative)===0),this.iuxor(o)},i.prototype.xor=function(o){return this.length>o.length?this.clone().ixor(o):o.clone().ixor(this)},i.prototype.uxor=function(o){return this.length>o.length?this.clone().iuxor(o):o.clone().iuxor(this)},i.prototype.inotn=function(o){r(typeof o=="number"&&o>=0);var s=Math.ceil(o/26)|0,l=o%26;this._expand(s),l>0&&s--;for(var d=0;d<s;d++)this.words[d]=~this.words[d]&67108863;return l>0&&(this.words[d]=~this.words[d]&67108863>>26-l),this._strip()},i.prototype.notn=function(o){return this.clone().inotn(o)},i.prototype.setn=function(o,s){r(typeof o=="number"&&o>=0);var l=o/26|0,d=o%26;return this._expand(l+1),s?this.words[l]=this.words[l]|1<<d:this.words[l]=this.words[l]&~(1<<d),this._strip()},i.prototype.iadd=function(o){var s;if(this.negative!==0&&o.negative===0)return this.negative=0,s=this.isub(o),this.negative^=1,this._normSign();if(this.negative===0&&o.negative!==0)return o.negative=0,s=this.isub(o),o.negative=1,s._normSign();var l,d;this.length>o.length?(l=this,d=o):(l=o,d=this);for(var u=0,v=0;v<d.length;v++)s=(l.words[v]|0)+(d.words[v]|0)+u,this.words[v]=s&67108863,u=s>>>26;for(;u!==0&&v<l.length;v++)s=(l.words[v]|0)+u,this.words[v]=s&67108863,u=s>>>26;if(this.length=l.length,u!==0)this.words[this.length]=u,this.length++;else if(l!==this)for(;v<l.length;v++)this.words[v]=l.words[v];return this},i.prototype.add=function(o){var s;return o.negative!==0&&this.negative===0?(o.negative=0,s=this.sub(o),o.negative^=1,s):o.negative===0&&this.negative!==0?(this.negative=0,s=o.sub(this),this.negative=1,s):this.length>o.length?this.clone().iadd(o):o.clone().iadd(this)},i.prototype.isub=function(o){if(o.negative!==0){o.negative=0;var s=this.iadd(o);return o.negative=1,s._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(o),this.negative=1,this._normSign();var l=this.cmp(o);if(l===0)return this.negative=0,this.length=1,this.words[0]=0,this;var d,u;l>0?(d=this,u=o):(d=o,u=this);for(var v=0,b=0;b<u.length;b++)s=(d.words[b]|0)-(u.words[b]|0)+v,v=s>>26,this.words[b]=s&67108863;for(;v!==0&&b<d.length;b++)s=(d.words[b]|0)+v,v=s>>26,this.words[b]=s&67108863;if(v===0&&b<d.length&&d!==this)for(;b<d.length;b++)this.words[b]=d.words[b];return this.length=Math.max(this.length,b),d!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(o){return this.clone().isub(o)};function S(h,o,s){s.negative=o.negative^h.negative;var l=h.length+o.length|0;s.length=l,l=l-1|0;var d=h.words[0]|0,u=o.words[0]|0,v=d*u,b=v&67108863,p=v/67108864|0;s.words[0]=b;for(var a=1;a<l;a++){for(var m=p>>>26,R=p&67108863,W=Math.min(a,o.length-1),U=Math.max(0,a-h.length+1);U<=W;U++){var q=a-U|0;d=h.words[q]|0,u=o.words[U]|0,v=d*u+R,m+=v/67108864|0,R=v&67108863}s.words[a]=R|0,p=m|0}return p!==0?s.words[a]=p|0:s.length--,s._strip()}var k=function(o,s,l){var d=o.words,u=s.words,v=l.words,b=0,p,a,m,R=d[0]|0,W=R&8191,U=R>>>13,q=d[1]|0,x=q&8191,C=q>>>13,$=d[2]|0,I=$&8191,ae=$>>>13,ho=d[3]|0,pe=ho&8191,Ce=ho>>>13,Ts=d[4]|0,xe=Ts&8191,Ee=Ts>>>13,Ms=d[5]|0,_e=Ms&8191,Pe=Ms>>>13,Ls=d[6]|0,Ae=Ls&8191,Se=Ls>>>13,ks=d[7]|0,Te=ks&8191,Me=ks>>>13,Rs=d[8]|0,Le=Rs&8191,ke=Rs>>>13,Ws=d[9]|0,Re=Ws&8191,We=Ws>>>13,Is=u[0]|0,Ie=Is&8191,Ne=Is>>>13,Ns=u[1]|0,Oe=Ns&8191,De=Ns>>>13,Os=u[2]|0,Ue=Os&8191,Be=Os>>>13,Ds=u[3]|0,Fe=Ds&8191,Ge=Ds>>>13,Us=u[4]|0,He=Us&8191,Ve=Us>>>13,Bs=u[5]|0,qe=Bs&8191,$e=Bs>>>13,Fs=u[6]|0,ze=Fs&8191,Ze=Fs>>>13,Gs=u[7]|0,je=Gs&8191,Ke=Gs>>>13,Hs=u[8]|0,Je=Hs&8191,Ye=Hs>>>13,Vs=u[9]|0,Qe=Vs&8191,Xe=Vs>>>13;l.negative=o.negative^s.negative,l.length=19,p=Math.imul(W,Ie),a=Math.imul(W,Ne),a=a+Math.imul(U,Ie)|0,m=Math.imul(U,Ne);var Vi=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(Vi>>>26)|0,Vi&=67108863,p=Math.imul(x,Ie),a=Math.imul(x,Ne),a=a+Math.imul(C,Ie)|0,m=Math.imul(C,Ne),p=p+Math.imul(W,Oe)|0,a=a+Math.imul(W,De)|0,a=a+Math.imul(U,Oe)|0,m=m+Math.imul(U,De)|0;var qi=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(qi>>>26)|0,qi&=67108863,p=Math.imul(I,Ie),a=Math.imul(I,Ne),a=a+Math.imul(ae,Ie)|0,m=Math.imul(ae,Ne),p=p+Math.imul(x,Oe)|0,a=a+Math.imul(x,De)|0,a=a+Math.imul(C,Oe)|0,m=m+Math.imul(C,De)|0,p=p+Math.imul(W,Ue)|0,a=a+Math.imul(W,Be)|0,a=a+Math.imul(U,Ue)|0,m=m+Math.imul(U,Be)|0;var $i=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+($i>>>26)|0,$i&=67108863,p=Math.imul(pe,Ie),a=Math.imul(pe,Ne),a=a+Math.imul(Ce,Ie)|0,m=Math.imul(Ce,Ne),p=p+Math.imul(I,Oe)|0,a=a+Math.imul(I,De)|0,a=a+Math.imul(ae,Oe)|0,m=m+Math.imul(ae,De)|0,p=p+Math.imul(x,Ue)|0,a=a+Math.imul(x,Be)|0,a=a+Math.imul(C,Ue)|0,m=m+Math.imul(C,Be)|0,p=p+Math.imul(W,Fe)|0,a=a+Math.imul(W,Ge)|0,a=a+Math.imul(U,Fe)|0,m=m+Math.imul(U,Ge)|0;var zi=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(zi>>>26)|0,zi&=67108863,p=Math.imul(xe,Ie),a=Math.imul(xe,Ne),a=a+Math.imul(Ee,Ie)|0,m=Math.imul(Ee,Ne),p=p+Math.imul(pe,Oe)|0,a=a+Math.imul(pe,De)|0,a=a+Math.imul(Ce,Oe)|0,m=m+Math.imul(Ce,De)|0,p=p+Math.imul(I,Ue)|0,a=a+Math.imul(I,Be)|0,a=a+Math.imul(ae,Ue)|0,m=m+Math.imul(ae,Be)|0,p=p+Math.imul(x,Fe)|0,a=a+Math.imul(x,Ge)|0,a=a+Math.imul(C,Fe)|0,m=m+Math.imul(C,Ge)|0,p=p+Math.imul(W,He)|0,a=a+Math.imul(W,Ve)|0,a=a+Math.imul(U,He)|0,m=m+Math.imul(U,Ve)|0;var Zi=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(Zi>>>26)|0,Zi&=67108863,p=Math.imul(_e,Ie),a=Math.imul(_e,Ne),a=a+Math.imul(Pe,Ie)|0,m=Math.imul(Pe,Ne),p=p+Math.imul(xe,Oe)|0,a=a+Math.imul(xe,De)|0,a=a+Math.imul(Ee,Oe)|0,m=m+Math.imul(Ee,De)|0,p=p+Math.imul(pe,Ue)|0,a=a+Math.imul(pe,Be)|0,a=a+Math.imul(Ce,Ue)|0,m=m+Math.imul(Ce,Be)|0,p=p+Math.imul(I,Fe)|0,a=a+Math.imul(I,Ge)|0,a=a+Math.imul(ae,Fe)|0,m=m+Math.imul(ae,Ge)|0,p=p+Math.imul(x,He)|0,a=a+Math.imul(x,Ve)|0,a=a+Math.imul(C,He)|0,m=m+Math.imul(C,Ve)|0,p=p+Math.imul(W,qe)|0,a=a+Math.imul(W,$e)|0,a=a+Math.imul(U,qe)|0,m=m+Math.imul(U,$e)|0;var ji=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(ji>>>26)|0,ji&=67108863,p=Math.imul(Ae,Ie),a=Math.imul(Ae,Ne),a=a+Math.imul(Se,Ie)|0,m=Math.imul(Se,Ne),p=p+Math.imul(_e,Oe)|0,a=a+Math.imul(_e,De)|0,a=a+Math.imul(Pe,Oe)|0,m=m+Math.imul(Pe,De)|0,p=p+Math.imul(xe,Ue)|0,a=a+Math.imul(xe,Be)|0,a=a+Math.imul(Ee,Ue)|0,m=m+Math.imul(Ee,Be)|0,p=p+Math.imul(pe,Fe)|0,a=a+Math.imul(pe,Ge)|0,a=a+Math.imul(Ce,Fe)|0,m=m+Math.imul(Ce,Ge)|0,p=p+Math.imul(I,He)|0,a=a+Math.imul(I,Ve)|0,a=a+Math.imul(ae,He)|0,m=m+Math.imul(ae,Ve)|0,p=p+Math.imul(x,qe)|0,a=a+Math.imul(x,$e)|0,a=a+Math.imul(C,qe)|0,m=m+Math.imul(C,$e)|0,p=p+Math.imul(W,ze)|0,a=a+Math.imul(W,Ze)|0,a=a+Math.imul(U,ze)|0,m=m+Math.imul(U,Ze)|0;var Ki=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(Ki>>>26)|0,Ki&=67108863,p=Math.imul(Te,Ie),a=Math.imul(Te,Ne),a=a+Math.imul(Me,Ie)|0,m=Math.imul(Me,Ne),p=p+Math.imul(Ae,Oe)|0,a=a+Math.imul(Ae,De)|0,a=a+Math.imul(Se,Oe)|0,m=m+Math.imul(Se,De)|0,p=p+Math.imul(_e,Ue)|0,a=a+Math.imul(_e,Be)|0,a=a+Math.imul(Pe,Ue)|0,m=m+Math.imul(Pe,Be)|0,p=p+Math.imul(xe,Fe)|0,a=a+Math.imul(xe,Ge)|0,a=a+Math.imul(Ee,Fe)|0,m=m+Math.imul(Ee,Ge)|0,p=p+Math.imul(pe,He)|0,a=a+Math.imul(pe,Ve)|0,a=a+Math.imul(Ce,He)|0,m=m+Math.imul(Ce,Ve)|0,p=p+Math.imul(I,qe)|0,a=a+Math.imul(I,$e)|0,a=a+Math.imul(ae,qe)|0,m=m+Math.imul(ae,$e)|0,p=p+Math.imul(x,ze)|0,a=a+Math.imul(x,Ze)|0,a=a+Math.imul(C,ze)|0,m=m+Math.imul(C,Ze)|0,p=p+Math.imul(W,je)|0,a=a+Math.imul(W,Ke)|0,a=a+Math.imul(U,je)|0,m=m+Math.imul(U,Ke)|0;var Ji=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(Ji>>>26)|0,Ji&=67108863,p=Math.imul(Le,Ie),a=Math.imul(Le,Ne),a=a+Math.imul(ke,Ie)|0,m=Math.imul(ke,Ne),p=p+Math.imul(Te,Oe)|0,a=a+Math.imul(Te,De)|0,a=a+Math.imul(Me,Oe)|0,m=m+Math.imul(Me,De)|0,p=p+Math.imul(Ae,Ue)|0,a=a+Math.imul(Ae,Be)|0,a=a+Math.imul(Se,Ue)|0,m=m+Math.imul(Se,Be)|0,p=p+Math.imul(_e,Fe)|0,a=a+Math.imul(_e,Ge)|0,a=a+Math.imul(Pe,Fe)|0,m=m+Math.imul(Pe,Ge)|0,p=p+Math.imul(xe,He)|0,a=a+Math.imul(xe,Ve)|0,a=a+Math.imul(Ee,He)|0,m=m+Math.imul(Ee,Ve)|0,p=p+Math.imul(pe,qe)|0,a=a+Math.imul(pe,$e)|0,a=a+Math.imul(Ce,qe)|0,m=m+Math.imul(Ce,$e)|0,p=p+Math.imul(I,ze)|0,a=a+Math.imul(I,Ze)|0,a=a+Math.imul(ae,ze)|0,m=m+Math.imul(ae,Ze)|0,p=p+Math.imul(x,je)|0,a=a+Math.imul(x,Ke)|0,a=a+Math.imul(C,je)|0,m=m+Math.imul(C,Ke)|0,p=p+Math.imul(W,Je)|0,a=a+Math.imul(W,Ye)|0,a=a+Math.imul(U,Je)|0,m=m+Math.imul(U,Ye)|0;var Yi=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(Yi>>>26)|0,Yi&=67108863,p=Math.imul(Re,Ie),a=Math.imul(Re,Ne),a=a+Math.imul(We,Ie)|0,m=Math.imul(We,Ne),p=p+Math.imul(Le,Oe)|0,a=a+Math.imul(Le,De)|0,a=a+Math.imul(ke,Oe)|0,m=m+Math.imul(ke,De)|0,p=p+Math.imul(Te,Ue)|0,a=a+Math.imul(Te,Be)|0,a=a+Math.imul(Me,Ue)|0,m=m+Math.imul(Me,Be)|0,p=p+Math.imul(Ae,Fe)|0,a=a+Math.imul(Ae,Ge)|0,a=a+Math.imul(Se,Fe)|0,m=m+Math.imul(Se,Ge)|0,p=p+Math.imul(_e,He)|0,a=a+Math.imul(_e,Ve)|0,a=a+Math.imul(Pe,He)|0,m=m+Math.imul(Pe,Ve)|0,p=p+Math.imul(xe,qe)|0,a=a+Math.imul(xe,$e)|0,a=a+Math.imul(Ee,qe)|0,m=m+Math.imul(Ee,$e)|0,p=p+Math.imul(pe,ze)|0,a=a+Math.imul(pe,Ze)|0,a=a+Math.imul(Ce,ze)|0,m=m+Math.imul(Ce,Ze)|0,p=p+Math.imul(I,je)|0,a=a+Math.imul(I,Ke)|0,a=a+Math.imul(ae,je)|0,m=m+Math.imul(ae,Ke)|0,p=p+Math.imul(x,Je)|0,a=a+Math.imul(x,Ye)|0,a=a+Math.imul(C,Je)|0,m=m+Math.imul(C,Ye)|0,p=p+Math.imul(W,Qe)|0,a=a+Math.imul(W,Xe)|0,a=a+Math.imul(U,Qe)|0,m=m+Math.imul(U,Xe)|0;var Qi=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(Qi>>>26)|0,Qi&=67108863,p=Math.imul(Re,Oe),a=Math.imul(Re,De),a=a+Math.imul(We,Oe)|0,m=Math.imul(We,De),p=p+Math.imul(Le,Ue)|0,a=a+Math.imul(Le,Be)|0,a=a+Math.imul(ke,Ue)|0,m=m+Math.imul(ke,Be)|0,p=p+Math.imul(Te,Fe)|0,a=a+Math.imul(Te,Ge)|0,a=a+Math.imul(Me,Fe)|0,m=m+Math.imul(Me,Ge)|0,p=p+Math.imul(Ae,He)|0,a=a+Math.imul(Ae,Ve)|0,a=a+Math.imul(Se,He)|0,m=m+Math.imul(Se,Ve)|0,p=p+Math.imul(_e,qe)|0,a=a+Math.imul(_e,$e)|0,a=a+Math.imul(Pe,qe)|0,m=m+Math.imul(Pe,$e)|0,p=p+Math.imul(xe,ze)|0,a=a+Math.imul(xe,Ze)|0,a=a+Math.imul(Ee,ze)|0,m=m+Math.imul(Ee,Ze)|0,p=p+Math.imul(pe,je)|0,a=a+Math.imul(pe,Ke)|0,a=a+Math.imul(Ce,je)|0,m=m+Math.imul(Ce,Ke)|0,p=p+Math.imul(I,Je)|0,a=a+Math.imul(I,Ye)|0,a=a+Math.imul(ae,Je)|0,m=m+Math.imul(ae,Ye)|0,p=p+Math.imul(x,Qe)|0,a=a+Math.imul(x,Xe)|0,a=a+Math.imul(C,Qe)|0,m=m+Math.imul(C,Xe)|0;var Xi=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(Xi>>>26)|0,Xi&=67108863,p=Math.imul(Re,Ue),a=Math.imul(Re,Be),a=a+Math.imul(We,Ue)|0,m=Math.imul(We,Be),p=p+Math.imul(Le,Fe)|0,a=a+Math.imul(Le,Ge)|0,a=a+Math.imul(ke,Fe)|0,m=m+Math.imul(ke,Ge)|0,p=p+Math.imul(Te,He)|0,a=a+Math.imul(Te,Ve)|0,a=a+Math.imul(Me,He)|0,m=m+Math.imul(Me,Ve)|0,p=p+Math.imul(Ae,qe)|0,a=a+Math.imul(Ae,$e)|0,a=a+Math.imul(Se,qe)|0,m=m+Math.imul(Se,$e)|0,p=p+Math.imul(_e,ze)|0,a=a+Math.imul(_e,Ze)|0,a=a+Math.imul(Pe,ze)|0,m=m+Math.imul(Pe,Ze)|0,p=p+Math.imul(xe,je)|0,a=a+Math.imul(xe,Ke)|0,a=a+Math.imul(Ee,je)|0,m=m+Math.imul(Ee,Ke)|0,p=p+Math.imul(pe,Je)|0,a=a+Math.imul(pe,Ye)|0,a=a+Math.imul(Ce,Je)|0,m=m+Math.imul(Ce,Ye)|0,p=p+Math.imul(I,Qe)|0,a=a+Math.imul(I,Xe)|0,a=a+Math.imul(ae,Qe)|0,m=m+Math.imul(ae,Xe)|0;var ea=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(ea>>>26)|0,ea&=67108863,p=Math.imul(Re,Fe),a=Math.imul(Re,Ge),a=a+Math.imul(We,Fe)|0,m=Math.imul(We,Ge),p=p+Math.imul(Le,He)|0,a=a+Math.imul(Le,Ve)|0,a=a+Math.imul(ke,He)|0,m=m+Math.imul(ke,Ve)|0,p=p+Math.imul(Te,qe)|0,a=a+Math.imul(Te,$e)|0,a=a+Math.imul(Me,qe)|0,m=m+Math.imul(Me,$e)|0,p=p+Math.imul(Ae,ze)|0,a=a+Math.imul(Ae,Ze)|0,a=a+Math.imul(Se,ze)|0,m=m+Math.imul(Se,Ze)|0,p=p+Math.imul(_e,je)|0,a=a+Math.imul(_e,Ke)|0,a=a+Math.imul(Pe,je)|0,m=m+Math.imul(Pe,Ke)|0,p=p+Math.imul(xe,Je)|0,a=a+Math.imul(xe,Ye)|0,a=a+Math.imul(Ee,Je)|0,m=m+Math.imul(Ee,Ye)|0,p=p+Math.imul(pe,Qe)|0,a=a+Math.imul(pe,Xe)|0,a=a+Math.imul(Ce,Qe)|0,m=m+Math.imul(Ce,Xe)|0;var ta=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(ta>>>26)|0,ta&=67108863,p=Math.imul(Re,He),a=Math.imul(Re,Ve),a=a+Math.imul(We,He)|0,m=Math.imul(We,Ve),p=p+Math.imul(Le,qe)|0,a=a+Math.imul(Le,$e)|0,a=a+Math.imul(ke,qe)|0,m=m+Math.imul(ke,$e)|0,p=p+Math.imul(Te,ze)|0,a=a+Math.imul(Te,Ze)|0,a=a+Math.imul(Me,ze)|0,m=m+Math.imul(Me,Ze)|0,p=p+Math.imul(Ae,je)|0,a=a+Math.imul(Ae,Ke)|0,a=a+Math.imul(Se,je)|0,m=m+Math.imul(Se,Ke)|0,p=p+Math.imul(_e,Je)|0,a=a+Math.imul(_e,Ye)|0,a=a+Math.imul(Pe,Je)|0,m=m+Math.imul(Pe,Ye)|0,p=p+Math.imul(xe,Qe)|0,a=a+Math.imul(xe,Xe)|0,a=a+Math.imul(Ee,Qe)|0,m=m+Math.imul(Ee,Xe)|0;var ra=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(ra>>>26)|0,ra&=67108863,p=Math.imul(Re,qe),a=Math.imul(Re,$e),a=a+Math.imul(We,qe)|0,m=Math.imul(We,$e),p=p+Math.imul(Le,ze)|0,a=a+Math.imul(Le,Ze)|0,a=a+Math.imul(ke,ze)|0,m=m+Math.imul(ke,Ze)|0,p=p+Math.imul(Te,je)|0,a=a+Math.imul(Te,Ke)|0,a=a+Math.imul(Me,je)|0,m=m+Math.imul(Me,Ke)|0,p=p+Math.imul(Ae,Je)|0,a=a+Math.imul(Ae,Ye)|0,a=a+Math.imul(Se,Je)|0,m=m+Math.imul(Se,Ye)|0,p=p+Math.imul(_e,Qe)|0,a=a+Math.imul(_e,Xe)|0,a=a+Math.imul(Pe,Qe)|0,m=m+Math.imul(Pe,Xe)|0;var oa=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(oa>>>26)|0,oa&=67108863,p=Math.imul(Re,ze),a=Math.imul(Re,Ze),a=a+Math.imul(We,ze)|0,m=Math.imul(We,Ze),p=p+Math.imul(Le,je)|0,a=a+Math.imul(Le,Ke)|0,a=a+Math.imul(ke,je)|0,m=m+Math.imul(ke,Ke)|0,p=p+Math.imul(Te,Je)|0,a=a+Math.imul(Te,Ye)|0,a=a+Math.imul(Me,Je)|0,m=m+Math.imul(Me,Ye)|0,p=p+Math.imul(Ae,Qe)|0,a=a+Math.imul(Ae,Xe)|0,a=a+Math.imul(Se,Qe)|0,m=m+Math.imul(Se,Xe)|0;var na=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(na>>>26)|0,na&=67108863,p=Math.imul(Re,je),a=Math.imul(Re,Ke),a=a+Math.imul(We,je)|0,m=Math.imul(We,Ke),p=p+Math.imul(Le,Je)|0,a=a+Math.imul(Le,Ye)|0,a=a+Math.imul(ke,Je)|0,m=m+Math.imul(ke,Ye)|0,p=p+Math.imul(Te,Qe)|0,a=a+Math.imul(Te,Xe)|0,a=a+Math.imul(Me,Qe)|0,m=m+Math.imul(Me,Xe)|0;var ia=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(ia>>>26)|0,ia&=67108863,p=Math.imul(Re,Je),a=Math.imul(Re,Ye),a=a+Math.imul(We,Je)|0,m=Math.imul(We,Ye),p=p+Math.imul(Le,Qe)|0,a=a+Math.imul(Le,Xe)|0,a=a+Math.imul(ke,Qe)|0,m=m+Math.imul(ke,Xe)|0;var aa=(b+p|0)+((a&8191)<<13)|0;b=(m+(a>>>13)|0)+(aa>>>26)|0,aa&=67108863,p=Math.imul(Re,Qe),a=Math.imul(Re,Xe),a=a+Math.imul(We,Qe)|0,m=Math.imul(We,Xe);var sa=(b+p|0)+((a&8191)<<13)|0;return b=(m+(a>>>13)|0)+(sa>>>26)|0,sa&=67108863,v[0]=Vi,v[1]=qi,v[2]=$i,v[3]=zi,v[4]=Zi,v[5]=ji,v[6]=Ki,v[7]=Ji,v[8]=Yi,v[9]=Qi,v[10]=Xi,v[11]=ea,v[12]=ta,v[13]=ra,v[14]=oa,v[15]=na,v[16]=ia,v[17]=aa,v[18]=sa,b!==0&&(v[19]=b,l.length++),l};Math.imul||(k=S);function V(h,o,s){s.negative=o.negative^h.negative,s.length=h.length+o.length;for(var l=0,d=0,u=0;u<s.length-1;u++){var v=d;d=0;for(var b=l&67108863,p=Math.min(u,o.length-1),a=Math.max(0,u-h.length+1);a<=p;a++){var m=u-a,R=h.words[m]|0,W=o.words[a]|0,U=R*W,q=U&67108863;v=v+(U/67108864|0)|0,q=q+b|0,b=q&67108863,v=v+(q>>>26)|0,d+=v>>>26,v&=67108863}s.words[u]=b,l=v,v=d}return l!==0?s.words[u]=l:s.length--,s._strip()}function z(h,o,s){return V(h,o,s)}i.prototype.mulTo=function(o,s){var l,d=this.length+o.length;return this.length===10&&o.length===10?l=k(this,o,s):d<63?l=S(this,o,s):d<1024?l=V(this,o,s):l=z(this,o,s),l};function Z(h,o){this.x=h,this.y=o}Z.prototype.makeRBT=function(o){for(var s=new Array(o),l=i.prototype._countBits(o)-1,d=0;d<o;d++)s[d]=this.revBin(d,l,o);return s},Z.prototype.revBin=function(o,s,l){if(o===0||o===l-1)return o;for(var d=0,u=0;u<s;u++)d|=(o&1)<<s-u-1,o>>=1;return d},Z.prototype.permute=function(o,s,l,d,u,v){for(var b=0;b<v;b++)d[b]=s[o[b]],u[b]=l[o[b]]},Z.prototype.transform=function(o,s,l,d,u,v){this.permute(v,o,s,l,d,u);for(var b=1;b<u;b<<=1)for(var p=b<<1,a=Math.cos(2*Math.PI/p),m=Math.sin(2*Math.PI/p),R=0;R<u;R+=p)for(var W=a,U=m,q=0;q<b;q++){var x=l[R+q],C=d[R+q],$=l[R+q+b],I=d[R+q+b],ae=W*$-U*I;I=W*I+U*$,$=ae,l[R+q]=x+$,d[R+q]=C+I,l[R+q+b]=x-$,d[R+q+b]=C-I,q!==p&&(ae=a*W-m*U,U=a*U+m*W,W=ae)}},Z.prototype.guessLen13b=function(o,s){var l=Math.max(s,o)|1,d=l&1,u=0;for(l=l/2|0;l;l=l>>>1)u++;return 1<<u+1+d},Z.prototype.conjugate=function(o,s,l){if(!(l<=1))for(var d=0;d<l/2;d++){var u=o[d];o[d]=o[l-d-1],o[l-d-1]=u,u=s[d],s[d]=-s[l-d-1],s[l-d-1]=-u}},Z.prototype.normalize13b=function(o,s){for(var l=0,d=0;d<s/2;d++){var u=Math.round(o[2*d+1]/s)*8192+Math.round(o[2*d]/s)+l;o[d]=u&67108863,u<67108864?l=0:l=u/67108864|0}return o},Z.prototype.convert13b=function(o,s,l,d){for(var u=0,v=0;v<s;v++)u=u+(o[v]|0),l[2*v]=u&8191,u=u>>>13,l[2*v+1]=u&8191,u=u>>>13;for(v=2*s;v<d;++v)l[v]=0;r(u===0),r((u&-8192)===0)},Z.prototype.stub=function(o){for(var s=new Array(o),l=0;l<o;l++)s[l]=0;return s},Z.prototype.mulp=function(o,s,l){var d=2*this.guessLen13b(o.length,s.length),u=this.makeRBT(d),v=this.stub(d),b=new Array(d),p=new Array(d),a=new Array(d),m=new Array(d),R=new Array(d),W=new Array(d),U=l.words;U.length=d,this.convert13b(o.words,o.length,b,d),this.convert13b(s.words,s.length,m,d),this.transform(b,v,p,a,d,u),this.transform(m,v,R,W,d,u);for(var q=0;q<d;q++){var x=p[q]*R[q]-a[q]*W[q];a[q]=p[q]*W[q]+a[q]*R[q],p[q]=x}return this.conjugate(p,a,d),this.transform(p,a,U,v,d,u),this.conjugate(U,v,d),this.normalize13b(U,d),l.negative=o.negative^s.negative,l.length=o.length+s.length,l._strip()},i.prototype.mul=function(o){var s=new i(null);return s.words=new Array(this.length+o.length),this.mulTo(o,s)},i.prototype.mulf=function(o){var s=new i(null);return s.words=new Array(this.length+o.length),z(this,o,s)},i.prototype.imul=function(o){return this.clone().mulTo(o,this)},i.prototype.imuln=function(o){var s=o<0;s&&(o=-o),r(typeof o=="number"),r(o<67108864);for(var l=0,d=0;d<this.length;d++){var u=(this.words[d]|0)*o,v=(u&67108863)+(l&67108863);l>>=26,l+=u/67108864|0,l+=v>>>26,this.words[d]=v&67108863}return l!==0&&(this.words[d]=l,this.length++),s?this.ineg():this},i.prototype.muln=function(o){return this.clone().imuln(o)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(o){var s=E(o);if(s.length===0)return new i(1);for(var l=this,d=0;d<s.length&&s[d]===0;d++,l=l.sqr());if(++d<s.length)for(var u=l.sqr();d<s.length;d++,u=u.sqr())s[d]!==0&&(l=l.mul(u));return l},i.prototype.iushln=function(o){r(typeof o=="number"&&o>=0);var s=o%26,l=(o-s)/26,d=67108863>>>26-s<<26-s,u;if(s!==0){var v=0;for(u=0;u<this.length;u++){var b=this.words[u]&d,p=(this.words[u]|0)-b<<s;this.words[u]=p|v,v=b>>>26-s}v&&(this.words[u]=v,this.length++)}if(l!==0){for(u=this.length-1;u>=0;u--)this.words[u+l]=this.words[u];for(u=0;u<l;u++)this.words[u]=0;this.length+=l}return this._strip()},i.prototype.ishln=function(o){return r(this.negative===0),this.iushln(o)},i.prototype.iushrn=function(o,s,l){r(typeof o=="number"&&o>=0);var d;s?d=(s-s%26)/26:d=0;var u=o%26,v=Math.min((o-u)/26,this.length),b=67108863^67108863>>>u<<u,p=l;if(d-=v,d=Math.max(0,d),p){for(var a=0;a<v;a++)p.words[a]=this.words[a];p.length=v}if(v!==0)if(this.length>v)for(this.length-=v,a=0;a<this.length;a++)this.words[a]=this.words[a+v];else this.words[0]=0,this.length=1;var m=0;for(a=this.length-1;a>=0&&(m!==0||a>=d);a--){var R=this.words[a]|0;this.words[a]=m<<26-u|R>>>u,m=R&b}return p&&m!==0&&(p.words[p.length++]=m),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(o,s,l){return r(this.negative===0),this.iushrn(o,s,l)},i.prototype.shln=function(o){return this.clone().ishln(o)},i.prototype.ushln=function(o){return this.clone().iushln(o)},i.prototype.shrn=function(o){return this.clone().ishrn(o)},i.prototype.ushrn=function(o){return this.clone().iushrn(o)},i.prototype.testn=function(o){r(typeof o=="number"&&o>=0);var s=o%26,l=(o-s)/26,d=1<<s;if(this.length<=l)return!1;var u=this.words[l];return!!(u&d)},i.prototype.imaskn=function(o){r(typeof o=="number"&&o>=0);var s=o%26,l=(o-s)/26;if(r(this.negative===0,"imaskn works only with positive numbers"),this.length<=l)return this;if(s!==0&&l++,this.length=Math.min(l,this.length),s!==0){var d=67108863^67108863>>>s<<s;this.words[this.length-1]&=d}return this._strip()},i.prototype.maskn=function(o){return this.clone().imaskn(o)},i.prototype.iaddn=function(o){return r(typeof o=="number"),r(o<67108864),o<0?this.isubn(-o):this.negative!==0?this.length===1&&(this.words[0]|0)<=o?(this.words[0]=o-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(o),this.negative=1,this):this._iaddn(o)},i.prototype._iaddn=function(o){this.words[0]+=o;for(var s=0;s<this.length&&this.words[s]>=67108864;s++)this.words[s]-=67108864,s===this.length-1?this.words[s+1]=1:this.words[s+1]++;return this.length=Math.max(this.length,s+1),this},i.prototype.isubn=function(o){if(r(typeof o=="number"),r(o<67108864),o<0)return this.iaddn(-o);if(this.negative!==0)return this.negative=0,this.iaddn(o),this.negative=1,this;if(this.words[0]-=o,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var s=0;s<this.length&&this.words[s]<0;s++)this.words[s]+=67108864,this.words[s+1]-=1;return this._strip()},i.prototype.addn=function(o){return this.clone().iaddn(o)},i.prototype.subn=function(o){return this.clone().isubn(o)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(o,s,l){var d=o.length+l,u;this._expand(d);var v,b=0;for(u=0;u<o.length;u++){v=(this.words[u+l]|0)+b;var p=(o.words[u]|0)*s;v-=p&67108863,b=(v>>26)-(p/67108864|0),this.words[u+l]=v&67108863}for(;u<this.length-l;u++)v=(this.words[u+l]|0)+b,b=v>>26,this.words[u+l]=v&67108863;if(b===0)return this._strip();for(r(b===-1),b=0,u=0;u<this.length;u++)v=-(this.words[u]|0)+b,b=v>>26,this.words[u]=v&67108863;return this.negative=1,this._strip()},i.prototype._wordDiv=function(o,s){var l=this.length-o.length,d=this.clone(),u=o,v=u.words[u.length-1]|0,b=this._countBits(v);l=26-b,l!==0&&(u=u.ushln(l),d.iushln(l),v=u.words[u.length-1]|0);var p=d.length-u.length,a;if(s!=="mod"){a=new i(null),a.length=p+1,a.words=new Array(a.length);for(var m=0;m<a.length;m++)a.words[m]=0}var R=d.clone()._ishlnsubmul(u,1,p);R.negative===0&&(d=R,a&&(a.words[p]=1));for(var W=p-1;W>=0;W--){var U=(d.words[u.length+W]|0)*67108864+(d.words[u.length+W-1]|0);for(U=Math.min(U/v|0,67108863),d._ishlnsubmul(u,U,W);d.negative!==0;)U--,d.negative=0,d._ishlnsubmul(u,1,W),d.isZero()||(d.negative^=1);a&&(a.words[W]=U)}return a&&a._strip(),d._strip(),s!=="div"&&l!==0&&d.iushrn(l),{div:a||null,mod:d}},i.prototype.divmod=function(o,s,l){if(r(!o.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var d,u,v;return this.negative!==0&&o.negative===0?(v=this.neg().divmod(o,s),s!=="mod"&&(d=v.div.neg()),s!=="div"&&(u=v.mod.neg(),l&&u.negative!==0&&u.iadd(o)),{div:d,mod:u}):this.negative===0&&o.negative!==0?(v=this.divmod(o.neg(),s),s!=="mod"&&(d=v.div.neg()),{div:d,mod:v.mod}):(this.negative&o.negative)!==0?(v=this.neg().divmod(o.neg(),s),s!=="div"&&(u=v.mod.neg(),l&&u.negative!==0&&u.isub(o)),{div:v.div,mod:u}):o.length>this.length||this.cmp(o)<0?{div:new i(0),mod:this}:o.length===1?s==="div"?{div:this.divn(o.words[0]),mod:null}:s==="mod"?{div:null,mod:new i(this.modrn(o.words[0]))}:{div:this.divn(o.words[0]),mod:new i(this.modrn(o.words[0]))}:this._wordDiv(o,s)},i.prototype.div=function(o){return this.divmod(o,"div",!1).div},i.prototype.mod=function(o){return this.divmod(o,"mod",!1).mod},i.prototype.umod=function(o){return this.divmod(o,"mod",!0).mod},i.prototype.divRound=function(o){var s=this.divmod(o);if(s.mod.isZero())return s.div;var l=s.div.negative!==0?s.mod.isub(o):s.mod,d=o.ushrn(1),u=o.andln(1),v=l.cmp(d);return v<0||u===1&&v===0?s.div:s.div.negative!==0?s.div.isubn(1):s.div.iaddn(1)},i.prototype.modrn=function(o){var s=o<0;s&&(o=-o),r(o<=67108863);for(var l=(1<<26)%o,d=0,u=this.length-1;u>=0;u--)d=(l*d+(this.words[u]|0))%o;return s?-d:d},i.prototype.modn=function(o){return this.modrn(o)},i.prototype.idivn=function(o){var s=o<0;s&&(o=-o),r(o<=67108863);for(var l=0,d=this.length-1;d>=0;d--){var u=(this.words[d]|0)+l*67108864;this.words[d]=u/o|0,l=u%o}return this._strip(),s?this.ineg():this},i.prototype.divn=function(o){return this.clone().idivn(o)},i.prototype.egcd=function(o){r(o.negative===0),r(!o.isZero());var s=this,l=o.clone();s.negative!==0?s=s.umod(o):s=s.clone();for(var d=new i(1),u=new i(0),v=new i(0),b=new i(1),p=0;s.isEven()&&l.isEven();)s.iushrn(1),l.iushrn(1),++p;for(var a=l.clone(),m=s.clone();!s.isZero();){for(var R=0,W=1;(s.words[0]&W)===0&&R<26;++R,W<<=1);if(R>0)for(s.iushrn(R);R-- >0;)(d.isOdd()||u.isOdd())&&(d.iadd(a),u.isub(m)),d.iushrn(1),u.iushrn(1);for(var U=0,q=1;(l.words[0]&q)===0&&U<26;++U,q<<=1);if(U>0)for(l.iushrn(U);U-- >0;)(v.isOdd()||b.isOdd())&&(v.iadd(a),b.isub(m)),v.iushrn(1),b.iushrn(1);s.cmp(l)>=0?(s.isub(l),d.isub(v),u.isub(b)):(l.isub(s),v.isub(d),b.isub(u))}return{a:v,b,gcd:l.iushln(p)}},i.prototype._invmp=function(o){r(o.negative===0),r(!o.isZero());var s=this,l=o.clone();s.negative!==0?s=s.umod(o):s=s.clone();for(var d=new i(1),u=new i(0),v=l.clone();s.cmpn(1)>0&&l.cmpn(1)>0;){for(var b=0,p=1;(s.words[0]&p)===0&&b<26;++b,p<<=1);if(b>0)for(s.iushrn(b);b-- >0;)d.isOdd()&&d.iadd(v),d.iushrn(1);for(var a=0,m=1;(l.words[0]&m)===0&&a<26;++a,m<<=1);if(a>0)for(l.iushrn(a);a-- >0;)u.isOdd()&&u.iadd(v),u.iushrn(1);s.cmp(l)>=0?(s.isub(l),d.isub(u)):(l.isub(s),u.isub(d))}var R;return s.cmpn(1)===0?R=d:R=u,R.cmpn(0)<0&&R.iadd(o),R},i.prototype.gcd=function(o){if(this.isZero())return o.abs();if(o.isZero())return this.abs();var s=this.clone(),l=o.clone();s.negative=0,l.negative=0;for(var d=0;s.isEven()&&l.isEven();d++)s.iushrn(1),l.iushrn(1);do{for(;s.isEven();)s.iushrn(1);for(;l.isEven();)l.iushrn(1);var u=s.cmp(l);if(u<0){var v=s;s=l,l=v}else if(u===0||l.cmpn(1)===0)break;s.isub(l)}while(!0);return l.iushln(d)},i.prototype.invm=function(o){return this.egcd(o).a.umod(o)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(o){return this.words[0]&o},i.prototype.bincn=function(o){r(typeof o=="number");var s=o%26,l=(o-s)/26,d=1<<s;if(this.length<=l)return this._expand(l+1),this.words[l]|=d,this;for(var u=d,v=l;u!==0&&v<this.length;v++){var b=this.words[v]|0;b+=u,u=b>>>26,b&=67108863,this.words[v]=b}return u!==0&&(this.words[v]=u,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(o){var s=o<0;if(this.negative!==0&&!s)return-1;if(this.negative===0&&s)return 1;this._strip();var l;if(this.length>1)l=1;else{s&&(o=-o),r(o<=67108863,"Number is too big");var d=this.words[0]|0;l=d===o?0:d<o?-1:1}return this.negative!==0?-l|0:l},i.prototype.cmp=function(o){if(this.negative!==0&&o.negative===0)return-1;if(this.negative===0&&o.negative!==0)return 1;var s=this.ucmp(o);return this.negative!==0?-s|0:s},i.prototype.ucmp=function(o){if(this.length>o.length)return 1;if(this.length<o.length)return-1;for(var s=0,l=this.length-1;l>=0;l--){var d=this.words[l]|0,u=o.words[l]|0;if(d!==u){d<u?s=-1:d>u&&(s=1);break}}return s},i.prototype.gtn=function(o){return this.cmpn(o)===1},i.prototype.gt=function(o){return this.cmp(o)===1},i.prototype.gten=function(o){return this.cmpn(o)>=0},i.prototype.gte=function(o){return this.cmp(o)>=0},i.prototype.ltn=function(o){return this.cmpn(o)===-1},i.prototype.lt=function(o){return this.cmp(o)===-1},i.prototype.lten=function(o){return this.cmpn(o)<=0},i.prototype.lte=function(o){return this.cmp(o)<=0},i.prototype.eqn=function(o){return this.cmpn(o)===0},i.prototype.eq=function(o){return this.cmp(o)===0},i.red=function(o){return new H(o)},i.prototype.toRed=function(o){return r(!this.red,"Already a number in reduction context"),r(this.negative===0,"red works only with positives"),o.convertTo(this)._forceRed(o)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(o){return this.red=o,this},i.prototype.forceRed=function(o){return r(!this.red,"Already a number in reduction context"),this._forceRed(o)},i.prototype.redAdd=function(o){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,o)},i.prototype.redIAdd=function(o){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,o)},i.prototype.redSub=function(o){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,o)},i.prototype.redISub=function(o){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,o)},i.prototype.redShl=function(o){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,o)},i.prototype.redMul=function(o){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.mul(this,o)},i.prototype.redIMul=function(o){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.imul(this,o)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(o){return r(this.red&&!o.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,o)};var Y={k256:null,p224:null,p192:null,p25519:null};function Q(h,o){this.name=h,this.p=new i(o,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}Q.prototype._tmp=function(){var o=new i(null);return o.words=new Array(Math.ceil(this.n/13)),o},Q.prototype.ireduce=function(o){var s=o,l;do this.split(s,this.tmp),s=this.imulK(s),s=s.iadd(this.tmp),l=s.bitLength();while(l>this.n);var d=l<this.n?-1:s.ucmp(this.p);return d===0?(s.words[0]=0,s.length=1):d>0?s.isub(this.p):s.strip!==void 0?s.strip():s._strip(),s},Q.prototype.split=function(o,s){o.iushrn(this.n,0,s)},Q.prototype.imulK=function(o){return o.imul(this.k)};function ne(){Q.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}n(ne,Q),ne.prototype.split=function(o,s){for(var l=4194303,d=Math.min(o.length,9),u=0;u<d;u++)s.words[u]=o.words[u];if(s.length=d,o.length<=9){o.words[0]=0,o.length=1;return}var v=o.words[9];for(s.words[s.length++]=v&l,u=10;u<o.length;u++){var b=o.words[u]|0;o.words[u-10]=(b&l)<<4|v>>>22,v=b}v>>>=22,o.words[u-10]=v,v===0&&o.length>10?o.length-=10:o.length-=9},ne.prototype.imulK=function(o){o.words[o.length]=0,o.words[o.length+1]=0,o.length+=2;for(var s=0,l=0;l<o.length;l++){var d=o.words[l]|0;s+=d*977,o.words[l]=s&67108863,s=d*64+(s/67108864|0)}return o.words[o.length-1]===0&&(o.length--,o.words[o.length-1]===0&&o.length--),o};function it(){Q.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}n(it,Q);function at(){Q.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}n(at,Q);function ce(){Q.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}n(ce,Q),ce.prototype.imulK=function(o){for(var s=0,l=0;l<o.length;l++){var d=(o.words[l]|0)*19+s,u=d&67108863;d>>>=26,o.words[l]=u,s=d}return s!==0&&(o.words[o.length++]=s),o},i._prime=function(o){if(Y[o])return Y[o];var s;if(o==="k256")s=new ne;else if(o==="p224")s=new it;else if(o==="p192")s=new at;else if(o==="p25519")s=new ce;else throw new Error("Unknown prime "+o);return Y[o]=s,s};function H(h){if(typeof h=="string"){var o=i._prime(h);this.m=o.p,this.prime=o}else r(h.gtn(1),"modulus must be greater than 1"),this.m=h,this.prime=null}H.prototype._verify1=function(o){r(o.negative===0,"red works only with positives"),r(o.red,"red works only with red numbers")},H.prototype._verify2=function(o,s){r((o.negative|s.negative)===0,"red works only with positives"),r(o.red&&o.red===s.red,"red works only with red numbers")},H.prototype.imod=function(o){return this.prime?this.prime.ireduce(o)._forceRed(this):(w(o,o.umod(this.m)._forceRed(this)),o)},H.prototype.neg=function(o){return o.isZero()?o.clone():this.m.sub(o)._forceRed(this)},H.prototype.add=function(o,s){this._verify2(o,s);var l=o.add(s);return l.cmp(this.m)>=0&&l.isub(this.m),l._forceRed(this)},H.prototype.iadd=function(o,s){this._verify2(o,s);var l=o.iadd(s);return l.cmp(this.m)>=0&&l.isub(this.m),l},H.prototype.sub=function(o,s){this._verify2(o,s);var l=o.sub(s);return l.cmpn(0)<0&&l.iadd(this.m),l._forceRed(this)},H.prototype.isub=function(o,s){this._verify2(o,s);var l=o.isub(s);return l.cmpn(0)<0&&l.iadd(this.m),l},H.prototype.shl=function(o,s){return this._verify1(o),this.imod(o.ushln(s))},H.prototype.imul=function(o,s){return this._verify2(o,s),this.imod(o.imul(s))},H.prototype.mul=function(o,s){return this._verify2(o,s),this.imod(o.mul(s))},H.prototype.isqr=function(o){return this.imul(o,o.clone())},H.prototype.sqr=function(o){return this.mul(o,o)},H.prototype.sqrt=function(o){if(o.isZero())return o.clone();var s=this.m.andln(3);if(r(s%2===1),s===3){var l=this.m.add(new i(1)).iushrn(2);return this.pow(o,l)}for(var d=this.m.subn(1),u=0;!d.isZero()&&d.andln(1)===0;)u++,d.iushrn(1);r(!d.isZero());var v=new i(1).toRed(this),b=v.redNeg(),p=this.m.subn(1).iushrn(1),a=this.m.bitLength();for(a=new i(2*a*a).toRed(this);this.pow(a,p).cmp(b)!==0;)a.redIAdd(b);for(var m=this.pow(a,d),R=this.pow(o,d.addn(1).iushrn(1)),W=this.pow(o,d),U=u;W.cmp(v)!==0;){for(var q=W,x=0;q.cmp(v)!==0;x++)q=q.redSqr();r(x<U);var C=this.pow(m,new i(1).iushln(U-x-1));R=R.redMul(C),m=C.redSqr(),W=W.redMul(m),U=x}return R},H.prototype.invm=function(o){var s=o._invmp(this.m);return s.negative!==0?(s.negative=0,this.imod(s).redNeg()):this.imod(s)},H.prototype.pow=function(o,s){if(s.isZero())return new i(1).toRed(this);if(s.cmpn(1)===0)return o.clone();var l=4,d=new Array(1<<l);d[0]=new i(1).toRed(this),d[1]=o;for(var u=2;u<d.length;u++)d[u]=this.mul(d[u-1],o);var v=d[0],b=0,p=0,a=s.bitLength()%26;for(a===0&&(a=26),u=s.length-1;u>=0;u--){for(var m=s.words[u],R=a-1;R>=0;R--){var W=m>>R&1;if(v!==d[0]&&(v=this.sqr(v)),W===0&&b===0){p=0;continue}b<<=1,b|=W,p++,!(p!==l&&(u!==0||R!==0))&&(v=this.mul(v,d[b]),p=0,b=0)}a=26}return v},H.prototype.convertTo=function(o){var s=o.umod(this.m);return s===o?s.clone():s},H.prototype.convertFrom=function(o){var s=o.clone();return s.red=null,s},i.mont=function(o){return new j(o)};function j(h){H.call(this,h),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}n(j,H),j.prototype.convertTo=function(o){return this.imod(o.ushln(this.shift))},j.prototype.convertFrom=function(o){var s=this.imod(o.mul(this.rinv));return s.red=null,s},j.prototype.imul=function(o,s){if(o.isZero()||s.isZero())return o.words[0]=0,o.length=1,o;var l=o.imul(s),d=l.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),u=l.isub(d).iushrn(this.shift),v=u;return u.cmp(this.m)>=0?v=u.isub(this.m):u.cmpn(0)<0&&(v=u.iadd(this.m)),v._forceRed(this)},j.prototype.mul=function(o,s){if(o.isZero()||s.isZero())return new i(0)._forceRed(this);var l=o.mul(s),d=l.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),u=l.isub(d).iushrn(this.shift),v=u;return u.cmp(this.m)>=0?v=u.isub(this.m):u.cmpn(0)<0&&(v=u.iadd(this.m)),v._forceRed(this)},j.prototype.invm=function(o){var s=this.imod(o._invmp(this.m).mul(this.r2));return s._forceRed(this)}})(typeof ha>"u"||ha,El)});var Hn=nr((s2,Gn)=>{var rc,oc,nc,ic,ac,sc,lc,cc,dc,Bn,Aa,uc,fc,pc,xo,hc,mc,gc,vc,yc,bc,wc,Cc,xc,Fn;(function(e){var t=typeof global=="object"?global:typeof self=="object"?self:typeof this=="object"?this:{};typeof define=="function"&&define.amd?define("tslib",["exports"],function(n){e(r(t,r(n)))}):typeof Gn=="object"&&typeof Gn.exports=="object"?e(r(t,r(Gn.exports))):e(r(t));function r(n,i){return n!==t&&(typeof Object.create=="function"?Object.defineProperty(n,"__esModule",{value:!0}):n.__esModule=!0),function(c,f){return n[c]=i?i(c,f):f}}})(function(e){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var c in i)Object.prototype.hasOwnProperty.call(i,c)&&(n[c]=i[c])};rc=function(n,i){if(typeof i!="function"&&i!==null)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");t(n,i);function c(){this.constructor=n}n.prototype=i===null?Object.create(i):(c.prototype=i.prototype,new c)},oc=Object.assign||function(n){for(var i,c=1,f=arguments.length;c<f;c++){i=arguments[c];for(var g in i)Object.prototype.hasOwnProperty.call(i,g)&&(n[g]=i[g])}return n},nc=function(n,i){var c={};for(var f in n)Object.prototype.hasOwnProperty.call(n,f)&&i.indexOf(f)<0&&(c[f]=n[f]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var g=0,f=Object.getOwnPropertySymbols(n);g<f.length;g++)i.indexOf(f[g])<0&&Object.prototype.propertyIsEnumerable.call(n,f[g])&&(c[f[g]]=n[f[g]]);return c},ic=function(n,i,c,f){var g=arguments.length,y=g<3?i:f===null?f=Object.getOwnPropertyDescriptor(i,c):f,w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(n,i,c,f);else for(var A=n.length-1;A>=0;A--)(w=n[A])&&(y=(g<3?w(y):g>3?w(i,c,y):w(i,c))||y);return g>3&&y&&Object.defineProperty(i,c,y),y},ac=function(n,i){return function(c,f){i(c,f,n)}},sc=function(n,i){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,i)},lc=function(n,i,c,f){function g(y){return y instanceof c?y:new c(function(w){w(y)})}return new(c||(c=Promise))(function(y,w){function A(T){try{_(f.next(T))}catch(M){w(M)}}function P(T){try{_(f.throw(T))}catch(M){w(M)}}function _(T){T.done?y(T.value):g(T.value).then(A,P)}_((f=f.apply(n,i||[])).next())})},cc=function(n,i){var c={label:0,sent:function(){if(y[0]&1)throw y[1];return y[1]},trys:[],ops:[]},f,g,y,w;return w={next:A(0),throw:A(1),return:A(2)},typeof Symbol=="function"&&(w[Symbol.iterator]=function(){return this}),w;function A(_){return function(T){return P([_,T])}}function P(_){if(f)throw new TypeError("Generator is already executing.");for(;c;)try{if(f=1,g&&(y=_[0]&2?g.return:_[0]?g.throw||((y=g.return)&&y.call(g),0):g.next)&&!(y=y.call(g,_[1])).done)return y;switch(g=0,y&&(_=[_[0]&2,y.value]),_[0]){case 0:case 1:y=_;break;case 4:return c.label++,{value:_[1],done:!1};case 5:c.label++,g=_[1],_=[0];continue;case 7:_=c.ops.pop(),c.trys.pop();continue;default:if(y=c.trys,!(y=y.length>0&&y[y.length-1])&&(_[0]===6||_[0]===2)){c=0;continue}if(_[0]===3&&(!y||_[1]>y[0]&&_[1]<y[3])){c.label=_[1];break}if(_[0]===6&&c.label<y[1]){c.label=y[1],y=_;break}if(y&&c.label<y[2]){c.label=y[2],c.ops.push(_);break}y[2]&&c.ops.pop(),c.trys.pop();continue}_=i.call(n,c)}catch(T){_=[6,T],g=0}finally{f=y=0}if(_[0]&5)throw _[1];return{value:_[0]?_[1]:void 0,done:!0}}},dc=function(n,i){for(var c in n)c!=="default"&&!Object.prototype.hasOwnProperty.call(i,c)&&Fn(i,n,c)},Fn=Object.create?function(n,i,c,f){f===void 0&&(f=c);var g=Object.getOwnPropertyDescriptor(i,c);(!g||("get"in g?!i.__esModule:g.writable||g.configurable))&&(g={enumerable:!0,get:function(){return i[c]}}),Object.defineProperty(n,f,g)}:function(n,i,c,f){f===void 0&&(f=c),n[f]=i[c]},Bn=function(n){var i=typeof Symbol=="function"&&Symbol.iterator,c=i&&n[i],f=0;if(c)return c.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&f>=n.length&&(n=void 0),{value:n&&n[f++],done:!n}}};throw new TypeError(i?"Object is not iterable.":"Symbol.iterator is not defined.")},Aa=function(n,i){var c=typeof Symbol=="function"&&n[Symbol.iterator];if(!c)return n;var f=c.call(n),g,y=[],w;try{for(;(i===void 0||i-- >0)&&!(g=f.next()).done;)y.push(g.value)}catch(A){w={error:A}}finally{try{g&&!g.done&&(c=f.return)&&c.call(f)}finally{if(w)throw w.error}}return y},uc=function(){for(var n=[],i=0;i<arguments.length;i++)n=n.concat(Aa(arguments[i]));return n},fc=function(){for(var n=0,i=0,c=arguments.length;i<c;i++)n+=arguments[i].length;for(var f=Array(n),g=0,i=0;i<c;i++)for(var y=arguments[i],w=0,A=y.length;w<A;w++,g++)f[g]=y[w];return f},pc=function(n,i,c){if(c||arguments.length===2)for(var f=0,g=i.length,y;f<g;f++)(y||!(f in i))&&(y||(y=Array.prototype.slice.call(i,0,f)),y[f]=i[f]);return n.concat(y||Array.prototype.slice.call(i))},xo=function(n){return this instanceof xo?(this.v=n,this):new xo(n)},hc=function(n,i,c){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var f=c.apply(n,i||[]),g,y=[];return g={},w("next"),w("throw"),w("return"),g[Symbol.asyncIterator]=function(){return this},g;function w(E){f[E]&&(g[E]=function(S){return new Promise(function(k,V){y.push([E,S,k,V])>1||A(E,S)})})}function A(E,S){try{P(f[E](S))}catch(k){M(y[0][3],k)}}function P(E){E.value instanceof xo?Promise.resolve(E.value.v).then(_,T):M(y[0][2],E)}function _(E){A("next",E)}function T(E){A("throw",E)}function M(E,S){E(S),y.shift(),y.length&&A(y[0][0],y[0][1])}},mc=function(n){var i,c;return i={},f("next"),f("throw",function(g){throw g}),f("return"),i[Symbol.iterator]=function(){return this},i;function f(g,y){i[g]=n[g]?function(w){return(c=!c)?{value:xo(n[g](w)),done:g==="return"}:y?y(w):w}:y}},gc=function(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=n[Symbol.asyncIterator],c;return i?i.call(n):(n=typeof Bn=="function"?Bn(n):n[Symbol.iterator](),c={},f("next"),f("throw"),f("return"),c[Symbol.asyncIterator]=function(){return this},c);function f(y){c[y]=n[y]&&function(w){return new Promise(function(A,P){w=n[y](w),g(A,P,w.done,w.value)})}}function g(y,w,A,P){Promise.resolve(P).then(function(_){y({value:_,done:A})},w)}},vc=function(n,i){return Object.defineProperty?Object.defineProperty(n,"raw",{value:i}):n.raw=i,n};var r=Object.create?function(n,i){Object.defineProperty(n,"default",{enumerable:!0,value:i})}:function(n,i){n.default=i};yc=function(n){if(n&&n.__esModule)return n;var i={};if(n!=null)for(var c in n)c!=="default"&&Object.prototype.hasOwnProperty.call(n,c)&&Fn(i,n,c);return r(i,n),i},bc=function(n){return n&&n.__esModule?n:{default:n}},wc=function(n,i,c,f){if(c==="a"&&!f)throw new TypeError("Private accessor was defined without a getter");if(typeof i=="function"?n!==i||!f:!i.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return c==="m"?f:c==="a"?f.call(n):f?f.value:i.get(n)},Cc=function(n,i,c,f,g){if(f==="m")throw new TypeError("Private method is not writable");if(f==="a"&&!g)throw new TypeError("Private accessor was defined without a setter");if(typeof i=="function"?n!==i||!g:!i.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return f==="a"?g.call(n,c):g?g.value=c:i.set(n,c),c},xc=function(n,i){if(i===null||typeof i!="object"&&typeof i!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof n=="function"?i===n:n.has(i)},e("__extends",rc),e("__assign",oc),e("__rest",nc),e("__decorate",ic),e("__param",ac),e("__metadata",sc),e("__awaiter",lc),e("__generator",cc),e("__exportStar",dc),e("__createBinding",Fn),e("__values",Bn),e("__read",Aa),e("__spread",uc),e("__spreadArrays",fc),e("__spreadArray",pc),e("__await",xo),e("__asyncGenerator",hc),e("__asyncDelegator",mc),e("__asyncValues",gc),e("__makeTemplateObject",vc),e("__importStar",yc),e("__importDefault",bc),e("__classPrivateFieldGet",wc),e("__classPrivateFieldSet",Cc),e("__classPrivateFieldIn",xc)})});var Sa=nr(de=>{"use strict";Object.defineProperty(de,"__esModule",{value:!0});de.getLocalStorage=de.getLocalStorageOrThrow=de.getCrypto=de.getCryptoOrThrow=de.getLocation=de.getLocationOrThrow=de.getNavigator=de.getNavigatorOrThrow=de.getDocument=de.getDocumentOrThrow=de.getFromWindowOrThrow=de.getFromWindow=void 0;function eo(e){let t;return typeof window<"u"&&typeof window[e]<"u"&&(t=window[e]),t}de.getFromWindow=eo;function Eo(e){let t=eo(e);if(!t)throw new Error(`${e} is not defined in Window`);return t}de.getFromWindowOrThrow=Eo;function Vu(){return Eo("document")}de.getDocumentOrThrow=Vu;function qu(){return eo("document")}de.getDocument=qu;function $u(){return Eo("navigator")}de.getNavigatorOrThrow=$u;function zu(){return eo("navigator")}de.getNavigator=zu;function Zu(){return Eo("location")}de.getLocationOrThrow=Zu;function ju(){return eo("location")}de.getLocation=ju;function Ku(){return Eo("crypto")}de.getCryptoOrThrow=Ku;function Ju(){return eo("crypto")}de.getCrypto=Ju;function Yu(){return Eo("localStorage")}de.getLocalStorageOrThrow=Yu;function Qu(){return eo("localStorage")}de.getLocalStorage=Qu});var _c=nr(Vn=>{"use strict";Object.defineProperty(Vn,"__esModule",{value:!0});Vn.getWindowMetadata=void 0;var Ec=Sa();function Xu(){let e,t;try{e=Ec.getDocumentOrThrow(),t=Ec.getLocationOrThrow()}catch{return null}function r(){let P=e.getElementsByTagName("link"),_=[];for(let T=0;T<P.length;T++){let M=P[T],E=M.getAttribute("rel");if(E&&E.toLowerCase().indexOf("icon")>-1){let S=M.getAttribute("href");if(S)if(S.toLowerCase().indexOf("https:")===-1&&S.toLowerCase().indexOf("http:")===-1&&S.indexOf("//")!==0){let k=t.protocol+"//"+t.host;if(S.indexOf("/")===0)k+=S;else{let V=t.pathname.split("/");V.pop(),k+=V.join("/")+"/"+S}_.push(k)}else if(S.indexOf("//")===0){let k=t.protocol+S;_.push(k)}else _.push(S)}}return _}function n(...P){let _=e.getElementsByTagName("meta");for(let T=0;T<_.length;T++){let M=_[T],E=["itemprop","property","name"].map(S=>M.getAttribute(S)).filter(S=>S?P.includes(S):!1);if(E.length&&E){let S=M.getAttribute("content");if(S)return S}}return""}function i(){let P=n("name","og:site_name","og:title","twitter:title");return P||(P=e.title),P}function c(){return n("description","og:description","twitter:description","keywords")}let f=i(),g=c(),y=t.origin,w=r();return{description:g,url:y,icons:w,name:f}}Vn.getWindowMetadata=Xu});var Nc={};la(Nc,{BotInfo:()=>Lc,BrowserInfo:()=>Sc,NodeInfo:()=>Tc,ReactNativeInfo:()=>kc,SearchBotDeviceInfo:()=>Mc,browserName:()=>i0,detect:()=>n0,detectOS:()=>Wc,getNodeVersion:()=>Ic,parseUserAgent:()=>Ta});function n0(e){return e?Ta(e):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new kc:typeof navigator<"u"?Ta(navigator.userAgent):Ic()}function Rc(e){return e!==""&&o0.reduce(function(t,r){var n=r[0],i=r[1];if(t)return t;var c=i.exec(e);return!!c&&[n,c]},!1)}function i0(e){var t=Rc(e);return t?t[0]:null}function Ta(e){var t=Rc(e);if(!t)return null;var r=t[0],n=t[1];if(r==="searchbot")return new Lc;var i=n[1]&&n[1].split(/[._]/).slice(0,3);i?i.length<Pc&&(i=e0(i,a0(Pc-i.length))):i=[];var c=i.join("."),f=Wc(e),g=r0.exec(e);return g&&g[1]?new Mc(r,c,f,g[1]):new Sc(r,c,f)}function Wc(e){for(var t=0,r=Ac.length;t<r;t++){var n=Ac[t],i=n[0],c=n[1],f=c.exec(e);if(f)return i}return null}function Ic(){var e=typeof process<"u"&&process.version;return e?new Tc(process.version.slice(1)):null}function a0(e){for(var t=[],r=0;r<e;r++)t.push("0");return t}var e0,Sc,Tc,Mc,Lc,kc,t0,r0,Pc,o0,Ac,Oc=qs(()=>{e0=function(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;for(var n=Array(e),i=0,t=0;t<r;t++)for(var c=arguments[t],f=0,g=c.length;f<g;f++,i++)n[i]=c[f];return n},Sc=function(){function e(t,r,n){this.name=t,this.version=r,this.os=n,this.type="browser"}return e}(),Tc=function(){function e(t){this.version=t,this.type="node",this.name="node",this.os=process.platform}return e}(),Mc=function(){function e(t,r,n,i){this.name=t,this.version=r,this.os=n,this.bot=i,this.type="bot-device"}return e}(),Lc=function(){function e(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return e}(),kc=function(){function e(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return e}(),t0=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,r0=/(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,Pc=3,o0=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/EdgA?\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FBAV\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["searchbot",t0]],Ac=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]]});var La=nr(J=>{"use strict";Object.defineProperty(J,"__esModule",{value:!0});J.getClientMeta=J.getLocalStorage=J.getLocalStorageOrThrow=J.getCrypto=J.getCryptoOrThrow=J.getLocation=J.getLocationOrThrow=J.getNavigator=J.getNavigatorOrThrow=J.getDocument=J.getDocumentOrThrow=J.getFromWindowOrThrow=J.getFromWindow=J.isBrowser=J.isNode=J.isMobile=J.isIOS=J.isAndroid=J.detectOS=J.detectEnv=void 0;var Dc=Hn(),s0=Dc.__importStar(_c()),qt=Dc.__importStar(Sa()),l0=(Oc(),ca(Nc));function Ma(e){return(0,l0.detect)(e)}J.detectEnv=Ma;function qn(){let e=Ma();return e&&e.os?e.os:void 0}J.detectOS=qn;function Uc(){let e=qn();return e?e.toLowerCase().includes("android"):!1}J.isAndroid=Uc;function Bc(){let e=qn();return e?e.toLowerCase().includes("ios")||e.toLowerCase().includes("mac")&&navigator.maxTouchPoints>1:!1}J.isIOS=Bc;function c0(){return qn()?Uc()||Bc():!1}J.isMobile=c0;function Fc(){let e=Ma();return e&&e.name?e.name.toLowerCase()==="node":!1}J.isNode=Fc;function d0(){return!Fc()&&!!(0,J.getNavigator)()}J.isBrowser=d0;J.getFromWindow=qt.getFromWindow;J.getFromWindowOrThrow=qt.getFromWindowOrThrow;J.getDocumentOrThrow=qt.getDocumentOrThrow;J.getDocument=qt.getDocument;J.getNavigatorOrThrow=qt.getNavigatorOrThrow;J.getNavigator=qt.getNavigator;J.getLocationOrThrow=qt.getLocationOrThrow;J.getLocation=qt.getLocation;J.getCryptoOrThrow=qt.getCryptoOrThrow;J.getCrypto=qt.getCrypto;J.getLocalStorageOrThrow=qt.getLocalStorageOrThrow;J.getLocalStorage=qt.getLocalStorage;function u0(){return s0.getWindowMetadata()}J.getClientMeta=u0});var Gc={};la(Gc,{safeJsonParse:()=>f0,safeJsonStringify:()=>p0});function f0(e){if(typeof e!="string")throw new Error(`Cannot safe json parse value of type ${typeof e}`);try{return JSON.parse(e)}catch{return e}}function p0(e){return typeof e=="string"?e:JSON.stringify(e)}var Hc=qs(()=>{});var ka=nr(_o=>{"use strict";Object.defineProperty(_o,"__esModule",{value:!0});_o.safeJsonStringify=_o.safeJsonParse=void 0;var h0=Hn(),Vc=h0.__importStar((Hc(),ca(Gc)));_o.safeJsonParse=Vc.safeJsonParse;_o.safeJsonStringify=Vc.safeJsonStringify});var Wa=nr(Ir=>{"use strict";Object.defineProperty(Ir,"__esModule",{value:!0});Ir.removeLocal=Ir.getLocal=Ir.setLocal=void 0;var qc=ka(),Ra=La();function m0(e,t){let r=(0,qc.safeJsonStringify)(t),n=(0,Ra.getLocalStorage)();n&&n.setItem(e,r)}Ir.setLocal=m0;function g0(e){let t=null,r=null,n=(0,Ra.getLocalStorage)();return n&&(r=n.getItem(e)),t=r&&(0,qc.safeJsonParse)(r),t}Ir.getLocal=g0;function v0(e){let t=(0,Ra.getLocalStorage)();t&&t.removeItem(e)}Ir.removeLocal=v0});var zc=nr(_t=>{"use strict";Object.defineProperty(_t,"__esModule",{value:!0});_t.getMobileLinkRegistry=_t.getMobileRegistryEntry=_t.saveMobileLinkInfo=_t.formatIOSMobile=_t.mobileLinkChoiceKey=void 0;var y0=Wa();_t.mobileLinkChoiceKey="WALLETCONNECT_DEEPLINK_CHOICE";function b0(e,t){let r=encodeURIComponent(e);return t.universalLink?`${t.universalLink}/wc?uri=${r}`:t.deepLink?`${t.deepLink}${t.deepLink.endsWith(":")?"//":"/"}wc?uri=${r}`:""}_t.formatIOSMobile=b0;function w0(e){let t=e.href.split("?")[0];(0,y0.setLocal)(_t.mobileLinkChoiceKey,Object.assign(Object.assign({},e),{href:t}))}_t.saveMobileLinkInfo=w0;function $c(e,t){return e.filter(r=>r.name.toLowerCase().includes(t.toLowerCase()))[0]}_t.getMobileRegistryEntry=$c;function C0(e,t){let r=e;return t&&(r=t.map(n=>$c(e,n)).filter(Boolean)),r}_t.getMobileLinkRegistry=C0});var Kc=nr(sr=>{"use strict";Object.defineProperty(sr,"__esModule",{value:!0});sr.formatMobileRegistry=sr.formatMobileRegistryEntry=sr.getDappRegistryUrl=sr.getWalletRegistryUrl=void 0;var Zc="https://registry.walletconnect.com";function x0(){return Zc+"/api/v2/wallets"}sr.getWalletRegistryUrl=x0;function E0(){return Zc+"/api/v2/dapps"}sr.getDappRegistryUrl=E0;function jc(e,t="mobile"){var r;return{name:e.name||"",shortName:e.metadata.shortName||"",color:e.metadata.colors.primary||"",logo:(r=e.image_url.sm)!==null&&r!==void 0?r:"",universalLink:e[t].universal||"",deepLink:e[t].native||""}}sr.formatMobileRegistryEntry=jc;function _0(e,t="mobile"){return Object.values(e).filter(r=>!!r[t].universal||!!r[t].native).map(r=>jc(r,t))}sr.formatMobileRegistry=_0});var Jc=nr(to=>{"use strict";Object.defineProperty(to,"__esModule",{value:!0});var Ko=Hn();Ko.__exportStar(La(),to);Ko.__exportStar(ka(),to);Ko.__exportStar(Wa(),to);Ko.__exportStar(zc(),to);Ko.__exportStar(Kc(),to)});var Ah={};la(Ah,{AsExternalProvider:()=>Rr,ConnectorManager:()=>Po,PrivyClient:()=>So,PrivyProvider:()=>Eu,PrivyProxyProvider:()=>Gt,VERSION:()=>En,WalletConnector:()=>wt,getAccessToken:()=>wo,usePrivy:()=>ie});module.exports=ca(Ah);var wu=require("@ethersproject/providers"),ve=require("react");var B=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};var zs=N(require("axios")),Kt=class extends Error{constructor(r,n,i){super(r);n instanceof Error&&(this.cause=n),this.privyErrorCode=i}toString(){return`${this.type}${this.privyErrorCode?`-${this.privyErrorCode}`:""}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}},mo=class extends Kt{constructor(r,n,i,c,f){super(i,c,f);this.type=r;this.status=n}},F=class extends Kt{constructor(r,n,i){super(r,n,i);this.type="client_error"}};var ye=class extends Kt{constructor(r,n,i){super(r,n,i);this.type="connector_error"}},st=e=>{if(e instanceof Kt)return e;if(!zs.default.isAxiosError(e))return Nt(e);if(!e.response)return new mo("api_error",null,e.message,e);let{type:t,message:r,error:n,code:i}=e.response.data;return new mo(t||"ApiError",e.response.status,r||n,e,i)},Nt=e=>e instanceof Kt?e:e instanceof Error?new F(e.message,e):new F(`Internal error: ${e}`);var Zs=()=>"/api/v1/sessions",js=()=>"/api/v1/sessions/logout",Ks=()=>"/api/v1/sessions/fork",Js=()=>"/api/v1/sessions/fork/recover",Ys=()=>"/api/v1/siwe/init",Qs=()=>"/api/v1/siwe/authenticate",Xs=()=>"/api/v1/siwe/link",el=()=>"/api/v1/passwordless/init",tl=()=>"/api/v1/passwordless/authenticate",rl=()=>"/api/v1/passwordless/link",ol=()=>"/api/v1/passwordless_sms/init",nl=()=>"/api/v1/passwordless_sms/authenticate",il=()=>"/api/v1/passwordless_sms/link",al=()=>"/api/v1/oauth/init",sl=()=>"/api/v1/oauth/authenticate",ll=()=>"/api/v1/oauth/link",cl=()=>"/api/v1/siwe/unlink",dl=()=>"/api/v1/passwordless/unlink",ul=()=>"/api/v1/passwordless_sms/unlink",fl=()=>"/api/v1/oauth/unlink",pl=()=>"/api/v1/analytics_events";var jr=class{constructor(t){this.meta={email:t}}async authenticate(){if(!this.api)throw new F("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new F("Email and email code must be set prior to calling authenticate.");try{let t=tl(),r=await this.api.post(t,{email:this.meta.email,code:this.meta.emailCode});return{user:r.data.user,token:r.data.token,refresh_token:r.data.refresh_token,is_new_user:r.data.is_new_user}}catch(t){throw st(t)}}async link(){if(!this.api)throw new F("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new F("Email and email code must be set prior to calling authenticate.");try{let t=rl();return(await this.api.post(t,{email:this.meta.email,code:this.meta.emailCode})).data}catch(t){throw st(t)}}async sendCodeEmail(t){if(!this.api)throw new F("Auth flow has no API instance");if(t&&(this.meta.email=t),!this.meta.email)throw new F("Email must be set when initialzing authentication.");try{let r=el();return(await this.api.post(r,{email:this.meta.email})).data}catch(r){throw st(r)}}};var Mr=class{constructor(t,r,n){this.meta={provider:t},this.meta.authorizationCode=r,this.meta.stateCode=n}isActive(){return!!(this.meta.authorizationCode&&this.meta.stateCode&&this.meta.provider)}async authenticate(){if(!this.api)throw new F("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new F("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new F("User denied confirmation during OAuth flow");try{let t=sl(),r=await this.api.post(t,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode});return{user:r.data.user,token:r.data.token,refresh_token:r.data.refresh_token,is_new_user:r.data.is_new_user}}catch(t){throw st(t)}}async link(){if(!this.api)throw new F("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new F("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new F("User denied confirmation during OAuth flow");try{let t=ll();return(await this.api.post(t,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode})).data}catch(t){throw st(t)}}async getAuthorizationUrl(){var t;if(!this.api)throw new F("Auth flow has no API instance");if(!this.meta.provider)throw new F("Provider must be set when initialzing OAuth authentication.");try{let r=al();return(await this.api.post(r,{provider:this.meta.provider,redirect_to:window.location.href},{baseURL:(t=this.api)==null?void 0:t.fallbackApiUrl})).data}catch(r){throw st(r)}}};var Lr=class{constructor(t,r,n){this._meta={walletType:r,walletId:n},this.connectors=t,this.walletConnector=this.connectors.createWalletConnector(r,null,n)}get meta(){return{...this._meta,walletName:this.walletConnector.walletBranding.name,walletIcon:this.walletConnector.walletBranding.icon}}async authenticate(){if(!this.api)throw new F("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign(),n=await this.api.post(Qs(),{message:t,signature:r});return this.connectors.addWalletConnector(this.walletConnector),await this.connectors.setActiveWallet(this.walletConnector.address)||console.warn("Failed to set active wallet"),{user:n.data.user,token:n.data.token,refresh_token:n.data.refresh_token,is_new_user:n.data.is_new_user}}catch(t){throw st(t)}}async link(){if(!this.api)throw new F("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign(),n=await this.api.post(Xs(),{message:t,signature:r});return this.connectors.addWalletConnector(this.walletConnector),await this.connectors.setActiveWallet(this.walletConnector.address)||console.warn("Failed to set active wallet"),n.data}catch(t){throw st(t)}}async promptConnect(){if(!this.api)throw new F("Auth flow has no API instance");let t=await this.walletConnector.connect({showPrompt:!0});return await this.buildSiweMessage(t),t}async sign(){if(!this.api)throw new F("Auth flow has no API instance");if(!this.preparedMessage){let r=await this.walletConnector.connect({showPrompt:!1});await this.buildSiweMessage(r)}if(!this.preparedMessage)throw new F("Could not prepare SIWE message");let t=await this.walletConnector.sign(this.preparedMessage);return{message:this.preparedMessage,signature:t}}async buildSiweMessage(t){if(!this.api)throw new F("Auth flow has no API instance");let r=t.address,n=t.chainId,i=await this.api.post(Ys(),{address:r});return this.preparedMessage=this.walletConnector.prepareMessage(n,r,i.data.nonce),this.preparedMessage}};var Kr=class{constructor(t){this.meta={phoneNumber:t}}async authenticate(){if(!this.api)throw new F("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new F("phone number and sms code must be set prior to calling authenticate.");try{let t=nl(),r=await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return{user:r.data.user,token:r.data.token,refresh_token:r.data.refresh_token,is_new_user:r.data.is_new_user}}catch(t){throw st(t)}}async link(){if(!this.api)throw new F("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new F("phone number and sms code must be set prior to calling authenticate.");try{let t=il();return(await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})).data}catch(t){throw st(t)}}async sendSmsCode(t){if(!this.api)throw new F("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),!this.meta.phoneNumber)throw new F("phone nNumber must be set when initialzing authentication.");try{let r=ol();return(await this.api.post(r,{phoneNumber:this.meta.phoneNumber})).data}catch(r){throw st(r)}}};var od=require("@ethersproject/address");var hl="1.24.0-beta.7";var ir="4df5e2316331463a9130964bd6078dfa",xn="https://auth.privy.io",ml=1e4,Ot=1400,En=hl;var go="privy:token",_n="privy:refresh_token",$o="privy:session_transfer_token",Pn="privy:connectors",da="walletconnect",gl=3e4,Dt=1;var ua=class{constructor(){this._cache={}}get(t){return this._cache[t]}put(t,r){r!==void 0?this._cache[t]=r:this.del(t)}del(t){delete this._cache[t]}getKeys(){return Object.keys(this._cache)}},fa=class{get(t){let r=localStorage.getItem(t);return r===null?void 0:JSON.parse(r)}put(t,r){r!==void 0?localStorage.setItem(t,JSON.stringify(r)):this.del(t)}del(t){localStorage.removeItem(t)}getKeys(){return Object.entries(localStorage).map(([t])=>t)}};function Lu(){return typeof window<"u"&&window.localStorage?new fa:new ua}var me=Lu();var zl=N(require("@coinbase/wallet-sdk")),Zl=require("@ethersproject/address");var zo=require("react/jsx-runtime"),Ut=({style:e,...t})=>(0,zo.jsxs)("svg",{width:"1024",height:"1024",viewBox:"0 0 1024 1024",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...e},...t,children:[(0,zo.jsx)("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),(0,zo.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z",fill:"white"})]});var ql=require("@ethersproject/address"),$l=require("@ethersproject/providers");var bl=require("@ethersproject/logger");var vl="bytes/5.7.0";var vo=new bl.Logger(vl);function wl(e){return!!e.toHexString}function An(e){return e.slice||(e.slice=function(){let t=Array.prototype.slice.call(arguments);return An(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function yl(e){return typeof e=="number"&&e==e&&e%1===0}function Sn(e){if(e==null)return!1;if(e.constructor===Uint8Array)return!0;if(typeof e=="string"||!yl(e.length)||e.length<0)return!1;for(let t=0;t<e.length;t++){let r=e[t];if(!yl(r)||r<0||r>=256)return!1}return!0}function Cl(e,t){if(t||(t={}),typeof e=="number"){vo.checkSafeUint53(e,"invalid arrayify value");let r=[];for(;e;)r.unshift(e&255),e=parseInt(String(e/256));return r.length===0&&r.push(0),An(new Uint8Array(r))}if(t.allowMissingPrefix&&typeof e=="string"&&e.substring(0,2)!=="0x"&&(e="0x"+e),wl(e)&&(e=e.toHexString()),gr(e)){let r=e.substring(2);r.length%2&&(t.hexPad==="left"?r="0"+r:t.hexPad==="right"?r+="0":vo.throwArgumentError("hex data is odd-length","value",e));let n=[];for(let i=0;i<r.length;i+=2)n.push(parseInt(r.substring(i,i+2),16));return An(new Uint8Array(n))}return Sn(e)?An(new Uint8Array(e)):vo.throwArgumentError("invalid arrayify value","value",e)}function gr(e,t){return!(typeof e!="string"||!e.match(/^0x[0-9A-Fa-f]*$/)||t&&e.length!==2+2*t)}var pa="0123456789abcdef";function xl(e,t){if(t||(t={}),typeof e=="number"){vo.checkSafeUint53(e,"invalid hexlify value");let r="";for(;e;)r=pa[e&15]+r,e=Math.floor(e/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"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),wl(e))return e.toHexString();if(gr(e))return e.length%2&&(t.hexPad==="left"?e="0x0"+e.substring(2):t.hexPad==="right"?e+="0":vo.throwArgumentError("hex data is odd-length","value",e)),e.toLowerCase();if(Sn(e)){let r="0x";for(let n=0;n<e.length;n++){let i=e[n];r+=pa[(i&240)>>4]+pa[i&15]}return r}return vo.throwArgumentError("invalid hexlify value","value",e)}var Fl=require("@ethersproject/providers");var Tl=N(_l());var Jr=require("@ethersproject/logger");var Pl="bignumber/5.7.0";var ga=Tl.default.BN,vr=new Jr.Logger(Pl),ma={},Al=9007199254740991;var Sl=!1,lt=class{constructor(t,r){t!==ma&&vr.throwError("cannot call constructor directly; use BigNumber.from",Jr.Logger.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=r,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return yt(ee(this).fromTwos(t))}toTwos(t){return yt(ee(this).toTwos(t))}abs(){return this._hex[0]==="-"?lt.from(this._hex.substring(1)):this}add(t){return yt(ee(this).add(ee(t)))}sub(t){return yt(ee(this).sub(ee(t)))}div(t){return lt.from(t).isZero()&&Bt("division-by-zero","div"),yt(ee(this).div(ee(t)))}mul(t){return yt(ee(this).mul(ee(t)))}mod(t){let r=ee(t);return r.isNeg()&&Bt("division-by-zero","mod"),yt(ee(this).umod(r))}pow(t){let r=ee(t);return r.isNeg()&&Bt("negative-power","pow"),yt(ee(this).pow(r))}and(t){let r=ee(t);return(this.isNegative()||r.isNeg())&&Bt("unbound-bitwise-result","and"),yt(ee(this).and(r))}or(t){let r=ee(t);return(this.isNegative()||r.isNeg())&&Bt("unbound-bitwise-result","or"),yt(ee(this).or(r))}xor(t){let r=ee(t);return(this.isNegative()||r.isNeg())&&Bt("unbound-bitwise-result","xor"),yt(ee(this).xor(r))}mask(t){return(this.isNegative()||t<0)&&Bt("negative-width","mask"),yt(ee(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&Bt("negative-width","shl"),yt(ee(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&Bt("negative-width","shr"),yt(ee(this).shrn(t))}eq(t){return ee(this).eq(ee(t))}lt(t){return ee(this).lt(ee(t))}lte(t){return ee(this).lte(ee(t))}gt(t){return ee(this).gt(ee(t))}gte(t){return ee(this).gte(ee(t))}isNegative(){return this._hex[0]==="-"}isZero(){return ee(this).isZero()}toNumber(){try{return ee(this).toNumber()}catch{Bt("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return vr.throwError("this platform does not support BigInt",Jr.Logger.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?Sl||(Sl=!0,vr.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?vr.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",Jr.Logger.errors.UNEXPECTED_ARGUMENT,{}):vr.throwError("BigNumber.toString does not accept parameters",Jr.Logger.errors.UNEXPECTED_ARGUMENT,{})),ee(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof lt)return t;if(typeof t=="string")return t.match(/^-?0x[0-9a-f]+$/i)?new lt(ma,Zo(t)):t.match(/^-?[0-9]+$/)?new lt(ma,Zo(new ga(t))):vr.throwArgumentError("invalid BigNumber string","value",t);if(typeof t=="number")return t%1&&Bt("underflow","BigNumber.from",t),(t>=Al||t<=-Al)&&Bt("overflow","BigNumber.from",t),lt.from(String(t));let r=t;if(typeof r=="bigint")return lt.from(r.toString());if(Sn(r))return lt.from(xl(r));if(r)if(r.toHexString){let n=r.toHexString();if(typeof n=="string")return lt.from(n)}else{let n=r._hex;if(n==null&&r.type==="BigNumber"&&(n=r.hex),typeof n=="string"&&(gr(n)||n[0]==="-"&&gr(n.substring(1))))return lt.from(n)}return vr.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!!(t&&t._isBigNumber)}};function Zo(e){if(typeof e!="string")return Zo(e.toString(16));if(e[0]==="-")return e=e.substring(1),e[0]==="-"&&vr.throwArgumentError("invalid hex","value",e),e=Zo(e),e==="0x00"?e:"-"+e;if(e.substring(0,2)!=="0x"&&(e="0x"+e),e==="0x")return"0x00";for(e.length%2&&(e="0x0"+e.substring(2));e.length>4&&e.substring(0,4)==="0x00";)e="0x"+e.substring(4);return e}function yt(e){return lt.from(Zo(e))}function ee(e){let t=lt.from(e).toHexString();return t[0]==="-"?new ga("-"+t.substring(3),16):new ga(t.substring(2),16)}function Bt(e,t,r){let n={fault:e,operation:t};return r!=null&&(n.value=r),vr.throwError(e,Jr.Logger.errors.NUMERIC_FAULT,n)}var Ll=require("@ethersproject/logger");var Ml="strings/5.7.0";var ku=new Ll.Logger(Ml),va;(function(e){e.current="",e.NFC="NFC",e.NFD="NFD",e.NFKC="NFKC",e.NFKD="NFKD"})(va||(va={}));var bt;(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"})(bt||(bt={}));function Ru(e,t,r,n,i){return ku.throwArgumentError(`invalid codepoint at offset ${t}; ${e}`,"bytes",r)}function kl(e,t,r,n,i){if(e===bt.BAD_PREFIX||e===bt.UNEXPECTED_CONTINUE){let c=0;for(let f=t+1;f<r.length&&r[f]>>6===2;f++)c++;return c}return e===bt.OVERRUN?r.length-t-1:0}function Wu(e,t,r,n,i){return e===bt.OVERLONG?(n.push(i),0):(n.push(65533),kl(e,t,r,n,i))}var Rl=Object.freeze({error:Ru,ignore:kl,replace:Wu});function Iu(e,t){t==null&&(t=Rl.error),e=Cl(e);let r=[],n=0;for(;n<e.length;){let i=e[n++];if(i>>7===0){r.push(i);continue}let c=null,f=null;if((i&224)===192)c=1,f=127;else if((i&240)===224)c=2,f=2047;else if((i&248)===240)c=3,f=65535;else{(i&192)===128?n+=t(bt.UNEXPECTED_CONTINUE,n-1,e,r):n+=t(bt.BAD_PREFIX,n-1,e,r);continue}if(n-1+c>=e.length){n+=t(bt.OVERRUN,n-1,e,r);continue}let g=i&(1<<8-c-1)-1;for(let y=0;y<c;y++){let w=e[n];if((w&192)!=128){n+=t(bt.MISSING_CONTINUE,n,e,r),g=null;break}g=g<<6|w&63,n++}if(g!==null){if(g>1114111){n+=t(bt.OUT_OF_RANGE,n-1-c,e,r,g);continue}if(g>=55296&&g<=57343){n+=t(bt.UTF16_SURROGATE,n-1-c,e,r,g);continue}if(g<=f){n+=t(bt.OVERLONG,n-1-c,e,r,g);continue}r.push(g)}}return r}function Nu(e){return e.map(t=>t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10&1023)+55296,(t&1023)+56320))).join("")}function ya(e,t){return Nu(Iu(e,t))}var Gl=N(require("eventemitter3"));var Ou=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign"],Wl=e=>Ou.includes(e);var Il=require("libphonenumber-js/min");var Nl=e=>!!String(e).toLowerCase().match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/),Ol=e=>(0,Il.isPossiblePhoneNumber)(String(e),"US"),Dl=(e,t)=>{let r=e.slice(0),n=[];for(;r.length;)n.push(r.splice(0,t));return n},Jt=(e,t=3,r=4)=>{if(!e)return"";let n=2,i=3;if(t+r+n+i>=e.length)return e;let c=e.slice(0,n+t),f=e.slice(e.length-r,e.length);return`${c}...${f}`},ba=e=>new Promise(t=>setTimeout(t,e)),Ul=(e,t={})=>{let r=t.delayMs||40,n=t.maxAttempts||1e3;return new Promise(async(i,c)=>{let f=!1,g=0;for(;!f&&g<n;)e().then(()=>{f=!0,i()},(...y)=>{f=!0,c(...y)}),g+=1,await ba(r);f||c(new Error("Exceeded max attempts before resolving function"))})},Tn=(e,t,r={})=>{let n=new URL(t,e);for(let[i,c]of Object.entries(r))n.searchParams.set(i,c);return n.href},Du=(e,t)=>e.toLowerCase()===t.toLowerCase(),wa=(e,t)=>{for(let r of e)if(Du(r,t))return!0;return!1},Mn=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),jo=e=>typeof e=="string"?e:"0x"+e.toString(16);var Bl=require("@ethersproject/logger");var yo=class extends ye{constructor(){super("Wallet timeout");this.type="wallet_error"}},Qr=class extends ye{constructor(){super("User rejected connection");this.type="wallet_error"}},Ft=e=>{if(e instanceof ye)return e;if((e==null?void 0:e.code)&&(e==null?void 0:e.reason)){let t=new bo(e);return e.code===Bl.ErrorCode.ACTION_REJECTED&&(t.details=Yr.E4001_USER_REJECTED_REQUEST),t}return e!=null&&e.code?new bo(e):new ye("Unknown connector error",e)},Ca=class extends Kt{constructor(r,n,i){super(r);this.type="provider_error";this.code=n,this.data=i}},bo=class extends Ca{constructor(r){var c,f,g;let n=r;super(n.message,n.code,n.data);let i=Object.values(Yr).find(y=>y.eipCode===n.code);this.details=i||Yr.UNKNOWN_ERROR,n.code===-32002&&((c=n.message)!=null&&c.includes("already pending for origin")?(f=n.message)!=null&&f.includes("wallet_requestPermissions")?this.details=Yr.E32002_CONNECTION_ALREADY_PENDING:this.details=Yr.E32002_REQUEST_ALREADY_PENDING:(g=n.message)!=null&&g.includes("Already processing")&&n.message.includes("eth_requestAccounts")&&(this.details=Yr.E32002_WALLET_LOCKED))}},Uu={ERROR_USER_EXISTS:{message:"User already exists for this address",detail:"Try another address!",retryable:!1},ERROR_TIMED_OUT:{message:"Wallet request timed out",detail:"Please try connecting again.",retryable:!0},ERROR_WALLET_CONNECTION:{message:"Could not log in with wallet",detail:"Please try connecting again.",retryable:!0},ERROR_USER_REJECTED_CONNECTION:{message:"You rejected the request",detail:"Please try connecting again.",retryable:!0}},Bu={E32002_CONNECTION_ALREADY_PENDING:{eipCode:-32002,message:"Connection request already pending",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E32002_REQUEST_ALREADY_PENDING:{eipCode:-32002,message:"Resource request already pending",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E32002_WALLET_LOCKED:{eipCode:-32002,message:"Wallet might be locked",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E4001_USER_REJECTED_REQUEST:{eipCode:4001,message:"Signature rejected",detail:"Please try signing again.",retryable:!0}},Fu={E4001_DEFAULT_USER_REJECTED_REQUEST:{eipCode:4001,message:"User Rejected Request",detail:"The user rejected the request.",default:!0,retryable:!0},E4100_DEFAULT_UNAUTHORIZED:{eipCode:4100,message:"Unauthorized",detail:"The requested method and/or account has not been authorized by the user.",default:!0,retryable:!1},E4200_DEFAULT_UNSUPPORTED_METHOD:{eipCode:4200,message:"Unsupported Method",detail:"The Provider does not support the requested method.",default:!0,retryable:!1},E4900_DEFAULT_DISCONNECTED:{eipCode:4900,message:"Disconnected",detail:"The Provider is disconnected from all chains.",default:!0,retryable:!0},E4901_DEFAULT_CHAIN_DISCONNECTED:{eipCode:4901,message:"Chain Disconnected",detail:"The Provider is not connected to the requested chain.",default:!0,retryable:!0},E32700_DEFAULT_PARSE_ERROR:{eipCode:-32700,message:"Parse error",detail:"Invalid JSON",default:!0,retryable:!1},E32600_DEFAULT_INVALID_REQUEST:{eipCode:-32600,message:"Invalid request",detail:"JSON is not a valid request object",default:!0,retryable:!1},E32601_DEFAULT_METHOD_NOT_FOUND:{eipCode:-32601,message:"Method not found",detail:"Method does not exist",default:!0,retryable:!1},E32602_DEFAULT_INVALID_PARAMS:{eipCode:-32602,message:"Invalid params",detail:"Invalid method parameters",default:!0,retryable:!1},E32603_DEFAULT_INTERNAL_ERROR:{eipCode:-32603,message:"Internal error",detail:"Internal JSON-RPC error",default:!0,retryable:!0},E32000_DEFAULT_INVALID_INPUT:{eipCode:-32e3,message:"Invalid input",detail:"Missing or invalid parameters",default:!0,retryable:!1},E32001_DEFAULT_RESOURCE_NOT_FOUND:{eipCode:-32001,message:"Resource not found",detail:"Requested resource not found",default:!0,retryable:!1},E32002_DEFAULT_RESOURCE_UNAVAILABLE:{eipCode:-32002,message:"Resource unavailable",detail:"Requested resource not available",default:!0,retryable:!0},E32003_DEFAULT_TRANSACTION_REJECTED:{eipCode:-32003,message:"Transaction rejected",detail:"Transaction creation failed",default:!0,retryable:!0},E32004_DEFAULT_METHOD_NOT_SUPPORTED:{eipCode:-32004,message:"Method not supported",detail:"Method is not implemented",default:!0,retryable:!1},E32005_DEFAULT_LIMIT_EXCEEDED:{eipCode:-32005,message:"Limit exceeded",detail:"Request exceeds defined limit",default:!0,retryable:!1},E32006_DEFAULT_JSON_RPC_VERSION_NOT_SUPPORTED:{eipCode:-32006,message:"JSON-RPC version not supported",detail:"Version of JSON-RPC protocol is not supported",default:!0,retryable:!1}},Yr={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...Fu,...Bu},Xr={...Uu,...Yr};var Gu=12e4,xa=(e=new yo,t=Gu)=>new Promise((r,n)=>setTimeout(()=>{n(e)},t)),Gt=class{constructor(t){this.removeListener=(t,r)=>{if(this.walletProvider)return this.walletProvider.removeListener(t,r)};this.setWalletProvider=t=>{this.walletProvider=t,this._subscriptions.forEach(r=>{var n;(n=this.walletProvider)==null||n.on(r.eventName,r.listener)})};this.walletProvider=t,this._subscriptions=[]}on(t,r){if(this.walletProvider)return this.walletProvider.on(t,r);this._subscriptions.push({eventName:t,listener:r})}async request(t){if(!this.walletProvider)throw new ye(`A wallet request of type ${t.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(t),xa()]).catch(r=>{throw Ft(r)})}},kr=class extends Error{constructor(r,n,i){super(r);this.code=n,this.data=i}},Ln=class extends Gl.default{constructor(r,n,i=1){super();this.walletProxy=r,this.address=n,this.chainId=i,this.infuraProvider=new Fl.InfuraProvider(i,ir)}async handleSendTransaction(r){if(!r.params||!Array.isArray(r.params))throw new kr(`Invalid params for ${r.method}`,4200);let n=r.params[0],i=n.chainId;if(i&&Number(i)!==this.chainId)throw new kr(`Chain disconnected. Currently connected to ${this.chainId}, attempting to send to ${Number(i)}`,4901);if(!await wo()||!this.address)throw new kr("Disconnected",4900);return(await Vl(n)).transactionHash}handleSwitchEthereumChain(r){if(!r.params||!Array.isArray(r.params))throw new kr(`Invalid params for ${r.method}`,4200);let n=r.params[0];this.chainId=Number(n),this.emit("chainChanged",n)}async handlePersonalSign(r){if(!r.params||!Array.isArray(r.params))throw new Error("Invalid params for eth_estimateGas");let n=r.params[0],i=gr(n)?ya(n):n;return await Hl(i)}async handleEstimateGas(r){if(!r.params||!Array.isArray(r.params))throw new Error("Invalid params for eth_estimateGas");let n={...r.params[0],chainId:jo(this.chainId)};return delete n.from,this.infuraProvider.send("eth_estimateGas",[n])}async request(r){switch(console.debug("Embedded1193Provider.request() called with args",r),r.method){case"eth_accounts":return this.address?[this.address]:[];case"eth_chainId":return jo(this.chainId);case"eth_estimateGas":return this.handleEstimateGas(r);case"eth_sendTransaction":return this.handleSendTransaction(r);case"wallet_switchEthereumChain":return this.handleSwitchEthereumChain(r);case"personal_sign":return this.handlePersonalSign(r);default:break}if(Wl(r.method)){let n=await wo();if(!n||!this.address)throw new kr("Disconnected",4900);try{return(await this.walletProxy.rpc({address:this.address,accessToken:n,request:{method:r.method,params:r.params}})).response.data}catch(i){throw console.error(i),new kr("Disconnected",4900)}}else return this.infuraProvider.send(r.method,r.params)}async connect(){let r=await wo();if(!r||!this.address)return null;try{return(await this.walletProxy.connect({address:this.address,accessToken:r})).address}catch(n){return console.error(n),null}}},Rr=class extends Gt{constructor(r){super(r)}},kn=class extends Gt{constructor(t){super(t)}sendAsync(t,r){throw new Error("sendAsync is no longer supported by EIP-1193. Use the request method instead.")}};var wt=class{constructor(t,r,n){this.createSiweMessage=(t,r,n,i,c,f,g)=>`${n} wants you to sign in with your Ethereum account:
2
2
  ${r}
3
3
 
4
4
  ${g}
@@ -2117,7 +2117,7 @@ Resources:
2117
2117
  padding: 24px;
2118
2118
 
2119
2119
  &&[data-height='full'] {
2120
- min-height: 620px;
2120
+ height: 620px;
2121
2121
  }
2122
2122
 
2123
2123
  &&[data-height='medium'] {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@privy-io/react-auth",
3
- "version": "1.24.0-beta.6",
3
+ "version": "1.24.0-beta.7",
4
4
  "description": "React client for the Privy Auth API",
5
5
  "keywords": [
6
6
  "authentication",