@dodoex/wallet-web3 0.0.31-0 → 0.0.31-1
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-17ad7168.js +1 -0
- package/dist/__tslib-b87826b4.js +1 -0
- package/dist/{blocto-f6f8d63a.js → blocto-f3659cd9.js} +1 -1
- package/dist/{bn-3774738b.js → bn-555a7938.js} +1 -1
- package/dist/{browser-ponyfill-9605cef7.js → browser-ponyfill-43772019.js} +1 -1
- package/dist/cjs/{__node-resolve_empty-1488cd16.cjs → __node-resolve_empty-af30057e.cjs} +1 -1
- package/dist/cjs/__tslib-3820a1f8.cjs +1 -0
- package/dist/cjs/{blocto-5f1d417d.cjs → blocto-8dcd2f79.cjs} +1 -1
- package/dist/cjs/{bn-0534a4e4.cjs → bn-8a7b5459.cjs} +1 -1
- package/dist/cjs/{browser-ponyfill-54411473.cjs → browser-ponyfill-b81daa53.cjs} +1 -1
- package/dist/cjs/core/index.d.ts +3 -1
- package/dist/cjs/{draggabilly-0fc8a536.cjs → draggabilly-d29c3a82.cjs} +1 -1
- package/dist/cjs/{ethers-dc859196.cjs → ethers-b389cccb.cjs} +1 -1
- package/dist/cjs/{id-19cf59c8.cjs → id-68e6a153.cjs} +1 -1
- package/dist/cjs/index-1277d26f.cjs +1 -0
- package/dist/cjs/{index-87806d3c.cjs → index-14b46d68.cjs} +1 -1
- package/dist/cjs/{index-ba95f450.cjs → index-21c482a2.cjs} +1 -1
- package/dist/cjs/{index-161c54d5.cjs → index-600fd7ed.cjs} +1 -1
- package/dist/cjs/{index-4a496c8d.cjs → index-6b7da1aa.cjs} +2 -2
- package/dist/cjs/{index-6be9d69c.cjs → index-ad437009.cjs} +1 -1
- package/dist/cjs/{index-d177e65b.cjs → index-ae70e4c5.cjs} +1 -1
- package/dist/cjs/{index-318a527c.cjs → index-e7964857.cjs} +1 -1
- package/dist/cjs/{index-191bd254.cjs → index-eb1cac25.cjs} +1 -1
- package/dist/cjs/{index-b7cf7fed.cjs → index-ef5ffb5e.cjs} +1 -1
- package/dist/cjs/{index-2ea4fc30.cjs → index-fbc4f903.cjs} +2 -2
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/{index.es-42f50c2e.cjs → index.es-50db17ba.cjs} +1 -1
- package/dist/cjs/{interface-ae0ea70a.cjs → interface-b93da01f.cjs} +1 -1
- package/dist/cjs/{lib-typedarrays-df89bc0a.cjs → lib-typedarrays-076de3bb.cjs} +1 -1
- package/dist/cjs/{portis-7d79fe60.cjs → portis-47c56ce5.cjs} +1 -1
- package/dist/cjs/{provider-83eca69d.cjs → provider-43ade618.cjs} +1 -1
- package/dist/cjs/providers/connector/types.d.ts +1 -0
- package/dist/cjs/{rainbow-ac3ff6b5.cjs → rainbow-289f2393.cjs} +1 -1
- package/dist/cjs/sha224-061ffa54.cjs +1 -0
- package/dist/cjs/{sha256-a53dbc53.cjs → sha256-7eed4c68.cjs} +1 -1
- package/dist/cjs/{typed-data-7ead7a85.cjs → typed-data-679326c8.cjs} +1 -1
- package/dist/cjs/{uAuth-c511c3ce.cjs → uAuth-539f3674.cjs} +1 -1
- package/dist/cjs/{walletConnect-78db50fd.cjs → walletConnect-2e8f21b6.cjs} +1 -1
- package/dist/cjs/{walletLink-c1c7b8f0.cjs → walletLink-b61dbbb8.cjs} +1 -1
- package/dist/core/index.d.ts +3 -1
- package/dist/{draggabilly-573e1054.js → draggabilly-8f0d67e3.js} +1 -1
- package/dist/{ethers-8049fe41.js → ethers-523fce86.js} +1 -1
- package/dist/{id-ef03a15d.js → id-85e567e5.js} +1 -1
- package/dist/{index-ca422f78.js → index-05dd2219.js} +1 -1
- package/dist/{index-cfa9e903.js → index-1245000e.js} +1 -1
- package/dist/{index-b2b69dbc.js → index-1f850026.js} +1 -1
- package/dist/{index-6288f270.js → index-4d730ca8.js} +1 -1
- package/dist/{index-0fce8774.js → index-5a2cd2db.js} +1 -1
- package/dist/index-77165ec8.js +9 -0
- package/dist/{index-d159d0f2.js → index-af172a92.js} +2 -2
- package/dist/{index-84db45cd.js → index-b1dc2c86.js} +1 -1
- package/dist/{index-9bc62c7e.js → index-bf9d577f.js} +1 -1
- package/dist/{index-97709c48.js → index-dd184cf5.js} +1 -1
- package/dist/index-e078aabc.js +1 -0
- package/dist/{index.es-c2f506f8.js → index.es-0971159a.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/{interface-e24d0dc5.js → interface-7254d371.js} +1 -1
- package/dist/{lib-typedarrays-c28577be.js → lib-typedarrays-9766f57f.js} +1 -1
- package/dist/{portis-2efa19a9.js → portis-4c8aa7f7.js} +1 -1
- package/dist/{provider-7c2d75f1.js → provider-b5a6bb58.js} +1 -1
- package/dist/providers/connector/types.d.ts +1 -0
- package/dist/{rainbow-434e3124.js → rainbow-519d378e.js} +1 -1
- package/dist/sha224-9a5935d0.js +1 -0
- package/dist/{sha256-b558d8bb.js → sha256-9a186cac.js} +1 -1
- package/dist/{typed-data-d1ae7d71.js → typed-data-19b7bb0d.js} +1 -1
- package/dist/{uAuth-5222f5d6.js → uAuth-f0cdaa0e.js} +1 -1
- package/dist/{walletConnect-af4a7fba.js → walletConnect-b99aba0b.js} +1 -1
- package/dist/{walletLink-de862277.js → walletLink-9e5a68ee.js} +1 -1
- package/package.json +1 -1
- package/dist/__node-resolve_empty-7adc4131.js +0 -1
- package/dist/__tslib-d27165d6.js +0 -1
- package/dist/cjs/__tslib-305d6300.cjs +0 -1
- package/dist/cjs/index-7ef62653.cjs +0 -1
- package/dist/cjs/sha224-e1ea5c7d.cjs +0 -1
- package/dist/index-61e93a02.js +0 -1
- package/dist/index-f131d44f.js +0 -9
- package/dist/sha224-6b0580c6.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var t=require("./index-
|
|
1
|
+
"use strict";var t=require("./index-6b7da1aa.cjs"),e=require("buffer"),r=require("./__node-resolve_empty-af30057e.cjs"),n=require("./index-cf3bf3b5.cjs"),i=require("./v4-a8141ae2.cjs");function o(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 s=o(e),a={exports:{}};function u(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function c(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 h={number:u,bool:function(t){if("boolean"!=typeof t)throw new Error(`Expected boolean, not ${t}`)},bytes:c,hash:function(t){if("function"!=typeof t||"function"!=typeof t.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");u(t.outputLen),u(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){c(t);const r=e.outputLen;if(t.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}},l=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),d=(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 f(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 p{clone(){return this._cloneInto()}}function m(t){const e=e=>t().update(f(e)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}class g extends p{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=l(this.buffer)}update(t){h.exists(this);const{view:e,buffer:r,blockLen:n}=this,i=(t=f(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=l(t);for(;n<=i-o;o+=n)this.process(e,o)}}return this.length+=t.length,this.roundClean(),this}digestInto(t){h.exists(this),h.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=l(t),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=a/4,c=this.get();if(u>c.length)throw new Error("_sha2: outputLen bigger than state");for(let t=0;t<u;t++)s.setUint32(4*t,c[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 y=BigInt(2**32-1),w=BigInt(32);function b(t,e=!1){return e?{h:Number(t&y),l:Number(t>>w&y)}:{h:0|Number(t>>w&y),l:0|Number(t&y)}}const v={fromBig:b,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}=b(t[i],e);[r[i],n[i]]=[o,s]}return[r,n]},toBig:(t,e)=>BigInt(t>>>0)<<w|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)},[k,S]=v.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)))),_=new Uint32Array(80),A=new Uint32Array(80);class M extends g{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)_[r]=t.getUint32(e),A[r]=t.getUint32(e+=4);for(let t=16;t<80;t++){const e=0|_[t-15],r=0|A[t-15],n=v.rotrSH(e,r,1)^v.rotrSH(e,r,8)^v.shrSH(e,r,7),i=v.rotrSL(e,r,1)^v.rotrSL(e,r,8)^v.shrSL(e,r,7),o=0|_[t-2],s=0|A[t-2],a=v.rotrSH(o,s,19)^v.rotrBH(o,s,61)^v.shrSH(o,s,6),u=v.rotrSL(o,s,19)^v.rotrBL(o,s,61)^v.shrSL(o,s,6),c=v.add4L(i,u,A[t-7],A[t-16]),h=v.add4H(c,n,a,_[t-7],_[t-16]);_[t]=0|h,A[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=v.rotrSH(h,l,14)^v.rotrSH(h,l,18)^v.rotrBH(h,l,41),w=v.rotrSL(h,l,14)^v.rotrSL(h,l,18)^v.rotrBL(h,l,41),b=h&d^~h&p,M=l&f^~l&m,I=v.add5L(y,w,M,S[t],A[t]),E=v.add5H(I,g,e,b,k[t],_[t]),x=0|I,B=v.rotrSH(r,n,28)^v.rotrBH(r,n,34)^v.rotrBH(r,n,39),P=v.rotrSL(r,n,28)^v.rotrBL(r,n,34)^v.rotrBL(r,n,39),T=r&i^r&s^i&s,R=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}=v.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=v.add3L(x,P,R);r=v.add3H(L,E,B,T),n=0|L}({h:r,l:n}=v.add(0|this.Ah,0|this.Al,0|r,0|n)),({h:i,l:o}=v.add(0|this.Bh,0|this.Bl,0|i,0|o)),({h:s,l:a}=v.add(0|this.Ch,0|this.Cl,0|s,0|a)),({h:u,l:c}=v.add(0|this.Dh,0|this.Dl,0|u,0|c)),({h:h,l:l}=v.add(0|this.Eh,0|this.El,0|h,0|l)),({h:d,l:f}=v.add(0|this.Fh,0|this.Fl,0|d,0|f)),({h:p,l:m}=v.add(0|this.Gh,0|this.Gl,0|p,0|m)),({h:g,l:y}=v.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(){_.fill(0),A.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 I extends M{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 E extends M{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 x extends M{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 B=m((()=>new M));m((()=>new I)),m((()=>new E)),m((()=>new x));
|
|
3
3
|
/*! noble-ed25519 - MIT License (c) 2019 Paul Miller (paulmillr.com) */
|
|
4
4
|
const P=BigInt(0),T=BigInt(1),R=BigInt(2),L=BigInt(8),O=BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),C=Object.freeze({a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),P:BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),l:O,n:O,h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960")}),U=BigInt("0x10000000000000000000000000000000000000000000000000000000000000000"),N=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");BigInt("6853475219497561581579357271197624642482790079785650197046958215289687604742");const z=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),K=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),W=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),q=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952");class D{constructor(t,e,r,n){this.x=t,this.y=e,this.z=r,this.t=n}static fromAffine(t){if(!(t instanceof Z))throw new TypeError("ExtendedPoint#fromAffine: expected Point");return t.equals(Z.ZERO)?D.ZERO:new D(t.x,t.y,T,at(t.x*t.y))}static toAffineBatch(t){const e=function(t,e=C.P){const r=new Array(t.length),n=ut(t.reduce(((t,n,i)=>n===P?t:(r[i]=t,at(t*n,e))),T),e);return t.reduceRight(((t,n,i)=>n===P?t:(r[i]=at(t*r[i],e),at(t*n,e))),n),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){H(t);const{x:e,y:r,z:n}=this,{x:i,y:o,z:s}=t,a=at(e*s),u=at(i*n),c=at(r*s),h=at(o*n);return a===u&&c===h}negate(){return new D(at(-this.x),this.y,this.z,at(-this.t))}double(){const{x:t,y:e,z:r}=this,{a:n}=C,i=at(t*t),o=at(e*e),s=at(R*at(r*r)),a=at(n*i),u=t+e,c=at(at(u*u)-i-o),h=a+o,l=h-s,d=a-o,f=at(c*l),p=at(h*d),m=at(c*d),g=at(l*h);return new D(f,p,g,m)}add(t){H(t);const{x:e,y:r,z:n,t:i}=this,{x:o,y:s,z:a,t:u}=t,c=at((r-e)*(s+o)),h=at((r+e)*(s-o)),l=at(h-c);if(l===P)return this.double();const d=at(n*R*u),f=at(i*R*a),p=f+d,m=h+c,g=f-d,y=at(p*l),w=at(m*g),b=at(p*g),v=at(l*m);return new D(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(D.BASE)&&(e=Z.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&&G.get(e);n||(n=this.precomputeWindow(r),e&&1!==r&&(n=D.normalizeZ(n),G.set(e,n)));let i=D.ZERO,o=D.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+=T);const l=r,d=r+Math.abs(s)-1,f=e%2!=0,p=s<0;0===s?o=o.add(j(f,n[l])):i=i.add(j(p,n[d]))}return D.normalizeZ([i,o])[0]}multiply(t,e){return this.wNAF(pt(t,C.l),e)}multiplyUnsafe(t){let e=pt(t,C.l,!1);const r=D.BASE,n=D.ZERO;if(e===P)return n;if(this.equals(n)||e===T)return this;if(this.equals(r))return this.wNAF(e);let i=n,o=this;for(;e>P;)e&T&&(i=i.add(o)),o=o.double(),e>>=T;return i}isSmallOrder(){return this.multiplyUnsafe(C.h).equals(D.ZERO)}isTorsionFree(){let t=this.multiplyUnsafe(C.l/R).double();return C.l%R&&(t=t.add(this)),t.equals(D.ZERO)}toAffine(t){const{x:e,y:r,z:n}=this,i=this.equals(D.ZERO);null==t&&(t=i?L:ut(n));const o=at(e*t),s=at(r*t),a=at(n*t);if(i)return Z.ZERO;if(a!==T)throw new Error("invZ was invalid");return new Z(o,s)}fromRistrettoBytes(){$()}toRistrettoBytes(){$()}fromRistrettoHash(){$()}}function j(t,e){const r=e.negate();return t?r:e}function H(t){if(!(t instanceof D))throw new TypeError("ExtendedPoint expected")}function F(t){if(!(t instanceof V))throw new TypeError("RistrettoPoint expected")}function $(){throw new Error("Legacy method: switch to RistrettoPoint")}D.BASE=new D(C.Gx,C.Gy,T,at(C.Gx*C.Gy)),D.ZERO=new D(P,T,T,P);class V{constructor(t){this.ep=t}static calcElligatorRistrettoMap(t){const{d:e}=C,r=at(N*t*t),n=at((r+T)*W);let i=BigInt(-1);const o=at((i-e*r)*at(r+e));let{isValid:s,value:a}=ht(n,o),u=at(a*t);nt(u)||(u=at(-u)),s||(a=u),s||(i=r);const c=at(i*(r-T)*q-o),h=a*a,l=at((a+a)*o),d=at(c*z),f=at(T-h),p=at(T+h);return new D(at(l*p),at(f*d),at(d*p),at(l*f))}static hashToCurve(t){const e=st((t=ft(t,64)).slice(0,32)),r=this.calcElligatorRistrettoMap(e),n=st(t.slice(32,64)),i=this.calcElligatorRistrettoMap(n);return new V(r.add(i))}static fromHex(t){t=ft(t,32);const{a:e,d:r}=C,n="RistrettoPoint.fromHex: the hex is not valid encoding of RistrettoPoint",i=st(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}(rt(i),t)||nt(i))throw new Error(n);const o=at(i*i),s=at(T+e*o),a=at(T-e*o),u=at(s*s),c=at(a*a),h=at(e*r*u-c),{isValid:l,value:d}=lt(at(h*c)),f=at(d*a),p=at(d*f*h);let m=at((i+i)*f);nt(m)&&(m=at(-m));const g=at(s*p),y=at(m*g);if(!l||nt(y)||g===P)throw new Error(n);return new V(new D(m,g,T,y))}toRawBytes(){let{x:t,y:e,z:r,t:n}=this.ep;const i=at(at(r+e)*at(r-e)),o=at(t*e),s=at(o*o),{value:a}=lt(at(i*s)),u=at(a*i),c=at(a*o),h=at(u*c*n);let l;if(nt(n*h)){let r=at(e*N),n=at(t*N);t=r,e=n,l=at(u*K)}else l=c;nt(t*h)&&(e=at(-e));let d=at((r-e)*l);return nt(d)&&(d=at(-d)),rt(d)}toHex(){return Q(this.toRawBytes())}toString(){return this.toHex()}equals(t){F(t);const e=this.ep,r=t.ep,n=at(e.x*r.y)===at(e.y*r.x),i=at(e.y*r.y)===at(e.x*r.x);return n||i}add(t){return F(t),new V(this.ep.add(t.ep))}subtract(t){return F(t),new V(this.ep.subtract(t.ep))}multiply(t){return new V(this.ep.multiply(t))}multiplyUnsafe(t){return new V(this.ep.multiplyUnsafe(t))}}V.BASE=new V(D.BASE),V.ZERO=new V(D.ZERO);const G=new WeakMap;class Z{constructor(t,e){this.x=t,this.y=e}_setWindowSize(t){this._WINDOW_SIZE=t,G.delete(this)}static fromHex(t,e=!0){const{d:r,P:n}=C,i=(t=ft(t,32)).slice();i[31]=-129&t[31];const o=it(i);if(e&&o>=n)throw new Error("Expected 0 < hex < P");if(!e&&o>=U)throw new Error("Expected 0 < hex < 2**256");const s=at(o*o),a=at(s-T),u=at(r*s+T);let{isValid:c,value:h}=ht(a,u);if(!c)throw new Error("Point.fromHex: invalid y coordinate");const l=(h&T)===T;return 0!=(128&t[31])!==l&&(h=at(-h)),new Z(h,o)}static async fromPrivateKey(t){return(await bt(t)).point}toRawBytes(){const t=rt(this.y);return t[31]|=this.x&T?128:0,t}toHex(){return Q(this.toRawBytes())}toX25519(){const{y:t}=this;return rt(at((T+t)*ut(T-t)))}isTorsionFree(){return D.fromAffine(this).isTorsionFree()}equals(t){return this.x===t.x&&this.y===t.y}negate(){return new Z(at(-this.x),this.y)}add(t){return D.fromAffine(this).add(D.fromAffine(t)).toAffine()}subtract(t){return this.add(t.negate())}multiply(t){return D.fromAffine(this).multiply(t,this).toAffine()}}Z.BASE=new Z(C.Gx,C.Gy),Z.ZERO=new Z(P,T);class Y{constructor(t,e){this.r=t,this.s=e,this.assertValidity()}static fromHex(t){const e=ft(t,64),r=Z.fromHex(e.slice(0,32),!1),n=it(e.slice(32,64));return new Y(r,n)}assertValidity(){const{r:t,s:e}=this;if(!(t instanceof Z))throw new Error("Expected Point instance");return pt(e,C.l,!1),this}toRawBytes(){const t=new Uint8Array(64);return t.set(this.r.toRawBytes()),t.set(rt(this.s),32),t}toHex(){return Q(this.toRawBytes())}}function J(...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 X=Array.from({length:256},((t,e)=>e.toString(16).padStart(2,"0")));function Q(t){if(!(t instanceof Uint8Array))throw new Error("Uint8Array expected");let e="";for(let r=0;r<t.length;r++)e+=X[t[r]];return e}function tt(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 et(t){return tt(t.toString(16).padStart(64,"0"))}function rt(t){return et(t).reverse()}function nt(t){return(at(t)&T)===T}function it(t){if(!(t instanceof Uint8Array))throw new Error("Expected Uint8Array");return BigInt("0x"+Q(Uint8Array.from(t).reverse()))}const ot=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function st(t){return at(it(t)&ot)}function at(t,e=C.P){const r=t%e;return r>=P?r:e+r}function ut(t,e=C.P){if(t===P||e<=P)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=at(t,e),n=e,i=P,o=T;for(;r!==P;){const t=n%r,e=i-o*(n/r);n=r,r=t,i=o,o=e}if(n!==T)throw new Error("invert: does not exist");return at(i,e)}function ct(t,e){const{P:r}=C;let n=t;for(;e-- >P;)n*=n,n%=r;return n}function ht(t,e){const r=at(e*e*e),n=function(t){const{P:e}=C,r=BigInt(5),n=BigInt(10),i=BigInt(20),o=BigInt(40),s=BigInt(80),a=t*t%e*t%e,u=ct(a,R)*a%e,c=ct(u,T)*t%e,h=ct(c,r)*c%e,l=ct(h,n)*h%e,d=ct(l,i)*l%e,f=ct(d,o)*d%e,p=ct(f,s)*f%e,m=ct(p,s)*f%e,g=ct(m,n)*h%e;return{pow_p_5_8:ct(g,R)*t%e,b2:a}}(t*at(r*r*e)).pow_p_5_8;let i=at(t*r*n);const o=at(e*i*i),s=i,a=at(i*N),u=o===t,c=o===at(-t),h=o===at(-t*N);return u&&(i=s),(c||h)&&(i=a),nt(i)&&(i=at(-i)),{isValid:u||c,value:i}}function lt(t){return ht(T,t)}function dt(t){return at(it(t),C.l)}function ft(t,e){const r=t instanceof Uint8Array?Uint8Array.from(t):tt(t);if("number"==typeof e&&r.length!==e)throw new Error(`Expected ${e} bytes`);return r}function pt(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(P<t)return t}else if(P<=t)return t;throw new TypeError("Expected valid scalar: 0 < scalar < max")}function mt(t){if(32!==(t="bigint"==typeof t||"number"==typeof t?et(pt(t,U)):ft(t)).length)throw new Error("Expected 32 bytes");return t}function gt(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=dt(e),i=Z.BASE.multiply(n),o=i.toRawBytes();return{head:e,prefix:r,scalar:n,point:i,pointBytes:o}}let yt;function wt(...t){if("function"!=typeof yt)throw new Error("utils.sha512Sync must be set to use sync methods");return yt(...t)}async function bt(t){return gt(await _t.sha512(mt(t)))}function vt(t){return gt(wt(mt(t)))}const kt={getExtendedPublicKey:vt,getPublicKey:function(t){return vt(t).pointBytes},sign:function(t,e){t=ft(t);const{prefix:r,scalar:n,pointBytes:i}=vt(e),o=dt(wt(r,t)),s=Z.BASE.multiply(o),a=at(o+dt(wt(s.toRawBytes(),i,t))*n,C.l);return new Y(s,a).toRawBytes()},verify:function(t,e,r){const{r:n,SB:i,msg:o,pub:s}=function(t,e,r){e=ft(e),r instanceof Z||(r=Z.fromHex(r,!1));const{r:n,s:i}=t instanceof Y?t.assertValidity():Y.fromHex(t);return{r:n,s:i,SB:D.BASE.multiplyUnsafe(i),pub:r,msg:e}}(t,e,r),a=wt(n.toRawBytes(),s.toRawBytes(),o);return function(t,e,r,n){const i=dt(n),o=D.fromAffine(t).multiplyUnsafe(i);return D.fromAffine(e).add(o).subtract(r).multiplyUnsafe(C.h).equals(D.ZERO)}(s,n,i,a)}};Z.BASE._setWindowSize(8);const St={node:r.nodeCrypto,web:"object"==typeof self&&"crypto"in self?self.crypto:void 0},_t={bytesToHex:Q,hexToBytes:tt,concatBytes:J,getExtendedPublicKey:bt,mod:at,invert:ut,TORSION_SUBGROUP:["0100000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a","0000000000000000000000000000000000000000000000000000000000000080","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05","ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85","0000000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa"],hashToPrivateScalar:t=>{if((t=ft(t)).length<40||t.length>1024)throw new Error("Expected 40-1024 bytes of private key as per FIPS 186");return at(it(t),C.l-T)+T},randomBytes:(t=32)=>{if(St.web)return St.web.getRandomValues(new Uint8Array(t));if(St.node){const{randomBytes:e}=St.node;return new Uint8Array(e(t).buffer)}throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:()=>_t.randomBytes(32),sha512:async(...t)=>{const e=J(...t);if(St.web){const t=await St.web.subtle.digest("SHA-512",e.buffer);return new Uint8Array(t)}if(St.node)return Uint8Array.from(St.node.createHash("sha512").update(e).digest());throw new Error("The environment doesn't have sha512 function")},precompute(t=8,e=Z.BASE){const r=e.equals(Z.BASE)?e:new Z(e.x,e.y);return r._setWindowSize(t),r.multiply(R),r},sha512Sync:void 0};Object.defineProperties(_t,{sha512Sync:{configurable:!1,get:()=>yt,set(t){yt||(yt=t)}}});var At={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$$1.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,T=0|s[7],R=8191&T,L=T>>>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(R,q),i=(i=Math.imul(R,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(R,H)|0,i=(i=i+Math.imul(R,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(R,V)|0,i=(i=i+Math.imul(R,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(R,Y)|0,i=(i=i+Math.imul(R,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(R,Q)|0,i=(i=i+Math.imul(R,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(R,rt)|0,i=(i=i+Math.imul(R,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(R,ot)|0,i=(i=i+Math.imul(R,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(R,ut)|0,i=(i=i+Math.imul(R,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(R,lt)|0,i=(i=i+Math.imul(R,dt)|0)+Math.imul(L,lt)|0,o=o+Math.imul(L,dt)|0;var Tt=(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)+(Tt>>>26)|0,Tt&=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 Rt=(c+(n=n+Math.imul(R,pt)|0)|0)+((8191&(i=(i=i+Math.imul(R,mt)|0)+Math.imul(L,pt)|0))<<13)|0;c=((o=o+Math.imul(L,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=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]=Tt,u[16]=Rt,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)}}(At,t.commonjsGlobal);var Mt=At.exports,It=n.safeBuffer.exports.Buffer;var Et=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 It.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=It.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=It.from(e)),!It.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")}}},xt=Et("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");const Bt=(t,e,r)=>t&e^t&r^e&r,Pt=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]),Tt=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Rt=new Uint32Array(64);class Lt extends g{constructor(){super(64,32,8,!1),this.A=0|Tt[0],this.B=0|Tt[1],this.C=0|Tt[2],this.D=0|Tt[3],this.E=0|Tt[4],this.F=0|Tt[5],this.G=0|Tt[6],this.H=0|Tt[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=d(e,7)^d(e,18)^e>>>3,i=d(r,17)^d(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+(d(s,6)^d(s,11)^d(s,25))+((h=s)&a^~h&u)+Pt[t]+Rt[t]|0,l=(d(r,2)^d(r,13)^d(r,22))+Bt(r,n,i)|0;c=u,u=a,a=s,s=o+e|0,o=i,i=n,n=r,r=e+l|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 Ot extends Lt{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 Ct=m((()=>new Lt));m((()=>new Ot));var Ut={},Nt={exports:{}};function zt(t,e,r){return e<=t&&t<=r}function Kt(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$$1.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,T=0|s[7],R=8191&T,L=T>>>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(R,q),i=(i=Math.imul(R,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(R,H)|0,i=(i=i+Math.imul(R,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(R,V)|0,i=(i=i+Math.imul(R,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(R,Y)|0,i=(i=i+Math.imul(R,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(R,Q)|0,i=(i=i+Math.imul(R,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(R,rt)|0,i=(i=i+Math.imul(R,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(R,ot)|0,i=(i=i+Math.imul(R,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(R,ut)|0,i=(i=i+Math.imul(R,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(R,lt)|0,i=(i=i+Math.imul(R,dt)|0)+Math.imul(L,lt)|0,o=o+Math.imul(L,dt)|0;var Tt=(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)+(Tt>>>26)|0,Tt&=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 Rt=(c+(n=n+Math.imul(R,pt)|0)|0)+((8191&(i=(i=i+Math.imul(R,mt)|0)+Math.imul(L,pt)|0))<<13)|0;c=((o=o+Math.imul(L,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=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]=Tt,u[16]=Rt,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)}}(Nt,t.commonjsGlobal);var Wt=-1;function qt(t){this.tokens=[].slice.call(t)}qt.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():Wt},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 Dt=-1;function jt(t,e){if(t)throw TypeError("Decoder error");return e||65533}var Ht="utf-8";function Ft(t,e){if(!(this instanceof Ft))return new Ft(t,e);if((t=void 0!==t?String(t).toLowerCase():Ht)!==Ht)throw new Error("Encoding not supported. Only utf-8 is supported");e=Kt(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 $t(t,e){if(!(this instanceof $t))return new $t(t,e);if((t=void 0!==t?String(t).toLowerCase():Ht)!==Ht)throw new Error("Encoding not supported. Only utf-8 is supported");e=Kt(e),this._streaming=!1,this._encoder=null,this._options={fatal:Boolean(e.fatal)},Object.defineProperty(this,"encoding",{value:"utf-8"})}function Vt(t){var e=t.fatal,r=0,n=0,i=0,o=128,s=191;this.handler=function(t,a){if(a===Wt&&0!==i)return i=0,jt(e);if(a===Wt)return Dt;if(0===i){if(zt(a,0,127))return a;if(zt(a,194,223))i=1,r=a-192;else if(zt(a,224,239))224===a&&(o=160),237===a&&(s=159),i=2,r=a-224;else{if(!zt(a,240,244))return jt(e);240===a&&(o=144),244===a&&(s=143),i=3,r=a-240}return r<<=6*i,null}if(!zt(a,o,s))return r=i=n=0,o=128,s=191,t.prepend(a),jt(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 Gt(t){t.fatal,this.handler=function(t,e){if(e===Wt)return Dt;if(zt(e,0,127))return e;var r,n;zt(e,128,2047)?(r=1,n=192):zt(e,2048,65535)?(r=2,n=224):zt(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}}Ft.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=Kt(e),this._streaming||(this._decoder=new Vt({fatal:this._fatal}),this._BOMseen=!1),this._streaming=Boolean(e.stream);for(var n,i=new qt(r),o=[];!i.endOfStream()&&(n=this._decoder.handler(i,i.read()))!==Dt;)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()))===Dt)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)}},$t.prototype={encode:function(t,e){t=t?String(t):"",e=Kt(e),this._streaming||(this._encoder=new Gt(this._options)),this._streaming=Boolean(e.stream);for(var r,n=[],i=new qt(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()))!==Dt;)Array.isArray(r)?n.push.apply(n,r):n.push(r);if(!this._streaming){for(;(r=this._encoder.handler(i,i.read()))!==Dt;)Array.isArray(r)?n.push.apply(n,r):n.push(r);this._encoder=null}return new Uint8Array(n)}};var Zt=Object.freeze({__proto__:null,TextEncoder:$t,TextDecoder:Ft}),Yt=t.getAugmentedNamespace(Zt),Jt=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]}),Xt=t.commonjsGlobal&&t.commonjsGlobal.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Qt=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},te=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)&&Jt(e,t,r);return Xt(e,t),e},ee=t.commonjsGlobal&&t.commonjsGlobal.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ut,"__esModule",{value:!0});var re=Ut.deserializeUnchecked=we=Ut.deserialize=me=Ut.serialize=Ut.BinaryReader=Ut.BinaryWriter=Ut.BorshError=Ut.baseDecode=Ut.baseEncode=void 0;const ne=ee(Nt.exports),ie=ee(xt),oe=te(Yt),se=new("function"!=typeof TextDecoder?oe.TextDecoder:TextDecoder)("utf-8",{fatal:!0});Ut.baseEncode=function(t){return"string"==typeof t&&(t=Buffer.from(t,"utf8")),ie.default.encode(Buffer.from(t))},Ut.baseDecode=function(t){return Buffer.from(ie.default.decode(t))};const ae=1024;class ue 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(".")}}Ut.BorshError=ue;class ce{constructor(){this.buf=Buffer.alloc(ae),this.length=0}maybeResize(){this.buf.length<16+this.length&&(this.buf=Buffer.concat([this.buf,Buffer.alloc(ae)]))}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 ne.default(t).toArray("le",8)))}writeU128(t){this.maybeResize(),this.writeBuffer(Buffer.from(new ne.default(t).toArray("le",16)))}writeU256(t){this.maybeResize(),this.writeBuffer(Buffer.from(new ne.default(t).toArray("le",32)))}writeU512(t){this.maybeResize(),this.writeBuffer(Buffer.from(new ne.default(t).toArray("le",64)))}writeBuffer(t){this.buf=Buffer.concat([Buffer.from(this.buf.subarray(0,this.length)),t,Buffer.alloc(ae)]),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 he(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 ue("Reached the end of buffer when deserializing")}throw t}}}Ut.BinaryWriter=ce;class le{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 ne.default(t,"le")}readU128(){const t=this.readBuffer(16);return new ne.default(t,"le")}readU256(){const t=this.readBuffer(32);return new ne.default(t,"le")}readU512(){const t=this.readBuffer(64);return new ne.default(t,"le")}readBuffer(t){if(this.offset+t>this.buf.length)throw new ue(`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 se.decode(e)}catch(t){throw new ue(`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 de(t){return t.charAt(0).toUpperCase()+t.slice(1)}function fe(t,e,r,n,i){try{if("string"==typeof n)i[`write${de(n)}`](r);else if(n instanceof Array)if("number"==typeof n[0]){if(r.length!==n[0])throw new ue(`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 ue(`Expecting byte array of length ${n[1]}, but got ${r.length} bytes`);for(let e=0;e<n[1];e++)fe(t,null,r[e],n[0],i)}else i.writeArray(r,(r=>{fe(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),fe(t,e,r,n.type,i));break;case"map":i.writeU32(r.size),r.forEach(((r,o)=>{fe(t,e,o,n.key,i),fe(t,e,r,n.value,i)}));break;default:throw new ue(`FieldType ${n} unrecognized`)}else pe(t,r,i)}catch(t){throw t instanceof ue&&t.addToFieldPath(e),t}}function pe(t,e,r){if("function"==typeof e.borshSerialize)return void e.borshSerialize(r);const n=t.get(e.constructor);if(!n)throw new ue(`Class ${e.constructor.name} is missing in schema`);if("struct"===n.kind)n.fields.map((([n,i])=>{fe(t,n,e[n],i,r)}));else{if("enum"!==n.kind)throw new ue(`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),fe(t,s,e[s],a,r);break}}}}}Qt([he],le.prototype,"readU8",null),Qt([he],le.prototype,"readU16",null),Qt([he],le.prototype,"readU32",null),Qt([he],le.prototype,"readU64",null),Qt([he],le.prototype,"readU128",null),Qt([he],le.prototype,"readU256",null),Qt([he],le.prototype,"readU512",null),Qt([he],le.prototype,"readString",null),Qt([he],le.prototype,"readFixedArray",null),Qt([he],le.prototype,"readArray",null),Ut.BinaryReader=le;var me=Ut.serialize=function(t,e,r=ce){const n=new r;return pe(t,e,n),n.toArray()};function ge(t,e,r,n){try{if("string"==typeof r)return n[`read${de(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(ge(t,null,r[0],n));return e}return n.readArray((()=>ge(t,e,r[0],n)))}if("option"===r.kind){return n.readU8()?ge(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=ge(t,e,r.key,n),s=ge(t,e,r.value,n);i.set(o,s)}return i}return ye(t,r,n)}catch(t){throw t instanceof ue&&t.addToFieldPath(e),t}}function ye(t,e,r){if("function"==typeof e.borshDeserialize)return e.borshDeserialize(r);const n=t.get(e);if(!n)throw new ue(`Class ${e.name} is missing in schema`);if("struct"===n.kind){const n={};for(const[i,o]of t.get(e).fields)n[i]=ge(t,i,o,r);return new e(n)}if("enum"===n.kind){const i=r.readU8();if(i>=n.values.length)throw new ue(`Enum index: ${i} is out of range`);const[o,s]=n.values[i];return new e({[o]:ge(t,o,s,r)})}throw new ue(`Unexpected schema kind: ${n.kind} for ${e.constructor.name}`)}var we=Ut.deserialize=function(t,e,r,n=le){const i=new n(r),o=ye(t,e,i);if(i.offset<r.length)throw new ue(`Unexpected ${r.length-i.offset} bytes after deserialized data`);return o};re=Ut.deserializeUnchecked=function(t,e,r,n=le){return ye(t,e,new n(r))};var be={};Object.defineProperty(be,"__esModule",{value:!0}),be.s16=be.s8=be.nu64be=be.u48be=be.u40be=be.u32be=be.u24be=be.u16be=ar=be.nu64=be.u48=be.u40=sr=be.u32=be.u24=or=be.u16=ir=be.u8=nr=be.offset=be.greedy=be.Constant=be.UTF8=be.CString=be.Blob=be.Boolean=be.BitField=be.BitStructure=be.VariantLayout=be.Union=be.UnionLayoutDiscriminator=be.UnionDiscriminator=be.Structure=be.Sequence=be.DoubleBE=be.Double=be.FloatBE=be.Float=be.NearInt64BE=be.NearInt64=be.NearUInt64BE=be.NearUInt64=be.IntBE=be.Int=be.UIntBE=be.UInt=be.OffsetLayout=be.GreedyCount=be.ExternalLayout=be.bindConstructorLayout=be.nameWithProperty=be.Layout=be.uint8ArrayToBuffer=be.checkUint8Array=void 0,be.constant=be.utf8=be.cstr=lr=be.blob=be.unionLayoutDiscriminator=be.union=hr=be.seq=be.bits=cr=be.struct=be.f64be=be.f64=be.f32be=be.f32=be.ns64be=be.s48be=be.s40be=be.s32be=be.s24be=be.s16be=ur=be.ns64=be.s48=be.s40=be.s32=be.s24=void 0;const ve=s.default;function ke(t){if(!(t instanceof Uint8Array))throw new TypeError("b must be a Uint8Array")}function Se(t){return ke(t),ve.Buffer.from(t.buffer,t.byteOffset,t.length)}be.checkUint8Array=ke,be.uint8ArrayToBuffer=Se;class _e{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 Ae(t,e){return e.property?t+"["+e.property+"]":t}be.Layout=_e,be.nameWithProperty=Ae,be.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 _e))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 Me extends _e{isCount(){throw new Error("ExternalLayout is abstract")}}be.ExternalLayout=Me;class Ie extends Me{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){ke(t);const r=t.length-e;return Math.floor(r/this.elementSpan)}encode(t,e,r){return 0}}be.GreedyCount=Ie;class Ee extends Me{constructor(t,e=0,r){if(!(t instanceof _e))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 xe||this.layout instanceof Be}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)}}be.OffsetLayout=Ee;class xe extends _e{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e=0){return Se(t).readUIntLE(e,this.span)}encode(t,e,r=0){return Se(e).writeUIntLE(t,r,this.span),this.span}}be.UInt=xe;class Be extends _e{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e=0){return Se(t).readUIntBE(e,this.span)}encode(t,e,r=0){return Se(e).writeUIntBE(t,r,this.span),this.span}}be.UIntBE=Be;class Pe extends _e{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e=0){return Se(t).readIntLE(e,this.span)}encode(t,e,r=0){return Se(e).writeIntLE(t,r,this.span),this.span}}be.Int=Pe;class Te extends _e{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e=0){return Se(t).readIntBE(e,this.span)}encode(t,e,r=0){return Se(e).writeIntBE(t,r,this.span),this.span}}be.IntBE=Te;const Re=Math.pow(2,32);function Le(t){const e=Math.floor(t/Re);return{hi32:e,lo32:t-e*Re}}function Oe(t,e){return t*Re+e}class Ce extends _e{constructor(t){super(8,t)}decode(t,e=0){const r=Se(t),n=r.readUInt32LE(e);return Oe(r.readUInt32LE(e+4),n)}encode(t,e,r=0){const n=Le(t),i=Se(e);return i.writeUInt32LE(n.lo32,r),i.writeUInt32LE(n.hi32,r+4),8}}be.NearUInt64=Ce;class Ue extends _e{constructor(t){super(8,t)}decode(t,e=0){const r=Se(t);return Oe(r.readUInt32BE(e),r.readUInt32BE(e+4))}encode(t,e,r=0){const n=Le(t),i=Se(e);return i.writeUInt32BE(n.hi32,r),i.writeUInt32BE(n.lo32,r+4),8}}be.NearUInt64BE=Ue;class Ne extends _e{constructor(t){super(8,t)}decode(t,e=0){const r=Se(t),n=r.readUInt32LE(e);return Oe(r.readInt32LE(e+4),n)}encode(t,e,r=0){const n=Le(t),i=Se(e);return i.writeUInt32LE(n.lo32,r),i.writeInt32LE(n.hi32,r+4),8}}be.NearInt64=Ne;class ze extends _e{constructor(t){super(8,t)}decode(t,e=0){const r=Se(t);return Oe(r.readInt32BE(e),r.readUInt32BE(e+4))}encode(t,e,r=0){const n=Le(t),i=Se(e);return i.writeInt32BE(n.hi32,r),i.writeUInt32BE(n.lo32,r+4),8}}be.NearInt64BE=ze;class Ke extends _e{constructor(t){super(4,t)}decode(t,e=0){return Se(t).readFloatLE(e)}encode(t,e,r=0){return Se(e).writeFloatLE(t,r),4}}be.Float=Ke;class We extends _e{constructor(t){super(4,t)}decode(t,e=0){return Se(t).readFloatBE(e)}encode(t,e,r=0){return Se(e).writeFloatBE(t,r),4}}be.FloatBE=We;class qe extends _e{constructor(t){super(8,t)}decode(t,e=0){return Se(t).readDoubleLE(e)}encode(t,e,r=0){return Se(e).writeDoubleLE(t,r),8}}be.Double=qe;class De extends _e{constructor(t){super(8,t)}decode(t,e=0){return Se(t).readDoubleBE(e)}encode(t,e,r=0){return Se(e).writeDoubleBE(t,r),8}}be.DoubleBE=De;class je extends _e{constructor(t,e,r){if(!(t instanceof _e))throw new TypeError("elementLayout must be a Layout");if(!(e instanceof Me&&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 Me)&&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 Me&&(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 Me&&(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 Me&&this.count.encode(t.length,e,r),i}}be.Sequence=je;class He extends _e{constructor(t,e,r){if(!Array.isArray(t)||!t.reduce(((t,e)=>t&&e instanceof _e),!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){ke(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)}}}be.Structure=He;class Fe{constructor(t){this.property=t}decode(t,e){throw new Error("UnionDiscriminator is abstract")}encode(t,e,r){throw new Error("UnionDiscriminator is abstract")}}be.UnionDiscriminator=Fe;class $e extends Fe{constructor(t,e){if(!(t instanceof Me&&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)}}be.UnionLayoutDiscriminator=$e;class Ve extends _e{constructor(t,e,r){let n;if(t instanceof xe||t instanceof Be)n=new $e(new Ee(t));else if(t instanceof Me&&t.isCount())n=new $e(t);else{if(!(t instanceof Fe))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 _e))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 xe||t instanceof Be)&&(i+=n.layout.span)),super(i,r),this.discriminator=n,this.usesPrefixDiscriminator=t instanceof xe||t instanceof Be,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 Ge(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]}}be.Union=Ve;class Ge extends _e{constructor(t,e,r,n){if(!(t instanceof Ve))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 _e))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 Ze(t){return 0>t&&(t+=4294967296),t}be.VariantLayout=Ge;class Ye extends _e{constructor(t,e,r){if(!(t instanceof xe||t instanceof Be))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=Ze(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 Je(this,t,e);return this.fields.push(r),r}addBoolean(t){const e=new Xe(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}}be.BitStructure=Ye;class Je{constructor(t,e,r){if(!(t instanceof Ye))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=Ze(this.valueMask<<this.start),this.property=r}decode(t,e){return Ze(this.container._packedGetValue()&this.wordMask)>>>this.start}encode(t){if("number"!=typeof t||!Number.isInteger(t)||t!==Ze(t&this.valueMask))throw new TypeError(Ae("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const e=this.container._packedGetValue(),r=Ze(t<<this.start);this.container._packedSetValue(Ze(e&~this.wordMask)|r)}}be.BitField=Je;class Xe extends Je{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)}}be.Boolean=Xe;class Qe extends _e{constructor(t,e){if(!(t instanceof Me&&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 Me||(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)),Se(t).slice(e,e+r)}encode(t,e,r){let n=this.length;if(this.length instanceof Me&&(n=t.length),!(t instanceof Uint8Array&&n===t.length))throw new TypeError(Ae("Blob.encode",this)+" requires (length "+n+") Uint8Array as src");if(r+n>e.length)throw new RangeError("encoding overruns Uint8Array");const i=Se(t);return Se(e).write(i.toString("hex"),r,n,"hex"),this.length instanceof Me&&this.length.encode(n,e,r),n}}be.Blob=Qe;class tr extends _e{constructor(t){super(-1,t)}getSpan(t,e=0){ke(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 Se(t).slice(e,e+r-1).toString("utf-8")}encode(t,e,r=0){"string"!=typeof t&&(t=String(t));const n=ve.Buffer.from(t,"utf8"),i=n.length;if(r+i>e.length)throw new RangeError("encoding overruns Buffer");const o=Se(e);return n.copy(o,r),o[r+i]=0,i+1}}be.CString=tr;class er extends _e{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 ke(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 Se(t).slice(e,e+r).toString("utf-8")}encode(t,e,r=0){"string"!=typeof t&&(t=String(t));const n=ve.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(Se(e),r),i}}be.UTF8=er;class rr extends _e{constructor(t,e){super(0,e),this.value=t}decode(t,e){return this.value}encode(t,e,r){return 0}}be.Constant=rr,be.greedy=(t,e)=>new Ie(t,e);var nr=be.offset=(t,e,r)=>new Ee(t,e,r),ir=be.u8=t=>new xe(1,t),or=be.u16=t=>new xe(2,t);be.u24=t=>new xe(3,t);var sr=be.u32=t=>new xe(4,t);be.u40=t=>new xe(5,t),be.u48=t=>new xe(6,t);var ar=be.nu64=t=>new Ce(t);be.u16be=t=>new Be(2,t),be.u24be=t=>new Be(3,t),be.u32be=t=>new Be(4,t),be.u40be=t=>new Be(5,t),be.u48be=t=>new Be(6,t),be.nu64be=t=>new Ue(t),be.s8=t=>new Pe(1,t),be.s16=t=>new Pe(2,t),be.s24=t=>new Pe(3,t),be.s32=t=>new Pe(4,t),be.s40=t=>new Pe(5,t),be.s48=t=>new Pe(6,t);var ur=be.ns64=t=>new Ne(t);be.s16be=t=>new Te(2,t),be.s24be=t=>new Te(3,t),be.s32be=t=>new Te(4,t),be.s40be=t=>new Te(5,t),be.s48be=t=>new Te(6,t),be.ns64be=t=>new ze(t),be.f32=t=>new Ke(t),be.f32be=t=>new We(t),be.f64=t=>new qe(t),be.f64be=t=>new De(t);var cr=be.struct=(t,e,r)=>new He(t,e,r);be.bits=(t,e,r)=>new Ye(t,e,r);var hr=be.seq=(t,e,r)=>new je(t,e,r);be.union=(t,e,r)=>new Ve(t,e,r),be.unionLayoutDiscriminator=(t,e)=>new $e(t,e);var lr=be.blob=(t,e)=>new Qe(t,e);be.cstr=t=>new tr(t),be.utf8=(t,e)=>new er(t,e),be.constant=(t,e)=>new rr(t,e);var dr={};Object.defineProperty(dr,"__esModule",{value:!0});var fr=dr.toBigIntLE=function(t){{const e=Buffer.from(t);e.reverse();const r=e.toString("hex");return 0===r.length?BigInt(0):BigInt(`0x${r}`)}};dr.toBigIntBE=function(t){{const e=t.toString("hex");return 0===e.length?BigInt(0):BigInt(`0x${e}`)}};var pr,mr,gr=dr.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}};dr.toBufferBE=function(t,e){{const r=t.toString(16);return Buffer.from(r.padStart(2*e,"0").slice(0,2*e),"hex")}};class yr 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 wr(t){return"object"==typeof t&&null!=t}function br(t){return"string"==typeof t?JSON.stringify(t):""+t}function vr(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: `"+br(n)+"`"}=t;return{value:n,type:s,refinement:a,key:i[i.length-1],path:i,branch:o,...t,message:u}}function*kr(t,e,r,n){var i;wr(i=t)&&"function"==typeof i[Symbol.iterator]||(t=[t]);for(const i of t){const t=vr(i,e,r,n);t&&(yield t)}}function*Sr(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&&wr(e.schema)&&wr(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=Sr(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):wr(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 _r{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)=>kr(n(t,e),e,this,t):()=>[],this.refiner=i?(t,e)=>kr(i(t,e),e,this,t):()=>[]}assert(t){return Ar(t,this)}create(t){return Mr(t,this)}is(t){return Ir(t,this)}mask(t){return function(t,e){const r=Er(t,e,{coerce:!0,mask:!0});if(r[0])throw r[0];return r[1]}(t,this)}validate(t,e={}){return Er(t,this,e)}}function Ar(t,e){const r=Er(t,e);if(r[0])throw r[0]}function Mr(t,e){const r=Er(t,e,{coerce:!0});if(r[0])throw r[0];return r[1]}function Ir(t,e){return!Er(t,e)[0]}function Er(t,e,r={}){const n=Sr(t,e,r),i=function(t){const{done:e,value:r}=t.next();return e?void 0:r}(n);if(i[0]){return[new yr(i[0],(function*(){for(const t of n)t[0]&&(yield t[0])})),void 0]}return[void 0,i[1]]}function xr(t,e){return new _r({type:t,schema:null,validator:e})}function Br(t){return new _r({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: "+br(t)})}function Pr(){return xr("boolean",(t=>"boolean"==typeof t))}function Tr(t){return xr("instance",(e=>e instanceof t||"Expected a `"+t.name+"` instance, but received: "+br(e)))}function Rr(t){const e=br(t),r=typeof t;return new _r({type:"literal",schema:"string"===r||"number"===r||"boolean"===r?t:null,validator:r=>r===t||"Expected the literal `"+e+"`, but received: "+br(r)})}function Lr(t){return new _r({...t,validator:(e,r)=>null===e||t.validator(e,r),refiner:(e,r)=>null===e||t.refiner(e,r)})}function Or(){return xr("number",(t=>"number"==typeof t&&!isNaN(t)||"Expected a number, but received: "+br(t)))}function Cr(t){return new _r({...t,validator:(e,r)=>void 0===e||t.validator(e,r),refiner:(e,r)=>void 0===e||t.refiner(e,r)})}function Ur(t,e){return new _r({type:"record",schema:null,*entries(r){if(wr(r))for(const n in r){const i=r[n];yield[n,n,t],yield[n,i,e]}},validator:t=>wr(t)||"Expected an object, but received: "+br(t)})}function Nr(){return xr("string",(t=>"string"==typeof t||"Expected a string, but received: "+br(t)))}function zr(t){const e=xr("never",(()=>!1));return new _r({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: "+br(t)})}function Kr(t){const e=Object.keys(t);return new _r({type:"type",schema:t,*entries(r){if(wr(r))for(const n of e)yield[n,r[n],t[n]]},validator:t=>wr(t)||"Expected an object, but received: "+br(t)})}function Wr(t){const e=t.map((t=>t.type)).join(" | ");return new _r({type:"union",schema:null,validator(r,n){const i=[];for(const e of t){const[...t]=Sr(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: "+br(r),...i]}})}function qr(){return xr("unknown",(()=>!0))}function Dr(t,e,r){return new _r({...t,coercer:(n,i)=>Ir(n,e)?t.coercer(r(n,i),i):t.coercer(n,i)})}var jr=0,Hr=0;function Fr(t){if(!i.validate(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 $r(t,e,r){function n(t,n,o,s){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=Fr(n)),16!==n.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var a=new Uint8Array(16+t.length);if(a.set(n),a.set(t,n.length),(a=r(a))[6]=15&a[6]|e,a[8]=63&a[8]|128,o){s=s||0;for(var u=0;u<16;++u)o[s+u]=a[u];return o}return i.stringify(a)}try{n.name=t}catch(t){}return n.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",n.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",n}function Vr(t){return 14+(t+64>>>9<<4)+1}function Gr(t,e){var r=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(r>>16)<<16|65535&r}function Zr(t,e,r,n,i,o){return Gr((s=Gr(Gr(e,t),Gr(n,o)))<<(a=i)|s>>>32-a,r);var s,a}function Yr(t,e,r,n,i,o,s){return Zr(e&r|~e&n,t,e,i,o,s)}function Jr(t,e,r,n,i,o,s){return Zr(e&n|r&~n,t,e,i,o,s)}function Xr(t,e,r,n,i,o,s){return Zr(e^r^n,t,e,i,o,s)}function Qr(t,e,r,n,i,o,s){return Zr(r^(e|~n),t,e,i,o,s)}var tn=$r("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[Vr(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=Yr(r,n,i,o,t[s],7,-680876936),o=Yr(o,r,n,i,t[s+1],12,-389564586),i=Yr(i,o,r,n,t[s+2],17,606105819),n=Yr(n,i,o,r,t[s+3],22,-1044525330),r=Yr(r,n,i,o,t[s+4],7,-176418897),o=Yr(o,r,n,i,t[s+5],12,1200080426),i=Yr(i,o,r,n,t[s+6],17,-1473231341),n=Yr(n,i,o,r,t[s+7],22,-45705983),r=Yr(r,n,i,o,t[s+8],7,1770035416),o=Yr(o,r,n,i,t[s+9],12,-1958414417),i=Yr(i,o,r,n,t[s+10],17,-42063),n=Yr(n,i,o,r,t[s+11],22,-1990404162),r=Yr(r,n,i,o,t[s+12],7,1804603682),o=Yr(o,r,n,i,t[s+13],12,-40341101),i=Yr(i,o,r,n,t[s+14],17,-1502002290),r=Jr(r,n=Yr(n,i,o,r,t[s+15],22,1236535329),i,o,t[s+1],5,-165796510),o=Jr(o,r,n,i,t[s+6],9,-1069501632),i=Jr(i,o,r,n,t[s+11],14,643717713),n=Jr(n,i,o,r,t[s],20,-373897302),r=Jr(r,n,i,o,t[s+5],5,-701558691),o=Jr(o,r,n,i,t[s+10],9,38016083),i=Jr(i,o,r,n,t[s+15],14,-660478335),n=Jr(n,i,o,r,t[s+4],20,-405537848),r=Jr(r,n,i,o,t[s+9],5,568446438),o=Jr(o,r,n,i,t[s+14],9,-1019803690),i=Jr(i,o,r,n,t[s+3],14,-187363961),n=Jr(n,i,o,r,t[s+8],20,1163531501),r=Jr(r,n,i,o,t[s+13],5,-1444681467),o=Jr(o,r,n,i,t[s+2],9,-51403784),i=Jr(i,o,r,n,t[s+7],14,1735328473),r=Xr(r,n=Jr(n,i,o,r,t[s+12],20,-1926607734),i,o,t[s+5],4,-378558),o=Xr(o,r,n,i,t[s+8],11,-2022574463),i=Xr(i,o,r,n,t[s+11],16,1839030562),n=Xr(n,i,o,r,t[s+14],23,-35309556),r=Xr(r,n,i,o,t[s+1],4,-1530992060),o=Xr(o,r,n,i,t[s+4],11,1272893353),i=Xr(i,o,r,n,t[s+7],16,-155497632),n=Xr(n,i,o,r,t[s+10],23,-1094730640),r=Xr(r,n,i,o,t[s+13],4,681279174),o=Xr(o,r,n,i,t[s],11,-358537222),i=Xr(i,o,r,n,t[s+3],16,-722521979),n=Xr(n,i,o,r,t[s+6],23,76029189),r=Xr(r,n,i,o,t[s+9],4,-640364487),o=Xr(o,r,n,i,t[s+12],11,-421815835),i=Xr(i,o,r,n,t[s+15],16,530742520),r=Qr(r,n=Xr(n,i,o,r,t[s+2],23,-995338651),i,o,t[s],6,-198630844),o=Qr(o,r,n,i,t[s+7],10,1126891415),i=Qr(i,o,r,n,t[s+14],15,-1416354905),n=Qr(n,i,o,r,t[s+5],21,-57434055),r=Qr(r,n,i,o,t[s+12],6,1700485571),o=Qr(o,r,n,i,t[s+3],10,-1894986606),i=Qr(i,o,r,n,t[s+10],15,-1051523),n=Qr(n,i,o,r,t[s+1],21,-2054922799),r=Qr(r,n,i,o,t[s+8],6,1873313359),o=Qr(o,r,n,i,t[s+15],10,-30611744),i=Qr(i,o,r,n,t[s+6],15,-1560198380),n=Qr(n,i,o,r,t[s+13],21,1309151649),r=Qr(r,n,i,o,t[s+4],6,-145523070),o=Qr(o,r,n,i,t[s+11],10,-1120210379),i=Qr(i,o,r,n,t[s+2],15,718787259),n=Qr(n,i,o,r,t[s+9],21,-343485551),r=Gr(r,a),n=Gr(n,u),i=Gr(i,c),o=Gr(o,h)}return[r,n,i,o]}(function(t){if(0===t.length)return[];for(var e=8*t.length,r=new Uint32Array(Vr(e)),n=0;n<e;n+=8)r[n>>5]|=(255&t[n/8])<<n%32;return r}(t),8*t.length))})),en=tn;function rn(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 nn(t,e){return t<<e|t>>>32-e}var on=$r("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]=nn(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=nn(m,5)+rn(k,g,y,w)+b+e[k]+d[v]>>>0;b=w,w=y,y=nn(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]]})),sn=on;var an=Object.freeze({__proto__:null,v1:function(t,e,r){var n=e&&r||0,o=e||new Array(16),s=(t=t||{}).node||pr,a=void 0!==t.clockseq?t.clockseq:mr;if(null==s||null==a){var u=t.random||(t.rng||i.rng)();null==s&&(s=pr=[1|u[0],u[1],u[2],u[3],u[4],u[5]]),null==a&&(a=mr=16383&(u[6]<<8|u[7]))}var c=void 0!==t.msecs?t.msecs:Date.now(),h=void 0!==t.nsecs?t.nsecs:Hr+1,l=c-jr+(h-Hr)/1e4;if(l<0&&void 0===t.clockseq&&(a=a+1&16383),(l<0||c>jr)&&void 0===t.nsecs&&(h=0),h>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");jr=c,Hr=h,mr=a;var d=(1e4*(268435455&(c+=122192928e5))+h)%4294967296;o[n++]=d>>>24&255,o[n++]=d>>>16&255,o[n++]=d>>>8&255,o[n++]=255&d;var f=c/4294967296*1e4&268435455;o[n++]=f>>>8&255,o[n++]=255&f,o[n++]=f>>>24&15|16,o[n++]=f>>>16&255,o[n++]=a>>>8|128,o[n++]=255&a;for(var p=0;p<6;++p)o[n+p]=s[p];return e||i.stringify(o)},v3:en,v4:i.v4,v5:sn,NIL:"00000000-0000-0000-0000-000000000000",version:function(t){if(!i.validate(t))throw TypeError("Invalid UUID");return parseInt(t.substr(14,1),16)},validate:i.validate,stringify:i.stringify,parse:Fr}),un=t.getAugmentedNamespace(an);const cn=un.v4;var hn=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 cn()};o.id=t(o,n)}else 2===i&&null===r?n.notificationIdNull&&(o.id=null):o.id=r;return o};const ln=un.v4,dn=hn,fn=function(t,e){if(!(this instanceof fn))return new fn(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 ln()},version:void 0!==e.version?e.version:2,notificationIdNull:"boolean"==typeof e.notificationIdNull&&e.notificationIdNull},this.callServer=t};var pn=fn;fn.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=dn(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},fn.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 mn,gn={},yn={exports:{}};(mn=yn).exports=function(t){return t&&t.__esModule?t:{default:t}},mn.exports.__esModule=!0,mn.exports.default=mn.exports;var wn,bn,vn,kn,Sn={exports:{}},_n={exports:{}};function An(){return wn||(wn=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}(_n)),_n.exports}function Mn(){return bn||(bn=1,function(t){var e=An().default;function r(){
|