@dodoex/wallet-web3 0.0.29-2 → 0.0.29-4
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/__node-resolve_empty-9c0fe235.js +1 -0
- package/dist/__tslib-8d197f50.js +1 -0
- package/dist/_commonjs-dynamic-modules-7cfc9805.js +1 -0
- package/dist/{blocto-e0c3fba1.js → blocto-6a8a2342.js} +1 -1
- package/dist/bn-b39718d7.js +1 -0
- package/dist/{browser-ponyfill-44c16c11.js → browser-ponyfill-7992d3d0.js} +1 -1
- package/dist/cjs/{__node-resolve_empty-99e1fe6a.cjs → __node-resolve_empty-71310b0b.cjs} +1 -1
- package/dist/cjs/__tslib-e8ae5da7.cjs +1 -0
- package/dist/cjs/_commonjs-dynamic-modules-f09a98c7.cjs +1 -0
- package/dist/cjs/{blocto-6db880e3.cjs → blocto-06fd57f6.cjs} +1 -1
- package/dist/cjs/bn-9dd9a29f.cjs +1 -0
- package/dist/cjs/{browser-ponyfill-0c3c6a1d.cjs → browser-ponyfill-71e323cb.cjs} +1 -1
- package/dist/cjs/{ethers-553c2892.cjs → ethers-bab3724b.cjs} +1 -1
- package/dist/cjs/{id-07decbd4.cjs → id-d7130594.cjs} +1 -1
- package/dist/cjs/{index-66395df0.cjs → index-0d0e0a26.cjs} +1 -1
- package/dist/cjs/index-269c7834.cjs +1 -0
- package/dist/cjs/{index-136ec288.cjs → index-270bac6a.cjs} +1 -1
- package/dist/cjs/{index-19d69924.cjs → index-2e2cf060.cjs} +1 -1
- package/dist/cjs/index-5077c64e.cjs +15 -0
- package/dist/cjs/{index-2ef621f6.cjs → index-5f82d59c.cjs} +1 -1
- package/dist/cjs/index-6286567d.cjs +66 -0
- package/dist/cjs/{index-edc6cd1d.cjs → index-6867dc10.cjs} +1 -1
- package/dist/cjs/{index-4b3d4170.cjs → index-79a671ea.cjs} +1 -1
- package/dist/cjs/{index-373a72d9.cjs → index-8e09ff75.cjs} +1 -1
- package/dist/cjs/{index-b8a341ce.cjs → index-e3acb1db.cjs} +1 -1
- package/dist/cjs/index-e51dad87.cjs +1 -0
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.es-f9ac36f5.cjs +9 -0
- package/dist/cjs/{interface-a76cb731.cjs → interface-c44121d8.cjs} +1 -1
- package/dist/cjs/{portis-59e137a1.cjs → portis-84ad4e3c.cjs} +1 -1
- package/dist/cjs/{provider-b0f94199.cjs → provider-69ecf3d5.cjs} +1 -1
- package/dist/cjs/rainbow-4e6702b8.cjs +1 -0
- package/dist/cjs/{typed-data-bfb59085.cjs → typed-data-8c267c11.cjs} +1 -1
- package/dist/cjs/uAuth-6885948a.cjs +1 -0
- package/dist/cjs/walletConnect-d4959518.cjs +1 -0
- package/dist/cjs/walletLink-c6edc88a.cjs +1 -0
- package/dist/{ethers-60251e65.js → ethers-8181a73b.js} +1 -1
- package/dist/{id-0598d431.js → id-6d8573d3.js} +1 -1
- package/dist/{index-1ae3396a.js → index-15483c83.js} +1 -1
- package/dist/{index-b16ae8fe.js → index-472a33f8.js} +1 -1
- package/dist/index-6168470a.js +15 -0
- package/dist/{index-e8318bc1.js → index-6c5eabc0.js} +1 -1
- package/dist/index-71e104e3.js +1 -0
- package/dist/{index-33fbffcd.js → index-9a2fe895.js} +2 -2
- package/dist/{index-2ee17786.js → index-9c184c63.js} +1 -1
- package/dist/{index-900fd90f.js → index-a799f96f.js} +1 -1
- package/dist/index-aa70a2b2.js +66 -0
- package/dist/index-caf37db5.js +1 -0
- package/dist/{index-d7e1a9f2.js → index-d1677b7f.js} +1 -1
- package/dist/{index-585b9501.js → index-f80f2892.js} +1 -1
- package/dist/index.es-2660d81c.js +9 -0
- package/dist/index.js +1 -1
- package/dist/{interface-7179eae0.js → interface-04b0d44b.js} +1 -1
- package/dist/{portis-c06b505a.js → portis-be0e0b07.js} +1 -1
- package/dist/{provider-851ce70a.js → provider-bafb9c6b.js} +1 -1
- package/dist/rainbow-7b3f336e.js +1 -0
- package/dist/{typed-data-949a2805.js → typed-data-e96f6ed3.js} +1 -1
- package/dist/uAuth-01120919.js +1 -0
- package/dist/walletConnect-b5c5df2e.js +1 -0
- package/dist/walletLink-59d4a764.js +1 -0
- package/package.json +2 -3
- package/dist/__node-resolve_empty-d33b2526.js +0 -1
- package/dist/bn-67d99a17.js +0 -1
- package/dist/cjs/bn-9be07c83.cjs +0 -1
- package/dist/cjs/index-e178b1f3.cjs +0 -15
- package/dist/cjs/index-ec81b44d.cjs +0 -1
- package/dist/cjs/rainbow-9872e246.cjs +0 -1
- package/dist/cjs/uAuth-cf05b8e2.cjs +0 -1
- package/dist/cjs/walletConnect-530e02c9.cjs +0 -1
- package/dist/cjs/walletLink-b1c6c8dc.cjs +0 -1
- package/dist/index-bc6b4ac4.js +0 -15
- package/dist/index-deecbaf1.js +0 -1
- package/dist/rainbow-bebe571d.js +0 -1
- package/dist/uAuth-33b72e8b.js +0 -1
- package/dist/walletConnect-3e4e5cc0.js +0 -1
- package/dist/walletLink-7baca3ea.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("./index-
|
|
1
|
+
"use strict";var e=require("./index-270bac6a.cjs"),r=Object.freeze({__proto__:null,default:{}}),t=e.getAugmentedNamespace(r);exports.nodeCrypto=r,exports.require$$0=t;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var e=require("./index-270bac6a.cjs"),r=e.getAugmentedNamespace(e._tslib);exports.require$$0=r;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";exports.commonjsRequire=function(r){throw new Error('Could not dynamically require "'+r+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var t=require("./index-
|
|
1
|
+
"use strict";var t=require("./index-270bac6a.cjs"),e=require("buffer"),r=require("./__node-resolve_empty-71310b0b.cjs"),n=require("./index-cf3bf3b5.cjs");function i(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}require("@ethersproject/providers"),require("zustand"),require("events"),require("@ethersproject/address"),require("@ethersproject/constants"),require("@ethersproject/contracts"),require("@ethersproject/properties"),require("@ethersproject/transactions"),require("@ethersproject/bytes");var o=i(e),s={exports:{}};function a(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function u(t,...e){if(!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(e.length>0&&!e.includes(t.length))throw new TypeError(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}const c={number:a,bool:function(t){if("boolean"!=typeof t)throw new Error(`Expected boolean, not ${t}`)},bytes:u,hash:function(t){if("function"!=typeof t||"function"!=typeof t.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");a(t.outputLen),a(t.blockLen)},exists:function(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")},output:function(t,e){u(t);const r=e.outputLen;if(t.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}},h=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),l=(t,e)=>t<<32-e|t>>>e;
|
|
2
2
|
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */if(!(68===new Uint8Array(new Uint32Array([287454020]).buffer)[0]))throw new Error("Non little-endian hardware is not supported");function d(t){if("string"==typeof t&&(t=function(t){if("string"!=typeof t)throw new TypeError("utf8ToBytes expected string, got "+typeof t);return(new TextEncoder).encode(t)}(t)),!(t instanceof Uint8Array))throw new TypeError(`Expected input type is Uint8Array (got ${typeof t})`);return t}Array.from({length:256},((t,e)=>e.toString(16).padStart(2,"0")));class f{clone(){return this._cloneInto()}}function p(t){const e=e=>t().update(d(e)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}class m extends f{constructor(t,e,r,n){super(),this.blockLen=t,this.outputLen=e,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=h(this.buffer)}update(t){c.exists(this);const{view:e,buffer:r,blockLen:n}=this,i=(t=d(t)).length;for(let o=0;o<i;){const s=Math.min(n-this.pos,i-o);if(s!==n)r.set(t.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===n&&(this.process(e,0),this.pos=0);else{const e=h(t);for(;n<=i-o;o+=n)this.process(e,o)}}return this.length+=t.length,this.roundClean(),this}digestInto(t){c.exists(this),c.output(t,this),this.finished=!0;const{buffer:e,view:r,blockLen:n,isLE:i}=this;let{pos:o}=this;e[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>n-o&&(this.process(r,0),o=0);for(let t=o;t<n;t++)e[t]=0;!function(t,e,r,n){if("function"==typeof t.setBigUint64)return t.setBigUint64(e,r,n);const i=BigInt(32),o=BigInt(4294967295),s=Number(r>>i&o),a=Number(r&o),u=n?4:0,c=n?0:4;t.setUint32(e+u,s,n),t.setUint32(e+c,a,n)}(r,n-8,BigInt(8*this.length),i),this.process(r,0);const s=h(t),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=a/4,l=this.get();if(u>l.length)throw new Error("_sha2: outputLen bigger than state");for(let t=0;t<u;t++)s.setUint32(4*t,l[t],i)}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const r=t.slice(0,e);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:e,buffer:r,length:n,finished:i,destroyed:o,pos:s}=this;return t.length=n,t.pos=s,t.finished=i,t.destroyed=o,n%e&&t.buffer.set(r),t}}const g=BigInt(2**32-1),y=BigInt(32);function w(t,e=!1){return e?{h:Number(t&g),l:Number(t>>y&g)}:{h:0|Number(t>>y&g),l:0|Number(t&g)}}const b={fromBig:w,split:function(t,e=!1){let r=new Uint32Array(t.length),n=new Uint32Array(t.length);for(let i=0;i<t.length;i++){const{h:o,l:s}=w(t[i],e);[r[i],n[i]]=[o,s]}return[r,n]},toBig:(t,e)=>BigInt(t>>>0)<<y|BigInt(e>>>0),shrSH:(t,e,r)=>t>>>r,shrSL:(t,e,r)=>t<<32-r|e>>>r,rotrSH:(t,e,r)=>t>>>r|e<<32-r,rotrSL:(t,e,r)=>t<<32-r|e>>>r,rotrBH:(t,e,r)=>t<<64-r|e>>>r-32,rotrBL:(t,e,r)=>t>>>r-32|e<<64-r,rotr32H:(t,e)=>e,rotr32L:(t,e)=>t,rotlSH:(t,e,r)=>t<<r|e>>>32-r,rotlSL:(t,e,r)=>e<<r|t>>>32-r,rotlBH:(t,e,r)=>e<<r-32|t>>>64-r,rotlBL:(t,e,r)=>t<<r-32|e>>>64-r,add:function(t,e,r,n){const i=(e>>>0)+(n>>>0);return{h:t+r+(i/2**32|0)|0,l:0|i}},add3L:(t,e,r)=>(t>>>0)+(e>>>0)+(r>>>0),add3H:(t,e,r,n)=>e+r+n+(t/2**32|0)|0,add4L:(t,e,r,n)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0),add4H:(t,e,r,n,i)=>e+r+n+i+(t/2**32|0)|0,add5H:(t,e,r,n,i,o)=>e+r+n+i+o+(t/2**32|0)|0,add5L:(t,e,r,n,i)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0)+(i>>>0)},[v,k]=b.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map((t=>BigInt(t)))),S=new Uint32Array(80),_=new Uint32Array(80);class A extends m{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:t,Al:e,Bh:r,Bl:n,Ch:i,Cl:o,Dh:s,Dl:a,Eh:u,El:c,Fh:h,Fl:l,Gh:d,Gl:f,Hh:p,Hl:m}=this;return[t,e,r,n,i,o,s,a,u,c,h,l,d,f,p,m]}set(t,e,r,n,i,o,s,a,u,c,h,l,d,f,p,m){this.Ah=0|t,this.Al=0|e,this.Bh=0|r,this.Bl=0|n,this.Ch=0|i,this.Cl=0|o,this.Dh=0|s,this.Dl=0|a,this.Eh=0|u,this.El=0|c,this.Fh=0|h,this.Fl=0|l,this.Gh=0|d,this.Gl=0|f,this.Hh=0|p,this.Hl=0|m}process(t,e){for(let r=0;r<16;r++,e+=4)S[r]=t.getUint32(e),_[r]=t.getUint32(e+=4);for(let t=16;t<80;t++){const e=0|S[t-15],r=0|_[t-15],n=b.rotrSH(e,r,1)^b.rotrSH(e,r,8)^b.shrSH(e,r,7),i=b.rotrSL(e,r,1)^b.rotrSL(e,r,8)^b.shrSL(e,r,7),o=0|S[t-2],s=0|_[t-2],a=b.rotrSH(o,s,19)^b.rotrBH(o,s,61)^b.shrSH(o,s,6),u=b.rotrSL(o,s,19)^b.rotrBL(o,s,61)^b.shrSL(o,s,6),c=b.add4L(i,u,_[t-7],_[t-16]),h=b.add4H(c,n,a,S[t-7],S[t-16]);S[t]=0|h,_[t]=0|c}let{Ah:r,Al:n,Bh:i,Bl:o,Ch:s,Cl:a,Dh:u,Dl:c,Eh:h,El:l,Fh:d,Fl:f,Gh:p,Gl:m,Hh:g,Hl:y}=this;for(let t=0;t<80;t++){const e=b.rotrSH(h,l,14)^b.rotrSH(h,l,18)^b.rotrBH(h,l,41),w=b.rotrSL(h,l,14)^b.rotrSL(h,l,18)^b.rotrBL(h,l,41),A=h&d^~h&p,M=l&f^~l&m,I=b.add5L(y,w,M,k[t],_[t]),E=b.add5H(I,g,e,A,v[t],S[t]),x=0|I,B=b.rotrSH(r,n,28)^b.rotrBH(r,n,34)^b.rotrBH(r,n,39),P=b.rotrSL(r,n,28)^b.rotrBL(r,n,34)^b.rotrBL(r,n,39),R=r&i^r&s^i&s,T=n&o^n&a^o&a;g=0|p,y=0|m,p=0|d,m=0|f,d=0|h,f=0|l,({h:h,l:l}=b.add(0|u,0|c,0|E,0|x)),u=0|s,c=0|a,s=0|i,a=0|o,i=0|r,o=0|n;const L=b.add3L(x,P,T);r=b.add3H(L,E,B,R),n=0|L}({h:r,l:n}=b.add(0|this.Ah,0|this.Al,0|r,0|n)),({h:i,l:o}=b.add(0|this.Bh,0|this.Bl,0|i,0|o)),({h:s,l:a}=b.add(0|this.Ch,0|this.Cl,0|s,0|a)),({h:u,l:c}=b.add(0|this.Dh,0|this.Dl,0|u,0|c)),({h:h,l:l}=b.add(0|this.Eh,0|this.El,0|h,0|l)),({h:d,l:f}=b.add(0|this.Fh,0|this.Fl,0|d,0|f)),({h:p,l:m}=b.add(0|this.Gh,0|this.Gl,0|p,0|m)),({h:g,l:y}=b.add(0|this.Hh,0|this.Hl,0|g,0|y)),this.set(r,n,i,o,s,a,u,c,h,l,d,f,p,m,g,y)}roundClean(){S.fill(0),_.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}class M extends A{constructor(){super(),this.Ah=-1942145080,this.Al=424955298,this.Bh=1944164710,this.Bl=-1982016298,this.Ch=502970286,this.Cl=855612546,this.Dh=1738396948,this.Dl=1479516111,this.Eh=258812777,this.El=2077511080,this.Fh=2011393907,this.Fl=79989058,this.Gh=1067287976,this.Gl=1780299464,this.Hh=286451373,this.Hl=-1848208735,this.outputLen=28}}class I extends A{constructor(){super(),this.Ah=573645204,this.Al=-64227540,this.Bh=-1621794909,this.Bl=-934517566,this.Ch=596883563,this.Cl=1867755857,this.Dh=-1774684391,this.Dl=1497426621,this.Eh=-1775747358,this.El=-1467023389,this.Fh=-1101128155,this.Fl=1401305490,this.Gh=721525244,this.Gl=746961066,this.Hh=246885852,this.Hl=-2117784414,this.outputLen=32}}class E extends A{constructor(){super(),this.Ah=-876896931,this.Al=-1056596264,this.Bh=1654270250,this.Bl=914150663,this.Ch=-1856437926,this.Cl=812702999,this.Dh=355462360,this.Dl=-150054599,this.Eh=1731405415,this.El=-4191439,this.Fh=-1900787065,this.Fl=1750603025,this.Gh=-619958771,this.Gl=1694076839,this.Hh=1203062813,this.Hl=-1090891868,this.outputLen=48}}const x=p((()=>new A));p((()=>new M)),p((()=>new I)),p((()=>new E));
|
|
3
3
|
/*! noble-ed25519 - MIT License (c) 2019 Paul Miller (paulmillr.com) */
|
|
4
4
|
const B=BigInt(0),P=BigInt(1),R=BigInt(2),T=BigInt(8),L=BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),O=Object.freeze({a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),P:BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),l:L,n:L,h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960")}),C=BigInt("0x10000000000000000000000000000000000000000000000000000000000000000"),U=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");BigInt("6853475219497561581579357271197624642482790079785650197046958215289687604742");const N=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),z=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),K=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),W=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952");class q{constructor(t,e,r,n){this.x=t,this.y=e,this.z=r,this.t=n}static fromAffine(t){if(!(t instanceof G))throw new TypeError("ExtendedPoint#fromAffine: expected Point");return t.equals(G.ZERO)?q.ZERO:new q(t.x,t.y,P,st(t.x*t.y))}static toAffineBatch(t){const e=function(t,e=O.P){const r=new Array(t.length),n=t.reduce(((t,n,i)=>n===B?t:(r[i]=t,st(t*n,e))),P),i=at(n,e);return t.reduceRight(((t,n,i)=>n===B?t:(r[i]=st(t*r[i],e),st(t*n,e))),i),r}(t.map((t=>t.z)));return t.map(((t,r)=>t.toAffine(e[r])))}static normalizeZ(t){return this.toAffineBatch(t).map(this.fromAffine)}equals(t){j(t);const{x:e,y:r,z:n}=this,{x:i,y:o,z:s}=t,a=st(e*s),u=st(i*n),c=st(r*s),h=st(o*n);return a===u&&c===h}negate(){return new q(st(-this.x),this.y,this.z,st(-this.t))}double(){const{x:t,y:e,z:r}=this,{a:n}=O,i=st(t*t),o=st(e*e),s=st(R*st(r*r)),a=st(n*i),u=t+e,c=st(st(u*u)-i-o),h=a+o,l=h-s,d=a-o,f=st(c*l),p=st(h*d),m=st(c*d),g=st(l*h);return new q(f,p,g,m)}add(t){j(t);const{x:e,y:r,z:n,t:i}=this,{x:o,y:s,z:a,t:u}=t,c=st((r-e)*(s+o)),h=st((r+e)*(s-o)),l=st(h-c);if(l===B)return this.double();const d=st(n*R*u),f=st(i*R*a),p=f+d,m=h+c,g=f-d,y=st(p*l),w=st(m*g),b=st(p*g),v=st(l*m);return new q(y,w,v,b)}subtract(t){return this.add(t.negate())}precomputeWindow(t){const e=1+256/t,r=[];let n=this,i=n;for(let o=0;o<e;o++){i=n,r.push(i);for(let e=1;e<2**(t-1);e++)i=i.add(n),r.push(i);n=i.double()}return r}wNAF(t,e){!e&&this.equals(q.BASE)&&(e=G.BASE);const r=e&&e._WINDOW_SIZE||1;if(256%r)throw new Error("Point#wNAF: Invalid precomputation window, must be power of 2");let n=e&&V.get(e);n||(n=this.precomputeWindow(r),e&&1!==r&&(n=q.normalizeZ(n),V.set(e,n)));let i=q.ZERO,o=q.BASE;const s=1+256/r,a=2**(r-1),u=BigInt(2**r-1),c=2**r,h=BigInt(r);for(let e=0;e<s;e++){const r=e*a;let s=Number(t&u);t>>=h,s>a&&(s-=c,t+=P);const l=r,d=r+Math.abs(s)-1,f=e%2!=0,p=s<0;0===s?o=o.add(D(f,n[l])):i=i.add(D(p,n[d]))}return q.normalizeZ([i,o])[0]}multiply(t,e){return this.wNAF(ft(t,O.l),e)}multiplyUnsafe(t){let e=ft(t,O.l,!1);const r=q.BASE,n=q.ZERO;if(e===B)return n;if(this.equals(n)||e===P)return this;if(this.equals(r))return this.wNAF(e);let i=n,o=this;for(;e>B;)e&P&&(i=i.add(o)),o=o.double(),e>>=P;return i}isSmallOrder(){return this.multiplyUnsafe(O.h).equals(q.ZERO)}isTorsionFree(){let t=this.multiplyUnsafe(O.l/R).double();return O.l%R&&(t=t.add(this)),t.equals(q.ZERO)}toAffine(t){const{x:e,y:r,z:n}=this,i=this.equals(q.ZERO);null==t&&(t=i?T:at(n));const o=st(e*t),s=st(r*t),a=st(n*t);if(i)return G.ZERO;if(a!==P)throw new Error("invZ was invalid");return new G(o,s)}fromRistrettoBytes(){F()}toRistrettoBytes(){F()}fromRistrettoHash(){F()}}function D(t,e){const r=e.negate();return t?r:e}function j(t){if(!(t instanceof q))throw new TypeError("ExtendedPoint expected")}function H(t){if(!(t instanceof $))throw new TypeError("RistrettoPoint expected")}function F(){throw new Error("Legacy method: switch to RistrettoPoint")}q.BASE=new q(O.Gx,O.Gy,P,st(O.Gx*O.Gy)),q.ZERO=new q(B,P,P,B);class ${constructor(t){this.ep=t}static calcElligatorRistrettoMap(t){const{d:e}=O,r=st(U*t*t),n=st((r+P)*K);let i=BigInt(-1);const o=st((i-e*r)*st(r+e));let{isValid:s,value:a}=ct(n,o),u=st(a*t);rt(u)||(u=st(-u)),s||(a=u),s||(i=r);const c=st(i*(r-P)*W-o),h=a*a,l=st((a+a)*o),d=st(c*N),f=st(P-h),p=st(P+h);return new q(st(l*p),st(f*d),st(d*p),st(l*f))}static hashToCurve(t){const e=ot((t=dt(t,64)).slice(0,32)),r=this.calcElligatorRistrettoMap(e),n=ot(t.slice(32,64)),i=this.calcElligatorRistrettoMap(n);return new $(r.add(i))}static fromHex(t){t=dt(t,32);const{a:e,d:r}=O,n="RistrettoPoint.fromHex: the hex is not valid encoding of RistrettoPoint",i=ot(t);if(!function(t,e){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}(et(i),t)||rt(i))throw new Error(n);const o=st(i*i),s=st(P+e*o),a=st(P-e*o),u=st(s*s),c=st(a*a),h=st(e*r*u-c),{isValid:l,value:d}=ht(st(h*c)),f=st(d*a),p=st(d*f*h);let m=st((i+i)*f);rt(m)&&(m=st(-m));const g=st(s*p),y=st(m*g);if(!l||rt(y)||g===B)throw new Error(n);return new $(new q(m,g,P,y))}toRawBytes(){let{x:t,y:e,z:r,t:n}=this.ep;const i=st(st(r+e)*st(r-e)),o=st(t*e),s=st(o*o),{value:a}=ht(st(i*s)),u=st(a*i),c=st(a*o),h=st(u*c*n);let l;if(rt(n*h)){let r=st(e*U),n=st(t*U);t=r,e=n,l=st(u*z)}else l=c;rt(t*h)&&(e=st(-e));let d=st((r-e)*l);return rt(d)&&(d=st(-d)),et(d)}toHex(){return X(this.toRawBytes())}toString(){return this.toHex()}equals(t){H(t);const e=this.ep,r=t.ep,n=st(e.x*r.y)===st(e.y*r.x),i=st(e.y*r.y)===st(e.x*r.x);return n||i}add(t){return H(t),new $(this.ep.add(t.ep))}subtract(t){return H(t),new $(this.ep.subtract(t.ep))}multiply(t){return new $(this.ep.multiply(t))}multiplyUnsafe(t){return new $(this.ep.multiplyUnsafe(t))}}$.BASE=new $(q.BASE),$.ZERO=new $(q.ZERO);const V=new WeakMap;class G{constructor(t,e){this.x=t,this.y=e}_setWindowSize(t){this._WINDOW_SIZE=t,V.delete(this)}static fromHex(t,e=!0){const{d:r,P:n}=O,i=(t=dt(t,32)).slice();i[31]=-129&t[31];const o=nt(i);if(e&&o>=n)throw new Error("Expected 0 < hex < P");if(!e&&o>=C)throw new Error("Expected 0 < hex < 2**256");const s=st(o*o),a=st(s-P),u=st(r*s+P);let{isValid:c,value:h}=ct(a,u);if(!c)throw new Error("Point.fromHex: invalid y coordinate");const l=(h&P)===P;return 0!=(128&t[31])!==l&&(h=st(-h)),new G(h,o)}static async fromPrivateKey(t){return(await wt(t)).point}toRawBytes(){const t=et(this.y);return t[31]|=this.x&P?128:0,t}toHex(){return X(this.toRawBytes())}toX25519(){const{y:t}=this;return et(st((P+t)*at(P-t)))}isTorsionFree(){return q.fromAffine(this).isTorsionFree()}equals(t){return this.x===t.x&&this.y===t.y}negate(){return new G(st(-this.x),this.y)}add(t){return q.fromAffine(this).add(q.fromAffine(t)).toAffine()}subtract(t){return this.add(t.negate())}multiply(t){return q.fromAffine(this).multiply(t,this).toAffine()}}G.BASE=new G(O.Gx,O.Gy),G.ZERO=new G(B,P);class Z{constructor(t,e){this.r=t,this.s=e,this.assertValidity()}static fromHex(t){const e=dt(t,64),r=G.fromHex(e.slice(0,32),!1),n=nt(e.slice(32,64));return new Z(r,n)}assertValidity(){const{r:t,s:e}=this;if(!(t instanceof G))throw new Error("Expected Point instance");return ft(e,O.l,!1),this}toRawBytes(){const t=new Uint8Array(64);return t.set(this.r.toRawBytes()),t.set(et(this.s),32),t}toHex(){return X(this.toRawBytes())}}function Y(...t){if(!t.every((t=>t instanceof Uint8Array)))throw new Error("Expected Uint8Array list");if(1===t.length)return t[0];const e=t.reduce(((t,e)=>t+e.length),0),r=new Uint8Array(e);for(let e=0,n=0;e<t.length;e++){const i=t[e];r.set(i,n),n+=i.length}return r}const J=Array.from({length:256},((t,e)=>e.toString(16).padStart(2,"0")));function X(t){if(!(t instanceof Uint8Array))throw new Error("Uint8Array expected");let e="";for(let r=0;r<t.length;r++)e+=J[t[r]];return e}function Q(t){if("string"!=typeof t)throw new TypeError("hexToBytes: expected string, got "+typeof t);if(t.length%2)throw new Error("hexToBytes: received invalid unpadded hex");const e=new Uint8Array(t.length/2);for(let r=0;r<e.length;r++){const n=2*r,i=t.slice(n,n+2),o=Number.parseInt(i,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");e[r]=o}return e}function tt(t){return Q(t.toString(16).padStart(64,"0"))}function et(t){return tt(t).reverse()}function rt(t){return(st(t)&P)===P}function nt(t){if(!(t instanceof Uint8Array))throw new Error("Expected Uint8Array");return BigInt("0x"+X(Uint8Array.from(t).reverse()))}const it=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function ot(t){return st(nt(t)&it)}function st(t,e=O.P){const r=t%e;return r>=B?r:e+r}function at(t,e=O.P){if(t===B||e<=B)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=st(t,e),n=e,i=B,o=P;for(;r!==B;){const t=n%r,e=i-o*(n/r);n=r,r=t,i=o,o=e}if(n!==P)throw new Error("invert: does not exist");return st(i,e)}function ut(t,e){const{P:r}=O;let n=t;for(;e-- >B;)n*=n,n%=r;return n}function ct(t,e){const r=st(e*e*e),n=function(t){const{P:e}=O,r=BigInt(5),n=BigInt(10),i=BigInt(20),o=BigInt(40),s=BigInt(80),a=t*t%e*t%e,u=ut(a,R)*a%e,c=ut(u,P)*t%e,h=ut(c,r)*c%e,l=ut(h,n)*h%e,d=ut(l,i)*l%e,f=ut(d,o)*d%e,p=ut(f,s)*f%e,m=ut(p,s)*f%e,g=ut(m,n)*h%e;return{pow_p_5_8:ut(g,R)*t%e,b2:a}}(t*st(r*r*e)).pow_p_5_8;let i=st(t*r*n);const o=st(e*i*i),s=i,a=st(i*U),u=o===t,c=o===st(-t),h=o===st(-t*U);return u&&(i=s),(c||h)&&(i=a),rt(i)&&(i=st(-i)),{isValid:u||c,value:i}}function ht(t){return ct(P,t)}function lt(t){return st(nt(t),O.l)}function dt(t,e){const r=t instanceof Uint8Array?Uint8Array.from(t):Q(t);if("number"==typeof e&&r.length!==e)throw new Error(`Expected ${e} bytes`);return r}function ft(t,e,r=!0){if(!e)throw new TypeError("Specify max value");if("number"==typeof t&&Number.isSafeInteger(t)&&(t=BigInt(t)),"bigint"==typeof t&&t<e)if(r){if(B<t)return t}else if(B<=t)return t;throw new TypeError("Expected valid scalar: 0 < scalar < max")}function pt(t){if(32!==(t="bigint"==typeof t||"number"==typeof t?tt(ft(t,C)):dt(t)).length)throw new Error("Expected 32 bytes");return t}function mt(t){const e=function(t){return t[0]&=248,t[31]&=127,t[31]|=64,t}(t.slice(0,32)),r=t.slice(32,64),n=lt(e),i=G.BASE.multiply(n),o=i.toRawBytes();return{head:e,prefix:r,scalar:n,point:i,pointBytes:o}}let gt;function yt(...t){if("function"!=typeof gt)throw new Error("utils.sha512Sync must be set to use sync methods");return gt(...t)}async function wt(t){return mt(await St.sha512(pt(t)))}function bt(t){return mt(yt(pt(t)))}const vt={getExtendedPublicKey:bt,getPublicKey:function(t){return bt(t).pointBytes},sign:function(t,e){t=dt(t);const{prefix:r,scalar:n,pointBytes:i}=bt(e),o=lt(yt(r,t)),s=G.BASE.multiply(o),a=st(o+lt(yt(s.toRawBytes(),i,t))*n,O.l);return new Z(s,a).toRawBytes()},verify:function(t,e,r){const{r:n,SB:i,msg:o,pub:s}=function(t,e,r){e=dt(e),r instanceof G||(r=G.fromHex(r,!1));const{r:n,s:i}=t instanceof Z?t.assertValidity():Z.fromHex(t);return{r:n,s:i,SB:q.BASE.multiplyUnsafe(i),pub:r,msg:e}}(t,e,r),a=yt(n.toRawBytes(),s.toRawBytes(),o);return function(t,e,r,n){const i=lt(n),o=q.fromAffine(t).multiplyUnsafe(i);return q.fromAffine(e).add(o).subtract(r).multiplyUnsafe(O.h).equals(q.ZERO)}(s,n,i,a)}};G.BASE._setWindowSize(8);const kt={node:r.nodeCrypto,web:"object"==typeof self&&"crypto"in self?self.crypto:void 0},St={bytesToHex:X,hexToBytes:Q,concatBytes:Y,getExtendedPublicKey:wt,mod:st,invert:at,TORSION_SUBGROUP:["0100000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a","0000000000000000000000000000000000000000000000000000000000000080","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05","ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85","0000000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa"],hashToPrivateScalar:t=>{if((t=dt(t)).length<40||t.length>1024)throw new Error("Expected 40-1024 bytes of private key as per FIPS 186");return st(nt(t),O.l-P)+P},randomBytes:(t=32)=>{if(kt.web)return kt.web.getRandomValues(new Uint8Array(t));if(kt.node){const{randomBytes:e}=kt.node;return new Uint8Array(e(t).buffer)}throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:()=>St.randomBytes(32),sha512:async(...t)=>{const e=Y(...t);if(kt.web){const t=await kt.web.subtle.digest("SHA-512",e.buffer);return new Uint8Array(t)}if(kt.node)return Uint8Array.from(kt.node.createHash("sha512").update(e).digest());throw new Error("The environment doesn't have sha512 function")},precompute(t=8,e=G.BASE){const r=e.equals(G.BASE)?e:new G(e.x,e.y);return r._setWindowSize(t),r.multiply(R),r},sha512Sync:void 0};Object.defineProperties(St,{sha512Sync:{configurable:!1,get:()=>gt,set(t){gt||(gt=t)}}});var _t={exports:{}};!function(t,e){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 o(t,e,r){if(o.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=o:e.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r.require$$0.Buffer}catch(t){}function a(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=a(t,r);return r-1>=e&&(n|=a(t,r-1)<<4),n}function c(t,e,r,i){for(var o=0,s=0,a=Math.min(t.length,r),u=e;u<a;u++){var c=t.charCodeAt(u)-48;o*=i,s=c>=49?c-49+10:c>=17?c-17+10:c,n(c>=0&&s<i,"Invalid character"),o+=s}return o}function h(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.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)))},o.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)},o.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 o,s,a=0;if("be"===r)for(i=t.length-1,o=0;i>=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i<t.length;i+=3)s=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},o.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,o=0,s=0;if("be"===r)for(n=t.length-1;n>=e;n-=2)i=u(t,e,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n<t.length;n+=2)i=u(t,e,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this._strip()},o.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 o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,u=0,h=r;h<a;h+=n)u=c(t,h,h+n,e),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var l=1;for(u=c(t,h,t.length,e),h=0;h<s;h++)l*=e;this.imuln(l),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},o.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},o.prototype._move=function(t){h(t,this)},o.prototype.clone=function(){var t=new o(null);return this.copy(t),t},o.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},o.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){o.prototype.inspect=l}else o.prototype.inspect=l;function l(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var d=["","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"],f=[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 m(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],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var c=1;c<n;c++){for(var h=u>>>26,l=67108863&u,d=Math.min(c,e.length-1),f=Math.max(0,c-t.length+1);f<=d;f++){var p=c-f|0;h+=(s=(i=0|t.words[p])*(o=0|e.words[f])+l)/67108864|0,l=67108863&s}r.words[c]=0|l,u=0|h}return 0!==u?r.words[c]=0|u:r.length--,r._strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,s=0;s<this.length;s++){var a=this.words[s],u=(16777215&(a<<i|o)).toString(16);o=a>>>24-i&16777215,(i+=2)>=26&&(i-=26,s--),r=0!==o||s!==this.length-1?d[6-u.length]+u+r:u+r}for(0!==o&&(r=o.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 c=f[t],h=p[t];r="";var l=this.clone();for(l.negative=0;!l.isZero();){var m=l.modrn(h).toString(t);r=(l=l.idivn(h)).isZero()?m+r:d[c-m.length]+m+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")},o.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},o.prototype.toJSON=function(){return this.toString(16,2)},s&&(o.prototype.toBuffer=function(t,e){return this.toArrayLike(s,t,e)}),o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var s=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](s,i),s},o.prototype._toArrayLikeLE=function(t,e){for(var r=0,n=0,i=0,o=0;i<this.length;i++){var s=this.words[i]<<o|n;t[r++]=255&s,r<t.length&&(t[r++]=s>>8&255),r<t.length&&(t[r++]=s>>16&255),6===o?(r<t.length&&(t[r++]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r<t.length)for(t[r++]=n;r<t.length;)t[r++]=0},o.prototype._toArrayLikeBE=function(t,e){for(var r=t.length-1,n=0,i=0,o=0;i<this.length;i++){var s=this.words[i]<<o|n;t[r--]=255&s,r>=0&&(t[r--]=s>>8&255),r>=0&&(t[r--]=s>>16&255),6===o?(r>=0&&(t[r--]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r>=0)for(t[r--]=n;r>=0;)t[r--]=0},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.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},o.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},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.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},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},o.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.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()},o.prototype.ior=function(t){return n(0==(this.negative|t.negative)),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.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()},o.prototype.iand=function(t){return n(0==(this.negative|t.negative)),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.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()},o.prototype.ixor=function(t){return n(0==(this.negative|t.negative)),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.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()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.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()},o.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,o=0;o<n.length;o++)e=(0|r.words[o])+(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<r.length;o++)e=(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},o.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)},o.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 o=0,s=0;s<n.length;s++)o=(e=(0|r.words[s])-(0|n.words[s])+o)>>26,this.words[s]=67108863&e;for(;0!==o&&s<r.length;s++)o=(e=(0|r.words[s])+o)>>26,this.words[s]=67108863&e;if(0===o&&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()},o.prototype.sub=function(t){return this.clone().isub(t)};var g=function(t,e,r){var n,i,o,s=t.words,a=e.words,u=r.words,c=0,h=0|s[0],l=8191&h,d=h>>>13,f=0|s[1],p=8191&f,m=f>>>13,g=0|s[2],y=8191&g,w=g>>>13,b=0|s[3],v=8191&b,k=b>>>13,S=0|s[4],_=8191&S,A=S>>>13,M=0|s[5],I=8191&M,E=M>>>13,x=0|s[6],B=8191&x,P=x>>>13,R=0|s[7],T=8191&R,L=R>>>13,O=0|s[8],C=8191&O,U=O>>>13,N=0|s[9],z=8191&N,K=N>>>13,W=0|a[0],q=8191&W,D=W>>>13,j=0|a[1],H=8191&j,F=j>>>13,$=0|a[2],V=8191&$,G=$>>>13,Z=0|a[3],Y=8191&Z,J=Z>>>13,X=0|a[4],Q=8191&X,tt=X>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,ct=at>>>13,ht=0|a[8],lt=8191&ht,dt=ht>>>13,ft=0|a[9],pt=8191&ft,mt=ft>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(c+(n=Math.imul(l,q))|0)+((8191&(i=(i=Math.imul(l,D))+Math.imul(d,q)|0))<<13)|0;c=((o=Math.imul(d,D))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(p,q),i=(i=Math.imul(p,D))+Math.imul(m,q)|0,o=Math.imul(m,D);var yt=(c+(n=n+Math.imul(l,H)|0)|0)+((8191&(i=(i=i+Math.imul(l,F)|0)+Math.imul(d,H)|0))<<13)|0;c=((o=o+Math.imul(d,F)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(y,q),i=(i=Math.imul(y,D))+Math.imul(w,q)|0,o=Math.imul(w,D),n=n+Math.imul(p,H)|0,i=(i=i+Math.imul(p,F)|0)+Math.imul(m,H)|0,o=o+Math.imul(m,F)|0;var wt=(c+(n=n+Math.imul(l,V)|0)|0)+((8191&(i=(i=i+Math.imul(l,G)|0)+Math.imul(d,V)|0))<<13)|0;c=((o=o+Math.imul(d,G)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(v,q),i=(i=Math.imul(v,D))+Math.imul(k,q)|0,o=Math.imul(k,D),n=n+Math.imul(y,H)|0,i=(i=i+Math.imul(y,F)|0)+Math.imul(w,H)|0,o=o+Math.imul(w,F)|0,n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,G)|0)+Math.imul(m,V)|0,o=o+Math.imul(m,G)|0;var bt=(c+(n=n+Math.imul(l,Y)|0)|0)+((8191&(i=(i=i+Math.imul(l,J)|0)+Math.imul(d,Y)|0))<<13)|0;c=((o=o+Math.imul(d,J)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(_,q),i=(i=Math.imul(_,D))+Math.imul(A,q)|0,o=Math.imul(A,D),n=n+Math.imul(v,H)|0,i=(i=i+Math.imul(v,F)|0)+Math.imul(k,H)|0,o=o+Math.imul(k,F)|0,n=n+Math.imul(y,V)|0,i=(i=i+Math.imul(y,G)|0)+Math.imul(w,V)|0,o=o+Math.imul(w,G)|0,n=n+Math.imul(p,Y)|0,i=(i=i+Math.imul(p,J)|0)+Math.imul(m,Y)|0,o=o+Math.imul(m,J)|0;var vt=(c+(n=n+Math.imul(l,Q)|0)|0)+((8191&(i=(i=i+Math.imul(l,tt)|0)+Math.imul(d,Q)|0))<<13)|0;c=((o=o+Math.imul(d,tt)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(I,q),i=(i=Math.imul(I,D))+Math.imul(E,q)|0,o=Math.imul(E,D),n=n+Math.imul(_,H)|0,i=(i=i+Math.imul(_,F)|0)+Math.imul(A,H)|0,o=o+Math.imul(A,F)|0,n=n+Math.imul(v,V)|0,i=(i=i+Math.imul(v,G)|0)+Math.imul(k,V)|0,o=o+Math.imul(k,G)|0,n=n+Math.imul(y,Y)|0,i=(i=i+Math.imul(y,J)|0)+Math.imul(w,Y)|0,o=o+Math.imul(w,J)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var kt=(c+(n=n+Math.imul(l,rt)|0)|0)+((8191&(i=(i=i+Math.imul(l,nt)|0)+Math.imul(d,rt)|0))<<13)|0;c=((o=o+Math.imul(d,nt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(B,q),i=(i=Math.imul(B,D))+Math.imul(P,q)|0,o=Math.imul(P,D),n=n+Math.imul(I,H)|0,i=(i=i+Math.imul(I,F)|0)+Math.imul(E,H)|0,o=o+Math.imul(E,F)|0,n=n+Math.imul(_,V)|0,i=(i=i+Math.imul(_,G)|0)+Math.imul(A,V)|0,o=o+Math.imul(A,G)|0,n=n+Math.imul(v,Y)|0,i=(i=i+Math.imul(v,J)|0)+Math.imul(k,Y)|0,o=o+Math.imul(k,J)|0,n=n+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(w,Q)|0,o=o+Math.imul(w,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,nt)|0;var St=(c+(n=n+Math.imul(l,ot)|0)|0)+((8191&(i=(i=i+Math.imul(l,st)|0)+Math.imul(d,ot)|0))<<13)|0;c=((o=o+Math.imul(d,st)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(T,q),i=(i=Math.imul(T,D))+Math.imul(L,q)|0,o=Math.imul(L,D),n=n+Math.imul(B,H)|0,i=(i=i+Math.imul(B,F)|0)+Math.imul(P,H)|0,o=o+Math.imul(P,F)|0,n=n+Math.imul(I,V)|0,i=(i=i+Math.imul(I,G)|0)+Math.imul(E,V)|0,o=o+Math.imul(E,G)|0,n=n+Math.imul(_,Y)|0,i=(i=i+Math.imul(_,J)|0)+Math.imul(A,Y)|0,o=o+Math.imul(A,J)|0,n=n+Math.imul(v,Q)|0,i=(i=i+Math.imul(v,tt)|0)+Math.imul(k,Q)|0,o=o+Math.imul(k,tt)|0,n=n+Math.imul(y,rt)|0,i=(i=i+Math.imul(y,nt)|0)+Math.imul(w,rt)|0,o=o+Math.imul(w,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var _t=(c+(n=n+Math.imul(l,ut)|0)|0)+((8191&(i=(i=i+Math.imul(l,ct)|0)+Math.imul(d,ut)|0))<<13)|0;c=((o=o+Math.imul(d,ct)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(C,q),i=(i=Math.imul(C,D))+Math.imul(U,q)|0,o=Math.imul(U,D),n=n+Math.imul(T,H)|0,i=(i=i+Math.imul(T,F)|0)+Math.imul(L,H)|0,o=o+Math.imul(L,F)|0,n=n+Math.imul(B,V)|0,i=(i=i+Math.imul(B,G)|0)+Math.imul(P,V)|0,o=o+Math.imul(P,G)|0,n=n+Math.imul(I,Y)|0,i=(i=i+Math.imul(I,J)|0)+Math.imul(E,Y)|0,o=o+Math.imul(E,J)|0,n=n+Math.imul(_,Q)|0,i=(i=i+Math.imul(_,tt)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,tt)|0,n=n+Math.imul(v,rt)|0,i=(i=i+Math.imul(v,nt)|0)+Math.imul(k,rt)|0,o=o+Math.imul(k,nt)|0,n=n+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,st)|0)+Math.imul(w,ot)|0,o=o+Math.imul(w,st)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ct)|0;var At=(c+(n=n+Math.imul(l,lt)|0)|0)+((8191&(i=(i=i+Math.imul(l,dt)|0)+Math.imul(d,lt)|0))<<13)|0;c=((o=o+Math.imul(d,dt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(z,q),i=(i=Math.imul(z,D))+Math.imul(K,q)|0,o=Math.imul(K,D),n=n+Math.imul(C,H)|0,i=(i=i+Math.imul(C,F)|0)+Math.imul(U,H)|0,o=o+Math.imul(U,F)|0,n=n+Math.imul(T,V)|0,i=(i=i+Math.imul(T,G)|0)+Math.imul(L,V)|0,o=o+Math.imul(L,G)|0,n=n+Math.imul(B,Y)|0,i=(i=i+Math.imul(B,J)|0)+Math.imul(P,Y)|0,o=o+Math.imul(P,J)|0,n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,tt)|0,n=n+Math.imul(_,rt)|0,i=(i=i+Math.imul(_,nt)|0)+Math.imul(A,rt)|0,o=o+Math.imul(A,nt)|0,n=n+Math.imul(v,ot)|0,i=(i=i+Math.imul(v,st)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,st)|0,n=n+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ct)|0)+Math.imul(w,ut)|0,o=o+Math.imul(w,ct)|0,n=n+Math.imul(p,lt)|0,i=(i=i+Math.imul(p,dt)|0)+Math.imul(m,lt)|0,o=o+Math.imul(m,dt)|0;var Mt=(c+(n=n+Math.imul(l,pt)|0)|0)+((8191&(i=(i=i+Math.imul(l,mt)|0)+Math.imul(d,pt)|0))<<13)|0;c=((o=o+Math.imul(d,mt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(z,H),i=(i=Math.imul(z,F))+Math.imul(K,H)|0,o=Math.imul(K,F),n=n+Math.imul(C,V)|0,i=(i=i+Math.imul(C,G)|0)+Math.imul(U,V)|0,o=o+Math.imul(U,G)|0,n=n+Math.imul(T,Y)|0,i=(i=i+Math.imul(T,J)|0)+Math.imul(L,Y)|0,o=o+Math.imul(L,J)|0,n=n+Math.imul(B,Q)|0,i=(i=i+Math.imul(B,tt)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,tt)|0,n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,nt)|0,n=n+Math.imul(_,ot)|0,i=(i=i+Math.imul(_,st)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,st)|0,n=n+Math.imul(v,ut)|0,i=(i=i+Math.imul(v,ct)|0)+Math.imul(k,ut)|0,o=o+Math.imul(k,ct)|0,n=n+Math.imul(y,lt)|0,i=(i=i+Math.imul(y,dt)|0)+Math.imul(w,lt)|0,o=o+Math.imul(w,dt)|0;var It=(c+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;c=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(z,V),i=(i=Math.imul(z,G))+Math.imul(K,V)|0,o=Math.imul(K,G),n=n+Math.imul(C,Y)|0,i=(i=i+Math.imul(C,J)|0)+Math.imul(U,Y)|0,o=o+Math.imul(U,J)|0,n=n+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,tt)|0)+Math.imul(L,Q)|0,o=o+Math.imul(L,tt)|0,n=n+Math.imul(B,rt)|0,i=(i=i+Math.imul(B,nt)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,nt)|0,n=n+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,st)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,st)|0,n=n+Math.imul(_,ut)|0,i=(i=i+Math.imul(_,ct)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,ct)|0,n=n+Math.imul(v,lt)|0,i=(i=i+Math.imul(v,dt)|0)+Math.imul(k,lt)|0,o=o+Math.imul(k,dt)|0;var Et=(c+(n=n+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,mt)|0)+Math.imul(w,pt)|0))<<13)|0;c=((o=o+Math.imul(w,mt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(z,Y),i=(i=Math.imul(z,J))+Math.imul(K,Y)|0,o=Math.imul(K,J),n=n+Math.imul(C,Q)|0,i=(i=i+Math.imul(C,tt)|0)+Math.imul(U,Q)|0,o=o+Math.imul(U,tt)|0,n=n+Math.imul(T,rt)|0,i=(i=i+Math.imul(T,nt)|0)+Math.imul(L,rt)|0,o=o+Math.imul(L,nt)|0,n=n+Math.imul(B,ot)|0,i=(i=i+Math.imul(B,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,n=n+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,ct)|0)+Math.imul(E,ut)|0,o=o+Math.imul(E,ct)|0,n=n+Math.imul(_,lt)|0,i=(i=i+Math.imul(_,dt)|0)+Math.imul(A,lt)|0,o=o+Math.imul(A,dt)|0;var xt=(c+(n=n+Math.imul(v,pt)|0)|0)+((8191&(i=(i=i+Math.imul(v,mt)|0)+Math.imul(k,pt)|0))<<13)|0;c=((o=o+Math.imul(k,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(z,Q),i=(i=Math.imul(z,tt))+Math.imul(K,Q)|0,o=Math.imul(K,tt),n=n+Math.imul(C,rt)|0,i=(i=i+Math.imul(C,nt)|0)+Math.imul(U,rt)|0,o=o+Math.imul(U,nt)|0,n=n+Math.imul(T,ot)|0,i=(i=i+Math.imul(T,st)|0)+Math.imul(L,ot)|0,o=o+Math.imul(L,st)|0,n=n+Math.imul(B,ut)|0,i=(i=i+Math.imul(B,ct)|0)+Math.imul(P,ut)|0,o=o+Math.imul(P,ct)|0,n=n+Math.imul(I,lt)|0,i=(i=i+Math.imul(I,dt)|0)+Math.imul(E,lt)|0,o=o+Math.imul(E,dt)|0;var Bt=(c+(n=n+Math.imul(_,pt)|0)|0)+((8191&(i=(i=i+Math.imul(_,mt)|0)+Math.imul(A,pt)|0))<<13)|0;c=((o=o+Math.imul(A,mt)|0)+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,n=Math.imul(z,rt),i=(i=Math.imul(z,nt))+Math.imul(K,rt)|0,o=Math.imul(K,nt),n=n+Math.imul(C,ot)|0,i=(i=i+Math.imul(C,st)|0)+Math.imul(U,ot)|0,o=o+Math.imul(U,st)|0,n=n+Math.imul(T,ut)|0,i=(i=i+Math.imul(T,ct)|0)+Math.imul(L,ut)|0,o=o+Math.imul(L,ct)|0,n=n+Math.imul(B,lt)|0,i=(i=i+Math.imul(B,dt)|0)+Math.imul(P,lt)|0,o=o+Math.imul(P,dt)|0;var Pt=(c+(n=n+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,mt)|0)+Math.imul(E,pt)|0))<<13)|0;c=((o=o+Math.imul(E,mt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(z,ot),i=(i=Math.imul(z,st))+Math.imul(K,ot)|0,o=Math.imul(K,st),n=n+Math.imul(C,ut)|0,i=(i=i+Math.imul(C,ct)|0)+Math.imul(U,ut)|0,o=o+Math.imul(U,ct)|0,n=n+Math.imul(T,lt)|0,i=(i=i+Math.imul(T,dt)|0)+Math.imul(L,lt)|0,o=o+Math.imul(L,dt)|0;var Rt=(c+(n=n+Math.imul(B,pt)|0)|0)+((8191&(i=(i=i+Math.imul(B,mt)|0)+Math.imul(P,pt)|0))<<13)|0;c=((o=o+Math.imul(P,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(z,ut),i=(i=Math.imul(z,ct))+Math.imul(K,ut)|0,o=Math.imul(K,ct),n=n+Math.imul(C,lt)|0,i=(i=i+Math.imul(C,dt)|0)+Math.imul(U,lt)|0,o=o+Math.imul(U,dt)|0;var Tt=(c+(n=n+Math.imul(T,pt)|0)|0)+((8191&(i=(i=i+Math.imul(T,mt)|0)+Math.imul(L,pt)|0))<<13)|0;c=((o=o+Math.imul(L,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(z,lt),i=(i=Math.imul(z,dt))+Math.imul(K,lt)|0,o=Math.imul(K,dt);var Lt=(c+(n=n+Math.imul(C,pt)|0)|0)+((8191&(i=(i=i+Math.imul(C,mt)|0)+Math.imul(U,pt)|0))<<13)|0;c=((o=o+Math.imul(U,mt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863;var Ot=(c+(n=Math.imul(z,pt))|0)+((8191&(i=(i=Math.imul(z,mt))+Math.imul(K,pt)|0))<<13)|0;return c=((o=Math.imul(K,mt))+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,u[0]=gt,u[1]=yt,u[2]=wt,u[3]=bt,u[4]=vt,u[5]=kt,u[6]=St,u[7]=_t,u[8]=At,u[9]=Mt,u[10]=It,u[11]=Et,u[12]=xt,u[13]=Bt,u[14]=Pt,u[15]=Rt,u[16]=Tt,u[17]=Lt,u[18]=Ot,0!==c&&(u[19]=c,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,o=0;o<r.length-1;o++){var s=i;i=0;for(var a=67108863&n,u=Math.min(o,e.length-1),c=Math.max(0,o-t.length+1);c<=u;c++){var h=o-c,l=(0|t.words[h])*(0|e.words[c]),d=67108863&l;a=67108863&(d=d+a|0),i+=(s=(s=s+(l/67108864|0)|0)+(d>>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r._strip()}function w(t,e,r){return y(t,e,r)}Math.imul||(g=m),o.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?g(this,t,e):r<63?m(this,t,e):r<1024?y(this,t,e):w(this,t,e)},o.prototype.mul=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},o.prototype.mulf=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),w(this,t,e)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.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 o=(0|this.words[i])*t,s=(67108863&o)+(67108863&r);r>>=26,r+=o/67108864|0,r+=s>>>26,this.words[i]=67108863&s}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.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 o(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},o.prototype.iushln=function(t){n("number"==typeof t&&t>=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,u=(0|this.words[e])-a<<r;this.words[e]=u|s,s=a>>>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()},o.prototype.ishln=function(t){return n(0===this.negative),this.iushln(t)},o.prototype.iushrn=function(t,e,r){var i;n("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,u=r;if(i-=s,i=Math.max(0,i),u){for(var c=0;c<s;c++)u.words[c]=this.words[c];u.length=s}if(0===s);else if(this.length>s)for(this.length-=s,c=0;c<this.length;c++)this.words[c]=this.words[c+s];else this.words[0]=0,this.length=1;var h=0;for(c=this.length-1;c>=0&&(0!==h||c>=i);c--){var l=0|this.words[c];this.words[c]=h<<26-o|l>>>o,h=l&a}return u&&0!==h&&(u.words[u.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.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))},o.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()},o.prototype.maskn=function(t){return this.clone().imaskn(t)},o.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)},o.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},o.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()},o.prototype.addn=function(t){return this.clone().iaddn(t)},o.prototype.subn=function(t){return this.clone().isubn(t)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(t,e,r){var i,o,s=t.length+r;this._expand(s);var a=0;for(i=0;i<t.length;i++){o=(0|this.words[i+r])+a;var u=(0|t.words[i])*e;a=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i<this.length-r;i++)a=(o=(0|this.words[i+r])+a)>>26,this.words[i+r]=67108863&o;if(0===a)return this._strip();for(n(-1===a),a=0,i=0;i<this.length;i++)a=(o=-(0|this.words[i])+a)>>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},o.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 a,u=n.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var c=0;c<a.length;c++)a.words[c]=0}var h=n.clone()._ishlnsubmul(i,1,u);0===h.negative&&(n=h,a&&(a.words[u]=1));for(var l=u-1;l>=0;l--){var d=67108864*(0|n.words[i.length+l])+(0|n.words[i.length+l-1]);for(d=Math.min(d/s|0,67108863),n._ishlnsubmul(i,d,l);0!==n.negative;)d--,n.negative=0,n._ishlnsubmul(i,1,l),n.isZero()||(n.negative^=1);a&&(a.words[l]=d)}return a&&a._strip(),n._strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modrn(t.words[0]))}:this._wordDiv(t,e);var i,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.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),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modrn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%t;return e?-i:i},o.prototype.modn=function(t){return this.modrn(t)},o.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 o=(0|this.words[i])+67108864*r;this.words[i]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},o.prototype.divn=function(t){return this.clone().idivn(t)},o.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 o(1),s=new o(0),a=new o(0),u=new o(1),c=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++c;for(var h=r.clone(),l=e.clone();!e.isZero();){for(var d=0,f=1;0==(e.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(h),s.isub(l)),i.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(h),u.isub(l)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),s.isub(u)):(r.isub(e),a.isub(i),u.isub(s))}return{a:a,b:u,gcd:r.iushln(c)}},o.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 o(1),a=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,h=1;0==(e.words[0]&h)&&c<26;++c,h<<=1);if(c>0)for(e.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var l=0,d=1;0==(r.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(r.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(t),i},o.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 o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.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 o=i,s=r;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.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},o.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},o.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},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new M(t)},o.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)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var b={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function k(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function S(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function A(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function M(t){if("string"==typeof t){var e=o._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 I(t){M.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(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)}v.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.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},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},i(k,v),k.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 o=t.words[9];for(e.words[e.length++]=o&r,i=10;i<t.length;i++){var s=0|t.words[i];t.words[i-10]=(s&r)<<4|o>>>22,o=s}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},k.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(S,v),i(_,v),i(A,v),A.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},o._prime=function(t){if(b[t])return b[t];var e;if("k256"===t)e=new k;else if("p224"===t)e=new S;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new A}return b[t]=e,e},M.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},M.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")},M.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(h(t,t.umod(this.m)._forceRed(this)),t)},M.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},M.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)},M.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},M.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)},M.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},M.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},M.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},M.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},M.prototype.isqr=function(t){return this.imul(t,t.clone())},M.prototype.sqr=function(t){return this.mul(t,t)},M.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 o(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 a=new o(1).toRed(this),u=a.redNeg(),c=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new o(2*h*h).toRed(this);0!==this.pow(h,c).cmp(u);)h.redIAdd(u);for(var l=this.pow(h,i),d=this.pow(t,i.addn(1).iushrn(1)),f=this.pow(t,i),p=s;0!==f.cmp(a);){for(var m=f,g=0;0!==m.cmp(a);g++)m=m.redSqr();n(g<p);var y=this.pow(l,new o(1).iushln(p-g-1));d=d.redMul(y),l=y.redSqr(),f=f.redMul(l),p=g}return d},M.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},M.prototype.pow=function(t,e){if(e.isZero())return new o(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new o(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,a=0,u=e.bitLength()%26;for(0===u&&(u=26),n=e.length-1;n>=0;n--){for(var c=e.words[n],h=u-1;h>=0;h--){var l=c>>h&1;i!==r[0]&&(i=this.sqr(i)),0!==l||0!==s?(s<<=1,s|=l,(4==++a||0===n&&0===h)&&(i=this.mul(i,r[s]),a=0,s=0)):a=0}u=26}return i},M.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},M.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new I(t)},i(I,M),I.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},I.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},I.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),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},I.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(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)},I.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(_t,t.commonjsGlobal);var At=_t.exports,Mt=n.safeBuffer.exports.Buffer;var It=function(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r<e.length;r++)e[r]=255;for(var n=0;n<t.length;n++){var i=t.charAt(n),o=i.charCodeAt(0);if(255!==e[o])throw new TypeError(i+" is ambiguous");e[o]=n}var s=t.length,a=t.charAt(0),u=Math.log(s)/Math.log(256),c=Math.log(256)/Math.log(s);function h(t){if("string"!=typeof t)throw new TypeError("Expected String");if(0===t.length)return Mt.alloc(0);for(var r=0,n=0,i=0;t[r]===a;)n++,r++;for(var o=(t.length-r)*u+1>>>0,c=new Uint8Array(o);t[r];){var h=e[t.charCodeAt(r)];if(255===h)return;for(var l=0,d=o-1;(0!==h||l<i)&&-1!==d;d--,l++)h+=s*c[d]>>>0,c[d]=h%256>>>0,h=h/256>>>0;if(0!==h)throw new Error("Non-zero carry");i=l,r++}for(var f=o-i;f!==o&&0===c[f];)f++;var p=Mt.allocUnsafe(n+(o-f));p.fill(0,0,n);for(var m=n;f!==o;)p[m++]=c[f++];return p}return{encode:function(e){if((Array.isArray(e)||e instanceof Uint8Array)&&(e=Mt.from(e)),!Mt.isBuffer(e))throw new TypeError("Expected Buffer");if(0===e.length)return"";for(var r=0,n=0,i=0,o=e.length;i!==o&&0===e[i];)i++,r++;for(var u=(o-i)*c+1>>>0,h=new Uint8Array(u);i!==o;){for(var l=e[i],d=0,f=u-1;(0!==l||d<n)&&-1!==f;f--,d++)l+=256*h[f]>>>0,h[f]=l%s>>>0,l=l/s>>>0;if(0!==l)throw new Error("Non-zero carry");n=d,i++}for(var p=u-n;p!==u&&0===h[p];)p++;for(var m=a.repeat(r);p<u;++p)m+=t.charAt(h[p]);return m},decodeUnsafe:h,decode:function(t){var e=h(t);if(e)return e;throw new Error("Non-base"+s+" character")}}},Et=It("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");const xt=(t,e,r)=>t&e^t&r^e&r,Bt=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Pt=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Rt=new Uint32Array(64);class Tt extends m{constructor(){super(64,32,8,!1),this.A=0|Pt[0],this.B=0|Pt[1],this.C=0|Pt[2],this.D=0|Pt[3],this.E=0|Pt[4],this.F=0|Pt[5],this.G=0|Pt[6],this.H=0|Pt[7]}get(){const{A:t,B:e,C:r,D:n,E:i,F:o,G:s,H:a}=this;return[t,e,r,n,i,o,s,a]}set(t,e,r,n,i,o,s,a){this.A=0|t,this.B=0|e,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|a}process(t,e){for(let r=0;r<16;r++,e+=4)Rt[r]=t.getUint32(e,!1);for(let t=16;t<64;t++){const e=Rt[t-15],r=Rt[t-2],n=l(e,7)^l(e,18)^e>>>3,i=l(r,17)^l(r,19)^r>>>10;Rt[t]=i+Rt[t-7]+n+Rt[t-16]|0}let{A:r,B:n,C:i,D:o,E:s,F:a,G:u,H:c}=this;for(let t=0;t<64;t++){const e=c+(l(s,6)^l(s,11)^l(s,25))+((h=s)&a^~h&u)+Bt[t]+Rt[t]|0,d=(l(r,2)^l(r,13)^l(r,22))+xt(r,n,i)|0;c=u,u=a,a=s,s=o+e|0,o=i,i=n,n=r,r=e+d|0}var h;r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,o=o+this.D|0,s=s+this.E|0,a=a+this.F|0,u=u+this.G|0,c=c+this.H|0,this.set(r,n,i,o,s,a,u,c)}roundClean(){Rt.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class Lt extends Tt{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}const Ot=p((()=>new Tt));p((()=>new Lt));var Ct={},Ut={exports:{}};function Nt(t,e,r){return e<=t&&t<=r}function zt(t){if(void 0===t)return{};if(t===Object(t))return t;throw TypeError("Could not convert argument to dictionary")}!function(t,e){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 o(t,e,r){if(o.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=o:e.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r.require$$0.Buffer}catch(t){}function a(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=a(t,r);return r-1>=e&&(n|=a(t,r-1)<<4),n}function c(t,e,r,i){for(var o=0,s=0,a=Math.min(t.length,r),u=e;u<a;u++){var c=t.charCodeAt(u)-48;o*=i,s=c>=49?c-49+10:c>=17?c-17+10:c,n(c>=0&&s<i,"Invalid character"),o+=s}return o}function h(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.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)))},o.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)},o.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 o,s,a=0;if("be"===r)for(i=t.length-1,o=0;i>=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i<t.length;i+=3)s=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},o.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,o=0,s=0;if("be"===r)for(n=t.length-1;n>=e;n-=2)i=u(t,e,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n<t.length;n+=2)i=u(t,e,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this._strip()},o.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 o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,u=0,h=r;h<a;h+=n)u=c(t,h,h+n,e),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var l=1;for(u=c(t,h,t.length,e),h=0;h<s;h++)l*=e;this.imuln(l),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},o.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},o.prototype._move=function(t){h(t,this)},o.prototype.clone=function(){var t=new o(null);return this.copy(t),t},o.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},o.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){o.prototype.inspect=l}else o.prototype.inspect=l;function l(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var d=["","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"],f=[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 m(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],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var c=1;c<n;c++){for(var h=u>>>26,l=67108863&u,d=Math.min(c,e.length-1),f=Math.max(0,c-t.length+1);f<=d;f++){var p=c-f|0;h+=(s=(i=0|t.words[p])*(o=0|e.words[f])+l)/67108864|0,l=67108863&s}r.words[c]=0|l,u=0|h}return 0!==u?r.words[c]=0|u:r.length--,r._strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,s=0;s<this.length;s++){var a=this.words[s],u=(16777215&(a<<i|o)).toString(16);o=a>>>24-i&16777215,(i+=2)>=26&&(i-=26,s--),r=0!==o||s!==this.length-1?d[6-u.length]+u+r:u+r}for(0!==o&&(r=o.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 c=f[t],h=p[t];r="";var l=this.clone();for(l.negative=0;!l.isZero();){var m=l.modrn(h).toString(t);r=(l=l.idivn(h)).isZero()?m+r:d[c-m.length]+m+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")},o.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},o.prototype.toJSON=function(){return this.toString(16,2)},s&&(o.prototype.toBuffer=function(t,e){return this.toArrayLike(s,t,e)}),o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var s=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](s,i),s},o.prototype._toArrayLikeLE=function(t,e){for(var r=0,n=0,i=0,o=0;i<this.length;i++){var s=this.words[i]<<o|n;t[r++]=255&s,r<t.length&&(t[r++]=s>>8&255),r<t.length&&(t[r++]=s>>16&255),6===o?(r<t.length&&(t[r++]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r<t.length)for(t[r++]=n;r<t.length;)t[r++]=0},o.prototype._toArrayLikeBE=function(t,e){for(var r=t.length-1,n=0,i=0,o=0;i<this.length;i++){var s=this.words[i]<<o|n;t[r--]=255&s,r>=0&&(t[r--]=s>>8&255),r>=0&&(t[r--]=s>>16&255),6===o?(r>=0&&(t[r--]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r>=0)for(t[r--]=n;r>=0;)t[r--]=0},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.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},o.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},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.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},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},o.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.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()},o.prototype.ior=function(t){return n(0==(this.negative|t.negative)),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.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()},o.prototype.iand=function(t){return n(0==(this.negative|t.negative)),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.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()},o.prototype.ixor=function(t){return n(0==(this.negative|t.negative)),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.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()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.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()},o.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,o=0;o<n.length;o++)e=(0|r.words[o])+(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<r.length;o++)e=(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},o.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)},o.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 o=0,s=0;s<n.length;s++)o=(e=(0|r.words[s])-(0|n.words[s])+o)>>26,this.words[s]=67108863&e;for(;0!==o&&s<r.length;s++)o=(e=(0|r.words[s])+o)>>26,this.words[s]=67108863&e;if(0===o&&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()},o.prototype.sub=function(t){return this.clone().isub(t)};var g=function(t,e,r){var n,i,o,s=t.words,a=e.words,u=r.words,c=0,h=0|s[0],l=8191&h,d=h>>>13,f=0|s[1],p=8191&f,m=f>>>13,g=0|s[2],y=8191&g,w=g>>>13,b=0|s[3],v=8191&b,k=b>>>13,S=0|s[4],_=8191&S,A=S>>>13,M=0|s[5],I=8191&M,E=M>>>13,x=0|s[6],B=8191&x,P=x>>>13,R=0|s[7],T=8191&R,L=R>>>13,O=0|s[8],C=8191&O,U=O>>>13,N=0|s[9],z=8191&N,K=N>>>13,W=0|a[0],q=8191&W,D=W>>>13,j=0|a[1],H=8191&j,F=j>>>13,$=0|a[2],V=8191&$,G=$>>>13,Z=0|a[3],Y=8191&Z,J=Z>>>13,X=0|a[4],Q=8191&X,tt=X>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,ct=at>>>13,ht=0|a[8],lt=8191&ht,dt=ht>>>13,ft=0|a[9],pt=8191&ft,mt=ft>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(c+(n=Math.imul(l,q))|0)+((8191&(i=(i=Math.imul(l,D))+Math.imul(d,q)|0))<<13)|0;c=((o=Math.imul(d,D))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(p,q),i=(i=Math.imul(p,D))+Math.imul(m,q)|0,o=Math.imul(m,D);var yt=(c+(n=n+Math.imul(l,H)|0)|0)+((8191&(i=(i=i+Math.imul(l,F)|0)+Math.imul(d,H)|0))<<13)|0;c=((o=o+Math.imul(d,F)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(y,q),i=(i=Math.imul(y,D))+Math.imul(w,q)|0,o=Math.imul(w,D),n=n+Math.imul(p,H)|0,i=(i=i+Math.imul(p,F)|0)+Math.imul(m,H)|0,o=o+Math.imul(m,F)|0;var wt=(c+(n=n+Math.imul(l,V)|0)|0)+((8191&(i=(i=i+Math.imul(l,G)|0)+Math.imul(d,V)|0))<<13)|0;c=((o=o+Math.imul(d,G)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(v,q),i=(i=Math.imul(v,D))+Math.imul(k,q)|0,o=Math.imul(k,D),n=n+Math.imul(y,H)|0,i=(i=i+Math.imul(y,F)|0)+Math.imul(w,H)|0,o=o+Math.imul(w,F)|0,n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,G)|0)+Math.imul(m,V)|0,o=o+Math.imul(m,G)|0;var bt=(c+(n=n+Math.imul(l,Y)|0)|0)+((8191&(i=(i=i+Math.imul(l,J)|0)+Math.imul(d,Y)|0))<<13)|0;c=((o=o+Math.imul(d,J)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(_,q),i=(i=Math.imul(_,D))+Math.imul(A,q)|0,o=Math.imul(A,D),n=n+Math.imul(v,H)|0,i=(i=i+Math.imul(v,F)|0)+Math.imul(k,H)|0,o=o+Math.imul(k,F)|0,n=n+Math.imul(y,V)|0,i=(i=i+Math.imul(y,G)|0)+Math.imul(w,V)|0,o=o+Math.imul(w,G)|0,n=n+Math.imul(p,Y)|0,i=(i=i+Math.imul(p,J)|0)+Math.imul(m,Y)|0,o=o+Math.imul(m,J)|0;var vt=(c+(n=n+Math.imul(l,Q)|0)|0)+((8191&(i=(i=i+Math.imul(l,tt)|0)+Math.imul(d,Q)|0))<<13)|0;c=((o=o+Math.imul(d,tt)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(I,q),i=(i=Math.imul(I,D))+Math.imul(E,q)|0,o=Math.imul(E,D),n=n+Math.imul(_,H)|0,i=(i=i+Math.imul(_,F)|0)+Math.imul(A,H)|0,o=o+Math.imul(A,F)|0,n=n+Math.imul(v,V)|0,i=(i=i+Math.imul(v,G)|0)+Math.imul(k,V)|0,o=o+Math.imul(k,G)|0,n=n+Math.imul(y,Y)|0,i=(i=i+Math.imul(y,J)|0)+Math.imul(w,Y)|0,o=o+Math.imul(w,J)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var kt=(c+(n=n+Math.imul(l,rt)|0)|0)+((8191&(i=(i=i+Math.imul(l,nt)|0)+Math.imul(d,rt)|0))<<13)|0;c=((o=o+Math.imul(d,nt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(B,q),i=(i=Math.imul(B,D))+Math.imul(P,q)|0,o=Math.imul(P,D),n=n+Math.imul(I,H)|0,i=(i=i+Math.imul(I,F)|0)+Math.imul(E,H)|0,o=o+Math.imul(E,F)|0,n=n+Math.imul(_,V)|0,i=(i=i+Math.imul(_,G)|0)+Math.imul(A,V)|0,o=o+Math.imul(A,G)|0,n=n+Math.imul(v,Y)|0,i=(i=i+Math.imul(v,J)|0)+Math.imul(k,Y)|0,o=o+Math.imul(k,J)|0,n=n+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(w,Q)|0,o=o+Math.imul(w,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,nt)|0;var St=(c+(n=n+Math.imul(l,ot)|0)|0)+((8191&(i=(i=i+Math.imul(l,st)|0)+Math.imul(d,ot)|0))<<13)|0;c=((o=o+Math.imul(d,st)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(T,q),i=(i=Math.imul(T,D))+Math.imul(L,q)|0,o=Math.imul(L,D),n=n+Math.imul(B,H)|0,i=(i=i+Math.imul(B,F)|0)+Math.imul(P,H)|0,o=o+Math.imul(P,F)|0,n=n+Math.imul(I,V)|0,i=(i=i+Math.imul(I,G)|0)+Math.imul(E,V)|0,o=o+Math.imul(E,G)|0,n=n+Math.imul(_,Y)|0,i=(i=i+Math.imul(_,J)|0)+Math.imul(A,Y)|0,o=o+Math.imul(A,J)|0,n=n+Math.imul(v,Q)|0,i=(i=i+Math.imul(v,tt)|0)+Math.imul(k,Q)|0,o=o+Math.imul(k,tt)|0,n=n+Math.imul(y,rt)|0,i=(i=i+Math.imul(y,nt)|0)+Math.imul(w,rt)|0,o=o+Math.imul(w,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var _t=(c+(n=n+Math.imul(l,ut)|0)|0)+((8191&(i=(i=i+Math.imul(l,ct)|0)+Math.imul(d,ut)|0))<<13)|0;c=((o=o+Math.imul(d,ct)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(C,q),i=(i=Math.imul(C,D))+Math.imul(U,q)|0,o=Math.imul(U,D),n=n+Math.imul(T,H)|0,i=(i=i+Math.imul(T,F)|0)+Math.imul(L,H)|0,o=o+Math.imul(L,F)|0,n=n+Math.imul(B,V)|0,i=(i=i+Math.imul(B,G)|0)+Math.imul(P,V)|0,o=o+Math.imul(P,G)|0,n=n+Math.imul(I,Y)|0,i=(i=i+Math.imul(I,J)|0)+Math.imul(E,Y)|0,o=o+Math.imul(E,J)|0,n=n+Math.imul(_,Q)|0,i=(i=i+Math.imul(_,tt)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,tt)|0,n=n+Math.imul(v,rt)|0,i=(i=i+Math.imul(v,nt)|0)+Math.imul(k,rt)|0,o=o+Math.imul(k,nt)|0,n=n+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,st)|0)+Math.imul(w,ot)|0,o=o+Math.imul(w,st)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ct)|0;var At=(c+(n=n+Math.imul(l,lt)|0)|0)+((8191&(i=(i=i+Math.imul(l,dt)|0)+Math.imul(d,lt)|0))<<13)|0;c=((o=o+Math.imul(d,dt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(z,q),i=(i=Math.imul(z,D))+Math.imul(K,q)|0,o=Math.imul(K,D),n=n+Math.imul(C,H)|0,i=(i=i+Math.imul(C,F)|0)+Math.imul(U,H)|0,o=o+Math.imul(U,F)|0,n=n+Math.imul(T,V)|0,i=(i=i+Math.imul(T,G)|0)+Math.imul(L,V)|0,o=o+Math.imul(L,G)|0,n=n+Math.imul(B,Y)|0,i=(i=i+Math.imul(B,J)|0)+Math.imul(P,Y)|0,o=o+Math.imul(P,J)|0,n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,tt)|0,n=n+Math.imul(_,rt)|0,i=(i=i+Math.imul(_,nt)|0)+Math.imul(A,rt)|0,o=o+Math.imul(A,nt)|0,n=n+Math.imul(v,ot)|0,i=(i=i+Math.imul(v,st)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,st)|0,n=n+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ct)|0)+Math.imul(w,ut)|0,o=o+Math.imul(w,ct)|0,n=n+Math.imul(p,lt)|0,i=(i=i+Math.imul(p,dt)|0)+Math.imul(m,lt)|0,o=o+Math.imul(m,dt)|0;var Mt=(c+(n=n+Math.imul(l,pt)|0)|0)+((8191&(i=(i=i+Math.imul(l,mt)|0)+Math.imul(d,pt)|0))<<13)|0;c=((o=o+Math.imul(d,mt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(z,H),i=(i=Math.imul(z,F))+Math.imul(K,H)|0,o=Math.imul(K,F),n=n+Math.imul(C,V)|0,i=(i=i+Math.imul(C,G)|0)+Math.imul(U,V)|0,o=o+Math.imul(U,G)|0,n=n+Math.imul(T,Y)|0,i=(i=i+Math.imul(T,J)|0)+Math.imul(L,Y)|0,o=o+Math.imul(L,J)|0,n=n+Math.imul(B,Q)|0,i=(i=i+Math.imul(B,tt)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,tt)|0,n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,nt)|0,n=n+Math.imul(_,ot)|0,i=(i=i+Math.imul(_,st)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,st)|0,n=n+Math.imul(v,ut)|0,i=(i=i+Math.imul(v,ct)|0)+Math.imul(k,ut)|0,o=o+Math.imul(k,ct)|0,n=n+Math.imul(y,lt)|0,i=(i=i+Math.imul(y,dt)|0)+Math.imul(w,lt)|0,o=o+Math.imul(w,dt)|0;var It=(c+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;c=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(z,V),i=(i=Math.imul(z,G))+Math.imul(K,V)|0,o=Math.imul(K,G),n=n+Math.imul(C,Y)|0,i=(i=i+Math.imul(C,J)|0)+Math.imul(U,Y)|0,o=o+Math.imul(U,J)|0,n=n+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,tt)|0)+Math.imul(L,Q)|0,o=o+Math.imul(L,tt)|0,n=n+Math.imul(B,rt)|0,i=(i=i+Math.imul(B,nt)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,nt)|0,n=n+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,st)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,st)|0,n=n+Math.imul(_,ut)|0,i=(i=i+Math.imul(_,ct)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,ct)|0,n=n+Math.imul(v,lt)|0,i=(i=i+Math.imul(v,dt)|0)+Math.imul(k,lt)|0,o=o+Math.imul(k,dt)|0;var Et=(c+(n=n+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,mt)|0)+Math.imul(w,pt)|0))<<13)|0;c=((o=o+Math.imul(w,mt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(z,Y),i=(i=Math.imul(z,J))+Math.imul(K,Y)|0,o=Math.imul(K,J),n=n+Math.imul(C,Q)|0,i=(i=i+Math.imul(C,tt)|0)+Math.imul(U,Q)|0,o=o+Math.imul(U,tt)|0,n=n+Math.imul(T,rt)|0,i=(i=i+Math.imul(T,nt)|0)+Math.imul(L,rt)|0,o=o+Math.imul(L,nt)|0,n=n+Math.imul(B,ot)|0,i=(i=i+Math.imul(B,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,n=n+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,ct)|0)+Math.imul(E,ut)|0,o=o+Math.imul(E,ct)|0,n=n+Math.imul(_,lt)|0,i=(i=i+Math.imul(_,dt)|0)+Math.imul(A,lt)|0,o=o+Math.imul(A,dt)|0;var xt=(c+(n=n+Math.imul(v,pt)|0)|0)+((8191&(i=(i=i+Math.imul(v,mt)|0)+Math.imul(k,pt)|0))<<13)|0;c=((o=o+Math.imul(k,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(z,Q),i=(i=Math.imul(z,tt))+Math.imul(K,Q)|0,o=Math.imul(K,tt),n=n+Math.imul(C,rt)|0,i=(i=i+Math.imul(C,nt)|0)+Math.imul(U,rt)|0,o=o+Math.imul(U,nt)|0,n=n+Math.imul(T,ot)|0,i=(i=i+Math.imul(T,st)|0)+Math.imul(L,ot)|0,o=o+Math.imul(L,st)|0,n=n+Math.imul(B,ut)|0,i=(i=i+Math.imul(B,ct)|0)+Math.imul(P,ut)|0,o=o+Math.imul(P,ct)|0,n=n+Math.imul(I,lt)|0,i=(i=i+Math.imul(I,dt)|0)+Math.imul(E,lt)|0,o=o+Math.imul(E,dt)|0;var Bt=(c+(n=n+Math.imul(_,pt)|0)|0)+((8191&(i=(i=i+Math.imul(_,mt)|0)+Math.imul(A,pt)|0))<<13)|0;c=((o=o+Math.imul(A,mt)|0)+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,n=Math.imul(z,rt),i=(i=Math.imul(z,nt))+Math.imul(K,rt)|0,o=Math.imul(K,nt),n=n+Math.imul(C,ot)|0,i=(i=i+Math.imul(C,st)|0)+Math.imul(U,ot)|0,o=o+Math.imul(U,st)|0,n=n+Math.imul(T,ut)|0,i=(i=i+Math.imul(T,ct)|0)+Math.imul(L,ut)|0,o=o+Math.imul(L,ct)|0,n=n+Math.imul(B,lt)|0,i=(i=i+Math.imul(B,dt)|0)+Math.imul(P,lt)|0,o=o+Math.imul(P,dt)|0;var Pt=(c+(n=n+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,mt)|0)+Math.imul(E,pt)|0))<<13)|0;c=((o=o+Math.imul(E,mt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(z,ot),i=(i=Math.imul(z,st))+Math.imul(K,ot)|0,o=Math.imul(K,st),n=n+Math.imul(C,ut)|0,i=(i=i+Math.imul(C,ct)|0)+Math.imul(U,ut)|0,o=o+Math.imul(U,ct)|0,n=n+Math.imul(T,lt)|0,i=(i=i+Math.imul(T,dt)|0)+Math.imul(L,lt)|0,o=o+Math.imul(L,dt)|0;var Rt=(c+(n=n+Math.imul(B,pt)|0)|0)+((8191&(i=(i=i+Math.imul(B,mt)|0)+Math.imul(P,pt)|0))<<13)|0;c=((o=o+Math.imul(P,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(z,ut),i=(i=Math.imul(z,ct))+Math.imul(K,ut)|0,o=Math.imul(K,ct),n=n+Math.imul(C,lt)|0,i=(i=i+Math.imul(C,dt)|0)+Math.imul(U,lt)|0,o=o+Math.imul(U,dt)|0;var Tt=(c+(n=n+Math.imul(T,pt)|0)|0)+((8191&(i=(i=i+Math.imul(T,mt)|0)+Math.imul(L,pt)|0))<<13)|0;c=((o=o+Math.imul(L,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(z,lt),i=(i=Math.imul(z,dt))+Math.imul(K,lt)|0,o=Math.imul(K,dt);var Lt=(c+(n=n+Math.imul(C,pt)|0)|0)+((8191&(i=(i=i+Math.imul(C,mt)|0)+Math.imul(U,pt)|0))<<13)|0;c=((o=o+Math.imul(U,mt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863;var Ot=(c+(n=Math.imul(z,pt))|0)+((8191&(i=(i=Math.imul(z,mt))+Math.imul(K,pt)|0))<<13)|0;return c=((o=Math.imul(K,mt))+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,u[0]=gt,u[1]=yt,u[2]=wt,u[3]=bt,u[4]=vt,u[5]=kt,u[6]=St,u[7]=_t,u[8]=At,u[9]=Mt,u[10]=It,u[11]=Et,u[12]=xt,u[13]=Bt,u[14]=Pt,u[15]=Rt,u[16]=Tt,u[17]=Lt,u[18]=Ot,0!==c&&(u[19]=c,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,o=0;o<r.length-1;o++){var s=i;i=0;for(var a=67108863&n,u=Math.min(o,e.length-1),c=Math.max(0,o-t.length+1);c<=u;c++){var h=o-c,l=(0|t.words[h])*(0|e.words[c]),d=67108863&l;a=67108863&(d=d+a|0),i+=(s=(s=s+(l/67108864|0)|0)+(d>>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r._strip()}function w(t,e,r){return y(t,e,r)}Math.imul||(g=m),o.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?g(this,t,e):r<63?m(this,t,e):r<1024?y(this,t,e):w(this,t,e)},o.prototype.mul=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},o.prototype.mulf=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),w(this,t,e)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.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 o=(0|this.words[i])*t,s=(67108863&o)+(67108863&r);r>>=26,r+=o/67108864|0,r+=s>>>26,this.words[i]=67108863&s}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.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 o(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},o.prototype.iushln=function(t){n("number"==typeof t&&t>=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,u=(0|this.words[e])-a<<r;this.words[e]=u|s,s=a>>>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()},o.prototype.ishln=function(t){return n(0===this.negative),this.iushln(t)},o.prototype.iushrn=function(t,e,r){var i;n("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,u=r;if(i-=s,i=Math.max(0,i),u){for(var c=0;c<s;c++)u.words[c]=this.words[c];u.length=s}if(0===s);else if(this.length>s)for(this.length-=s,c=0;c<this.length;c++)this.words[c]=this.words[c+s];else this.words[0]=0,this.length=1;var h=0;for(c=this.length-1;c>=0&&(0!==h||c>=i);c--){var l=0|this.words[c];this.words[c]=h<<26-o|l>>>o,h=l&a}return u&&0!==h&&(u.words[u.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.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))},o.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()},o.prototype.maskn=function(t){return this.clone().imaskn(t)},o.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)},o.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},o.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()},o.prototype.addn=function(t){return this.clone().iaddn(t)},o.prototype.subn=function(t){return this.clone().isubn(t)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(t,e,r){var i,o,s=t.length+r;this._expand(s);var a=0;for(i=0;i<t.length;i++){o=(0|this.words[i+r])+a;var u=(0|t.words[i])*e;a=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i<this.length-r;i++)a=(o=(0|this.words[i+r])+a)>>26,this.words[i+r]=67108863&o;if(0===a)return this._strip();for(n(-1===a),a=0,i=0;i<this.length;i++)a=(o=-(0|this.words[i])+a)>>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},o.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 a,u=n.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var c=0;c<a.length;c++)a.words[c]=0}var h=n.clone()._ishlnsubmul(i,1,u);0===h.negative&&(n=h,a&&(a.words[u]=1));for(var l=u-1;l>=0;l--){var d=67108864*(0|n.words[i.length+l])+(0|n.words[i.length+l-1]);for(d=Math.min(d/s|0,67108863),n._ishlnsubmul(i,d,l);0!==n.negative;)d--,n.negative=0,n._ishlnsubmul(i,1,l),n.isZero()||(n.negative^=1);a&&(a.words[l]=d)}return a&&a._strip(),n._strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modrn(t.words[0]))}:this._wordDiv(t,e);var i,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.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),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modrn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%t;return e?-i:i},o.prototype.modn=function(t){return this.modrn(t)},o.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 o=(0|this.words[i])+67108864*r;this.words[i]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},o.prototype.divn=function(t){return this.clone().idivn(t)},o.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 o(1),s=new o(0),a=new o(0),u=new o(1),c=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++c;for(var h=r.clone(),l=e.clone();!e.isZero();){for(var d=0,f=1;0==(e.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(h),s.isub(l)),i.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(h),u.isub(l)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),s.isub(u)):(r.isub(e),a.isub(i),u.isub(s))}return{a:a,b:u,gcd:r.iushln(c)}},o.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 o(1),a=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,h=1;0==(e.words[0]&h)&&c<26;++c,h<<=1);if(c>0)for(e.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var l=0,d=1;0==(r.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(r.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(t),i},o.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 o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.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 o=i,s=r;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.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},o.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},o.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},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new M(t)},o.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)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var b={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function k(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function S(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function A(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function M(t){if("string"==typeof t){var e=o._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 I(t){M.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(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)}v.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.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},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},i(k,v),k.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 o=t.words[9];for(e.words[e.length++]=o&r,i=10;i<t.length;i++){var s=0|t.words[i];t.words[i-10]=(s&r)<<4|o>>>22,o=s}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},k.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(S,v),i(_,v),i(A,v),A.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},o._prime=function(t){if(b[t])return b[t];var e;if("k256"===t)e=new k;else if("p224"===t)e=new S;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new A}return b[t]=e,e},M.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},M.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")},M.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(h(t,t.umod(this.m)._forceRed(this)),t)},M.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},M.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)},M.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},M.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)},M.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},M.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},M.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},M.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},M.prototype.isqr=function(t){return this.imul(t,t.clone())},M.prototype.sqr=function(t){return this.mul(t,t)},M.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 o(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 a=new o(1).toRed(this),u=a.redNeg(),c=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new o(2*h*h).toRed(this);0!==this.pow(h,c).cmp(u);)h.redIAdd(u);for(var l=this.pow(h,i),d=this.pow(t,i.addn(1).iushrn(1)),f=this.pow(t,i),p=s;0!==f.cmp(a);){for(var m=f,g=0;0!==m.cmp(a);g++)m=m.redSqr();n(g<p);var y=this.pow(l,new o(1).iushln(p-g-1));d=d.redMul(y),l=y.redSqr(),f=f.redMul(l),p=g}return d},M.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},M.prototype.pow=function(t,e){if(e.isZero())return new o(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new o(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,a=0,u=e.bitLength()%26;for(0===u&&(u=26),n=e.length-1;n>=0;n--){for(var c=e.words[n],h=u-1;h>=0;h--){var l=c>>h&1;i!==r[0]&&(i=this.sqr(i)),0!==l||0!==s?(s<<=1,s|=l,(4==++a||0===n&&0===h)&&(i=this.mul(i,r[s]),a=0,s=0)):a=0}u=26}return i},M.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},M.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new I(t)},i(I,M),I.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},I.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},I.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),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},I.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(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)},I.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(Ut,t.commonjsGlobal);var Kt=-1;function Wt(t){this.tokens=[].slice.call(t)}Wt.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():Kt},prepend:function(t){if(Array.isArray(t))for(var e=t;e.length;)this.tokens.unshift(e.pop());else this.tokens.unshift(t)},push:function(t){if(Array.isArray(t))for(var e=t;e.length;)this.tokens.push(e.shift());else this.tokens.push(t)}};var qt=-1;function Dt(t,e){if(t)throw TypeError("Decoder error");return e||65533}var jt="utf-8";function Ht(t,e){if(!(this instanceof Ht))return new Ht(t,e);if((t=void 0!==t?String(t).toLowerCase():jt)!==jt)throw new Error("Encoding not supported. Only utf-8 is supported");e=zt(e),this._streaming=!1,this._BOMseen=!1,this._decoder=null,this._fatal=Boolean(e.fatal),this._ignoreBOM=Boolean(e.ignoreBOM),Object.defineProperty(this,"encoding",{value:"utf-8"}),Object.defineProperty(this,"fatal",{value:this._fatal}),Object.defineProperty(this,"ignoreBOM",{value:this._ignoreBOM})}function Ft(t,e){if(!(this instanceof Ft))return new Ft(t,e);if((t=void 0!==t?String(t).toLowerCase():jt)!==jt)throw new Error("Encoding not supported. Only utf-8 is supported");e=zt(e),this._streaming=!1,this._encoder=null,this._options={fatal:Boolean(e.fatal)},Object.defineProperty(this,"encoding",{value:"utf-8"})}function $t(t){var e=t.fatal,r=0,n=0,i=0,o=128,s=191;this.handler=function(t,a){if(a===Kt&&0!==i)return i=0,Dt(e);if(a===Kt)return qt;if(0===i){if(Nt(a,0,127))return a;if(Nt(a,194,223))i=1,r=a-192;else if(Nt(a,224,239))224===a&&(o=160),237===a&&(s=159),i=2,r=a-224;else{if(!Nt(a,240,244))return Dt(e);240===a&&(o=144),244===a&&(s=143),i=3,r=a-240}return r<<=6*i,null}if(!Nt(a,o,s))return r=i=n=0,o=128,s=191,t.prepend(a),Dt(e);if(o=128,s=191,r+=a-128<<6*(i-(n+=1)),n!==i)return null;var u=r;return r=i=n=0,u}}function Vt(t){t.fatal,this.handler=function(t,e){if(e===Kt)return qt;if(Nt(e,0,127))return e;var r,n;Nt(e,128,2047)?(r=1,n=192):Nt(e,2048,65535)?(r=2,n=224):Nt(e,65536,1114111)&&(r=3,n=240);for(var i=[(e>>6*r)+n];r>0;){var o=e>>6*(r-1);i.push(128|63&o),r-=1}return i}}Ht.prototype={decode:function(t,e){var r;r="object"==typeof t&&t instanceof ArrayBuffer?new Uint8Array(t):"object"==typeof t&&"buffer"in t&&t.buffer instanceof ArrayBuffer?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):new Uint8Array(0),e=zt(e),this._streaming||(this._decoder=new $t({fatal:this._fatal}),this._BOMseen=!1),this._streaming=Boolean(e.stream);for(var n,i=new Wt(r),o=[];!i.endOfStream()&&(n=this._decoder.handler(i,i.read()))!==qt;)null!==n&&(Array.isArray(n)?o.push.apply(o,n):o.push(n));if(!this._streaming){do{if((n=this._decoder.handler(i,i.read()))===qt)break;null!==n&&(Array.isArray(n)?o.push.apply(o,n):o.push(n))}while(!i.endOfStream());this._decoder=null}return o.length&&(-1===["utf-8"].indexOf(this.encoding)||this._ignoreBOM||this._BOMseen||(65279===o[0]?(this._BOMseen=!0,o.shift()):this._BOMseen=!0)),function(t){for(var e="",r=0;r<t.length;++r){var n=t[r];n<=65535?e+=String.fromCharCode(n):(n-=65536,e+=String.fromCharCode(55296+(n>>10),56320+(1023&n)))}return e}(o)}},Ft.prototype={encode:function(t,e){t=t?String(t):"",e=zt(e),this._streaming||(this._encoder=new Vt(this._options)),this._streaming=Boolean(e.stream);for(var r,n=[],i=new Wt(function(t){for(var e=String(t),r=e.length,n=0,i=[];n<r;){var o=e.charCodeAt(n);if(o<55296||o>57343)i.push(o);else if(56320<=o&&o<=57343)i.push(65533);else if(55296<=o&&o<=56319)if(n===r-1)i.push(65533);else{var s=t.charCodeAt(n+1);if(56320<=s&&s<=57343){var a=1023&o,u=1023&s;i.push(65536+(a<<10)+u),n+=1}else i.push(65533)}n+=1}return i}(t));!i.endOfStream()&&(r=this._encoder.handler(i,i.read()))!==qt;)Array.isArray(r)?n.push.apply(n,r):n.push(r);if(!this._streaming){for(;(r=this._encoder.handler(i,i.read()))!==qt;)Array.isArray(r)?n.push.apply(n,r):n.push(r);this._encoder=null}return new Uint8Array(n)}};var Gt=Object.freeze({__proto__:null,TextEncoder:Ft,TextDecoder:Ht}),Zt=t.getAugmentedNamespace(Gt),Yt=t.commonjsGlobal&&t.commonjsGlobal.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),Jt=t.commonjsGlobal&&t.commonjsGlobal.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Xt=t.commonjsGlobal&&t.commonjsGlobal.__decorate||function(t,e,r,n){var i,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(s=(o<3?i(s):o>3?i(e,r,s):i(e,r))||s);return o>3&&s&&Object.defineProperty(e,r,s),s},Qt=t.commonjsGlobal&&t.commonjsGlobal.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.hasOwnProperty.call(t,r)&&Yt(e,t,r);return Jt(e,t),e},te=t.commonjsGlobal&&t.commonjsGlobal.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ct,"__esModule",{value:!0});var ee=Ct.deserializeUnchecked=ye=Ct.deserialize=pe=Ct.serialize=Ct.BinaryReader=Ct.BinaryWriter=Ct.BorshError=Ct.baseDecode=Ct.baseEncode=void 0;const re=te(Ut.exports),ne=te(Et),ie=Qt(Zt),oe=new("function"!=typeof TextDecoder?ie.TextDecoder:TextDecoder)("utf-8",{fatal:!0});Ct.baseEncode=function(t){return"string"==typeof t&&(t=Buffer.from(t,"utf8")),ne.default.encode(Buffer.from(t))},Ct.baseDecode=function(t){return Buffer.from(ne.default.decode(t))};const se=1024;class ae extends Error{constructor(t){super(t),this.fieldPath=[],this.originalMessage=t}addToFieldPath(t){this.fieldPath.splice(0,0,t),this.message=this.originalMessage+": "+this.fieldPath.join(".")}}Ct.BorshError=ae;class ue{constructor(){this.buf=Buffer.alloc(se),this.length=0}maybeResize(){this.buf.length<16+this.length&&(this.buf=Buffer.concat([this.buf,Buffer.alloc(se)]))}writeU8(t){this.maybeResize(),this.buf.writeUInt8(t,this.length),this.length+=1}writeU16(t){this.maybeResize(),this.buf.writeUInt16LE(t,this.length),this.length+=2}writeU32(t){this.maybeResize(),this.buf.writeUInt32LE(t,this.length),this.length+=4}writeU64(t){this.maybeResize(),this.writeBuffer(Buffer.from(new re.default(t).toArray("le",8)))}writeU128(t){this.maybeResize(),this.writeBuffer(Buffer.from(new re.default(t).toArray("le",16)))}writeU256(t){this.maybeResize(),this.writeBuffer(Buffer.from(new re.default(t).toArray("le",32)))}writeU512(t){this.maybeResize(),this.writeBuffer(Buffer.from(new re.default(t).toArray("le",64)))}writeBuffer(t){this.buf=Buffer.concat([Buffer.from(this.buf.subarray(0,this.length)),t,Buffer.alloc(se)]),this.length+=t.length}writeString(t){this.maybeResize();const e=Buffer.from(t,"utf8");this.writeU32(e.length),this.writeBuffer(e)}writeFixedArray(t){this.writeBuffer(Buffer.from(t))}writeArray(t,e){this.maybeResize(),this.writeU32(t.length);for(const r of t)this.maybeResize(),e(r)}toArray(){return this.buf.subarray(0,this.length)}}function ce(t,e,r){const n=r.value;r.value=function(...t){try{return n.apply(this,t)}catch(t){if(t instanceof RangeError){const e=t.code;if(["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(e)>=0)throw new ae("Reached the end of buffer when deserializing")}throw t}}}Ct.BinaryWriter=ue;class he{constructor(t){this.buf=t,this.offset=0}readU8(){const t=this.buf.readUInt8(this.offset);return this.offset+=1,t}readU16(){const t=this.buf.readUInt16LE(this.offset);return this.offset+=2,t}readU32(){const t=this.buf.readUInt32LE(this.offset);return this.offset+=4,t}readU64(){const t=this.readBuffer(8);return new re.default(t,"le")}readU128(){const t=this.readBuffer(16);return new re.default(t,"le")}readU256(){const t=this.readBuffer(32);return new re.default(t,"le")}readU512(){const t=this.readBuffer(64);return new re.default(t,"le")}readBuffer(t){if(this.offset+t>this.buf.length)throw new ae(`Expected buffer length ${t} isn't within bounds`);const e=this.buf.slice(this.offset,this.offset+t);return this.offset+=t,e}readString(){const t=this.readU32(),e=this.readBuffer(t);try{return oe.decode(e)}catch(t){throw new ae(`Error decoding UTF-8 string: ${t}`)}}readFixedArray(t){return new Uint8Array(this.readBuffer(t))}readArray(t){const e=this.readU32(),r=Array();for(let n=0;n<e;++n)r.push(t());return r}}function le(t){return t.charAt(0).toUpperCase()+t.slice(1)}function de(t,e,r,n,i){try{if("string"==typeof n)i[`write${le(n)}`](r);else if(n instanceof Array)if("number"==typeof n[0]){if(r.length!==n[0])throw new ae(`Expecting byte array of length ${n[0]}, but got ${r.length} bytes`);i.writeFixedArray(r)}else if(2===n.length&&"number"==typeof n[1]){if(r.length!==n[1])throw new ae(`Expecting byte array of length ${n[1]}, but got ${r.length} bytes`);for(let e=0;e<n[1];e++)de(t,null,r[e],n[0],i)}else i.writeArray(r,(r=>{de(t,e,r,n[0],i)}));else if(void 0!==n.kind)switch(n.kind){case"option":null==r?i.writeU8(0):(i.writeU8(1),de(t,e,r,n.type,i));break;case"map":i.writeU32(r.size),r.forEach(((r,o)=>{de(t,e,o,n.key,i),de(t,e,r,n.value,i)}));break;default:throw new ae(`FieldType ${n} unrecognized`)}else fe(t,r,i)}catch(t){throw t instanceof ae&&t.addToFieldPath(e),t}}function fe(t,e,r){if("function"==typeof e.borshSerialize)return void e.borshSerialize(r);const n=t.get(e.constructor);if(!n)throw new ae(`Class ${e.constructor.name} is missing in schema`);if("struct"===n.kind)n.fields.map((([n,i])=>{de(t,n,e[n],i,r)}));else{if("enum"!==n.kind)throw new ae(`Unexpected schema kind: ${n.kind} for ${e.constructor.name}`);{const i=e[n.field];for(let o=0;o<n.values.length;++o){const[s,a]=n.values[o];if(s===i){r.writeU8(o),de(t,s,e[s],a,r);break}}}}}Xt([ce],he.prototype,"readU8",null),Xt([ce],he.prototype,"readU16",null),Xt([ce],he.prototype,"readU32",null),Xt([ce],he.prototype,"readU64",null),Xt([ce],he.prototype,"readU128",null),Xt([ce],he.prototype,"readU256",null),Xt([ce],he.prototype,"readU512",null),Xt([ce],he.prototype,"readString",null),Xt([ce],he.prototype,"readFixedArray",null),Xt([ce],he.prototype,"readArray",null),Ct.BinaryReader=he;var pe=Ct.serialize=function(t,e,r=ue){const n=new r;return fe(t,e,n),n.toArray()};function me(t,e,r,n){try{if("string"==typeof r)return n[`read${le(r)}`]();if(r instanceof Array){if("number"==typeof r[0])return n.readFixedArray(r[0]);if("number"==typeof r[1]){const e=[];for(let i=0;i<r[1];i++)e.push(me(t,null,r[0],n));return e}return n.readArray((()=>me(t,e,r[0],n)))}if("option"===r.kind){return n.readU8()?me(t,e,r.type,n):void 0}if("map"===r.kind){let i=new Map;const o=n.readU32();for(let s=0;s<o;s++){const o=me(t,e,r.key,n),s=me(t,e,r.value,n);i.set(o,s)}return i}return ge(t,r,n)}catch(t){throw t instanceof ae&&t.addToFieldPath(e),t}}function ge(t,e,r){if("function"==typeof e.borshDeserialize)return e.borshDeserialize(r);const n=t.get(e);if(!n)throw new ae(`Class ${e.name} is missing in schema`);if("struct"===n.kind){const n={};for(const[i,o]of t.get(e).fields)n[i]=me(t,i,o,r);return new e(n)}if("enum"===n.kind){const i=r.readU8();if(i>=n.values.length)throw new ae(`Enum index: ${i} is out of range`);const[o,s]=n.values[i];return new e({[o]:me(t,o,s,r)})}throw new ae(`Unexpected schema kind: ${n.kind} for ${e.constructor.name}`)}var ye=Ct.deserialize=function(t,e,r,n=he){const i=new n(r),o=ge(t,e,i);if(i.offset<r.length)throw new ae(`Unexpected ${r.length-i.offset} bytes after deserialized data`);return o};ee=Ct.deserializeUnchecked=function(t,e,r,n=he){return ge(t,e,new n(r))};var we={};Object.defineProperty(we,"__esModule",{value:!0}),we.s16=we.s8=we.nu64be=we.u48be=we.u40be=we.u32be=we.u24be=we.u16be=sr=we.nu64=we.u48=we.u40=or=we.u32=we.u24=ir=we.u16=nr=we.u8=rr=we.offset=we.greedy=we.Constant=we.UTF8=we.CString=we.Blob=we.Boolean=we.BitField=we.BitStructure=we.VariantLayout=we.Union=we.UnionLayoutDiscriminator=we.UnionDiscriminator=we.Structure=we.Sequence=we.DoubleBE=we.Double=we.FloatBE=we.Float=we.NearInt64BE=we.NearInt64=we.NearUInt64BE=we.NearUInt64=we.IntBE=we.Int=we.UIntBE=we.UInt=we.OffsetLayout=we.GreedyCount=we.ExternalLayout=we.bindConstructorLayout=we.nameWithProperty=we.Layout=we.uint8ArrayToBuffer=we.checkUint8Array=void 0,we.constant=we.utf8=we.cstr=hr=we.blob=we.unionLayoutDiscriminator=we.union=cr=we.seq=we.bits=ur=we.struct=we.f64be=we.f64=we.f32be=we.f32=we.ns64be=we.s48be=we.s40be=we.s32be=we.s24be=we.s16be=ar=we.ns64=we.s48=we.s40=we.s32=we.s24=void 0;const be=o.default;function ve(t){if(!(t instanceof Uint8Array))throw new TypeError("b must be a Uint8Array")}function ke(t){return ve(t),be.Buffer.from(t.buffer,t.byteOffset,t.length)}we.checkUint8Array=ve,we.uint8ArrayToBuffer=ke;class Se{constructor(t,e){if(!Number.isInteger(t))throw new TypeError("span must be an integer");this.span=t,this.property=e}makeDestinationObject(){return{}}getSpan(t,e){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(t){const e=Object.create(this.constructor.prototype);return Object.assign(e,this),e.property=t,e}fromArray(t){}}function _e(t,e){return e.property?t+"["+e.property+"]":t}we.Layout=Se,we.nameWithProperty=_e,we.bindConstructorLayout=function(t,e){if("function"!=typeof t)throw new TypeError("Class must be constructor");if(Object.prototype.hasOwnProperty.call(t,"layout_"))throw new Error("Class is already bound to a layout");if(!(e&&e instanceof Se))throw new TypeError("layout must be a Layout");if(Object.prototype.hasOwnProperty.call(e,"boundConstructor_"))throw new Error("layout is already bound to a constructor");t.layout_=e,e.boundConstructor_=t,e.makeDestinationObject=()=>new t,Object.defineProperty(t.prototype,"encode",{value(t,r){return e.encode(this,t,r)},writable:!0}),Object.defineProperty(t,"decode",{value:(t,r)=>e.decode(t,r),writable:!0})};class Ae extends Se{isCount(){throw new Error("ExternalLayout is abstract")}}we.ExternalLayout=Ae;class Me extends Ae{constructor(t=1,e){if(!Number.isInteger(t)||0>=t)throw new TypeError("elementSpan must be a (positive) integer");super(-1,e),this.elementSpan=t}isCount(){return!0}decode(t,e=0){ve(t);const r=t.length-e;return Math.floor(r/this.elementSpan)}encode(t,e,r){return 0}}we.GreedyCount=Me;class Ie extends Ae{constructor(t,e=0,r){if(!(t instanceof Se))throw new TypeError("layout must be a Layout");if(!Number.isInteger(e))throw new TypeError("offset must be integer or undefined");super(t.span,r||t.property),this.layout=t,this.offset=e}isCount(){return this.layout instanceof Ee||this.layout instanceof xe}decode(t,e=0){return this.layout.decode(t,e+this.offset)}encode(t,e,r=0){return this.layout.encode(t,e,r+this.offset)}}we.OffsetLayout=Ie;class Ee extends Se{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e=0){return ke(t).readUIntLE(e,this.span)}encode(t,e,r=0){return ke(e).writeUIntLE(t,r,this.span),this.span}}we.UInt=Ee;class xe extends Se{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e=0){return ke(t).readUIntBE(e,this.span)}encode(t,e,r=0){return ke(e).writeUIntBE(t,r,this.span),this.span}}we.UIntBE=xe;class Be extends Se{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e=0){return ke(t).readIntLE(e,this.span)}encode(t,e,r=0){return ke(e).writeIntLE(t,r,this.span),this.span}}we.Int=Be;class Pe extends Se{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e=0){return ke(t).readIntBE(e,this.span)}encode(t,e,r=0){return ke(e).writeIntBE(t,r,this.span),this.span}}we.IntBE=Pe;const Re=Math.pow(2,32);function Te(t){const e=Math.floor(t/Re);return{hi32:e,lo32:t-e*Re}}function Le(t,e){return t*Re+e}class Oe extends Se{constructor(t){super(8,t)}decode(t,e=0){const r=ke(t),n=r.readUInt32LE(e);return Le(r.readUInt32LE(e+4),n)}encode(t,e,r=0){const n=Te(t),i=ke(e);return i.writeUInt32LE(n.lo32,r),i.writeUInt32LE(n.hi32,r+4),8}}we.NearUInt64=Oe;class Ce extends Se{constructor(t){super(8,t)}decode(t,e=0){const r=ke(t);return Le(r.readUInt32BE(e),r.readUInt32BE(e+4))}encode(t,e,r=0){const n=Te(t),i=ke(e);return i.writeUInt32BE(n.hi32,r),i.writeUInt32BE(n.lo32,r+4),8}}we.NearUInt64BE=Ce;class Ue extends Se{constructor(t){super(8,t)}decode(t,e=0){const r=ke(t),n=r.readUInt32LE(e);return Le(r.readInt32LE(e+4),n)}encode(t,e,r=0){const n=Te(t),i=ke(e);return i.writeUInt32LE(n.lo32,r),i.writeInt32LE(n.hi32,r+4),8}}we.NearInt64=Ue;class Ne extends Se{constructor(t){super(8,t)}decode(t,e=0){const r=ke(t);return Le(r.readInt32BE(e),r.readUInt32BE(e+4))}encode(t,e,r=0){const n=Te(t),i=ke(e);return i.writeInt32BE(n.hi32,r),i.writeUInt32BE(n.lo32,r+4),8}}we.NearInt64BE=Ne;class ze extends Se{constructor(t){super(4,t)}decode(t,e=0){return ke(t).readFloatLE(e)}encode(t,e,r=0){return ke(e).writeFloatLE(t,r),4}}we.Float=ze;class Ke extends Se{constructor(t){super(4,t)}decode(t,e=0){return ke(t).readFloatBE(e)}encode(t,e,r=0){return ke(e).writeFloatBE(t,r),4}}we.FloatBE=Ke;class We extends Se{constructor(t){super(8,t)}decode(t,e=0){return ke(t).readDoubleLE(e)}encode(t,e,r=0){return ke(e).writeDoubleLE(t,r),8}}we.Double=We;class qe extends Se{constructor(t){super(8,t)}decode(t,e=0){return ke(t).readDoubleBE(e)}encode(t,e,r=0){return ke(e).writeDoubleBE(t,r),8}}we.DoubleBE=qe;class De extends Se{constructor(t,e,r){if(!(t instanceof Se))throw new TypeError("elementLayout must be a Layout");if(!(e instanceof Ae&&e.isCount()||Number.isInteger(e)&&0<=e))throw new TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");let n=-1;!(e instanceof Ae)&&0<t.span&&(n=e*t.span),super(n,r),this.elementLayout=t,this.count=e}getSpan(t,e=0){if(0<=this.span)return this.span;let r=0,n=this.count;if(n instanceof Ae&&(n=n.decode(t,e)),0<this.elementLayout.span)r=n*this.elementLayout.span;else{let i=0;for(;i<n;)r+=this.elementLayout.getSpan(t,e+r),++i}return r}decode(t,e=0){const r=[];let n=0,i=this.count;for(i instanceof Ae&&(i=i.decode(t,e));n<i;)r.push(this.elementLayout.decode(t,e)),e+=this.elementLayout.getSpan(t,e),n+=1;return r}encode(t,e,r=0){const n=this.elementLayout,i=t.reduce(((t,i)=>t+n.encode(i,e,r+t)),0);return this.count instanceof Ae&&this.count.encode(t.length,e,r),i}}we.Sequence=De;class je extends Se{constructor(t,e,r){if(!Array.isArray(t)||!t.reduce(((t,e)=>t&&e instanceof Se),!0))throw new TypeError("fields must be array of Layout instances");"boolean"==typeof e&&void 0===r&&(r=e,e=void 0);for(const e of t)if(0>e.span&&void 0===e.property)throw new Error("fields cannot contain unnamed variable-length layout");let n=-1;try{n=t.reduce(((t,e)=>t+e.getSpan()),0)}catch(t){}super(n,e),this.fields=t,this.decodePrefixes=!!r}getSpan(t,e=0){if(0<=this.span)return this.span;let r=0;try{r=this.fields.reduce(((r,n)=>{const i=n.getSpan(t,e);return e+=i,r+i}),0)}catch(t){throw new RangeError("indeterminate span")}return r}decode(t,e=0){ve(t);const r=this.makeDestinationObject();for(const n of this.fields)if(void 0!==n.property&&(r[n.property]=n.decode(t,e)),e+=n.getSpan(t,e),this.decodePrefixes&&t.length===e)break;return r}encode(t,e,r=0){const n=r;let i=0,o=0;for(const n of this.fields){let s=n.span;if(o=0<s?s:0,void 0!==n.property){const i=t[n.property];void 0!==i&&(o=n.encode(i,e,r),0>s&&(s=n.getSpan(e,r)))}i=r,r+=s}return i+o-n}fromArray(t){const e=this.makeDestinationObject();for(const r of this.fields)void 0!==r.property&&0<t.length&&(e[r.property]=t.shift());return e}layoutFor(t){if("string"!=typeof t)throw new TypeError("property must be string");for(const e of this.fields)if(e.property===t)return e}offsetOf(t){if("string"!=typeof t)throw new TypeError("property must be string");let e=0;for(const r of this.fields){if(r.property===t)return e;0>r.span?e=-1:0<=e&&(e+=r.span)}}}we.Structure=je;class He{constructor(t){this.property=t}decode(t,e){throw new Error("UnionDiscriminator is abstract")}encode(t,e,r){throw new Error("UnionDiscriminator is abstract")}}we.UnionDiscriminator=He;class Fe extends He{constructor(t,e){if(!(t instanceof Ae&&t.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(e||t.property||"variant"),this.layout=t}decode(t,e){return this.layout.decode(t,e)}encode(t,e,r){return this.layout.encode(t,e,r)}}we.UnionLayoutDiscriminator=Fe;class $e extends Se{constructor(t,e,r){let n;if(t instanceof Ee||t instanceof xe)n=new Fe(new Ie(t));else if(t instanceof Ae&&t.isCount())n=new Fe(t);else{if(!(t instanceof He))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");n=t}if(void 0===e&&(e=null),!(null===e||e instanceof Se))throw new TypeError("defaultLayout must be null or a Layout");if(null!==e){if(0>e.span)throw new Error("defaultLayout must have constant span");void 0===e.property&&(e=e.replicate("content"))}let i=-1;e&&(i=e.span,0<=i&&(t instanceof Ee||t instanceof xe)&&(i+=n.layout.span)),super(i,r),this.discriminator=n,this.usesPrefixDiscriminator=t instanceof Ee||t instanceof xe,this.defaultLayout=e,this.registry={};let o=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(t){return o(t)},this.configGetSourceVariant=function(t){o=t.bind(this)}}getSpan(t,e=0){if(0<=this.span)return this.span;const r=this.getVariant(t,e);if(!r)throw new Error("unable to determine span for unrecognized variant");return r.getSpan(t,e)}defaultGetSourceVariant(t){if(Object.prototype.hasOwnProperty.call(t,this.discriminator.property)){if(this.defaultLayout&&this.defaultLayout.property&&Object.prototype.hasOwnProperty.call(t,this.defaultLayout.property))return;const e=this.registry[t[this.discriminator.property]];if(e&&(!e.layout||e.property&&Object.prototype.hasOwnProperty.call(t,e.property)))return e}else for(const e in this.registry){const r=this.registry[e];if(r.property&&Object.prototype.hasOwnProperty.call(t,r.property))return r}throw new Error("unable to infer src variant")}decode(t,e=0){let r;const n=this.discriminator,i=n.decode(t,e),o=this.registry[i];if(void 0===o){const o=this.defaultLayout;let s=0;this.usesPrefixDiscriminator&&(s=n.layout.span),r=this.makeDestinationObject(),r[n.property]=i,r[o.property]=o.decode(t,e+s)}else r=o.decode(t,e);return r}encode(t,e,r=0){const n=this.getSourceVariant(t);if(void 0===n){const n=this.discriminator,i=this.defaultLayout;let o=0;return this.usesPrefixDiscriminator&&(o=n.layout.span),n.encode(t[n.property],e,r),o+i.encode(t[i.property],e,r+o)}return n.encode(t,e,r)}addVariant(t,e,r){const n=new Ve(this,t,e,r);return this.registry[t]=n,n}getVariant(t,e=0){let r;return r=t instanceof Uint8Array?this.discriminator.decode(t,e):t,this.registry[r]}}we.Union=$e;class Ve extends Se{constructor(t,e,r,n){if(!(t instanceof $e))throw new TypeError("union must be a Union");if(!Number.isInteger(e)||0>e)throw new TypeError("variant must be a (non-negative) integer");if("string"==typeof r&&void 0===n&&(n=r,r=null),r){if(!(r instanceof Se))throw new TypeError("layout must be a Layout");if(null!==t.defaultLayout&&0<=r.span&&r.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if("string"!=typeof n)throw new TypeError("variant must have a String property")}let i=t.span;0>t.span&&(i=r?r.span:0,0<=i&&t.usesPrefixDiscriminator&&(i+=t.discriminator.layout.span)),super(i,n),this.union=t,this.variant=e,this.layout=r||null}getSpan(t,e=0){if(0<=this.span)return this.span;let r=0;this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span);let n=0;return this.layout&&(n=this.layout.getSpan(t,e+r)),r+n}decode(t,e=0){const r=this.makeDestinationObject();if(this!==this.union.getVariant(t,e))throw new Error("variant mismatch");let n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),this.layout?r[this.property]=this.layout.decode(t,e+n):this.property?r[this.property]=!0:this.union.usesPrefixDiscriminator&&(r[this.union.discriminator.property]=this.variant),r}encode(t,e,r=0){let n=0;if(this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),this.layout&&!Object.prototype.hasOwnProperty.call(t,this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,e,r);let i=n;if(this.layout&&(this.layout.encode(t[this.property],e,r+n),i+=this.layout.getSpan(e,r+n),0<=this.union.span&&i>this.union.span))throw new Error("encoded variant overruns containing union");return i}fromArray(t){if(this.layout)return this.layout.fromArray(t)}}function Ge(t){return 0>t&&(t+=4294967296),t}we.VariantLayout=Ve;class Ze extends Se{constructor(t,e,r){if(!(t instanceof Ee||t instanceof xe))throw new TypeError("word must be a UInt or UIntBE layout");if("string"==typeof e&&void 0===r&&(r=e,e=!1),4<t.span)throw new RangeError("word cannot exceed 32 bits");super(t.span,r),this.word=t,this.msb=!!e,this.fields=[];let n=0;this._packedSetValue=function(t){return n=Ge(t),this},this._packedGetValue=function(){return n}}decode(t,e=0){const r=this.makeDestinationObject(),n=this.word.decode(t,e);this._packedSetValue(n);for(const e of this.fields)void 0!==e.property&&(r[e.property]=e.decode(t));return r}encode(t,e,r=0){const n=this.word.decode(e,r);this._packedSetValue(n);for(const e of this.fields)if(void 0!==e.property){const r=t[e.property];void 0!==r&&e.encode(r)}return this.word.encode(this._packedGetValue(),e,r)}addField(t,e){const r=new Ye(this,t,e);return this.fields.push(r),r}addBoolean(t){const e=new Je(this,t);return this.fields.push(e),e}fieldFor(t){if("string"!=typeof t)throw new TypeError("property must be string");for(const e of this.fields)if(e.property===t)return e}}we.BitStructure=Ze;class Ye{constructor(t,e,r){if(!(t instanceof Ze))throw new TypeError("container must be a BitStructure");if(!Number.isInteger(e)||0>=e)throw new TypeError("bits must be positive integer");const n=8*t.span,i=t.fields.reduce(((t,e)=>t+e.bits),0);if(e+i>n)throw new Error("bits too long for span remainder ("+(n-i)+" of "+n+" remain)");this.container=t,this.bits=e,this.valueMask=(1<<e)-1,32===e&&(this.valueMask=4294967295),this.start=i,this.container.msb&&(this.start=n-i-e),this.wordMask=Ge(this.valueMask<<this.start),this.property=r}decode(t,e){return Ge(this.container._packedGetValue()&this.wordMask)>>>this.start}encode(t){if("number"!=typeof t||!Number.isInteger(t)||t!==Ge(t&this.valueMask))throw new TypeError(_e("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const e=this.container._packedGetValue(),r=Ge(t<<this.start);this.container._packedSetValue(Ge(e&~this.wordMask)|r)}}we.BitField=Ye;class Je extends Ye{constructor(t,e){super(t,1,e)}decode(t,e){return!!super.decode(t,e)}encode(t){"boolean"==typeof t&&(t=+t),super.encode(t)}}we.Boolean=Je;class Xe extends Se{constructor(t,e){if(!(t instanceof Ae&&t.isCount()||Number.isInteger(t)&&0<=t))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");let r=-1;t instanceof Ae||(r=t),super(r,e),this.length=t}getSpan(t,e){let r=this.span;return 0>r&&(r=this.length.decode(t,e)),r}decode(t,e=0){let r=this.span;return 0>r&&(r=this.length.decode(t,e)),ke(t).slice(e,e+r)}encode(t,e,r){let n=this.length;if(this.length instanceof Ae&&(n=t.length),!(t instanceof Uint8Array&&n===t.length))throw new TypeError(_e("Blob.encode",this)+" requires (length "+n+") Uint8Array as src");if(r+n>e.length)throw new RangeError("encoding overruns Uint8Array");const i=ke(t);return ke(e).write(i.toString("hex"),r,n,"hex"),this.length instanceof Ae&&this.length.encode(n,e,r),n}}we.Blob=Xe;class Qe extends Se{constructor(t){super(-1,t)}getSpan(t,e=0){ve(t);let r=e;for(;r<t.length&&0!==t[r];)r+=1;return 1+r-e}decode(t,e=0){const r=this.getSpan(t,e);return ke(t).slice(e,e+r-1).toString("utf-8")}encode(t,e,r=0){"string"!=typeof t&&(t=String(t));const n=be.Buffer.from(t,"utf8"),i=n.length;if(r+i>e.length)throw new RangeError("encoding overruns Buffer");const o=ke(e);return n.copy(o,r),o[r+i]=0,i+1}}we.CString=Qe;class tr extends Se{constructor(t,e){if("string"==typeof t&&void 0===e&&(e=t,t=void 0),void 0===t)t=-1;else if(!Number.isInteger(t))throw new TypeError("maxSpan must be an integer");super(-1,e),this.maxSpan=t}getSpan(t,e=0){return ve(t),t.length-e}decode(t,e=0){const r=this.getSpan(t,e);if(0<=this.maxSpan&&this.maxSpan<r)throw new RangeError("text length exceeds maxSpan");return ke(t).slice(e,e+r).toString("utf-8")}encode(t,e,r=0){"string"!=typeof t&&(t=String(t));const n=be.Buffer.from(t,"utf8"),i=n.length;if(0<=this.maxSpan&&this.maxSpan<i)throw new RangeError("text length exceeds maxSpan");if(r+i>e.length)throw new RangeError("encoding overruns Buffer");return n.copy(ke(e),r),i}}we.UTF8=tr;class er extends Se{constructor(t,e){super(0,e),this.value=t}decode(t,e){return this.value}encode(t,e,r){return 0}}we.Constant=er,we.greedy=(t,e)=>new Me(t,e);var rr=we.offset=(t,e,r)=>new Ie(t,e,r),nr=we.u8=t=>new Ee(1,t),ir=we.u16=t=>new Ee(2,t);we.u24=t=>new Ee(3,t);var or=we.u32=t=>new Ee(4,t);we.u40=t=>new Ee(5,t),we.u48=t=>new Ee(6,t);var sr=we.nu64=t=>new Oe(t);we.u16be=t=>new xe(2,t),we.u24be=t=>new xe(3,t),we.u32be=t=>new xe(4,t),we.u40be=t=>new xe(5,t),we.u48be=t=>new xe(6,t),we.nu64be=t=>new Ce(t),we.s8=t=>new Be(1,t),we.s16=t=>new Be(2,t),we.s24=t=>new Be(3,t),we.s32=t=>new Be(4,t),we.s40=t=>new Be(5,t),we.s48=t=>new Be(6,t);var ar=we.ns64=t=>new Ue(t);we.s16be=t=>new Pe(2,t),we.s24be=t=>new Pe(3,t),we.s32be=t=>new Pe(4,t),we.s40be=t=>new Pe(5,t),we.s48be=t=>new Pe(6,t),we.ns64be=t=>new Ne(t),we.f32=t=>new ze(t),we.f32be=t=>new Ke(t),we.f64=t=>new We(t),we.f64be=t=>new qe(t);var ur=we.struct=(t,e,r)=>new je(t,e,r);we.bits=(t,e,r)=>new Ze(t,e,r);var cr=we.seq=(t,e,r)=>new De(t,e,r);we.union=(t,e,r)=>new $e(t,e,r),we.unionLayoutDiscriminator=(t,e)=>new Fe(t,e);var hr=we.blob=(t,e)=>new Xe(t,e);we.cstr=t=>new Qe(t),we.utf8=(t,e)=>new tr(t,e),we.constant=(t,e)=>new er(t,e);var lr={};Object.defineProperty(lr,"__esModule",{value:!0});var dr=lr.toBigIntLE=function(t){{const e=Buffer.from(t);e.reverse();const r=e.toString("hex");return 0===r.length?BigInt(0):BigInt(`0x${r}`)}};lr.toBigIntBE=function(t){{const e=t.toString("hex");return 0===e.length?BigInt(0):BigInt(`0x${e}`)}};var fr,pr=lr.toBufferLE=function(t,e){{const r=t.toString(16),n=Buffer.from(r.padStart(2*e,"0").slice(0,2*e),"hex");return n.reverse(),n}};lr.toBufferBE=function(t,e){{const r=t.toString(16);return Buffer.from(r.padStart(2*e,"0").slice(0,2*e),"hex")}};class mr extends TypeError{constructor(t,e){let r;const{message:n,...i}=t,{path:o}=t;super(0===o.length?n:"At path: "+o.join(".")+" -- "+n),Object.assign(this,i),this.name=this.constructor.name,this.failures=()=>{var n;return null!=(n=r)?n:r=[t,...e()]}}}function gr(t){return"object"==typeof t&&null!=t}function yr(t){return"string"==typeof t?JSON.stringify(t):""+t}function wr(t,e,r,n){if(!0===t)return;!1===t?t={}:"string"==typeof t&&(t={message:t});const{path:i,branch:o}=e,{type:s}=r,{refinement:a,message:u="Expected a value of type `"+s+"`"+(a?" with refinement `"+a+"`":"")+", but received: `"+yr(n)+"`"}=t;return{value:n,type:s,refinement:a,key:i[i.length-1],path:i,branch:o,...t,message:u}}function*br(t,e,r,n){var i;gr(i=t)&&"function"==typeof i[Symbol.iterator]||(t=[t]);for(const i of t){const t=wr(i,e,r,n);t&&(yield t)}}function*vr(t,e,r={}){const{path:n=[],branch:i=[t],coerce:o=!1,mask:s=!1}=r,a={path:n,branch:i};if(o&&(t=e.coercer(t,a),s&&"type"!==e.type&&gr(e.schema)&&gr(t)&&!Array.isArray(t)))for(const r in t)void 0===e.schema[r]&&delete t[r];let u=!0;for(const r of e.validator(t,a))u=!1,yield[r,void 0];for(let[r,c,h]of e.entries(t,a)){const e=vr(c,h,{path:void 0===r?n:[...n,r],branch:void 0===r?i:[...i,c],coerce:o,mask:s});for(const n of e)n[0]?(u=!1,yield[n[0],void 0]):o&&(c=n[1],void 0===r?t=c:t instanceof Map?t.set(r,c):t instanceof Set?t.add(c):gr(t)&&(t[r]=c))}if(u)for(const r of e.refiner(t,a))u=!1,yield[r,void 0];u&&(yield[void 0,t])}class kr{constructor(t){const{type:e,schema:r,validator:n,refiner:i,coercer:o=(t=>t),entries:s=function*(){}}=t;this.type=e,this.schema=r,this.entries=s,this.coercer=o,this.validator=n?(t,e)=>br(n(t,e),e,this,t):()=>[],this.refiner=i?(t,e)=>br(i(t,e),e,this,t):()=>[]}assert(t){return Sr(t,this)}create(t){return _r(t,this)}is(t){return Ar(t,this)}mask(t){return function(t,e){const r=Mr(t,e,{coerce:!0,mask:!0});if(r[0])throw r[0];return r[1]}(t,this)}validate(t,e={}){return Mr(t,this,e)}}function Sr(t,e){const r=Mr(t,e);if(r[0])throw r[0]}function _r(t,e){const r=Mr(t,e,{coerce:!0});if(r[0])throw r[0];return r[1]}function Ar(t,e){return!Mr(t,e)[0]}function Mr(t,e,r={}){const n=vr(t,e,r),i=function(t){const{done:e,value:r}=t.next();return e?void 0:r}(n);if(i[0]){return[new mr(i[0],(function*(){for(const t of n)t[0]&&(yield t[0])})),void 0]}return[void 0,i[1]]}function Ir(t,e){return new kr({type:t,schema:null,validator:e})}function Er(t){return new kr({type:"array",schema:t,*entries(e){if(t&&Array.isArray(e))for(const[r,n]of e.entries())yield[r,n,t]},coercer:t=>Array.isArray(t)?t.slice():t,validator:t=>Array.isArray(t)||"Expected an array value, but received: "+yr(t)})}function xr(){return Ir("boolean",(t=>"boolean"==typeof t))}function Br(t){return Ir("instance",(e=>e instanceof t||"Expected a `"+t.name+"` instance, but received: "+yr(e)))}function Pr(t){const e=yr(t),r=typeof t;return new kr({type:"literal",schema:"string"===r||"number"===r||"boolean"===r?t:null,validator:r=>r===t||"Expected the literal `"+e+"`, but received: "+yr(r)})}function Rr(t){return new kr({...t,validator:(e,r)=>null===e||t.validator(e,r),refiner:(e,r)=>null===e||t.refiner(e,r)})}function Tr(){return Ir("number",(t=>"number"==typeof t&&!isNaN(t)||"Expected a number, but received: "+yr(t)))}function Lr(t){return new kr({...t,validator:(e,r)=>void 0===e||t.validator(e,r),refiner:(e,r)=>void 0===e||t.refiner(e,r)})}function Or(t,e){return new kr({type:"record",schema:null,*entries(r){if(gr(r))for(const n in r){const i=r[n];yield[n,n,t],yield[n,i,e]}},validator:t=>gr(t)||"Expected an object, but received: "+yr(t)})}function Cr(){return Ir("string",(t=>"string"==typeof t||"Expected a string, but received: "+yr(t)))}function Ur(t){const e=Ir("never",(()=>!1));return new kr({type:"tuple",schema:null,*entries(r){if(Array.isArray(r)){const n=Math.max(t.length,r.length);for(let i=0;i<n;i++)yield[i,r[i],t[i]||e]}},validator:t=>Array.isArray(t)||"Expected an array, but received: "+yr(t)})}function Nr(t){const e=Object.keys(t);return new kr({type:"type",schema:t,*entries(r){if(gr(r))for(const n of e)yield[n,r[n],t[n]]},validator:t=>gr(t)||"Expected an object, but received: "+yr(t)})}function zr(t){const e=t.map((t=>t.type)).join(" | ");return new kr({type:"union",schema:null,validator(r,n){const i=[];for(const e of t){const[...t]=vr(r,e,n),[o]=t;if(!o[0])return[];for(const[e]of t)e&&i.push(e)}return["Expected the value to satisfy a union of `"+e+"`, but received: "+yr(r),...i]}})}function Kr(){return Ir("unknown",(()=>!0))}function Wr(t,e,r){return new kr({...t,coercer:(n,i)=>Ar(n,e)?t.coercer(r(n,i),i):t.coercer(n,i)})}var qr=new Uint8Array(16);function Dr(){if(!fr&&!(fr="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return fr(qr)}var jr=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function Hr(t){return"string"==typeof t&&jr.test(t)}for(var Fr,$r,Vr=[],Gr=0;Gr<256;++Gr)Vr.push((Gr+256).toString(16).substr(1));function Zr(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(Vr[t[e+0]]+Vr[t[e+1]]+Vr[t[e+2]]+Vr[t[e+3]]+"-"+Vr[t[e+4]]+Vr[t[e+5]]+"-"+Vr[t[e+6]]+Vr[t[e+7]]+"-"+Vr[t[e+8]]+Vr[t[e+9]]+"-"+Vr[t[e+10]]+Vr[t[e+11]]+Vr[t[e+12]]+Vr[t[e+13]]+Vr[t[e+14]]+Vr[t[e+15]]).toLowerCase();if(!Hr(r))throw TypeError("Stringified UUID is invalid");return r}var Yr=0,Jr=0;function Xr(t){if(!Hr(t))throw TypeError("Invalid UUID");var e,r=new Uint8Array(16);return r[0]=(e=parseInt(t.slice(0,8),16))>>>24,r[1]=e>>>16&255,r[2]=e>>>8&255,r[3]=255&e,r[4]=(e=parseInt(t.slice(9,13),16))>>>8,r[5]=255&e,r[6]=(e=parseInt(t.slice(14,18),16))>>>8,r[7]=255&e,r[8]=(e=parseInt(t.slice(19,23),16))>>>8,r[9]=255&e,r[10]=(e=parseInt(t.slice(24,36),16))/1099511627776&255,r[11]=e/4294967296&255,r[12]=e>>>24&255,r[13]=e>>>16&255,r[14]=e>>>8&255,r[15]=255&e,r}function Qr(t,e,r){function n(t,n,i,o){if("string"==typeof t&&(t=function(t){t=unescape(encodeURIComponent(t));for(var e=[],r=0;r<t.length;++r)e.push(t.charCodeAt(r));return e}(t)),"string"==typeof n&&(n=Xr(n)),16!==n.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var s=new Uint8Array(16+t.length);if(s.set(n),s.set(t,n.length),(s=r(s))[6]=15&s[6]|e,s[8]=63&s[8]|128,i){o=o||0;for(var a=0;a<16;++a)i[o+a]=s[a];return i}return Zr(s)}try{n.name=t}catch(t){}return n.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",n.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",n}function tn(t){return 14+(t+64>>>9<<4)+1}function en(t,e){var r=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(r>>16)<<16|65535&r}function rn(t,e,r,n,i,o){return en((s=en(en(e,t),en(n,o)))<<(a=i)|s>>>32-a,r);var s,a}function nn(t,e,r,n,i,o,s){return rn(e&r|~e&n,t,e,i,o,s)}function on(t,e,r,n,i,o,s){return rn(e&n|r&~n,t,e,i,o,s)}function sn(t,e,r,n,i,o,s){return rn(e^r^n,t,e,i,o,s)}function an(t,e,r,n,i,o,s){return rn(r^(e|~n),t,e,i,o,s)}var un=Qr("v3",48,(function(t){if("string"==typeof t){var e=unescape(encodeURIComponent(t));t=new Uint8Array(e.length);for(var r=0;r<e.length;++r)t[r]=e.charCodeAt(r)}return function(t){for(var e=[],r=32*t.length,n="0123456789abcdef",i=0;i<r;i+=8){var o=t[i>>5]>>>i%32&255,s=parseInt(n.charAt(o>>>4&15)+n.charAt(15&o),16);e.push(s)}return e}(function(t,e){t[e>>5]|=128<<e%32,t[tn(e)-1]=e;for(var r=1732584193,n=-271733879,i=-1732584194,o=271733878,s=0;s<t.length;s+=16){var a=r,u=n,c=i,h=o;r=nn(r,n,i,o,t[s],7,-680876936),o=nn(o,r,n,i,t[s+1],12,-389564586),i=nn(i,o,r,n,t[s+2],17,606105819),n=nn(n,i,o,r,t[s+3],22,-1044525330),r=nn(r,n,i,o,t[s+4],7,-176418897),o=nn(o,r,n,i,t[s+5],12,1200080426),i=nn(i,o,r,n,t[s+6],17,-1473231341),n=nn(n,i,o,r,t[s+7],22,-45705983),r=nn(r,n,i,o,t[s+8],7,1770035416),o=nn(o,r,n,i,t[s+9],12,-1958414417),i=nn(i,o,r,n,t[s+10],17,-42063),n=nn(n,i,o,r,t[s+11],22,-1990404162),r=nn(r,n,i,o,t[s+12],7,1804603682),o=nn(o,r,n,i,t[s+13],12,-40341101),i=nn(i,o,r,n,t[s+14],17,-1502002290),r=on(r,n=nn(n,i,o,r,t[s+15],22,1236535329),i,o,t[s+1],5,-165796510),o=on(o,r,n,i,t[s+6],9,-1069501632),i=on(i,o,r,n,t[s+11],14,643717713),n=on(n,i,o,r,t[s],20,-373897302),r=on(r,n,i,o,t[s+5],5,-701558691),o=on(o,r,n,i,t[s+10],9,38016083),i=on(i,o,r,n,t[s+15],14,-660478335),n=on(n,i,o,r,t[s+4],20,-405537848),r=on(r,n,i,o,t[s+9],5,568446438),o=on(o,r,n,i,t[s+14],9,-1019803690),i=on(i,o,r,n,t[s+3],14,-187363961),n=on(n,i,o,r,t[s+8],20,1163531501),r=on(r,n,i,o,t[s+13],5,-1444681467),o=on(o,r,n,i,t[s+2],9,-51403784),i=on(i,o,r,n,t[s+7],14,1735328473),r=sn(r,n=on(n,i,o,r,t[s+12],20,-1926607734),i,o,t[s+5],4,-378558),o=sn(o,r,n,i,t[s+8],11,-2022574463),i=sn(i,o,r,n,t[s+11],16,1839030562),n=sn(n,i,o,r,t[s+14],23,-35309556),r=sn(r,n,i,o,t[s+1],4,-1530992060),o=sn(o,r,n,i,t[s+4],11,1272893353),i=sn(i,o,r,n,t[s+7],16,-155497632),n=sn(n,i,o,r,t[s+10],23,-1094730640),r=sn(r,n,i,o,t[s+13],4,681279174),o=sn(o,r,n,i,t[s],11,-358537222),i=sn(i,o,r,n,t[s+3],16,-722521979),n=sn(n,i,o,r,t[s+6],23,76029189),r=sn(r,n,i,o,t[s+9],4,-640364487),o=sn(o,r,n,i,t[s+12],11,-421815835),i=sn(i,o,r,n,t[s+15],16,530742520),r=an(r,n=sn(n,i,o,r,t[s+2],23,-995338651),i,o,t[s],6,-198630844),o=an(o,r,n,i,t[s+7],10,1126891415),i=an(i,o,r,n,t[s+14],15,-1416354905),n=an(n,i,o,r,t[s+5],21,-57434055),r=an(r,n,i,o,t[s+12],6,1700485571),o=an(o,r,n,i,t[s+3],10,-1894986606),i=an(i,o,r,n,t[s+10],15,-1051523),n=an(n,i,o,r,t[s+1],21,-2054922799),r=an(r,n,i,o,t[s+8],6,1873313359),o=an(o,r,n,i,t[s+15],10,-30611744),i=an(i,o,r,n,t[s+6],15,-1560198380),n=an(n,i,o,r,t[s+13],21,1309151649),r=an(r,n,i,o,t[s+4],6,-145523070),o=an(o,r,n,i,t[s+11],10,-1120210379),i=an(i,o,r,n,t[s+2],15,718787259),n=an(n,i,o,r,t[s+9],21,-343485551),r=en(r,a),n=en(n,u),i=en(i,c),o=en(o,h)}return[r,n,i,o]}(function(t){if(0===t.length)return[];for(var e=8*t.length,r=new Uint32Array(tn(e)),n=0;n<e;n+=8)r[n>>5]|=(255&t[n/8])<<n%32;return r}(t),8*t.length))})),cn=un;function hn(t,e,r,n){switch(t){case 0:return e&r^~e&n;case 1:case 3:return e^r^n;case 2:return e&r^e&n^r&n}}function ln(t,e){return t<<e|t>>>32-e}var dn=Qr("v5",80,(function(t){var e=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof t){var n=unescape(encodeURIComponent(t));t=[];for(var i=0;i<n.length;++i)t.push(n.charCodeAt(i))}else Array.isArray(t)||(t=Array.prototype.slice.call(t));t.push(128);for(var o=t.length/4+2,s=Math.ceil(o/16),a=new Array(s),u=0;u<s;++u){for(var c=new Uint32Array(16),h=0;h<16;++h)c[h]=t[64*u+4*h]<<24|t[64*u+4*h+1]<<16|t[64*u+4*h+2]<<8|t[64*u+4*h+3];a[u]=c}a[s-1][14]=8*(t.length-1)/Math.pow(2,32),a[s-1][14]=Math.floor(a[s-1][14]),a[s-1][15]=8*(t.length-1)&4294967295;for(var l=0;l<s;++l){for(var d=new Uint32Array(80),f=0;f<16;++f)d[f]=a[l][f];for(var p=16;p<80;++p)d[p]=ln(d[p-3]^d[p-8]^d[p-14]^d[p-16],1);for(var m=r[0],g=r[1],y=r[2],w=r[3],b=r[4],v=0;v<80;++v){var k=Math.floor(v/20),S=ln(m,5)+hn(k,g,y,w)+b+e[k]+d[v]>>>0;b=w,w=y,y=ln(g,30)>>>0,g=m,m=S}r[0]=r[0]+m>>>0,r[1]=r[1]+g>>>0,r[2]=r[2]+y>>>0,r[3]=r[3]+w>>>0,r[4]=r[4]+b>>>0}return[r[0]>>24&255,r[0]>>16&255,r[0]>>8&255,255&r[0],r[1]>>24&255,r[1]>>16&255,r[1]>>8&255,255&r[1],r[2]>>24&255,r[2]>>16&255,r[2]>>8&255,255&r[2],r[3]>>24&255,r[3]>>16&255,r[3]>>8&255,255&r[3],r[4]>>24&255,r[4]>>16&255,r[4]>>8&255,255&r[4]]})),fn=dn;var pn=Object.freeze({__proto__:null,v1:function(t,e,r){var n=e&&r||0,i=e||new Array(16),o=(t=t||{}).node||Fr,s=void 0!==t.clockseq?t.clockseq:$r;if(null==o||null==s){var a=t.random||(t.rng||Dr)();null==o&&(o=Fr=[1|a[0],a[1],a[2],a[3],a[4],a[5]]),null==s&&(s=$r=16383&(a[6]<<8|a[7]))}var u=void 0!==t.msecs?t.msecs:Date.now(),c=void 0!==t.nsecs?t.nsecs:Jr+1,h=u-Yr+(c-Jr)/1e4;if(h<0&&void 0===t.clockseq&&(s=s+1&16383),(h<0||u>Yr)&&void 0===t.nsecs&&(c=0),c>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");Yr=u,Jr=c,$r=s;var l=(1e4*(268435455&(u+=122192928e5))+c)%4294967296;i[n++]=l>>>24&255,i[n++]=l>>>16&255,i[n++]=l>>>8&255,i[n++]=255&l;var d=u/4294967296*1e4&268435455;i[n++]=d>>>8&255,i[n++]=255&d,i[n++]=d>>>24&15|16,i[n++]=d>>>16&255,i[n++]=s>>>8|128,i[n++]=255&s;for(var f=0;f<6;++f)i[n+f]=o[f];return e||Zr(i)},v3:cn,v4:function(t,e,r){var n=(t=t||{}).random||(t.rng||Dr)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,e){r=r||0;for(var i=0;i<16;++i)e[r+i]=n[i];return e}return Zr(n)},v5:fn,NIL:"00000000-0000-0000-0000-000000000000",version:function(t){if(!Hr(t))throw TypeError("Invalid UUID");return parseInt(t.substr(14,1),16)},validate:Hr,stringify:Zr,parse:Xr}),mn=t.getAugmentedNamespace(pn);const gn=mn.v4;var yn=function(t,e,r,n){if("string"!=typeof t)throw new TypeError(t+" must be a string");const i="number"==typeof(n=n||{}).version?n.version:2;if(1!==i&&2!==i)throw new TypeError(i+" must be 1 or 2");const o={method:t};if(2===i&&(o.jsonrpc="2.0"),e){if("object"!=typeof e&&!Array.isArray(e))throw new TypeError(e+" must be an object, array or omitted");o.params=e}if(void 0===r){const t="function"==typeof n.generator?n.generator:function(){return gn()};o.id=t(o,n)}else 2===i&&null===r?n.notificationIdNull&&(o.id=null):o.id=r;return o};const wn=mn.v4,bn=yn,vn=function(t,e){if(!(this instanceof vn))return new vn(t,e);e||(e={}),this.options={reviver:void 0!==e.reviver?e.reviver:null,replacer:void 0!==e.replacer?e.replacer:null,generator:void 0!==e.generator?e.generator:function(){return wn()},version:void 0!==e.version?e.version:2,notificationIdNull:"boolean"==typeof e.notificationIdNull&&e.notificationIdNull},this.callServer=t};var kn=vn;vn.prototype.request=function(t,e,r,n){const i=this;let o=null;const s=Array.isArray(t)&&"function"==typeof e;if(1===this.options.version&&s)throw new TypeError("JSON-RPC 1.0 does not support batching");if(s||!s&&t&&"object"==typeof t&&"function"==typeof e)n=e,o=t;else{"function"==typeof r&&(n=r,r=void 0);const i="function"==typeof n;try{o=bn(t,e,r,{generator:this.options.generator,version:this.options.version,notificationIdNull:this.options.notificationIdNull})}catch(t){if(i)return n(t);throw t}if(!i)return o}let a;try{a=JSON.stringify(o,this.options.replacer)}catch(t){return n(t)}return this.callServer(a,(function(t,e){i._parseResponse(t,e,n)})),o},vn.prototype._parseResponse=function(t,e,r){if(t)return void r(t);if(!e)return r();let n;try{n=JSON.parse(e,this.options.reviver)}catch(t){return r(t)}if(3===r.length){if(Array.isArray(n)){const t=function(t){return void 0!==t.error},e=function(e){return!t(e)};return r(null,n.filter(t),n.filter(e))}return r(null,n.error,n.result)}r(null,n)};var Sn,_n={},An={exports:{}};(Sn=An).exports=function(t){return t&&t.__esModule?t:{default:t}},Sn.exports.__esModule=!0,Sn.exports.default=Sn.exports;var Mn,In,En,xn,Bn={exports:{}},Pn={exports:{}};function Rn(){return Mn||(Mn=1,function(t){function e(r){return t.exports=e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,e(r)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports}(Pn)),Pn.exports}function Tn(){return In||(In=1,function(t){var e=Rn().default;function r(){
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var t,i=require("./index-270bac6a.cjs"),r=require("./_commonjs-dynamic-modules-f09a98c7.cjs"),n=require("./__node-resolve_empty-71310b0b.cjs"),e={exports:{}};function h(){return t||(t=1,h=e,i.commonjsGlobal,h.exports=(o=o||function(t,e){var h;if("undefined"!=typeof window&&window.crypto&&(h=window.crypto),"undefined"!=typeof self&&self.crypto&&(h=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(h=globalThis.crypto),!h&&"undefined"!=typeof window&&window.msCrypto&&(h=window.msCrypto),!h&&void 0!==i.commonjsGlobal&&i.commonjsGlobal.crypto&&(h=i.commonjsGlobal.crypto),!h&&"function"==typeof r.commonjsRequire)try{h=n.require$$0}catch(t){}var o=function(){if(h){if("function"==typeof h.getRandomValues)try{return h.getRandomValues(new Uint32Array(1))[0]}catch(t){}if("function"==typeof h.randomBytes)try{return h.randomBytes(4).readInt32LE()}catch(t){}}throw new Error("Native crypto module could not be used to get secure random number.")},s=Object.create||function(){function t(){}return function(i){var r;return t.prototype=i,r=new t,t.prototype=null,r}}(),u={},a=u.lib={},l=a.Base={extend:function(t){var i=s(this);return t&&i.mixIn(t),i.hasOwnProperty("init")&&this.init!==i.init||(i.init=function(){i.$super.init.apply(this,arguments)}),i.init.prototype=i,i.$super=this,i},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var i in t)t.hasOwnProperty(i)&&(this[i]=t[i]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},f=a.WordArray=l.extend({init:function(t,i){t=this.words=t||[],this.sigBytes=i!=e?i:4*t.length},toString:function(t){return(t||d).stringify(this)},concat:function(t){var i=this.words,r=t.words,n=this.sigBytes,e=t.sigBytes;if(this.clamp(),n%4)for(var h=0;h<e;h++){var o=r[h>>>2]>>>24-h%4*8&255;i[n+h>>>2]|=o<<24-(n+h)%4*8}else for(var s=0;s<e;s+=4)i[n+s>>>2]=r[s>>>2];return this.sigBytes+=e,this},clamp:function(){var i=this.words,r=this.sigBytes;i[r>>>2]&=4294967295<<32-r%4*8,i.length=t.ceil(r/4)},clone:function(){var t=l.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var i=[],r=0;r<t;r+=4)i.push(o());return new f.init(i,t)}}),m=u.enc={},d=m.Hex={stringify:function(t){for(var i=t.words,r=t.sigBytes,n=[],e=0;e<r;e++){var h=i[e>>>2]>>>24-e%4*8&255;n.push((h>>>4).toString(16)),n.push((15&h).toString(16))}return n.join("")},parse:function(t){for(var i=t.length,r=[],n=0;n<i;n+=2)r[n>>>3]|=parseInt(t.substr(n,2),16)<<24-n%8*4;return new f.init(r,i/2)}},p=m.Latin1={stringify:function(t){for(var i=t.words,r=t.sigBytes,n=[],e=0;e<r;e++){var h=i[e>>>2]>>>24-e%4*8&255;n.push(String.fromCharCode(h))}return n.join("")},parse:function(t){for(var i=t.length,r=[],n=0;n<i;n++)r[n>>>2]|=(255&t.charCodeAt(n))<<24-n%4*8;return new f.init(r,i)}},c=m.Utf8={stringify:function(t){try{return decodeURIComponent(escape(p.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return p.parse(unescape(encodeURIComponent(t)))}},M=a.BufferedBlockAlgorithm=l.extend({reset:function(){this._data=new f.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=c.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(i){var r,n=this._data,e=n.words,h=n.sigBytes,o=this.blockSize,s=h/(4*o),u=(s=i?t.ceil(s):t.max((0|s)-this._minBufferSize,0))*o,a=t.min(4*u,h);if(u){for(var l=0;l<u;l+=o)this._doProcessBlock(e,l);r=e.splice(0,u),n.sigBytes-=a}return new f.init(r,a)},clone:function(){var t=l.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0});a.Hasher=M.extend({cfg:l.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){M.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(i,r){return new t.init(r).finalize(i)}},_createHmacHelper:function(t){return function(i,r){return new v.HMAC.init(t,r).finalize(i)}}});var v=u.algo={};return u}(Math),o)),e.exports;var h,o}var o,s,u={exports:{}};o=u,i.commonjsGlobal,o.exports=(s=h(),function(t){var i=s,r=i.lib,n=r.WordArray,e=r.Hasher,h=i.algo,o=[],u=[];!function(){function i(i){for(var r=t.sqrt(i),n=2;n<=r;n++)if(!(i%n))return!1;return!0}function r(t){return 4294967296*(t-(0|t))|0}for(var n=2,e=0;e<64;)i(n)&&(e<8&&(o[e]=r(t.pow(n,.5))),u[e]=r(t.pow(n,1/3)),e++),n++}();var a=[],l=h.SHA256=e.extend({_doReset:function(){this._hash=new n.init(o.slice(0))},_doProcessBlock:function(t,i){for(var r=this._hash.words,n=r[0],e=r[1],h=r[2],o=r[3],s=r[4],l=r[5],f=r[6],m=r[7],d=0;d<64;d++){if(d<16)a[d]=0|t[i+d];else{var p=a[d-15],c=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,M=a[d-2],v=(M<<15|M>>>17)^(M<<13|M>>>19)^M>>>10;a[d]=c+a[d-7]+v+a[d-16]}var g=n&e^n&h^e&h,w=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),y=m+((s<<26|s>>>6)^(s<<21|s>>>11)^(s<<7|s>>>25))+(s&l^~s&f)+u[d]+a[d];m=f,f=l,l=s,s=o+y|0,o=h,h=e,e=n,n=y+(w+g)|0}r[0]=r[0]+n|0,r[1]=r[1]+e|0,r[2]=r[2]+h|0,r[3]=r[3]+o|0,r[4]=r[4]+s|0,r[5]=r[5]+l|0,r[6]=r[6]+f|0,r[7]=r[7]+m|0},_doFinalize:function(){var i=this._data,r=i.words,n=8*this._nDataBytes,e=8*i.sigBytes;return r[e>>>5]|=128<<24-e%32,r[14+(e+64>>>9<<4)]=t.floor(n/4294967296),r[15+(e+64>>>9<<4)]=n,i.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var t=e.clone.call(this);return t._hash=this._hash.clone(),t}});i.SHA256=e._createHelper(l),i.HmacSHA256=e._createHmacHelper(l)}(Math),s.SHA256);var a={exports:{}};!function(t,i){function r(t,i){if(!t)throw new Error(i||"Assertion failed")}function e(t,i){t.super_=i;var r=function(){};r.prototype=i.prototype,t.prototype=new r,t.prototype.constructor=t}function h(t,i,r){if(h.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==i&&"be"!==i||(r=i,i=10),this._init(t||0,i||10,r||"be"))}var o;"object"==typeof t?t.exports=h:i.BN=h,h.BN=h,h.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:n.require$$0.Buffer}catch(t){}function s(t,i){var r=t.charCodeAt(i);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function u(t,i,r){var n=s(t,r);return r-1>=i&&(n|=s(t,r-1)<<4),n}function a(t,i,r,n){for(var e=0,h=Math.min(t.length,r),o=i;o<h;o++){var s=t.charCodeAt(o)-48;e*=n,e+=s>=49?s-49+10:s>=17?s-17+10:s}return e}h.isBN=function(t){return t instanceof h||null!==t&&"object"==typeof t&&t.constructor.wordSize===h.wordSize&&Array.isArray(t.words)},h.max=function(t,i){return t.cmp(i)>0?t:i},h.min=function(t,i){return t.cmp(i)<0?t:i},h.prototype._init=function(t,i,n){if("number"==typeof t)return this._initNumber(t,i,n);if("object"==typeof t)return this._initArray(t,i,n);"hex"===i&&(i=16),r(i===(0|i)&&i>=2&&i<=36);var e=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(e++,this.negative=1),e<t.length&&(16===i?this._parseHex(t,e,n):(this._parseBase(t,i,e),"le"===n&&this._initArray(this.toArray(),i,n)))},h.prototype._initNumber=function(t,i,n){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):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),i,n)},h.prototype._initArray=function(t,i,n){if(r("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 e=0;e<this.length;e++)this.words[e]=0;var h,o,s=0;if("be"===n)for(e=t.length-1,h=0;e>=0;e-=3)o=t[e]|t[e-1]<<8|t[e-2]<<16,this.words[h]|=o<<s&67108863,this.words[h+1]=o>>>26-s&67108863,(s+=24)>=26&&(s-=26,h++);else if("le"===n)for(e=0,h=0;e<t.length;e+=3)o=t[e]|t[e+1]<<8|t[e+2]<<16,this.words[h]|=o<<s&67108863,this.words[h+1]=o>>>26-s&67108863,(s+=24)>=26&&(s-=26,h++);return this.strip()},h.prototype._parseHex=function(t,i,r){this.length=Math.ceil((t.length-i)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var e,h=0,o=0;if("be"===r)for(n=t.length-1;n>=i;n-=2)e=u(t,i,n)<<h,this.words[o]|=67108863&e,h>=18?(h-=18,o+=1,this.words[o]|=e>>>26):h+=8;else for(n=(t.length-i)%2==0?i+1:i;n<t.length;n+=2)e=u(t,i,n)<<h,this.words[o]|=67108863&e,h>=18?(h-=18,o+=1,this.words[o]|=e>>>26):h+=8;this.strip()},h.prototype._parseBase=function(t,i,r){this.words=[0],this.length=1;for(var n=0,e=1;e<=67108863;e*=i)n++;n--,e=e/i|0;for(var h=t.length-r,o=h%n,s=Math.min(h,h-o)+r,u=0,l=r;l<s;l+=n)u=a(t,l,l+n,i),this.imuln(e),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==o){var f=1;for(u=a(t,l,t.length,i),l=0;l<o;l++)f*=i;this.imuln(f),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},h.prototype.copy=function(t){t.words=new Array(this.length);for(var i=0;i<this.length;i++)t.words[i]=this.words[i];t.length=this.length,t.negative=this.negative,t.red=this.red},h.prototype.clone=function(){var t=new h(null);return this.copy(t),t},h.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},h.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},h.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},h.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var l=["","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"],f=[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],m=[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 d(t,i,r){r.negative=i.negative^t.negative;var n=t.length+i.length|0;r.length=n,n=n-1|0;var e=0|t.words[0],h=0|i.words[0],o=e*h,s=67108863&o,u=o/67108864|0;r.words[0]=s;for(var a=1;a<n;a++){for(var l=u>>>26,f=67108863&u,m=Math.min(a,i.length-1),d=Math.max(0,a-t.length+1);d<=m;d++){var p=a-d|0;l+=(o=(e=0|t.words[p])*(h=0|i.words[d])+f)/67108864|0,f=67108863&o}r.words[a]=0|f,u=0|l}return 0!==u?r.words[a]=0|u:r.length--,r.strip()}h.prototype.toString=function(t,i){var n;if(i=0|i||1,16===(t=t||10)||"hex"===t){n="";for(var e=0,h=0,o=0;o<this.length;o++){var s=this.words[o],u=(16777215&(s<<e|h)).toString(16);n=0!=(h=s>>>24-e&16777215)||o!==this.length-1?l[6-u.length]+u+n:u+n,(e+=2)>=26&&(e-=26,o--)}for(0!==h&&(n=h.toString(16)+n);n.length%i!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var a=f[t],d=m[t];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var c=p.modn(d).toString(t);n=(p=p.idivn(d)).isZero()?c+n:l[a-c.length]+c+n}for(this.isZero()&&(n="0"+n);n.length%i!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},h.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&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},h.prototype.toJSON=function(){return this.toString(16)},h.prototype.toBuffer=function(t,i){return r(void 0!==o),this.toArrayLike(o,t,i)},h.prototype.toArray=function(t,i){return this.toArrayLike(Array,t,i)},h.prototype.toArrayLike=function(t,i,n){var e=this.byteLength(),h=n||Math.max(1,e);r(e<=h,"byte array longer than desired length"),r(h>0,"Requested array length <= 0"),this.strip();var o,s,u="le"===i,a=new t(h),l=this.clone();if(u){for(s=0;!l.isZero();s++)o=l.andln(255),l.iushrn(8),a[s]=o;for(;s<h;s++)a[s]=0}else{for(s=0;s<h-e;s++)a[s]=0;for(s=0;!l.isZero();s++)o=l.andln(255),l.iushrn(8),a[h-s-1]=o}return a},Math.clz32?h.prototype._countBits=function(t){return 32-Math.clz32(t)}:h.prototype._countBits=function(t){var i=t,r=0;return i>=4096&&(r+=13,i>>>=13),i>=64&&(r+=7,i>>>=7),i>=8&&(r+=4,i>>>=4),i>=2&&(r+=2,i>>>=2),r+i},h.prototype._zeroBits=function(t){if(0===t)return 26;var i=t,r=0;return 0==(8191&i)&&(r+=13,i>>>=13),0==(127&i)&&(r+=7,i>>>=7),0==(15&i)&&(r+=4,i>>>=4),0==(3&i)&&(r+=2,i>>>=2),0==(1&i)&&r++,r},h.prototype.bitLength=function(){var t=this.words[this.length-1],i=this._countBits(t);return 26*(this.length-1)+i},h.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,i=0;i<this.length;i++){var r=this._zeroBits(this.words[i]);if(t+=r,26!==r)break}return t},h.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},h.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},h.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},h.prototype.isNeg=function(){return 0!==this.negative},h.prototype.neg=function(){return this.clone().ineg()},h.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},h.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var i=0;i<t.length;i++)this.words[i]=this.words[i]|t.words[i];return this.strip()},h.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},h.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},h.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},h.prototype.iuand=function(t){var i;i=this.length>t.length?t:this;for(var r=0;r<i.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=i.length,this.strip()},h.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},h.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},h.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},h.prototype.iuxor=function(t){var i,r;this.length>t.length?(i=this,r=t):(i=t,r=this);for(var n=0;n<r.length;n++)this.words[n]=i.words[n]^r.words[n];if(this!==i)for(;n<i.length;n++)this.words[n]=i.words[n];return this.length=i.length,this.strip()},h.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},h.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},h.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},h.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var i=0|Math.ceil(t/26),n=t%26;this._expand(i),n>0&&i--;for(var e=0;e<i;e++)this.words[e]=67108863&~this.words[e];return n>0&&(this.words[e]=~this.words[e]&67108863>>26-n),this.strip()},h.prototype.notn=function(t){return this.clone().inotn(t)},h.prototype.setn=function(t,i){r("number"==typeof t&&t>=0);var n=t/26|0,e=t%26;return this._expand(n+1),this.words[n]=i?this.words[n]|1<<e:this.words[n]&~(1<<e),this.strip()},h.prototype.iadd=function(t){var i,r,n;if(0!==this.negative&&0===t.negative)return this.negative=0,i=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,i=this.isub(t),t.negative=1,i._normSign();this.length>t.length?(r=this,n=t):(r=t,n=this);for(var e=0,h=0;h<n.length;h++)i=(0|r.words[h])+(0|n.words[h])+e,this.words[h]=67108863&i,e=i>>>26;for(;0!==e&&h<r.length;h++)i=(0|r.words[h])+e,this.words[h]=67108863&i,e=i>>>26;if(this.length=r.length,0!==e)this.words[this.length]=e,this.length++;else if(r!==this)for(;h<r.length;h++)this.words[h]=r.words[h];return this},h.prototype.add=function(t){var i;return 0!==t.negative&&0===this.negative?(t.negative=0,i=this.sub(t),t.negative^=1,i):0===t.negative&&0!==this.negative?(this.negative=0,i=t.sub(this),this.negative=1,i):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},h.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var i=this.iadd(t);return t.negative=1,i._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,e=this.cmp(t);if(0===e)return this.negative=0,this.length=1,this.words[0]=0,this;e>0?(r=this,n=t):(r=t,n=this);for(var h=0,o=0;o<n.length;o++)h=(i=(0|r.words[o])-(0|n.words[o])+h)>>26,this.words[o]=67108863&i;for(;0!==h&&o<r.length;o++)h=(i=(0|r.words[o])+h)>>26,this.words[o]=67108863&i;if(0===h&&o<r.length&&r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this.length=Math.max(this.length,o),r!==this&&(this.negative=1),this.strip()},h.prototype.sub=function(t){return this.clone().isub(t)};var p=function(t,i,r){var n,e,h,o=t.words,s=i.words,u=r.words,a=0,l=0|o[0],f=8191&l,m=l>>>13,d=0|o[1],p=8191&d,c=d>>>13,M=0|o[2],v=8191&M,g=M>>>13,w=0|o[3],y=8191&w,b=w>>>13,_=0|o[4],x=8191&_,A=_>>>13,B=0|o[5],k=8191&B,S=B>>>13,q=0|o[6],R=8191&q,Z=q>>>13,j=0|o[7],z=8191&j,N=j>>>13,I=0|o[8],H=8191&I,L=I>>>13,T=0|o[9],E=8191&T,O=T>>>13,C=0|s[0],P=8191&C,F=C>>>13,G=0|s[1],U=8191&G,$=G>>>13,D=0|s[2],K=8191&D,V=D>>>13,W=0|s[3],J=8191&W,Q=W>>>13,X=0|s[4],Y=8191&X,tt=X>>>13,it=0|s[5],rt=8191&it,nt=it>>>13,et=0|s[6],ht=8191&et,ot=et>>>13,st=0|s[7],ut=8191&st,at=st>>>13,lt=0|s[8],ft=8191<,mt=lt>>>13,dt=0|s[9],pt=8191&dt,ct=dt>>>13;r.negative=t.negative^i.negative,r.length=19;var Mt=(a+(n=Math.imul(f,P))|0)+((8191&(e=(e=Math.imul(f,F))+Math.imul(m,P)|0))<<13)|0;a=((h=Math.imul(m,F))+(e>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(p,P),e=(e=Math.imul(p,F))+Math.imul(c,P)|0,h=Math.imul(c,F);var vt=(a+(n=n+Math.imul(f,U)|0)|0)+((8191&(e=(e=e+Math.imul(f,$)|0)+Math.imul(m,U)|0))<<13)|0;a=((h=h+Math.imul(m,$)|0)+(e>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(v,P),e=(e=Math.imul(v,F))+Math.imul(g,P)|0,h=Math.imul(g,F),n=n+Math.imul(p,U)|0,e=(e=e+Math.imul(p,$)|0)+Math.imul(c,U)|0,h=h+Math.imul(c,$)|0;var gt=(a+(n=n+Math.imul(f,K)|0)|0)+((8191&(e=(e=e+Math.imul(f,V)|0)+Math.imul(m,K)|0))<<13)|0;a=((h=h+Math.imul(m,V)|0)+(e>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(y,P),e=(e=Math.imul(y,F))+Math.imul(b,P)|0,h=Math.imul(b,F),n=n+Math.imul(v,U)|0,e=(e=e+Math.imul(v,$)|0)+Math.imul(g,U)|0,h=h+Math.imul(g,$)|0,n=n+Math.imul(p,K)|0,e=(e=e+Math.imul(p,V)|0)+Math.imul(c,K)|0,h=h+Math.imul(c,V)|0;var wt=(a+(n=n+Math.imul(f,J)|0)|0)+((8191&(e=(e=e+Math.imul(f,Q)|0)+Math.imul(m,J)|0))<<13)|0;a=((h=h+Math.imul(m,Q)|0)+(e>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(x,P),e=(e=Math.imul(x,F))+Math.imul(A,P)|0,h=Math.imul(A,F),n=n+Math.imul(y,U)|0,e=(e=e+Math.imul(y,$)|0)+Math.imul(b,U)|0,h=h+Math.imul(b,$)|0,n=n+Math.imul(v,K)|0,e=(e=e+Math.imul(v,V)|0)+Math.imul(g,K)|0,h=h+Math.imul(g,V)|0,n=n+Math.imul(p,J)|0,e=(e=e+Math.imul(p,Q)|0)+Math.imul(c,J)|0,h=h+Math.imul(c,Q)|0;var yt=(a+(n=n+Math.imul(f,Y)|0)|0)+((8191&(e=(e=e+Math.imul(f,tt)|0)+Math.imul(m,Y)|0))<<13)|0;a=((h=h+Math.imul(m,tt)|0)+(e>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(k,P),e=(e=Math.imul(k,F))+Math.imul(S,P)|0,h=Math.imul(S,F),n=n+Math.imul(x,U)|0,e=(e=e+Math.imul(x,$)|0)+Math.imul(A,U)|0,h=h+Math.imul(A,$)|0,n=n+Math.imul(y,K)|0,e=(e=e+Math.imul(y,V)|0)+Math.imul(b,K)|0,h=h+Math.imul(b,V)|0,n=n+Math.imul(v,J)|0,e=(e=e+Math.imul(v,Q)|0)+Math.imul(g,J)|0,h=h+Math.imul(g,Q)|0,n=n+Math.imul(p,Y)|0,e=(e=e+Math.imul(p,tt)|0)+Math.imul(c,Y)|0,h=h+Math.imul(c,tt)|0;var bt=(a+(n=n+Math.imul(f,rt)|0)|0)+((8191&(e=(e=e+Math.imul(f,nt)|0)+Math.imul(m,rt)|0))<<13)|0;a=((h=h+Math.imul(m,nt)|0)+(e>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(R,P),e=(e=Math.imul(R,F))+Math.imul(Z,P)|0,h=Math.imul(Z,F),n=n+Math.imul(k,U)|0,e=(e=e+Math.imul(k,$)|0)+Math.imul(S,U)|0,h=h+Math.imul(S,$)|0,n=n+Math.imul(x,K)|0,e=(e=e+Math.imul(x,V)|0)+Math.imul(A,K)|0,h=h+Math.imul(A,V)|0,n=n+Math.imul(y,J)|0,e=(e=e+Math.imul(y,Q)|0)+Math.imul(b,J)|0,h=h+Math.imul(b,Q)|0,n=n+Math.imul(v,Y)|0,e=(e=e+Math.imul(v,tt)|0)+Math.imul(g,Y)|0,h=h+Math.imul(g,tt)|0,n=n+Math.imul(p,rt)|0,e=(e=e+Math.imul(p,nt)|0)+Math.imul(c,rt)|0,h=h+Math.imul(c,nt)|0;var _t=(a+(n=n+Math.imul(f,ht)|0)|0)+((8191&(e=(e=e+Math.imul(f,ot)|0)+Math.imul(m,ht)|0))<<13)|0;a=((h=h+Math.imul(m,ot)|0)+(e>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(z,P),e=(e=Math.imul(z,F))+Math.imul(N,P)|0,h=Math.imul(N,F),n=n+Math.imul(R,U)|0,e=(e=e+Math.imul(R,$)|0)+Math.imul(Z,U)|0,h=h+Math.imul(Z,$)|0,n=n+Math.imul(k,K)|0,e=(e=e+Math.imul(k,V)|0)+Math.imul(S,K)|0,h=h+Math.imul(S,V)|0,n=n+Math.imul(x,J)|0,e=(e=e+Math.imul(x,Q)|0)+Math.imul(A,J)|0,h=h+Math.imul(A,Q)|0,n=n+Math.imul(y,Y)|0,e=(e=e+Math.imul(y,tt)|0)+Math.imul(b,Y)|0,h=h+Math.imul(b,tt)|0,n=n+Math.imul(v,rt)|0,e=(e=e+Math.imul(v,nt)|0)+Math.imul(g,rt)|0,h=h+Math.imul(g,nt)|0,n=n+Math.imul(p,ht)|0,e=(e=e+Math.imul(p,ot)|0)+Math.imul(c,ht)|0,h=h+Math.imul(c,ot)|0;var xt=(a+(n=n+Math.imul(f,ut)|0)|0)+((8191&(e=(e=e+Math.imul(f,at)|0)+Math.imul(m,ut)|0))<<13)|0;a=((h=h+Math.imul(m,at)|0)+(e>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(H,P),e=(e=Math.imul(H,F))+Math.imul(L,P)|0,h=Math.imul(L,F),n=n+Math.imul(z,U)|0,e=(e=e+Math.imul(z,$)|0)+Math.imul(N,U)|0,h=h+Math.imul(N,$)|0,n=n+Math.imul(R,K)|0,e=(e=e+Math.imul(R,V)|0)+Math.imul(Z,K)|0,h=h+Math.imul(Z,V)|0,n=n+Math.imul(k,J)|0,e=(e=e+Math.imul(k,Q)|0)+Math.imul(S,J)|0,h=h+Math.imul(S,Q)|0,n=n+Math.imul(x,Y)|0,e=(e=e+Math.imul(x,tt)|0)+Math.imul(A,Y)|0,h=h+Math.imul(A,tt)|0,n=n+Math.imul(y,rt)|0,e=(e=e+Math.imul(y,nt)|0)+Math.imul(b,rt)|0,h=h+Math.imul(b,nt)|0,n=n+Math.imul(v,ht)|0,e=(e=e+Math.imul(v,ot)|0)+Math.imul(g,ht)|0,h=h+Math.imul(g,ot)|0,n=n+Math.imul(p,ut)|0,e=(e=e+Math.imul(p,at)|0)+Math.imul(c,ut)|0,h=h+Math.imul(c,at)|0;var At=(a+(n=n+Math.imul(f,ft)|0)|0)+((8191&(e=(e=e+Math.imul(f,mt)|0)+Math.imul(m,ft)|0))<<13)|0;a=((h=h+Math.imul(m,mt)|0)+(e>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(E,P),e=(e=Math.imul(E,F))+Math.imul(O,P)|0,h=Math.imul(O,F),n=n+Math.imul(H,U)|0,e=(e=e+Math.imul(H,$)|0)+Math.imul(L,U)|0,h=h+Math.imul(L,$)|0,n=n+Math.imul(z,K)|0,e=(e=e+Math.imul(z,V)|0)+Math.imul(N,K)|0,h=h+Math.imul(N,V)|0,n=n+Math.imul(R,J)|0,e=(e=e+Math.imul(R,Q)|0)+Math.imul(Z,J)|0,h=h+Math.imul(Z,Q)|0,n=n+Math.imul(k,Y)|0,e=(e=e+Math.imul(k,tt)|0)+Math.imul(S,Y)|0,h=h+Math.imul(S,tt)|0,n=n+Math.imul(x,rt)|0,e=(e=e+Math.imul(x,nt)|0)+Math.imul(A,rt)|0,h=h+Math.imul(A,nt)|0,n=n+Math.imul(y,ht)|0,e=(e=e+Math.imul(y,ot)|0)+Math.imul(b,ht)|0,h=h+Math.imul(b,ot)|0,n=n+Math.imul(v,ut)|0,e=(e=e+Math.imul(v,at)|0)+Math.imul(g,ut)|0,h=h+Math.imul(g,at)|0,n=n+Math.imul(p,ft)|0,e=(e=e+Math.imul(p,mt)|0)+Math.imul(c,ft)|0,h=h+Math.imul(c,mt)|0;var Bt=(a+(n=n+Math.imul(f,pt)|0)|0)+((8191&(e=(e=e+Math.imul(f,ct)|0)+Math.imul(m,pt)|0))<<13)|0;a=((h=h+Math.imul(m,ct)|0)+(e>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,n=Math.imul(E,U),e=(e=Math.imul(E,$))+Math.imul(O,U)|0,h=Math.imul(O,$),n=n+Math.imul(H,K)|0,e=(e=e+Math.imul(H,V)|0)+Math.imul(L,K)|0,h=h+Math.imul(L,V)|0,n=n+Math.imul(z,J)|0,e=(e=e+Math.imul(z,Q)|0)+Math.imul(N,J)|0,h=h+Math.imul(N,Q)|0,n=n+Math.imul(R,Y)|0,e=(e=e+Math.imul(R,tt)|0)+Math.imul(Z,Y)|0,h=h+Math.imul(Z,tt)|0,n=n+Math.imul(k,rt)|0,e=(e=e+Math.imul(k,nt)|0)+Math.imul(S,rt)|0,h=h+Math.imul(S,nt)|0,n=n+Math.imul(x,ht)|0,e=(e=e+Math.imul(x,ot)|0)+Math.imul(A,ht)|0,h=h+Math.imul(A,ot)|0,n=n+Math.imul(y,ut)|0,e=(e=e+Math.imul(y,at)|0)+Math.imul(b,ut)|0,h=h+Math.imul(b,at)|0,n=n+Math.imul(v,ft)|0,e=(e=e+Math.imul(v,mt)|0)+Math.imul(g,ft)|0,h=h+Math.imul(g,mt)|0;var kt=(a+(n=n+Math.imul(p,pt)|0)|0)+((8191&(e=(e=e+Math.imul(p,ct)|0)+Math.imul(c,pt)|0))<<13)|0;a=((h=h+Math.imul(c,ct)|0)+(e>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(E,K),e=(e=Math.imul(E,V))+Math.imul(O,K)|0,h=Math.imul(O,V),n=n+Math.imul(H,J)|0,e=(e=e+Math.imul(H,Q)|0)+Math.imul(L,J)|0,h=h+Math.imul(L,Q)|0,n=n+Math.imul(z,Y)|0,e=(e=e+Math.imul(z,tt)|0)+Math.imul(N,Y)|0,h=h+Math.imul(N,tt)|0,n=n+Math.imul(R,rt)|0,e=(e=e+Math.imul(R,nt)|0)+Math.imul(Z,rt)|0,h=h+Math.imul(Z,nt)|0,n=n+Math.imul(k,ht)|0,e=(e=e+Math.imul(k,ot)|0)+Math.imul(S,ht)|0,h=h+Math.imul(S,ot)|0,n=n+Math.imul(x,ut)|0,e=(e=e+Math.imul(x,at)|0)+Math.imul(A,ut)|0,h=h+Math.imul(A,at)|0,n=n+Math.imul(y,ft)|0,e=(e=e+Math.imul(y,mt)|0)+Math.imul(b,ft)|0,h=h+Math.imul(b,mt)|0;var St=(a+(n=n+Math.imul(v,pt)|0)|0)+((8191&(e=(e=e+Math.imul(v,ct)|0)+Math.imul(g,pt)|0))<<13)|0;a=((h=h+Math.imul(g,ct)|0)+(e>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(E,J),e=(e=Math.imul(E,Q))+Math.imul(O,J)|0,h=Math.imul(O,Q),n=n+Math.imul(H,Y)|0,e=(e=e+Math.imul(H,tt)|0)+Math.imul(L,Y)|0,h=h+Math.imul(L,tt)|0,n=n+Math.imul(z,rt)|0,e=(e=e+Math.imul(z,nt)|0)+Math.imul(N,rt)|0,h=h+Math.imul(N,nt)|0,n=n+Math.imul(R,ht)|0,e=(e=e+Math.imul(R,ot)|0)+Math.imul(Z,ht)|0,h=h+Math.imul(Z,ot)|0,n=n+Math.imul(k,ut)|0,e=(e=e+Math.imul(k,at)|0)+Math.imul(S,ut)|0,h=h+Math.imul(S,at)|0,n=n+Math.imul(x,ft)|0,e=(e=e+Math.imul(x,mt)|0)+Math.imul(A,ft)|0,h=h+Math.imul(A,mt)|0;var qt=(a+(n=n+Math.imul(y,pt)|0)|0)+((8191&(e=(e=e+Math.imul(y,ct)|0)+Math.imul(b,pt)|0))<<13)|0;a=((h=h+Math.imul(b,ct)|0)+(e>>>13)|0)+(qt>>>26)|0,qt&=67108863,n=Math.imul(E,Y),e=(e=Math.imul(E,tt))+Math.imul(O,Y)|0,h=Math.imul(O,tt),n=n+Math.imul(H,rt)|0,e=(e=e+Math.imul(H,nt)|0)+Math.imul(L,rt)|0,h=h+Math.imul(L,nt)|0,n=n+Math.imul(z,ht)|0,e=(e=e+Math.imul(z,ot)|0)+Math.imul(N,ht)|0,h=h+Math.imul(N,ot)|0,n=n+Math.imul(R,ut)|0,e=(e=e+Math.imul(R,at)|0)+Math.imul(Z,ut)|0,h=h+Math.imul(Z,at)|0,n=n+Math.imul(k,ft)|0,e=(e=e+Math.imul(k,mt)|0)+Math.imul(S,ft)|0,h=h+Math.imul(S,mt)|0;var Rt=(a+(n=n+Math.imul(x,pt)|0)|0)+((8191&(e=(e=e+Math.imul(x,ct)|0)+Math.imul(A,pt)|0))<<13)|0;a=((h=h+Math.imul(A,ct)|0)+(e>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(E,rt),e=(e=Math.imul(E,nt))+Math.imul(O,rt)|0,h=Math.imul(O,nt),n=n+Math.imul(H,ht)|0,e=(e=e+Math.imul(H,ot)|0)+Math.imul(L,ht)|0,h=h+Math.imul(L,ot)|0,n=n+Math.imul(z,ut)|0,e=(e=e+Math.imul(z,at)|0)+Math.imul(N,ut)|0,h=h+Math.imul(N,at)|0,n=n+Math.imul(R,ft)|0,e=(e=e+Math.imul(R,mt)|0)+Math.imul(Z,ft)|0,h=h+Math.imul(Z,mt)|0;var Zt=(a+(n=n+Math.imul(k,pt)|0)|0)+((8191&(e=(e=e+Math.imul(k,ct)|0)+Math.imul(S,pt)|0))<<13)|0;a=((h=h+Math.imul(S,ct)|0)+(e>>>13)|0)+(Zt>>>26)|0,Zt&=67108863,n=Math.imul(E,ht),e=(e=Math.imul(E,ot))+Math.imul(O,ht)|0,h=Math.imul(O,ot),n=n+Math.imul(H,ut)|0,e=(e=e+Math.imul(H,at)|0)+Math.imul(L,ut)|0,h=h+Math.imul(L,at)|0,n=n+Math.imul(z,ft)|0,e=(e=e+Math.imul(z,mt)|0)+Math.imul(N,ft)|0,h=h+Math.imul(N,mt)|0;var jt=(a+(n=n+Math.imul(R,pt)|0)|0)+((8191&(e=(e=e+Math.imul(R,ct)|0)+Math.imul(Z,pt)|0))<<13)|0;a=((h=h+Math.imul(Z,ct)|0)+(e>>>13)|0)+(jt>>>26)|0,jt&=67108863,n=Math.imul(E,ut),e=(e=Math.imul(E,at))+Math.imul(O,ut)|0,h=Math.imul(O,at),n=n+Math.imul(H,ft)|0,e=(e=e+Math.imul(H,mt)|0)+Math.imul(L,ft)|0,h=h+Math.imul(L,mt)|0;var zt=(a+(n=n+Math.imul(z,pt)|0)|0)+((8191&(e=(e=e+Math.imul(z,ct)|0)+Math.imul(N,pt)|0))<<13)|0;a=((h=h+Math.imul(N,ct)|0)+(e>>>13)|0)+(zt>>>26)|0,zt&=67108863,n=Math.imul(E,ft),e=(e=Math.imul(E,mt))+Math.imul(O,ft)|0,h=Math.imul(O,mt);var Nt=(a+(n=n+Math.imul(H,pt)|0)|0)+((8191&(e=(e=e+Math.imul(H,ct)|0)+Math.imul(L,pt)|0))<<13)|0;a=((h=h+Math.imul(L,ct)|0)+(e>>>13)|0)+(Nt>>>26)|0,Nt&=67108863;var It=(a+(n=Math.imul(E,pt))|0)+((8191&(e=(e=Math.imul(E,ct))+Math.imul(O,pt)|0))<<13)|0;return a=((h=Math.imul(O,ct))+(e>>>13)|0)+(It>>>26)|0,It&=67108863,u[0]=Mt,u[1]=vt,u[2]=gt,u[3]=wt,u[4]=yt,u[5]=bt,u[6]=_t,u[7]=xt,u[8]=At,u[9]=Bt,u[10]=kt,u[11]=St,u[12]=qt,u[13]=Rt,u[14]=Zt,u[15]=jt,u[16]=zt,u[17]=Nt,u[18]=It,0!==a&&(u[19]=a,r.length++),r};function c(t,i,r){return(new M).mulp(t,i,r)}function M(t,i){this.x=t,this.y=i}Math.imul||(p=d),h.prototype.mulTo=function(t,i){var r,n=this.length+t.length;return r=10===this.length&&10===t.length?p(this,t,i):n<63?d(this,t,i):n<1024?function(t,i,r){r.negative=i.negative^t.negative,r.length=t.length+i.length;for(var n=0,e=0,h=0;h<r.length-1;h++){var o=e;e=0;for(var s=67108863&n,u=Math.min(h,i.length-1),a=Math.max(0,h-t.length+1);a<=u;a++){var l=h-a,f=(0|t.words[l])*(0|i.words[a]),m=67108863&f;s=67108863&(m=m+s|0),e+=(o=(o=o+(f/67108864|0)|0)+(m>>>26)|0)>>>26,o&=67108863}r.words[h]=s,n=o,o=e}return 0!==n?r.words[h]=n:r.length--,r.strip()}(this,t,i):c(this,t,i),r},M.prototype.makeRBT=function(t){for(var i=new Array(t),r=h.prototype._countBits(t)-1,n=0;n<t;n++)i[n]=this.revBin(n,r,t);return i},M.prototype.revBin=function(t,i,r){if(0===t||t===r-1)return t;for(var n=0,e=0;e<i;e++)n|=(1&t)<<i-e-1,t>>=1;return n},M.prototype.permute=function(t,i,r,n,e,h){for(var o=0;o<h;o++)n[o]=i[t[o]],e[o]=r[t[o]]},M.prototype.transform=function(t,i,r,n,e,h){this.permute(h,t,i,r,n,e);for(var o=1;o<e;o<<=1)for(var s=o<<1,u=Math.cos(2*Math.PI/s),a=Math.sin(2*Math.PI/s),l=0;l<e;l+=s)for(var f=u,m=a,d=0;d<o;d++){var p=r[l+d],c=n[l+d],M=r[l+d+o],v=n[l+d+o],g=f*M-m*v;v=f*v+m*M,M=g,r[l+d]=p+M,n[l+d]=c+v,r[l+d+o]=p-M,n[l+d+o]=c-v,d!==s&&(g=u*f-a*m,m=u*m+a*f,f=g)}},M.prototype.guessLen13b=function(t,i){var r=1|Math.max(i,t),n=1&r,e=0;for(r=r/2|0;r;r>>>=1)e++;return 1<<e+1+n},M.prototype.conjugate=function(t,i,r){if(!(r<=1))for(var n=0;n<r/2;n++){var e=t[n];t[n]=t[r-n-1],t[r-n-1]=e,e=i[n],i[n]=-i[r-n-1],i[r-n-1]=-e}},M.prototype.normalize13b=function(t,i){for(var r=0,n=0;n<i/2;n++){var e=8192*Math.round(t[2*n+1]/i)+Math.round(t[2*n]/i)+r;t[n]=67108863&e,r=e<67108864?0:e/67108864|0}return t},M.prototype.convert13b=function(t,i,n,e){for(var h=0,o=0;o<i;o++)h+=0|t[o],n[2*o]=8191&h,h>>>=13,n[2*o+1]=8191&h,h>>>=13;for(o=2*i;o<e;++o)n[o]=0;r(0===h),r(0==(-8192&h))},M.prototype.stub=function(t){for(var i=new Array(t),r=0;r<t;r++)i[r]=0;return i},M.prototype.mulp=function(t,i,r){var n=2*this.guessLen13b(t.length,i.length),e=this.makeRBT(n),h=this.stub(n),o=new Array(n),s=new Array(n),u=new Array(n),a=new Array(n),l=new Array(n),f=new Array(n),m=r.words;m.length=n,this.convert13b(t.words,t.length,o,n),this.convert13b(i.words,i.length,a,n),this.transform(o,h,s,u,n,e),this.transform(a,h,l,f,n,e);for(var d=0;d<n;d++){var p=s[d]*l[d]-u[d]*f[d];u[d]=s[d]*f[d]+u[d]*l[d],s[d]=p}return this.conjugate(s,u,n),this.transform(s,u,m,h,n,e),this.conjugate(m,h,n),this.normalize13b(m,n),r.negative=t.negative^i.negative,r.length=t.length+i.length,r.strip()},h.prototype.mul=function(t){var i=new h(null);return i.words=new Array(this.length+t.length),this.mulTo(t,i)},h.prototype.mulf=function(t){var i=new h(null);return i.words=new Array(this.length+t.length),c(this,t,i)},h.prototype.imul=function(t){return this.clone().mulTo(t,this)},h.prototype.imuln=function(t){r("number"==typeof t),r(t<67108864);for(var i=0,n=0;n<this.length;n++){var e=(0|this.words[n])*t,h=(67108863&e)+(67108863&i);i>>=26,i+=e/67108864|0,i+=h>>>26,this.words[n]=67108863&h}return 0!==i&&(this.words[n]=i,this.length++),this},h.prototype.muln=function(t){return this.clone().imuln(t)},h.prototype.sqr=function(){return this.mul(this)},h.prototype.isqr=function(){return this.imul(this.clone())},h.prototype.pow=function(t){var i=function(t){for(var i=new Array(t.bitLength()),r=0;r<i.length;r++){var n=r/26|0,e=r%26;i[r]=(t.words[n]&1<<e)>>>e}return i}(t);if(0===i.length)return new h(1);for(var r=this,n=0;n<i.length&&0===i[n];n++,r=r.sqr());if(++n<i.length)for(var e=r.sqr();n<i.length;n++,e=e.sqr())0!==i[n]&&(r=r.mul(e));return r},h.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var i,n=t%26,e=(t-n)/26,h=67108863>>>26-n<<26-n;if(0!==n){var o=0;for(i=0;i<this.length;i++){var s=this.words[i]&h,u=(0|this.words[i])-s<<n;this.words[i]=u|o,o=s>>>26-n}o&&(this.words[i]=o,this.length++)}if(0!==e){for(i=this.length-1;i>=0;i--)this.words[i+e]=this.words[i];for(i=0;i<e;i++)this.words[i]=0;this.length+=e}return this.strip()},h.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},h.prototype.iushrn=function(t,i,n){var e;r("number"==typeof t&&t>=0),e=i?(i-i%26)/26:0;var h=t%26,o=Math.min((t-h)/26,this.length),s=67108863^67108863>>>h<<h,u=n;if(e-=o,e=Math.max(0,e),u){for(var a=0;a<o;a++)u.words[a]=this.words[a];u.length=o}if(0===o);else if(this.length>o)for(this.length-=o,a=0;a<this.length;a++)this.words[a]=this.words[a+o];else this.words[0]=0,this.length=1;var l=0;for(a=this.length-1;a>=0&&(0!==l||a>=e);a--){var f=0|this.words[a];this.words[a]=l<<26-h|f>>>h,l=f&s}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},h.prototype.ishrn=function(t,i,n){return r(0===this.negative),this.iushrn(t,i,n)},h.prototype.shln=function(t){return this.clone().ishln(t)},h.prototype.ushln=function(t){return this.clone().iushln(t)},h.prototype.shrn=function(t){return this.clone().ishrn(t)},h.prototype.ushrn=function(t){return this.clone().iushrn(t)},h.prototype.testn=function(t){r("number"==typeof t&&t>=0);var i=t%26,n=(t-i)/26,e=1<<i;return!(this.length<=n||!(this.words[n]&e))},h.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var i=t%26,n=(t-i)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==i&&n++,this.length=Math.min(n,this.length),0!==i){var e=67108863^67108863>>>i<<i;this.words[this.length-1]&=e}return this.strip()},h.prototype.maskn=function(t){return this.clone().imaskn(t)},h.prototype.iaddn=function(t){return r("number"==typeof t),r(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)},h.prototype._iaddn=function(t){this.words[0]+=t;for(var i=0;i<this.length&&this.words[i]>=67108864;i++)this.words[i]-=67108864,i===this.length-1?this.words[i+1]=1:this.words[i+1]++;return this.length=Math.max(this.length,i+1),this},h.prototype.isubn=function(t){if(r("number"==typeof t),r(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 i=0;i<this.length&&this.words[i]<0;i++)this.words[i]+=67108864,this.words[i+1]-=1;return this.strip()},h.prototype.addn=function(t){return this.clone().iaddn(t)},h.prototype.subn=function(t){return this.clone().isubn(t)},h.prototype.iabs=function(){return this.negative=0,this},h.prototype.abs=function(){return this.clone().iabs()},h.prototype._ishlnsubmul=function(t,i,n){var e,h,o=t.length+n;this._expand(o);var s=0;for(e=0;e<t.length;e++){h=(0|this.words[e+n])+s;var u=(0|t.words[e])*i;s=((h-=67108863&u)>>26)-(u/67108864|0),this.words[e+n]=67108863&h}for(;e<this.length-n;e++)s=(h=(0|this.words[e+n])+s)>>26,this.words[e+n]=67108863&h;if(0===s)return this.strip();for(r(-1===s),s=0,e=0;e<this.length;e++)s=(h=-(0|this.words[e])+s)>>26,this.words[e]=67108863&h;return this.negative=1,this.strip()},h.prototype._wordDiv=function(t,i){var r=(this.length,t.length),n=this.clone(),e=t,o=0|e.words[e.length-1];0!=(r=26-this._countBits(o))&&(e=e.ushln(r),n.iushln(r),o=0|e.words[e.length-1]);var s,u=n.length-e.length;if("mod"!==i){(s=new h(null)).length=u+1,s.words=new Array(s.length);for(var a=0;a<s.length;a++)s.words[a]=0}var l=n.clone()._ishlnsubmul(e,1,u);0===l.negative&&(n=l,s&&(s.words[u]=1));for(var f=u-1;f>=0;f--){var m=67108864*(0|n.words[e.length+f])+(0|n.words[e.length+f-1]);for(m=Math.min(m/o|0,67108863),n._ishlnsubmul(e,m,f);0!==n.negative;)m--,n.negative=0,n._ishlnsubmul(e,1,f),n.isZero()||(n.negative^=1);s&&(s.words[f]=m)}return s&&s.strip(),n.strip(),"div"!==i&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},h.prototype.divmod=function(t,i,n){return r(!t.isZero()),this.isZero()?{div:new h(0),mod:new h(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,i),"mod"!==i&&(e=s.div.neg()),"div"!==i&&(o=s.mod.neg(),n&&0!==o.negative&&o.iadd(t)),{div:e,mod:o}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),i),"mod"!==i&&(e=s.div.neg()),{div:e,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),i),"div"!==i&&(o=s.mod.neg(),n&&0!==o.negative&&o.isub(t)),{div:s.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new h(0),mod:this}:1===t.length?"div"===i?{div:this.divn(t.words[0]),mod:null}:"mod"===i?{div:null,mod:new h(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new h(this.modn(t.words[0]))}:this._wordDiv(t,i);var e,o,s},h.prototype.div=function(t){return this.divmod(t,"div",!1).div},h.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},h.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},h.prototype.divRound=function(t){var i=this.divmod(t);if(i.mod.isZero())return i.div;var r=0!==i.div.negative?i.mod.isub(t):i.mod,n=t.ushrn(1),e=t.andln(1),h=r.cmp(n);return h<0||1===e&&0===h?i.div:0!==i.div.negative?i.div.isubn(1):i.div.iaddn(1)},h.prototype.modn=function(t){r(t<=67108863);for(var i=(1<<26)%t,n=0,e=this.length-1;e>=0;e--)n=(i*n+(0|this.words[e]))%t;return n},h.prototype.idivn=function(t){r(t<=67108863);for(var i=0,n=this.length-1;n>=0;n--){var e=(0|this.words[n])+67108864*i;this.words[n]=e/t|0,i=e%t}return this.strip()},h.prototype.divn=function(t){return this.clone().idivn(t)},h.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var i=this,n=t.clone();i=0!==i.negative?i.umod(t):i.clone();for(var e=new h(1),o=new h(0),s=new h(0),u=new h(1),a=0;i.isEven()&&n.isEven();)i.iushrn(1),n.iushrn(1),++a;for(var l=n.clone(),f=i.clone();!i.isZero();){for(var m=0,d=1;0==(i.words[0]&d)&&m<26;++m,d<<=1);if(m>0)for(i.iushrn(m);m-- >0;)(e.isOdd()||o.isOdd())&&(e.iadd(l),o.isub(f)),e.iushrn(1),o.iushrn(1);for(var p=0,c=1;0==(n.words[0]&c)&&p<26;++p,c<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(f)),s.iushrn(1),u.iushrn(1);i.cmp(n)>=0?(i.isub(n),e.isub(s),o.isub(u)):(n.isub(i),s.isub(e),u.isub(o))}return{a:s,b:u,gcd:n.iushln(a)}},h.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var i=this,n=t.clone();i=0!==i.negative?i.umod(t):i.clone();for(var e,o=new h(1),s=new h(0),u=n.clone();i.cmpn(1)>0&&n.cmpn(1)>0;){for(var a=0,l=1;0==(i.words[0]&l)&&a<26;++a,l<<=1);if(a>0)for(i.iushrn(a);a-- >0;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var f=0,m=1;0==(n.words[0]&m)&&f<26;++f,m<<=1);if(f>0)for(n.iushrn(f);f-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);i.cmp(n)>=0?(i.isub(n),o.isub(s)):(n.isub(i),s.isub(o))}return(e=0===i.cmpn(1)?o:s).cmpn(0)<0&&e.iadd(t),e},h.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var i=this.clone(),r=t.clone();i.negative=0,r.negative=0;for(var n=0;i.isEven()&&r.isEven();n++)i.iushrn(1),r.iushrn(1);for(;;){for(;i.isEven();)i.iushrn(1);for(;r.isEven();)r.iushrn(1);var e=i.cmp(r);if(e<0){var h=i;i=r,r=h}else if(0===e||0===r.cmpn(1))break;i.isub(r)}return r.iushln(n)},h.prototype.invm=function(t){return this.egcd(t).a.umod(t)},h.prototype.isEven=function(){return 0==(1&this.words[0])},h.prototype.isOdd=function(){return 1==(1&this.words[0])},h.prototype.andln=function(t){return this.words[0]&t},h.prototype.bincn=function(t){r("number"==typeof t);var i=t%26,n=(t-i)/26,e=1<<i;if(this.length<=n)return this._expand(n+1),this.words[n]|=e,this;for(var h=e,o=n;0!==h&&o<this.length;o++){var s=0|this.words[o];h=(s+=h)>>>26,s&=67108863,this.words[o]=s}return 0!==h&&(this.words[o]=h,this.length++),this},h.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},h.prototype.cmpn=function(t){var i,n=t<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)i=1;else{n&&(t=-t),r(t<=67108863,"Number is too big");var e=0|this.words[0];i=e===t?0:e<t?-1:1}return 0!==this.negative?0|-i:i},h.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var i=this.ucmp(t);return 0!==this.negative?0|-i:i},h.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var i=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],e=0|t.words[r];if(n!==e){n<e?i=-1:n>e&&(i=1);break}}return i},h.prototype.gtn=function(t){return 1===this.cmpn(t)},h.prototype.gt=function(t){return 1===this.cmp(t)},h.prototype.gten=function(t){return this.cmpn(t)>=0},h.prototype.gte=function(t){return this.cmp(t)>=0},h.prototype.ltn=function(t){return-1===this.cmpn(t)},h.prototype.lt=function(t){return-1===this.cmp(t)},h.prototype.lten=function(t){return this.cmpn(t)<=0},h.prototype.lte=function(t){return this.cmp(t)<=0},h.prototype.eqn=function(t){return 0===this.cmpn(t)},h.prototype.eq=function(t){return 0===this.cmp(t)},h.red=function(t){return new x(t)},h.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},h.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},h.prototype._forceRed=function(t){return this.red=t,this},h.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},h.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},h.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},h.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},h.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},h.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},h.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},h.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},h.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},h.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},h.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},h.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},h.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},h.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function g(t,i){this.name=t,this.p=new h(i,16),this.n=this.p.bitLength(),this.k=new h(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){g.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function y(){g.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function b(){g.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){g.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function x(t){if("string"==typeof t){var i=h._prime(t);this.m=i.p,this.prime=i}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function A(t){x.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new h(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)}g.prototype._tmp=function(){var t=new h(null);return t.words=new Array(Math.ceil(this.n/13)),t},g.prototype.ireduce=function(t){var i,r=t;do{this.split(r,this.tmp),i=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(i>this.n);var n=i<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},g.prototype.split=function(t,i){t.iushrn(this.n,0,i)},g.prototype.imulK=function(t){return t.imul(this.k)},e(w,g),w.prototype.split=function(t,i){for(var r=4194303,n=Math.min(t.length,9),e=0;e<n;e++)i.words[e]=t.words[e];if(i.length=n,t.length<=9)return t.words[0]=0,void(t.length=1);var h=t.words[9];for(i.words[i.length++]=h&r,e=10;e<t.length;e++){var o=0|t.words[e];t.words[e-10]=(o&r)<<4|h>>>22,h=o}h>>>=22,t.words[e-10]=h,0===h&&t.length>10?t.length-=10:t.length-=9},w.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var i=0,r=0;r<t.length;r++){var n=0|t.words[r];i+=977*n,t.words[r]=67108863&i,i=64*n+(i/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},e(y,g),e(b,g),e(_,g),_.prototype.imulK=function(t){for(var i=0,r=0;r<t.length;r++){var n=19*(0|t.words[r])+i,e=67108863&n;n>>>=26,t.words[r]=e,i=n}return 0!==i&&(t.words[t.length++]=i),t},h._prime=function(t){if(v[t])return v[t];var i;if("k256"===t)i=new w;else if("p224"===t)i=new y;else if("p192"===t)i=new b;else{if("p25519"!==t)throw new Error("Unknown prime "+t);i=new _}return v[t]=i,i},x.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},x.prototype._verify2=function(t,i){r(0==(t.negative|i.negative),"red works only with positives"),r(t.red&&t.red===i.red,"red works only with red numbers")},x.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},x.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},x.prototype.add=function(t,i){this._verify2(t,i);var r=t.add(i);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},x.prototype.iadd=function(t,i){this._verify2(t,i);var r=t.iadd(i);return r.cmp(this.m)>=0&&r.isub(this.m),r},x.prototype.sub=function(t,i){this._verify2(t,i);var r=t.sub(i);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},x.prototype.isub=function(t,i){this._verify2(t,i);var r=t.isub(i);return r.cmpn(0)<0&&r.iadd(this.m),r},x.prototype.shl=function(t,i){return this._verify1(t),this.imod(t.ushln(i))},x.prototype.imul=function(t,i){return this._verify2(t,i),this.imod(t.imul(i))},x.prototype.mul=function(t,i){return this._verify2(t,i),this.imod(t.mul(i))},x.prototype.isqr=function(t){return this.imul(t,t.clone())},x.prototype.sqr=function(t){return this.mul(t,t)},x.prototype.sqrt=function(t){if(t.isZero())return t.clone();var i=this.m.andln(3);if(r(i%2==1),3===i){var n=this.m.add(new h(1)).iushrn(2);return this.pow(t,n)}for(var e=this.m.subn(1),o=0;!e.isZero()&&0===e.andln(1);)o++,e.iushrn(1);r(!e.isZero());var s=new h(1).toRed(this),u=s.redNeg(),a=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new h(2*l*l).toRed(this);0!==this.pow(l,a).cmp(u);)l.redIAdd(u);for(var f=this.pow(l,e),m=this.pow(t,e.addn(1).iushrn(1)),d=this.pow(t,e),p=o;0!==d.cmp(s);){for(var c=d,M=0;0!==c.cmp(s);M++)c=c.redSqr();r(M<p);var v=this.pow(f,new h(1).iushln(p-M-1));m=m.redMul(v),f=v.redSqr(),d=d.redMul(f),p=M}return m},x.prototype.invm=function(t){var i=t._invmp(this.m);return 0!==i.negative?(i.negative=0,this.imod(i).redNeg()):this.imod(i)},x.prototype.pow=function(t,i){if(i.isZero())return new h(1).toRed(this);if(0===i.cmpn(1))return t.clone();var r=new Array(16);r[0]=new h(1).toRed(this),r[1]=t;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],t);var e=r[0],o=0,s=0,u=i.bitLength()%26;for(0===u&&(u=26),n=i.length-1;n>=0;n--){for(var a=i.words[n],l=u-1;l>=0;l--){var f=a>>l&1;e!==r[0]&&(e=this.sqr(e)),0!==f||0!==o?(o<<=1,o|=f,(4==++s||0===n&&0===l)&&(e=this.mul(e,r[o]),s=0,o=0)):s=0}u=26}return e},x.prototype.convertTo=function(t){var i=t.umod(this.m);return i===t?i.clone():i},x.prototype.convertFrom=function(t){var i=t.clone();return i.red=null,i},h.mont=function(t){return new A(t)},e(A,x),A.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},A.prototype.convertFrom=function(t){var i=this.imod(t.mul(this.rinv));return i.red=null,i},A.prototype.imul=function(t,i){if(t.isZero()||i.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(i),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),e=r.isub(n).iushrn(this.shift),h=e;return e.cmp(this.m)>=0?h=e.isub(this.m):e.cmpn(0)<0&&(h=e.iadd(this.m)),h._forceRed(this)},A.prototype.mul=function(t,i){if(t.isZero()||i.isZero())return new h(0)._forceRed(this);var r=t.mul(i),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),e=r.isub(n).iushrn(this.shift),o=e;return e.cmp(this.m)>=0?o=e.isub(this.m):e.cmpn(0)<0&&(o=e.iadd(this.m)),o._forceRed(this)},A.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(a,i.commonjsGlobal),exports.bn=a,exports.requireCore=h,exports.sha256=u;
|