@tan_hoang/test2
Version:
ethers.js extension for kaia blockchain
2 lines • 824 kB
JavaScript
/*! For license information please see ethers-ext.v6.bundle.js.LICENSE.txt */
(()=>{var t={3550:function(t,e,r){!function(t,e){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function a(t,e,r){if(a.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var s;"object"==typeof t?t.exports=a:e.BN=a,a.BN=a,a.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(6601).Buffer}catch(t){}function o(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+t)}function u(t,e,r){var n=o(t,r);return r-1>=e&&(n|=o(t,r-1)<<4),n}function l(t,e,r,i){for(var a=0,s=0,o=Math.min(t.length,r),u=e;u<o;u++){var l=t.charCodeAt(u)-48;a*=i,s=l>=49?l-49+10:l>=17?l-17+10:l,n(l>=0&&s<i,"Invalid character"),a+=s}return a}function c(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(a.isBN=function(t){return t instanceof a||null!==t&&"object"==typeof t&&t.constructor.wordSize===a.wordSize&&Array.isArray(t.words)},a.max=function(t,e){return t.cmp(e)>0?t:e},a.min=function(t,e){return t.cmp(e)<0?t:e},a.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<t.length&&(16===e?this._parseHex(t,i,r):(this._parseBase(t,e,i),"le"===r&&this._initArray(this.toArray(),e,r)))},a.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initArray=function(t,e,r){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var a,s,o=0;if("be"===r)for(i=t.length-1,a=0;i>=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[a]|=s<<o&67108863,this.words[a+1]=s>>>26-o&67108863,(o+=24)>=26&&(o-=26,a++);else if("le"===r)for(i=0,a=0;i<t.length;i+=3)s=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[a]|=s<<o&67108863,this.words[a+1]=s>>>26-o&67108863,(o+=24)>=26&&(o-=26,a++);return this._strip()},a.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var i,a=0,s=0;if("be"===r)for(n=t.length-1;n>=e;n-=2)i=u(t,e,n)<<a,this.words[s]|=67108863&i,a>=18?(a-=18,s+=1,this.words[s]|=i>>>26):a+=8;else for(n=(t.length-e)%2==0?e+1:e;n<t.length;n+=2)i=u(t,e,n)<<a,this.words[s]|=67108863&i,a>=18?(a-=18,s+=1,this.words[s]|=i>>>26):a+=8;this._strip()},a.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var a=t.length-r,s=a%n,o=Math.min(a,a-s)+r,u=0,c=r;c<o;c+=n)u=l(t,c,c+n,e),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var f=1;for(u=l(t,c,t.length,e),c=0;c<s;c++)f*=e;this.imuln(f),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},a.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},a.prototype._move=function(t){c(t,this)},a.prototype.clone=function(){var t=new a(null);return this.copy(t),t},a.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},a.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},a.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{a.prototype[Symbol.for("nodejs.util.inspect.custom")]=f}catch(t){a.prototype.inspect=f}else a.prototype.inspect=f;function f(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var h=["","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"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function g(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],a=0|e.words[0],s=i*a,o=67108863&s,u=s/67108864|0;r.words[0]=o;for(var l=1;l<n;l++){for(var c=u>>>26,f=67108863&u,h=Math.min(l,e.length-1),d=Math.max(0,l-t.length+1);d<=h;d++){var p=l-d|0;c+=(s=(i=0|t.words[p])*(a=0|e.words[d])+f)/67108864|0,f=67108863&s}r.words[l]=0|f,u=0|c}return 0!==u?r.words[l]=0|u:r.length--,r._strip()}a.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,a=0,s=0;s<this.length;s++){var o=this.words[s],u=(16777215&(o<<i|a)).toString(16);a=o>>>24-i&16777215,(i+=2)>=26&&(i-=26,s--),r=0!==a||s!==this.length-1?h[6-u.length]+u+r:u+r}for(0!==a&&(r=a.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var l=d[t],c=p[t];r="";var f=this.clone();for(f.negative=0;!f.isZero();){var g=f.modrn(c).toString(t);r=(f=f.idivn(c)).isZero()?g+r:h[l-g.length]+g+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},a.prototype.toJSON=function(){return this.toString(16,2)},s&&(a.prototype.toBuffer=function(t,e){return this.toArrayLike(s,t,e)}),a.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},a.prototype.toArrayLike=function(t,e,r){this._strip();var i=this.byteLength(),a=r||Math.max(1,i);n(i<=a,"byte array longer than desired length"),n(a>0,"Requested array length <= 0");var s=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,a);return this["_toArrayLike"+("le"===e?"LE":"BE")](s,i),s},a.prototype._toArrayLikeLE=function(t,e){for(var r=0,n=0,i=0,a=0;i<this.length;i++){var s=this.words[i]<<a|n;t[r++]=255&s,r<t.length&&(t[r++]=s>>8&255),r<t.length&&(t[r++]=s>>16&255),6===a?(r<t.length&&(t[r++]=s>>24&255),n=0,a=0):(n=s>>>24,a+=2)}if(r<t.length)for(t[r++]=n;r<t.length;)t[r++]=0},a.prototype._toArrayLikeBE=function(t,e){for(var r=t.length-1,n=0,i=0,a=0;i<this.length;i++){var s=this.words[i]<<a|n;t[r--]=255&s,r>=0&&(t[r--]=s>>8&255),r>=0&&(t[r--]=s>>16&255),6===a?(r>=0&&(t[r--]=s>>24&255),n=0,a=0):(n=s>>>24,a+=2)}if(r>=0)for(t[r--]=n;r>=0;)t[r--]=0},Math.clz32?a.prototype._countBits=function(t){return 32-Math.clz32(t)}:a.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},a.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},a.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},a.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},a.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},a.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},a.prototype.isNeg=function(){return 0!==this.negative},a.prototype.neg=function(){return this.clone().ineg()},a.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},a.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this._strip()},a.prototype.ior=function(t){return n(0==(this.negative|t.negative)),this.iuor(t)},a.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},a.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},a.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this._strip()},a.prototype.iand=function(t){return n(0==(this.negative|t.negative)),this.iuand(t)},a.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},a.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},a.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;n<r.length;n++)this.words[n]=e.words[n]^r.words[n];if(this!==e)for(;n<e.length;n++)this.words[n]=e.words[n];return this.length=e.length,this._strip()},a.prototype.ixor=function(t){return n(0==(this.negative|t.negative)),this.iuxor(t)},a.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},a.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},a.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i<e;i++)this.words[i]=67108863&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},a.prototype.notn=function(t){return this.clone().inotn(t)},a.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<<i:this.words[r]&~(1<<i),this._strip()},a.prototype.iadd=function(t){var e,r,n;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,n=t):(r=t,n=this);for(var i=0,a=0;a<n.length;a++)e=(0|r.words[a])+(0|n.words[a])+i,this.words[a]=67108863&e,i=e>>>26;for(;0!==i&&a<r.length;a++)e=(0|r.words[a])+i,this.words[a]=67108863&e,i=e>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;a<r.length;a++)this.words[a]=r.words[a];return this},a.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},a.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var a=0,s=0;s<n.length;s++)a=(e=(0|r.words[s])-(0|n.words[s])+a)>>26,this.words[s]=67108863&e;for(;0!==a&&s<r.length;s++)a=(e=(0|r.words[s])+a)>>26,this.words[s]=67108863&e;if(0===a&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this._strip()},a.prototype.sub=function(t){return this.clone().isub(t)};var m=function(t,e,r){var n,i,a,s=t.words,o=e.words,u=r.words,l=0,c=0|s[0],f=8191&c,h=c>>>13,d=0|s[1],p=8191&d,g=d>>>13,m=0|s[2],y=8191&m,b=m>>>13,v=0|s[3],w=8191&v,A=v>>>13,P=0|s[4],k=8191&P,E=P>>>13,x=0|s[5],S=8191&x,M=x>>>13,T=0|s[6],_=8191&T,R=T>>>13,N=0|s[7],I=8191&N,O=N>>>13,C=0|s[8],j=8191&C,B=C>>>13,L=0|s[9],F=8191&L,U=L>>>13,D=0|o[0],q=8191&D,z=D>>>13,H=0|o[1],G=8191&H,K=H>>>13,V=0|o[2],J=8191&V,W=V>>>13,Q=0|o[3],Z=8191&Q,Y=Q>>>13,X=0|o[4],$=8191&X,tt=X>>>13,et=0|o[5],rt=8191&et,nt=et>>>13,it=0|o[6],at=8191&it,st=it>>>13,ot=0|o[7],ut=8191&ot,lt=ot>>>13,ct=0|o[8],ft=8191&ct,ht=ct>>>13,dt=0|o[9],pt=8191&dt,gt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(l+(n=Math.imul(f,q))|0)+((8191&(i=(i=Math.imul(f,z))+Math.imul(h,q)|0))<<13)|0;l=((a=Math.imul(h,z))+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(p,q),i=(i=Math.imul(p,z))+Math.imul(g,q)|0,a=Math.imul(g,z);var yt=(l+(n=n+Math.imul(f,G)|0)|0)+((8191&(i=(i=i+Math.imul(f,K)|0)+Math.imul(h,G)|0))<<13)|0;l=((a=a+Math.imul(h,K)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(y,q),i=(i=Math.imul(y,z))+Math.imul(b,q)|0,a=Math.imul(b,z),n=n+Math.imul(p,G)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(g,G)|0,a=a+Math.imul(g,K)|0;var bt=(l+(n=n+Math.imul(f,J)|0)|0)+((8191&(i=(i=i+Math.imul(f,W)|0)+Math.imul(h,J)|0))<<13)|0;l=((a=a+Math.imul(h,W)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(w,q),i=(i=Math.imul(w,z))+Math.imul(A,q)|0,a=Math.imul(A,z),n=n+Math.imul(y,G)|0,i=(i=i+Math.imul(y,K)|0)+Math.imul(b,G)|0,a=a+Math.imul(b,K)|0,n=n+Math.imul(p,J)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(g,J)|0,a=a+Math.imul(g,W)|0;var vt=(l+(n=n+Math.imul(f,Z)|0)|0)+((8191&(i=(i=i+Math.imul(f,Y)|0)+Math.imul(h,Z)|0))<<13)|0;l=((a=a+Math.imul(h,Y)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(k,q),i=(i=Math.imul(k,z))+Math.imul(E,q)|0,a=Math.imul(E,z),n=n+Math.imul(w,G)|0,i=(i=i+Math.imul(w,K)|0)+Math.imul(A,G)|0,a=a+Math.imul(A,K)|0,n=n+Math.imul(y,J)|0,i=(i=i+Math.imul(y,W)|0)+Math.imul(b,J)|0,a=a+Math.imul(b,W)|0,n=n+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(g,Z)|0,a=a+Math.imul(g,Y)|0;var wt=(l+(n=n+Math.imul(f,$)|0)|0)+((8191&(i=(i=i+Math.imul(f,tt)|0)+Math.imul(h,$)|0))<<13)|0;l=((a=a+Math.imul(h,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(S,q),i=(i=Math.imul(S,z))+Math.imul(M,q)|0,a=Math.imul(M,z),n=n+Math.imul(k,G)|0,i=(i=i+Math.imul(k,K)|0)+Math.imul(E,G)|0,a=a+Math.imul(E,K)|0,n=n+Math.imul(w,J)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(A,J)|0,a=a+Math.imul(A,W)|0,n=n+Math.imul(y,Z)|0,i=(i=i+Math.imul(y,Y)|0)+Math.imul(b,Z)|0,a=a+Math.imul(b,Y)|0,n=n+Math.imul(p,$)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(g,$)|0,a=a+Math.imul(g,tt)|0;var At=(l+(n=n+Math.imul(f,rt)|0)|0)+((8191&(i=(i=i+Math.imul(f,nt)|0)+Math.imul(h,rt)|0))<<13)|0;l=((a=a+Math.imul(h,nt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(_,q),i=(i=Math.imul(_,z))+Math.imul(R,q)|0,a=Math.imul(R,z),n=n+Math.imul(S,G)|0,i=(i=i+Math.imul(S,K)|0)+Math.imul(M,G)|0,a=a+Math.imul(M,K)|0,n=n+Math.imul(k,J)|0,i=(i=i+Math.imul(k,W)|0)+Math.imul(E,J)|0,a=a+Math.imul(E,W)|0,n=n+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,Y)|0)+Math.imul(A,Z)|0,a=a+Math.imul(A,Y)|0,n=n+Math.imul(y,$)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(b,$)|0,a=a+Math.imul(b,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(g,rt)|0,a=a+Math.imul(g,nt)|0;var Pt=(l+(n=n+Math.imul(f,at)|0)|0)+((8191&(i=(i=i+Math.imul(f,st)|0)+Math.imul(h,at)|0))<<13)|0;l=((a=a+Math.imul(h,st)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(I,q),i=(i=Math.imul(I,z))+Math.imul(O,q)|0,a=Math.imul(O,z),n=n+Math.imul(_,G)|0,i=(i=i+Math.imul(_,K)|0)+Math.imul(R,G)|0,a=a+Math.imul(R,K)|0,n=n+Math.imul(S,J)|0,i=(i=i+Math.imul(S,W)|0)+Math.imul(M,J)|0,a=a+Math.imul(M,W)|0,n=n+Math.imul(k,Z)|0,i=(i=i+Math.imul(k,Y)|0)+Math.imul(E,Z)|0,a=a+Math.imul(E,Y)|0,n=n+Math.imul(w,$)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(A,$)|0,a=a+Math.imul(A,tt)|0,n=n+Math.imul(y,rt)|0,i=(i=i+Math.imul(y,nt)|0)+Math.imul(b,rt)|0,a=a+Math.imul(b,nt)|0,n=n+Math.imul(p,at)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(g,at)|0,a=a+Math.imul(g,st)|0;var kt=(l+(n=n+Math.imul(f,ut)|0)|0)+((8191&(i=(i=i+Math.imul(f,lt)|0)+Math.imul(h,ut)|0))<<13)|0;l=((a=a+Math.imul(h,lt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(j,q),i=(i=Math.imul(j,z))+Math.imul(B,q)|0,a=Math.imul(B,z),n=n+Math.imul(I,G)|0,i=(i=i+Math.imul(I,K)|0)+Math.imul(O,G)|0,a=a+Math.imul(O,K)|0,n=n+Math.imul(_,J)|0,i=(i=i+Math.imul(_,W)|0)+Math.imul(R,J)|0,a=a+Math.imul(R,W)|0,n=n+Math.imul(S,Z)|0,i=(i=i+Math.imul(S,Y)|0)+Math.imul(M,Z)|0,a=a+Math.imul(M,Y)|0,n=n+Math.imul(k,$)|0,i=(i=i+Math.imul(k,tt)|0)+Math.imul(E,$)|0,a=a+Math.imul(E,tt)|0,n=n+Math.imul(w,rt)|0,i=(i=i+Math.imul(w,nt)|0)+Math.imul(A,rt)|0,a=a+Math.imul(A,nt)|0,n=n+Math.imul(y,at)|0,i=(i=i+Math.imul(y,st)|0)+Math.imul(b,at)|0,a=a+Math.imul(b,st)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,lt)|0)+Math.imul(g,ut)|0,a=a+Math.imul(g,lt)|0;var Et=(l+(n=n+Math.imul(f,ft)|0)|0)+((8191&(i=(i=i+Math.imul(f,ht)|0)+Math.imul(h,ft)|0))<<13)|0;l=((a=a+Math.imul(h,ht)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(F,q),i=(i=Math.imul(F,z))+Math.imul(U,q)|0,a=Math.imul(U,z),n=n+Math.imul(j,G)|0,i=(i=i+Math.imul(j,K)|0)+Math.imul(B,G)|0,a=a+Math.imul(B,K)|0,n=n+Math.imul(I,J)|0,i=(i=i+Math.imul(I,W)|0)+Math.imul(O,J)|0,a=a+Math.imul(O,W)|0,n=n+Math.imul(_,Z)|0,i=(i=i+Math.imul(_,Y)|0)+Math.imul(R,Z)|0,a=a+Math.imul(R,Y)|0,n=n+Math.imul(S,$)|0,i=(i=i+Math.imul(S,tt)|0)+Math.imul(M,$)|0,a=a+Math.imul(M,tt)|0,n=n+Math.imul(k,rt)|0,i=(i=i+Math.imul(k,nt)|0)+Math.imul(E,rt)|0,a=a+Math.imul(E,nt)|0,n=n+Math.imul(w,at)|0,i=(i=i+Math.imul(w,st)|0)+Math.imul(A,at)|0,a=a+Math.imul(A,st)|0,n=n+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,lt)|0)+Math.imul(b,ut)|0,a=a+Math.imul(b,lt)|0,n=n+Math.imul(p,ft)|0,i=(i=i+Math.imul(p,ht)|0)+Math.imul(g,ft)|0,a=a+Math.imul(g,ht)|0;var xt=(l+(n=n+Math.imul(f,pt)|0)|0)+((8191&(i=(i=i+Math.imul(f,gt)|0)+Math.imul(h,pt)|0))<<13)|0;l=((a=a+Math.imul(h,gt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(F,G),i=(i=Math.imul(F,K))+Math.imul(U,G)|0,a=Math.imul(U,K),n=n+Math.imul(j,J)|0,i=(i=i+Math.imul(j,W)|0)+Math.imul(B,J)|0,a=a+Math.imul(B,W)|0,n=n+Math.imul(I,Z)|0,i=(i=i+Math.imul(I,Y)|0)+Math.imul(O,Z)|0,a=a+Math.imul(O,Y)|0,n=n+Math.imul(_,$)|0,i=(i=i+Math.imul(_,tt)|0)+Math.imul(R,$)|0,a=a+Math.imul(R,tt)|0,n=n+Math.imul(S,rt)|0,i=(i=i+Math.imul(S,nt)|0)+Math.imul(M,rt)|0,a=a+Math.imul(M,nt)|0,n=n+Math.imul(k,at)|0,i=(i=i+Math.imul(k,st)|0)+Math.imul(E,at)|0,a=a+Math.imul(E,st)|0,n=n+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,lt)|0)+Math.imul(A,ut)|0,a=a+Math.imul(A,lt)|0,n=n+Math.imul(y,ft)|0,i=(i=i+Math.imul(y,ht)|0)+Math.imul(b,ft)|0,a=a+Math.imul(b,ht)|0;var St=(l+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,gt)|0)+Math.imul(g,pt)|0))<<13)|0;l=((a=a+Math.imul(g,gt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(F,J),i=(i=Math.imul(F,W))+Math.imul(U,J)|0,a=Math.imul(U,W),n=n+Math.imul(j,Z)|0,i=(i=i+Math.imul(j,Y)|0)+Math.imul(B,Z)|0,a=a+Math.imul(B,Y)|0,n=n+Math.imul(I,$)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(O,$)|0,a=a+Math.imul(O,tt)|0,n=n+Math.imul(_,rt)|0,i=(i=i+Math.imul(_,nt)|0)+Math.imul(R,rt)|0,a=a+Math.imul(R,nt)|0,n=n+Math.imul(S,at)|0,i=(i=i+Math.imul(S,st)|0)+Math.imul(M,at)|0,a=a+Math.imul(M,st)|0,n=n+Math.imul(k,ut)|0,i=(i=i+Math.imul(k,lt)|0)+Math.imul(E,ut)|0,a=a+Math.imul(E,lt)|0,n=n+Math.imul(w,ft)|0,i=(i=i+Math.imul(w,ht)|0)+Math.imul(A,ft)|0,a=a+Math.imul(A,ht)|0;var Mt=(l+(n=n+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,gt)|0)+Math.imul(b,pt)|0))<<13)|0;l=((a=a+Math.imul(b,gt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(F,Z),i=(i=Math.imul(F,Y))+Math.imul(U,Z)|0,a=Math.imul(U,Y),n=n+Math.imul(j,$)|0,i=(i=i+Math.imul(j,tt)|0)+Math.imul(B,$)|0,a=a+Math.imul(B,tt)|0,n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(O,rt)|0,a=a+Math.imul(O,nt)|0,n=n+Math.imul(_,at)|0,i=(i=i+Math.imul(_,st)|0)+Math.imul(R,at)|0,a=a+Math.imul(R,st)|0,n=n+Math.imul(S,ut)|0,i=(i=i+Math.imul(S,lt)|0)+Math.imul(M,ut)|0,a=a+Math.imul(M,lt)|0,n=n+Math.imul(k,ft)|0,i=(i=i+Math.imul(k,ht)|0)+Math.imul(E,ft)|0,a=a+Math.imul(E,ht)|0;var Tt=(l+(n=n+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,gt)|0)+Math.imul(A,pt)|0))<<13)|0;l=((a=a+Math.imul(A,gt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(F,$),i=(i=Math.imul(F,tt))+Math.imul(U,$)|0,a=Math.imul(U,tt),n=n+Math.imul(j,rt)|0,i=(i=i+Math.imul(j,nt)|0)+Math.imul(B,rt)|0,a=a+Math.imul(B,nt)|0,n=n+Math.imul(I,at)|0,i=(i=i+Math.imul(I,st)|0)+Math.imul(O,at)|0,a=a+Math.imul(O,st)|0,n=n+Math.imul(_,ut)|0,i=(i=i+Math.imul(_,lt)|0)+Math.imul(R,ut)|0,a=a+Math.imul(R,lt)|0,n=n+Math.imul(S,ft)|0,i=(i=i+Math.imul(S,ht)|0)+Math.imul(M,ft)|0,a=a+Math.imul(M,ht)|0;var _t=(l+(n=n+Math.imul(k,pt)|0)|0)+((8191&(i=(i=i+Math.imul(k,gt)|0)+Math.imul(E,pt)|0))<<13)|0;l=((a=a+Math.imul(E,gt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(F,rt),i=(i=Math.imul(F,nt))+Math.imul(U,rt)|0,a=Math.imul(U,nt),n=n+Math.imul(j,at)|0,i=(i=i+Math.imul(j,st)|0)+Math.imul(B,at)|0,a=a+Math.imul(B,st)|0,n=n+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,lt)|0)+Math.imul(O,ut)|0,a=a+Math.imul(O,lt)|0,n=n+Math.imul(_,ft)|0,i=(i=i+Math.imul(_,ht)|0)+Math.imul(R,ft)|0,a=a+Math.imul(R,ht)|0;var Rt=(l+(n=n+Math.imul(S,pt)|0)|0)+((8191&(i=(i=i+Math.imul(S,gt)|0)+Math.imul(M,pt)|0))<<13)|0;l=((a=a+Math.imul(M,gt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(F,at),i=(i=Math.imul(F,st))+Math.imul(U,at)|0,a=Math.imul(U,st),n=n+Math.imul(j,ut)|0,i=(i=i+Math.imul(j,lt)|0)+Math.imul(B,ut)|0,a=a+Math.imul(B,lt)|0,n=n+Math.imul(I,ft)|0,i=(i=i+Math.imul(I,ht)|0)+Math.imul(O,ft)|0,a=a+Math.imul(O,ht)|0;var Nt=(l+(n=n+Math.imul(_,pt)|0)|0)+((8191&(i=(i=i+Math.imul(_,gt)|0)+Math.imul(R,pt)|0))<<13)|0;l=((a=a+Math.imul(R,gt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(F,ut),i=(i=Math.imul(F,lt))+Math.imul(U,ut)|0,a=Math.imul(U,lt),n=n+Math.imul(j,ft)|0,i=(i=i+Math.imul(j,ht)|0)+Math.imul(B,ft)|0,a=a+Math.imul(B,ht)|0;var It=(l+(n=n+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,gt)|0)+Math.imul(O,pt)|0))<<13)|0;l=((a=a+Math.imul(O,gt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(F,ft),i=(i=Math.imul(F,ht))+Math.imul(U,ft)|0,a=Math.imul(U,ht);var Ot=(l+(n=n+Math.imul(j,pt)|0)|0)+((8191&(i=(i=i+Math.imul(j,gt)|0)+Math.imul(B,pt)|0))<<13)|0;l=((a=a+Math.imul(B,gt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863;var Ct=(l+(n=Math.imul(F,pt))|0)+((8191&(i=(i=Math.imul(F,gt))+Math.imul(U,pt)|0))<<13)|0;return l=((a=Math.imul(U,gt))+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,u[0]=mt,u[1]=yt,u[2]=bt,u[3]=vt,u[4]=wt,u[5]=At,u[6]=Pt,u[7]=kt,u[8]=Et,u[9]=xt,u[10]=St,u[11]=Mt,u[12]=Tt,u[13]=_t,u[14]=Rt,u[15]=Nt,u[16]=It,u[17]=Ot,u[18]=Ct,0!==l&&(u[19]=l,r.length++),r};function y(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,a=0;a<r.length-1;a++){var s=i;i=0;for(var o=67108863&n,u=Math.min(a,e.length-1),l=Math.max(0,a-t.length+1);l<=u;l++){var c=a-l,f=(0|t.words[c])*(0|e.words[l]),h=67108863&f;o=67108863&(h=h+o|0),i+=(s=(s=s+(f/67108864|0)|0)+(h>>>26)|0)>>>26,s&=67108863}r.words[a]=o,n=s,s=i}return 0!==n?r.words[a]=n:r.length--,r._strip()}function b(t,e,r){return y(t,e,r)}function v(t,e){this.x=t,this.y=e}Math.imul||(m=g),a.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?m(this,t,e):r<63?g(this,t,e):r<1024?y(this,t,e):b(this,t,e)},v.prototype.makeRBT=function(t){for(var e=new Array(t),r=a.prototype._countBits(t)-1,n=0;n<t;n++)e[n]=this.revBin(n,r,t);return e},v.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var n=0,i=0;i<e;i++)n|=(1&t)<<e-i-1,t>>=1;return n},v.prototype.permute=function(t,e,r,n,i,a){for(var s=0;s<a;s++)n[s]=e[t[s]],i[s]=r[t[s]]},v.prototype.transform=function(t,e,r,n,i,a){this.permute(a,t,e,r,n,i);for(var s=1;s<i;s<<=1)for(var o=s<<1,u=Math.cos(2*Math.PI/o),l=Math.sin(2*Math.PI/o),c=0;c<i;c+=o)for(var f=u,h=l,d=0;d<s;d++){var p=r[c+d],g=n[c+d],m=r[c+d+s],y=n[c+d+s],b=f*m-h*y;y=f*y+h*m,m=b,r[c+d]=p+m,n[c+d]=g+y,r[c+d+s]=p-m,n[c+d+s]=g-y,d!==o&&(b=u*f-l*h,h=u*h+l*f,f=b)}},v.prototype.guessLen13b=function(t,e){var r=1|Math.max(e,t),n=1&r,i=0;for(r=r/2|0;r;r>>>=1)i++;return 1<<i+1+n},v.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var n=0;n<r/2;n++){var i=t[n];t[n]=t[r-n-1],t[r-n-1]=i,i=e[n],e[n]=-e[r-n-1],e[r-n-1]=-i}},v.prototype.normalize13b=function(t,e){for(var r=0,n=0;n<e/2;n++){var i=8192*Math.round(t[2*n+1]/e)+Math.round(t[2*n]/e)+r;t[n]=67108863&i,r=i<67108864?0:i/67108864|0}return t},v.prototype.convert13b=function(t,e,r,i){for(var a=0,s=0;s<e;s++)a+=0|t[s],r[2*s]=8191&a,a>>>=13,r[2*s+1]=8191&a,a>>>=13;for(s=2*e;s<i;++s)r[s]=0;n(0===a),n(0==(-8192&a))},v.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},v.prototype.mulp=function(t,e,r){var n=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(n),a=this.stub(n),s=new Array(n),o=new Array(n),u=new Array(n),l=new Array(n),c=new Array(n),f=new Array(n),h=r.words;h.length=n,this.convert13b(t.words,t.length,s,n),this.convert13b(e.words,e.length,l,n),this.transform(s,a,o,u,n,i),this.transform(l,a,c,f,n,i);for(var d=0;d<n;d++){var p=o[d]*c[d]-u[d]*f[d];u[d]=o[d]*f[d]+u[d]*c[d],o[d]=p}return this.conjugate(o,u,n),this.transform(o,u,h,a,n,i),this.conjugate(h,a,n),this.normalize13b(h,n),r.negative=t.negative^e.negative,r.length=t.length+e.length,r._strip()},a.prototype.mul=function(t){var e=new a(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},a.prototype.mulf=function(t){var e=new a(null);return e.words=new Array(this.length+t.length),b(this,t,e)},a.prototype.imul=function(t){return this.clone().mulTo(t,this)},a.prototype.imuln=function(t){var e=t<0;e&&(t=-t),n("number"==typeof t),n(t<67108864);for(var r=0,i=0;i<this.length;i++){var a=(0|this.words[i])*t,s=(67108863&a)+(67108863&r);r>>=26,r+=a/67108864|0,r+=s>>>26,this.words[i]=67108863&s}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():this},a.prototype.muln=function(t){return this.clone().imuln(t)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var n=r/26|0,i=r%26;e[r]=t.words[n]>>>i&1}return e}(t);if(0===e.length)return new a(1);for(var r=this,n=0;n<e.length&&0===e[n];n++,r=r.sqr());if(++n<e.length)for(var i=r.sqr();n<e.length;n++,i=i.sqr())0!==e[n]&&(r=r.mul(i));return r},a.prototype.iushln=function(t){n("number"==typeof t&&t>=0);var e,r=t%26,i=(t-r)/26,a=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e<this.length;e++){var o=this.words[e]&a,u=(0|this.words[e])-o<<r;this.words[e]=u|s,s=o>>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this._strip()},a.prototype.ishln=function(t){return n(0===this.negative),this.iushln(t)},a.prototype.iushrn=function(t,e,r){var i;n("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var a=t%26,s=Math.min((t-a)/26,this.length),o=67108863^67108863>>>a<<a,u=r;if(i-=s,i=Math.max(0,i),u){for(var l=0;l<s;l++)u.words[l]=this.words[l];u.length=s}if(0===s);else if(this.length>s)for(this.length-=s,l=0;l<this.length;l++)this.words[l]=this.words[l+s];else this.words[0]=0,this.length=1;var c=0;for(l=this.length-1;l>=0&&(0!==c||l>=i);l--){var f=0|this.words[l];this.words[l]=c<<26-a|f>>>a,c=f&o}return u&&0!==c&&(u.words[u.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},a.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},a.prototype.shln=function(t){return this.clone().ishln(t)},a.prototype.ushln=function(t){return this.clone().iushln(t)},a.prototype.shrn=function(t){return this.clone().ishrn(t)},a.prototype.ushrn=function(t){return this.clone().iushrn(t)},a.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<<e;return!(this.length<=r||!(this.words[r]&i))},a.prototype.imaskn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<<e;this.words[this.length-1]&=i}return this._strip()},a.prototype.maskn=function(t){return this.clone().imaskn(t)},a.prototype.iaddn=function(t){return n("number"==typeof t),n(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<=t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},a.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},a.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this._strip()},a.prototype.addn=function(t){return this.clone().iaddn(t)},a.prototype.subn=function(t){return this.clone().isubn(t)},a.prototype.iabs=function(){return this.negative=0,this},a.prototype.abs=function(){return this.clone().iabs()},a.prototype._ishlnsubmul=function(t,e,r){var i,a,s=t.length+r;this._expand(s);var o=0;for(i=0;i<t.length;i++){a=(0|this.words[i+r])+o;var u=(0|t.words[i])*e;o=((a-=67108863&u)>>26)-(u/67108864|0),this.words[i+r]=67108863&a}for(;i<this.length-r;i++)o=(a=(0|this.words[i+r])+o)>>26,this.words[i+r]=67108863&a;if(0===o)return this._strip();for(n(-1===o),o=0,i=0;i<this.length;i++)o=(a=-(0|this.words[i])+o)>>26,this.words[i]=67108863&a;return this.negative=1,this._strip()},a.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,s=0|i.words[i.length-1];0!=(r=26-this._countBits(s))&&(i=i.ushln(r),n.iushln(r),s=0|i.words[i.length-1]);var o,u=n.length-i.length;if("mod"!==e){(o=new a(null)).length=u+1,o.words=new Array(o.length);for(var l=0;l<o.length;l++)o.words[l]=0}var c=n.clone()._ishlnsubmul(i,1,u);0===c.negative&&(n=c,o&&(o.words[u]=1));for(var f=u-1;f>=0;f--){var h=67108864*(0|n.words[i.length+f])+(0|n.words[i.length+f-1]);for(h=Math.min(h/s|0,67108863),n._ishlnsubmul(i,h,f);0!==n.negative;)h--,n.negative=0,n._ishlnsubmul(i,1,f),n.isZero()||(n.negative^=1);o&&(o.words[f]=h)}return o&&o._strip(),n._strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:o||null,mod:n}},a.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new a(0),mod:new a(0)}:0!==this.negative&&0===t.negative?(o=this.neg().divmod(t,e),"mod"!==e&&(i=o.div.neg()),"div"!==e&&(s=o.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(o=this.divmod(t.neg(),e),"mod"!==e&&(i=o.div.neg()),{div:i,mod:o.mod}):0!=(this.negative&t.negative)?(o=this.neg().divmod(t.neg(),e),"div"!==e&&(s=o.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:o.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new a(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new a(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new a(this.modrn(t.words[0]))}:this._wordDiv(t,e);var i,s,o},a.prototype.div=function(t){return this.divmod(t,"div",!1).div},a.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},a.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},a.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),a=r.cmp(n);return a<0||1===i&&0===a?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},a.prototype.modrn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=(1<<26)%t,i=0,a=this.length-1;a>=0;a--)i=(r*i+(0|this.words[a]))%t;return e?-i:i},a.prototype.modn=function(t){return this.modrn(t)},a.prototype.idivn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var a=(0|this.words[i])+67108864*r;this.words[i]=a/t|0,r=a%t}return this._strip(),e?this.ineg():this},a.prototype.divn=function(t){return this.clone().idivn(t)},a.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new a(1),s=new a(0),o=new a(0),u=new a(1),l=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++l;for(var c=r.clone(),f=e.clone();!e.isZero();){for(var h=0,d=1;0==(e.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(e.iushrn(h);h-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(c),s.isub(f)),i.iushrn(1),s.iushrn(1);for(var p=0,g=1;0==(r.words[0]&g)&&p<26;++p,g<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(o.isOdd()||u.isOdd())&&(o.iadd(c),u.isub(f)),o.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(o),s.isub(u)):(r.isub(e),o.isub(i),u.isub(s))}return{a:o,b:u,gcd:r.iushln(l)}},a.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,s=new a(1),o=new a(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var l=0,c=1;0==(e.words[0]&c)&&l<26;++l,c<<=1);if(l>0)for(e.iushrn(l);l-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var f=0,h=1;0==(r.words[0]&h)&&f<26;++f,h<<=1);if(f>0)for(r.iushrn(f);f-- >0;)o.isOdd()&&o.iadd(u),o.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(o)):(r.isub(e),o.isub(s))}return(i=0===e.cmpn(1)?s:o).cmpn(0)<0&&i.iadd(t),i},a.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var a=e;e=r,r=a}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},a.prototype.invm=function(t){return this.egcd(t).a.umod(t)},a.prototype.isEven=function(){return 0==(1&this.words[0])},a.prototype.isOdd=function(){return 1==(1&this.words[0])},a.prototype.andln=function(t){return this.words[0]&t},a.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<<e;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var a=i,s=r;0!==a&&s<this.length;s++){var o=0|this.words[s];a=(o+=a)>>>26,o&=67108863,this.words[s]=o}return 0!==a&&(this.words[s]=a,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},a.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:i<t?-1:1}return 0!==this.negative?0|-e:e},a.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},a.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){n<i?e=-1:n>i&&(e=1);break}}return e},a.prototype.gtn=function(t){return 1===this.cmpn(t)},a.prototype.gt=function(t){return 1===this.cmp(t)},a.prototype.gten=function(t){return this.cmpn(t)>=0},a.prototype.gte=function(t){return this.cmp(t)>=0},a.prototype.ltn=function(t){return-1===this.cmpn(t)},a.prototype.lt=function(t){return-1===this.cmp(t)},a.prototype.lten=function(t){return this.cmpn(t)<=0},a.prototype.lte=function(t){return this.cmp(t)<=0},a.prototype.eqn=function(t){return 0===this.cmpn(t)},a.prototype.eq=function(t){return 0===this.cmp(t)},a.red=function(t){return new S(t)},a.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},a.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(t){return this.red=t,this},a.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},a.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},a.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},a.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},a.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},a.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},a.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},a.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},a.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var w={k256:null,p224:null,p192:null,p25519:null};function A(t,e){this.name=t,this.p=new a(e,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function P(){A.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function k(){A.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function E(){A.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function x(){A.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(t){if("string"==typeof t){var e=a._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function M(t){S.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new a(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)}A.prototype._tmp=function(){var t=new a(null);return t.words=new Array(Math.ceil(this.n/13)),t},A.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},A.prototype.split=function(t,e){t.iushrn(this.n,0,e)},A.prototype.imulK=function(t){return t.imul(this.k)},i(P,A),P.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i<n;i++)e.words[i]=t.words[i];if(e.length=n,t.length<=9)return t.words[0]=0,void(t.length=1);var a=t.words[9];for(e.words[e.length++]=a&r,i=10;i<t.length;i++){var s=0|t.words[i];t.words[i-10]=(s&r)<<4|a>>>22,a=s}a>>>=22,t.words[i-10]=a,0===a&&t.length>10?t.length-=10:t.length-=9},P.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var n=0|t.words[r];e+=977*n,t.words[r]=67108863&e,e=64*n+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(k,A),i(E,A),i(x,A),x.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var n=19*(0|t.words[r])+e,i=67108863&n;n>>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},a._prime=function(t){if(w[t])return w[t];var e;if("k256"===t)e=new P;else if("p224"===t)e=new k;else if("p192"===t)e=new E;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new x}return w[t]=e,e},S.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},S.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},S.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(c(t,t.umod(this.m)._forceRed(this)),t)},S.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},S.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},S.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},S.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},S.prototype.isqr=function(t){return this.imul(t,t.clone())},S.prototype.sqr=function(t){return this.mul(t,t)},S.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new a(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var o=new a(1).toRed(this),u=o.redNeg(),l=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new a(2*c*c).toRed(this);0!==this.pow(c,l).cmp(u);)c.redIAdd(u);for(var f=this.pow(c,i),h=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=s;0!==d.cmp(o);){for(var g=d,m=0;0!==g.cmp(o);m++)g=g.redSqr();n(m<p);var y=this.pow(f,new a(1).iushln(p-m-1));h=h.redMul(y),f=y.redSqr(),d=d.redMul(f),p=m}return h},S.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},S.prototype.pow=function(t,e){if(e.isZero())return new a(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new a(1).toRed(this),r[1]=t;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],t);var i=r[0],s=0,o=0,u=e.bitLength()%26;for(0===u&&(u=26),n=e.length-1;n>=0;n--){for(var l=e.words[n],c=u-1;c>=0;c--){var f=l>>c&1;i!==r[0]&&(i=this.sqr(i)),0!==f||0!==s?(s<<=1,s|=f,(4==++o||0===n&&0===c)&&(i=this.mul(i,r[s]),o=0,s=0)):o=0}u=26}return i},S.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},S.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},a.mont=function(t){return new M(t)},i(M,S),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new a(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},9931:(t,e,r)=>{var n;function i(t){this.rand=t}if(t.exports=function(t){return n||(n=new i(null)),n.generate(t)},t.exports.Rand=i,i.prototype.generate=function(t){return this._rand(t)},i.prototype._rand=function(t){if(this.rand.getBytes)return this.rand.getBytes(t);for(var e=new Uint8Array(t),r=0;r<e.length;r++)e[r]=this.rand.getByte();return e},"object"==typeof self)self.crypto&&self.crypto.getRandomValues?i.prototype._rand=function(t){var e=new Uint8Array(t);return self.crypto.getRandomValues(e),e}:self.msCrypto&&self.msCrypto.getRandomValues?i.prototype._rand=function(t){var e=new Uint8Array(t);return self.msCrypto.getRandomValues(e),e}:"object"==typeof window&&(i.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var a=r(9214);if("function"!=typeof a.randomBytes)throw new Error("Not supported");i.prototype._rand=function(t){return a.randomBytes(t)}}catch(t){}},8767:t=>{function e(t){if(t)return function(t){for(var r in e.prototype)t[r]=e.prototype[r];return t}(t)}t.exports=e,e.prototype.on=e.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},e.prototype.once=function(t,e){function r(){this.off(t,r),e.apply(this,arguments)}return r.fn=e,this.on(t,r),this},e.prototype.off=e.prototype.removeListener=e.prototype.removeAllListeners=e.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r,n=this._callbacks["$"+t];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var i=0;i<n.length;i++)if((r=n[i])===e||r.fn===e){n.splice(i,1);break}return 0===n.length&&delete this._callbacks["$"+t],this},e.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),r=this._callbacks["$"+t],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(r){n=0;for(var i=(r=r.slice(0)).length;n<i;++n)r[n].apply(this,e)}return this},e.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},e.prototype.hasListeners=function(t){return!!this.listeners(t).length}},6266:(t,e,r)=>{"use strict";var n=e;n.version=r(8597).i8,n.utils=r(953),n.rand=r(9931),n.curve=r(8254),n.curves=r(5427),n.ec=r(7954),n.eddsa=r(5980)},4918:(t,e,r)=>{"use strict";var n=r(3785),i=r(953),a=i.getNAF,s=i.getJSF,o=i.assert;function u(t,e){this.type=t,this.p=new n(e.p,16),this.red=e.prime?n.red(e.prime):n.mont(this.p),this.zero=new n(0).toRed(this.red),this.one=new n(1).toRed(this.red),this.two=new n(2).toRed(this.red),this.n=e.n&&new n(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function l(t,e){this.curve=t,this.type=e,this.precomputed=null}t.exports=u,u.prototype.point=function(){throw new Error("Not implemented")},u.prototype.validate=function(){throw new Error("Not implemented")},u.prototype._fixedNafMul=function(t,e){o(t.precomputed);var r=t._getDoubles(),n=a(e,1,this._bitLength),i=(1<<r.step+1)-(r.step%2==0?2:1);i/=3;var s,u,l=[];for(s=0;s<n.length;s+=r.step){u=0;for(var c=s+r.step-1;c>=s;c--)u=(u<<1)+n[c];l.push(u)}for(var f=this.jpoint(null,null,null),h=this.jpoint(null,null,null),d=i;d>0;d--){for(s=0;s<l.length;s++)(u=l[s])===d?h=h.mixedAdd(r.points[s]):u===-d&&(h=h.mixedAdd(r.points[s].neg()));f=f.add(h)}return f.toP()},u.prototype._wnafMul=function(t,e){var r=4,n=t._getNAFPoints(r);r=n.wnd;for(var i=n.points,s=a(e,r,this._bitLength),u=this.jpoint(null,null,null),l=s.length-1;l>=0;l--){for(var c=0;l>=0&&0===s[l];l--)c++;if(l>=0&&c++,u=u.dblp(c),l<0)break;var f=s[l];o(0!==f),u="affine"===t.type?f>0?u.mixedAdd(i[f-1>>1]):u.mixedAdd(i[-f-1>>1].neg()):f>0?u.add(i[f-1>>1]):u.add(i[-f-1>>1].neg())}return"affine"===t.type?u.toP():u},u.prototype._wnafMulAdd=function(t,e,r,n,i){var o,u,l,c=this._wnafT1,f=this._wnafT2,h=this._wnafT3,d=0;for(o=0;o<n;o++){var p=(l=e[o])._getNAFPoints(t);c[o]=p.wnd,f[o]=p.points}for(o=n-1;o>=1;o-=2){var g=o-1,m=o;if(1===c[g]&&1===c[m]){var y=[e[g],null,null,e[m]];0===e[g].y.cmp(e[m].y)?(y[1]=e[g].add(e[m]),y[2]=e[g].toJ().mixedAdd(e[m].neg())):0===e[g].y.cmp(e[m].y.redNeg())?(y[1]=e[g].toJ().mixedAdd(e[m]),y[2]=e[g].add(e[m].neg())):(y[1]=e[g].toJ().mixedAdd(e[m]),y[2]=e[g].toJ().mixedAdd(e[m].neg()));var b=[-3,-1,-5,-7,0,7,5,1,3],v=s(r[g],r[m]);for(d=Math.max(v[0].length,d),h[g]=new Array(d),h[m]=new Array(d),u=0;u<d;u++){var w=0|v[0][u],A=0|v[1][u];h[g][u]=b[3*(w+1)+(A+1)],h[m][u]=0,f[g]=y}}else h[g]=a(r[g],c[g],this._bitLength),h[m]=a(r[m],c[m],this._bitLength),d=Math.max(h[g].length,d),d=Math.max(h[m].length,d)}var P=this.jpoint(null,null,null),k=this._wnafT4;for(o=d;o>=0;o--){for(var E=0;o>=0;){var x=!0;for(u=0;u<n;u++)k[u]=0|h[u][o],0!==k[u]&&(x=!1);if(!x)break;E++,o--}if(o>=0&&E++,P=P.dblp(E),o<0)break;for(u=0;u<n;u++){var S=k[u];0!==S&&(S>0?l=f[u][S-1>>1]:S<0&&(l=f[u][-S-1>>1].neg()),P="affine"===l.type?P.mixedAdd(l):P.add(l))}}for(o=0;o<n;o++)f[o]=null;return i?P:P.toP()},u.BasePoint=l,l.prototype.eq=function(){throw new Error("Not implemented")},l.prototype.validate=function(){return this.curve.validate(this)},u.prototype.decodePoint=function(t,e){t=i.toArray(t,e);var r=this.p.byteLength();if((4===t[0]||6===t[0]||7===t[0])&&t.length-1==2*r)return 6===t[0]?o(t[t.length-1]%2==0):7===t[0]&&o(t[t.length-1]%2==1),this.point(t.slice(1,1+r),t.slice(1+r,1+2*r));if((2===t[0]||3===t[0])&&t.length-1===r)return this.pointFromX(t.slice(1,1+r),3===t[0]);throw new Error("Unknown point format")},l