@depay/widgets 10.2.7 → 10.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.bundle.js
CHANGED
|
@@ -53,7 +53,7 @@ o((function(t,e){}));var rh=o((function(t){!function t(){if("undefined"!=typeof
|
|
|
53
53
|
/*! https://mths.be/punycode v1.4.1 by @mathias */
|
|
54
54
|
var $A=2147483647,tx=36,ex=1,nx=26,rx=38,ix=700,ox=72,ax=128,sx="-",ux=/[^\x20-\x7E]/,cx=/[\x2E\u3002\uFF0E\uFF61]/g,lx={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},hx=tx-ex,dx=Math.floor,fx=String.fromCharCode;function px(t){throw new RangeError(lx[t])}function mx(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function gx(t,e,n){var r=0;for(t=n?dx(t/ix):t>>1,t+=dx(t/e);t>hx*nx>>1;r+=tx)t=dx(t/hx);return dx(r+(hx+1)*t/(t+rx))}function yx(t){return function(t,e){var n=t.split("@"),r="";n.length>1&&(r=n[0]+"@",t=n[1]);var i=function(t,e){for(var n=t.length,r=[];n--;)r[n]=e(t[n]);return r}((t=t.replace(cx,".")).split("."),e).join(".");return r+i}(t,(function(t){return ux.test(t)?"xn--"+function(t){var e,n,r,i,o,a,s,u,c,l,h,d,f,p,m,g=[];for(t=function(t){for(var e,n,r=[],i=0,o=t.length;i<o;)(e=t.charCodeAt(i++))>=55296&&e<=56319&&i<o?56320==(64512&(n=t.charCodeAt(i++)))?r.push(((1023&e)<<10)+(1023&n)+65536):(r.push(e),i--):r.push(e);return r}(t),d=t.length,e=ax,n=0,o=ox,a=0;a<d;++a)(h=t[a])<128&&g.push(fx(h));for(r=i=g.length,i&&g.push(sx);r<d;){for(s=$A,a=0;a<d;++a)(h=t[a])>=e&&h<s&&(s=h);for(s-e>dx(($A-n)/(f=r+1))&&px("overflow"),n+=(s-e)*f,e=s,a=0;a<d;++a)if((h=t[a])<e&&++n>$A&&px("overflow"),h==e){for(u=n,c=tx;!(u<(l=c<=o?ex:c>=o+nx?nx:c-o));c+=tx)m=u-l,p=tx-l,g.push(fx(mx(l+m%p,0))),u=dx(m/p);g.push(fx(mx(u,0))),o=gx(n,f,r==i),n=0,++r}++n,++e}return g.join("")}(t):t}))}function bx(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var vx=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function wx(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}}function Mx(t,e){if(t.map)return t.map(e);for(var n=[],r=0;r<t.length;r++)n.push(e(t[r],r));return n}var _x=Object.keys||function(t){var e=[];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.push(n);return e};function Ex(t,e,n,r){e=e||"&",n=n||"=";var i={};if("string"!=typeof t||0===t.length)return i;var o=/\+/g;t=t.split(e);var a=1e3;r&&"number"==typeof r.maxKeys&&(a=r.maxKeys);var s=t.length;a>0&&s>a&&(s=a);for(var u=0;u<s;++u){var c,l,h,d,f=t[u].replace(o,"%20"),p=f.indexOf(n);p>=0?(c=f.substr(0,p),l=f.substr(p+1)):(c=f,l=""),h=decodeURIComponent(c),d=decodeURIComponent(l),bx(i,h)?vx(i[h])?i[h].push(d):i[h]=[i[h],d]:i[h]=d}return i}var Nx={parse:Bx,resolve:Qx,resolveObject:Hx,fileURLToPath:Fx,format:Wx,Url:Lx};function Lx(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var Sx=/^([a-z0-9.+-]+:)/i,Ax=/:[0-9]*$/,xx=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,Tx=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),Ix=["'"].concat(Tx),kx=["%","/","?",";","#"].concat(Ix),jx=["/","?","#"],Cx=255,Dx=/^[+a-z0-9A-Z_-]{0,63}$/,Ox=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,zx={javascript:!0,"javascript:":!0},Px={javascript:!0,"javascript:":!0},Rx={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function Bx(t,e,n){if(t&&KS(t)&&t instanceof Lx)return t;var r=new Lx;return r.parse(t,e,n),r}function Ux(t,e,n,r){if(!VS(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var i=e.indexOf("?"),o=-1!==i&&i<e.indexOf("#")?"?":"#",a=e.split(o);a[0]=a[0].replace(/\\/g,"/");var s=e=a.join(o);if(s=s.trim(),!r&&1===e.split("#").length){var u=xx.exec(s);if(u)return t.path=s,t.href=s,t.pathname=u[1],u[2]?(t.search=u[2],t.query=n?Ex(t.search.substr(1)):t.search.substr(1)):n&&(t.search="",t.query={}),t}var c,l,h,d,f=Sx.exec(s);if(f){var p=(f=f[0]).toLowerCase();t.protocol=p,s=s.substr(f.length)}if(r||f||s.match(/^\/\/[^@\/]+@[^@\/]+/)){var m="//"===s.substr(0,2);!m||f&&Px[f]||(s=s.substr(2),t.slashes=!0)}if(!Px[f]&&(m||f&&!Rx[f])){var g,y,b=-1;for(c=0;c<jx.length;c++)-1!==(l=s.indexOf(jx[c]))&&(-1===b||l<b)&&(b=l);for(-1!==(y=-1===b?s.lastIndexOf("@"):s.lastIndexOf("@",b))&&(g=s.slice(0,y),s=s.slice(y+1),t.auth=decodeURIComponent(g)),b=-1,c=0;c<kx.length;c++)-1!==(l=s.indexOf(kx[c]))&&(-1===b||l<b)&&(b=l);-1===b&&(b=s.length),t.host=s.slice(0,b),s=s.slice(b),Gx(t),t.hostname=t.hostname||"";var v="["===t.hostname[0]&&"]"===t.hostname[t.hostname.length-1];if(!v){var w=t.hostname.split(/\./);for(c=0,h=w.length;c<h;c++){var M=w[c];if(M&&!M.match(Dx)){for(var _="",E=0,N=M.length;E<N;E++)M.charCodeAt(E)>127?_+="x":_+=M[E];if(!_.match(Dx)){var L=w.slice(0,c),S=w.slice(c+1),A=M.match(Ox);A&&(L.push(A[1]),S.unshift(A[2])),S.length&&(s="/"+S.join(".")+s),t.hostname=L.join(".");break}}}}t.hostname.length>Cx?t.hostname="":t.hostname=t.hostname.toLowerCase(),v||(t.hostname=yx(t.hostname)),d=t.port?":"+t.port:"";var x=t.hostname||"";t.host=x+d,t.href+=t.host,v&&(t.hostname=t.hostname.substr(1,t.hostname.length-2),"/"!==s[0]&&(s="/"+s))}if(!zx[p])for(c=0,h=Ix.length;c<h;c++){var T=Ix[c];if(-1!==s.indexOf(T)){var I=encodeURIComponent(T);I===T&&(I=escape(T)),s=s.split(T).join(I)}}var k=s.indexOf("#");-1!==k&&(t.hash=s.substr(k),s=s.slice(0,k));var j=s.indexOf("?");if(-1!==j?(t.search=s.substr(j),t.query=s.substr(j+1),n&&(t.query=Ex(t.query)),s=s.slice(0,j)):n&&(t.search="",t.query={}),s&&(t.pathname=s),Rx[p]&&t.hostname&&!t.pathname&&(t.pathname="/"),t.pathname||t.search){d=t.pathname||"";var C=t.search||"";t.path=d+C}return t.href=Yx(t),t}function Fx(t){if("string"==typeof t)t=(new Lx).parse(t);else if(!(url instanceof Lx))throw new TypeError('The "path" argument must be of type string or an instance of URL. Received type '+typeof t+String(t));if("file:"!==t.protocol)throw new TypeError("The URL must be of scheme file");return function(t){const e=t.pathname;for(let t=0;t<e.length;t++)if("%"===e[t]){const n=32|e.codePointAt(t+2);if("2"===e[t+1]&&102===n)throw new TypeError("must not include encoded / characters")}return decodeURIComponent(e)}(t)}function Wx(t){return VS(t)&&(t=Ux({},t)),Yx(t)}function Yx(t){var e=t.auth||"";e&&(e=(e=encodeURIComponent(e)).replace(/%3A/i,":"),e+="@");var n=t.protocol||"",r=t.pathname||"",i=t.hash||"",o=!1,a="";t.host?o=e+t.host:t.hostname&&(o=e+(-1===t.hostname.indexOf(":")?t.hostname:"["+this.hostname+"]"),t.port&&(o+=":"+t.port)),t.query&&KS(t.query)&&Object.keys(t.query).length&&(a=function(t,e,n,r){return e=e||"&",n=n||"=",null===t&&(t=void 0),"object"==typeof t?Mx(_x(t),(function(r){var i=encodeURIComponent(wx(r))+n;return vx(t[r])?Mx(t[r],(function(t){return i+encodeURIComponent(wx(t))})).join(e):i+encodeURIComponent(wx(t[r]))})).join(e):r?encodeURIComponent(wx(r))+n+encodeURIComponent(wx(t)):""}(t.query));var s=t.search||a&&"?"+a||"";return n&&":"!==n.substr(-1)&&(n+=":"),t.slashes||(!n||Rx[n])&&!1!==o?(o="//"+(o||""),r&&"/"!==r.charAt(0)&&(r="/"+r)):o||(o=""),i&&"#"!==i.charAt(0)&&(i="#"+i),s&&"?"!==s.charAt(0)&&(s="?"+s),n+o+(r=r.replace(/[?#]/g,(function(t){return encodeURIComponent(t)})))+(s=s.replace("#","%23"))+i}function Qx(t,e){return Bx(t,!1,!0).resolve(e)}function Hx(t,e){return t?Bx(t,!1,!0).resolveObject(e):e}function Gx(t){var e=t.host,n=Ax.exec(e);n&&(":"!==(n=n[0])&&(t.port=n.substr(1)),e=e.substr(0,e.length-n.length)),e&&(t.hostname=e)}Lx.prototype.parse=function(t,e,n){return Ux(this,t,e,n)},Lx.prototype.format=function(){return Yx(this)},Lx.prototype.resolve=function(t){return this.resolveObject(Bx(t,!1,!0)).format()},Lx.prototype.resolveObject=function(t){if(VS(t)){var e=new Lx;e.parse(t,!1,!0),t=e}for(var n,r=new Lx,i=Object.keys(this),o=0;o<i.length;o++){var a=i[o];r[a]=this[a]}if(r.hash=t.hash,""===t.href)return r.href=r.format(),r;if(t.slashes&&!t.protocol){for(var s=Object.keys(t),u=0;u<s.length;u++){var c=s[u];"protocol"!==c&&(r[c]=t[c])}return Rx[r.protocol]&&r.hostname&&!r.pathname&&(r.path=r.pathname="/"),r.href=r.format(),r}if(t.protocol&&t.protocol!==r.protocol){if(!Rx[t.protocol]){for(var l=Object.keys(t),h=0;h<l.length;h++){var d=l[h];r[d]=t[d]}return r.href=r.format(),r}if(r.protocol=t.protocol,t.host||Px[t.protocol])r.pathname=t.pathname;else{for(n=(t.pathname||"").split("/");n.length&&!(t.host=n.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),""!==n[0]&&n.unshift(""),n.length<2&&n.unshift(""),r.pathname=n.join("/")}if(r.search=t.search,r.query=t.query,r.host=t.host||"",r.auth=t.auth,r.hostname=t.hostname||t.host,r.port=t.port,r.pathname||r.search){var f=r.pathname||"",p=r.search||"";r.path=f+p}return r.slashes=r.slashes||t.slashes,r.href=r.format(),r}var m,g=r.pathname&&"/"===r.pathname.charAt(0),y=t.host||t.pathname&&"/"===t.pathname.charAt(0),b=y||g||r.host&&t.pathname,v=b,w=r.pathname&&r.pathname.split("/")||[],M=r.protocol&&!Rx[r.protocol];if(n=t.pathname&&t.pathname.split("/")||[],M&&(r.hostname="",r.port=null,r.host&&(""===w[0]?w[0]=r.host:w.unshift(r.host)),r.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(""===n[0]?n[0]=t.host:n.unshift(t.host)),t.host=null),b=b&&(""===n[0]||""===w[0])),y)r.host=t.host||""===t.host?t.host:r.host,r.hostname=t.hostname||""===t.hostname?t.hostname:r.hostname,r.search=t.search,r.query=t.query,w=n;else if(n.length)w||(w=[]),w.pop(),w=w.concat(n),r.search=t.search,r.query=t.query;else if(null!=t.search)return M&&(r.hostname=r.host=w.shift(),(m=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=m.shift(),r.host=r.hostname=m.shift())),r.search=t.search,r.query=t.query,ZS(r.pathname)&&ZS(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r;if(!w.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var _=w.slice(-1)[0],E=(r.host||t.host||w.length>1)&&("."===_||".."===_)||""===_,N=0,L=w.length;L>=0;L--)"."===(_=w[L])?w.splice(L,1):".."===_?(w.splice(L,1),N++):N&&(w.splice(L,1),N--);if(!b&&!v)for(;N--;N)w.unshift("..");!b||""===w[0]||w[0]&&"/"===w[0].charAt(0)||w.unshift(""),E&&"/"!==w.join("/").substr(-1)&&w.push("");var S=""===w[0]||w[0]&&"/"===w[0].charAt(0);return M&&(r.hostname=r.host=S?"":w.length?w.shift():"",(m=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=m.shift(),r.host=r.hostname=m.shift())),(b=b||r.host&&w.length)&&!S&&w.unshift(""),w.length?r.pathname=w.join("/"):(r.pathname=null,r.path=null),ZS(r.pathname)&&ZS(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r},Lx.prototype.parseHost=function(){return Gx(this)};var Zx=Object.freeze({__proto__:null,parse:Bx,resolve:Qx,resolveObject:Hx,fileURLToPath:Fx,format:Wx,default:Nx,Url:Lx});function Vx(t,e){"string"==typeof t&&(t=Bx(t));var n=-1===$M.location.protocol.search(/^https?:$/)?"http:":"",r=t.protocol||n,i=t.hostname||t.host,o=t.port,a=t.path||"/";i&&-1!==i.indexOf(":")&&(i="["+i+"]"),t.url=(i?r+"//"+i:"")+(o?":"+o:"")+a,t.method=(t.method||"GET").toUpperCase(),t.headers=t.headers||{};var s=new KA(t);return e&&s.on("response",e),s}function qx(t,e){var n=Vx(t,e);return n.end(),n}function Jx(){}Jx.defaultMaxSockets=4;var Kx=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"],Xx={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",300:"Multiple Choices",301:"Moved Permanently",302:"Moved Temporarily",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Time-out",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Request Entity Too Large",414:"Request-URI Too Large",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Time-out",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"},$x={request:Vx,get:qx,Agent:Jx,METHODS:Kx,STATUS_CODES:Xx},tT=XM(Object.freeze({__proto__:null,request:Vx,get:qx,Agent:Jx,METHODS:Kx,STATUS_CODES:Xx,default:$x}));function eT(t,e){"string"==typeof t&&(t=Bx(t));var n=-1===$M.location.protocol.search(/^https?:$/)?"http:":"",r=t.protocol||n,i=t.hostname||t.host,o=t.port,a=t.path||"/";i&&-1!==i.indexOf(":")&&(i="["+i+"]"),t.url=(i?r+"//"+i:"")+(o?":"+o:"")+a,t.method=(t.method||"GET").toUpperCase(),t.headers=t.headers||{};var s=new KA(t);return e&&s.on("response",e),s}function nT(t,e){var n=eT(t,e);return n.end(),n}function rT(){}rT.defaultMaxSockets=4;var iT=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"],oT={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",300:"Multiple Choices",301:"Moved Permanently",302:"Moved Temporarily",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Time-out",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Request Entity Too Large",414:"Request-URI Too Large",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Time-out",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"},aT={request:eT,get:nT,Agent:rT,METHODS:iT,STATUS_CODES:oT},sT=XM(Object.freeze({__proto__:null,request:eT,get:nT,Agent:rT,METHODS:iT,STATUS_CODES:oT,default:aT})),uT=XM(Object.freeze({__proto__:null,default:{}})),cT=XM(Object.freeze({__proto__:null,default:{}})),lT=XM(ZA),hT=XM(Zx),dT={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"};function fT(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}function pT(t,e,n,r,i){if(e.subarray&&t.subarray)t.set(e.subarray(n,n+r),i);else for(var o=0;o<r;o++)t[i+o]=e[n+o]}var mT=Uint8Array,gT=Uint16Array,yT=Int32Array,bT=4,vT=0,wT=1,MT=2;function _T(t){for(var e=t.length;--e>=0;)t[e]=0}var ET=0,NT=1,LT=2,ST=29,AT=256,xT=AT+1+ST,TT=30,IT=19,kT=2*xT+1,jT=15,CT=16,DT=7,OT=256,zT=16,PT=17,RT=18,BT=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],UT=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],FT=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],WT=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],YT=new Array(2*(xT+2));_T(YT);var QT=new Array(2*TT);_T(QT);var HT=new Array(512);_T(HT);var GT=new Array(256);_T(GT);var ZT=new Array(ST);_T(ZT);var VT,qT,JT,KT=new Array(TT);function XT(t,e,n,r,i){this.static_tree=t,this.extra_bits=e,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=t&&t.length}function $T(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}function tI(t){return t<256?HT[t]:HT[256+(t>>>7)]}function eI(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255}function nI(t,e,n){t.bi_valid>CT-n?(t.bi_buf|=e<<t.bi_valid&65535,eI(t,t.bi_buf),t.bi_buf=e>>CT-t.bi_valid,t.bi_valid+=n-CT):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=n)}function rI(t,e,n){nI(t,n[2*e],n[2*e+1])}function iI(t,e){var n=0;do{n|=1&t,t>>>=1,n<<=1}while(--e>0);return n>>>1}function oI(t,e,n){var r,i,o=new Array(jT+1),a=0;for(r=1;r<=jT;r++)o[r]=a=a+n[r-1]<<1;for(i=0;i<=e;i++){var s=t[2*i+1];0!==s&&(t[2*i]=iI(o[s]++,s))}}function aI(t){var e;for(e=0;e<xT;e++)t.dyn_ltree[2*e]=0;for(e=0;e<TT;e++)t.dyn_dtree[2*e]=0;for(e=0;e<IT;e++)t.bl_tree[2*e]=0;t.dyn_ltree[2*OT]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0}function sI(t){t.bi_valid>8?eI(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0}function uI(t,e,n,r){var i=2*e,o=2*n;return t[i]<t[o]||t[i]===t[o]&&r[e]<=r[n]}function cI(t,e,n){for(var r=t.heap[n],i=n<<1;i<=t.heap_len&&(i<t.heap_len&&uI(e,t.heap[i+1],t.heap[i],t.depth)&&i++,!uI(e,r,t.heap[i],t.depth));)t.heap[n]=t.heap[i],n=i,i<<=1;t.heap[n]=r}function lI(t,e,n){var r,i,o,a,s=0;if(0!==t.last_lit)do{r=t.pending_buf[t.d_buf+2*s]<<8|t.pending_buf[t.d_buf+2*s+1],i=t.pending_buf[t.l_buf+s],s++,0===r?rI(t,i,e):(rI(t,(o=GT[i])+AT+1,e),0!==(a=BT[o])&&nI(t,i-=ZT[o],a),rI(t,o=tI(--r),n),0!==(a=UT[o])&&nI(t,r-=KT[o],a))}while(s<t.last_lit);rI(t,OT,e)}function hI(t,e){var n,r,i,o=e.dyn_tree,a=e.stat_desc.static_tree,s=e.stat_desc.has_stree,u=e.stat_desc.elems,c=-1;for(t.heap_len=0,t.heap_max=kT,n=0;n<u;n++)0!==o[2*n]?(t.heap[++t.heap_len]=c=n,t.depth[n]=0):o[2*n+1]=0;for(;t.heap_len<2;)o[2*(i=t.heap[++t.heap_len]=c<2?++c:0)]=1,t.depth[i]=0,t.opt_len--,s&&(t.static_len-=a[2*i+1]);for(e.max_code=c,n=t.heap_len>>1;n>=1;n--)cI(t,o,n);i=u;do{n=t.heap[1],t.heap[1]=t.heap[t.heap_len--],cI(t,o,1),r=t.heap[1],t.heap[--t.heap_max]=n,t.heap[--t.heap_max]=r,o[2*i]=o[2*n]+o[2*r],t.depth[i]=(t.depth[n]>=t.depth[r]?t.depth[n]:t.depth[r])+1,o[2*n+1]=o[2*r+1]=i,t.heap[1]=i++,cI(t,o,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],function(t,e){var n,r,i,o,a,s,u=e.dyn_tree,c=e.max_code,l=e.stat_desc.static_tree,h=e.stat_desc.has_stree,d=e.stat_desc.extra_bits,f=e.stat_desc.extra_base,p=e.stat_desc.max_length,m=0;for(o=0;o<=jT;o++)t.bl_count[o]=0;for(u[2*t.heap[t.heap_max]+1]=0,n=t.heap_max+1;n<kT;n++)(o=u[2*u[2*(r=t.heap[n])+1]+1]+1)>p&&(o=p,m++),u[2*r+1]=o,r>c||(t.bl_count[o]++,a=0,r>=f&&(a=d[r-f]),s=u[2*r],t.opt_len+=s*(o+a),h&&(t.static_len+=s*(l[2*r+1]+a)));if(0!==m){do{for(o=p-1;0===t.bl_count[o];)o--;t.bl_count[o]--,t.bl_count[o+1]+=2,t.bl_count[p]--,m-=2}while(m>0);for(o=p;0!==o;o--)for(r=t.bl_count[o];0!==r;)(i=t.heap[--n])>c||(u[2*i+1]!==o&&(t.opt_len+=(o-u[2*i+1])*u[2*i],u[2*i+1]=o),r--)}}(t,e),oI(o,c,t.bl_count)}function dI(t,e,n){var r,i,o=-1,a=e[1],s=0,u=7,c=4;for(0===a&&(u=138,c=3),e[2*(n+1)+1]=65535,r=0;r<=n;r++)i=a,a=e[2*(r+1)+1],++s<u&&i===a||(s<c?t.bl_tree[2*i]+=s:0!==i?(i!==o&&t.bl_tree[2*i]++,t.bl_tree[2*zT]++):s<=10?t.bl_tree[2*PT]++:t.bl_tree[2*RT]++,s=0,o=i,0===a?(u=138,c=3):i===a?(u=6,c=3):(u=7,c=4))}function fI(t,e,n){var r,i,o=-1,a=e[1],s=0,u=7,c=4;for(0===a&&(u=138,c=3),r=0;r<=n;r++)if(i=a,a=e[2*(r+1)+1],!(++s<u&&i===a)){if(s<c)do{rI(t,i,t.bl_tree)}while(0!=--s);else 0!==i?(i!==o&&(rI(t,i,t.bl_tree),s--),rI(t,zT,t.bl_tree),nI(t,s-3,2)):s<=10?(rI(t,PT,t.bl_tree),nI(t,s-3,3)):(rI(t,RT,t.bl_tree),nI(t,s-11,7));s=0,o=i,0===a?(u=138,c=3):i===a?(u=6,c=3):(u=7,c=4)}}_T(KT);var pI=!1;function mI(t){pI||(!function(){var t,e,n,r,i,o=new Array(jT+1);for(n=0,r=0;r<ST-1;r++)for(ZT[r]=n,t=0;t<1<<BT[r];t++)GT[n++]=r;for(GT[n-1]=r,i=0,r=0;r<16;r++)for(KT[r]=i,t=0;t<1<<UT[r];t++)HT[i++]=r;for(i>>=7;r<TT;r++)for(KT[r]=i<<7,t=0;t<1<<UT[r]-7;t++)HT[256+i++]=r;for(e=0;e<=jT;e++)o[e]=0;for(t=0;t<=143;)YT[2*t+1]=8,t++,o[8]++;for(;t<=255;)YT[2*t+1]=9,t++,o[9]++;for(;t<=279;)YT[2*t+1]=7,t++,o[7]++;for(;t<=287;)YT[2*t+1]=8,t++,o[8]++;for(oI(YT,xT+1,o),t=0;t<TT;t++)QT[2*t+1]=5,QT[2*t]=iI(t,5);VT=new XT(YT,BT,AT+1,xT,jT),qT=new XT(QT,UT,0,TT,jT),JT=new XT(new Array(0),FT,0,IT,DT)}(),pI=!0),t.l_desc=new $T(t.dyn_ltree,VT),t.d_desc=new $T(t.dyn_dtree,qT),t.bl_desc=new $T(t.bl_tree,JT),t.bi_buf=0,t.bi_valid=0,aI(t)}function gI(t,e,n,r){nI(t,(ET<<1)+(r?1:0),3),function(t,e,n,r){sI(t),r&&(eI(t,n),eI(t,~n)),pT(t.pending_buf,t.window,e,n,t.pending),t.pending+=n}(t,e,n,!0)}function yI(t){nI(t,NT<<1,3),rI(t,OT,YT),function(t){16===t.bi_valid?(eI(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}(t)}function bI(t,e,n,r){var i,o,a=0;t.level>0?(t.strm.data_type===MT&&(t.strm.data_type=function(t){var e,n=4093624447;for(e=0;e<=31;e++,n>>>=1)if(1&n&&0!==t.dyn_ltree[2*e])return vT;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return wT;for(e=32;e<AT;e++)if(0!==t.dyn_ltree[2*e])return wT;return vT}(t)),hI(t,t.l_desc),hI(t,t.d_desc),a=function(t){var e;for(dI(t,t.dyn_ltree,t.l_desc.max_code),dI(t,t.dyn_dtree,t.d_desc.max_code),hI(t,t.bl_desc),e=IT-1;e>=3&&0===t.bl_tree[2*WT[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e}(t),i=t.opt_len+3+7>>>3,(o=t.static_len+3+7>>>3)<=i&&(i=o)):i=o=n+5,n+4<=i&&-1!==e?gI(t,e,n,r):t.strategy===bT||o===i?(nI(t,(NT<<1)+(r?1:0),3),lI(t,YT,QT)):(nI(t,(LT<<1)+(r?1:0),3),function(t,e,n,r){var i;for(nI(t,e-257,5),nI(t,n-1,5),nI(t,r-4,4),i=0;i<r;i++)nI(t,t.bl_tree[2*WT[i]+1],3);fI(t,t.dyn_ltree,e-1),fI(t,t.dyn_dtree,n-1)}(t,t.l_desc.max_code+1,t.d_desc.max_code+1,a+1),lI(t,t.dyn_ltree,t.dyn_dtree)),aI(t),r&&sI(t)}function vI(t,e,n){return t.pending_buf[t.d_buf+2*t.last_lit]=e>>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&n,t.last_lit++,0===e?t.dyn_ltree[2*n]++:(t.matches++,e--,t.dyn_ltree[2*(GT[n]+AT+1)]++,t.dyn_dtree[2*tI(e)]++),t.last_lit===t.lit_bufsize-1}function wI(t,e,n,r){for(var i=65535&t|0,o=t>>>16&65535|0,a=0;0!==n;){n-=a=n>2e3?2e3:n;do{o=o+(i=i+e[r++]|0)|0}while(--a);i%=65521,o%=65521}return i|o<<16|0}var MI=function(){for(var t,e=[],n=0;n<256;n++){t=n;for(var r=0;r<8;r++)t=1&t?3988292384^t>>>1:t>>>1;e[n]=t}return e}();function _I(t,e,n,r){var i=MI,o=r+n;t^=-1;for(var a=r;a<o;a++)t=t>>>8^i[255&(t^e[a])];return-1^t}var EI,NI=0,LI=1,SI=3,AI=4,xI=5,TI=0,II=1,kI=-2,jI=-3,CI=-5,DI=-1,OI=1,zI=2,PI=3,RI=4,BI=2,UI=8,FI=9,WI=286,YI=30,QI=19,HI=2*WI+1,GI=15,ZI=3,VI=258,qI=VI+ZI+1,JI=32,KI=42,XI=69,$I=73,tk=91,ek=103,nk=113,rk=666,ik=1,ok=2,ak=3,sk=4,uk=3;function ck(t,e){return t.msg=dT[e],e}function lk(t){return(t<<1)-(t>4?9:0)}function hk(t){for(var e=t.length;--e>=0;)t[e]=0}function dk(t){var e=t.state,n=e.pending;n>t.avail_out&&(n=t.avail_out),0!==n&&(pT(t.output,e.pending_buf,e.pending_out,n,t.next_out),t.next_out+=n,e.pending_out+=n,t.total_out+=n,t.avail_out-=n,e.pending-=n,0===e.pending&&(e.pending_out=0))}function fk(t,e){bI(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,dk(t.strm)}function pk(t,e){t.pending_buf[t.pending++]=e}function mk(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e}function gk(t,e,n,r){var i=t.avail_in;return i>r&&(i=r),0===i?0:(t.avail_in-=i,pT(e,t.input,t.next_in,i,n),1===t.state.wrap?t.adler=wI(t.adler,e,i,n):2===t.state.wrap&&(t.adler=_I(t.adler,e,i,n)),t.next_in+=i,t.total_in+=i,i)}function yk(t,e){var n,r,i=t.max_chain_length,o=t.strstart,a=t.prev_length,s=t.nice_match,u=t.strstart>t.w_size-qI?t.strstart-(t.w_size-qI):0,c=t.window,l=t.w_mask,h=t.prev,d=t.strstart+VI,f=c[o+a-1],p=c[o+a];t.prev_length>=t.good_match&&(i>>=2),s>t.lookahead&&(s=t.lookahead);do{if(c[(n=e)+a]===p&&c[n+a-1]===f&&c[n]===c[o]&&c[++n]===c[o+1]){o+=2,n++;do{}while(c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&o<d);if(r=VI-(d-o),o=d-VI,r>a){if(t.match_start=e,a=r,r>=s)break;f=c[o+a-1],p=c[o+a]}}}while((e=h[e&l])>u&&0!=--i);return a<=t.lookahead?a:t.lookahead}function bk(t){var e,n,r,i,o,a=t.w_size;do{if(i=t.window_size-t.lookahead-t.strstart,t.strstart>=a+(a-qI)){pT(t.window,t.window,a,a,0),t.match_start-=a,t.strstart-=a,t.block_start-=a,e=n=t.hash_size;do{r=t.head[--e],t.head[e]=r>=a?r-a:0}while(--n);e=n=a;do{r=t.prev[--e],t.prev[e]=r>=a?r-a:0}while(--n);i+=a}if(0===t.strm.avail_in)break;if(n=gk(t.strm,t.window,t.strstart+t.lookahead,i),t.lookahead+=n,t.lookahead+t.insert>=ZI)for(o=t.strstart-t.insert,t.ins_h=t.window[o],t.ins_h=(t.ins_h<<t.hash_shift^t.window[o+1])&t.hash_mask;t.insert&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[o+ZI-1])&t.hash_mask,t.prev[o&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=o,o++,t.insert--,!(t.lookahead+t.insert<ZI)););}while(t.lookahead<qI&&0!==t.strm.avail_in)}function vk(t,e){for(var n,r;;){if(t.lookahead<qI){if(bk(t),t.lookahead<qI&&e===NI)return ik;if(0===t.lookahead)break}if(n=0,t.lookahead>=ZI&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+ZI-1])&t.hash_mask,n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==n&&t.strstart-n<=t.w_size-qI&&(t.match_length=yk(t,n)),t.match_length>=ZI)if(r=vI(t,t.strstart-t.match_start,t.match_length-ZI),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=ZI){t.match_length--;do{t.strstart++,t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+ZI-1])&t.hash_mask,n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!=--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+1])&t.hash_mask;else r=vI(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(r&&(fk(t,!1),0===t.strm.avail_out))return ik}return t.insert=t.strstart<ZI-1?t.strstart:ZI-1,e===AI?(fk(t,!0),0===t.strm.avail_out?ak:sk):t.last_lit&&(fk(t,!1),0===t.strm.avail_out)?ik:ok}function wk(t,e){for(var n,r,i;;){if(t.lookahead<qI){if(bk(t),t.lookahead<qI&&e===NI)return ik;if(0===t.lookahead)break}if(n=0,t.lookahead>=ZI&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+ZI-1])&t.hash_mask,n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=ZI-1,0!==n&&t.prev_length<t.max_lazy_match&&t.strstart-n<=t.w_size-qI&&(t.match_length=yk(t,n),t.match_length<=5&&(t.strategy===OI||t.match_length===ZI&&t.strstart-t.match_start>4096)&&(t.match_length=ZI-1)),t.prev_length>=ZI&&t.match_length<=t.prev_length){i=t.strstart+t.lookahead-ZI,r=vI(t,t.strstart-1-t.prev_match,t.prev_length-ZI),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=i&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+ZI-1])&t.hash_mask,n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=ZI-1,t.strstart++,r&&(fk(t,!1),0===t.strm.avail_out))return ik}else if(t.match_available){if((r=vI(t,0,t.window[t.strstart-1]))&&fk(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return ik}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(r=vI(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<ZI-1?t.strstart:ZI-1,e===AI?(fk(t,!0),0===t.strm.avail_out?ak:sk):t.last_lit&&(fk(t,!1),0===t.strm.avail_out)?ik:ok}function Mk(t,e,n,r,i){this.good_length=t,this.max_lazy=e,this.nice_length=n,this.max_chain=r,this.func=i}function _k(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=UI,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new gT(2*HI),this.dyn_dtree=new gT(2*(2*YI+1)),this.bl_tree=new gT(2*(2*QI+1)),hk(this.dyn_ltree),hk(this.dyn_dtree),hk(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new gT(GI+1),this.heap=new gT(2*WI+1),hk(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new gT(2*WI+1),hk(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function Ek(t){var e=function(t){var e;return t&&t.state?(t.total_in=t.total_out=0,t.data_type=BI,(e=t.state).pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?KI:nk,t.adler=2===e.wrap?0:1,e.last_flush=NI,mI(e),TI):ck(t,kI)}(t);return e===TI&&function(t){t.window_size=2*t.w_size,hk(t.head),t.max_lazy_match=EI[t.level].max_lazy,t.good_match=EI[t.level].good_length,t.nice_match=EI[t.level].nice_length,t.max_chain_length=EI[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=ZI-1,t.match_available=0,t.ins_h=0}(t.state),e}function Nk(t,e){var n,r,i,o;if(!t||!t.state||e>xI||e<0)return t?ck(t,kI):kI;if(r=t.state,!t.output||!t.input&&0!==t.avail_in||r.status===rk&&e!==AI)return ck(t,0===t.avail_out?CI:kI);if(r.strm=t,n=r.last_flush,r.last_flush=e,r.status===KI)if(2===r.wrap)t.adler=0,pk(r,31),pk(r,139),pk(r,8),r.gzhead?(pk(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),pk(r,255&r.gzhead.time),pk(r,r.gzhead.time>>8&255),pk(r,r.gzhead.time>>16&255),pk(r,r.gzhead.time>>24&255),pk(r,9===r.level?2:r.strategy>=zI||r.level<2?4:0),pk(r,255&r.gzhead.os),r.gzhead.extra&&r.gzhead.extra.length&&(pk(r,255&r.gzhead.extra.length),pk(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(t.adler=_I(t.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=XI):(pk(r,0),pk(r,0),pk(r,0),pk(r,0),pk(r,0),pk(r,9===r.level?2:r.strategy>=zI||r.level<2?4:0),pk(r,uk),r.status=nk);else{var a=UI+(r.w_bits-8<<4)<<8;a|=(r.strategy>=zI||r.level<2?0:r.level<6?1:6===r.level?2:3)<<6,0!==r.strstart&&(a|=JI),a+=31-a%31,r.status=nk,mk(r,a),0!==r.strstart&&(mk(r,t.adler>>>16),mk(r,65535&t.adler)),t.adler=1}if(r.status===XI)if(r.gzhead.extra){for(i=r.pending;r.gzindex<(65535&r.gzhead.extra.length)&&(r.pending!==r.pending_buf_size||(r.gzhead.hcrc&&r.pending>i&&(t.adler=_I(t.adler,r.pending_buf,r.pending-i,i)),dk(t),i=r.pending,r.pending!==r.pending_buf_size));)pk(r,255&r.gzhead.extra[r.gzindex]),r.gzindex++;r.gzhead.hcrc&&r.pending>i&&(t.adler=_I(t.adler,r.pending_buf,r.pending-i,i)),r.gzindex===r.gzhead.extra.length&&(r.gzindex=0,r.status=$I)}else r.status=$I;if(r.status===$I)if(r.gzhead.name){i=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>i&&(t.adler=_I(t.adler,r.pending_buf,r.pending-i,i)),dk(t),i=r.pending,r.pending===r.pending_buf_size)){o=1;break}o=r.gzindex<r.gzhead.name.length?255&r.gzhead.name.charCodeAt(r.gzindex++):0,pk(r,o)}while(0!==o);r.gzhead.hcrc&&r.pending>i&&(t.adler=_I(t.adler,r.pending_buf,r.pending-i,i)),0===o&&(r.gzindex=0,r.status=tk)}else r.status=tk;if(r.status===tk)if(r.gzhead.comment){i=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>i&&(t.adler=_I(t.adler,r.pending_buf,r.pending-i,i)),dk(t),i=r.pending,r.pending===r.pending_buf_size)){o=1;break}o=r.gzindex<r.gzhead.comment.length?255&r.gzhead.comment.charCodeAt(r.gzindex++):0,pk(r,o)}while(0!==o);r.gzhead.hcrc&&r.pending>i&&(t.adler=_I(t.adler,r.pending_buf,r.pending-i,i)),0===o&&(r.status=ek)}else r.status=ek;if(r.status===ek&&(r.gzhead.hcrc?(r.pending+2>r.pending_buf_size&&dk(t),r.pending+2<=r.pending_buf_size&&(pk(r,255&t.adler),pk(r,t.adler>>8&255),t.adler=0,r.status=nk)):r.status=nk),0!==r.pending){if(dk(t),0===t.avail_out)return r.last_flush=-1,TI}else if(0===t.avail_in&&lk(e)<=lk(n)&&e!==AI)return ck(t,CI);if(r.status===rk&&0!==t.avail_in)return ck(t,CI);if(0!==t.avail_in||0!==r.lookahead||e!==NI&&r.status!==rk){var s=r.strategy===zI?function(t,e){for(var n;;){if(0===t.lookahead&&(bk(t),0===t.lookahead)){if(e===NI)return ik;break}if(t.match_length=0,n=vI(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,n&&(fk(t,!1),0===t.strm.avail_out))return ik}return t.insert=0,e===AI?(fk(t,!0),0===t.strm.avail_out?ak:sk):t.last_lit&&(fk(t,!1),0===t.strm.avail_out)?ik:ok}(r,e):r.strategy===PI?function(t,e){for(var n,r,i,o,a=t.window;;){if(t.lookahead<=VI){if(bk(t),t.lookahead<=VI&&e===NI)return ik;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=ZI&&t.strstart>0&&(r=a[i=t.strstart-1])===a[++i]&&r===a[++i]&&r===a[++i]){o=t.strstart+VI;do{}while(r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&i<o);t.match_length=VI-(o-i),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=ZI?(n=vI(t,1,t.match_length-ZI),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(n=vI(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),n&&(fk(t,!1),0===t.strm.avail_out))return ik}return t.insert=0,e===AI?(fk(t,!0),0===t.strm.avail_out?ak:sk):t.last_lit&&(fk(t,!1),0===t.strm.avail_out)?ik:ok}(r,e):EI[r.level].func(r,e);if(s!==ak&&s!==sk||(r.status=rk),s===ik||s===ak)return 0===t.avail_out&&(r.last_flush=-1),TI;if(s===ok&&(e===LI?yI(r):e!==xI&&(gI(r,0,0,!1),e===SI&&(hk(r.head),0===r.lookahead&&(r.strstart=0,r.block_start=0,r.insert=0))),dk(t),0===t.avail_out))return r.last_flush=-1,TI}return e!==AI?TI:r.wrap<=0?II:(2===r.wrap?(pk(r,255&t.adler),pk(r,t.adler>>8&255),pk(r,t.adler>>16&255),pk(r,t.adler>>24&255),pk(r,255&t.total_in),pk(r,t.total_in>>8&255),pk(r,t.total_in>>16&255),pk(r,t.total_in>>24&255)):(mk(r,t.adler>>>16),mk(r,65535&t.adler)),dk(t),r.wrap>0&&(r.wrap=-r.wrap),0!==r.pending?TI:II)}EI=[new Mk(0,0,0,0,(function(t,e){var n=65535;for(n>t.pending_buf_size-5&&(n=t.pending_buf_size-5);;){if(t.lookahead<=1){if(bk(t),0===t.lookahead&&e===NI)return ik;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var r=t.block_start+n;if((0===t.strstart||t.strstart>=r)&&(t.lookahead=t.strstart-r,t.strstart=r,fk(t,!1),0===t.strm.avail_out))return ik;if(t.strstart-t.block_start>=t.w_size-qI&&(fk(t,!1),0===t.strm.avail_out))return ik}return t.insert=0,e===AI?(fk(t,!0),0===t.strm.avail_out?ak:sk):(t.strstart>t.block_start&&(fk(t,!1),t.strm.avail_out),ik)})),new Mk(4,4,8,4,vk),new Mk(4,5,16,8,vk),new Mk(4,6,32,32,vk),new Mk(4,4,16,16,wk),new Mk(8,16,32,32,wk),new Mk(8,16,128,128,wk),new Mk(8,32,128,256,wk),new Mk(32,128,258,1024,wk),new Mk(32,258,258,4096,wk)];var Lk=30,Sk=12;function Ak(t,e){var n,r,i,o,a,s,u,c,l,h,d,f,p,m,g,y,b,v,w,M,_,E,N,L,S;n=t.state,r=t.next_in,L=t.input,i=r+(t.avail_in-5),o=t.next_out,S=t.output,a=o-(e-t.avail_out),s=o+(t.avail_out-257),u=n.dmax,c=n.wsize,l=n.whave,h=n.wnext,d=n.window,f=n.hold,p=n.bits,m=n.lencode,g=n.distcode,y=(1<<n.lenbits)-1,b=(1<<n.distbits)-1;t:do{p<15&&(f+=L[r++]<<p,p+=8,f+=L[r++]<<p,p+=8),v=m[f&y];e:for(;;){if(f>>>=w=v>>>24,p-=w,0===(w=v>>>16&255))S[o++]=65535&v;else{if(!(16&w)){if(0==(64&w)){v=m[(65535&v)+(f&(1<<w)-1)];continue e}if(32&w){n.mode=Sk;break t}t.msg="invalid literal/length code",n.mode=Lk;break t}M=65535&v,(w&=15)&&(p<w&&(f+=L[r++]<<p,p+=8),M+=f&(1<<w)-1,f>>>=w,p-=w),p<15&&(f+=L[r++]<<p,p+=8,f+=L[r++]<<p,p+=8),v=g[f&b];n:for(;;){if(f>>>=w=v>>>24,p-=w,!(16&(w=v>>>16&255))){if(0==(64&w)){v=g[(65535&v)+(f&(1<<w)-1)];continue n}t.msg="invalid distance code",n.mode=Lk;break t}if(_=65535&v,p<(w&=15)&&(f+=L[r++]<<p,(p+=8)<w&&(f+=L[r++]<<p,p+=8)),(_+=f&(1<<w)-1)>u){t.msg="invalid distance too far back",n.mode=Lk;break t}if(f>>>=w,p-=w,_>(w=o-a)){if((w=_-w)>l&&n.sane){t.msg="invalid distance too far back",n.mode=Lk;break t}if(E=0,N=d,0===h){if(E+=c-w,w<M){M-=w;do{S[o++]=d[E++]}while(--w);E=o-_,N=S}}else if(h<w){if(E+=c+h-w,(w-=h)<M){M-=w;do{S[o++]=d[E++]}while(--w);if(E=0,h<M){M-=w=h;do{S[o++]=d[E++]}while(--w);E=o-_,N=S}}}else if(E+=h-w,w<M){M-=w;do{S[o++]=d[E++]}while(--w);E=o-_,N=S}for(;M>2;)S[o++]=N[E++],S[o++]=N[E++],S[o++]=N[E++],M-=3;M&&(S[o++]=N[E++],M>1&&(S[o++]=N[E++]))}else{E=o-_;do{S[o++]=S[E++],S[o++]=S[E++],S[o++]=S[E++],M-=3}while(M>2);M&&(S[o++]=S[E++],M>1&&(S[o++]=S[E++]))}break}}break}}while(r<i&&o<s);r-=M=p>>3,f&=(1<<(p-=M<<3))-1,t.next_in=r,t.next_out=o,t.avail_in=r<i?i-r+5:5-(r-i),t.avail_out=o<s?s-o+257:257-(o-s),n.hold=f,n.bits=p}var xk=15,Tk=852,Ik=592,kk=0,jk=1,Ck=2,Dk=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],Ok=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],zk=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],Pk=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];function Rk(t,e,n,r,i,o,a,s){var u,c,l,h,d,f,p,m,g,y=s.bits,b=0,v=0,w=0,M=0,_=0,E=0,N=0,L=0,S=0,A=0,x=null,T=0,I=new gT(xk+1),k=new gT(xk+1),j=null,C=0;for(b=0;b<=xk;b++)I[b]=0;for(v=0;v<r;v++)I[e[n+v]]++;for(_=y,M=xk;M>=1&&0===I[M];M--);if(_>M&&(_=M),0===M)return i[o++]=20971520,i[o++]=20971520,s.bits=1,0;for(w=1;w<M&&0===I[w];w++);for(_<w&&(_=w),L=1,b=1;b<=xk;b++)if(L<<=1,(L-=I[b])<0)return-1;if(L>0&&(t===kk||1!==M))return-1;for(k[1]=0,b=1;b<xk;b++)k[b+1]=k[b]+I[b];for(v=0;v<r;v++)0!==e[n+v]&&(a[k[e[n+v]]++]=v);if(t===kk?(x=j=a,f=19):t===jk?(x=Dk,T-=257,j=Ok,C-=257,f=256):(x=zk,j=Pk,f=-1),A=0,v=0,b=w,d=o,E=_,N=0,l=-1,h=(S=1<<_)-1,t===jk&&S>Tk||t===Ck&&S>Ik)return 1;for(;;){p=b-N,a[v]<f?(m=0,g=a[v]):a[v]>f?(m=j[C+a[v]],g=x[T+a[v]]):(m=96,g=0),u=1<<b-N,w=c=1<<E;do{i[d+(A>>N)+(c-=u)]=p<<24|m<<16|g|0}while(0!==c);for(u=1<<b-1;A&u;)u>>=1;if(0!==u?(A&=u-1,A+=u):A=0,v++,0==--I[b]){if(b===M)break;b=e[n+a[v]]}if(b>_&&(A&h)!==l){for(0===N&&(N=_),d+=w,L=1<<(E=b-N);E+N<M&&!((L-=I[E+N])<=0);)E++,L<<=1;if(S+=1<<E,t===jk&&S>Tk||t===Ck&&S>Ik)return 1;i[l=A&h]=_<<24|E<<16|d-o|0}}return 0!==A&&(i[d+A]=b-N<<24|64<<16|0),s.bits=_,0}var Bk=0,Uk=1,Fk=2,Wk=4,Yk=5,Qk=6,Hk=0,Gk=1,Zk=2,Vk=-2,qk=-3,Jk=-4,Kk=-5,Xk=8,$k=1,tj=2,ej=3,nj=4,rj=5,ij=6,oj=7,aj=8,sj=9,uj=10,cj=11,lj=12,hj=13,dj=14,fj=15,pj=16,mj=17,gj=18,yj=19,bj=20,vj=21,wj=22,Mj=23,_j=24,Ej=25,Nj=26,Lj=27,Sj=28,Aj=29,xj=30,Tj=31,Ij=852,kj=592;function jj(t){return(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function Cj(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new gT(320),this.work=new gT(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function Dj(t){var e;return t&&t.state?((e=t.state).wsize=0,e.whave=0,e.wnext=0,function(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=$k,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new yT(Ij),e.distcode=e.distdyn=new yT(kj),e.sane=1,e.back=-1,Hk):Vk}(t)):Vk}function Oj(t,e){var n,r;return t?(r=new Cj,t.state=r,r.window=null,n=function(t,e){var n,r;return t&&t.state?(r=t.state,e<0?(n=0,e=-e):(n=1+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?Vk:(null!==r.window&&r.wbits!==e&&(r.window=null),r.wrap=n,r.wbits=e,Dj(t))):Vk}(t,e),n!==Hk&&(t.state=null),n):Vk}var zj,Pj,Rj=!0;function Bj(t){if(Rj){var e;for(zj=new yT(512),Pj=new yT(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(Rk(Uk,t.lens,0,288,zj,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;Rk(Fk,t.lens,0,32,Pj,0,t.work,{bits:5}),Rj=!1}t.lencode=zj,t.lenbits=9,t.distcode=Pj,t.distbits=5}function Uj(t,e){var n,r,i,o,a,s,u,c,l,h,d,f,p,m,g,y,b,v,w,M,_,E,N,L,S=0,A=new mT(4),x=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!t||!t.state||!t.output||!t.input&&0!==t.avail_in)return Vk;(n=t.state).mode===lj&&(n.mode=hj),a=t.next_out,i=t.output,u=t.avail_out,o=t.next_in,r=t.input,s=t.avail_in,c=n.hold,l=n.bits,h=s,d=u,E=Hk;t:for(;;)switch(n.mode){case $k:if(0===n.wrap){n.mode=hj;break}for(;l<16;){if(0===s)break t;s--,c+=r[o++]<<l,l+=8}if(2&n.wrap&&35615===c){n.check=0,A[0]=255&c,A[1]=c>>>8&255,n.check=_I(n.check,A,2,0),c=0,l=0,n.mode=tj;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&c)<<8)+(c>>8))%31){t.msg="incorrect header check",n.mode=xj;break}if((15&c)!==Xk){t.msg="unknown compression method",n.mode=xj;break}if(l-=4,_=8+(15&(c>>>=4)),0===n.wbits)n.wbits=_;else if(_>n.wbits){t.msg="invalid window size",n.mode=xj;break}n.dmax=1<<_,t.adler=n.check=1,n.mode=512&c?uj:lj,c=0,l=0;break;case tj:for(;l<16;){if(0===s)break t;s--,c+=r[o++]<<l,l+=8}if(n.flags=c,(255&n.flags)!==Xk){t.msg="unknown compression method",n.mode=xj;break}if(57344&n.flags){t.msg="unknown header flags set",n.mode=xj;break}n.head&&(n.head.text=c>>8&1),512&n.flags&&(A[0]=255&c,A[1]=c>>>8&255,n.check=_I(n.check,A,2,0)),c=0,l=0,n.mode=ej;case ej:for(;l<32;){if(0===s)break t;s--,c+=r[o++]<<l,l+=8}n.head&&(n.head.time=c),512&n.flags&&(A[0]=255&c,A[1]=c>>>8&255,A[2]=c>>>16&255,A[3]=c>>>24&255,n.check=_I(n.check,A,4,0)),c=0,l=0,n.mode=nj;case nj:for(;l<16;){if(0===s)break t;s--,c+=r[o++]<<l,l+=8}n.head&&(n.head.xflags=255&c,n.head.os=c>>8),512&n.flags&&(A[0]=255&c,A[1]=c>>>8&255,n.check=_I(n.check,A,2,0)),c=0,l=0,n.mode=rj;case rj:if(1024&n.flags){for(;l<16;){if(0===s)break t;s--,c+=r[o++]<<l,l+=8}n.length=c,n.head&&(n.head.extra_len=c),512&n.flags&&(A[0]=255&c,A[1]=c>>>8&255,n.check=_I(n.check,A,2,0)),c=0,l=0}else n.head&&(n.head.extra=null);n.mode=ij;case ij:if(1024&n.flags&&((f=n.length)>s&&(f=s),f&&(n.head&&(_=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),pT(n.head.extra,r,o,f,_)),512&n.flags&&(n.check=_I(n.check,r,f,o)),s-=f,o+=f,n.length-=f),n.length))break t;n.length=0,n.mode=oj;case oj:if(2048&n.flags){if(0===s)break t;f=0;do{_=r[o+f++],n.head&&_&&n.length<65536&&(n.head.name+=String.fromCharCode(_))}while(_&&f<s);if(512&n.flags&&(n.check=_I(n.check,r,f,o)),s-=f,o+=f,_)break t}else n.head&&(n.head.name=null);n.length=0,n.mode=aj;case aj:if(4096&n.flags){if(0===s)break t;f=0;do{_=r[o+f++],n.head&&_&&n.length<65536&&(n.head.comment+=String.fromCharCode(_))}while(_&&f<s);if(512&n.flags&&(n.check=_I(n.check,r,f,o)),s-=f,o+=f,_)break t}else n.head&&(n.head.comment=null);n.mode=sj;case sj:if(512&n.flags){for(;l<16;){if(0===s)break t;s--,c+=r[o++]<<l,l+=8}if(c!==(65535&n.check)){t.msg="header crc mismatch",n.mode=xj;break}c=0,l=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),t.adler=n.check=0,n.mode=lj;break;case uj:for(;l<32;){if(0===s)break t;s--,c+=r[o++]<<l,l+=8}t.adler=n.check=jj(c),c=0,l=0,n.mode=cj;case cj:if(0===n.havedict)return t.next_out=a,t.avail_out=u,t.next_in=o,t.avail_in=s,n.hold=c,n.bits=l,Zk;t.adler=n.check=1,n.mode=lj;case lj:if(e===Yk||e===Qk)break t;case hj:if(n.last){c>>>=7&l,l-=7&l,n.mode=Lj;break}for(;l<3;){if(0===s)break t;s--,c+=r[o++]<<l,l+=8}switch(n.last=1&c,l-=1,3&(c>>>=1)){case 0:n.mode=dj;break;case 1:if(Bj(n),n.mode=bj,e===Qk){c>>>=2,l-=2;break t}break;case 2:n.mode=mj;break;case 3:t.msg="invalid block type",n.mode=xj}c>>>=2,l-=2;break;case dj:for(c>>>=7&l,l-=7&l;l<32;){if(0===s)break t;s--,c+=r[o++]<<l,l+=8}if((65535&c)!=(c>>>16^65535)){t.msg="invalid stored block lengths",n.mode=xj;break}if(n.length=65535&c,c=0,l=0,n.mode=fj,e===Qk)break t;case fj:n.mode=pj;case pj:if(f=n.length){if(f>s&&(f=s),f>u&&(f=u),0===f)break t;pT(i,r,o,f,a),s-=f,o+=f,u-=f,a+=f,n.length-=f;break}n.mode=lj;break;case mj:for(;l<14;){if(0===s)break t;s--,c+=r[o++]<<l,l+=8}if(n.nlen=257+(31&c),c>>>=5,l-=5,n.ndist=1+(31&c),c>>>=5,l-=5,n.ncode=4+(15&c),c>>>=4,l-=4,n.nlen>286||n.ndist>30){t.msg="too many length or distance symbols",n.mode=xj;break}n.have=0,n.mode=gj;case gj:for(;n.have<n.ncode;){for(;l<3;){if(0===s)break t;s--,c+=r[o++]<<l,l+=8}n.lens[x[n.have++]]=7&c,c>>>=3,l-=3}for(;n.have<19;)n.lens[x[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,N={bits:n.lenbits},E=Rk(Bk,n.lens,0,19,n.lencode,0,n.work,N),n.lenbits=N.bits,E){t.msg="invalid code lengths set",n.mode=xj;break}n.have=0,n.mode=yj;case yj:for(;n.have<n.nlen+n.ndist;){for(;y=(S=n.lencode[c&(1<<n.lenbits)-1])>>>16&255,b=65535&S,!((g=S>>>24)<=l);){if(0===s)break t;s--,c+=r[o++]<<l,l+=8}if(b<16)c>>>=g,l-=g,n.lens[n.have++]=b;else{if(16===b){for(L=g+2;l<L;){if(0===s)break t;s--,c+=r[o++]<<l,l+=8}if(c>>>=g,l-=g,0===n.have){t.msg="invalid bit length repeat",n.mode=xj;break}_=n.lens[n.have-1],f=3+(3&c),c>>>=2,l-=2}else if(17===b){for(L=g+3;l<L;){if(0===s)break t;s--,c+=r[o++]<<l,l+=8}l-=g,_=0,f=3+(7&(c>>>=g)),c>>>=3,l-=3}else{for(L=g+7;l<L;){if(0===s)break t;s--,c+=r[o++]<<l,l+=8}l-=g,_=0,f=11+(127&(c>>>=g)),c>>>=7,l-=7}if(n.have+f>n.nlen+n.ndist){t.msg="invalid bit length repeat",n.mode=xj;break}for(;f--;)n.lens[n.have++]=_}}if(n.mode===xj)break;if(0===n.lens[256]){t.msg="invalid code -- missing end-of-block",n.mode=xj;break}if(n.lenbits=9,N={bits:n.lenbits},E=Rk(Uk,n.lens,0,n.nlen,n.lencode,0,n.work,N),n.lenbits=N.bits,E){t.msg="invalid literal/lengths set",n.mode=xj;break}if(n.distbits=6,n.distcode=n.distdyn,N={bits:n.distbits},E=Rk(Fk,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,N),n.distbits=N.bits,E){t.msg="invalid distances set",n.mode=xj;break}if(n.mode=bj,e===Qk)break t;case bj:n.mode=vj;case vj:if(s>=6&&u>=258){t.next_out=a,t.avail_out=u,t.next_in=o,t.avail_in=s,n.hold=c,n.bits=l,Ak(t,d),a=t.next_out,i=t.output,u=t.avail_out,o=t.next_in,r=t.input,s=t.avail_in,c=n.hold,l=n.bits,n.mode===lj&&(n.back=-1);break}for(n.back=0;y=(S=n.lencode[c&(1<<n.lenbits)-1])>>>16&255,b=65535&S,!((g=S>>>24)<=l);){if(0===s)break t;s--,c+=r[o++]<<l,l+=8}if(y&&0==(240&y)){for(v=g,w=y,M=b;y=(S=n.lencode[M+((c&(1<<v+w)-1)>>v)])>>>16&255,b=65535&S,!(v+(g=S>>>24)<=l);){if(0===s)break t;s--,c+=r[o++]<<l,l+=8}c>>>=v,l-=v,n.back+=v}if(c>>>=g,l-=g,n.back+=g,n.length=b,0===y){n.mode=Nj;break}if(32&y){n.back=-1,n.mode=lj;break}if(64&y){t.msg="invalid literal/length code",n.mode=xj;break}n.extra=15&y,n.mode=wj;case wj:if(n.extra){for(L=n.extra;l<L;){if(0===s)break t;s--,c+=r[o++]<<l,l+=8}n.length+=c&(1<<n.extra)-1,c>>>=n.extra,l-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=Mj;case Mj:for(;y=(S=n.distcode[c&(1<<n.distbits)-1])>>>16&255,b=65535&S,!((g=S>>>24)<=l);){if(0===s)break t;s--,c+=r[o++]<<l,l+=8}if(0==(240&y)){for(v=g,w=y,M=b;y=(S=n.distcode[M+((c&(1<<v+w)-1)>>v)])>>>16&255,b=65535&S,!(v+(g=S>>>24)<=l);){if(0===s)break t;s--,c+=r[o++]<<l,l+=8}c>>>=v,l-=v,n.back+=v}if(c>>>=g,l-=g,n.back+=g,64&y){t.msg="invalid distance code",n.mode=xj;break}n.offset=b,n.extra=15&y,n.mode=_j;case _j:if(n.extra){for(L=n.extra;l<L;){if(0===s)break t;s--,c+=r[o++]<<l,l+=8}n.offset+=c&(1<<n.extra)-1,c>>>=n.extra,l-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){t.msg="invalid distance too far back",n.mode=xj;break}n.mode=Ej;case Ej:if(0===u)break t;if(f=d-u,n.offset>f){if((f=n.offset-f)>n.whave&&n.sane){t.msg="invalid distance too far back",n.mode=xj;break}f>n.wnext?(f-=n.wnext,p=n.wsize-f):p=n.wnext-f,f>n.length&&(f=n.length),m=n.window}else m=i,p=a-n.offset,f=n.length;f>u&&(f=u),u-=f,n.length-=f;do{i[a++]=m[p++]}while(--f);0===n.length&&(n.mode=vj);break;case Nj:if(0===u)break t;i[a++]=n.length,u--,n.mode=vj;break;case Lj:if(n.wrap){for(;l<32;){if(0===s)break t;s--,c|=r[o++]<<l,l+=8}if(d-=u,t.total_out+=d,n.total+=d,d&&(t.adler=n.check=n.flags?_I(n.check,i,d,a-d):wI(n.check,i,d,a-d)),d=u,(n.flags?c:jj(c))!==n.check){t.msg="incorrect data check",n.mode=xj;break}c=0,l=0}n.mode=Sj;case Sj:if(n.wrap&&n.flags){for(;l<32;){if(0===s)break t;s--,c+=r[o++]<<l,l+=8}if(c!==(4294967295&n.total)){t.msg="incorrect length check",n.mode=xj;break}c=0,l=0}n.mode=Aj;case Aj:E=Gk;break t;case xj:E=qk;break t;case Tj:return Jk;default:return Vk}return t.next_out=a,t.avail_out=u,t.next_in=o,t.avail_in=s,n.hold=c,n.bits=l,(n.wsize||d!==t.avail_out&&n.mode<xj&&(n.mode<Lj||e!==Wk))&&function(t,e,n,r){var i,o=t.state;null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new mT(o.wsize)),r>=o.wsize?(pT(o.window,e,n-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((i=o.wsize-o.wnext)>r&&(i=r),pT(o.window,e,n-r,i,o.wnext),(r-=i)?(pT(o.window,e,n-r,r,0),o.wnext=r,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=i)))}(t,t.output,t.next_out,d-t.avail_out),h-=t.avail_in,d-=t.avail_out,t.total_in+=h,t.total_out+=d,n.total+=d,n.wrap&&d&&(t.adler=n.check=n.flags?_I(n.check,i,d,t.next_out-d):wI(n.check,i,d,t.next_out-d)),t.data_type=n.bits+(n.last?64:0)+(n.mode===lj?128:0)+(n.mode===bj||n.mode===fj?256:0),(0===h&&0===d||e===Wk)&&E===Hk&&(E=Kk),E}var Fj,Wj=1,Yj=7;function Qj(t){if(t<Wj||t>Yj)throw new TypeError("Bad argument");this.mode=t,this.init_done=!1,this.write_in_progress=!1,this.pending_close=!1,this.windowBits=0,this.level=0,this.memLevel=0,this.strategy=0,this.dictionary=null}function Hj(t,e){for(var n=0;n<t.length;n++)this[e+n]=t[n]}Qj.prototype.init=function(t,e,n,r,i){var o;switch(this.windowBits=t,this.level=e,this.memLevel=n,this.strategy=r,3!==this.mode&&4!==this.mode||(this.windowBits+=16),this.mode===Yj&&(this.windowBits+=32),5!==this.mode&&6!==this.mode||(this.windowBits=-this.windowBits),this.strm=new fT,this.mode){case Wj:case 3:case 5:o=function(t,e,n,r,i,o){if(!t)return kI;var a=1;if(e===DI&&(e=6),r<0?(a=0,r=-r):r>15&&(a=2,r-=16),i<1||i>FI||n!==UI||r<8||r>15||e<0||e>9||o<0||o>RI)return ck(t,kI);8===r&&(r=9);var s=new _k;return t.state=s,s.strm=t,s.wrap=a,s.gzhead=null,s.w_bits=r,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=i+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+ZI-1)/ZI),s.window=new mT(2*s.w_size),s.head=new gT(s.hash_size),s.prev=new gT(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new mT(s.pending_buf_size),s.d_buf=1*s.lit_bufsize,s.l_buf=3*s.lit_bufsize,s.level=e,s.strategy=o,s.method=n,Ek(t)}(this.strm,this.level,8,this.windowBits,this.memLevel,this.strategy);break;case 2:case 4:case 6:case Yj:o=Oj(this.strm,this.windowBits);break;default:throw new Error("Unknown mode "+this.mode)}0===o?(this.write_in_progress=!1,this.init_done=!0):this._error(o)},Qj.prototype.params=function(){throw new Error("deflateParams Not supported")},Qj.prototype._writeCheck=function(){if(!this.init_done)throw new Error("write before init");if(0===this.mode)throw new Error("already finalized");if(this.write_in_progress)throw new Error("write already in progress");if(this.pending_close)throw new Error("close is pending")},Qj.prototype.write=function(t,e,n,r,i,o,a){this._writeCheck(),this.write_in_progress=!0;var s=this;return fS.nextTick((function(){s.write_in_progress=!1;var u=s._write(t,e,n,r,i,o,a);s.callback(u[0],u[1]),s.pending_close&&s.close()})),this},Qj.prototype.writeSync=function(t,e,n,r,i,o,a){return this._writeCheck(),this._write(t,e,n,r,i,o,a)},Qj.prototype._write=function(t,e,n,r,i,o,a){if(this.write_in_progress=!0,0!==t&&1!==t&&2!==t&&3!==t&&4!==t&&5!==t)throw new Error("Invalid flush value");null==e&&(e=new p_(0),r=0,n=0),i._set?i.set=i._set:i.set=Hj;var s,u=this.strm;switch(u.avail_in=r,u.input=e,u.next_in=n,u.avail_out=a,u.output=i,u.next_out=o,this.mode){case Wj:case 3:case 5:s=Nk(u,t);break;case Yj:case 2:case 4:case 6:s=Uj(u,t);break;default:throw new Error("Unknown mode "+this.mode)}return 1!==s&&0!==s&&this._error(s),this.write_in_progress=!1,[u.avail_in,u.avail_out]},Qj.prototype.close=function(){this.write_in_progress?this.pending_close=!0:(this.pending_close=!1,this.mode===Wj||3===this.mode||5===this.mode?function(t){var e;t&&t.state&&((e=t.state.status)!==KI&&e!==XI&&e!==$I&&e!==tk&&e!==ek&&e!==nk&&e!==rk?ck(t,kI):(t.state=null,e===nk&&ck(t,jI)))}(this.strm):function(t){if(!t||!t.state)return Vk;var e=t.state;e.window&&(e.window=null),t.state=null}(this.strm),this.mode=0)},Qj.prototype.reset=function(){switch(this.mode){case Wj:case 5:Fj=Ek(this.strm);break;case 2:case 6:Fj=Dj(this.strm)}0!==Fj&&this._error(Fj)},Qj.prototype._error=function(t){this.onerror(dT[t]+": "+this.strm.msg,t),this.write_in_progress=!1,this.pending_close&&this.close()};var Gj=Object.freeze({__proto__:null,NONE:0,DEFLATE:Wj,INFLATE:2,GZIP:3,GUNZIP:4,DEFLATERAW:5,INFLATERAW:6,UNZIP:Yj,Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8,Zlib:Qj});var Zj={};Object.keys(Gj).forEach((function(t){Zj[t]=Gj[t]})),Zj.Z_MIN_WINDOWBITS=8,Zj.Z_MAX_WINDOWBITS=15,Zj.Z_DEFAULT_WINDOWBITS=15,Zj.Z_MIN_CHUNK=64,Zj.Z_MAX_CHUNK=1/0,Zj.Z_DEFAULT_CHUNK=16384,Zj.Z_MIN_MEMLEVEL=1,Zj.Z_MAX_MEMLEVEL=9,Zj.Z_DEFAULT_MEMLEVEL=8,Zj.Z_MIN_LEVEL=-1,Zj.Z_MAX_LEVEL=9,Zj.Z_DEFAULT_LEVEL=Zj.Z_DEFAULT_COMPRESSION;var Vj={Z_OK:Zj.Z_OK,Z_STREAM_END:Zj.Z_STREAM_END,Z_NEED_DICT:Zj.Z_NEED_DICT,Z_ERRNO:Zj.Z_ERRNO,Z_STREAM_ERROR:Zj.Z_STREAM_ERROR,Z_DATA_ERROR:Zj.Z_DATA_ERROR,Z_MEM_ERROR:Zj.Z_MEM_ERROR,Z_BUF_ERROR:Zj.Z_BUF_ERROR,Z_VERSION_ERROR:Zj.Z_VERSION_ERROR};function qj(t){return new bC(t)}function Jj(t){return new vC(t)}function Kj(t){return new _C(t)}function Xj(t){return new EC(t)}function $j(t){return new wC(t)}function tC(t){return new MC(t)}function eC(t){return new NC(t)}function nC(t,e,n){return"function"==typeof e&&(n=e,e={}),gC(new bC(e),t,n)}function rC(t,e){return yC(new bC(e),t)}function iC(t,e,n){return"function"==typeof e&&(n=e,e={}),gC(new wC(e),t,n)}function oC(t,e){return yC(new wC(e),t)}function aC(t,e,n){return"function"==typeof e&&(n=e,e={}),gC(new _C(e),t,n)}function sC(t,e){return yC(new _C(e),t)}function uC(t,e,n){return"function"==typeof e&&(n=e,e={}),gC(new NC(e),t,n)}function cC(t,e){return yC(new NC(e),t)}function lC(t,e,n){return"function"==typeof e&&(n=e,e={}),gC(new vC(e),t,n)}function hC(t,e){return yC(new vC(e),t)}function dC(t,e,n){return"function"==typeof e&&(n=e,e={}),gC(new MC(e),t,n)}function fC(t,e){return yC(new MC(e),t)}function pC(t,e,n){return"function"==typeof e&&(n=e,e={}),gC(new EC(e),t,n)}function mC(t,e){return yC(new EC(e),t)}function gC(t,e,n){var r=[],i=0;function o(){for(var e;null!==(e=t.read());)r.push(e),i+=e.length;t.once("readable",o)}function a(){var e=p_.concat(r,i);r=[],n(null,e),t.close()}t.on("error",(function(e){t.removeListener("end",a),t.removeListener("readable",o),n(e)})),t.on("end",a),t.end(e),o()}function yC(t,e){if("string"==typeof e&&(e=new p_(e)),!p_.isBuffer(e))throw new TypeError("Not a string or buffer");var n=Zj.Z_FINISH;return t._processChunk(e,n)}function bC(t){if(!(this instanceof bC))return new bC(t);LC.call(this,t,Zj.DEFLATE)}function vC(t){if(!(this instanceof vC))return new vC(t);LC.call(this,t,Zj.INFLATE)}function wC(t){if(!(this instanceof wC))return new wC(t);LC.call(this,t,Zj.GZIP)}function MC(t){if(!(this instanceof MC))return new MC(t);LC.call(this,t,Zj.GUNZIP)}function _C(t){if(!(this instanceof _C))return new _C(t);LC.call(this,t,Zj.DEFLATERAW)}function EC(t){if(!(this instanceof EC))return new EC(t);LC.call(this,t,Zj.INFLATERAW)}function NC(t){if(!(this instanceof NC))return new NC(t);LC.call(this,t,Zj.UNZIP)}function LC(t,e){if(this._opts=t=t||{},this._chunkSize=t.chunkSize||Zj.Z_DEFAULT_CHUNK,YA.call(this,t),t.flush&&t.flush!==Zj.Z_NO_FLUSH&&t.flush!==Zj.Z_PARTIAL_FLUSH&&t.flush!==Zj.Z_SYNC_FLUSH&&t.flush!==Zj.Z_FULL_FLUSH&&t.flush!==Zj.Z_FINISH&&t.flush!==Zj.Z_BLOCK)throw new Error("Invalid flush flag: "+t.flush);if(this._flushFlag=t.flush||Zj.Z_NO_FLUSH,t.chunkSize&&(t.chunkSize<Zj.Z_MIN_CHUNK||t.chunkSize>Zj.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+t.chunkSize);if(t.windowBits&&(t.windowBits<Zj.Z_MIN_WINDOWBITS||t.windowBits>Zj.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+t.windowBits);if(t.level&&(t.level<Zj.Z_MIN_LEVEL||t.level>Zj.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+t.level);if(t.memLevel&&(t.memLevel<Zj.Z_MIN_MEMLEVEL||t.memLevel>Zj.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+t.memLevel);if(t.strategy&&t.strategy!=Zj.Z_FILTERED&&t.strategy!=Zj.Z_HUFFMAN_ONLY&&t.strategy!=Zj.Z_RLE&&t.strategy!=Zj.Z_FIXED&&t.strategy!=Zj.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+t.strategy);if(t.dictionary&&!p_.isBuffer(t.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._binding=new Zj.Zlib(e);var n=this;this._hadError=!1,this._binding.onerror=function(t,e){n._binding=null,n._hadError=!0;var r=new Error(t);r.errno=e,r.code=Zj.codes[e],n.emit("error",r)};var r=Zj.Z_DEFAULT_COMPRESSION;"number"==typeof t.level&&(r=t.level);var i=Zj.Z_DEFAULT_STRATEGY;"number"==typeof t.strategy&&(i=t.strategy),this._binding.init(t.windowBits||Zj.Z_DEFAULT_WINDOWBITS,r,t.memLevel||Zj.Z_DEFAULT_MEMLEVEL,i,t.dictionary),this._buffer=new p_(this._chunkSize),this._offset=0,this._closed=!1,this._level=r,this._strategy=i,this.once("end",this.close)}Object.keys(Vj).forEach((function(t){Vj[Vj[t]]=t})),DS(LC,YA),LC.prototype.params=function(t,e,n){if(t<Zj.Z_MIN_LEVEL||t>Zj.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+t);if(e!=Zj.Z_FILTERED&&e!=Zj.Z_HUFFMAN_ONLY&&e!=Zj.Z_RLE&&e!=Zj.Z_FIXED&&e!=Zj.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+e);if(this._level!==t||this._strategy!==e){var r=this;this.flush(Zj.Z_SYNC_FLUSH,(function(){r._binding.params(t,e),r._hadError||(r._level=t,r._strategy=e,n&&n())}))}else fS.nextTick(n)},LC.prototype.reset=function(){return this._binding.reset()},LC.prototype._flush=function(t){this._transform(new p_(0),"",t)},LC.prototype.flush=function(t,e){var n=this._writableState;if(("function"==typeof t||void 0===t&&!e)&&(e=t,t=Zj.Z_FULL_FLUSH),n.ended)e&&fS.nextTick(e);else if(n.ending)e&&this.once("end",e);else if(n.needDrain){var r=this;this.once("drain",(function(){r.flush(e)}))}else this._flushFlag=t,this.write(new p_(0),"",e)},LC.prototype.close=function(t){if(t&&fS.nextTick(t),!this._closed){this._closed=!0,this._binding.close();var e=this;fS.nextTick((function(){e.emit("close")}))}},LC.prototype._transform=function(t,e,n){var r,i=this._writableState,o=(i.ending||i.ended)&&(!t||i.length===t.length);if(null===!t&&!p_.isBuffer(t))return n(new Error("invalid input"));o?r=Zj.Z_FINISH:(r=this._flushFlag,t.length>=i.length&&(this._flushFlag=this._opts.flush||Zj.Z_NO_FLUSH)),this._processChunk(t,r,n)},LC.prototype._processChunk=function(t,e,n){var r=t&&t.length,i=this._chunkSize-this._offset,o=0,a=this,s="function"==typeof n;if(!s){var u,c=[],l=0;this.on("error",(function(t){u=t}));do{var h=this._binding.writeSync(e,t,o,r,this._buffer,this._offset,i)}while(!this._hadError&&p(h[0],h[1]));if(this._hadError)throw u;var d=p_.concat(c,l);return this.close(),d}var f=this._binding.write(e,t,o,r,this._buffer,this._offset,i);function p(u,h){if(!a._hadError){var d=i-h;if(function(t,e){if(!t)throw new Error(e)}(d>=0,"have should not go down"),d>0){var f=a._buffer.slice(a._offset,a._offset+d);a._offset+=d,s?a.push(f):(c.push(f),l+=f.length)}if((0===h||a._offset>=a._chunkSize)&&(i=a._chunkSize,a._offset=0,a._buffer=new p_(a._chunkSize)),0===h){if(o+=r-u,r=u,!s)return!0;var m=a._binding.write(e,t,o,r,a._buffer,a._offset,a._chunkSize);return m.callback=p,void(m.buffer=t)}if(!s)return!1;n()}}f.buffer=t,f.callback=p},DS(bC,LC),DS(vC,LC),DS(wC,LC),DS(MC,LC),DS(_C,LC),DS(EC,LC),DS(NC,LC);var SC,AC,xC={codes:Vj,createDeflate:qj,createInflate:Jj,createDeflateRaw:Kj,createInflateRaw:Xj,createGzip:$j,createGunzip:tC,createUnzip:eC,deflate:nC,deflateSync:rC,gzip:iC,gzipSync:oC,deflateRaw:aC,deflateRawSync:sC,unzip:uC,unzipSync:cC,inflate:lC,inflateSync:hC,gunzip:dC,gunzipSync:fC,inflateRaw:pC,inflateRawSync:mC,Deflate:bC,Inflate:vC,Gzip:wC,Gunzip:MC,DeflateRaw:_C,InflateRaw:EC,Unzip:NC,Zlib:LC},TC=XM(Object.freeze({__proto__:null,codes:Vj,createDeflate:qj,createInflate:Jj,createDeflateRaw:Kj,createInflateRaw:Xj,createGzip:$j,createGunzip:tC,createUnzip:eC,deflate:nC,deflateSync:rC,gzip:iC,gzipSync:oC,deflateRaw:aC,deflateRawSync:sC,unzip:uC,unzipSync:cC,inflate:lC,inflateSync:hC,gunzip:dC,gunzipSync:fC,inflateRaw:pC,inflateRawSync:mC,Deflate:bC,Inflate:vC,Gzip:wC,Gunzip:MC,DeflateRaw:_C,InflateRaw:EC,Unzip:NC,Zlib:LC,default:xC})),IC={exports:{}};function kC(){return AC?SC:(AC=1,SC={BINARY_TYPES:["nodebuffer","arraybuffer","fragments"],EMPTY_BUFFER:p_.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}})}var jC="/Users/sebastian/Work/DePay/solana-web3.js/node_modules/bufferutil",CC={exports:{}},DC=XM(Object.freeze({__proto__:null,default:{}}));function OC(t,e){for(var n=0,r=t.length-1;r>=0;r--){var i=t[r];"."===i?t.splice(r,1):".."===i?(t.splice(r,1),n++):n&&(t.splice(r,1),n--)}if(e)for(;n--;n)t.unshift("..");return t}var zC=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,PC=function(t){return zC.exec(t).slice(1)};function RC(){for(var t="",e=!1,n=arguments.length-1;n>=-1&&!e;n--){var r=n>=0?arguments[n]:"/";if("string"!=typeof r)throw new TypeError("Arguments to path.resolve must be strings");r&&(t=r+"/"+t,e="/"===r.charAt(0))}return t=OC(ZC(t.split("/"),(function(t){return!!t})),!e).join("/"),(e?"/":"")+t||"."}function BC(t){var e=UC(t),n="/"===qC(t,-1);return t=OC(ZC(t.split("/"),(function(t){return!!t})),!e).join("/"),t||e||(t="."),t&&n&&(t+="/"),(e?"/":"")+t}function UC(t){return"/"===t.charAt(0)}function FC(){return BC(ZC(Array.prototype.slice.call(arguments,0),(function(t,e){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t})).join("/"))}function WC(t,e){function n(t){for(var e=0;e<t.length&&""===t[e];e++);for(var n=t.length-1;n>=0&&""===t[n];n--);return e>n?[]:t.slice(e,n-e+1)}t=RC(t).substr(1),e=RC(e).substr(1);for(var r=n(t.split("/")),i=n(e.split("/")),o=Math.min(r.length,i.length),a=o,s=0;s<o;s++)if(r[s]!==i[s]){a=s;break}var u=[];for(s=a;s<r.length;s++)u.push("..");return(u=u.concat(i.slice(a))).join("/")}function YC(t){var e=PC(t),n=e[0],r=e[1];return n||r?(r&&(r=r.substr(0,r.length-1)),n+r):"."}function QC(t,e){var n=PC(t)[2];return e&&n.substr(-1*e.length)===e&&(n=n.substr(0,n.length-e.length)),n}function HC(t){return PC(t)[3]}var GC={extname:HC,basename:QC,dirname:YC,sep:"/",delimiter:":",relative:WC,join:FC,isAbsolute:UC,normalize:BC,resolve:RC};function ZC(t,e){if(t.filter)return t.filter(e);for(var n=[],r=0;r<t.length;r++)e(t[r],r,t)&&n.push(t[r]);return n}var VC,qC="b"==="ab".substr(-1)?function(t,e,n){return t.substr(e,n)}:function(t,e,n){return e<0&&(e=t.length+e),t.substr(e,n)},JC=XM(Object.freeze({__proto__:null,resolve:RC,normalize:BC,isAbsolute:UC,join:FC,relative:WC,sep:"/",delimiter:":",dirname:YC,basename:QC,extname:HC,default:GC}));function KC(){if(void 0===VC){var t=new ArrayBuffer(2),e=new Uint8Array(t),n=new Uint16Array(t);if(e[0]=1,e[1]=2,258===n[0])VC="BE";else{if(513!==n[0])throw new Error("unable to figure out endianess");VC="LE"}}return VC}function XC(){return void 0!==$M.location?$M.location.hostname:""}function $C(){return[]}function tD(){return 0}function eD(){return Number.MAX_VALUE}function nD(){return Number.MAX_VALUE}function rD(){return[]}function iD(){return"Browser"}function oD(){return void 0!==$M.navigator?$M.navigator.appVersion:""}function aD(){return{}}function sD(){return{}}function uD(){return"javascript"}function cD(){return"browser"}function lD(){return"/tmp"}var hD=lD;function dD(){return"$HOME"}var fD,pD,mD,gD,yD,bD,vD,wD,MD,_D,ED={homedir:dD,EOL:"\n",arch:uD,platform:cD,tmpdir:hD,tmpDir:lD,networkInterfaces:aD,getNetworkInterfaces:sD,release:oD,type:iD,cpus:rD,totalmem:nD,freemem:eD,uptime:tD,loadavg:$C,hostname:XC,endianness:KC},ND=XM(Object.freeze({__proto__:null,endianness:KC,hostname:XC,loadavg:$C,uptime:tD,freemem:eD,totalmem:nD,cpus:rD,type:iD,release:oD,networkInterfaces:aD,getNetworkInterfaces:sD,arch:uD,platform:cD,tmpDir:lD,tmpdir:hD,EOL:"\n",homedir:dD,default:ED}));function LD(){if(pD)return fD;pD=1;var t=DC,e=JC,n=ND,r="function"==typeof __webpack_require__?__non_webpack_require__:rE,i=fS.config&&fS.config.variables||{},o=!!fS.env.PREBUILDS_ONLY,a=fS.versions.modules,s=!(!fS.versions||!fS.versions.electron)||!!fS.env.ELECTRON_RUN_AS_NODE||"undefined"!=typeof window&&window.process&&"renderer"===window.process.type?"electron":fS.versions&&fS.versions.nw?"node-webkit":"node",u=fS.env.npm_config_arch||n.arch(),c=fS.env.npm_config_platform||n.platform(),l=fS.env.LIBC||(function(e){return"linux"===e&&t.existsSync("/etc/alpine-release")}(c)?"musl":"glibc"),h=fS.env.ARM_VERSION||("arm64"===u?"8":i.arm_version)||"",d=(fS.versions.uv||"").split(".")[0];function f(t){return r(f.path(t))}function p(e){try{return t.readdirSync(e)}catch(t){return[]}}function m(t,n){var r=p(t).filter(n);return r[0]&&e.join(t,r[0])}function g(t){return/\.node$/.test(t)}function y(t){var e=t.split("-");if(2===e.length){var n=e[0],r=e[1].split("+");if(n&&r.length&&r.every(Boolean))return{name:t,platform:n,architectures:r}}}function b(t,e){return function(n){return null!=n&&(n.platform===t&&n.architectures.includes(e))}}function v(t,e){return t.architectures.length-e.architectures.length}function w(t){var e=t.split("."),n={file:t,specificity:0};if("node"===e.pop()){for(var r=0;r<e.length;r++){var i=e[r];if("node"===i||"electron"===i||"node-webkit"===i)n.runtime=i;else if("napi"===i)n.napi=!0;else if("abi"===i.slice(0,3))n.abi=i.slice(3);else if("uv"===i.slice(0,2))n.uv=i.slice(2);else if("armv"===i.slice(0,4))n.armv=i.slice(4);else{if("glibc"!==i&&"musl"!==i)continue;n.libc=i}n.specificity++}return n}}function M(t,e){return function(n){return null!=n&&(!(n.runtime!==t&&!function(t){return"node"===t.runtime&&t.napi}(n))&&(!(n.abi!==e&&!n.napi)&&((!n.uv||n.uv===d)&&((!n.armv||n.armv===h)&&(!n.libc||n.libc===l)))))}}function _(t){return function(e,n){return e.runtime!==n.runtime?e.runtime===t?-1:1:e.abi!==n.abi?e.abi?-1:1:e.specificity!==n.specificity?e.specificity>n.specificity?-1:1:0}}return fD=f,f.path=function(t){t=e.resolve(t||".");try{var n=r(e.join(t,"package.json")).name.toUpperCase().replace(/-/g,"_");fS.env[n+"_PREBUILD"]&&(t=fS.env[n+"_PREBUILD"])}catch(t){}if(!o){var i=m(e.join(t,"build/Release"),g);if(i)return i;var f=m(e.join(t,"build/Debug"),g);if(f)return f}var E=S(t);if(E)return E;var N=S(e.dirname(fS.execPath));if(N)return N;var L=["platform="+c,"arch="+u,"runtime="+s,"abi="+a,"uv="+d,h?"armv="+h:"","libc="+l,"node="+fS.versions.node,fS.versions.electron?"electron="+fS.versions.electron:"","function"==typeof __webpack_require__?"webpack=true":""].filter(Boolean).join(" ");throw new Error("No native build was found for "+L+"\n loaded from: "+t+"\n");function S(t){var n=p(e.join(t,"prebuilds")).map(y).filter(b(c,u)).sort(v)[0];if(n){var r=e.join(t,"prebuilds",n.name),i=p(r).map(w).filter(M(s,a)).sort(_(s))[0];return i?e.join(r,i.file):void 0}}},f.parseTags=w,f.matchTags=M,f.compareTags=_,f.parseTuple=y,f.matchTuple=b,f.compareTuples=v,fD}function SD(){return yD||(yD=1,function(t){try{t.exports=LD()(jC)}catch(e){t.exports=(gD||(gD=1,mD={mask:(t,e,n,r,i)=>{for(var o=0;o<i;o++)n[r+o]=t[o]^e[3&o]},unmask:(t,e)=>{const n=t.length;for(var r=0;r<n;r++)t[r]^=e[3&r]}}),mD)}}(CC)),CC.exports}function AD(){if(bD)return IC.exports;bD=1;const{EMPTY_BUFFER:t}=kC();function e(t,e,n,r,i){for(let o=0;o<i;o++)n[r+o]=t[o]^e[3&o]}function n(t,e){for(let n=0;n<t.length;n++)t[n]^=e[3&n]}if(IC.exports={concat:function(e,n){if(0===e.length)return t;if(1===e.length)return e[0];const r=p_.allocUnsafe(n);let i=0;for(let t=0;t<e.length;t++){const n=e[t];r.set(n,i),i+=n.length}return i<n?r.slice(0,i):r},mask:e,toArrayBuffer:function(t){return t.byteLength===t.buffer.byteLength?t.buffer:t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)},toBuffer:function t(e){if(t.readOnly=!0,p_.isBuffer(e))return e;let n;return e instanceof ArrayBuffer?n=p_.from(e):ArrayBuffer.isView(e)?n=p_.from(e.buffer,e.byteOffset,e.byteLength):(n=p_.from(e),t.readOnly=!1),n},unmask:n},!fS.env.WS_NO_BUFFER_UTIL)try{const t=SD();IC.exports.mask=function(n,r,i,o,a){a<48?e(n,r,i,o,a):t.mask(n,r,i,o,a)},IC.exports.unmask=function(e,r){e.length<32?n(e,r):t.unmask(e,r)}}catch(t){}return IC.exports}function xD(){if(_D)return MD;_D=1;const t=TC,e=AD(),n=function(){if(wD)return vD;wD=1;const t=Symbol("kDone"),e=Symbol("kRun");return vD=class{constructor(n){this[t]=()=>{this.pending--,this[e]()},this.concurrency=n||1/0,this.jobs=[],this.pending=0}add(t){this.jobs.push(t),this[e]()}[e](){if(this.pending!==this.concurrency&&this.jobs.length){const e=this.jobs.shift();this.pending++,e(this[t])}}}}(),{kStatusCode:r}=kC(),i=p_.from([0,0,255,255]),o=Symbol("permessage-deflate"),a=Symbol("total-length"),s=Symbol("callback"),u=Symbol("buffers"),c=Symbol("error");let l;function h(t){this[u].push(t),this[a]+=t.length}function d(t){this[a]+=t.length,this[o]._maxPayload<1||this[a]<=this[o]._maxPayload?this[u].push(t):(this[c]=new RangeError("Max payload size exceeded"),this[c].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[c][r]=1009,this.removeListener("data",d),this.reset())}function f(t){this[o]._inflate=null,t[r]=1007,this[s](t)}return MD=class{constructor(t,e,r){if(this._maxPayload=0|r,this._options=t||{},this._threshold=void 0!==this._options.threshold?this._options.threshold:1024,this._isServer=!!e,this._deflate=null,this._inflate=null,this.params=null,!l){const t=void 0!==this._options.concurrencyLimit?this._options.concurrencyLimit:10;l=new n(t)}}static get extensionName(){return"permessage-deflate"}offer(){const t={};return this._options.serverNoContextTakeover&&(t.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(t.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(t.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?t.client_max_window_bits=this._options.clientMaxWindowBits:null==this._options.clientMaxWindowBits&&(t.client_max_window_bits=!0),t}accept(t){return t=this.normalizeParams(t),this.params=this._isServer?this.acceptAsServer(t):this.acceptAsClient(t),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){const t=this._deflate[s];this._deflate.close(),this._deflate=null,t&&t(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(t){const e=this._options,n=t.find((t=>!(!1===e.serverNoContextTakeover&&t.server_no_context_takeover||t.server_max_window_bits&&(!1===e.serverMaxWindowBits||"number"==typeof e.serverMaxWindowBits&&e.serverMaxWindowBits>t.server_max_window_bits)||"number"==typeof e.clientMaxWindowBits&&!t.client_max_window_bits)));if(!n)throw new Error("None of the extension offers can be accepted");return e.serverNoContextTakeover&&(n.server_no_context_takeover=!0),e.clientNoContextTakeover&&(n.client_no_context_takeover=!0),"number"==typeof e.serverMaxWindowBits&&(n.server_max_window_bits=e.serverMaxWindowBits),"number"==typeof e.clientMaxWindowBits?n.client_max_window_bits=e.clientMaxWindowBits:!0!==n.client_max_window_bits&&!1!==e.clientMaxWindowBits||delete n.client_max_window_bits,n}acceptAsClient(t){const e=t[0];if(!1===this._options.clientNoContextTakeover&&e.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(e.client_max_window_bits){if(!1===this._options.clientMaxWindowBits||"number"==typeof this._options.clientMaxWindowBits&&e.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"')}else"number"==typeof this._options.clientMaxWindowBits&&(e.client_max_window_bits=this._options.clientMaxWindowBits);return e}normalizeParams(t){return t.forEach((t=>{Object.keys(t).forEach((e=>{let n=t[e];if(n.length>1)throw new Error(`Parameter "${e}" must have only a single value`);if(n=n[0],"client_max_window_bits"===e){if(!0!==n){const t=+n;if(!Number.isInteger(t)||t<8||t>15)throw new TypeError(`Invalid value for parameter "${e}": ${n}`);n=t}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${e}": ${n}`)}else if("server_max_window_bits"===e){const t=+n;if(!Number.isInteger(t)||t<8||t>15)throw new TypeError(`Invalid value for parameter "${e}": ${n}`);n=t}else{if("client_no_context_takeover"!==e&&"server_no_context_takeover"!==e)throw new Error(`Unknown parameter "${e}"`);if(!0!==n)throw new TypeError(`Invalid value for parameter "${e}": ${n}`)}t[e]=n}))})),t}decompress(t,e,n){l.add((r=>{this._decompress(t,e,((t,e)=>{r(),n(t,e)}))}))}compress(t,e,n){l.add((r=>{this._compress(t,e,((t,e)=>{r(),n(t,e)}))}))}_decompress(n,r,l){const h=this._isServer?"client":"server";if(!this._inflate){const e=`${h}_max_window_bits`,n="number"!=typeof this.params[e]?t.Z_DEFAULT_WINDOWBITS:this.params[e];this._inflate=t.createInflateRaw({...this._options.zlibInflateOptions,windowBits:n}),this._inflate[o]=this,this._inflate[a]=0,this._inflate[u]=[],this._inflate.on("error",f),this._inflate.on("data",d)}this._inflate[s]=l,this._inflate.write(n),r&&this._inflate.write(i),this._inflate.flush((()=>{const t=this._inflate[c];if(t)return this._inflate.close(),this._inflate=null,void l(t);const n=e.concat(this._inflate[u],this._inflate[a]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[a]=0,this._inflate[u]=[],r&&this.params[`${h}_no_context_takeover`]&&this._inflate.reset()),l(null,n)}))}_compress(n,r,i){const o=this._isServer?"server":"client";if(!this._deflate){const e=`${o}_max_window_bits`,n="number"!=typeof this.params[e]?t.Z_DEFAULT_WINDOWBITS:this.params[e];this._deflate=t.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:n}),this._deflate[a]=0,this._deflate[u]=[],this._deflate.on("data",h)}this._deflate[s]=i,this._deflate.write(n),this._deflate.flush(t.Z_SYNC_FLUSH,(()=>{if(!this._deflate)return;let t=e.concat(this._deflate[u],this._deflate[a]);r&&(t=t.slice(0,t.length-4)),this._deflate[s]=null,this._deflate[a]=0,this._deflate[u]=[],r&&this.params[`${o}_no_context_takeover`]&&this._deflate.reset(),i(null,t)}))}},MD}var TD,ID,kD,jD,CD,DD,OD,zD,PD,RD,BD,UD,FD,WD,YD,QD,HD,GD,ZD,VD,qD,JD,KD,XD={exports:{}},$D="/Users/sebastian/Work/DePay/solana-web3.js/node_modules/utf-8-validate",tO={exports:{}};function eO(){return kD||(kD=1,function(t){try{t.exports=LD()($D)}catch(e){t.exports=(ID||(ID=1,TD=function(t){const e=t.length;let n=0;for(;n<e;)if(0==(128&t[n]))n++;else if(192==(224&t[n])){if(n+1===e||128!=(192&t[n+1])||192==(254&t[n]))return!1;n+=2}else if(224==(240&t[n])){if(n+2>=e||128!=(192&t[n+1])||128!=(192&t[n+2])||224===t[n]&&128==(224&t[n+1])||237===t[n]&&160==(224&t[n+1]))return!1;n+=3}else{if(240!=(248&t[n]))return!1;if(n+3>=e||128!=(192&t[n+1])||128!=(192&t[n+2])||128!=(192&t[n+3])||240===t[n]&&128==(240&t[n+1])||244===t[n]&&t[n+1]>143||t[n]>244)return!1;n+=4}return!0}),TD)}}(tO)),tO.exports}function nO(){if(jD)return XD.exports;jD=1;function t(t){const e=t.length;let n=0;for(;n<e;)if(0==(128&t[n]))n++;else if(192==(224&t[n])){if(n+1===e||128!=(192&t[n+1])||192==(254&t[n]))return!1;n+=2}else if(224==(240&t[n])){if(n+2>=e||128!=(192&t[n+1])||128!=(192&t[n+2])||224===t[n]&&128==(224&t[n+1])||237===t[n]&&160==(224&t[n+1]))return!1;n+=3}else{if(240!=(248&t[n]))return!1;if(n+3>=e||128!=(192&t[n+1])||128!=(192&t[n+2])||128!=(192&t[n+3])||240===t[n]&&128==(240&t[n+1])||244===t[n]&&t[n+1]>143||t[n]>244)return!1;n+=4}return!0}if(XD.exports={isValidStatusCode:function(t){return t>=1e3&&t<=1014&&1004!==t&&1005!==t&&1006!==t||t>=3e3&&t<=4999},isValidUTF8:t,tokenChars:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0]},!fS.env.WS_NO_UTF_8_VALIDATE)try{const e=eO();XD.exports.isValidUTF8=function(n){return n.length<150?t(n):e(n)}}catch(t){}return XD.exports}function rO(){if(DD)return CD;DD=1;const{Writable:t}=lT,e=xD(),{BINARY_TYPES:n,EMPTY_BUFFER:r,kStatusCode:i,kWebSocket:o}=kC(),{concat:a,toArrayBuffer:s,unmask:u}=AD(),{isValidStatusCode:c,isValidUTF8:l}=nO();function h(t,e,n,r,o){const a=new t(n?`Invalid WebSocket frame: ${e}`:e);return Error.captureStackTrace(a,h),a.code=o,a[i]=r,a}return CD=class extends t{constructor(t={}){super(),this._binaryType=t.binaryType||n[0],this._extensions=t.extensions||{},this._isServer=!!t.isServer,this._maxPayload=0|t.maxPayload,this._skipUTF8Validation=!!t.skipUTF8Validation,this[o]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._state=0,this._loop=!1}_write(t,e,n){if(8===this._opcode&&0==this._state)return n();this._bufferedBytes+=t.length,this._buffers.push(t),this.startLoop(n)}consume(t){if(this._bufferedBytes-=t,t===this._buffers[0].length)return this._buffers.shift();if(t<this._buffers[0].length){const e=this._buffers[0];return this._buffers[0]=e.slice(t),e.slice(0,t)}const e=p_.allocUnsafe(t);do{const n=this._buffers[0],r=e.length-t;t>=n.length?e.set(this._buffers.shift(),r):(e.set(new Uint8Array(n.buffer,n.byteOffset,t),r),this._buffers[0]=n.slice(t)),t-=n.length}while(t>0);return e}startLoop(t){let e;this._loop=!0;do{switch(this._state){case 0:e=this.getInfo();break;case 1:e=this.getPayloadLength16();break;case 2:e=this.getPayloadLength64();break;case 3:this.getMask();break;case 4:e=this.getData(t);break;default:return void(this._loop=!1)}}while(this._loop);t(e)}getInfo(){if(this._bufferedBytes<2)return void(this._loop=!1);const t=this.consume(2);if(0!=(48&t[0]))return this._loop=!1,h(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");const n=64==(64&t[0]);if(n&&!this._extensions[e.extensionName])return this._loop=!1,h(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(this._fin=128==(128&t[0]),this._opcode=15&t[0],this._payloadLength=127&t[1],0===this._opcode){if(n)return this._loop=!1,h(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(!this._fragmented)return this._loop=!1,h(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");this._opcode=this._fragmented}else if(1===this._opcode||2===this._opcode){if(this._fragmented)return this._loop=!1,h(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");this._compressed=n}else{if(!(this._opcode>7&&this._opcode<11))return this._loop=!1,h(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");if(!this._fin)return this._loop=!1,h(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");if(n)return this._loop=!1,h(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(this._payloadLength>125)return this._loop=!1,h(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH")}if(this._fin||this._fragmented||(this._fragmented=this._opcode),this._masked=128==(128&t[1]),this._isServer){if(!this._masked)return this._loop=!1,h(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK")}else if(this._masked)return this._loop=!1,h(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");if(126===this._payloadLength)this._state=1;else{if(127!==this._payloadLength)return this.haveLength();this._state=2}}getPayloadLength16(){if(!(this._bufferedBytes<2))return this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength();this._loop=!1}getPayloadLength64(){if(this._bufferedBytes<8)return void(this._loop=!1);const t=this.consume(8),e=t.readUInt32BE(0);return e>Math.pow(2,21)-1?(this._loop=!1,h(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH")):(this._payloadLength=e*Math.pow(2,32)+t.readUInt32BE(4),this.haveLength())}haveLength(){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0))return this._loop=!1,h(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");this._masked?this._state=3:this._state=4}getMask(){this._bufferedBytes<4?this._loop=!1:(this._mask=this.consume(4),this._state=4)}getData(t){let e=r;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength)return void(this._loop=!1);e=this.consume(this._payloadLength),this._masked&&0!=(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])&&u(e,this._mask)}return this._opcode>7?this.controlMessage(e):this._compressed?(this._state=5,void this.decompress(e,t)):(e.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(e)),this.dataMessage())}decompress(t,n){this._extensions[e.extensionName].decompress(t,this._fin,((t,e)=>{if(t)return n(t);if(e.length){if(this._messageLength+=e.length,this._messageLength>this._maxPayload&&this._maxPayload>0)return n(h(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"));this._fragments.push(e)}const r=this.dataMessage();if(r)return n(r);this.startLoop(n)}))}dataMessage(){if(this._fin){const t=this._messageLength,e=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],2===this._opcode){let n;n="nodebuffer"===this._binaryType?a(e,t):"arraybuffer"===this._binaryType?s(a(e,t)):e,this.emit("message",n,!0)}else{const n=a(e,t);if(!this._skipUTF8Validation&&!l(n))return this._loop=!1,h(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");this.emit("message",n,!1)}}this._state=0}controlMessage(t){if(8===this._opcode)if(this._loop=!1,0===t.length)this.emit("conclude",1005,r),this.end();else{if(1===t.length)return h(RangeError,"invalid payload length 1",!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");{const e=t.readUInt16BE(0);if(!c(e))return h(RangeError,`invalid status code ${e}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");const n=t.slice(2);if(!this._skipUTF8Validation&&!l(n))return h(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");this.emit("conclude",e,n),this.end()}}else 9===this._opcode?this.emit("ping",t):this.emit("pong",t);this._state=0}},CD}function iO(){if(zD)return OD;zD=1;const{randomFillSync:t}=oE,e=xD(),{EMPTY_BUFFER:n}=kC(),{isValidStatusCode:r}=nO(),{mask:i,toBuffer:o}=AD(),a=Symbol("kByteLength"),s=p_.alloc(4);class u{constructor(t,e,n){this._extensions=e||{},n&&(this._generateMask=n,this._maskBuffer=p_.alloc(4)),this._socket=t,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._deflating=!1,this._queue=[]}static frame(e,n){let r,o,u=!1,c=2,l=!1;n.mask&&(r=n.maskBuffer||s,n.generateMask?n.generateMask(r):t(r,0,4),l=0==(r[0]|r[1]|r[2]|r[3]),c=6),"string"==typeof e?o=n.mask&&!l||void 0===n[a]?(e=p_.from(e)).length:n[a]:(o=e.length,u=n.mask&&n.readOnly&&!l);let h=o;o>=65536?(c+=8,h=127):o>125&&(c+=2,h=126);const d=p_.allocUnsafe(u?o+c:c);return d[0]=n.fin?128|n.opcode:n.opcode,n.rsv1&&(d[0]|=64),d[1]=h,126===h?d.writeUInt16BE(o,2):127===h&&(d[2]=d[3]=0,d.writeUIntBE(o,4,6)),n.mask?(d[1]|=128,d[c-4]=r[0],d[c-3]=r[1],d[c-2]=r[2],d[c-1]=r[3],l?[d,e]:u?(i(e,r,d,c,o),[d]):(i(e,r,e,0,o),[d,e])):[d,e]}close(t,e,i,o){let s;if(void 0===t)s=n;else{if("number"!=typeof t||!r(t))throw new TypeError("First argument must be a valid error code number");if(void 0!==e&&e.length){const n=p_.byteLength(e);if(n>123)throw new RangeError("The message must not be greater than 123 bytes");s=p_.allocUnsafe(2+n),s.writeUInt16BE(t,0),"string"==typeof e?s.write(e,2):s.set(e,2)}else s=p_.allocUnsafe(2),s.writeUInt16BE(t,0)}const c={[a]:s.length,fin:!0,generateMask:this._generateMask,mask:i,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._deflating?this.enqueue([this.dispatch,s,!1,c,o]):this.sendFrame(u.frame(s,c),o)}ping(t,e,n){let r,i;if("string"==typeof t?(r=p_.byteLength(t),i=!1):(r=(t=o(t)).length,i=o.readOnly),r>125)throw new RangeError("The data size must not be greater than 125 bytes");const s={[a]:r,fin:!0,generateMask:this._generateMask,mask:e,maskBuffer:this._maskBuffer,opcode:9,readOnly:i,rsv1:!1};this._deflating?this.enqueue([this.dispatch,t,!1,s,n]):this.sendFrame(u.frame(t,s),n)}pong(t,e,n){let r,i;if("string"==typeof t?(r=p_.byteLength(t),i=!1):(r=(t=o(t)).length,i=o.readOnly),r>125)throw new RangeError("The data size must not be greater than 125 bytes");const s={[a]:r,fin:!0,generateMask:this._generateMask,mask:e,maskBuffer:this._maskBuffer,opcode:10,readOnly:i,rsv1:!1};this._deflating?this.enqueue([this.dispatch,t,!1,s,n]):this.sendFrame(u.frame(t,s),n)}send(t,n,r){const i=this._extensions[e.extensionName];let s,c,l=n.binary?2:1,h=n.compress;if("string"==typeof t?(s=p_.byteLength(t),c=!1):(s=(t=o(t)).length,c=o.readOnly),this._firstFragment?(this._firstFragment=!1,h&&i&&i.params[i._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(h=s>=i._threshold),this._compress=h):(h=!1,l=0),n.fin&&(this._firstFragment=!0),i){const e={[a]:s,fin:n.fin,generateMask:this._generateMask,mask:n.mask,maskBuffer:this._maskBuffer,opcode:l,readOnly:c,rsv1:h};this._deflating?this.enqueue([this.dispatch,t,this._compress,e,r]):this.dispatch(t,this._compress,e,r)}else this.sendFrame(u.frame(t,{[a]:s,fin:n.fin,generateMask:this._generateMask,mask:n.mask,maskBuffer:this._maskBuffer,opcode:l,readOnly:c,rsv1:!1}),r)}dispatch(t,n,r,i){if(!n)return void this.sendFrame(u.frame(t,r),i);const o=this._extensions[e.extensionName];this._bufferedBytes+=r[a],this._deflating=!0,o.compress(t,r.fin,((t,e)=>{if(this._socket.destroyed){const t=new Error("The socket was closed while data was being compressed");"function"==typeof i&&i(t);for(let e=0;e<this._queue.length;e++){const n=this._queue[e],r=n[n.length-1];"function"==typeof r&&r(t)}}else this._bufferedBytes-=r[a],this._deflating=!1,r.readOnly=!1,this.sendFrame(u.frame(e,r),i),this.dequeue()}))}dequeue(){for(;!this._deflating&&this._queue.length;){const t=this._queue.shift();this._bufferedBytes-=t[3][a],Reflect.apply(t[0],this,t.slice(1))}}enqueue(t){this._bufferedBytes+=t[3][a],this._queue.push(t)}sendFrame(t,e){2===t.length?(this._socket.cork(),this._socket.write(t[0]),this._socket.write(t[1],e),this._socket.uncork()):this._socket.write(t[0],e)}}return OD=u}function oO(){if(UD)return BD;UD=1;const{tokenChars:t}=nO();function e(t,e,n){void 0===t[e]?t[e]=[n]:t[e].push(n)}return BD={format:function(t){return Object.keys(t).map((e=>{let n=t[e];return Array.isArray(n)||(n=[n]),n.map((t=>[e].concat(Object.keys(t).map((e=>{let n=t[e];return Array.isArray(n)||(n=[n]),n.map((t=>!0===t?e:`${e}=${t}`)).join("; ")}))).join("; "))).join(", ")})).join(", ")},parse:function(n){const r=Object.create(null);let i,o,a=Object.create(null),s=!1,u=!1,c=!1,l=-1,h=-1,d=-1,f=0;for(;f<n.length;f++)if(h=n.charCodeAt(f),void 0===i)if(-1===d&&1===t[h])-1===l&&(l=f);else if(0===f||32!==h&&9!==h){if(59!==h&&44!==h)throw new SyntaxError(`Unexpected character at index ${f}`);{if(-1===l)throw new SyntaxError(`Unexpected character at index ${f}`);-1===d&&(d=f);const t=n.slice(l,d);44===h?(e(r,t,a),a=Object.create(null)):i=t,l=d=-1}}else-1===d&&-1!==l&&(d=f);else if(void 0===o)if(-1===d&&1===t[h])-1===l&&(l=f);else if(32===h||9===h)-1===d&&-1!==l&&(d=f);else if(59===h||44===h){if(-1===l)throw new SyntaxError(`Unexpected character at index ${f}`);-1===d&&(d=f),e(a,n.slice(l,d),!0),44===h&&(e(r,i,a),a=Object.create(null),i=void 0),l=d=-1}else{if(61!==h||-1===l||-1!==d)throw new SyntaxError(`Unexpected character at index ${f}`);o=n.slice(l,f),l=d=-1}else if(u){if(1!==t[h])throw new SyntaxError(`Unexpected character at index ${f}`);-1===l?l=f:s||(s=!0),u=!1}else if(c)if(1===t[h])-1===l&&(l=f);else if(34===h&&-1!==l)c=!1,d=f;else{if(92!==h)throw new SyntaxError(`Unexpected character at index ${f}`);u=!0}else if(34===h&&61===n.charCodeAt(f-1))c=!0;else if(-1===d&&1===t[h])-1===l&&(l=f);else if(-1===l||32!==h&&9!==h){if(59!==h&&44!==h)throw new SyntaxError(`Unexpected character at index ${f}`);{if(-1===l)throw new SyntaxError(`Unexpected character at index ${f}`);-1===d&&(d=f);let t=n.slice(l,d);s&&(t=t.replace(/\\/g,""),s=!1),e(a,o,t),44===h&&(e(r,i,a),a=Object.create(null),i=void 0),o=void 0,l=d=-1}}else-1===d&&(d=f);if(-1===l||c||32===h||9===h)throw new SyntaxError("Unexpected end of input");-1===d&&(d=f);const p=n.slice(l,d);return void 0===i?e(r,p,a):(void 0===o?e(a,p,!0):e(a,o,s?p.replace(/\\/g,""):p),e(r,i,a)),r}},BD}function aO(){if(WD)return FD;WD=1;const t=ES,e=tT,n=sT,r=uT,i=cT,{randomBytes:o,createHash:a}=oE,{URL:s}=hT,u=xD(),c=rO(),l=iO(),{BINARY_TYPES:h,EMPTY_BUFFER:d,GUID:f,kForOnEventAttribute:p,kListener:m,kStatusCode:g,kWebSocket:y,NOOP:b}=kC(),{EventTarget:{addEventListener:v,removeEventListener:w}}=function(){if(RD)return PD;RD=1;const{kForOnEventAttribute:t,kListener:e}=kC(),n=Symbol("kCode"),r=Symbol("kData"),i=Symbol("kError"),o=Symbol("kMessage"),a=Symbol("kReason"),s=Symbol("kTarget"),u=Symbol("kType"),c=Symbol("kWasClean");class l{constructor(t){this[s]=null,this[u]=t}get target(){return this[s]}get type(){return this[u]}}Object.defineProperty(l.prototype,"target",{enumerable:!0}),Object.defineProperty(l.prototype,"type",{enumerable:!0});class h extends l{constructor(t,e={}){super(t),this[n]=void 0===e.code?0:e.code,this[a]=void 0===e.reason?"":e.reason,this[c]=void 0!==e.wasClean&&e.wasClean}get code(){return this[n]}get reason(){return this[a]}get wasClean(){return this[c]}}Object.defineProperty(h.prototype,"code",{enumerable:!0}),Object.defineProperty(h.prototype,"reason",{enumerable:!0}),Object.defineProperty(h.prototype,"wasClean",{enumerable:!0});class d extends l{constructor(t,e={}){super(t),this[i]=void 0===e.error?null:e.error,this[o]=void 0===e.message?"":e.message}get error(){return this[i]}get message(){return this[o]}}Object.defineProperty(d.prototype,"error",{enumerable:!0}),Object.defineProperty(d.prototype,"message",{enumerable:!0});class f extends l{constructor(t,e={}){super(t),this[r]=void 0===e.data?null:e.data}get data(){return this[r]}}Object.defineProperty(f.prototype,"data",{enumerable:!0});const p={addEventListener(n,r,i={}){let o;if("message"===n)o=function(t,e){const n=new f("message",{data:e?t:t.toString()});n[s]=this,r.call(this,n)};else if("close"===n)o=function(t,e){const n=new h("close",{code:t,reason:e.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});n[s]=this,r.call(this,n)};else if("error"===n)o=function(t){const e=new d("error",{error:t,message:t.message});e[s]=this,r.call(this,e)};else{if("open"!==n)return;o=function(){const t=new l("open");t[s]=this,r.call(this,t)}}o[t]=!!i[t],o[e]=r,i.once?this.once(n,o):this.on(n,o)},removeEventListener(n,r){for(const i of this.listeners(n))if(i[e]===r&&!i[t]){this.removeListener(n,i);break}}};return PD={CloseEvent:h,ErrorEvent:d,Event:l,EventTarget:p,MessageEvent:f}}(),{format:M,parse:_}=oO(),{toBuffer:E}=AD(),N=Symbol("kAborted"),L=[8,13],S=["CONNECTING","OPEN","CLOSING","CLOSED"],A=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;class x extends t{constructor(t,e,n){super(),this._binaryType=h[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=d,this._closeTimer=null,this._extensions={},this._paused=!1,this._protocol="",this._readyState=x.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,null!==t?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,void 0===e?e=[]:Array.isArray(e)||("object"==typeof e&&null!==e?(n=e,e=[]):e=[e]),T(this,t,e,n)):this._isServer=!0}get binaryType(){return this._binaryType}set binaryType(t){h.includes(t)&&(this._binaryType=t,this._receiver&&(this._receiver._binaryType=t))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(t,e,n){const r=new c({binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:n.maxPayload,skipUTF8Validation:n.skipUTF8Validation});this._sender=new l(t,this._extensions,n.generateMask),this._receiver=r,this._socket=t,r[y]=this,t[y]=this,r.on("conclude",O),r.on("drain",z),r.on("error",P),r.on("message",B),r.on("ping",U),r.on("pong",F),t.setTimeout(0),t.setNoDelay(),e.length>0&&t.unshift(e),t.on("close",Y),t.on("data",Q),t.on("end",H),t.on("error",G),this._readyState=x.OPEN,this.emit("open")}emitClose(){if(!this._socket)return this._readyState=x.CLOSED,void this.emit("close",this._closeCode,this._closeMessage);this._extensions[u.extensionName]&&this._extensions[u.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=x.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(t,e){if(this.readyState!==x.CLOSED){if(this.readyState===x.CONNECTING){const t="WebSocket was closed before the connection was established";return C(this,this._req,t)}this.readyState!==x.CLOSING?(this._readyState=x.CLOSING,this._sender.close(t,e,!this._isServer,(t=>{t||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())})),this._closeTimer=setTimeout(this._socket.destroy.bind(this._socket),3e4)):this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end()}}pause(){this.readyState!==x.CONNECTING&&this.readyState!==x.CLOSED&&(this._paused=!0,this._socket.pause())}ping(t,e,n){if(this.readyState===x.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");"function"==typeof t?(n=t,t=e=void 0):"function"==typeof e&&(n=e,e=void 0),"number"==typeof t&&(t=t.toString()),this.readyState===x.OPEN?(void 0===e&&(e=!this._isServer),this._sender.ping(t||d,e,n)):D(this,t,n)}pong(t,e,n){if(this.readyState===x.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");"function"==typeof t?(n=t,t=e=void 0):"function"==typeof e&&(n=e,e=void 0),"number"==typeof t&&(t=t.toString()),this.readyState===x.OPEN?(void 0===e&&(e=!this._isServer),this._sender.pong(t||d,e,n)):D(this,t,n)}resume(){this.readyState!==x.CONNECTING&&this.readyState!==x.CLOSED&&(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(t,e,n){if(this.readyState===x.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if("function"==typeof e&&(n=e,e={}),"number"==typeof t&&(t=t.toString()),this.readyState!==x.OPEN)return void D(this,t,n);const r={binary:"string"!=typeof t,mask:!this._isServer,compress:!0,fin:!0,...e};this._extensions[u.extensionName]||(r.compress=!1),this._sender.send(t||d,r,n)}terminate(){if(this.readyState!==x.CLOSED){if(this.readyState===x.CONNECTING){const t="WebSocket was closed before the connection was established";return C(this,this._req,t)}this._socket&&(this._readyState=x.CLOSING,this._socket.destroy())}}}function T(t,r,i,c){const l={protocolVersion:L[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...c,createConnection:void 0,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(!L.includes(l.protocolVersion))throw new RangeError(`Unsupported protocol version: ${l.protocolVersion} (supported versions: ${L.join(", ")})`);let h;if(r instanceof s)h=r,t._url=r.href;else{try{h=new s(r)}catch(t){throw new SyntaxError(`Invalid URL: ${r}`)}t._url=r}const d="wss:"===h.protocol,p="ws+unix:"===h.protocol;let m;if("ws:"===h.protocol||d||p?p&&!h.pathname?m="The URL's pathname is empty":h.hash&&(m="The URL contains a fragment identifier"):m='The URL\'s protocol must be one of "ws:", "wss:", or "ws+unix:"',m){const e=new SyntaxError(m);if(0===t._redirects)throw e;return void I(t,e)}const g=d?443:80,y=o(16).toString("base64"),b=d?e.request:n.request,v=new Set;let w,E;if(l.createConnection=d?j:k,l.defaultPort=l.defaultPort||g,l.port=h.port||g,l.host=h.hostname.startsWith("[")?h.hostname.slice(1,-1):h.hostname,l.headers={"Sec-WebSocket-Version":l.protocolVersion,"Sec-WebSocket-Key":y,Connection:"Upgrade",Upgrade:"websocket",...l.headers},l.path=h.pathname+h.search,l.timeout=l.handshakeTimeout,l.perMessageDeflate&&(w=new u(!0!==l.perMessageDeflate?l.perMessageDeflate:{},!1,l.maxPayload),l.headers["Sec-WebSocket-Extensions"]=M({[u.extensionName]:w.offer()})),i.length){for(const t of i){if("string"!=typeof t||!A.test(t)||v.has(t))throw new SyntaxError("An invalid or duplicated subprotocol was specified");v.add(t)}l.headers["Sec-WebSocket-Protocol"]=i.join(",")}if(l.origin&&(l.protocolVersion<13?l.headers["Sec-WebSocket-Origin"]=l.origin:l.headers.Origin=l.origin),(h.username||h.password)&&(l.auth=`${h.username}:${h.password}`),p){const t=l.path.split(":");l.socketPath=t[0],l.path=t[1]}if(l.followRedirects){if(0===t._redirects){t._originalSecure=d,t._originalHost=h.host;const e=c&&c.headers;if(c={...c,headers:{}},e)for(const[t,n]of Object.entries(e))c.headers[t.toLowerCase()]=n}else if(0===t.listenerCount("redirect")){const e=h.host===t._originalHost;(!e||t._originalSecure&&!d)&&(delete l.headers.authorization,delete l.headers.cookie,e||delete l.headers.host,l.auth=void 0)}l.auth&&!c.headers.authorization&&(c.headers.authorization="Basic "+p_.from(l.auth).toString("base64")),E=t._req=b(l),t._redirects&&t.emit("redirect",t.url,E)}else E=t._req=b(l);l.timeout&&E.on("timeout",(()=>{C(t,E,"Opening handshake has timed out")})),E.on("error",(e=>{null===E||E[N]||(E=t._req=null,I(t,e))})),E.on("response",(e=>{const n=e.headers.location,o=e.statusCode;if(n&&l.followRedirects&&o>=300&&o<400){if(++t._redirects>l.maxRedirects)return void C(t,E,"Maximum redirects exceeded");let e;E.abort();try{e=new s(n,r)}catch(e){const r=new SyntaxError(`Invalid URL: ${n}`);return void I(t,r)}T(t,e,i,c)}else t.emit("unexpected-response",E,e)||C(t,E,`Unexpected server response: ${e.statusCode}`)})),E.on("upgrade",((e,n,r)=>{if(t.emit("upgrade",e),t.readyState!==x.CONNECTING)return;if(E=t._req=null,"websocket"!==e.headers.upgrade.toLowerCase())return void C(t,n,"Invalid Upgrade header");const i=a("sha1").update(y+f).digest("base64");if(e.headers["sec-websocket-accept"]!==i)return void C(t,n,"Invalid Sec-WebSocket-Accept header");const o=e.headers["sec-websocket-protocol"];let s;if(void 0!==o?v.size?v.has(o)||(s="Server sent an invalid subprotocol"):s="Server sent a subprotocol but none was requested":v.size&&(s="Server sent no subprotocol"),s)return void C(t,n,s);o&&(t._protocol=o);const c=e.headers["sec-websocket-extensions"];if(void 0!==c){if(!w){return void C(t,n,"Server sent a Sec-WebSocket-Extensions header but no extension was requested")}let e;try{e=_(c)}catch(e){return void C(t,n,"Invalid Sec-WebSocket-Extensions header")}const r=Object.keys(e);if(1!==r.length||r[0]!==u.extensionName){return void C(t,n,"Server indicated an extension that was not requested")}try{w.accept(e[u.extensionName])}catch(e){return void C(t,n,"Invalid Sec-WebSocket-Extensions header")}t._extensions[u.extensionName]=w}t.setSocket(n,r,{generateMask:l.generateMask,maxPayload:l.maxPayload,skipUTF8Validation:l.skipUTF8Validation})})),E.end()}function I(t,e){t._readyState=x.CLOSING,t.emit("error",e),t.emitClose()}function k(t){return t.path=t.socketPath,r.connect(t)}function j(t){return t.path=void 0,t.servername||""===t.servername||(t.servername=r.isIP(t.host)?"":t.host),i.connect(t)}function C(t,e,n){t._readyState=x.CLOSING;const r=new Error(n);Error.captureStackTrace(r,C),e.setHeader?(e[N]=!0,e.abort(),e.socket&&!e.socket.destroyed&&e.socket.destroy(),fS.nextTick(I,t,r)):(e.destroy(r),e.once("error",t.emit.bind(t,"error")),e.once("close",t.emitClose.bind(t)))}function D(t,e,n){if(e){const n=E(e).length;t._socket?t._sender._bufferedBytes+=n:t._bufferedAmount+=n}if(n){n(new Error(`WebSocket is not open: readyState ${t.readyState} (${S[t.readyState]})`))}}function O(t,e){const n=this[y];n._closeFrameReceived=!0,n._closeMessage=e,n._closeCode=t,void 0!==n._socket[y]&&(n._socket.removeListener("data",Q),fS.nextTick(W,n._socket),1005===t?n.close():n.close(t,e))}function z(){const t=this[y];t.isPaused||t._socket.resume()}function P(t){const e=this[y];void 0!==e._socket[y]&&(e._socket.removeListener("data",Q),fS.nextTick(W,e._socket),e.close(t[g])),e.emit("error",t)}function R(){this[y].emitClose()}function B(t,e){this[y].emit("message",t,e)}function U(t){const e=this[y];e.pong(t,!e._isServer,b),e.emit("ping",t)}function F(t){this[y].emit("pong",t)}function W(t){t.resume()}function Y(){const t=this[y];let e;this.removeListener("close",Y),this.removeListener("data",Q),this.removeListener("end",H),t._readyState=x.CLOSING,this._readableState.endEmitted||t._closeFrameReceived||t._receiver._writableState.errorEmitted||null===(e=t._socket.read())||t._receiver.write(e),t._receiver.end(),this[y]=void 0,clearTimeout(t._closeTimer),t._receiver._writableState.finished||t._receiver._writableState.errorEmitted?t.emitClose():(t._receiver.on("error",R),t._receiver.on("finish",R))}function Q(t){this[y]._receiver.write(t)||this.pause()}function H(){const t=this[y];t._readyState=x.CLOSING,t._receiver.end(),this.end()}function G(){const t=this[y];this.removeListener("error",G),this.on("error",b),t&&(t._readyState=x.CLOSING,this.destroy())}return Object.defineProperty(x,"CONNECTING",{enumerable:!0,value:S.indexOf("CONNECTING")}),Object.defineProperty(x.prototype,"CONNECTING",{enumerable:!0,value:S.indexOf("CONNECTING")}),Object.defineProperty(x,"OPEN",{enumerable:!0,value:S.indexOf("OPEN")}),Object.defineProperty(x.prototype,"OPEN",{enumerable:!0,value:S.indexOf("OPEN")}),Object.defineProperty(x,"CLOSING",{enumerable:!0,value:S.indexOf("CLOSING")}),Object.defineProperty(x.prototype,"CLOSING",{enumerable:!0,value:S.indexOf("CLOSING")}),Object.defineProperty(x,"CLOSED",{enumerable:!0,value:S.indexOf("CLOSED")}),Object.defineProperty(x.prototype,"CLOSED",{enumerable:!0,value:S.indexOf("CLOSED")}),["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach((t=>{Object.defineProperty(x.prototype,t,{enumerable:!0})})),["open","error","close","message"].forEach((t=>{Object.defineProperty(x.prototype,`on${t}`,{enumerable:!0,get(){for(const e of this.listeners(t))if(e[p])return e[m];return null},set(e){for(const e of this.listeners(t))if(e[p]){this.removeListener(t,e);break}"function"==typeof e&&this.addEventListener(t,e,{[p]:!0})}})})),x.prototype.addEventListener=v,x.prototype.removeEventListener=w,FD=x}function sO(){if(GD)return HD;GD=1;const{tokenChars:t}=nO();return HD={parse:function(e){const n=new Set;let r=-1,i=-1,o=0;for(;o<e.length;o++){const a=e.charCodeAt(o);if(-1===i&&1===t[a])-1===r&&(r=o);else if(0===o||32!==a&&9!==a){if(44!==a)throw new SyntaxError(`Unexpected character at index ${o}`);{if(-1===r)throw new SyntaxError(`Unexpected character at index ${o}`);-1===i&&(i=o);const t=e.slice(r,i);if(n.has(t))throw new SyntaxError(`The "${t}" subprotocol is duplicated`);n.add(t),r=i=-1}}else-1===i&&-1!==r&&(i=o)}if(-1===r||-1!==i)throw new SyntaxError("Unexpected end of input");const a=e.slice(r,o);if(n.has(a))throw new SyntaxError(`The "${a}" subprotocol is duplicated`);return n.add(a),n}},HD}function uO(){if(VD)return ZD;VD=1;const t=ES,e=sT,{createHash:n}=oE,r=oO(),i=xD(),o=sO(),a=aO(),{GUID:s,kWebSocket:u}=kC(),c=/^[+/0-9A-Za-z]{22}==$/,l=2;function h(t){t._state=l,t.emit("close")}function d(){this.destroy()}function f(t,n,r,i){r=r||e.STATUS_CODES[n],i={Connection:"close","Content-Type":"text/html","Content-Length":p_.byteLength(r),...i},t.once("finish",t.destroy),t.end(`HTTP/1.1 ${n} ${e.STATUS_CODES[n]}\r\n`+Object.keys(i).map((t=>`${t}: ${i[t]}`)).join("\r\n")+"\r\n\r\n"+r)}function p(t,e,n,r,i){if(t.listenerCount("wsClientError")){const r=new Error(i);Error.captureStackTrace(r,p),t.emit("wsClientError",r,n,e)}else f(n,r,i)}return ZD=class extends t{constructor(t,n){if(super(),null==(t={maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:a,...t}).port&&!t.server&&!t.noServer||null!=t.port&&(t.server||t.noServer)||t.server&&t.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(null!=t.port?(this._server=e.createServer(((t,n)=>{const r=e.STATUS_CODES[426];n.writeHead(426,{"Content-Length":r.length,"Content-Type":"text/plain"}),n.end(r)})),this._server.listen(t.port,t.host,t.backlog,n)):t.server&&(this._server=t.server),this._server){const t=this.emit.bind(this,"connection");this._removeListeners=function(t,e){for(const n of Object.keys(e))t.on(n,e[n]);return function(){for(const n of Object.keys(e))t.removeListener(n,e[n])}}(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(e,n,r)=>{this.handleUpgrade(e,n,r,t)}})}!0===t.perMessageDeflate&&(t.perMessageDeflate={}),t.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=t,this._state=0}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(t){if(this._state===l)return t&&this.once("close",(()=>{t(new Error("The server is not running"))})),void fS.nextTick(h,this);if(t&&this.once("close",t),1!==this._state)if(this._state=1,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients&&this.clients.size?this._shouldEmitClose=!0:fS.nextTick(h,this);else{const t=this._server;this._removeListeners(),this._removeListeners=this._server=null,t.close((()=>{h(this)}))}}shouldHandle(t){if(this.options.path){const e=t.url.indexOf("?");if((-1!==e?t.url.slice(0,e):t.url)!==this.options.path)return!1}return!0}handleUpgrade(t,e,n,a){e.on("error",d);const s=t.headers["sec-websocket-key"],u=+t.headers["sec-websocket-version"];if("GET"!==t.method){return void p(this,t,e,405,"Invalid HTTP method")}if("websocket"!==t.headers.upgrade.toLowerCase()){return void p(this,t,e,400,"Invalid Upgrade header")}if(!s||!c.test(s)){return void p(this,t,e,400,"Missing or invalid Sec-WebSocket-Key header")}if(8!==u&&13!==u){return void p(this,t,e,400,"Missing or invalid Sec-WebSocket-Version header")}if(!this.shouldHandle(t))return void f(e,400);const l=t.headers["sec-websocket-protocol"];let h=new Set;if(void 0!==l)try{h=o.parse(l)}catch(n){return void p(this,t,e,400,"Invalid Sec-WebSocket-Protocol header")}const m=t.headers["sec-websocket-extensions"],g={};if(this.options.perMessageDeflate&&void 0!==m){const n=new i(this.options.perMessageDeflate,!0,this.options.maxPayload);try{const t=r.parse(m);t[i.extensionName]&&(n.accept(t[i.extensionName]),g[i.extensionName]=n)}catch(n){return void p(this,t,e,400,"Invalid or unacceptable Sec-WebSocket-Extensions header")}}if(this.options.verifyClient){const r={origin:t.headers[""+(8===u?"sec-websocket-origin":"origin")],secure:!(!t.socket.authorized&&!t.socket.encrypted),req:t};if(2===this.options.verifyClient.length)return void this.options.verifyClient(r,((r,i,o,u)=>{if(!r)return f(e,i||401,o,u);this.completeUpgrade(g,s,h,t,e,n,a)}));if(!this.options.verifyClient(r))return f(e,401)}this.completeUpgrade(g,s,h,t,e,n,a)}completeUpgrade(t,e,o,a,c,l,p){if(!c.readable||!c.writable)return c.destroy();if(c[u])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>0)return f(c,503);const m=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${n("sha1").update(e+s).digest("base64")}`],g=new this.options.WebSocket(null);if(o.size){const t=this.options.handleProtocols?this.options.handleProtocols(o,a):o.values().next().value;t&&(m.push(`Sec-WebSocket-Protocol: ${t}`),g._protocol=t)}if(t[i.extensionName]){const e=t[i.extensionName].params,n=r.format({[i.extensionName]:[e]});m.push(`Sec-WebSocket-Extensions: ${n}`),g._extensions=t}this.emit("headers",m,a),c.write(m.concat("\r\n").join("\r\n")),c.removeListener("error",d),g.setSocket(c,l,{maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(g),g.on("close",(()=>{this.clients.delete(g),this._shouldEmitClose&&!this.clients.size&&fS.nextTick(h,this)}))),p(g,a)}},ZD}function cO(){if(JD)return qD;JD=1;const t=aO();return t.createWebSocketStream=function(){if(QD)return YD;QD=1;const{Duplex:t}=lT;function e(t){t.emit("close")}function n(){!this.destroyed&&this._writableState.finished&&this.destroy()}function r(t){this.removeListener("error",r),this.destroy(),0===this.listenerCount("error")&&this.emit("error",t)}return YD=function(i,o){let a=!0;const s=new t({...o,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return i.on("message",(function(t,e){const n=!e&&s._readableState.objectMode?t.toString():t;s.push(n)||i.pause()})),i.once("error",(function(t){s.destroyed||(a=!1,s.destroy(t))})),i.once("close",(function(){s.destroyed||s.push(null)})),s._destroy=function(t,n){if(i.readyState===i.CLOSED)return n(t),void fS.nextTick(e,s);let r=!1;i.once("error",(function(t){r=!0,n(t)})),i.once("close",(function(){r||n(t),fS.nextTick(e,s)})),a&&i.terminate()},s._final=function(t){i.readyState!==i.CONNECTING?null!==i._socket&&(i._socket._writableState.finished?(t(),s._readableState.endEmitted&&s.destroy()):(i._socket.once("finish",(function(){t()})),i.close())):i.once("open",(function(){s._final(t)}))},s._read=function(){i.isPaused&&i.resume()},s._write=function(t,e,n){i.readyState!==i.CONNECTING?i.send(t,n):i.once("open",(function(){s._write(t,e,n)}))},s.on("end",n),s.on("error",r),s},YD}(),t.Server=uO(),t.Receiver=rO(),t.Sender=iO(),t.WebSocket=t,t.WebSocketServer=t.Server,qD=t}var lO,hO,dO,fO={},pO={exports:{}};function mO(){return lO||(lO=1,function(t){var e=CL().default;function n(){
|
|
55
55
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
56
|
-
t.exports=n=function(){return r},t.exports.__esModule=!0,t.exports.default=t.exports;var r={},i=Object.prototype,o=i.hasOwnProperty,a="function"==typeof Symbol?Symbol:{},s=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function l(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,n){return t[e]=n}}function h(t,e,n,r){var i=e&&e.prototype instanceof p?e:p,o=Object.create(i.prototype),a=new S(r||[]);return o._invoke=function(t,e,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return x()}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var s=E(a,n);if(s){if(s===f)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=d(t,e,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===f)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}(t,n,a),o}function d(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}r.wrap=h;var f={};function p(){}function m(){}function g(){}var y={};l(y,s,(function(){return this}));var b=Object.getPrototypeOf,v=b&&b(b(A([])));v&&v!==i&&o.call(v,s)&&(y=v);var w=g.prototype=p.prototype=Object.create(y);function M(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,n){function r(i,a,s,u){var c=d(t[i],t,a);if("throw"!==c.type){var l=c.arg,h=l.value;return h&&"object"==e(h)&&o.call(h,"__await")?n.resolve(h.__await).then((function(t){r("next",t,s,u)}),(function(t){r("throw",t,s,u)})):n.resolve(h).then((function(t){l.value=t,s(l)}),(function(t){return r("throw",t,s,u)}))}u(c.arg)}var i;this._invoke=function(t,e){function o(){return new n((function(n,i){r(t,e,n,i)}))}return i=i?i.then(o,o):o()}}function E(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,E(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var r=d(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,f;var i=r.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function N(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(N,this),this.reset(!0)}function A(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,r=function e(){for(;++n<t.length;)if(o.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return r.next=r}}return{next:x}}function x(){return{value:void 0,done:!0}}return m.prototype=g,l(w,"constructor",g),l(g,"constructor",m),m.displayName=l(g,c,"GeneratorFunction"),r.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===m||"GeneratorFunction"===(e.displayName||e.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,g):(t.__proto__=g,l(t,c,"GeneratorFunction")),t.prototype=Object.create(w),t},r.awrap=function(t){return{__await:t}},M(_.prototype),l(_.prototype,u,(function(){return this})),r.AsyncIterator=_,r.async=function(t,e,n,i,o){void 0===o&&(o=Promise);var a=new _(h(t,e,n,i),o);return r.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},M(w),l(w,c,"Generator"),l(w,s,(function(){return this})),l(w,"toString",(function(){return"[object Generator]"})),r.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},r.values=A,S.prototype={constructor:S,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(L),!t)for(var e in this)"t"===e.charAt(0)&&o.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(n,r){return a.type="throw",a.arg=t,e.next=n,r&&(e.method="next",e.arg=void 0),!!r}for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=o.call(i,"catchLoc"),u=o.call(i,"finallyLoc");if(s&&u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&o.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,f):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),L(n),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;L(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:A(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},r}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}(pO)),pO.exports}function gO(){if(dO)return hO;dO=1;var t=mO()();hO=t;try{regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}return hO}var yO,bO={exports:{}};function vO(){return yO||(yO=1,function(t){function e(t,e,n,r,i,o,a){try{var s=t[o](a),u=s.value}catch(t){return void n(t)}s.done?e(u):Promise.resolve(u).then(r,i)}t.exports=function(t){return function(){var n=this,r=arguments;return new Promise((function(i,o){var a=t.apply(n,r);function s(t){e(a,i,o,s,u,"next",t)}function u(t){e(a,i,o,s,u,"throw",t)}s(void 0)}))}},t.exports.__esModule=!0,t.exports.default=t.exports}(bO)),bO.exports}var wO,MO,_O={exports:{}};function EO(){return wO||(wO=1,function(t){var e=Object.prototype.hasOwnProperty,n="~";function r(){}function i(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function o(t,e,r,o,a){if("function"!=typeof r)throw new TypeError("The listener must be a function");var s=new i(r,o||t,a),u=n?n+e:e;return t._events[u]?t._events[u].fn?t._events[u]=[t._events[u],s]:t._events[u].push(s):(t._events[u]=s,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new r:delete t._events[e]}function s(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),s.prototype.eventNames=function(){var t,r,i=[];if(0===this._eventsCount)return i;for(r in t=this._events)e.call(t,r)&&i.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(t)):i},s.prototype.listeners=function(t){var e=n?n+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,o=r.length,a=new Array(o);i<o;i++)a[i]=r[i].fn;return a},s.prototype.listenerCount=function(t){var e=n?n+t:t,r=this._events[e];return r?r.fn?1:r.length:0},s.prototype.emit=function(t,e,r,i,o,a){var s=n?n+t:t;if(!this._events[s])return!1;var u,c,l=this._events[s],h=arguments.length;if(l.fn){switch(l.once&&this.removeListener(t,l.fn,void 0,!0),h){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,e),!0;case 3:return l.fn.call(l.context,e,r),!0;case 4:return l.fn.call(l.context,e,r,i),!0;case 5:return l.fn.call(l.context,e,r,i,o),!0;case 6:return l.fn.call(l.context,e,r,i,o,a),!0}for(c=1,u=new Array(h-1);c<h;c++)u[c-1]=arguments[c];l.fn.apply(l.context,u)}else{var d,f=l.length;for(c=0;c<f;c++)switch(l[c].once&&this.removeListener(t,l[c].fn,void 0,!0),h){case 1:l[c].fn.call(l[c].context);break;case 2:l[c].fn.call(l[c].context,e);break;case 3:l[c].fn.call(l[c].context,e,r);break;case 4:l[c].fn.call(l[c].context,e,r,i);break;default:if(!u)for(d=1,u=new Array(h-1);d<h;d++)u[d-1]=arguments[d];l[c].fn.apply(l[c].context,u)}}return!0},s.prototype.on=function(t,e,n){return o(this,t,e,n,!1)},s.prototype.once=function(t,e,n){return o(this,t,e,n,!0)},s.prototype.removeListener=function(t,e,r,i){var o=n?n+t:t;if(!this._events[o])return this;if(!e)return a(this,o),this;var s=this._events[o];if(s.fn)s.fn!==e||i&&!s.once||r&&s.context!==r||a(this,o);else{for(var u=0,c=[],l=s.length;u<l;u++)(s[u].fn!==e||i&&!s[u].once||r&&s[u].context!==r)&&c.push(s[u]);c.length?this._events[o]=1===c.length?c[0]:c:a(this,o)}return this},s.prototype.removeAllListeners=function(t){var e;return t?(e=n?n+t:t,this._events[e]&&a(this,e)):(this._events=new r,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=n,s.EventEmitter=s,t.exports=s}(_O)),_O.exports}function NO(){return MO||(MO=1,function(t){var e=yL.exports;Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=e(gO()),r=e(vO()),i=e(CL()),o=e(EL()),a=e(wL()),s=e(TL()),u=e(RL()),c=e(FL()),l=EO();function h(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=(0,c.default)(t);if(e){var i=(0,c.default)(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return(0,u.default)(this,n)}}var d=function(t){(0,s.default)(f,t);var e,u,c,l,d=h(f);function f(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"ws://localhost:8080",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;(0,o.default)(this,f);var a=r.autoconnect,s=void 0===a||a,u=r.reconnect,c=void 0===u||u,l=r.reconnect_interval,h=void 0===l?1e3:l,p=r.max_reconnects,m=void 0===p?5:p,g=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}(r,["autoconnect","reconnect","reconnect_interval","max_reconnects"]);return(e=d.call(this)).webSocketFactory=t,e.queue={},e.rpc_id=0,e.address=n,e.autoconnect=s,e.ready=!1,e.reconnect=c,e.reconnect_interval=h,e.max_reconnects=m,e.rest_options=g,e.current_reconnects=0,e.generate_request_id=i||function(){return++e.rpc_id},e.autoconnect&&e._connect(e.address,Object.assign({autoconnect:e.autoconnect,reconnect:e.reconnect,reconnect_interval:e.reconnect_interval,max_reconnects:e.max_reconnects},e.rest_options)),e}return(0,a.default)(f,[{key:"connect",value:function(){this.socket||this._connect(this.address,Object.assign({autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects},this.rest_options))}},{key:"call",value:function(t,e,n,r){var o=this;return r||"object"!==(0,i.default)(n)||(r=n,n=null),new Promise((function(i,a){if(!o.ready)return a(new Error("socket not ready"));var s=o.generate_request_id(t,e),u={jsonrpc:"2.0",method:t,params:e||null,id:s};o.socket.send(JSON.stringify(u),r,(function(t){if(t)return a(t);o.queue[s]={promise:[i,a]},n&&(o.queue[s].timeout=setTimeout((function(){delete o.queue[s],a(new Error("reply timeout"))}),n))}))}))}},{key:"login",value:(l=(0,r.default)(n.default.mark((function t(e){var r;return n.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.call("rpc.login",e);case 2:if(r=t.sent){t.next=5;break}throw new Error("authentication failed");case 5:return t.abrupt("return",r);case 6:case"end":return t.stop()}}),t,this)}))),function(t){return l.apply(this,arguments)})},{key:"listMethods",value:(c=(0,r.default)(n.default.mark((function t(){return n.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.call("__listMethods");case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)}))),function(){return c.apply(this,arguments)})},{key:"notify",value:function(t,e){var n=this;return new Promise((function(r,i){if(!n.ready)return i(new Error("socket not ready"));var o={jsonrpc:"2.0",method:t,params:e||null};n.socket.send(JSON.stringify(o),(function(t){if(t)return i(t);r()}))}))}},{key:"subscribe",value:(u=(0,r.default)(n.default.mark((function t(e){var r;return n.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return"string"==typeof e&&(e=[e]),t.next=3,this.call("rpc.on",e);case 3:if(r=t.sent,"string"!=typeof e||"ok"===r[e]){t.next=6;break}throw new Error("Failed subscribing to an event '"+e+"' with: "+r[e]);case 6:return t.abrupt("return",r);case 7:case"end":return t.stop()}}),t,this)}))),function(t){return u.apply(this,arguments)})},{key:"unsubscribe",value:(e=(0,r.default)(n.default.mark((function t(e){var r;return n.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return"string"==typeof e&&(e=[e]),t.next=3,this.call("rpc.off",e);case 3:if(r=t.sent,"string"!=typeof e||"ok"===r[e]){t.next=6;break}throw new Error("Failed unsubscribing from an event with: "+r);case 6:return t.abrupt("return",r);case 7:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})},{key:"close",value:function(t,e){this.socket.close(t||1e3,e)}},{key:"_connect",value:function(t,e){var n=this;this.socket=this.webSocketFactory(t,e),this.socket.addEventListener("open",(function(){n.ready=!0,n.emit("open"),n.current_reconnects=0})),this.socket.addEventListener("message",(function(t){var e=t.data;e instanceof ArrayBuffer&&(e=p_.from(e).toString());try{e=JSON.parse(e)}catch(t){return}if(e.notification&&n.listeners(e.notification).length){if(!Object.keys(e.params).length)return n.emit(e.notification);var r=[e.notification];if(e.params.constructor===Object)r.push(e.params);else for(var i=0;i<e.params.length;i++)r.push(e.params[i]);return Promise.resolve().then((function(){n.emit.apply(n,r)}))}if(!n.queue[e.id])return e.method&&e.params?Promise.resolve().then((function(){n.emit(e.method,e.params)})):void 0;"error"in e=="result"in e&&n.queue[e.id].promise[1](new Error('Server response malformed. Response must include either "result" or "error", but not both.')),n.queue[e.id].timeout&&clearTimeout(n.queue[e.id].timeout),e.error?n.queue[e.id].promise[1](e.error):n.queue[e.id].promise[0](e.result),delete n.queue[e.id]})),this.socket.addEventListener("error",(function(t){return n.emit("error",t)})),this.socket.addEventListener("close",(function(r){var i=r.code,o=r.reason;n.ready&&setTimeout((function(){return n.emit("close",i,o)}),0),n.ready=!1,n.socket=void 0,1e3!==i&&(n.current_reconnects++,n.reconnect&&(n.max_reconnects>n.current_reconnects||0===n.max_reconnects)&&setTimeout((function(){return n._connect(t,e)}),n.reconnect_interval))}))}}]),f}(l.EventEmitter);t.default=d}(fO)),fO}var LO,SO={},AO={exports:{}};var xO,TO,IO={exports:{}},kO={exports:{}},jO={exports:{}};function CO(){return xO||(xO=1,function(t){t.exports=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r},t.exports.__esModule=!0,t.exports.default=t.exports}(jO)),jO.exports}function DO(){return TO||(TO=1,function(t){var e=CO();t.exports=function(t){if(Array.isArray(t))return e(t)},t.exports.__esModule=!0,t.exports.default=t.exports}(kO)),kO.exports}var OO,zO={exports:{}};function PO(){return OO||(OO=1,function(t){t.exports=function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)},t.exports.__esModule=!0,t.exports.default=t.exports}(zO)),zO.exports}var RO,BO={exports:{}};function UO(){return RO||(RO=1,function(t){var e=CO();t.exports=function(t,n){if(t){if("string"==typeof t)return e(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?e(t,n):void 0}},t.exports.__esModule=!0,t.exports.default=t.exports}(BO)),BO.exports}var FO,WO,YO,QO={exports:{}};function HO(){return FO||(FO=1,function(t){t.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},t.exports.__esModule=!0,t.exports.default=t.exports}(QO)),QO.exports}var GO=new Uint8Array(16);function ZO(){if(!YO&&!(YO="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return YO(GO)}var VO=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function qO(t){return"string"==typeof t&&VO.test(t)}for(var JO,KO,XO=[],$O=0;$O<256;++$O)XO.push(($O+256).toString(16).substr(1));function tz(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(XO[t[e+0]]+XO[t[e+1]]+XO[t[e+2]]+XO[t[e+3]]+"-"+XO[t[e+4]]+XO[t[e+5]]+"-"+XO[t[e+6]]+XO[t[e+7]]+"-"+XO[t[e+8]]+XO[t[e+9]]+"-"+XO[t[e+10]]+XO[t[e+11]]+XO[t[e+12]]+XO[t[e+13]]+XO[t[e+14]]+XO[t[e+15]]).toLowerCase();if(!qO(n))throw TypeError("Stringified UUID is invalid");return n}var ez=0,nz=0;function rz(t){if(!qO(t))throw TypeError("Invalid UUID");var e,n=new Uint8Array(16);return n[0]=(e=parseInt(t.slice(0,8),16))>>>24,n[1]=e>>>16&255,n[2]=e>>>8&255,n[3]=255&e,n[4]=(e=parseInt(t.slice(9,13),16))>>>8,n[5]=255&e,n[6]=(e=parseInt(t.slice(14,18),16))>>>8,n[7]=255&e,n[8]=(e=parseInt(t.slice(19,23),16))>>>8,n[9]=255&e,n[10]=(e=parseInt(t.slice(24,36),16))/1099511627776&255,n[11]=e/4294967296&255,n[12]=e>>>24&255,n[13]=e>>>16&255,n[14]=e>>>8&255,n[15]=255&e,n}var iz="6ba7b810-9dad-11d1-80b4-00c04fd430c8",oz="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function az(t,e,n){function r(t,r,i,o){if("string"==typeof t&&(t=function(t){t=unescape(encodeURIComponent(t));for(var e=[],n=0;n<t.length;++n)e.push(t.charCodeAt(n));return e}(t)),"string"==typeof r&&(r=rz(r)),16!==r.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var a=new Uint8Array(16+t.length);if(a.set(r),a.set(t,r.length),(a=n(a))[6]=15&a[6]|e,a[8]=63&a[8]|128,i){o=o||0;for(var s=0;s<16;++s)i[o+s]=a[s];return i}return tz(a)}try{r.name=t}catch(t){}return r.DNS=iz,r.URL=oz,r}function sz(t){return 14+(t+64>>>9<<4)+1}function uz(t,e){var n=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(n>>16)<<16|65535&n}function cz(t,e,n,r,i,o){return uz((a=uz(uz(e,t),uz(r,o)))<<(s=i)|a>>>32-s,n);var a,s}function lz(t,e,n,r,i,o,a){return cz(e&n|~e&r,t,e,i,o,a)}function hz(t,e,n,r,i,o,a){return cz(e&r|n&~r,t,e,i,o,a)}function dz(t,e,n,r,i,o,a){return cz(e^n^r,t,e,i,o,a)}function fz(t,e,n,r,i,o,a){return cz(n^(e|~r),t,e,i,o,a)}var pz=az("v3",48,(function(t){if("string"==typeof t){var e=unescape(encodeURIComponent(t));t=new Uint8Array(e.length);for(var n=0;n<e.length;++n)t[n]=e.charCodeAt(n)}return function(t){for(var e=[],n=32*t.length,r="0123456789abcdef",i=0;i<n;i+=8){var o=t[i>>5]>>>i%32&255,a=parseInt(r.charAt(o>>>4&15)+r.charAt(15&o),16);e.push(a)}return e}(function(t,e){t[e>>5]|=128<<e%32,t[sz(e)-1]=e;for(var n=1732584193,r=-271733879,i=-1732584194,o=271733878,a=0;a<t.length;a+=16){var s=n,u=r,c=i,l=o;n=lz(n,r,i,o,t[a],7,-680876936),o=lz(o,n,r,i,t[a+1],12,-389564586),i=lz(i,o,n,r,t[a+2],17,606105819),r=lz(r,i,o,n,t[a+3],22,-1044525330),n=lz(n,r,i,o,t[a+4],7,-176418897),o=lz(o,n,r,i,t[a+5],12,1200080426),i=lz(i,o,n,r,t[a+6],17,-1473231341),r=lz(r,i,o,n,t[a+7],22,-45705983),n=lz(n,r,i,o,t[a+8],7,1770035416),o=lz(o,n,r,i,t[a+9],12,-1958414417),i=lz(i,o,n,r,t[a+10],17,-42063),r=lz(r,i,o,n,t[a+11],22,-1990404162),n=lz(n,r,i,o,t[a+12],7,1804603682),o=lz(o,n,r,i,t[a+13],12,-40341101),i=lz(i,o,n,r,t[a+14],17,-1502002290),n=hz(n,r=lz(r,i,o,n,t[a+15],22,1236535329),i,o,t[a+1],5,-165796510),o=hz(o,n,r,i,t[a+6],9,-1069501632),i=hz(i,o,n,r,t[a+11],14,643717713),r=hz(r,i,o,n,t[a],20,-373897302),n=hz(n,r,i,o,t[a+5],5,-701558691),o=hz(o,n,r,i,t[a+10],9,38016083),i=hz(i,o,n,r,t[a+15],14,-660478335),r=hz(r,i,o,n,t[a+4],20,-405537848),n=hz(n,r,i,o,t[a+9],5,568446438),o=hz(o,n,r,i,t[a+14],9,-1019803690),i=hz(i,o,n,r,t[a+3],14,-187363961),r=hz(r,i,o,n,t[a+8],20,1163531501),n=hz(n,r,i,o,t[a+13],5,-1444681467),o=hz(o,n,r,i,t[a+2],9,-51403784),i=hz(i,o,n,r,t[a+7],14,1735328473),n=dz(n,r=hz(r,i,o,n,t[a+12],20,-1926607734),i,o,t[a+5],4,-378558),o=dz(o,n,r,i,t[a+8],11,-2022574463),i=dz(i,o,n,r,t[a+11],16,1839030562),r=dz(r,i,o,n,t[a+14],23,-35309556),n=dz(n,r,i,o,t[a+1],4,-1530992060),o=dz(o,n,r,i,t[a+4],11,1272893353),i=dz(i,o,n,r,t[a+7],16,-155497632),r=dz(r,i,o,n,t[a+10],23,-1094730640),n=dz(n,r,i,o,t[a+13],4,681279174),o=dz(o,n,r,i,t[a],11,-358537222),i=dz(i,o,n,r,t[a+3],16,-722521979),r=dz(r,i,o,n,t[a+6],23,76029189),n=dz(n,r,i,o,t[a+9],4,-640364487),o=dz(o,n,r,i,t[a+12],11,-421815835),i=dz(i,o,n,r,t[a+15],16,530742520),n=fz(n,r=dz(r,i,o,n,t[a+2],23,-995338651),i,o,t[a],6,-198630844),o=fz(o,n,r,i,t[a+7],10,1126891415),i=fz(i,o,n,r,t[a+14],15,-1416354905),r=fz(r,i,o,n,t[a+5],21,-57434055),n=fz(n,r,i,o,t[a+12],6,1700485571),o=fz(o,n,r,i,t[a+3],10,-1894986606),i=fz(i,o,n,r,t[a+10],15,-1051523),r=fz(r,i,o,n,t[a+1],21,-2054922799),n=fz(n,r,i,o,t[a+8],6,1873313359),o=fz(o,n,r,i,t[a+15],10,-30611744),i=fz(i,o,n,r,t[a+6],15,-1560198380),r=fz(r,i,o,n,t[a+13],21,1309151649),n=fz(n,r,i,o,t[a+4],6,-145523070),o=fz(o,n,r,i,t[a+11],10,-1120210379),i=fz(i,o,n,r,t[a+2],15,718787259),r=fz(r,i,o,n,t[a+9],21,-343485551),n=uz(n,s),r=uz(r,u),i=uz(i,c),o=uz(o,l)}return[n,r,i,o]}(function(t){if(0===t.length)return[];for(var e=8*t.length,n=new Uint32Array(sz(e)),r=0;r<e;r+=8)n[r>>5]|=(255&t[r/8])<<r%32;return n}(t),8*t.length))})),mz=pz;function gz(t,e,n,r){switch(t){case 0:return e&n^~e&r;case 1:case 3:return e^n^r;case 2:return e&n^e&r^n&r}}function yz(t,e){return t<<e|t>>>32-e}var bz=az("v5",80,(function(t){var e=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof t){var r=unescape(encodeURIComponent(t));t=[];for(var i=0;i<r.length;++i)t.push(r.charCodeAt(i))}else Array.isArray(t)||(t=Array.prototype.slice.call(t));t.push(128);for(var o=t.length/4+2,a=Math.ceil(o/16),s=new Array(a),u=0;u<a;++u){for(var c=new Uint32Array(16),l=0;l<16;++l)c[l]=t[64*u+4*l]<<24|t[64*u+4*l+1]<<16|t[64*u+4*l+2]<<8|t[64*u+4*l+3];s[u]=c}s[a-1][14]=8*(t.length-1)/Math.pow(2,32),s[a-1][14]=Math.floor(s[a-1][14]),s[a-1][15]=8*(t.length-1)&4294967295;for(var h=0;h<a;++h){for(var d=new Uint32Array(80),f=0;f<16;++f)d[f]=s[h][f];for(var p=16;p<80;++p)d[p]=yz(d[p-3]^d[p-8]^d[p-14]^d[p-16],1);for(var m=n[0],g=n[1],y=n[2],b=n[3],v=n[4],w=0;w<80;++w){var M=Math.floor(w/20),_=yz(m,5)+gz(M,g,y,b)+v+e[M]+d[w]>>>0;v=b,b=y,y=yz(g,30)>>>0,g=m,m=_}n[0]=n[0]+m>>>0,n[1]=n[1]+g>>>0,n[2]=n[2]+y>>>0,n[3]=n[3]+b>>>0,n[4]=n[4]+v>>>0}return[n[0]>>24&255,n[0]>>16&255,n[0]>>8&255,255&n[0],n[1]>>24&255,n[1]>>16&255,n[1]>>8&255,255&n[1],n[2]>>24&255,n[2]>>16&255,n[2]>>8&255,255&n[2],n[3]>>24&255,n[3]>>16&255,n[3]>>8&255,255&n[3],n[4]>>24&255,n[4]>>16&255,n[4]>>8&255,255&n[4]]})),vz=bz;var wz,Mz,_z=Object.freeze({__proto__:null,v1:function(t,e,n){var r=e&&n||0,i=e||new Array(16),o=(t=t||{}).node||JO,a=void 0!==t.clockseq?t.clockseq:KO;if(null==o||null==a){var s=t.random||(t.rng||ZO)();null==o&&(o=JO=[1|s[0],s[1],s[2],s[3],s[4],s[5]]),null==a&&(a=KO=16383&(s[6]<<8|s[7]))}var u=void 0!==t.msecs?t.msecs:Date.now(),c=void 0!==t.nsecs?t.nsecs:nz+1,l=u-ez+(c-nz)/1e4;if(l<0&&void 0===t.clockseq&&(a=a+1&16383),(l<0||u>ez)&&void 0===t.nsecs&&(c=0),c>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");ez=u,nz=c,KO=a;var h=(1e4*(268435455&(u+=122192928e5))+c)%4294967296;i[r++]=h>>>24&255,i[r++]=h>>>16&255,i[r++]=h>>>8&255,i[r++]=255&h;var d=u/4294967296*1e4&268435455;i[r++]=d>>>8&255,i[r++]=255&d,i[r++]=d>>>24&15|16,i[r++]=d>>>16&255,i[r++]=a>>>8|128,i[r++]=255&a;for(var f=0;f<6;++f)i[r+f]=o[f];return e||tz(i)},v3:mz,v4:function(t,e,n){var r=(t=t||{}).random||(t.rng||ZO)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,e){n=n||0;for(var i=0;i<16;++i)e[n+i]=r[i];return e}return tz(r)},v5:vz,NIL:"00000000-0000-0000-0000-000000000000",version:function(t){if(!qO(t))throw TypeError("Invalid UUID");return parseInt(t.substr(14,1),16)},validate:qO,stringify:tz,parse:rz}),Ez=XM(_z),Nz={};function Lz(){return Mz||(Mz=1,function(t){var e=yL.exports,n=CL();Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=e(gO()),i=e(CL()),o=e(vO()),a=e((LO||(LO=1,function(t){t.exports=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t},t.exports.__esModule=!0,t.exports.default=t.exports}(AO)),AO.exports)),s=e((WO||(WO=1,function(t){var e=DO(),n=PO(),r=UO(),i=HO();t.exports=function(t){return e(t)||n(t)||r(t)||i()},t.exports.__esModule=!0,t.exports.default=t.exports}(IO)),IO.exports)),u=e(EL()),c=e(wL()),l=e(TL()),h=e(RL()),d=e(FL()),f=EO(),p=cO(),m=Ez,g=e(hT),y=function(t,e){if(!e&&t&&t.__esModule)return t;if(null===t||"object"!==n(t)&&"function"!=typeof t)return{default:t};var r=b(e);if(r&&r.has(t))return r.get(t);var i={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in t)if("default"!==a&&Object.prototype.hasOwnProperty.call(t,a)){var s=o?Object.getOwnPropertyDescriptor(t,a):null;s&&(s.get||s.set)?Object.defineProperty(i,a,s):i[a]=t[a]}i.default=t,r&&r.set(t,i);return i}(function(){if(wz)return Nz;wz=1,Object.defineProperty(Nz,"__esModule",{value:!0}),Nz.createError=function(e,n){var r={code:e,message:t.get(e)||"Internal Server Error"};return n&&(r.data=n),r};var t=new Map([[-32e3,"Event not provided"],[-32600,"Invalid Request"],[-32601,"Method not found"],[-32602,"Invalid params"],[-32603,"Internal error"],[-32604,"Params not found"],[-32605,"Method forbidden"],[-32606,"Event forbidden"],[-32700,"Parse error"]]);return Nz}());function b(t){if("function"!=typeof WeakMap)return null;var e=new WeakMap,n=new WeakMap;return(b=function(t){return t?n:e})(t)}function v(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return w(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return w(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function w(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function M(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=(0,d.default)(t);if(e){var i=(0,d.default)(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return(0,h.default)(this,n)}}var _=function(t){(0,l.default)(h,t);var e,n=M(h);function h(t){var e;return(0,u.default)(this,h),(e=n.call(this)).namespaces={},e.wss=new p.Server(t),e.wss.on("listening",(function(){return e.emit("listening")})),e.wss.on("connection",(function(t,n){var r=g.default.parse(n.url,!0),i=r.pathname;return r.query.socket_id?t._id=r.query.socket_id:t._id=(0,m.v1)(),t._authenticated=!1,t.on("error",(function(n){return e.emit("socket-error",t,n)})),t.on("close",(function(){e.namespaces[i].clients.delete(t._id);for(var n=0,r=Object.keys(e.namespaces[i].events);n<r.length;n++){var o=r[n],a=e.namespaces[i].events[o].sockets.indexOf(t._id);a>=0&&e.namespaces[i].events[o].sockets.splice(a,1)}e.emit("disconnection",t)})),e.namespaces[i]||e._generateNamespace(i),e.namespaces[i].clients.set(t._id,t),e.emit("connection",t,n),e._handleRPC(t,i)})),e.wss.on("error",(function(t){return e.emit("error",t)})),e}return(0,c.default)(h,[{key:"register",value:function(t,e){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"/";return this.namespaces[r]||this._generateNamespace(r),this.namespaces[r].rpc_methods[t]={fn:e,protected:!1},{protected:function(){return n._makeProtectedMethod(t,r)},public:function(){return n._makePublicMethod(t,r)}}}},{key:"setAuth",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/";this.register("rpc.login",t,e)}},{key:"_makeProtectedMethod",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/";this.namespaces[e].rpc_methods[t].protected=!0}},{key:"_makePublicMethod",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/";this.namespaces[e].rpc_methods[t].protected=!1}},{key:"_makeProtectedEvent",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/";this.namespaces[e].events[t].protected=!0}},{key:"_makePublicEvent",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/";this.namespaces[e].events[t].protected=!1}},{key:"closeNamespace",value:function(t){var e=this.namespaces[t];if(e){delete e.rpc_methods,delete e.events;var n,r=v(e.clients.values());try{for(r.s();!(n=r.n()).done;){n.value.close()}}catch(t){r.e(t)}finally{r.f()}delete this.namespaces[t]}}},{key:"event",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/";if(this.namespaces[n]){if(void 0!==this.namespaces[n].events[t])throw new Error("Already registered event ".concat(n).concat(t))}else this._generateNamespace(n);return this.namespaces[n].events[t]={sockets:[],protected:!1},this.on(t,(function(){for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];1===i.length&&i[0]instanceof Object&&(i=i[0]);var a,s=v(e.namespaces[n].events[t].sockets);try{for(s.s();!(a=s.n()).done;){var u=a.value,c=e.namespaces[n].clients.get(u);c&&c.send(JSON.stringify({notification:t,params:i||null}))}}catch(t){s.e(t)}finally{s.f()}})),{protected:function(){return e._makeProtectedEvent(t,n)},public:function(){return e._makePublicEvent(t,n)}}}},{key:"of",value:function(t){this.namespaces[t]||this._generateNamespace(t);var e=this;return{register:function(n,r){if(2!==arguments.length)throw new Error("must provide exactly two arguments");if("string"!=typeof n)throw new Error("name must be a string");if("function"!=typeof r)throw new Error("handler must be a function");return e.register(n,r,t)},event:function(n){if(1!==arguments.length)throw new Error("must provide exactly one argument");if("string"!=typeof n)throw new Error("name must be a string");return e.event(n,t)},get eventList(){return Object.keys(e.namespaces[t].events)},emit:function(n){for(var r=(0,s.default)(e.namespaces[t].clients.keys()),i=arguments.length,o=new Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];for(var u,c=0;u=r[c];++c)e.namespaces[t].clients.get(u).send(JSON.stringify({notification:n,params:o||[]}))},get name(){return t},connected:function(){return(0,s.default)(e.namespaces[t].clients.keys()).reduce((function(n,r){return Object.assign(Object.assign({},n),(0,a.default)({},r,e.namespaces[t].clients.get(r)))}),{})},clients:function(){return e.namespaces[t]}}}},{key:"eventList",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/";return this.namespaces[t]?Object.keys(this.namespaces[t].events):[]}},{key:"createError",value:function(t,e,n){return{code:t,message:e,data:n||null}}},{key:"close",value:function(){var t=this;return new Promise((function(e,n){try{t.wss.close(),t.emit("close"),e()}catch(t){n(t)}}))}},{key:"_handleRPC",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/";t.on("message",function(){var i=(0,o.default)(r.default.mark((function i(o){var a,s,u,c,l,h,d,f;return r.default.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(a={},o instanceof ArrayBuffer&&(a.binary=!0,o=p_.from(o).toString()),1===t.readyState){r.next=4;break}return r.abrupt("return");case 4:r.prev=4,s=JSON.parse(o),r.next=11;break;case 8:return r.prev=8,r.t0=r.catch(4),r.abrupt("return",t.send(JSON.stringify({jsonrpc:"2.0",error:y.createError(-32700,r.t0.toString()),id:null}),a));case 11:if(!Array.isArray(s)){r.next=39;break}if(s.length){r.next=14;break}return r.abrupt("return",t.send(JSON.stringify({jsonrpc:"2.0",error:y.createError(-32600,"Invalid array"),id:null}),a));case 14:u=[],c=v(s),r.prev=16,c.s();case 18:if((l=c.n()).done){r.next=28;break}return h=l.value,r.next=22,e._runMethod(h,t._id,n);case 22:if(d=r.sent){r.next=25;break}return r.abrupt("continue",26);case 25:u.push(d);case 26:r.next=18;break;case 28:r.next=33;break;case 30:r.prev=30,r.t1=r.catch(16),c.e(r.t1);case 33:return r.prev=33,c.f(),r.finish(33);case 36:if(u.length){r.next=38;break}return r.abrupt("return");case 38:return r.abrupt("return",t.send(JSON.stringify(u),a));case 39:return r.next=41,e._runMethod(s,t._id,n);case 41:if(f=r.sent){r.next=44;break}return r.abrupt("return");case 44:return r.abrupt("return",t.send(JSON.stringify(f),a));case 45:case"end":return r.stop()}}),i,null,[[4,8],[16,30,33,36]])})));return function(t){return i.apply(this,arguments)}}())}},{key:"_runMethod",value:(e=(0,o.default)(r.default.mark((function t(e,n){var o,a,s,u,c,l,h,d,f,p,m,g,b,w,M,_=arguments;return r.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(o=_.length>2&&void 0!==_[2]?_[2]:"/","object"===(0,i.default)(e)&&null!==e){t.next=3;break}return t.abrupt("return",{jsonrpc:"2.0",error:y.createError(-32600),id:null});case 3:if("2.0"===e.jsonrpc){t.next=5;break}return t.abrupt("return",{jsonrpc:"2.0",error:y.createError(-32600,"Invalid JSON RPC version"),id:e.id||null});case 5:if(e.method){t.next=7;break}return t.abrupt("return",{jsonrpc:"2.0",error:y.createError(-32602,"Method not specified"),id:e.id||null});case 7:if("string"==typeof e.method){t.next=9;break}return t.abrupt("return",{jsonrpc:"2.0",error:y.createError(-32600,"Invalid method name"),id:e.id||null});case 9:if(!e.params||"string"!=typeof e.params){t.next=11;break}return t.abrupt("return",{jsonrpc:"2.0",error:y.createError(-32600),id:e.id||null});case 11:if("rpc.on"!==e.method){t.next=47;break}if(e.params){t.next=14;break}return t.abrupt("return",{jsonrpc:"2.0",error:y.createError(-32e3),id:e.id||null});case 14:a={},s=Object.keys(this.namespaces[o].events),u=v(e.params),t.prev=17,u.s();case 19:if((c=u.n()).done){t.next=36;break}if(l=c.value,h=s.indexOf(l),d=this.namespaces[o],-1!==h){t.next=26;break}return a[l]="provided event invalid",t.abrupt("continue",34);case 26:if(!0!==d.events[s[h]].protected||!1!==d.clients.get(n)._authenticated){t.next=28;break}return t.abrupt("return",{jsonrpc:"2.0",error:y.createError(-32606),id:e.id||null});case 28:if(!(d.events[s[h]].sockets.indexOf(n)>=0)){t.next=32;break}return a[l]="socket has already been subscribed to event",t.abrupt("continue",34);case 32:d.events[s[h]].sockets.push(n),a[l]="ok";case 34:t.next=19;break;case 36:t.next=41;break;case 38:t.prev=38,t.t0=t.catch(17),u.e(t.t0);case 41:return t.prev=41,u.f(),t.finish(41);case 44:return t.abrupt("return",{jsonrpc:"2.0",result:a,id:e.id||null});case 47:if("rpc.off"!==e.method){t.next=78;break}if(e.params){t.next=50;break}return t.abrupt("return",{jsonrpc:"2.0",error:y.createError(-32e3),id:e.id||null});case 50:f={},p=v(e.params),t.prev=52,p.s();case 54:if((m=p.n()).done){t.next=67;break}if(g=m.value,this.namespaces[o].events[g]){t.next=59;break}return f[g]="provided event invalid",t.abrupt("continue",65);case 59:if(-1!==(b=this.namespaces[o].events[g].sockets.indexOf(n))){t.next=63;break}return f[g]="not subscribed",t.abrupt("continue",65);case 63:this.namespaces[o].events[g].sockets.splice(b,1),f[g]="ok";case 65:t.next=54;break;case 67:t.next=72;break;case 69:t.prev=69,t.t1=t.catch(52),p.e(t.t1);case 72:return t.prev=72,p.f(),t.finish(72);case 75:return t.abrupt("return",{jsonrpc:"2.0",result:f,id:e.id||null});case 78:if("rpc.login"!==e.method){t.next=81;break}if(e.params){t.next=81;break}return t.abrupt("return",{jsonrpc:"2.0",error:y.createError(-32604),id:e.id||null});case 81:if(this.namespaces[o].rpc_methods[e.method]){t.next=83;break}return t.abrupt("return",{jsonrpc:"2.0",error:y.createError(-32601),id:e.id||null});case 83:if(w=null,!0!==this.namespaces[o].rpc_methods[e.method].protected||!1!==this.namespaces[o].clients.get(n)._authenticated){t.next=86;break}return t.abrupt("return",{jsonrpc:"2.0",error:y.createError(-32605),id:e.id||null});case 86:return t.prev=86,t.next=89,this.namespaces[o].rpc_methods[e.method].fn(e.params,n);case 89:w=t.sent,t.next=99;break;case 92:if(t.prev=92,t.t2=t.catch(86),e.id){t.next=96;break}return t.abrupt("return");case 96:if(!(t.t2 instanceof Error)){t.next=98;break}return t.abrupt("return",{jsonrpc:"2.0",error:{code:-32e3,message:t.t2.name,data:t.t2.message},id:e.id});case 98:return t.abrupt("return",{jsonrpc:"2.0",error:t.t2,id:e.id});case 99:if(e.id){t.next=101;break}return t.abrupt("return");case 101:return"rpc.login"===e.method&&!0===w&&((M=this.namespaces[o].clients.get(n))._authenticated=!0,this.namespaces[o].clients.set(n,M)),t.abrupt("return",{jsonrpc:"2.0",result:w,id:e.id});case 103:case"end":return t.stop()}}),t,this,[[17,38,41,44],[52,69,72,75],[86,92]])}))),function(t,n){return e.apply(this,arguments)})},{key:"_generateNamespace",value:function(t){var e=this;this.namespaces[t]={rpc_methods:{__listMethods:{fn:function(){return Object.keys(e.namespaces[t].rpc_methods)},protected:!1}},clients:new Map,events:{}}}}]),h}(f.EventEmitter);t.default=_}(SO)),SO}!function(t){var e=yL.exports;Object.defineProperty(t,"__esModule",{value:!0}),t.Client=void 0,Object.defineProperty(t,"Server",{enumerable:!0,get:function(){return c.default}});var n=e(wL()),r=e(EL()),i=e(TL()),o=e(RL()),a=e(FL()),s=e((KD||(KD=1,function(t){var e=yL.exports;Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(t,e){return new n.default(t,e)};var n=e(cO())}(WL)),WL)),u=e(NO()),c=e(Lz());function l(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=(0,a.default)(t);if(e){var i=(0,a.default)(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return(0,o.default)(this,n)}}var h=function(t){(0,i.default)(o,t);var e=l(o);function o(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"ws://localhost:8080",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;(0,r.default)(this,o);var a=n.autoconnect,u=void 0===a||a,c=n.reconnect,l=void 0===c||c,h=n.reconnect_interval,d=void 0===h?1e3:h,f=n.max_reconnects,p=void 0===f?5:f,m=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}(n,["autoconnect","reconnect","reconnect_interval","max_reconnects"]);return e.call(this,s.default,t,Object.assign({autoconnect:u,reconnect:l,reconnect_interval:d,max_reconnects:p},m),i)}return(0,n.default)(o)}(u.default);t.Client=h}(gL);const Sz=Ez.v4;var Az=function(t,e,n,r){if("string"!=typeof t)throw new TypeError(t+" must be a string");const i="number"==typeof(r=r||{}).version?r.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===n){const t="function"==typeof r.generator?r.generator:function(){return Sz()};o.id=t(o,r)}else 2===i&&null===n?r.notificationIdNull&&(o.id=null):o.id=n;return o};const xz=Ez.v4,Tz=Az,Iz=function(t,e){if(!(this instanceof Iz))return new Iz(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 xz()},version:void 0!==e.version?e.version:2,notificationIdNull:"boolean"==typeof e.notificationIdNull&&e.notificationIdNull},this.callServer=t};var kz=Iz;Iz.prototype.request=function(t,e,n,r){const i=this;let o=null;const a=Array.isArray(t)&&"function"==typeof e;if(1===this.options.version&&a)throw new TypeError("JSON-RPC 1.0 does not support batching");if(a||!a&&t&&"object"==typeof t&&"function"==typeof e)r=e,o=t;else{"function"==typeof n&&(r=n,n=void 0);const i="function"==typeof r;try{o=Tz(t,e,n,{generator:this.options.generator,version:this.options.version,notificationIdNull:this.options.notificationIdNull})}catch(t){if(i)return r(t);throw t}if(!i)return o}let s;try{s=JSON.stringify(o,this.options.replacer)}catch(t){return r(t)}return this.callServer(s,(function(t,e){i._parseResponse(t,e,r)})),o},Iz.prototype._parseResponse=function(t,e,n){if(t)return void n(t);if(!e)return n();let r;try{r=JSON.parse(e,this.options.reviver)}catch(t){return n(t)}if(3===n.length){if(Array.isArray(r)){const t=function(t){return void 0!==t.error},e=function(e){return!t(e)};return n(null,r.filter(t),r.filter(e))}return n(null,r.error,r.result)}n(null,r)};var jz=kz;const Cz="Impossible case. Please create issue.",Dz="The tweak was out of range or the resulted private key is invalid",Oz="The tweak was out of range or equal to zero",zz="Unknow error on context randomization",Pz="Private Key is invalid",Rz="Public Key could not be parsed",Bz="Public Key serialization error",Uz="The sum of the public keys is not valid",Fz="Signature could not be parsed",Wz="The nonce generation function failed, or the private key was invalid",Yz="Public key could not be recover",Qz="Scalar was invalid (zero or overflow)";function Hz(t,e){if(!t)throw new Error(e)}function Gz(t,e,n){if(Hz(e instanceof Uint8Array,`Expected ${t} to be an Uint8Array`),void 0!==n)if(Array.isArray(n)){const r=`Expected ${t} to be an Uint8Array with length [${n.join(", ")}]`;Hz(n.includes(e.length),r)}else{const r=`Expected ${t} to be an Uint8Array with length ${n}`;Hz(e.length===n,r)}}function Zz(t){Hz("Boolean"===qz(t),"Expected compressed to be a Boolean")}function Vz(t=(t=>new Uint8Array(t)),e){return"function"==typeof t&&(t=t(e)),Gz("output",t,e),t}function qz(t){return Object.prototype.toString.call(t).slice(8,-1)}var Jz={},Kz="6.5.4",Xz={},$z={exports:{}};!function(t,e){function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function r(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}function i(t,e,n){if(i.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(n=e,e=10),this._init(t||0,e||10,n||"be"))}var o;"object"==typeof t?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:tE.Buffer}catch(t){}function a(t,e){var n=t.charCodeAt(e);return n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:n-48&15}function s(t,e,n){var r=a(t,n);return n-1>=e&&(r|=a(t,n-1)<<4),r}function u(t,e,n,r){for(var i=0,o=Math.min(t.length,n),a=e;a<o;a++){var s=t.charCodeAt(a)-48;i*=r,i+=s>=49?s-49+10:s>=17?s-17+10:s}return i}i.isBN=function(t){return t instanceof i||null!==t&&"object"==typeof t&&t.constructor.wordSize===i.wordSize&&Array.isArray(t.words)},i.max=function(t,e){return t.cmp(e)>0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.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)))},i.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)},i.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,a,s=0;if("be"===r)for(i=t.length-1,o=0;i>=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i<t.length;i+=3)a=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this.strip()},i.prototype._parseHex=function(t,e,n){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var i,o=0,a=0;if("be"===n)for(r=t.length-1;r>=e;r-=2)i=s(t,e,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(r=(t.length-e)%2==0?e+1:e;r<t.length;r+=2)i=s(t,e,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this.strip()},i.prototype._parseBase=function(t,e,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=e)r++;r--,i=i/e|0;for(var o=t.length-n,a=o%r,s=Math.min(o,o-a)+n,c=0,l=n;l<s;l+=r)c=u(t,l,l+r,e),this.imuln(i),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==a){var h=1;for(c=u(t,l,t.length,e),l=0;l<a;l++)h*=e;this.imuln(h),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}this.strip()},i.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},i.prototype.clone=function(){var t=new i(null);return this.copy(t),t},i.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},i.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var c=["","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"],l=[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],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(t,e,n){n.negative=e.negative^t.negative;var r=t.length+e.length|0;n.length=r,r=r-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,u=a/67108864|0;n.words[0]=s;for(var c=1;c<r;c++){for(var l=u>>>26,h=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;l+=(a=(i=0|t.words[p])*(o=0|e.words[f])+h)/67108864|0,h=67108863&a}n.words[c]=0|h,u=0|l}return 0!==u?n.words[c]=0|u:n.length--,n.strip()}i.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,a=0;a<this.length;a++){var s=this.words[a],u=(16777215&(s<<i|o)).toString(16);r=0!=(o=s>>>24-i&16777215)||a!==this.length-1?c[6-u.length]+u+r:u+r,(i+=2)>=26&&(i-=26,a--)}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 d=l[t],f=h[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(f).toString(t);r=(p=p.idivn(f)).isZero()?m+r:c[d-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")},i.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},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(t,e){return n(void 0!==o),this.toArrayLike(o,t,e)},i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},i.prototype.toArrayLike=function(t,e,r){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"),this.strip();var a,s,u="le"===e,c=new t(o),l=this.clone();if(u){for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),c[s]=a;for(;s<o;s++)c[s]=0}else{for(s=0;s<o-i;s++)c[s]=0;for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),c[o-s-1]=a}return c},Math.clz32?i.prototype._countBits=function(t){return 32-Math.clz32(t)}:i.prototype._countBits=function(t){var e=t,n=0;return e>=4096&&(n+=13,e>>>=13),e>=64&&(n+=7,e>>>=7),e>=8&&(n+=4,e>>>=4),e>=2&&(n+=2,e>>>=2),n+e},i.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,n=0;return 0==(8191&e)&&(n+=13,e>>>=13),0==(127&e)&&(n+=7,e>>>=7),0==(15&e)&&(n+=4,e>>>=4),0==(3&e)&&(n+=2,e>>>=2),0==(1&e)&&n++,n},i.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var n=this._zeroBits(this.words[e]);if(t+=n,26!==n)break}return t},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},i.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return 0!==this.negative},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.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()},i.prototype.ior=function(t){return n(0==(this.negative|t.negative)),this.iuor(t)},i.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},i.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var n=0;n<e.length;n++)this.words[n]=this.words[n]&t.words[n];return this.length=e.length,this.strip()},i.prototype.iand=function(t){return n(0==(this.negative|t.negative)),this.iuand(t)},i.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},i.prototype.iuxor=function(t){var e,n;this.length>t.length?(e=this,n=t):(e=t,n=this);for(var r=0;r<n.length;r++)this.words[r]=e.words[r]^n.words[r];if(this!==e)for(;r<e.length;r++)this.words[r]=e.words[r];return this.length=e.length,this.strip()},i.prototype.ixor=function(t){return n(0==(this.negative|t.negative)),this.iuxor(t)},i.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},i.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()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.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()},i.prototype.iadd=function(t){var e,n,r;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?(n=this,r=t):(n=t,r=this);for(var i=0,o=0;o<r.length;o++)e=(0|n.words[o])+(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<n.length;o++)e=(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;o<n.length;o++)this.words[o]=n.words[o];return this},i.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)},i.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 n,r,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=t):(n=t,r=this);for(var o=0,a=0;a<r.length;a++)o=(e=(0|n.words[a])-(0|r.words[a])+o)>>26,this.words[a]=67108863&e;for(;0!==o&&a<n.length;a++)o=(e=(0|n.words[a])+o)>>26,this.words[a]=67108863&e;if(0===o&&a<n.length&&n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this.length=Math.max(this.length,a),n!==this&&(this.negative=1),this.strip()},i.prototype.sub=function(t){return this.clone().isub(t)};var f=function(t,e,n){var r,i,o,a=t.words,s=e.words,u=n.words,c=0,l=0|a[0],h=8191&l,d=l>>>13,f=0|a[1],p=8191&f,m=f>>>13,g=0|a[2],y=8191&g,b=g>>>13,v=0|a[3],w=8191&v,M=v>>>13,_=0|a[4],E=8191&_,N=_>>>13,L=0|a[5],S=8191&L,A=L>>>13,x=0|a[6],T=8191&x,I=x>>>13,k=0|a[7],j=8191&k,C=k>>>13,D=0|a[8],O=8191&D,z=D>>>13,P=0|a[9],R=8191&P,B=P>>>13,U=0|s[0],F=8191&U,W=U>>>13,Y=0|s[1],Q=8191&Y,H=Y>>>13,G=0|s[2],Z=8191&G,V=G>>>13,q=0|s[3],J=8191&q,K=q>>>13,X=0|s[4],$=8191&X,tt=X>>>13,et=0|s[5],nt=8191&et,rt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ct=st>>>13,lt=0|s[8],ht=8191<,dt=lt>>>13,ft=0|s[9],pt=8191&ft,mt=ft>>>13;n.negative=t.negative^e.negative,n.length=19;var gt=(c+(r=Math.imul(h,F))|0)+((8191&(i=(i=Math.imul(h,W))+Math.imul(d,F)|0))<<13)|0;c=((o=Math.imul(d,W))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(p,F),i=(i=Math.imul(p,W))+Math.imul(m,F)|0,o=Math.imul(m,W);var yt=(c+(r=r+Math.imul(h,Q)|0)|0)+((8191&(i=(i=i+Math.imul(h,H)|0)+Math.imul(d,Q)|0))<<13)|0;c=((o=o+Math.imul(d,H)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,r=Math.imul(y,F),i=(i=Math.imul(y,W))+Math.imul(b,F)|0,o=Math.imul(b,W),r=r+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,H)|0;var bt=(c+(r=r+Math.imul(h,Z)|0)|0)+((8191&(i=(i=i+Math.imul(h,V)|0)+Math.imul(d,Z)|0))<<13)|0;c=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(w,F),i=(i=Math.imul(w,W))+Math.imul(M,F)|0,o=Math.imul(M,W),r=r+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,H)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,H)|0,r=r+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,V)|0;var vt=(c+(r=r+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,K)|0)+Math.imul(d,J)|0))<<13)|0;c=((o=o+Math.imul(d,K)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(E,F),i=(i=Math.imul(E,W))+Math.imul(N,F)|0,o=Math.imul(N,W),r=r+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,H)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,H)|0,r=r+Math.imul(y,Z)|0,i=(i=i+Math.imul(y,V)|0)+Math.imul(b,Z)|0,o=o+Math.imul(b,V)|0,r=r+Math.imul(p,J)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,K)|0;var wt=(c+(r=r+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,tt)|0)+Math.imul(d,$)|0))<<13)|0;c=((o=o+Math.imul(d,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(S,F),i=(i=Math.imul(S,W))+Math.imul(A,F)|0,o=Math.imul(A,W),r=r+Math.imul(E,Q)|0,i=(i=i+Math.imul(E,H)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,H)|0,r=r+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,V)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,V)|0,r=r+Math.imul(y,J)|0,i=(i=i+Math.imul(y,K)|0)+Math.imul(b,J)|0,o=o+Math.imul(b,K)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,tt)|0;var Mt=(c+(r=r+Math.imul(h,nt)|0)|0)+((8191&(i=(i=i+Math.imul(h,rt)|0)+Math.imul(d,nt)|0))<<13)|0;c=((o=o+Math.imul(d,rt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(T,F),i=(i=Math.imul(T,W))+Math.imul(I,F)|0,o=Math.imul(I,W),r=r+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,H)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,H)|0,r=r+Math.imul(E,Z)|0,i=(i=i+Math.imul(E,V)|0)+Math.imul(N,Z)|0,o=o+Math.imul(N,V)|0,r=r+Math.imul(w,J)|0,i=(i=i+Math.imul(w,K)|0)+Math.imul(M,J)|0,o=o+Math.imul(M,K)|0,r=r+Math.imul(y,$)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(b,$)|0,o=o+Math.imul(b,tt)|0,r=r+Math.imul(p,nt)|0,i=(i=i+Math.imul(p,rt)|0)+Math.imul(m,nt)|0,o=o+Math.imul(m,rt)|0;var _t=(c+(r=r+Math.imul(h,ot)|0)|0)+((8191&(i=(i=i+Math.imul(h,at)|0)+Math.imul(d,ot)|0))<<13)|0;c=((o=o+Math.imul(d,at)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,r=Math.imul(j,F),i=(i=Math.imul(j,W))+Math.imul(C,F)|0,o=Math.imul(C,W),r=r+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,H)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,H)|0,r=r+Math.imul(S,Z)|0,i=(i=i+Math.imul(S,V)|0)+Math.imul(A,Z)|0,o=o+Math.imul(A,V)|0,r=r+Math.imul(E,J)|0,i=(i=i+Math.imul(E,K)|0)+Math.imul(N,J)|0,o=o+Math.imul(N,K)|0,r=r+Math.imul(w,$)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,tt)|0,r=r+Math.imul(y,nt)|0,i=(i=i+Math.imul(y,rt)|0)+Math.imul(b,nt)|0,o=o+Math.imul(b,rt)|0,r=r+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,at)|0;var Et=(c+(r=r+Math.imul(h,ut)|0)|0)+((8191&(i=(i=i+Math.imul(h,ct)|0)+Math.imul(d,ut)|0))<<13)|0;c=((o=o+Math.imul(d,ct)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(O,F),i=(i=Math.imul(O,W))+Math.imul(z,F)|0,o=Math.imul(z,W),r=r+Math.imul(j,Q)|0,i=(i=i+Math.imul(j,H)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,H)|0,r=r+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,V)|0)+Math.imul(I,Z)|0,o=o+Math.imul(I,V)|0,r=r+Math.imul(S,J)|0,i=(i=i+Math.imul(S,K)|0)+Math.imul(A,J)|0,o=o+Math.imul(A,K)|0,r=r+Math.imul(E,$)|0,i=(i=i+Math.imul(E,tt)|0)+Math.imul(N,$)|0,o=o+Math.imul(N,tt)|0,r=r+Math.imul(w,nt)|0,i=(i=i+Math.imul(w,rt)|0)+Math.imul(M,nt)|0,o=o+Math.imul(M,rt)|0,r=r+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,at)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,at)|0,r=r+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 Nt=(c+(r=r+Math.imul(h,ht)|0)|0)+((8191&(i=(i=i+Math.imul(h,dt)|0)+Math.imul(d,ht)|0))<<13)|0;c=((o=o+Math.imul(d,dt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,r=Math.imul(R,F),i=(i=Math.imul(R,W))+Math.imul(B,F)|0,o=Math.imul(B,W),r=r+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,H)|0)+Math.imul(z,Q)|0,o=o+Math.imul(z,H)|0,r=r+Math.imul(j,Z)|0,i=(i=i+Math.imul(j,V)|0)+Math.imul(C,Z)|0,o=o+Math.imul(C,V)|0,r=r+Math.imul(T,J)|0,i=(i=i+Math.imul(T,K)|0)+Math.imul(I,J)|0,o=o+Math.imul(I,K)|0,r=r+Math.imul(S,$)|0,i=(i=i+Math.imul(S,tt)|0)+Math.imul(A,$)|0,o=o+Math.imul(A,tt)|0,r=r+Math.imul(E,nt)|0,i=(i=i+Math.imul(E,rt)|0)+Math.imul(N,nt)|0,o=o+Math.imul(N,rt)|0,r=r+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,at)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,at)|0,r=r+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ct)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,ct)|0,r=r+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,dt)|0)+Math.imul(m,ht)|0,o=o+Math.imul(m,dt)|0;var Lt=(c+(r=r+Math.imul(h,pt)|0)|0)+((8191&(i=(i=i+Math.imul(h,mt)|0)+Math.imul(d,pt)|0))<<13)|0;c=((o=o+Math.imul(d,mt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,r=Math.imul(R,Q),i=(i=Math.imul(R,H))+Math.imul(B,Q)|0,o=Math.imul(B,H),r=r+Math.imul(O,Z)|0,i=(i=i+Math.imul(O,V)|0)+Math.imul(z,Z)|0,o=o+Math.imul(z,V)|0,r=r+Math.imul(j,J)|0,i=(i=i+Math.imul(j,K)|0)+Math.imul(C,J)|0,o=o+Math.imul(C,K)|0,r=r+Math.imul(T,$)|0,i=(i=i+Math.imul(T,tt)|0)+Math.imul(I,$)|0,o=o+Math.imul(I,tt)|0,r=r+Math.imul(S,nt)|0,i=(i=i+Math.imul(S,rt)|0)+Math.imul(A,nt)|0,o=o+Math.imul(A,rt)|0,r=r+Math.imul(E,ot)|0,i=(i=i+Math.imul(E,at)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,at)|0,r=r+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,ct)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ct)|0,r=r+Math.imul(y,ht)|0,i=(i=i+Math.imul(y,dt)|0)+Math.imul(b,ht)|0,o=o+Math.imul(b,dt)|0;var St=(c+(r=r+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)+(St>>>26)|0,St&=67108863,r=Math.imul(R,Z),i=(i=Math.imul(R,V))+Math.imul(B,Z)|0,o=Math.imul(B,V),r=r+Math.imul(O,J)|0,i=(i=i+Math.imul(O,K)|0)+Math.imul(z,J)|0,o=o+Math.imul(z,K)|0,r=r+Math.imul(j,$)|0,i=(i=i+Math.imul(j,tt)|0)+Math.imul(C,$)|0,o=o+Math.imul(C,tt)|0,r=r+Math.imul(T,nt)|0,i=(i=i+Math.imul(T,rt)|0)+Math.imul(I,nt)|0,o=o+Math.imul(I,rt)|0,r=r+Math.imul(S,ot)|0,i=(i=i+Math.imul(S,at)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,at)|0,r=r+Math.imul(E,ut)|0,i=(i=i+Math.imul(E,ct)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ct)|0,r=r+Math.imul(w,ht)|0,i=(i=i+Math.imul(w,dt)|0)+Math.imul(M,ht)|0,o=o+Math.imul(M,dt)|0;var At=(c+(r=r+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,mt)|0)+Math.imul(b,pt)|0))<<13)|0;c=((o=o+Math.imul(b,mt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(R,J),i=(i=Math.imul(R,K))+Math.imul(B,J)|0,o=Math.imul(B,K),r=r+Math.imul(O,$)|0,i=(i=i+Math.imul(O,tt)|0)+Math.imul(z,$)|0,o=o+Math.imul(z,tt)|0,r=r+Math.imul(j,nt)|0,i=(i=i+Math.imul(j,rt)|0)+Math.imul(C,nt)|0,o=o+Math.imul(C,rt)|0,r=r+Math.imul(T,ot)|0,i=(i=i+Math.imul(T,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,r=r+Math.imul(S,ut)|0,i=(i=i+Math.imul(S,ct)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,ct)|0,r=r+Math.imul(E,ht)|0,i=(i=i+Math.imul(E,dt)|0)+Math.imul(N,ht)|0,o=o+Math.imul(N,dt)|0;var xt=(c+(r=r+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,mt)|0)+Math.imul(M,pt)|0))<<13)|0;c=((o=o+Math.imul(M,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,r=Math.imul(R,$),i=(i=Math.imul(R,tt))+Math.imul(B,$)|0,o=Math.imul(B,tt),r=r+Math.imul(O,nt)|0,i=(i=i+Math.imul(O,rt)|0)+Math.imul(z,nt)|0,o=o+Math.imul(z,rt)|0,r=r+Math.imul(j,ot)|0,i=(i=i+Math.imul(j,at)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,at)|0,r=r+Math.imul(T,ut)|0,i=(i=i+Math.imul(T,ct)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ct)|0,r=r+Math.imul(S,ht)|0,i=(i=i+Math.imul(S,dt)|0)+Math.imul(A,ht)|0,o=o+Math.imul(A,dt)|0;var Tt=(c+(r=r+Math.imul(E,pt)|0)|0)+((8191&(i=(i=i+Math.imul(E,mt)|0)+Math.imul(N,pt)|0))<<13)|0;c=((o=o+Math.imul(N,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(R,nt),i=(i=Math.imul(R,rt))+Math.imul(B,nt)|0,o=Math.imul(B,rt),r=r+Math.imul(O,ot)|0,i=(i=i+Math.imul(O,at)|0)+Math.imul(z,ot)|0,o=o+Math.imul(z,at)|0,r=r+Math.imul(j,ut)|0,i=(i=i+Math.imul(j,ct)|0)+Math.imul(C,ut)|0,o=o+Math.imul(C,ct)|0,r=r+Math.imul(T,ht)|0,i=(i=i+Math.imul(T,dt)|0)+Math.imul(I,ht)|0,o=o+Math.imul(I,dt)|0;var It=(c+(r=r+Math.imul(S,pt)|0)|0)+((8191&(i=(i=i+Math.imul(S,mt)|0)+Math.imul(A,pt)|0))<<13)|0;c=((o=o+Math.imul(A,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(R,ot),i=(i=Math.imul(R,at))+Math.imul(B,ot)|0,o=Math.imul(B,at),r=r+Math.imul(O,ut)|0,i=(i=i+Math.imul(O,ct)|0)+Math.imul(z,ut)|0,o=o+Math.imul(z,ct)|0,r=r+Math.imul(j,ht)|0,i=(i=i+Math.imul(j,dt)|0)+Math.imul(C,ht)|0,o=o+Math.imul(C,dt)|0;var kt=(c+(r=r+Math.imul(T,pt)|0)|0)+((8191&(i=(i=i+Math.imul(T,mt)|0)+Math.imul(I,pt)|0))<<13)|0;c=((o=o+Math.imul(I,mt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,r=Math.imul(R,ut),i=(i=Math.imul(R,ct))+Math.imul(B,ut)|0,o=Math.imul(B,ct),r=r+Math.imul(O,ht)|0,i=(i=i+Math.imul(O,dt)|0)+Math.imul(z,ht)|0,o=o+Math.imul(z,dt)|0;var jt=(c+(r=r+Math.imul(j,pt)|0)|0)+((8191&(i=(i=i+Math.imul(j,mt)|0)+Math.imul(C,pt)|0))<<13)|0;c=((o=o+Math.imul(C,mt)|0)+(i>>>13)|0)+(jt>>>26)|0,jt&=67108863,r=Math.imul(R,ht),i=(i=Math.imul(R,dt))+Math.imul(B,ht)|0,o=Math.imul(B,dt);var Ct=(c+(r=r+Math.imul(O,pt)|0)|0)+((8191&(i=(i=i+Math.imul(O,mt)|0)+Math.imul(z,pt)|0))<<13)|0;c=((o=o+Math.imul(z,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863;var Dt=(c+(r=Math.imul(R,pt))|0)+((8191&(i=(i=Math.imul(R,mt))+Math.imul(B,pt)|0))<<13)|0;return c=((o=Math.imul(B,mt))+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,u[0]=gt,u[1]=yt,u[2]=bt,u[3]=vt,u[4]=wt,u[5]=Mt,u[6]=_t,u[7]=Et,u[8]=Nt,u[9]=Lt,u[10]=St,u[11]=At,u[12]=xt,u[13]=Tt,u[14]=It,u[15]=kt,u[16]=jt,u[17]=Ct,u[18]=Dt,0!==c&&(u[19]=c,n.length++),n};function p(t,e,n){return(new m).mulp(t,e,n)}function m(t,e){this.x=t,this.y=e}Math.imul||(f=d),i.prototype.mulTo=function(t,e){var n,r=this.length+t.length;return n=10===this.length&&10===t.length?f(this,t,e):r<63?d(this,t,e):r<1024?function(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var r=0,i=0,o=0;o<n.length-1;o++){var a=i;i=0;for(var s=67108863&r,u=Math.min(o,e.length-1),c=Math.max(0,o-t.length+1);c<=u;c++){var l=o-c,h=(0|t.words[l])*(0|e.words[c]),d=67108863&h;s=67108863&(d=d+s|0),i+=(a=(a=a+(h/67108864|0)|0)+(d>>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n.strip()}(this,t,e):p(this,t,e),n},m.prototype.makeRBT=function(t){for(var e=new Array(t),n=i.prototype._countBits(t)-1,r=0;r<t;r++)e[r]=this.revBin(r,n,t);return e},m.prototype.revBin=function(t,e,n){if(0===t||t===n-1)return t;for(var r=0,i=0;i<e;i++)r|=(1&t)<<e-i-1,t>>=1;return r},m.prototype.permute=function(t,e,n,r,i,o){for(var a=0;a<o;a++)r[a]=e[t[a]],i[a]=n[t[a]]},m.prototype.transform=function(t,e,n,r,i,o){this.permute(o,t,e,n,r,i);for(var a=1;a<i;a<<=1)for(var s=a<<1,u=Math.cos(2*Math.PI/s),c=Math.sin(2*Math.PI/s),l=0;l<i;l+=s)for(var h=u,d=c,f=0;f<a;f++){var p=n[l+f],m=r[l+f],g=n[l+f+a],y=r[l+f+a],b=h*g-d*y;y=h*y+d*g,g=b,n[l+f]=p+g,r[l+f]=m+y,n[l+f+a]=p-g,r[l+f+a]=m-y,f!==s&&(b=u*h-c*d,d=u*d+c*h,h=b)}},m.prototype.guessLen13b=function(t,e){var n=1|Math.max(e,t),r=1&n,i=0;for(n=n/2|0;n;n>>>=1)i++;return 1<<i+1+r},m.prototype.conjugate=function(t,e,n){if(!(n<=1))for(var r=0;r<n/2;r++){var i=t[r];t[r]=t[n-r-1],t[n-r-1]=i,i=e[r],e[r]=-e[n-r-1],e[n-r-1]=-i}},m.prototype.normalize13b=function(t,e){for(var n=0,r=0;r<e/2;r++){var i=8192*Math.round(t[2*r+1]/e)+Math.round(t[2*r]/e)+n;t[r]=67108863&i,n=i<67108864?0:i/67108864|0}return t},m.prototype.convert13b=function(t,e,r,i){for(var o=0,a=0;a<e;a++)o+=0|t[a],r[2*a]=8191&o,o>>>=13,r[2*a+1]=8191&o,o>>>=13;for(a=2*e;a<i;++a)r[a]=0;n(0===o),n(0==(-8192&o))},m.prototype.stub=function(t){for(var e=new Array(t),n=0;n<t;n++)e[n]=0;return e},m.prototype.mulp=function(t,e,n){var r=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(r),o=this.stub(r),a=new Array(r),s=new Array(r),u=new Array(r),c=new Array(r),l=new Array(r),h=new Array(r),d=n.words;d.length=r,this.convert13b(t.words,t.length,a,r),this.convert13b(e.words,e.length,c,r),this.transform(a,o,s,u,r,i),this.transform(c,o,l,h,r,i);for(var f=0;f<r;f++){var p=s[f]*l[f]-u[f]*h[f];u[f]=s[f]*h[f]+u[f]*l[f],s[f]=p}return this.conjugate(s,u,r),this.transform(s,u,d,o,r,i),this.conjugate(d,o,r),this.normalize13b(d,r),n.negative=t.negative^e.negative,n.length=t.length+e.length,n.strip()},i.prototype.mul=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},i.prototype.mulf=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),p(this,t,e)},i.prototype.imul=function(t){return this.clone().mulTo(t,this)},i.prototype.imuln=function(t){n("number"==typeof t),n(t<67108864);for(var e=0,r=0;r<this.length;r++){var i=(0|this.words[r])*t,o=(67108863&i)+(67108863&e);e>>=26,e+=i/67108864|0,e+=o>>>26,this.words[r]=67108863&o}return 0!==e&&(this.words[r]=e,this.length++),this},i.prototype.muln=function(t){return this.clone().imuln(t)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),n=0;n<e.length;n++){var r=n/26|0,i=n%26;e[n]=(t.words[r]&1<<i)>>>i}return e}(t);if(0===e.length)return new i(1);for(var n=this,r=0;r<e.length&&0===e[r];r++,n=n.sqr());if(++r<e.length)for(var o=n.sqr();r<e.length;r++,o=o.sqr())0!==e[r]&&(n=n.mul(o));return n},i.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 a=0;for(e=0;e<this.length;e++){var s=this.words[e]&o,u=(0|this.words[e])-s<<r;this.words[e]=u|a,a=s>>>26-r}a&&(this.words[e]=a,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()},i.prototype.ishln=function(t){return n(0===this.negative),this.iushln(t)},i.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,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<<o,u=r;if(i-=a,i=Math.max(0,i),u){for(var c=0;c<a;c++)u.words[c]=this.words[c];u.length=a}if(0===a);else if(this.length>a)for(this.length-=a,c=0;c<this.length;c++)this.words[c]=this.words[c+a];else this.words[0]=0,this.length=1;var l=0;for(c=this.length-1;c>=0&&(0!==l||c>=i);c--){var h=0|this.words[c];this.words[c]=l<<26-o|h>>>o,l=h&s}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},i.prototype.shln=function(t){return this.clone().ishln(t)},i.prototype.ushln=function(t){return this.clone().iushln(t)},i.prototype.shrn=function(t){return this.clone().ishrn(t)},i.prototype.ushrn=function(t){return this.clone().iushrn(t)},i.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))},i.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()},i.prototype.maskn=function(t){return this.clone().imaskn(t)},i.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)},i.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},i.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()},i.prototype.addn=function(t){return this.clone().iaddn(t)},i.prototype.subn=function(t){return this.clone().isubn(t)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(t,e,r){var i,o,a=t.length+r;this._expand(a);var s=0;for(i=0;i<t.length;i++){o=(0|this.words[i+r])+s;var u=(0|t.words[i])*e;s=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i<this.length-r;i++)s=(o=(0|this.words[i+r])+s)>>26,this.words[i+r]=67108863&o;if(0===s)return this.strip();for(n(-1===s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},i.prototype._wordDiv=function(t,e){var n=(this.length,t.length),r=this.clone(),o=t,a=0|o.words[o.length-1];0!=(n=26-this._countBits(a))&&(o=o.ushln(n),r.iushln(n),a=0|o.words[o.length-1]);var s,u=r.length-o.length;if("mod"!==e){(s=new i(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c<s.length;c++)s.words[c]=0}var l=r.clone()._ishlnsubmul(o,1,u);0===l.negative&&(r=l,s&&(s.words[u]=1));for(var h=u-1;h>=0;h--){var d=67108864*(0|r.words[o.length+h])+(0|r.words[o.length+h-1]);for(d=Math.min(d/a|0,67108863),r._ishlnsubmul(o,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(o,1,h),r.isZero()||(r.negative^=1);s&&(s.words[h]=d)}return s&&s.strip(),r.strip(),"div"!==e&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},i.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(o=s.div.neg()),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(t)),{div:o,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new i(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new i(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modn(t.words[0]))}:this._wordDiv(t,e);var o,a,s},i.prototype.div=function(t){return this.divmod(t,"div",!1).div},i.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},i.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},i.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var n=0!==e.div.negative?e.mod.isub(t):e.mod,r=t.ushrn(1),i=t.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modn=function(t){n(t<=67108863);for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},i.prototype.idivn=function(t){n(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},i.prototype.divn=function(t){return this.clone().idivn(t)},i.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 o=new i(1),a=new i(0),s=new i(0),u=new i(1),c=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++c;for(var l=r.clone(),h=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;)(o.isOdd()||a.isOdd())&&(o.iadd(l),a.isub(h)),o.iushrn(1),a.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;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(h)),s.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(s),a.isub(u)):(r.isub(e),s.isub(o),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},i.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 o,a=new i(1),s=new i(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,l=1;0==(e.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(e.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var h=0,d=1;0==(r.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(r.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),a.isub(s)):(r.isub(e),s.isub(a))}return(o=0===e.cmpn(1)?a:s).cmpn(0)<0&&o.iadd(t),o},i.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),n=t.clone();e.negative=0,n.negative=0;for(var r=0;e.isEven()&&n.isEven();r++)e.iushrn(1),n.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=e.cmp(n);if(i<0){var o=e;e=n,n=o}else if(0===i||0===n.cmpn(1))break;e.isub(n)}return n.iushln(r)},i.prototype.invm=function(t){return this.egcd(t).a.umod(t)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(t){return this.words[0]&t},i.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,a=r;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.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},i.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},i.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,n=this.length-1;n>=0;n--){var r=0|this.words[n],i=0|t.words[n];if(r!==i){r<i?e=-1:r>i&&(e=1);break}}return e},i.prototype.gtn=function(t){return 1===this.cmpn(t)},i.prototype.gt=function(t){return 1===this.cmp(t)},i.prototype.gten=function(t){return this.cmpn(t)>=0},i.prototype.gte=function(t){return this.cmp(t)>=0},i.prototype.ltn=function(t){return-1===this.cmpn(t)},i.prototype.lt=function(t){return-1===this.cmp(t)},i.prototype.lten=function(t){return this.cmpn(t)<=0},i.prototype.lte=function(t){return this.cmp(t)<=0},i.prototype.eqn=function(t){return 0===this.cmpn(t)},i.prototype.eq=function(t){return 0===this.cmp(t)},i.red=function(t){return new _(t)},i.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)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(t){return this.red=t,this},i.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var g={k256:null,p224:null,p192:null,p25519:null};function y(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function M(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function _(t){if("string"==typeof t){var e=i._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 E(t){_.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}y.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},y.prototype.ireduce=function(t){var e,n=t;do{this.split(n,this.tmp),e=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(e>this.n);var r=e<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):r>0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},y.prototype.split=function(t,e){t.iushrn(this.n,0,e)},y.prototype.imulK=function(t){return t.imul(this.k)},r(b,y),b.prototype.split=function(t,e){for(var n=4194303,r=Math.min(t.length,9),i=0;i<r;i++)e.words[i]=t.words[i];if(e.length=r,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&n,i=10;i<t.length;i++){var a=0|t.words[i];t.words[i-10]=(a&n)<<4|o>>>22,o=a}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n<t.length;n++){var r=0|t.words[n];e+=977*r,t.words[n]=67108863&e,e=64*r+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},r(v,y),r(w,y),r(M,y),M.prototype.imulK=function(t){for(var e=0,n=0;n<t.length;n++){var r=19*(0|t.words[n])+e,i=67108863&r;r>>>=26,t.words[n]=i,e=r}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(g[t])return g[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new v;else if("p192"===t)e=new w;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new M}return g[t]=e,e},_.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},_.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")},_.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},_.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},_.prototype.add=function(t,e){this._verify2(t,e);var n=t.add(e);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},_.prototype.iadd=function(t,e){this._verify2(t,e);var n=t.iadd(e);return n.cmp(this.m)>=0&&n.isub(this.m),n},_.prototype.sub=function(t,e){this._verify2(t,e);var n=t.sub(e);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},_.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},_.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},_.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},_.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},_.prototype.isqr=function(t){return this.imul(t,t.clone())},_.prototype.sqr=function(t){return this.mul(t,t)},_.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 i(1)).iushrn(2);return this.pow(t,r)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);n(!o.isZero());var s=new i(1).toRed(this),u=s.redNeg(),c=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new i(2*l*l).toRed(this);0!==this.pow(l,c).cmp(u);)l.redIAdd(u);for(var h=this.pow(l,o),d=this.pow(t,o.addn(1).iushrn(1)),f=this.pow(t,o),p=a;0!==f.cmp(s);){for(var m=f,g=0;0!==m.cmp(s);g++)m=m.redSqr();n(g<p);var y=this.pow(h,new i(1).iushln(p-g-1));d=d.redMul(y),h=y.redSqr(),f=f.redMul(h),p=g}return d},_.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},_.prototype.pow=function(t,e){if(e.isZero())return new i(1).toRed(this);if(0===e.cmpn(1))return t.clone();var n=new Array(16);n[0]=new i(1).toRed(this),n[1]=t;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],t);var o=n[0],a=0,s=0,u=e.bitLength()%26;for(0===u&&(u=26),r=e.length-1;r>=0;r--){for(var c=e.words[r],l=u-1;l>=0;l--){var h=c>>l&1;o!==n[0]&&(o=this.sqr(o)),0!==h||0!==a?(a<<=1,a|=h,(4==++s||0===r&&0===l)&&(o=this.mul(o,n[a]),s=0,a=0)):s=0}u=26}return o},_.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},_.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new E(t)},r(E,_),E.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},E.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},E.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var n=t.imul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).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)},E.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new i(0)._forceRed(this);var n=t.mul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=n.isub(r).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},E.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}($z,KM);var tP=eP;function eP(t,e){if(!t)throw new Error(e||"Assertion failed")}eP.equal=function(t,e,n){if(t!=e)throw new Error(n||"Assertion failed: "+t+" != "+e)};var nP={};!function(t){var e=nP;function n(t){return 1===t.length?"0"+t:t}function r(t){for(var e="",r=0;r<t.length;r++)e+=n(t[r].toString(16));return e}e.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var n=[];if("string"!=typeof t){for(var r=0;r<t.length;r++)n[r]=0|t[r];return n}if("hex"===e){(t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t);for(r=0;r<t.length;r+=2)n.push(parseInt(t[r]+t[r+1],16))}else for(r=0;r<t.length;r++){var i=t.charCodeAt(r),o=i>>8,a=255&i;o?n.push(o,a):n.push(a)}return n},e.zero2=n,e.toHex=r,e.encode=function(t,e){return"hex"===e?r(t):t}}(),function(t){var e=Xz,n=$z.exports,r=tP,i=nP;e.assert=r,e.toArray=i.toArray,e.zero2=i.zero2,e.toHex=i.toHex,e.encode=i.encode,e.getNAF=function(t,e,n){var r=new Array(Math.max(t.bitLength(),n)+1);r.fill(0);for(var i=1<<e+1,o=t.clone(),a=0;a<r.length;a++){var s,u=o.andln(i-1);o.isOdd()?(s=u>(i>>1)-1?(i>>1)-u:u,o.isubn(s)):s=0,r[a]=s,o.iushrn(1)}return r},e.getJSF=function(t,e){var n=[[],[]];t=t.clone(),e=e.clone();for(var r,i=0,o=0;t.cmpn(-i)>0||e.cmpn(-o)>0;){var a,s,u=t.andln(3)+i&3,c=e.andln(3)+o&3;3===u&&(u=-1),3===c&&(c=-1),a=0==(1&u)?0:3!==(r=t.andln(7)+i&7)&&5!==r||2!==c?u:-u,n[0].push(a),s=0==(1&c)?0:3!==(r=e.andln(7)+o&7)&&5!==r||2!==u?c:-c,n[1].push(s),2*i===a+1&&(i=1-i),2*o===s+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return n},e.cachedProperty=function(t,e,n){var r="_"+e;t.prototype[e]=function(){return void 0!==this[r]?this[r]:this[r]=n.call(this)}},e.parseBytes=function(t){return"string"==typeof t?e.toArray(t,"hex"):t},e.intFromLE=function(t){return new n(t,"hex","le")}}();var rP,iP={exports:{}};function oP(t){this.rand=t}if(iP.exports=function(t){return rP||(rP=new oP(null)),rP.generate(t)},iP.exports.Rand=oP,oP.prototype.generate=function(t){return this._rand(t)},oP.prototype._rand=function(t){if(this.rand.getBytes)return this.rand.getBytes(t);for(var e=new Uint8Array(t),n=0;n<e.length;n++)e[n]=this.rand.getByte();return e},"object"==typeof self)self.crypto&&self.crypto.getRandomValues?oP.prototype._rand=function(t){var e=new Uint8Array(t);return self.crypto.getRandomValues(e),e}:self.msCrypto&&self.msCrypto.getRandomValues?oP.prototype._rand=function(t){var e=new Uint8Array(t);return self.msCrypto.getRandomValues(e),e}:"object"==typeof window&&(oP.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var aP=oE;if("function"!=typeof aP.randomBytes)throw new Error("Not supported");oP.prototype._rand=function(t){return aP.randomBytes(t)}}catch(t){}var sP={},uP=$z.exports,cP=Xz,lP=cP.getNAF,hP=cP.getJSF,dP=cP.assert;function fP(t,e){this.type=t,this.p=new uP(e.p,16),this.red=e.prime?uP.red(e.prime):uP.mont(this.p),this.zero=new uP(0).toRed(this.red),this.one=new uP(1).toRed(this.red),this.two=new uP(2).toRed(this.red),this.n=e.n&&new uP(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var n=this.n&&this.p.div(this.n);!n||n.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var pP=fP;function mP(t,e){this.curve=t,this.type=e,this.precomputed=null}fP.prototype.point=function(){throw new Error("Not implemented")},fP.prototype.validate=function(){throw new Error("Not implemented")},fP.prototype._fixedNafMul=function(t,e){dP(t.precomputed);var n=t._getDoubles(),r=lP(e,1,this._bitLength),i=(1<<n.step+1)-(n.step%2==0?2:1);i/=3;var o,a,s=[];for(o=0;o<r.length;o+=n.step){a=0;for(var u=o+n.step-1;u>=o;u--)a=(a<<1)+r[u];s.push(a)}for(var c=this.jpoint(null,null,null),l=this.jpoint(null,null,null),h=i;h>0;h--){for(o=0;o<s.length;o++)(a=s[o])===h?l=l.mixedAdd(n.points[o]):a===-h&&(l=l.mixedAdd(n.points[o].neg()));c=c.add(l)}return c.toP()},fP.prototype._wnafMul=function(t,e){var n=4,r=t._getNAFPoints(n);n=r.wnd;for(var i=r.points,o=lP(e,n,this._bitLength),a=this.jpoint(null,null,null),s=o.length-1;s>=0;s--){for(var u=0;s>=0&&0===o[s];s--)u++;if(s>=0&&u++,a=a.dblp(u),s<0)break;var c=o[s];dP(0!==c),a="affine"===t.type?c>0?a.mixedAdd(i[c-1>>1]):a.mixedAdd(i[-c-1>>1].neg()):c>0?a.add(i[c-1>>1]):a.add(i[-c-1>>1].neg())}return"affine"===t.type?a.toP():a},fP.prototype._wnafMulAdd=function(t,e,n,r,i){var o,a,s,u=this._wnafT1,c=this._wnafT2,l=this._wnafT3,h=0;for(o=0;o<r;o++){var d=(s=e[o])._getNAFPoints(t);u[o]=d.wnd,c[o]=d.points}for(o=r-1;o>=1;o-=2){var f=o-1,p=o;if(1===u[f]&&1===u[p]){var m=[e[f],null,null,e[p]];0===e[f].y.cmp(e[p].y)?(m[1]=e[f].add(e[p]),m[2]=e[f].toJ().mixedAdd(e[p].neg())):0===e[f].y.cmp(e[p].y.redNeg())?(m[1]=e[f].toJ().mixedAdd(e[p]),m[2]=e[f].add(e[p].neg())):(m[1]=e[f].toJ().mixedAdd(e[p]),m[2]=e[f].toJ().mixedAdd(e[p].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],y=hP(n[f],n[p]);for(h=Math.max(y[0].length,h),l[f]=new Array(h),l[p]=new Array(h),a=0;a<h;a++){var b=0|y[0][a],v=0|y[1][a];l[f][a]=g[3*(b+1)+(v+1)],l[p][a]=0,c[f]=m}}else l[f]=lP(n[f],u[f],this._bitLength),l[p]=lP(n[p],u[p],this._bitLength),h=Math.max(l[f].length,h),h=Math.max(l[p].length,h)}var w=this.jpoint(null,null,null),M=this._wnafT4;for(o=h;o>=0;o--){for(var _=0;o>=0;){var E=!0;for(a=0;a<r;a++)M[a]=0|l[a][o],0!==M[a]&&(E=!1);if(!E)break;_++,o--}if(o>=0&&_++,w=w.dblp(_),o<0)break;for(a=0;a<r;a++){var N=M[a];0!==N&&(N>0?s=c[a][N-1>>1]:N<0&&(s=c[a][-N-1>>1].neg()),w="affine"===s.type?w.mixedAdd(s):w.add(s))}}for(o=0;o<r;o++)c[o]=null;return i?w:w.toP()},fP.BasePoint=mP,mP.prototype.eq=function(){throw new Error("Not implemented")},mP.prototype.validate=function(){return this.curve.validate(this)},fP.prototype.decodePoint=function(t,e){t=cP.toArray(t,e);var n=this.p.byteLength();if((4===t[0]||6===t[0]||7===t[0])&&t.length-1==2*n)return 6===t[0]?dP(t[t.length-1]%2==0):7===t[0]&&dP(t[t.length-1]%2==1),this.point(t.slice(1,1+n),t.slice(1+n,1+2*n));if((2===t[0]||3===t[0])&&t.length-1===n)return this.pointFromX(t.slice(1,1+n),3===t[0]);throw new Error("Unknown point format")},mP.prototype.encodeCompressed=function(t){return this.encode(t,!0)},mP.prototype._encode=function(t){var e=this.curve.p.byteLength(),n=this.getX().toArray("be",e);return t?[this.getY().isEven()?2:3].concat(n):[4].concat(n,this.getY().toArray("be",e))},mP.prototype.encode=function(t,e){return cP.encode(this._encode(e),t)},mP.prototype.precompute=function(t){if(this.precomputed)return this;var e={doubles:null,naf:null,beta:null};return e.naf=this._getNAFPoints(8),e.doubles=this._getDoubles(4,t),e.beta=this._getBeta(),this.precomputed=e,this},mP.prototype._hasDoubles=function(t){if(!this.precomputed)return!1;var e=this.precomputed.doubles;return!!e&&e.points.length>=Math.ceil((t.bitLength()+1)/e.step)},mP.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],r=this,i=0;i<e;i+=t){for(var o=0;o<t;o++)r=r.dbl();n.push(r)}return{step:t,points:n}},mP.prototype._getNAFPoints=function(t){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var e=[this],n=(1<<t)-1,r=1===n?null:this.dbl(),i=1;i<n;i++)e[i]=e[i-1].add(r);return{wnd:t,points:e}},mP.prototype._getBeta=function(){return null},mP.prototype.dblp=function(t){for(var e=this,n=0;n<t;n++)e=e.dbl();return e};var gP="function"==typeof Object.create?function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:function(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t},yP=XM(Object.freeze({__proto__:null,default:gP})),bP=$z.exports,vP=yP,wP=pP,MP=Xz.assert;function _P(t){wP.call(this,"short",t),this.a=new bP(t.a,16).toRed(this.red),this.b=new bP(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}vP(_P,wP);var EP=_P;function NP(t,e,n,r){wP.BasePoint.call(this,t,"affine"),null===e&&null===n?(this.x=null,this.y=null,this.inf=!0):(this.x=new bP(e,16),this.y=new bP(n,16),r&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function LP(t,e,n,r){wP.BasePoint.call(this,t,"jacobian"),null===e&&null===n&&null===r?(this.x=this.curve.one,this.y=this.curve.one,this.z=new bP(0)):(this.x=new bP(e,16),this.y=new bP(n,16),this.z=new bP(r,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}_P.prototype._getEndomorphism=function(t){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var e,n,r;if(t.beta)e=new bP(t.beta,16).toRed(this.red);else{var i=this._getEndoRoots(this.p);e=(e=i[0].cmp(i[1])<0?i[0]:i[1]).toRed(this.red)}if(t.lambda)n=new bP(t.lambda,16);else{var o=this._getEndoRoots(this.n);0===this.g.mul(o[0]).x.cmp(this.g.x.redMul(e))?n=o[0]:(n=o[1],MP(0===this.g.mul(n).x.cmp(this.g.x.redMul(e))))}return r=t.basis?t.basis.map((function(t){return{a:new bP(t.a,16),b:new bP(t.b,16)}})):this._getEndoBasis(n),{beta:e,lambda:n,basis:r}}},_P.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:bP.mont(t),n=new bP(2).toRed(e).redInvm(),r=n.redNeg(),i=new bP(3).toRed(e).redNeg().redSqrt().redMul(n);return[r.redAdd(i).fromRed(),r.redSub(i).fromRed()]},_P.prototype._getEndoBasis=function(t){for(var e,n,r,i,o,a,s,u,c,l=this.n.ushrn(Math.floor(this.n.bitLength()/2)),h=t,d=this.n.clone(),f=new bP(1),p=new bP(0),m=new bP(0),g=new bP(1),y=0;0!==h.cmpn(0);){var b=d.div(h);u=d.sub(b.mul(h)),c=m.sub(b.mul(f));var v=g.sub(b.mul(p));if(!r&&u.cmp(l)<0)e=s.neg(),n=f,r=u.neg(),i=c;else if(r&&2==++y)break;s=u,d=h,h=u,m=f,f=c,g=p,p=v}o=u.neg(),a=c;var w=r.sqr().add(i.sqr());return o.sqr().add(a.sqr()).cmp(w)>=0&&(o=e,a=n),r.negative&&(r=r.neg(),i=i.neg()),o.negative&&(o=o.neg(),a=a.neg()),[{a:r,b:i},{a:o,b:a}]},_P.prototype._endoSplit=function(t){var e=this.endo.basis,n=e[0],r=e[1],i=r.b.mul(t).divRound(this.n),o=n.b.neg().mul(t).divRound(this.n),a=i.mul(n.a),s=o.mul(r.a),u=i.mul(n.b),c=o.mul(r.b);return{k1:t.sub(a).sub(s),k2:u.add(c).neg()}},_P.prototype.pointFromX=function(t,e){(t=new bP(t,16)).red||(t=t.toRed(this.red));var n=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),r=n.redSqrt();if(0!==r.redSqr().redSub(n).cmp(this.zero))throw new Error("invalid point");var i=r.fromRed().isOdd();return(e&&!i||!e&&i)&&(r=r.redNeg()),this.point(t,r)},_P.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,n=t.y,r=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(r).redIAdd(this.b);return 0===n.redSqr().redISub(i).cmpn(0)},_P.prototype._endoWnafMulAdd=function(t,e,n){for(var r=this._endoWnafT1,i=this._endoWnafT2,o=0;o<t.length;o++){var a=this._endoSplit(e[o]),s=t[o],u=s._getBeta();a.k1.negative&&(a.k1.ineg(),s=s.neg(!0)),a.k2.negative&&(a.k2.ineg(),u=u.neg(!0)),r[2*o]=s,r[2*o+1]=u,i[2*o]=a.k1,i[2*o+1]=a.k2}for(var c=this._wnafMulAdd(1,r,i,2*o,n),l=0;l<2*o;l++)r[l]=null,i[l]=null;return c},vP(NP,wP.BasePoint),_P.prototype.point=function(t,e,n){return new NP(this,t,e,n)},_P.prototype.pointFromJSON=function(t,e){return NP.fromJSON(this,t,e)},NP.prototype._getBeta=function(){if(this.curve.endo){var t=this.precomputed;if(t&&t.beta)return t.beta;var e=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(t){var n=this.curve,r=function(t){return n.point(t.x.redMul(n.endo.beta),t.y)};t.beta=e,e.precomputed={beta:null,naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(r)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(r)}}}return e}},NP.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},NP.fromJSON=function(t,e,n){"string"==typeof e&&(e=JSON.parse(e));var r=t.point(e[0],e[1],n);if(!e[2])return r;function i(e){return t.point(e[0],e[1],n)}var o=e[2];return r.precomputed={beta:null,doubles:o.doubles&&{step:o.doubles.step,points:[r].concat(o.doubles.points.map(i))},naf:o.naf&&{wnd:o.naf.wnd,points:[r].concat(o.naf.points.map(i))}},r},NP.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},NP.prototype.isInfinity=function(){return this.inf},NP.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var n=e.redSqr().redISub(this.x).redISub(t.x),r=e.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,r)},NP.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,n=this.x.redSqr(),r=t.redInvm(),i=n.redAdd(n).redIAdd(n).redIAdd(e).redMul(r),o=i.redSqr().redISub(this.x.redAdd(this.x)),a=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},NP.prototype.getX=function(){return this.x.fromRed()},NP.prototype.getY=function(){return this.y.fromRed()},NP.prototype.mul=function(t){return t=new bP(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},NP.prototype.mulAdd=function(t,e,n){var r=[this,e],i=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i):this.curve._wnafMulAdd(1,r,i,2)},NP.prototype.jmulAdd=function(t,e,n){var r=[this,e],i=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i,!0):this.curve._wnafMulAdd(1,r,i,2,!0)},NP.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},NP.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var n=this.precomputed,r=function(t){return t.neg()};e.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(r)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(r)}}}return e},NP.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},vP(LP,wP.BasePoint),_P.prototype.jpoint=function(t,e,n){return new LP(this,t,e,n)},LP.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),n=this.x.redMul(e),r=this.y.redMul(e).redMul(t);return this.curve.point(n,r)},LP.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},LP.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),n=this.z.redSqr(),r=this.x.redMul(e),i=t.x.redMul(n),o=this.y.redMul(e.redMul(t.z)),a=t.y.redMul(n.redMul(this.z)),s=r.redSub(i),u=o.redSub(a);if(0===s.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=s.redSqr(),l=c.redMul(s),h=r.redMul(c),d=u.redSqr().redIAdd(l).redISub(h).redISub(h),f=u.redMul(h.redISub(d)).redISub(o.redMul(l)),p=this.z.redMul(t.z).redMul(s);return this.curve.jpoint(d,f,p)},LP.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),n=this.x,r=t.x.redMul(e),i=this.y,o=t.y.redMul(e).redMul(this.z),a=n.redSub(r),s=i.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),c=u.redMul(a),l=n.redMul(u),h=s.redSqr().redIAdd(c).redISub(l).redISub(l),d=s.redMul(l.redISub(h)).redISub(i.redMul(c)),f=this.z.redMul(a);return this.curve.jpoint(h,d,f)},LP.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var n=this;for(e=0;e<t;e++)n=n.dbl();return n}var r=this.curve.a,i=this.curve.tinv,o=this.x,a=this.y,s=this.z,u=s.redSqr().redSqr(),c=a.redAdd(a);for(e=0;e<t;e++){var l=o.redSqr(),h=c.redSqr(),d=h.redSqr(),f=l.redAdd(l).redIAdd(l).redIAdd(r.redMul(u)),p=o.redMul(h),m=f.redSqr().redISub(p.redAdd(p)),g=p.redISub(m),y=f.redMul(g);y=y.redIAdd(y).redISub(d);var b=c.redMul(s);e+1<t&&(u=u.redMul(d)),o=m,s=b,c=y}return this.curve.jpoint(o,c.redMul(i),s)},LP.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},LP.prototype._zeroDbl=function(){var t,e,n;if(this.zOne){var r=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),a=this.x.redAdd(i).redSqr().redISub(r).redISub(o);a=a.redIAdd(a);var s=r.redAdd(r).redIAdd(r),u=s.redSqr().redISub(a).redISub(a),c=o.redIAdd(o);c=(c=c.redIAdd(c)).redIAdd(c),t=u,e=s.redMul(a.redISub(u)).redISub(c),n=this.y.redAdd(this.y)}else{var l=this.x.redSqr(),h=this.y.redSqr(),d=h.redSqr(),f=this.x.redAdd(h).redSqr().redISub(l).redISub(d);f=f.redIAdd(f);var p=l.redAdd(l).redIAdd(l),m=p.redSqr(),g=d.redIAdd(d);g=(g=g.redIAdd(g)).redIAdd(g),t=m.redISub(f).redISub(f),e=p.redMul(f.redISub(t)).redISub(g),n=(n=this.y.redMul(this.z)).redIAdd(n)}return this.curve.jpoint(t,e,n)},LP.prototype._threeDbl=function(){var t,e,n;if(this.zOne){var r=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),a=this.x.redAdd(i).redSqr().redISub(r).redISub(o);a=a.redIAdd(a);var s=r.redAdd(r).redIAdd(r).redIAdd(this.curve.a),u=s.redSqr().redISub(a).redISub(a);t=u;var c=o.redIAdd(o);c=(c=c.redIAdd(c)).redIAdd(c),e=s.redMul(a.redISub(u)).redISub(c),n=this.y.redAdd(this.y)}else{var l=this.z.redSqr(),h=this.y.redSqr(),d=this.x.redMul(h),f=this.x.redSub(l).redMul(this.x.redAdd(l));f=f.redAdd(f).redIAdd(f);var p=d.redIAdd(d),m=(p=p.redIAdd(p)).redAdd(p);t=f.redSqr().redISub(m),n=this.y.redAdd(this.z).redSqr().redISub(h).redISub(l);var g=h.redSqr();g=(g=(g=g.redIAdd(g)).redIAdd(g)).redIAdd(g),e=f.redMul(p.redISub(t)).redISub(g)}return this.curve.jpoint(t,e,n)},LP.prototype._dbl=function(){var t=this.curve.a,e=this.x,n=this.y,r=this.z,i=r.redSqr().redSqr(),o=e.redSqr(),a=n.redSqr(),s=o.redAdd(o).redIAdd(o).redIAdd(t.redMul(i)),u=e.redAdd(e),c=(u=u.redIAdd(u)).redMul(a),l=s.redSqr().redISub(c.redAdd(c)),h=c.redISub(l),d=a.redSqr();d=(d=(d=d.redIAdd(d)).redIAdd(d)).redIAdd(d);var f=s.redMul(h).redISub(d),p=n.redAdd(n).redMul(r);return this.curve.jpoint(l,f,p)},LP.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var t=this.x.redSqr(),e=this.y.redSqr(),n=this.z.redSqr(),r=e.redSqr(),i=t.redAdd(t).redIAdd(t),o=i.redSqr(),a=this.x.redAdd(e).redSqr().redISub(t).redISub(r),s=(a=(a=(a=a.redIAdd(a)).redAdd(a).redIAdd(a)).redISub(o)).redSqr(),u=r.redIAdd(r);u=(u=(u=u.redIAdd(u)).redIAdd(u)).redIAdd(u);var c=i.redIAdd(a).redSqr().redISub(o).redISub(s).redISub(u),l=e.redMul(c);l=(l=l.redIAdd(l)).redIAdd(l);var h=this.x.redMul(s).redISub(l);h=(h=h.redIAdd(h)).redIAdd(h);var d=this.y.redMul(c.redMul(u.redISub(c)).redISub(a.redMul(s)));d=(d=(d=d.redIAdd(d)).redIAdd(d)).redIAdd(d);var f=this.z.redAdd(a).redSqr().redISub(n).redISub(s);return this.curve.jpoint(h,d,f)},LP.prototype.mul=function(t,e){return t=new bP(t,e),this.curve._wnafMul(this,t)},LP.prototype.eq=function(t){if("affine"===t.type)return this.eq(t.toJ());if(this===t)return!0;var e=this.z.redSqr(),n=t.z.redSqr();if(0!==this.x.redMul(n).redISub(t.x.redMul(e)).cmpn(0))return!1;var r=e.redMul(this.z),i=n.redMul(t.z);return 0===this.y.redMul(i).redISub(t.y.redMul(r)).cmpn(0)},LP.prototype.eqXToP=function(t){var e=this.z.redSqr(),n=t.toRed(this.curve.red).redMul(e);if(0===this.x.cmp(n))return!0;for(var r=t.clone(),i=this.curve.redN.redMul(e);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(n.redIAdd(i),0===this.x.cmp(n))return!0}},LP.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},LP.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var SP=$z.exports,AP=yP,xP=pP,TP=Xz;function IP(t){xP.call(this,"mont",t),this.a=new SP(t.a,16).toRed(this.red),this.b=new SP(t.b,16).toRed(this.red),this.i4=new SP(4).toRed(this.red).redInvm(),this.two=new SP(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}AP(IP,xP);var kP=IP;function jP(t,e,n){xP.BasePoint.call(this,t,"projective"),null===e&&null===n?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new SP(e,16),this.z=new SP(n,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}IP.prototype.validate=function(t){var e=t.normalize().x,n=e.redSqr(),r=n.redMul(e).redAdd(n.redMul(this.a)).redAdd(e);return 0===r.redSqrt().redSqr().cmp(r)},AP(jP,xP.BasePoint),IP.prototype.decodePoint=function(t,e){return this.point(TP.toArray(t,e),1)},IP.prototype.point=function(t,e){return new jP(this,t,e)},IP.prototype.pointFromJSON=function(t){return jP.fromJSON(this,t)},jP.prototype.precompute=function(){},jP.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},jP.fromJSON=function(t,e){return new jP(t,e[0],e[1]||t.one)},jP.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},jP.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},jP.prototype.dbl=function(){var t=this.x.redAdd(this.z).redSqr(),e=this.x.redSub(this.z).redSqr(),n=t.redSub(e),r=t.redMul(e),i=n.redMul(e.redAdd(this.curve.a24.redMul(n)));return this.curve.point(r,i)},jP.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},jP.prototype.diffAdd=function(t,e){var n=this.x.redAdd(this.z),r=this.x.redSub(this.z),i=t.x.redAdd(t.z),o=t.x.redSub(t.z).redMul(n),a=i.redMul(r),s=e.z.redMul(o.redAdd(a).redSqr()),u=e.x.redMul(o.redISub(a).redSqr());return this.curve.point(s,u)},jP.prototype.mul=function(t){for(var e=t.clone(),n=this,r=this.curve.point(null,null),i=[];0!==e.cmpn(0);e.iushrn(1))i.push(e.andln(1));for(var o=i.length-1;o>=0;o--)0===i[o]?(n=n.diffAdd(r,this),r=r.dbl()):(r=n.diffAdd(r,this),n=n.dbl());return r},jP.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},jP.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},jP.prototype.eq=function(t){return 0===this.getX().cmp(t.getX())},jP.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},jP.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var CP=$z.exports,DP=yP,OP=pP,zP=Xz.assert;function PP(t){this.twisted=1!=(0|t.a),this.mOneA=this.twisted&&-1==(0|t.a),this.extended=this.mOneA,OP.call(this,"edwards",t),this.a=new CP(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new CP(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new CP(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),zP(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|t.c)}DP(PP,OP);var RP=PP;function BP(t,e,n,r,i){OP.BasePoint.call(this,t,"projective"),null===e&&null===n&&null===r?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new CP(e,16),this.y=new CP(n,16),this.z=r?new CP(r,16):this.curve.one,this.t=i&&new CP(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}PP.prototype._mulA=function(t){return this.mOneA?t.redNeg():this.a.redMul(t)},PP.prototype._mulC=function(t){return this.oneC?t:this.c.redMul(t)},PP.prototype.jpoint=function(t,e,n,r){return this.point(t,e,n,r)},PP.prototype.pointFromX=function(t,e){(t=new CP(t,16)).red||(t=t.toRed(this.red));var n=t.redSqr(),r=this.c2.redSub(this.a.redMul(n)),i=this.one.redSub(this.c2.redMul(this.d).redMul(n)),o=r.redMul(i.redInvm()),a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");var s=a.fromRed().isOdd();return(e&&!s||!e&&s)&&(a=a.redNeg()),this.point(t,a)},PP.prototype.pointFromY=function(t,e){(t=new CP(t,16)).red||(t=t.toRed(this.red));var n=t.redSqr(),r=n.redSub(this.c2),i=n.redMul(this.d).redMul(this.c2).redSub(this.a),o=r.redMul(i.redInvm());if(0===o.cmp(this.zero)){if(e)throw new Error("invalid point");return this.point(this.zero,t)}var a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");return a.fromRed().isOdd()!==e&&(a=a.redNeg()),this.point(a,t)},PP.prototype.validate=function(t){if(t.isInfinity())return!0;t.normalize();var e=t.x.redSqr(),n=t.y.redSqr(),r=e.redMul(this.a).redAdd(n),i=this.c2.redMul(this.one.redAdd(this.d.redMul(e).redMul(n)));return 0===r.cmp(i)},DP(BP,OP.BasePoint),PP.prototype.pointFromJSON=function(t){return BP.fromJSON(this,t)},PP.prototype.point=function(t,e,n,r){return new BP(this,t,e,n,r)},BP.fromJSON=function(t,e){return new BP(t,e[0],e[1],e[2])},BP.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},BP.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},BP.prototype._extDbl=function(){var t=this.x.redSqr(),e=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var r=this.curve._mulA(t),i=this.x.redAdd(this.y).redSqr().redISub(t).redISub(e),o=r.redAdd(e),a=o.redSub(n),s=r.redSub(e),u=i.redMul(a),c=o.redMul(s),l=i.redMul(s),h=a.redMul(o);return this.curve.point(u,c,h,l)},BP.prototype._projDbl=function(){var t,e,n,r,i,o,a=this.x.redAdd(this.y).redSqr(),s=this.x.redSqr(),u=this.y.redSqr();if(this.curve.twisted){var c=(r=this.curve._mulA(s)).redAdd(u);this.zOne?(t=a.redSub(s).redSub(u).redMul(c.redSub(this.curve.two)),e=c.redMul(r.redSub(u)),n=c.redSqr().redSub(c).redSub(c)):(i=this.z.redSqr(),o=c.redSub(i).redISub(i),t=a.redSub(s).redISub(u).redMul(o),e=c.redMul(r.redSub(u)),n=c.redMul(o))}else r=s.redAdd(u),i=this.curve._mulC(this.z).redSqr(),o=r.redSub(i).redSub(i),t=this.curve._mulC(a.redISub(r)).redMul(o),e=this.curve._mulC(r).redMul(s.redISub(u)),n=r.redMul(o);return this.curve.point(t,e,n)},BP.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},BP.prototype._extAdd=function(t){var e=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),n=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),r=this.t.redMul(this.curve.dd).redMul(t.t),i=this.z.redMul(t.z.redAdd(t.z)),o=n.redSub(e),a=i.redSub(r),s=i.redAdd(r),u=n.redAdd(e),c=o.redMul(a),l=s.redMul(u),h=o.redMul(u),d=a.redMul(s);return this.curve.point(c,l,d,h)},BP.prototype._projAdd=function(t){var e,n,r=this.z.redMul(t.z),i=r.redSqr(),o=this.x.redMul(t.x),a=this.y.redMul(t.y),s=this.curve.d.redMul(o).redMul(a),u=i.redSub(s),c=i.redAdd(s),l=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(o).redISub(a),h=r.redMul(u).redMul(l);return this.curve.twisted?(e=r.redMul(c).redMul(a.redSub(this.curve._mulA(o))),n=u.redMul(c)):(e=r.redMul(c).redMul(a.redSub(o)),n=this.curve._mulC(u).redMul(c)),this.curve.point(h,e,n)},BP.prototype.add=function(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)},BP.prototype.mul=function(t){return this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)},BP.prototype.mulAdd=function(t,e,n){return this.curve._wnafMulAdd(1,[this,e],[t,n],2,!1)},BP.prototype.jmulAdd=function(t,e,n){return this.curve._wnafMulAdd(1,[this,e],[t,n],2,!0)},BP.prototype.normalize=function(){if(this.zOne)return this;var t=this.z.redInvm();return this.x=this.x.redMul(t),this.y=this.y.redMul(t),this.t&&(this.t=this.t.redMul(t)),this.z=this.curve.one,this.zOne=!0,this},BP.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},BP.prototype.getX=function(){return this.normalize(),this.x.fromRed()},BP.prototype.getY=function(){return this.normalize(),this.y.fromRed()},BP.prototype.eq=function(t){return this===t||0===this.getX().cmp(t.getX())&&0===this.getY().cmp(t.getY())},BP.prototype.eqXToP=function(t){var e=t.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(e))return!0;for(var n=t.clone(),r=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(e.redIAdd(r),0===this.x.cmp(e))return!0}},BP.prototype.toP=BP.prototype.normalize,BP.prototype.mixedAdd=BP.prototype.add,function(t){var e=t;e.base=pP,e.short=EP,e.mont=kP,e.edwards=RP}(sP);var UP={},FP={},WP={},YP=tP,QP=yP;function HP(t,e){return 55296==(64512&t.charCodeAt(e))&&(!(e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1)))}function GP(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function ZP(t){return 1===t.length?"0"+t:t}function VP(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}WP.inherits=QP,WP.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var n=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),i=0;i<t.length;i+=2)n.push(parseInt(t[i]+t[i+1],16))}else for(var r=0,i=0;i<t.length;i++){var o=t.charCodeAt(i);o<128?n[r++]=o:o<2048?(n[r++]=o>>6|192,n[r++]=63&o|128):HP(t,i)?(o=65536+((1023&o)<<10)+(1023&t.charCodeAt(++i)),n[r++]=o>>18|240,n[r++]=o>>12&63|128,n[r++]=o>>6&63|128,n[r++]=63&o|128):(n[r++]=o>>12|224,n[r++]=o>>6&63|128,n[r++]=63&o|128)}else for(i=0;i<t.length;i++)n[i]=0|t[i];return n},WP.toHex=function(t){for(var e="",n=0;n<t.length;n++)e+=ZP(t[n].toString(16));return e},WP.htonl=GP,WP.toHex32=function(t,e){for(var n="",r=0;r<t.length;r++){var i=t[r];"little"===e&&(i=GP(i)),n+=VP(i.toString(16))}return n},WP.zero2=ZP,WP.zero8=VP,WP.join32=function(t,e,n,r){var i=n-e;YP(i%4==0);for(var o=new Array(i/4),a=0,s=e;a<o.length;a++,s+=4){var u;u="big"===r?t[s]<<24|t[s+1]<<16|t[s+2]<<8|t[s+3]:t[s+3]<<24|t[s+2]<<16|t[s+1]<<8|t[s],o[a]=u>>>0}return o},WP.split32=function(t,e){for(var n=new Array(4*t.length),r=0,i=0;r<t.length;r++,i+=4){var o=t[r];"big"===e?(n[i]=o>>>24,n[i+1]=o>>>16&255,n[i+2]=o>>>8&255,n[i+3]=255&o):(n[i+3]=o>>>24,n[i+2]=o>>>16&255,n[i+1]=o>>>8&255,n[i]=255&o)}return n},WP.rotr32=function(t,e){return t>>>e|t<<32-e},WP.rotl32=function(t,e){return t<<e|t>>>32-e},WP.sum32=function(t,e){return t+e>>>0},WP.sum32_3=function(t,e,n){return t+e+n>>>0},WP.sum32_4=function(t,e,n,r){return t+e+n+r>>>0},WP.sum32_5=function(t,e,n,r,i){return t+e+n+r+i>>>0},WP.sum64=function(t,e,n,r){var i=t[e],o=r+t[e+1]>>>0,a=(o<r?1:0)+n+i;t[e]=a>>>0,t[e+1]=o},WP.sum64_hi=function(t,e,n,r){return(e+r>>>0<e?1:0)+t+n>>>0},WP.sum64_lo=function(t,e,n,r){return e+r>>>0},WP.sum64_4_hi=function(t,e,n,r,i,o,a,s){var u=0,c=e;return u+=(c=c+r>>>0)<e?1:0,u+=(c=c+o>>>0)<o?1:0,t+n+i+a+(u+=(c=c+s>>>0)<s?1:0)>>>0},WP.sum64_4_lo=function(t,e,n,r,i,o,a,s){return e+r+o+s>>>0},WP.sum64_5_hi=function(t,e,n,r,i,o,a,s,u,c){var l=0,h=e;return l+=(h=h+r>>>0)<e?1:0,l+=(h=h+o>>>0)<o?1:0,l+=(h=h+s>>>0)<s?1:0,t+n+i+a+u+(l+=(h=h+c>>>0)<c?1:0)>>>0},WP.sum64_5_lo=function(t,e,n,r,i,o,a,s,u,c){return e+r+o+s+c>>>0},WP.rotr64_hi=function(t,e,n){return(e<<32-n|t>>>n)>>>0},WP.rotr64_lo=function(t,e,n){return(t<<32-n|e>>>n)>>>0},WP.shr64_hi=function(t,e,n){return t>>>n},WP.shr64_lo=function(t,e,n){return(t<<32-n|e>>>n)>>>0};var qP={},JP=WP,KP=tP;function XP(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}qP.BlockHash=XP,XP.prototype.update=function(t,e){if(t=JP.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){var n=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-n,t.length),0===this.pending.length&&(this.pending=null),t=JP.join32(t,0,t.length-n,this.endian);for(var r=0;r<t.length;r+=this._delta32)this._update(t,r,r+this._delta32)}return this},XP.prototype.digest=function(t){return this.update(this._pad()),KP(null===this.pending),this._digest(t)},XP.prototype._pad=function(){var t=this.pendingTotal,e=this._delta8,n=e-(t+this.padLength)%e,r=new Array(n+this.padLength);r[0]=128;for(var i=1;i<n;i++)r[i]=0;if(t<<=3,"big"===this.endian){for(var o=8;o<this.padLength;o++)r[i++]=0;r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=t>>>24&255,r[i++]=t>>>16&255,r[i++]=t>>>8&255,r[i++]=255&t}else for(r[i++]=255&t,r[i++]=t>>>8&255,r[i++]=t>>>16&255,r[i++]=t>>>24&255,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,o=8;o<this.padLength;o++)r[i++]=0;return r};var $P={},tR={},eR=WP.rotr32;function nR(t,e,n){return t&e^~t&n}function rR(t,e,n){return t&e^t&n^e&n}function iR(t,e,n){return t^e^n}tR.ft_1=function(t,e,n,r){return 0===t?nR(e,n,r):1===t||3===t?iR(e,n,r):2===t?rR(e,n,r):void 0},tR.ch32=nR,tR.maj32=rR,tR.p32=iR,tR.s0_256=function(t){return eR(t,2)^eR(t,13)^eR(t,22)},tR.s1_256=function(t){return eR(t,6)^eR(t,11)^eR(t,25)},tR.g0_256=function(t){return eR(t,7)^eR(t,18)^t>>>3},tR.g1_256=function(t){return eR(t,17)^eR(t,19)^t>>>10};var oR=WP,aR=qP,sR=tR,uR=oR.rotl32,cR=oR.sum32,lR=oR.sum32_5,hR=sR.ft_1,dR=aR.BlockHash,fR=[1518500249,1859775393,2400959708,3395469782];function pR(){if(!(this instanceof pR))return new pR;dR.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}oR.inherits(pR,dR);var mR=pR;pR.blockSize=512,pR.outSize=160,pR.hmacStrength=80,pR.padLength=64,pR.prototype._update=function(t,e){for(var n=this.W,r=0;r<16;r++)n[r]=t[e+r];for(;r<n.length;r++)n[r]=uR(n[r-3]^n[r-8]^n[r-14]^n[r-16],1);var i=this.h[0],o=this.h[1],a=this.h[2],s=this.h[3],u=this.h[4];for(r=0;r<n.length;r++){var c=~~(r/20),l=lR(uR(i,5),hR(c,o,a,s),u,n[r],fR[c]);u=s,s=a,a=uR(o,30),o=i,i=l}this.h[0]=cR(this.h[0],i),this.h[1]=cR(this.h[1],o),this.h[2]=cR(this.h[2],a),this.h[3]=cR(this.h[3],s),this.h[4]=cR(this.h[4],u)},pR.prototype._digest=function(t){return"hex"===t?oR.toHex32(this.h,"big"):oR.split32(this.h,"big")};var gR=WP,yR=qP,bR=tR,vR=tP,wR=gR.sum32,MR=gR.sum32_4,_R=gR.sum32_5,ER=bR.ch32,NR=bR.maj32,LR=bR.s0_256,SR=bR.s1_256,AR=bR.g0_256,xR=bR.g1_256,TR=yR.BlockHash,IR=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function kR(){if(!(this instanceof kR))return new kR;TR.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=IR,this.W=new Array(64)}gR.inherits(kR,TR);var jR=kR;kR.blockSize=512,kR.outSize=256,kR.hmacStrength=192,kR.padLength=64,kR.prototype._update=function(t,e){for(var n=this.W,r=0;r<16;r++)n[r]=t[e+r];for(;r<n.length;r++)n[r]=MR(xR(n[r-2]),n[r-7],AR(n[r-15]),n[r-16]);var i=this.h[0],o=this.h[1],a=this.h[2],s=this.h[3],u=this.h[4],c=this.h[5],l=this.h[6],h=this.h[7];for(vR(this.k.length===n.length),r=0;r<n.length;r++){var d=_R(h,SR(u),ER(u,c,l),this.k[r],n[r]),f=wR(LR(i),NR(i,o,a));h=l,l=c,c=u,u=wR(s,d),s=a,a=o,o=i,i=wR(d,f)}this.h[0]=wR(this.h[0],i),this.h[1]=wR(this.h[1],o),this.h[2]=wR(this.h[2],a),this.h[3]=wR(this.h[3],s),this.h[4]=wR(this.h[4],u),this.h[5]=wR(this.h[5],c),this.h[6]=wR(this.h[6],l),this.h[7]=wR(this.h[7],h)},kR.prototype._digest=function(t){return"hex"===t?gR.toHex32(this.h,"big"):gR.split32(this.h,"big")};var CR=WP,DR=jR;function OR(){if(!(this instanceof OR))return new OR;DR.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}CR.inherits(OR,DR);var zR=OR;OR.blockSize=512,OR.outSize=224,OR.hmacStrength=192,OR.padLength=64,OR.prototype._digest=function(t){return"hex"===t?CR.toHex32(this.h.slice(0,7),"big"):CR.split32(this.h.slice(0,7),"big")};var PR=WP,RR=qP,BR=tP,UR=PR.rotr64_hi,FR=PR.rotr64_lo,WR=PR.shr64_hi,YR=PR.shr64_lo,QR=PR.sum64,HR=PR.sum64_hi,GR=PR.sum64_lo,ZR=PR.sum64_4_hi,VR=PR.sum64_4_lo,qR=PR.sum64_5_hi,JR=PR.sum64_5_lo,KR=RR.BlockHash,XR=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function $R(){if(!(this instanceof $R))return new $R;KR.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=XR,this.W=new Array(160)}PR.inherits($R,KR);var tB=$R;function eB(t,e,n,r,i){var o=t&n^~t&i;return o<0&&(o+=4294967296),o}function nB(t,e,n,r,i,o){var a=e&r^~e&o;return a<0&&(a+=4294967296),a}function rB(t,e,n,r,i){var o=t&n^t&i^n&i;return o<0&&(o+=4294967296),o}function iB(t,e,n,r,i,o){var a=e&r^e&o^r&o;return a<0&&(a+=4294967296),a}function oB(t,e){var n=UR(t,e,28)^UR(e,t,2)^UR(e,t,7);return n<0&&(n+=4294967296),n}function aB(t,e){var n=FR(t,e,28)^FR(e,t,2)^FR(e,t,7);return n<0&&(n+=4294967296),n}function sB(t,e){var n=UR(t,e,14)^UR(t,e,18)^UR(e,t,9);return n<0&&(n+=4294967296),n}function uB(t,e){var n=FR(t,e,14)^FR(t,e,18)^FR(e,t,9);return n<0&&(n+=4294967296),n}function cB(t,e){var n=UR(t,e,1)^UR(t,e,8)^WR(t,e,7);return n<0&&(n+=4294967296),n}function lB(t,e){var n=FR(t,e,1)^FR(t,e,8)^YR(t,e,7);return n<0&&(n+=4294967296),n}function hB(t,e){var n=UR(t,e,19)^UR(e,t,29)^WR(t,e,6);return n<0&&(n+=4294967296),n}function dB(t,e){var n=FR(t,e,19)^FR(e,t,29)^YR(t,e,6);return n<0&&(n+=4294967296),n}$R.blockSize=1024,$R.outSize=512,$R.hmacStrength=192,$R.padLength=128,$R.prototype._prepareBlock=function(t,e){for(var n=this.W,r=0;r<32;r++)n[r]=t[e+r];for(;r<n.length;r+=2){var i=hB(n[r-4],n[r-3]),o=dB(n[r-4],n[r-3]),a=n[r-14],s=n[r-13],u=cB(n[r-30],n[r-29]),c=lB(n[r-30],n[r-29]),l=n[r-32],h=n[r-31];n[r]=ZR(i,o,a,s,u,c,l,h),n[r+1]=VR(i,o,a,s,u,c,l,h)}},$R.prototype._update=function(t,e){this._prepareBlock(t,e);var n=this.W,r=this.h[0],i=this.h[1],o=this.h[2],a=this.h[3],s=this.h[4],u=this.h[5],c=this.h[6],l=this.h[7],h=this.h[8],d=this.h[9],f=this.h[10],p=this.h[11],m=this.h[12],g=this.h[13],y=this.h[14],b=this.h[15];BR(this.k.length===n.length);for(var v=0;v<n.length;v+=2){var w=y,M=b,_=sB(h,d),E=uB(h,d),N=eB(h,d,f,p,m),L=nB(h,d,f,p,m,g),S=this.k[v],A=this.k[v+1],x=n[v],T=n[v+1],I=qR(w,M,_,E,N,L,S,A,x,T),k=JR(w,M,_,E,N,L,S,A,x,T);w=oB(r,i),M=aB(r,i),_=rB(r,i,o,a,s),E=iB(r,i,o,a,s,u);var j=HR(w,M,_,E),C=GR(w,M,_,E);y=m,b=g,m=f,g=p,f=h,p=d,h=HR(c,l,I,k),d=GR(l,l,I,k),c=s,l=u,s=o,u=a,o=r,a=i,r=HR(I,k,j,C),i=GR(I,k,j,C)}QR(this.h,0,r,i),QR(this.h,2,o,a),QR(this.h,4,s,u),QR(this.h,6,c,l),QR(this.h,8,h,d),QR(this.h,10,f,p),QR(this.h,12,m,g),QR(this.h,14,y,b)},$R.prototype._digest=function(t){return"hex"===t?PR.toHex32(this.h,"big"):PR.split32(this.h,"big")};var fB=WP,pB=tB;function mB(){if(!(this instanceof mB))return new mB;pB.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}fB.inherits(mB,pB);var gB=mB;mB.blockSize=1024,mB.outSize=384,mB.hmacStrength=192,mB.padLength=128,mB.prototype._digest=function(t){return"hex"===t?fB.toHex32(this.h.slice(0,12),"big"):fB.split32(this.h.slice(0,12),"big")},$P.sha1=mR,$P.sha224=zR,$P.sha256=jR,$P.sha384=gB,$P.sha512=tB;var yB={},bB=WP,vB=qP,wB=bB.rotl32,MB=bB.sum32,_B=bB.sum32_3,EB=bB.sum32_4,NB=vB.BlockHash;function LB(){if(!(this instanceof LB))return new LB;NB.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function SB(t,e,n,r){return t<=15?e^n^r:t<=31?e&n|~e&r:t<=47?(e|~n)^r:t<=63?e&r|n&~r:e^(n|~r)}function AB(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function xB(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}bB.inherits(LB,NB),yB.ripemd160=LB,LB.blockSize=512,LB.outSize=160,LB.hmacStrength=192,LB.padLength=64,LB.prototype._update=function(t,e){for(var n=this.h[0],r=this.h[1],i=this.h[2],o=this.h[3],a=this.h[4],s=n,u=r,c=i,l=o,h=a,d=0;d<80;d++){var f=MB(wB(EB(n,SB(d,r,i,o),t[TB[d]+e],AB(d)),kB[d]),a);n=a,a=o,o=wB(i,10),i=r,r=f,f=MB(wB(EB(s,SB(79-d,u,c,l),t[IB[d]+e],xB(d)),jB[d]),h),s=h,h=l,l=wB(c,10),c=u,u=f}f=_B(this.h[1],i,l),this.h[1]=_B(this.h[2],o,h),this.h[2]=_B(this.h[3],a,s),this.h[3]=_B(this.h[4],n,u),this.h[4]=_B(this.h[0],r,c),this.h[0]=f},LB.prototype._digest=function(t){return"hex"===t?bB.toHex32(this.h,"little"):bB.split32(this.h,"little")};var TB=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],IB=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],kB=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],jB=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],CB=WP,DB=tP;function OB(t,e,n){if(!(this instanceof OB))return new OB(t,e,n);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(CB.toArray(e,n))}var zB,PB,RB=OB;OB.prototype._init=function(t){t.length>this.blockSize&&(t=(new this.Hash).update(t).digest()),DB(t.length<=this.blockSize);for(var e=t.length;e<this.blockSize;e++)t.push(0);for(e=0;e<t.length;e++)t[e]^=54;for(this.inner=(new this.Hash).update(t),e=0;e<t.length;e++)t[e]^=106;this.outer=(new this.Hash).update(t)},OB.prototype.update=function(t,e){return this.inner.update(t,e),this},OB.prototype.digest=function(t){return this.outer.update(this.inner.digest()),this.outer.digest(t)},function(t){var e=FP;e.utils=WP,e.common=qP,e.sha=$P,e.ripemd=yB,e.hmac=RB,e.sha1=e.sha.sha1,e.sha256=e.sha.sha256,e.sha224=e.sha.sha224,e.sha384=e.sha.sha384,e.sha512=e.sha.sha512,e.ripemd160=e.ripemd.ripemd160}(),function(t){var e,n=UP,r=FP,i=sP,o=Xz.assert;function a(t){"short"===t.type?this.curve=new i.short(t):"edwards"===t.type?this.curve=new i.edwards(t):this.curve=new i.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,o(this.g.validate(),"Invalid curve"),o(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function s(t,e){Object.defineProperty(n,t,{configurable:!0,enumerable:!0,get:function(){var r=new a(e);return Object.defineProperty(n,t,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=a,s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:r.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:r.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:r.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:r.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:r.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{e=PB?zB:(PB=1,zB={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}})}catch(t){e=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:r.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",e]})}();var BB=FP,UB=nP,FB=tP;function WB(t){if(!(this instanceof WB))return new WB(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=UB.toArray(t.entropy,t.entropyEnc||"hex"),n=UB.toArray(t.nonce,t.nonceEnc||"hex"),r=UB.toArray(t.pers,t.persEnc||"hex");FB(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,n,r)}var YB=WB;WB.prototype._init=function(t,e,n){var r=t.concat(e).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i<this.V.length;i++)this.K[i]=0,this.V[i]=1;this._update(r),this._reseed=1,this.reseedInterval=281474976710656},WB.prototype._hmac=function(){return new BB.hmac(this.hash,this.K)},WB.prototype._update=function(t){var e=this._hmac().update(this.V).update([0]);t&&(e=e.update(t)),this.K=e.digest(),this.V=this._hmac().update(this.V).digest(),t&&(this.K=this._hmac().update(this.V).update([1]).update(t).digest(),this.V=this._hmac().update(this.V).digest())},WB.prototype.reseed=function(t,e,n,r){"string"!=typeof e&&(r=n,n=e,e=null),t=UB.toArray(t,e),n=UB.toArray(n,r),FB(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(n||[])),this._reseed=1},WB.prototype.generate=function(t,e,n,r){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(r=n,n=e,e=null),n&&(n=UB.toArray(n,r||"hex"),this._update(n));for(var i=[];i.length<t;)this.V=this._hmac().update(this.V).digest(),i=i.concat(this.V);var o=i.slice(0,t);return this._update(n),this._reseed++,UB.encode(o,e)};var QB=$z.exports,HB=Xz.assert;function GB(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}var ZB=GB;GB.fromPublic=function(t,e,n){return e instanceof GB?e:new GB(t,{pub:e,pubEnc:n})},GB.fromPrivate=function(t,e,n){return e instanceof GB?e:new GB(t,{priv:e,privEnc:n})},GB.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},GB.prototype.getPublic=function(t,e){return"string"==typeof t&&(e=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),e?this.pub.encode(e,t):this.pub},GB.prototype.getPrivate=function(t){return"hex"===t?this.priv.toString(16,2):this.priv},GB.prototype._importPrivate=function(t,e){this.priv=new QB(t,e||16),this.priv=this.priv.umod(this.ec.curve.n)},GB.prototype._importPublic=function(t,e){if(t.x||t.y)return"mont"===this.ec.curve.type?HB(t.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||HB(t.x&&t.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(t.x,t.y));this.pub=this.ec.curve.decodePoint(t,e)},GB.prototype.derive=function(t){return t.validate()||HB(t.validate(),"public point not validated"),t.mul(this.priv).getX()},GB.prototype.sign=function(t,e,n){return this.ec.sign(t,this,e,n)},GB.prototype.verify=function(t,e){return this.ec.verify(t,e,this)},GB.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var VB=$z.exports,qB=Xz,JB=qB.assert;function KB(t,e){if(t instanceof KB)return t;this._importDER(t,e)||(JB(t.r&&t.s,"Signature without r or s"),this.r=new VB(t.r,16),this.s=new VB(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var XB=KB;function $B(){this.place=0}function tU(t,e){var n=t[e.place++];if(!(128&n))return n;var r=15&n;if(0===r||r>4)return!1;for(var i=0,o=0,a=e.place;o<r;o++,a++)i<<=8,i|=t[a],i>>>=0;return!(i<=127)&&(e.place=a,i)}function eU(t){for(var e=0,n=t.length-1;!t[e]&&!(128&t[e+1])&&e<n;)e++;return 0===e?t:t.slice(e)}function nU(t,e){if(e<128)t.push(e);else{var n=1+(Math.log(e)/Math.LN2>>>3);for(t.push(128|n);--n;)t.push(e>>>(n<<3)&255);t.push(e)}}KB.prototype._importDER=function(t,e){t=qB.toArray(t,e);var n=new $B;if(48!==t[n.place++])return!1;var r=tU(t,n);if(!1===r)return!1;if(r+n.place!==t.length)return!1;if(2!==t[n.place++])return!1;var i=tU(t,n);if(!1===i)return!1;var o=t.slice(n.place,i+n.place);if(n.place+=i,2!==t[n.place++])return!1;var a=tU(t,n);if(!1===a)return!1;if(t.length!==a+n.place)return!1;var s=t.slice(n.place,a+n.place);if(0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}return this.r=new VB(o),this.s=new VB(s),this.recoveryParam=null,!0},KB.prototype.toDER=function(t){var e=this.r.toArray(),n=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&n[0]&&(n=[0].concat(n)),e=eU(e),n=eU(n);!(n[0]||128&n[1]);)n=n.slice(1);var r=[2];nU(r,e.length),(r=r.concat(e)).push(2),nU(r,n.length);var i=r.concat(n),o=[48];return nU(o,i.length),o=o.concat(i),qB.encode(o,t)};var rU=$z.exports,iU=YB,oU=Xz,aU=UP,sU=iP.exports,uU=oU.assert,cU=ZB,lU=XB;function hU(t){if(!(this instanceof hU))return new hU(t);"string"==typeof t&&(uU(Object.prototype.hasOwnProperty.call(aU,t),"Unknown curve "+t),t=aU[t]),t instanceof aU.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var dU=hU;hU.prototype.keyPair=function(t){return new cU(this,t)},hU.prototype.keyFromPrivate=function(t,e){return cU.fromPrivate(this,t,e)},hU.prototype.keyFromPublic=function(t,e){return cU.fromPublic(this,t,e)},hU.prototype.genKeyPair=function(t){t||(t={});for(var e=new iU({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||sU(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),r=this.n.sub(new rU(2));;){var i=new rU(e.generate(n));if(!(i.cmp(r)>0))return i.iaddn(1),this.keyFromPrivate(i)}},hU.prototype._truncateToN=function(t,e){var n=8*t.byteLength()-this.n.bitLength();return n>0&&(t=t.ushrn(n)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},hU.prototype.sign=function(t,e,n,r){"object"==typeof n&&(r=n,n=null),r||(r={}),e=this.keyFromPrivate(e,n),t=this._truncateToN(new rU(t,16));for(var i=this.n.byteLength(),o=e.getPrivate().toArray("be",i),a=t.toArray("be",i),s=new iU({hash:this.hash,entropy:o,nonce:a,pers:r.pers,persEnc:r.persEnc||"utf8"}),u=this.n.sub(new rU(1)),c=0;;c++){var l=r.k?r.k(c):new rU(s.generate(this.n.byteLength()));if(!((l=this._truncateToN(l,!0)).cmpn(1)<=0||l.cmp(u)>=0)){var h=this.g.mul(l);if(!h.isInfinity()){var d=h.getX(),f=d.umod(this.n);if(0!==f.cmpn(0)){var p=l.invm(this.n).mul(f.mul(e.getPrivate()).iadd(t));if(0!==(p=p.umod(this.n)).cmpn(0)){var m=(h.getY().isOdd()?1:0)|(0!==d.cmp(f)?2:0);return r.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),m^=1),new lU({r:f,s:p,recoveryParam:m})}}}}}},hU.prototype.verify=function(t,e,n,r){t=this._truncateToN(new rU(t,16)),n=this.keyFromPublic(n,r);var i=(e=new lU(e,"hex")).r,o=e.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a,s=o.invm(this.n),u=s.mul(t).umod(this.n),c=s.mul(i).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(u,n.getPublic(),c)).isInfinity()&&a.eqXToP(i):!(a=this.g.mulAdd(u,n.getPublic(),c)).isInfinity()&&0===a.getX().umod(this.n).cmp(i)},hU.prototype.recoverPubKey=function(t,e,n,r){uU((3&n)===n,"The recovery param is more than two bits"),e=new lU(e,r);var i=this.n,o=new rU(t),a=e.r,s=e.s,u=1&n,c=n>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&c)throw new Error("Unable to find sencond key candinate");a=c?this.curve.pointFromX(a.add(this.curve.n),u):this.curve.pointFromX(a,u);var l=e.r.invm(i),h=i.sub(o).mul(l).umod(i),d=s.mul(l).umod(i);return this.g.mulAdd(h,a,d)},hU.prototype.getKeyRecoveryParam=function(t,e,n,r){if(null!==(e=new lU(e,r)).recoveryParam)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch(t){continue}if(o.eq(n))return i}throw new Error("Unable to find valid recovery factor")};var fU=Xz,pU=fU.assert,mU=fU.parseBytes,gU=fU.cachedProperty;function yU(t,e){this.eddsa=t,this._secret=mU(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=mU(e.pub)}yU.fromPublic=function(t,e){return e instanceof yU?e:new yU(t,{pub:e})},yU.fromSecret=function(t,e){return e instanceof yU?e:new yU(t,{secret:e})},yU.prototype.secret=function(){return this._secret},gU(yU,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),gU(yU,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),gU(yU,"privBytes",(function(){var t=this.eddsa,e=this.hash(),n=t.encodingLength-1,r=e.slice(0,t.encodingLength);return r[0]&=248,r[n]&=127,r[n]|=64,r})),gU(yU,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),gU(yU,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),gU(yU,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),yU.prototype.sign=function(t){return pU(this._secret,"KeyPair can only verify"),this.eddsa.sign(t,this)},yU.prototype.verify=function(t,e){return this.eddsa.verify(t,e,this)},yU.prototype.getSecret=function(t){return pU(this._secret,"KeyPair is public only"),fU.encode(this.secret(),t)},yU.prototype.getPublic=function(t){return fU.encode(this.pubBytes(),t)};var bU=yU,vU=$z.exports,wU=Xz,MU=wU.assert,_U=wU.cachedProperty,EU=wU.parseBytes;function NU(t,e){this.eddsa=t,"object"!=typeof e&&(e=EU(e)),Array.isArray(e)&&(e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),MU(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof vU&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}_U(NU,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),_U(NU,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),_U(NU,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),_U(NU,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),NU.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},NU.prototype.toHex=function(){return wU.encode(this.toBytes(),"hex").toUpperCase()};var LU=NU,SU=FP,AU=UP,xU=Xz,TU=xU.assert,IU=xU.parseBytes,kU=bU,jU=LU;function CU(t){if(TU("ed25519"===t,"only tested with ed25519 so far"),!(this instanceof CU))return new CU(t);t=AU[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=SU.sha512}var DU=CU;CU.prototype.sign=function(t,e){t=IU(t);var n=this.keyFromSecret(e),r=this.hashInt(n.messagePrefix(),t),i=this.g.mul(r),o=this.encodePoint(i),a=this.hashInt(o,n.pubBytes(),t).mul(n.priv()),s=r.add(a).umod(this.curve.n);return this.makeSignature({R:i,S:s,Rencoded:o})},CU.prototype.verify=function(t,e,n){t=IU(t),e=this.makeSignature(e);var r=this.keyFromPublic(n),i=this.hashInt(e.Rencoded(),r.pubBytes(),t),o=this.g.mul(e.S());return e.R().add(r.pub().mul(i)).eq(o)},CU.prototype.hashInt=function(){for(var t=this.hash(),e=0;e<arguments.length;e++)t.update(arguments[e]);return xU.intFromLE(t.digest()).umod(this.curve.n)},CU.prototype.keyFromPublic=function(t){return kU.fromPublic(this,t)},CU.prototype.keyFromSecret=function(t){return kU.fromSecret(this,t)},CU.prototype.makeSignature=function(t){return t instanceof jU?t:new jU(this,t)},CU.prototype.encodePoint=function(t){var e=t.getY().toArray("le",this.encodingLength);return e[this.encodingLength-1]|=t.getX().isOdd()?128:0,e},CU.prototype.decodePoint=function(t){var e=(t=xU.parseBytes(t)).length-1,n=t.slice(0,e).concat(-129&t[e]),r=0!=(128&t[e]),i=xU.intFromLE(n);return this.curve.pointFromY(i,r)},CU.prototype.encodeInt=function(t){return t.toArray("le",this.encodingLength)},CU.prototype.decodeInt=function(t){return xU.intFromLE(t)},CU.prototype.isPoint=function(t){return t instanceof this.pointClass},function(t){var e=Jz;e.version=Kz,e.utils=Xz,e.rand=iP.exports,e.curve=sP,e.curves=UP,e.ec=dU,e.eddsa=DU}();const OU=new(0,Jz.ec)("secp256k1"),zU=OU.curve,PU=zU.n.constructor;function RU(t){const e=t[0];switch(e){case 2:case 3:return 33!==t.length?null:function(t,e){let n=new PU(e);if(n.cmp(zU.p)>=0)return null;n=n.toRed(zU.red);let r=n.redSqr().redIMul(n).redIAdd(zU.b).redSqrt();return 3===t!==r.isOdd()&&(r=r.redNeg()),OU.keyPair({pub:{x:n,y:r}})}(e,t.subarray(1,33));case 4:case 6:case 7:return 65!==t.length?null:function(t,e,n){let r=new PU(e),i=new PU(n);if(r.cmp(zU.p)>=0||i.cmp(zU.p)>=0)return null;if(r=r.toRed(zU.red),i=i.toRed(zU.red),(6===t||7===t)&&i.isOdd()!==(7===t))return null;const o=r.redSqr().redIMul(r);return i.redSqr().redISub(o.redIAdd(zU.b)).isZero()?OU.keyPair({pub:{x:r,y:i}}):null}(e,t.subarray(1,33),t.subarray(33,65));default:return null}}function BU(t,e){const n=e.encode(null,33===t.length);for(let e=0;e<t.length;++e)t[e]=n[e]}var UU={contextRandomize:()=>0,privateKeyVerify(t){const e=new PU(t);return e.cmp(zU.n)<0&&!e.isZero()?0:1},privateKeyNegate(t){const e=new PU(t),n=zU.n.sub(e).umod(zU.n).toArrayLike(Uint8Array,"be",32);return t.set(n),0},privateKeyTweakAdd(t,e){const n=new PU(e);if(n.cmp(zU.n)>=0)return 1;if(n.iadd(new PU(t)),n.cmp(zU.n)>=0&&n.isub(zU.n),n.isZero())return 1;const r=n.toArrayLike(Uint8Array,"be",32);return t.set(r),0},privateKeyTweakMul(t,e){let n=new PU(e);if(n.cmp(zU.n)>=0||n.isZero())return 1;n.imul(new PU(t)),n.cmp(zU.n)>=0&&(n=n.umod(zU.n));const r=n.toArrayLike(Uint8Array,"be",32);return t.set(r),0},publicKeyVerify:t=>null===RU(t)?1:0,publicKeyCreate(t,e){const n=new PU(e);if(n.cmp(zU.n)>=0||n.isZero())return 1;return BU(t,OU.keyFromPrivate(e).getPublic()),0},publicKeyConvert(t,e){const n=RU(e);if(null===n)return 1;return BU(t,n.getPublic()),0},publicKeyNegate(t,e){const n=RU(e);if(null===n)return 1;const r=n.getPublic();return r.y=r.y.redNeg(),BU(t,r),0},publicKeyCombine(t,e){const n=new Array(e.length);for(let t=0;t<e.length;++t)if(n[t]=RU(e[t]),null===n[t])return 1;let r=n[0].getPublic();for(let t=1;t<n.length;++t)r=r.add(n[t].pub);return r.isInfinity()?2:(BU(t,r),0)},publicKeyTweakAdd(t,e,n){const r=RU(e);if(null===r)return 1;if((n=new PU(n)).cmp(zU.n)>=0)return 2;const i=r.getPublic().add(zU.g.mul(n));return i.isInfinity()?2:(BU(t,i),0)},publicKeyTweakMul(t,e,n){const r=RU(e);if(null===r)return 1;if((n=new PU(n)).cmp(zU.n)>=0||n.isZero())return 2;return BU(t,r.getPublic().mul(n)),0},signatureNormalize(t){const e=new PU(t.subarray(0,32)),n=new PU(t.subarray(32,64));return e.cmp(zU.n)>=0||n.cmp(zU.n)>=0?1:(1===n.cmp(OU.nh)&&t.set(zU.n.sub(n).toArrayLike(Uint8Array,"be",32),32),0)},signatureExport(t,e){const n=e.subarray(0,32),r=e.subarray(32,64);if(new PU(n).cmp(zU.n)>=0)return 1;if(new PU(r).cmp(zU.n)>=0)return 1;const{output:i}=t;let o=i.subarray(4,37);o[0]=0,o.set(n,1);let a=33,s=0;for(;a>1&&0===o[s]&&!(128&o[s+1]);--a,++s);if(o=o.subarray(s),128&o[0])return 1;if(a>1&&0===o[0]&&!(128&o[1]))return 1;let u=i.subarray(39,72);u[0]=0,u.set(r,1);let c=33,l=0;for(;c>1&&0===u[l]&&!(128&u[l+1]);--c,++l);return u=u.subarray(l),128&u[0]||c>1&&0===u[0]&&!(128&u[1])?1:(t.outputlen=6+a+c,i[0]=48,i[1]=t.outputlen-2,i[2]=2,i[3]=o.length,i.set(o,4),i[4+a]=2,i[5+a]=u.length,i.set(u,6+a),0)},signatureImport(t,e){if(e.length<8)return 1;if(e.length>72)return 1;if(48!==e[0])return 1;if(e[1]!==e.length-2)return 1;if(2!==e[2])return 1;const n=e[3];if(0===n)return 1;if(5+n>=e.length)return 1;if(2!==e[4+n])return 1;const r=e[5+n];if(0===r)return 1;if(6+n+r!==e.length)return 1;if(128&e[4])return 1;if(n>1&&0===e[4]&&!(128&e[5]))return 1;if(128&e[n+6])return 1;if(r>1&&0===e[n+6]&&!(128&e[n+7]))return 1;let i=e.subarray(4,4+n);if(33===i.length&&0===i[0]&&(i=i.subarray(1)),i.length>32)return 1;let o=e.subarray(6+n);if(33===o.length&&0===o[0]&&(o=o.slice(1)),o.length>32)throw new Error("S length is too long");let a=new PU(i);a.cmp(zU.n)>=0&&(a=new PU(0));let s=new PU(e.subarray(6+n));return s.cmp(zU.n)>=0&&(s=new PU(0)),t.set(a.toArrayLike(Uint8Array,"be",32),0),t.set(s.toArrayLike(Uint8Array,"be",32),32),0},ecdsaSign(t,e,n,r,i){if(i){const t=i;i=i=>{const o=t(e,n,null,r,i);if(!(o instanceof Uint8Array&&32===o.length))throw new Error("This is the way");return new PU(o)}}const o=new PU(n);if(o.cmp(zU.n)>=0||o.isZero())return 1;let a;try{a=OU.sign(e,n,{canonical:!0,k:i,pers:r})}catch(t){return 1}return t.signature.set(a.r.toArrayLike(Uint8Array,"be",32),0),t.signature.set(a.s.toArrayLike(Uint8Array,"be",32),32),t.recid=a.recoveryParam,0},ecdsaVerify(t,e,n){const r={r:t.subarray(0,32),s:t.subarray(32,64)},i=new PU(r.r),o=new PU(r.s);if(i.cmp(zU.n)>=0||o.cmp(zU.n)>=0)return 1;if(1===o.cmp(OU.nh)||i.isZero()||o.isZero())return 3;const a=RU(n);if(null===a)return 2;const s=a.getPublic();return OU.verify(e,r,s)?0:3},ecdsaRecover(t,e,n,r){const i={r:e.slice(0,32),s:e.slice(32,64)},o=new PU(i.r),a=new PU(i.s);if(o.cmp(zU.n)>=0||a.cmp(zU.n)>=0)return 1;if(o.isZero()||a.isZero())return 2;let s;try{s=OU.recoverPubKey(r,i,n)}catch(t){return 2}return BU(t,s),0},ecdh(t,e,n,r,i,o,a){const s=RU(e);if(null===s)return 1;const u=new PU(n);if(u.cmp(zU.n)>=0||u.isZero())return 2;const c=s.getPublic().mul(u);if(void 0===i){const e=c.encode(null,!0),n=OU.hash().update(e).digest();for(let e=0;e<32;++e)t[e]=n[e]}else{o||(o=new Uint8Array(32));const e=c.getX().toArray("be",32);for(let t=0;t<32;++t)o[t]=e[t];a||(a=new Uint8Array(32));const n=c.getY().toArray("be",32);for(let t=0;t<32;++t)a[t]=n[t];const s=i(o,a,r);if(!(s instanceof Uint8Array&&s.length===t.length))return 2;t.set(s)}return 0}},FU=(t=>({contextRandomize(e){if(Hz(null===e||e instanceof Uint8Array,"Expected seed to be an Uint8Array or null"),null!==e&&Gz("seed",e,32),1===t.contextRandomize(e))throw new Error(zz)},privateKeyVerify:e=>(Gz("private key",e,32),0===t.privateKeyVerify(e)),privateKeyNegate(e){switch(Gz("private key",e,32),t.privateKeyNegate(e)){case 0:return e;case 1:throw new Error(Cz)}},privateKeyTweakAdd(e,n){switch(Gz("private key",e,32),Gz("tweak",n,32),t.privateKeyTweakAdd(e,n)){case 0:return e;case 1:throw new Error(Dz)}},privateKeyTweakMul(e,n){switch(Gz("private key",e,32),Gz("tweak",n,32),t.privateKeyTweakMul(e,n)){case 0:return e;case 1:throw new Error(Oz)}},publicKeyVerify:e=>(Gz("public key",e,[33,65]),0===t.publicKeyVerify(e)),publicKeyCreate(e,n=!0,r){switch(Gz("private key",e,32),Zz(n),r=Vz(r,n?33:65),t.publicKeyCreate(r,e)){case 0:return r;case 1:throw new Error(Pz);case 2:throw new Error(Bz)}},publicKeyConvert(e,n=!0,r){switch(Gz("public key",e,[33,65]),Zz(n),r=Vz(r,n?33:65),t.publicKeyConvert(r,e)){case 0:return r;case 1:throw new Error(Rz);case 2:throw new Error(Bz)}},publicKeyNegate(e,n=!0,r){switch(Gz("public key",e,[33,65]),Zz(n),r=Vz(r,n?33:65),t.publicKeyNegate(r,e)){case 0:return r;case 1:throw new Error(Rz);case 2:throw new Error(Cz);case 3:throw new Error(Bz)}},publicKeyCombine(e,n=!0,r){Hz(Array.isArray(e),"Expected public keys to be an Array"),Hz(e.length>0,"Expected public keys array will have more than zero items");for(const t of e)Gz("public key",t,[33,65]);switch(Zz(n),r=Vz(r,n?33:65),t.publicKeyCombine(r,e)){case 0:return r;case 1:throw new Error(Rz);case 2:throw new Error(Uz);case 3:throw new Error(Bz)}},publicKeyTweakAdd(e,n,r=!0,i){switch(Gz("public key",e,[33,65]),Gz("tweak",n,32),Zz(r),i=Vz(i,r?33:65),t.publicKeyTweakAdd(i,e,n)){case 0:return i;case 1:throw new Error(Rz);case 2:throw new Error(Dz)}},publicKeyTweakMul(e,n,r=!0,i){switch(Gz("public key",e,[33,65]),Gz("tweak",n,32),Zz(r),i=Vz(i,r?33:65),t.publicKeyTweakMul(i,e,n)){case 0:return i;case 1:throw new Error(Rz);case 2:throw new Error(Oz)}},signatureNormalize(e){switch(Gz("signature",e,64),t.signatureNormalize(e)){case 0:return e;case 1:throw new Error(Fz)}},signatureExport(e,n){Gz("signature",e,64);const r={output:n=Vz(n,72),outputlen:72};switch(t.signatureExport(r,e)){case 0:return n.slice(0,r.outputlen);case 1:throw new Error(Fz);case 2:throw new Error(Cz)}},signatureImport(e,n){switch(Gz("signature",e),n=Vz(n,64),t.signatureImport(n,e)){case 0:return n;case 1:throw new Error(Fz);case 2:throw new Error(Cz)}},ecdsaSign(e,n,r={},i){Gz("message",e,32),Gz("private key",n,32),Hz("Object"===qz(r),"Expected options to be an Object"),void 0!==r.data&&Gz("options.data",r.data),void 0!==r.noncefn&&Hz("Function"===qz(r.noncefn),"Expected options.noncefn to be a Function");const o={signature:i=Vz(i,64),recid:null};switch(t.ecdsaSign(o,e,n,r.data,r.noncefn)){case 0:return o;case 1:throw new Error(Wz);case 2:throw new Error(Cz)}},ecdsaVerify(e,n,r){switch(Gz("signature",e,64),Gz("message",n,32),Gz("public key",r,[33,65]),t.ecdsaVerify(e,n,r)){case 0:return!0;case 3:return!1;case 1:throw new Error(Fz);case 2:throw new Error(Rz)}},ecdsaRecover(e,n,r,i=!0,o){switch(Gz("signature",e,64),Hz("Number"===qz(n)&&n>=0&&n<=3,"Expected recovery id to be a Number within interval [0, 3]"),Gz("message",r,32),Zz(i),o=Vz(o,i?33:65),t.ecdsaRecover(o,e,n,r)){case 0:return o;case 1:throw new Error(Fz);case 2:throw new Error(Yz);case 3:throw new Error(Cz)}},ecdh(e,n,r={},i){switch(Gz("public key",e,[33,65]),Gz("private key",n,32),Hz("Object"===qz(r),"Expected options to be an Object"),void 0!==r.data&&Gz("options.data",r.data),void 0!==r.hashfn?(Hz("Function"===qz(r.hashfn),"Expected options.hashfn to be a Function"),void 0!==r.xbuf&&Gz("options.xbuf",r.xbuf,32),void 0!==r.ybuf&&Gz("options.ybuf",r.ybuf,32),Gz("output",i)):i=Vz(i,32),t.ecdh(i,e,n,r.data,r.hashfn,r.xbuf,r.ybuf)){case 0:return i;case 1:throw new Error(Rz);case 2:throw new Error(Qz)}}}))(UU),WU=FU,YU={exports:{}};!function(t){!function(){var e="input is invalid type",n="object"==typeof window,r=n?window:{};r.JS_SHA3_NO_WINDOW&&(n=!1);var i=!n&&"object"==typeof self;!r.JS_SHA3_NO_NODE_JS&&"object"==typeof fS&&fS.versions&&fS.versions.node?r=KM:i&&(r=self);var o=!r.JS_SHA3_NO_COMMON_JS&&t.exports,a=!r.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,s="0123456789abcdef".split(""),u=[4,1024,262144,67108864],c=[0,8,16,24],l=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],h=[224,256,384,512],d=[128,256],f=["hex","buffer","arrayBuffer","array","digest"],p={128:168,256:136};!r.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),!a||!r.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(t){return"object"==typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer});for(var m=function(t,e,n){return function(r){return new I(t,e,t).update(r)[n]()}},g=function(t,e,n){return function(r,i){return new I(t,e,i).update(r)[n]()}},y=function(t,e,n){return function(e,r,i,o){return _["cshake"+t].update(e,r,i,o)[n]()}},b=function(t,e,n){return function(e,r,i,o){return _["kmac"+t].update(e,r,i,o)[n]()}},v=function(t,e,n,r){for(var i=0;i<f.length;++i){var o=f[i];t[o]=e(n,r,o)}return t},w=function(t,e){var n=m(t,e,"hex");return n.create=function(){return new I(t,e,t)},n.update=function(t){return n.create().update(t)},v(n,m,t,e)},M=[{name:"keccak",padding:[1,256,65536,16777216],bits:h,createMethod:w},{name:"sha3",padding:[6,1536,393216,100663296],bits:h,createMethod:w},{name:"shake",padding:[31,7936,2031616,520093696],bits:d,createMethod:function(t,e){var n=g(t,e,"hex");return n.create=function(n){return new I(t,e,n)},n.update=function(t,e){return n.create(e).update(t)},v(n,g,t,e)}},{name:"cshake",padding:u,bits:d,createMethod:function(t,e){var n=p[t],r=y(t,0,"hex");return r.create=function(r,i,o){return i||o?new I(t,e,r).bytepad([i,o],n):_["shake"+t].create(r)},r.update=function(t,e,n,i){return r.create(e,n,i).update(t)},v(r,y,t,e)}},{name:"kmac",padding:u,bits:d,createMethod:function(t,e){var n=p[t],r=b(t,0,"hex");return r.create=function(r,i,o){return new k(t,e,i).bytepad(["KMAC",o],n).bytepad([r],n)},r.update=function(t,e,n,i){return r.create(t,n,i).update(e)},v(r,b,t,e)}}],_={},E=[],N=0;N<M.length;++N)for(var L=M[N],S=L.bits,A=0;A<S.length;++A){var x=L.name+"_"+S[A];if(E.push(x),_[x]=L.createMethod(S[A],L.padding),"sha3"!==L.name){var T=L.name+S[A];E.push(T),_[T]=_[x]}}function I(t,e,n){this.blocks=[],this.s=[],this.padding=e,this.outputBits=n,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(t<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=n>>5,this.extraBytes=(31&n)>>3;for(var r=0;r<50;++r)this.s[r]=0}function k(t,e,n){I.call(this,t,e,n)}I.prototype.update=function(t){if(this.finalized)throw new Error("finalize already called");var n,r=typeof t;if("string"!==r){if("object"!==r)throw new Error(e);if(null===t)throw new Error(e);if(a&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||a&&ArrayBuffer.isView(t)))throw new Error(e);n=!0}for(var i,o,s=this.blocks,u=this.byteCount,l=t.length,h=this.blockCount,d=0,f=this.s;d<l;){if(this.reset)for(this.reset=!1,s[0]=this.block,i=1;i<h+1;++i)s[i]=0;if(n)for(i=this.start;d<l&&i<u;++d)s[i>>2]|=t[d]<<c[3&i++];else for(i=this.start;d<l&&i<u;++d)(o=t.charCodeAt(d))<128?s[i>>2]|=o<<c[3&i++]:o<2048?(s[i>>2]|=(192|o>>6)<<c[3&i++],s[i>>2]|=(128|63&o)<<c[3&i++]):o<55296||o>=57344?(s[i>>2]|=(224|o>>12)<<c[3&i++],s[i>>2]|=(128|o>>6&63)<<c[3&i++],s[i>>2]|=(128|63&o)<<c[3&i++]):(o=65536+((1023&o)<<10|1023&t.charCodeAt(++d)),s[i>>2]|=(240|o>>18)<<c[3&i++],s[i>>2]|=(128|o>>12&63)<<c[3&i++],s[i>>2]|=(128|o>>6&63)<<c[3&i++],s[i>>2]|=(128|63&o)<<c[3&i++]);if(this.lastByteIndex=i,i>=u){for(this.start=i-u,this.block=s[h],i=0;i<h;++i)f[i]^=s[i];j(f),this.reset=!0}else this.start=i}return this},I.prototype.encode=function(t,e){var n=255&t,r=1,i=[n];for(n=255&(t>>=8);n>0;)i.unshift(n),n=255&(t>>=8),++r;return e?i.push(r):i.unshift(r),this.update(i),i.length},I.prototype.encodeString=function(t){var n,r=typeof t;if("string"!==r){if("object"!==r)throw new Error(e);if(null===t)throw new Error(e);if(a&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||a&&ArrayBuffer.isView(t)))throw new Error(e);n=!0}var i=0,o=t.length;if(n)i=o;else for(var s=0;s<t.length;++s){var u=t.charCodeAt(s);u<128?i+=1:u<2048?i+=2:u<55296||u>=57344?i+=3:(u=65536+((1023&u)<<10|1023&t.charCodeAt(++s)),i+=4)}return i+=this.encode(8*i),this.update(t),i},I.prototype.bytepad=function(t,e){for(var n=this.encode(e),r=0;r<t.length;++r)n+=this.encodeString(t[r]);var i=e-n%e,o=[];return o.length=i,this.update(o),this},I.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex,n=this.blockCount,r=this.s;if(t[e>>2]|=this.padding[3&e],this.lastByteIndex===this.byteCount)for(t[0]=t[n],e=1;e<n+1;++e)t[e]=0;for(t[n-1]|=2147483648,e=0;e<n;++e)r[e]^=t[e];j(r)}},I.prototype.toString=I.prototype.hex=function(){this.finalize();for(var t,e=this.blockCount,n=this.s,r=this.outputBlocks,i=this.extraBytes,o=0,a=0,u="";a<r;){for(o=0;o<e&&a<r;++o,++a)t=n[o],u+=s[t>>4&15]+s[15&t]+s[t>>12&15]+s[t>>8&15]+s[t>>20&15]+s[t>>16&15]+s[t>>28&15]+s[t>>24&15];a%e==0&&(j(n),o=0)}return i&&(t=n[o],u+=s[t>>4&15]+s[15&t],i>1&&(u+=s[t>>12&15]+s[t>>8&15]),i>2&&(u+=s[t>>20&15]+s[t>>16&15])),u},I.prototype.arrayBuffer=function(){this.finalize();var t,e=this.blockCount,n=this.s,r=this.outputBlocks,i=this.extraBytes,o=0,a=0,s=this.outputBits>>3;t=i?new ArrayBuffer(r+1<<2):new ArrayBuffer(s);for(var u=new Uint32Array(t);a<r;){for(o=0;o<e&&a<r;++o,++a)u[a]=n[o];a%e==0&&j(n)}return i&&(u[o]=n[o],t=t.slice(0,s)),t},I.prototype.buffer=I.prototype.arrayBuffer,I.prototype.digest=I.prototype.array=function(){this.finalize();for(var t,e,n=this.blockCount,r=this.s,i=this.outputBlocks,o=this.extraBytes,a=0,s=0,u=[];s<i;){for(a=0;a<n&&s<i;++a,++s)t=s<<2,e=r[a],u[t]=255&e,u[t+1]=e>>8&255,u[t+2]=e>>16&255,u[t+3]=e>>24&255;s%n==0&&j(r)}return o&&(t=s<<2,e=r[a],u[t]=255&e,o>1&&(u[t+1]=e>>8&255),o>2&&(u[t+2]=e>>16&255)),u},k.prototype=new I,k.prototype.finalize=function(){return this.encode(this.outputBits,!0),I.prototype.finalize.call(this)};var j=function(t){var e,n,r,i,o,a,s,u,c,h,d,f,p,m,g,y,b,v,w,M,_,E,N,L,S,A,x,T,I,k,j,C,D,O,z,P,R,B,U,F,W,Y,Q,H,G,Z,V,q,J,K,X,$,tt,et,nt,rt,it,ot,at,st,ut,ct,lt;for(r=0;r<48;r+=2)i=t[0]^t[10]^t[20]^t[30]^t[40],o=t[1]^t[11]^t[21]^t[31]^t[41],a=t[2]^t[12]^t[22]^t[32]^t[42],s=t[3]^t[13]^t[23]^t[33]^t[43],u=t[4]^t[14]^t[24]^t[34]^t[44],c=t[5]^t[15]^t[25]^t[35]^t[45],h=t[6]^t[16]^t[26]^t[36]^t[46],d=t[7]^t[17]^t[27]^t[37]^t[47],e=(f=t[8]^t[18]^t[28]^t[38]^t[48])^(a<<1|s>>>31),n=(p=t[9]^t[19]^t[29]^t[39]^t[49])^(s<<1|a>>>31),t[0]^=e,t[1]^=n,t[10]^=e,t[11]^=n,t[20]^=e,t[21]^=n,t[30]^=e,t[31]^=n,t[40]^=e,t[41]^=n,e=i^(u<<1|c>>>31),n=o^(c<<1|u>>>31),t[2]^=e,t[3]^=n,t[12]^=e,t[13]^=n,t[22]^=e,t[23]^=n,t[32]^=e,t[33]^=n,t[42]^=e,t[43]^=n,e=a^(h<<1|d>>>31),n=s^(d<<1|h>>>31),t[4]^=e,t[5]^=n,t[14]^=e,t[15]^=n,t[24]^=e,t[25]^=n,t[34]^=e,t[35]^=n,t[44]^=e,t[45]^=n,e=u^(f<<1|p>>>31),n=c^(p<<1|f>>>31),t[6]^=e,t[7]^=n,t[16]^=e,t[17]^=n,t[26]^=e,t[27]^=n,t[36]^=e,t[37]^=n,t[46]^=e,t[47]^=n,e=h^(i<<1|o>>>31),n=d^(o<<1|i>>>31),t[8]^=e,t[9]^=n,t[18]^=e,t[19]^=n,t[28]^=e,t[29]^=n,t[38]^=e,t[39]^=n,t[48]^=e,t[49]^=n,m=t[0],g=t[1],Z=t[11]<<4|t[10]>>>28,V=t[10]<<4|t[11]>>>28,T=t[20]<<3|t[21]>>>29,I=t[21]<<3|t[20]>>>29,st=t[31]<<9|t[30]>>>23,ut=t[30]<<9|t[31]>>>23,Y=t[40]<<18|t[41]>>>14,Q=t[41]<<18|t[40]>>>14,O=t[2]<<1|t[3]>>>31,z=t[3]<<1|t[2]>>>31,y=t[13]<<12|t[12]>>>20,b=t[12]<<12|t[13]>>>20,q=t[22]<<10|t[23]>>>22,J=t[23]<<10|t[22]>>>22,k=t[33]<<13|t[32]>>>19,j=t[32]<<13|t[33]>>>19,ct=t[42]<<2|t[43]>>>30,lt=t[43]<<2|t[42]>>>30,et=t[5]<<30|t[4]>>>2,nt=t[4]<<30|t[5]>>>2,P=t[14]<<6|t[15]>>>26,R=t[15]<<6|t[14]>>>26,v=t[25]<<11|t[24]>>>21,w=t[24]<<11|t[25]>>>21,K=t[34]<<15|t[35]>>>17,X=t[35]<<15|t[34]>>>17,C=t[45]<<29|t[44]>>>3,D=t[44]<<29|t[45]>>>3,L=t[6]<<28|t[7]>>>4,S=t[7]<<28|t[6]>>>4,rt=t[17]<<23|t[16]>>>9,it=t[16]<<23|t[17]>>>9,B=t[26]<<25|t[27]>>>7,U=t[27]<<25|t[26]>>>7,M=t[36]<<21|t[37]>>>11,_=t[37]<<21|t[36]>>>11,$=t[47]<<24|t[46]>>>8,tt=t[46]<<24|t[47]>>>8,H=t[8]<<27|t[9]>>>5,G=t[9]<<27|t[8]>>>5,A=t[18]<<20|t[19]>>>12,x=t[19]<<20|t[18]>>>12,ot=t[29]<<7|t[28]>>>25,at=t[28]<<7|t[29]>>>25,F=t[38]<<8|t[39]>>>24,W=t[39]<<8|t[38]>>>24,E=t[48]<<14|t[49]>>>18,N=t[49]<<14|t[48]>>>18,t[0]=m^~y&v,t[1]=g^~b&w,t[10]=L^~A&T,t[11]=S^~x&I,t[20]=O^~P&B,t[21]=z^~R&U,t[30]=H^~Z&q,t[31]=G^~V&J,t[40]=et^~rt&ot,t[41]=nt^~it&at,t[2]=y^~v&M,t[3]=b^~w&_,t[12]=A^~T&k,t[13]=x^~I&j,t[22]=P^~B&F,t[23]=R^~U&W,t[32]=Z^~q&K,t[33]=V^~J&X,t[42]=rt^~ot&st,t[43]=it^~at&ut,t[4]=v^~M&E,t[5]=w^~_&N,t[14]=T^~k&C,t[15]=I^~j&D,t[24]=B^~F&Y,t[25]=U^~W&Q,t[34]=q^~K&$,t[35]=J^~X&tt,t[44]=ot^~st&ct,t[45]=at^~ut<,t[6]=M^~E&m,t[7]=_^~N&g,t[16]=k^~C&L,t[17]=j^~D&S,t[26]=F^~Y&O,t[27]=W^~Q&z,t[36]=K^~$&H,t[37]=X^~tt&G,t[46]=st^~ct&et,t[47]=ut^~lt&nt,t[8]=E^~m&y,t[9]=N^~g&b,t[18]=C^~L&A,t[19]=D^~S&x,t[28]=Y^~O&P,t[29]=Q^~z&R,t[38]=$^~H&Z,t[39]=tt^~G&V,t[48]=ct^~et&rt,t[49]=lt^~nt&it,t[0]^=l[r],t[1]^=l[r+1]};if(o)t.exports=_;else for(N=0;N<E.length;++N)r[E[N]]=_[E[N]]}()}(YU);var QU=YU.exports;const HU=t=>p_.isBuffer(t)?t:t instanceof Uint8Array?p_.from(t.buffer,t.byteOffset,t.byteLength):p_.from(t);var GU={},ZU={},VU=qU;function qU(t,e){if(!t)throw new Error(e||"Assertion failed")}qU.equal=function(t,e,n){if(t!=e)throw new Error(n||"Assertion failed: "+t+" != "+e)};var JU={exports:{}};"function"==typeof Object.create?JU.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:JU.exports=function(t,e){if(e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}};var KU=VU,XU=JU.exports;function $U(t,e){return 55296==(64512&t.charCodeAt(e))&&(!(e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1)))}function tF(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function eF(t){return 1===t.length?"0"+t:t}function nF(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}ZU.inherits=XU,ZU.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var n=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),i=0;i<t.length;i+=2)n.push(parseInt(t[i]+t[i+1],16))}else for(var r=0,i=0;i<t.length;i++){var o=t.charCodeAt(i);o<128?n[r++]=o:o<2048?(n[r++]=o>>6|192,n[r++]=63&o|128):$U(t,i)?(o=65536+((1023&o)<<10)+(1023&t.charCodeAt(++i)),n[r++]=o>>18|240,n[r++]=o>>12&63|128,n[r++]=o>>6&63|128,n[r++]=63&o|128):(n[r++]=o>>12|224,n[r++]=o>>6&63|128,n[r++]=63&o|128)}else for(i=0;i<t.length;i++)n[i]=0|t[i];return n},ZU.toHex=function(t){for(var e="",n=0;n<t.length;n++)e+=eF(t[n].toString(16));return e},ZU.htonl=tF,ZU.toHex32=function(t,e){for(var n="",r=0;r<t.length;r++){var i=t[r];"little"===e&&(i=tF(i)),n+=nF(i.toString(16))}return n},ZU.zero2=eF,ZU.zero8=nF,ZU.join32=function(t,e,n,r){var i=n-e;KU(i%4==0);for(var o=new Array(i/4),a=0,s=e;a<o.length;a++,s+=4){var u;u="big"===r?t[s]<<24|t[s+1]<<16|t[s+2]<<8|t[s+3]:t[s+3]<<24|t[s+2]<<16|t[s+1]<<8|t[s],o[a]=u>>>0}return o},ZU.split32=function(t,e){for(var n=new Array(4*t.length),r=0,i=0;r<t.length;r++,i+=4){var o=t[r];"big"===e?(n[i]=o>>>24,n[i+1]=o>>>16&255,n[i+2]=o>>>8&255,n[i+3]=255&o):(n[i+3]=o>>>24,n[i+2]=o>>>16&255,n[i+1]=o>>>8&255,n[i]=255&o)}return n},ZU.rotr32=function(t,e){return t>>>e|t<<32-e},ZU.rotl32=function(t,e){return t<<e|t>>>32-e},ZU.sum32=function(t,e){return t+e>>>0},ZU.sum32_3=function(t,e,n){return t+e+n>>>0},ZU.sum32_4=function(t,e,n,r){return t+e+n+r>>>0},ZU.sum32_5=function(t,e,n,r,i){return t+e+n+r+i>>>0},ZU.sum64=function(t,e,n,r){var i=t[e],o=r+t[e+1]>>>0,a=(o<r?1:0)+n+i;t[e]=a>>>0,t[e+1]=o},ZU.sum64_hi=function(t,e,n,r){return(e+r>>>0<e?1:0)+t+n>>>0},ZU.sum64_lo=function(t,e,n,r){return e+r>>>0},ZU.sum64_4_hi=function(t,e,n,r,i,o,a,s){var u=0,c=e;return u+=(c=c+r>>>0)<e?1:0,u+=(c=c+o>>>0)<o?1:0,t+n+i+a+(u+=(c=c+s>>>0)<s?1:0)>>>0},ZU.sum64_4_lo=function(t,e,n,r,i,o,a,s){return e+r+o+s>>>0},ZU.sum64_5_hi=function(t,e,n,r,i,o,a,s,u,c){var l=0,h=e;return l+=(h=h+r>>>0)<e?1:0,l+=(h=h+o>>>0)<o?1:0,l+=(h=h+s>>>0)<s?1:0,t+n+i+a+u+(l+=(h=h+c>>>0)<c?1:0)>>>0},ZU.sum64_5_lo=function(t,e,n,r,i,o,a,s,u,c){return e+r+o+s+c>>>0},ZU.rotr64_hi=function(t,e,n){return(e<<32-n|t>>>n)>>>0},ZU.rotr64_lo=function(t,e,n){return(t<<32-n|e>>>n)>>>0},ZU.shr64_hi=function(t,e,n){return t>>>n},ZU.shr64_lo=function(t,e,n){return(t<<32-n|e>>>n)>>>0};var rF={},iF=ZU,oF=VU;function aF(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}rF.BlockHash=aF,aF.prototype.update=function(t,e){if(t=iF.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){var n=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-n,t.length),0===this.pending.length&&(this.pending=null),t=iF.join32(t,0,t.length-n,this.endian);for(var r=0;r<t.length;r+=this._delta32)this._update(t,r,r+this._delta32)}return this},aF.prototype.digest=function(t){return this.update(this._pad()),oF(null===this.pending),this._digest(t)},aF.prototype._pad=function(){var t=this.pendingTotal,e=this._delta8,n=e-(t+this.padLength)%e,r=new Array(n+this.padLength);r[0]=128;for(var i=1;i<n;i++)r[i]=0;if(t<<=3,"big"===this.endian){for(var o=8;o<this.padLength;o++)r[i++]=0;r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=t>>>24&255,r[i++]=t>>>16&255,r[i++]=t>>>8&255,r[i++]=255&t}else for(r[i++]=255&t,r[i++]=t>>>8&255,r[i++]=t>>>16&255,r[i++]=t>>>24&255,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,o=8;o<this.padLength;o++)r[i++]=0;return r};var sF={},uF={},cF=ZU.rotr32;function lF(t,e,n){return t&e^~t&n}function hF(t,e,n){return t&e^t&n^e&n}function dF(t,e,n){return t^e^n}uF.ft_1=function(t,e,n,r){return 0===t?lF(e,n,r):1===t||3===t?dF(e,n,r):2===t?hF(e,n,r):void 0},uF.ch32=lF,uF.maj32=hF,uF.p32=dF,uF.s0_256=function(t){return cF(t,2)^cF(t,13)^cF(t,22)},uF.s1_256=function(t){return cF(t,6)^cF(t,11)^cF(t,25)},uF.g0_256=function(t){return cF(t,7)^cF(t,18)^t>>>3},uF.g1_256=function(t){return cF(t,17)^cF(t,19)^t>>>10};var fF=ZU,pF=rF,mF=uF,gF=fF.rotl32,yF=fF.sum32,bF=fF.sum32_5,vF=mF.ft_1,wF=pF.BlockHash,MF=[1518500249,1859775393,2400959708,3395469782];function _F(){if(!(this instanceof _F))return new _F;wF.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}fF.inherits(_F,wF);var EF=_F;_F.blockSize=512,_F.outSize=160,_F.hmacStrength=80,_F.padLength=64,_F.prototype._update=function(t,e){for(var n=this.W,r=0;r<16;r++)n[r]=t[e+r];for(;r<n.length;r++)n[r]=gF(n[r-3]^n[r-8]^n[r-14]^n[r-16],1);var i=this.h[0],o=this.h[1],a=this.h[2],s=this.h[3],u=this.h[4];for(r=0;r<n.length;r++){var c=~~(r/20),l=bF(gF(i,5),vF(c,o,a,s),u,n[r],MF[c]);u=s,s=a,a=gF(o,30),o=i,i=l}this.h[0]=yF(this.h[0],i),this.h[1]=yF(this.h[1],o),this.h[2]=yF(this.h[2],a),this.h[3]=yF(this.h[3],s),this.h[4]=yF(this.h[4],u)},_F.prototype._digest=function(t){return"hex"===t?fF.toHex32(this.h,"big"):fF.split32(this.h,"big")};var NF=ZU,LF=rF,SF=uF,AF=VU,xF=NF.sum32,TF=NF.sum32_4,IF=NF.sum32_5,kF=SF.ch32,jF=SF.maj32,CF=SF.s0_256,DF=SF.s1_256,OF=SF.g0_256,zF=SF.g1_256,PF=LF.BlockHash,RF=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function BF(){if(!(this instanceof BF))return new BF;PF.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=RF,this.W=new Array(64)}NF.inherits(BF,PF);var UF=BF;BF.blockSize=512,BF.outSize=256,BF.hmacStrength=192,BF.padLength=64,BF.prototype._update=function(t,e){for(var n=this.W,r=0;r<16;r++)n[r]=t[e+r];for(;r<n.length;r++)n[r]=TF(zF(n[r-2]),n[r-7],OF(n[r-15]),n[r-16]);var i=this.h[0],o=this.h[1],a=this.h[2],s=this.h[3],u=this.h[4],c=this.h[5],l=this.h[6],h=this.h[7];for(AF(this.k.length===n.length),r=0;r<n.length;r++){var d=IF(h,DF(u),kF(u,c,l),this.k[r],n[r]),f=xF(CF(i),jF(i,o,a));h=l,l=c,c=u,u=xF(s,d),s=a,a=o,o=i,i=xF(d,f)}this.h[0]=xF(this.h[0],i),this.h[1]=xF(this.h[1],o),this.h[2]=xF(this.h[2],a),this.h[3]=xF(this.h[3],s),this.h[4]=xF(this.h[4],u),this.h[5]=xF(this.h[5],c),this.h[6]=xF(this.h[6],l),this.h[7]=xF(this.h[7],h)},BF.prototype._digest=function(t){return"hex"===t?NF.toHex32(this.h,"big"):NF.split32(this.h,"big")};var FF=ZU,WF=UF;function YF(){if(!(this instanceof YF))return new YF;WF.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}FF.inherits(YF,WF);var QF=YF;YF.blockSize=512,YF.outSize=224,YF.hmacStrength=192,YF.padLength=64,YF.prototype._digest=function(t){return"hex"===t?FF.toHex32(this.h.slice(0,7),"big"):FF.split32(this.h.slice(0,7),"big")};var HF=ZU,GF=rF,ZF=VU,VF=HF.rotr64_hi,qF=HF.rotr64_lo,JF=HF.shr64_hi,KF=HF.shr64_lo,XF=HF.sum64,$F=HF.sum64_hi,tW=HF.sum64_lo,eW=HF.sum64_4_hi,nW=HF.sum64_4_lo,rW=HF.sum64_5_hi,iW=HF.sum64_5_lo,oW=GF.BlockHash,aW=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function sW(){if(!(this instanceof sW))return new sW;oW.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=aW,this.W=new Array(160)}HF.inherits(sW,oW);var uW=sW;function cW(t,e,n,r,i){var o=t&n^~t&i;return o<0&&(o+=4294967296),o}function lW(t,e,n,r,i,o){var a=e&r^~e&o;return a<0&&(a+=4294967296),a}function hW(t,e,n,r,i){var o=t&n^t&i^n&i;return o<0&&(o+=4294967296),o}function dW(t,e,n,r,i,o){var a=e&r^e&o^r&o;return a<0&&(a+=4294967296),a}function fW(t,e){var n=VF(t,e,28)^VF(e,t,2)^VF(e,t,7);return n<0&&(n+=4294967296),n}function pW(t,e){var n=qF(t,e,28)^qF(e,t,2)^qF(e,t,7);return n<0&&(n+=4294967296),n}function mW(t,e){var n=VF(t,e,14)^VF(t,e,18)^VF(e,t,9);return n<0&&(n+=4294967296),n}function gW(t,e){var n=qF(t,e,14)^qF(t,e,18)^qF(e,t,9);return n<0&&(n+=4294967296),n}function yW(t,e){var n=VF(t,e,1)^VF(t,e,8)^JF(t,e,7);return n<0&&(n+=4294967296),n}function bW(t,e){var n=qF(t,e,1)^qF(t,e,8)^KF(t,e,7);return n<0&&(n+=4294967296),n}function vW(t,e){var n=VF(t,e,19)^VF(e,t,29)^JF(t,e,6);return n<0&&(n+=4294967296),n}function wW(t,e){var n=qF(t,e,19)^qF(e,t,29)^KF(t,e,6);return n<0&&(n+=4294967296),n}sW.blockSize=1024,sW.outSize=512,sW.hmacStrength=192,sW.padLength=128,sW.prototype._prepareBlock=function(t,e){for(var n=this.W,r=0;r<32;r++)n[r]=t[e+r];for(;r<n.length;r+=2){var i=vW(n[r-4],n[r-3]),o=wW(n[r-4],n[r-3]),a=n[r-14],s=n[r-13],u=yW(n[r-30],n[r-29]),c=bW(n[r-30],n[r-29]),l=n[r-32],h=n[r-31];n[r]=eW(i,o,a,s,u,c,l,h),n[r+1]=nW(i,o,a,s,u,c,l,h)}},sW.prototype._update=function(t,e){this._prepareBlock(t,e);var n=this.W,r=this.h[0],i=this.h[1],o=this.h[2],a=this.h[3],s=this.h[4],u=this.h[5],c=this.h[6],l=this.h[7],h=this.h[8],d=this.h[9],f=this.h[10],p=this.h[11],m=this.h[12],g=this.h[13],y=this.h[14],b=this.h[15];ZF(this.k.length===n.length);for(var v=0;v<n.length;v+=2){var w=y,M=b,_=mW(h,d),E=gW(h,d),N=cW(h,d,f,p,m),L=lW(h,d,f,p,m,g),S=this.k[v],A=this.k[v+1],x=n[v],T=n[v+1],I=rW(w,M,_,E,N,L,S,A,x,T),k=iW(w,M,_,E,N,L,S,A,x,T);w=fW(r,i),M=pW(r,i),_=hW(r,i,o,a,s),E=dW(r,i,o,a,s,u);var j=$F(w,M,_,E),C=tW(w,M,_,E);y=m,b=g,m=f,g=p,f=h,p=d,h=$F(c,l,I,k),d=tW(l,l,I,k),c=s,l=u,s=o,u=a,o=r,a=i,r=$F(I,k,j,C),i=tW(I,k,j,C)}XF(this.h,0,r,i),XF(this.h,2,o,a),XF(this.h,4,s,u),XF(this.h,6,c,l),XF(this.h,8,h,d),XF(this.h,10,f,p),XF(this.h,12,m,g),XF(this.h,14,y,b)},sW.prototype._digest=function(t){return"hex"===t?HF.toHex32(this.h,"big"):HF.split32(this.h,"big")};var MW=ZU,_W=uW;function EW(){if(!(this instanceof EW))return new EW;_W.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}MW.inherits(EW,_W);var NW=EW;EW.blockSize=1024,EW.outSize=384,EW.hmacStrength=192,EW.padLength=128,EW.prototype._digest=function(t){return"hex"===t?MW.toHex32(this.h.slice(0,12),"big"):MW.split32(this.h.slice(0,12),"big")},sF.sha1=EF,sF.sha224=QF,sF.sha256=UF,sF.sha384=NW,sF.sha512=uW;var LW={},SW=ZU,AW=rF,xW=SW.rotl32,TW=SW.sum32,IW=SW.sum32_3,kW=SW.sum32_4,jW=AW.BlockHash;function CW(){if(!(this instanceof CW))return new CW;jW.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function DW(t,e,n,r){return t<=15?e^n^r:t<=31?e&n|~e&r:t<=47?(e|~n)^r:t<=63?e&r|n&~r:e^(n|~r)}function OW(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function zW(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}SW.inherits(CW,jW),LW.ripemd160=CW,CW.blockSize=512,CW.outSize=160,CW.hmacStrength=192,CW.padLength=64,CW.prototype._update=function(t,e){for(var n=this.h[0],r=this.h[1],i=this.h[2],o=this.h[3],a=this.h[4],s=n,u=r,c=i,l=o,h=a,d=0;d<80;d++){var f=TW(xW(kW(n,DW(d,r,i,o),t[PW[d]+e],OW(d)),BW[d]),a);n=a,a=o,o=xW(i,10),i=r,r=f,f=TW(xW(kW(s,DW(79-d,u,c,l),t[RW[d]+e],zW(d)),UW[d]),h),s=h,h=l,l=xW(c,10),c=u,u=f}f=IW(this.h[1],i,l),this.h[1]=IW(this.h[2],o,h),this.h[2]=IW(this.h[3],a,s),this.h[3]=IW(this.h[4],n,u),this.h[4]=IW(this.h[0],r,c),this.h[0]=f},CW.prototype._digest=function(t){return"hex"===t?SW.toHex32(this.h,"little"):SW.split32(this.h,"little")};var PW=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],RW=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],BW=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],UW=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],FW=ZU,WW=VU;function YW(t,e,n){if(!(this instanceof YW))return new YW(t,e,n);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(FW.toArray(e,n))}var QW=YW;YW.prototype._init=function(t){t.length>this.blockSize&&(t=(new this.Hash).update(t).digest()),WW(t.length<=this.blockSize);for(var e=t.length;e<this.blockSize;e++)t.push(0);for(e=0;e<t.length;e++)t[e]^=54;for(this.inner=(new this.Hash).update(t),e=0;e<t.length;e++)t[e]^=106;this.outer=(new this.Hash).update(t)},YW.prototype.update=function(t,e){return this.inner.update(t,e),this},YW.prototype.digest=function(t){return this.outer.update(this.inner.digest()),this.outer.digest(t)},function(t){var e=GU;e.utils=ZU,e.common=rF,e.sha=sF,e.ripemd=LW,e.hmac=QW,e.sha1=e.sha.sha1,e.sha256=e.sha.sha256,e.sha224=e.sha.sha224,e.sha384=e.sha.sha384,e.sha512=e.sha.sha512,e.ripemd160=e.ripemd.ripemd160}();var HW=GU;let GW=!1,ZW=!1;const VW={debug:1,default:2,info:2,warning:3,error:4,off:5};let qW=VW.default,JW=null;const KW=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(n){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var XW,$W;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(XW||(XW={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED"}($W||($W={}));const tY="0123456789abcdef";class eY{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const n=t.toLowerCase();null==VW[n]&&this.throwArgumentError("invalid log level name","logLevel",t),qW>VW[n]||console.log.apply(console,e)}debug(...t){this._log(eY.levels.DEBUG,t)}info(...t){this._log(eY.levels.INFO,t)}warn(...t){this._log(eY.levels.WARNING,t)}makeError(t,e,n){if(ZW)return this.makeError("censored error",e,{});e||(e=eY.errors.UNKNOWN_ERROR),n||(n={});const r=[];Object.keys(n).forEach((t=>{const e=n[t];try{if(e instanceof Uint8Array){let n="";for(let t=0;t<e.length;t++)n+=tY[e[t]>>4],n+=tY[15&e[t]];r.push(t+"=Uint8Array(0x"+n+")")}else r.push(t+"="+JSON.stringify(e))}catch(e){r.push(t+"="+JSON.stringify(n[t].toString()))}})),r.push(`code=${e}`),r.push(`version=${this.version}`);const i=t;let o="";switch(e){case $W.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case $W.CALL_EXCEPTION:case $W.INSUFFICIENT_FUNDS:case $W.MISSING_NEW:case $W.NONCE_EXPIRED:case $W.REPLACEMENT_UNDERPRICED:case $W.TRANSACTION_REPLACED:case $W.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),r.length&&(t+=" ("+r.join(", ")+")");const a=new Error(t);return a.reason=i,a.code=e,Object.keys(n).forEach((function(t){a[t]=n[t]})),a}throwError(t,e,n){throw this.makeError(t,e,n)}throwArgumentError(t,e,n){return this.throwError(t,eY.errors.INVALID_ARGUMENT,{argument:e,value:n})}assert(t,e,n,r){t||this.throwError(e,n,r)}assertArgument(t,e,n,r){t||this.throwArgumentError(e,n,r)}checkNormalize(t){KW&&this.throwError("platform missing String.prototype.normalize",eY.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:KW})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,eY.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,eY.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,n){n=n?": "+n:"",t<e&&this.throwError("missing argument"+n,eY.errors.MISSING_ARGUMENT,{count:t,expectedCount:e}),t>e&&this.throwError("too many arguments"+n,eY.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",eY.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",eY.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",eY.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return JW||(JW=new eY("logger/5.6.0")),JW}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",eY.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),GW){if(!t)return;this.globalLogger().throwError("error censorship permanent",eY.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}ZW=!!t,GW=!!e}static setLogLevel(t){const e=VW[t.toLowerCase()];null!=e?qW=e:eY.globalLogger().warn("invalid log level - "+t)}static from(t){return new eY(t)}}eY.errors=$W,eY.levels=XW;const nY=new eY("bytes/5.6.0");function rY(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return rY(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function iY(t){return"number"==typeof t&&t==t&&t%1==0}function oY(t,e){if(e||(e={}),"number"==typeof t){nY.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),rY(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),function(t){return!!t.toHexString}(t)&&(t=t.toHexString()),function(t,e){if("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/))return!1;if(e&&t.length!==2+2*e)return!1;return!0}(t)){let n=t.substring(2);n.length%2&&("left"===e.hexPad?n="0x0"+n.substring(2):"right"===e.hexPad?n+="0":nY.throwArgumentError("hex data is odd-length","value",t));const r=[];for(let t=0;t<n.length;t+=2)r.push(parseInt(n.substring(t,t+2),16));return rY(new Uint8Array(r))}return function(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(!iY(t.length)||t.length<0)return!1;for(let e=0;e<t.length;e++){const n=t[e];if(!iY(n)||n<0||n>=256)return!1}return!0}(t)?rY(new Uint8Array(t)):nY.throwArgumentError("invalid arrayify value","value",t)}function aY(t){return"0x"+HW.sha256().update(oY(t)).digest("hex")}new eY("sha2/5.6.0");class sY{constructor(t){Object.assign(this,t)}encode(){return p_.from(YE(uY,this))}static decode(t){return GE(uY,this,t)}static decodeUnchecked(t){return IE(uY,this,t)}}const uY=new Map;class cY extends sY{constructor(t){if(super({}),this._bn=void 0,function(t){return void 0!==t._bn}(t))this._bn=t._bn;else{if("string"==typeof t){const e=hE.decode(t);if(32!=e.length)throw new Error("Invalid public key input");this._bn=new nE(e)}else this._bn=new nE(t);if(this._bn.byteLength()>32)throw new Error("Invalid public key input")}}equals(t){return this._bn.eq(t._bn)}toBase58(){return hE.encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){return this.toBuffer()}toBuffer(){const t=this._bn.toArrayLike(p_);if(32===t.length)return t;const e=p_.alloc(32);return t.copy(e,32-t.length),e}toString(){return this.toBase58()}static async createWithSeed(t,e,n){const r=p_.concat([t.toBuffer(),p_.from(e),n.toBuffer()]),i=aY(new Uint8Array(r)).slice(2);return new cY(p_.from(i,"hex"))}static createProgramAddressSync(t,e){let n=p_.alloc(0);t.forEach((function(t){if(t.length>32)throw new TypeError("Max seed length exceeded");n=p_.concat([n,HU(t)])})),n=p_.concat([n,e.toBuffer(),p_.from("ProgramDerivedAddress")]);let r=aY(new Uint8Array(n)).slice(2),i=new nE(r,16).toArray(void 0,32);if(hY(i))throw new Error("Invalid seeds, address must fall off the curve");return new cY(i)}static async createProgramAddress(t,e){return this.createProgramAddressSync(t,e)}static findProgramAddressSync(t,e){let n,r=255;for(;0!=r;){try{const i=t.concat(p_.from([r]));n=this.createProgramAddressSync(i,e)}catch(t){if(t instanceof TypeError)throw t;r--;continue}return[n,r]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(t,e){return this.findProgramAddressSync(t,e)}static isOnCurve(t){return 1==hY(new cY(t).toBytes())}}cY.default=new cY("11111111111111111111111111111111"),uY.set(cY,{kind:"struct",fields:[["_bn","u256"]]});let lY=aE.lowlevel;function hY(t){var e=[lY.gf(),lY.gf(),lY.gf(),lY.gf()],n=lY.gf(),r=lY.gf(),i=lY.gf(),o=lY.gf(),a=lY.gf(),s=lY.gf(),u=lY.gf();return lY.set25519(e[2],dY),lY.unpack25519(e[1],t),lY.S(i,e[1]),lY.M(o,i,lY.D),lY.Z(i,i,e[2]),lY.A(o,e[2],o),lY.S(a,o),lY.S(s,a),lY.M(u,s,a),lY.M(n,u,i),lY.M(n,n,o),lY.pow2523(n,n),lY.M(n,n,i),lY.M(n,n,o),lY.M(n,n,o),lY.M(e[0],n,o),lY.S(r,e[0]),lY.M(r,r,o),pY(r,i)&&lY.M(e[0],e[0],fY),lY.S(r,e[0]),lY.M(r,r,o),pY(r,i)?0:1}let dY=lY.gf([1]),fY=lY.gf([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function pY(t,e){var n=new Uint8Array(32),r=new Uint8Array(32);return lY.pack25519(n,t),lY.pack25519(r,e),lY.crypto_verify_32(n,0,r,0)}const mY=new cY("BPFLoader1111111111111111111111111111111111"),gY=1232,yY=(t="publicKey")=>BN(32,t),bY=(t="string")=>{const e=PN([DN("length"),DN("lengthPadding"),BN(kN(DN(),-8),"chars")],t),n=e.decode.bind(e),r=e.encode.bind(e),i=e;return i.decode=(t,e)=>n(t,e).chars.toString(),i.encode=(t,e,n)=>{const i={chars:p_.from(t,"utf8")};return r(i,e,n)},i.alloc=t=>DN().span+DN().span+p_.from(t,"utf8").length,i};function vY(t){let e=0,n=0;for(;;){let r=t.shift();if(e|=(127&r)<<7*n,n+=1,0==(128&r))break}return e}function wY(t,e){let n=e;for(;;){let e=127&n;if(n>>=7,0==n){t.push(e);break}e|=128,t.push(e)}}class MY{constructor(t){this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=t.header,this.accountKeys=t.accountKeys.map((t=>new cY(t))),this.recentBlockhash=t.recentBlockhash,this.instructions=t.instructions,this.instructions.forEach((t=>this.indexToProgramIds.set(t.programIdIndex,this.accountKeys[t.programIdIndex])))}isAccountSigner(t){return t<this.header.numRequiredSignatures}isAccountWritable(t){return t<this.header.numRequiredSignatures-this.header.numReadonlySignedAccounts||t>=this.header.numRequiredSignatures&&t<this.accountKeys.length-this.header.numReadonlyUnsignedAccounts}isProgramId(t){return this.indexToProgramIds.has(t)}programIds(){return[...this.indexToProgramIds.values()]}nonProgramIds(){return this.accountKeys.filter(((t,e)=>!this.isProgramId(e)))}serialize(){const t=this.accountKeys.length;let e=[];wY(e,t);const n=this.instructions.map((t=>{const{accounts:e,programIdIndex:n}=t,r=Array.from(hE.decode(t.data));let i=[];wY(i,e.length);let o=[];return wY(o,r.length),{programIdIndex:n,keyIndicesCount:p_.from(i),keyIndices:e,dataLength:p_.from(o),data:r}}));let r=[];wY(r,n.length);let i=p_.alloc(gY);p_.from(r).copy(i);let o=r.length;n.forEach((t=>{const e=PN([jN("programIdIndex"),BN(t.keyIndicesCount.length,"keyIndicesCount"),RN(jN("keyIndex"),t.keyIndices.length,"keyIndices"),BN(t.dataLength.length,"dataLength"),RN(jN("userdatum"),t.data.length,"data")]).encode(t,i,o);o+=e})),i=i.slice(0,o);const a=PN([BN(1,"numRequiredSignatures"),BN(1,"numReadonlySignedAccounts"),BN(1,"numReadonlyUnsignedAccounts"),BN(e.length,"keyCount"),RN(yY("key"),t,"keys"),yY("recentBlockhash")]),s={numRequiredSignatures:p_.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:p_.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:p_.from([this.header.numReadonlyUnsignedAccounts]),keyCount:p_.from(e),keys:this.accountKeys.map((t=>HU(t.toBytes()))),recentBlockhash:hE.decode(this.recentBlockhash)};let u=p_.alloc(2048);const c=a.encode(s,u);return i.copy(u,c),u.slice(0,c+i.length)}static from(t){let e=[...t];const n=e.shift(),r=e.shift(),i=e.shift(),o=vY(e);let a=[];for(let t=0;t<o;t++){const t=e.slice(0,32);e=e.slice(32),a.push(hE.encode(p_.from(t)))}const s=e.slice(0,32);e=e.slice(32);const u=vY(e);let c=[];for(let t=0;t<u;t++){const t=e.shift(),n=vY(e),r=e.slice(0,n);e=e.slice(n);const i=vY(e),o=e.slice(0,i),a=hE.encode(p_.from(o));e=e.slice(i),c.push({programIdIndex:t,accounts:r,data:a})}const l={header:{numRequiredSignatures:n,numReadonlySignedAccounts:r,numReadonlyUnsignedAccounts:i},recentBlockhash:hE.encode(p_.from(s)),accountKeys:a,instructions:c};return new MY(l)}}function _Y(t,e){if(!t)throw new Error(e||"Assertion failed")}let EY;!function(t){t[t.BLOCKHEIGHT_EXCEEDED=0]="BLOCKHEIGHT_EXCEEDED",t[t.PROCESSED=1]="PROCESSED",t[t.TIMED_OUT=2]="TIMED_OUT"}(EY||(EY={}));const NY=p_.alloc(64).fill(0);class LY{constructor(t){this.keys=void 0,this.programId=void 0,this.data=p_.alloc(0),this.programId=t.programId,this.keys=t.keys,t.data&&(this.data=t.data)}toJSON(){return{keys:this.keys.map((({pubkey:t,isSigner:e,isWritable:n})=>({pubkey:t.toJSON(),isSigner:e,isWritable:n}))),programId:this.programId.toJSON(),data:[...this.data]}}}class SY{get signature(){return this.signatures.length>0?this.signatures[0].signature:null}constructor(t){if(this.signatures=[],this.feePayer=void 0,this.instructions=[],this.recentBlockhash=void 0,this.lastValidBlockHeight=void 0,this.nonceInfo=void 0,this._message=void 0,this._json=void 0,t)if(t.feePayer&&(this.feePayer=t.feePayer),t.signatures&&(this.signatures=t.signatures),Object.prototype.hasOwnProperty.call(t,"lastValidBlockHeight")){const{blockhash:e,lastValidBlockHeight:n}=t;this.recentBlockhash=e,this.lastValidBlockHeight=n}else{const{recentBlockhash:e,nonceInfo:n}=t;n&&(this.nonceInfo=n),this.recentBlockhash=e}}toJSON(){return{recentBlockhash:this.recentBlockhash||null,feePayer:this.feePayer?this.feePayer.toJSON():null,nonceInfo:this.nonceInfo?{nonce:this.nonceInfo.nonce,nonceInstruction:this.nonceInfo.nonceInstruction.toJSON()}:null,instructions:this.instructions.map((t=>t.toJSON())),signers:this.signatures.map((({publicKey:t})=>t.toJSON()))}}add(...t){if(0===t.length)throw new Error("No instructions");return t.forEach((t=>{"instructions"in t?this.instructions=this.instructions.concat(t.instructions):"data"in t&&"programId"in t&&"keys"in t?this.instructions.push(t):this.instructions.push(new LY(t))})),this}compileMessage(){if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;let t,e,n;if(this.nonceInfo?(t=this.nonceInfo.nonce,e=this.instructions[0]!=this.nonceInfo.nonceInstruction?[this.nonceInfo.nonceInstruction,...this.instructions]:this.instructions):(t=this.recentBlockhash,e=this.instructions),!t)throw new Error("Transaction recentBlockhash required");if(e.length<1&&console.warn("No instructions provided"),this.feePayer)n=this.feePayer;else{if(!(this.signatures.length>0&&this.signatures[0].publicKey))throw new Error("Transaction fee payer required");n=this.signatures[0].publicKey}for(let t=0;t<e.length;t++)if(void 0===e[t].programId)throw new Error(`Transaction instruction index ${t} has undefined program id`);const r=[],i=[];e.forEach((t=>{t.keys.forEach((t=>{i.push({...t})}));const e=t.programId.toString();r.includes(e)||r.push(e)})),r.forEach((t=>{i.push({pubkey:new cY(t),isSigner:!1,isWritable:!1})}));const o=[];i.forEach((t=>{const e=t.pubkey.toString(),n=o.findIndex((t=>t.pubkey.toString()===e));n>-1?(o[n].isWritable=o[n].isWritable||t.isWritable,o[n].isSigner=o[n].isSigner||t.isSigner):o.push(t)})),o.sort((function(t,e){return t.isSigner!==e.isSigner?t.isSigner?-1:1:t.isWritable!==e.isWritable?t.isWritable?-1:1:t.pubkey.toBase58().localeCompare(e.pubkey.toBase58())}));const a=o.findIndex((t=>t.pubkey.equals(n)));if(a>-1){const[t]=o.splice(a,1);t.isSigner=!0,t.isWritable=!0,o.unshift(t)}else o.unshift({pubkey:n,isSigner:!0,isWritable:!0});for(const t of this.signatures){const e=o.findIndex((e=>e.pubkey.equals(t.publicKey)));if(!(e>-1))throw new Error(`unknown signer: ${t.publicKey.toString()}`);o[e].isSigner||(o[e].isSigner=!0,console.warn("Transaction references a signature that is unnecessary, only the fee payer and instruction signer accounts should sign a transaction. This behavior is deprecated and will throw an error in the next major version release."))}let s=0,u=0,c=0;const l=[],h=[];o.forEach((({pubkey:t,isSigner:e,isWritable:n})=>{e?(l.push(t.toString()),s+=1,n||(u+=1)):(h.push(t.toString()),n||(c+=1))}));const d=l.concat(h),f=e.map((t=>{const{data:e,programId:n}=t;return{programIdIndex:d.indexOf(n.toString()),accounts:t.keys.map((t=>d.indexOf(t.pubkey.toString()))),data:hE.encode(e)}}));return f.forEach((t=>{_Y(t.programIdIndex>=0),t.accounts.forEach((t=>_Y(t>=0)))})),new MY({header:{numRequiredSignatures:s,numReadonlySignedAccounts:u,numReadonlyUnsignedAccounts:c},accountKeys:d,recentBlockhash:t,instructions:f})}_compile(){const t=this.compileMessage(),e=t.accountKeys.slice(0,t.header.numRequiredSignatures);if(this.signatures.length===e.length){if(this.signatures.every(((t,n)=>e[n].equals(t.publicKey))))return t}return this.signatures=e.map((t=>({signature:null,publicKey:t}))),t}serializeMessage(){return this._compile().serialize()}async getEstimatedFee(t){return(await t.getFeeForMessage(this.compileMessage())).value}setSigners(...t){if(0===t.length)throw new Error("No signers");const e=new Set;this.signatures=t.filter((t=>{const n=t.toString();return!e.has(n)&&(e.add(n),!0)})).map((t=>({signature:null,publicKey:t})))}sign(...t){if(0===t.length)throw new Error("No signers");const e=new Set,n=[];for(const r of t){const t=r.publicKey.toString();e.has(t)||(e.add(t),n.push(r))}this.signatures=n.map((t=>({signature:null,publicKey:t.publicKey})));const r=this._compile();this._partialSign(r,...n)}partialSign(...t){if(0===t.length)throw new Error("No signers");const e=new Set,n=[];for(const r of t){const t=r.publicKey.toString();e.has(t)||(e.add(t),n.push(r))}const r=this._compile();this._partialSign(r,...n)}_partialSign(t,...e){const n=t.serialize();e.forEach((t=>{const e=aE.sign.detached(n,t.secretKey);this._addSignature(t.publicKey,HU(e))}))}addSignature(t,e){this._compile(),this._addSignature(t,e)}_addSignature(t,e){_Y(64===e.length);const n=this.signatures.findIndex((e=>t.equals(e.publicKey)));if(n<0)throw new Error(`unknown signer: ${t.toString()}`);this.signatures[n].signature=p_.from(e)}verifySignatures(){return this._verifySignatures(this.serializeMessage(),!0)}_verifySignatures(t,e){for(const{signature:n,publicKey:r}of this.signatures)if(null===n){if(e)return!1}else if(!aE.sign.detached.verify(t,n,r.toBuffer()))return!1;return!0}serialize(t){const{requireAllSignatures:e,verifySignatures:n}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},t),r=this.serializeMessage();if(n&&!this._verifySignatures(r,e))throw new Error("Signature verification failed");return this._serialize(r)}_serialize(t){const{signatures:e}=this,n=[];wY(n,e.length);const r=n.length+64*e.length+t.length,i=p_.alloc(r);return _Y(e.length<256),p_.from(n).copy(i,0),e.forEach((({signature:t},e)=>{null!==t&&(_Y(64===t.length,"signature has invalid length"),p_.from(t).copy(i,n.length+64*e))})),t.copy(i,n.length+64*e.length),_Y(i.length<=gY,`Transaction too large: ${i.length} > 1232`),i}get keys(){return _Y(1===this.instructions.length),this.instructions[0].keys.map((t=>t.pubkey))}get programId(){return _Y(1===this.instructions.length),this.instructions[0].programId}get data(){return _Y(1===this.instructions.length),this.instructions[0].data}static from(t){let e=[...t];const n=vY(e);let r=[];for(let t=0;t<n;t++){const t=e.slice(0,64);e=e.slice(64),r.push(hE.encode(p_.from(t)))}return SY.populate(MY.from(e),r)}static populate(t,e=[]){const n=new SY;return n.recentBlockhash=t.recentBlockhash,t.header.numRequiredSignatures>0&&(n.feePayer=t.accountKeys[0]),e.forEach(((e,r)=>{const i={signature:e==hE.encode(NY)?null:hE.decode(e),publicKey:t.accountKeys[r]};n.signatures.push(i)})),t.instructions.forEach((e=>{const r=e.accounts.map((e=>{const r=t.accountKeys[e];return{pubkey:r,isSigner:n.signatures.some((t=>t.publicKey.toString()===r.toString()))||t.isAccountSigner(e),isWritable:t.isAccountWritable(e)}}));n.instructions.push(new LY({keys:r,programId:t.accountKeys[e.programIdIndex],data:hE.decode(e.data)}))})),n._message=t,n._json=n.toJSON(),n}}const AY=new cY("SysvarC1ock11111111111111111111111111111111"),xY=new cY("SysvarEpochSchedu1e111111111111111111111111"),TY=new cY("Sysvar1nstructions1111111111111111111111111"),IY=new cY("SysvarRecentB1ockHashes11111111111111111111"),kY=new cY("SysvarRent111111111111111111111111111111111"),jY=new cY("SysvarRewards111111111111111111111111111111"),CY=new cY("SysvarS1otHashes111111111111111111111111111"),DY=new cY("SysvarS1otHistory11111111111111111111111111"),OY=new cY("SysvarStakeHistory1111111111111111111111111");async function zY(t,e,n,r){const i=r&&{skipPreflight:r.skipPreflight,preflightCommitment:r.preflightCommitment||r.commitment,maxRetries:r.maxRetries,minContextSlot:r.minContextSlot},o=await t.sendTransaction(e,n,i),a=null!=e.recentBlockhash&&null!=e.lastValidBlockHeight?(await t.confirmTransaction({signature:o,blockhash:e.recentBlockhash,lastValidBlockHeight:e.lastValidBlockHeight},r&&r.commitment)).value:(await t.confirmTransaction(o,r&&r.commitment)).value;if(a.err)throw new Error(`Transaction ${o} failed (${JSON.stringify(a)})`);return o}function PY(t){return new Promise((e=>setTimeout(e,t)))}function RY(t,e){const n=t.layout.span>=0?t.layout.span:function(t,e){let n=0;return t.layout.fields.forEach((t=>{t.span>=0?n+=t.span:"function"==typeof t.alloc&&(n+=t.alloc(e[t.property]))})),n}(t,e),r=p_.alloc(n),i=Object.assign({instruction:t.index},e);return t.layout.encode(i,r),r}function BY(t,e){let n;try{n=t.layout.decode(e)}catch(t){throw new Error("invalid instruction; "+t)}if(n.instruction!==t.index)throw new Error(`invalid instruction; instruction index mismatch ${n.instruction} != ${t.index}`);return n}const UY=ON("lamportsPerSignature"),FY=PN([DN("version"),DN("state"),yY("authorizedPubkey"),yY("nonce"),PN([UY],"feeCalculator")]),WY=FY.span;class YY{constructor(t){this.authorizedPubkey=void 0,this.nonce=void 0,this.feeCalculator=void 0,this.authorizedPubkey=t.authorizedPubkey,this.nonce=t.nonce,this.feeCalculator=t.feeCalculator}static fromAccountData(t){const e=FY.decode(HU(t),0);return new YY({authorizedPubkey:new cY(e.authorizedPubkey),nonce:new cY(e.nonce).toString(),feeCalculator:e.feeCalculator})}}const QY=(HY=8,t=>{const e=BN(HY,t),{encode:n,decode:r}=(t=>({decode:t.decode.bind(t),encode:t.encode.bind(t)}))(e),i=e;return i.decode=(t,e)=>{const n=r(t,e);return FN(p_.from(n))},i.encode=(t,e,r)=>{const i=WN(t,HY);return n(i,e,r)},i});var HY;const GY=Object.freeze({Create:{index:0,layout:PN([DN("instruction"),zN("lamports"),zN("space"),yY("programId")])},Assign:{index:1,layout:PN([DN("instruction"),yY("programId")])},Transfer:{index:2,layout:PN([DN("instruction"),QY("lamports")])},CreateWithSeed:{index:3,layout:PN([DN("instruction"),yY("base"),bY("seed"),zN("lamports"),zN("space"),yY("programId")])},AdvanceNonceAccount:{index:4,layout:PN([DN("instruction")])},WithdrawNonceAccount:{index:5,layout:PN([DN("instruction"),zN("lamports")])},InitializeNonceAccount:{index:6,layout:PN([DN("instruction"),yY("authorized")])},AuthorizeNonceAccount:{index:7,layout:PN([DN("instruction"),yY("authorized")])},Allocate:{index:8,layout:PN([DN("instruction"),zN("space")])},AllocateWithSeed:{index:9,layout:PN([DN("instruction"),yY("base"),bY("seed"),zN("space"),yY("programId")])},AssignWithSeed:{index:10,layout:PN([DN("instruction"),yY("base"),bY("seed"),yY("programId")])},TransferWithSeed:{index:11,layout:PN([DN("instruction"),QY("lamports"),bY("seed"),yY("programId")])},UpgradeNonceAccount:{index:12,layout:PN([DN("instruction")])}});class ZY{constructor(){}static createAccount(t){const e=RY(GY.Create,{lamports:t.lamports,space:t.space,programId:HU(t.programId.toBuffer())});return new LY({keys:[{pubkey:t.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:t.newAccountPubkey,isSigner:!0,isWritable:!0}],programId:this.programId,data:e})}static transfer(t){let e,n;if("basePubkey"in t){e=RY(GY.TransferWithSeed,{lamports:BigInt(t.lamports),seed:t.seed,programId:HU(t.programId.toBuffer())}),n=[{pubkey:t.fromPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0}]}else{e=RY(GY.Transfer,{lamports:BigInt(t.lamports)}),n=[{pubkey:t.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0}]}return new LY({keys:n,programId:this.programId,data:e})}static assign(t){let e,n;if("basePubkey"in t){e=RY(GY.AssignWithSeed,{base:HU(t.basePubkey.toBuffer()),seed:t.seed,programId:HU(t.programId.toBuffer())}),n=[{pubkey:t.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1}]}else{e=RY(GY.Assign,{programId:HU(t.programId.toBuffer())}),n=[{pubkey:t.accountPubkey,isSigner:!0,isWritable:!0}]}return new LY({keys:n,programId:this.programId,data:e})}static createAccountWithSeed(t){const e=RY(GY.CreateWithSeed,{base:HU(t.basePubkey.toBuffer()),seed:t.seed,lamports:t.lamports,space:t.space,programId:HU(t.programId.toBuffer())});let n=[{pubkey:t.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:t.newAccountPubkey,isSigner:!1,isWritable:!0}];return t.basePubkey!=t.fromPubkey&&n.push({pubkey:t.basePubkey,isSigner:!0,isWritable:!1}),new LY({keys:n,programId:this.programId,data:e})}static createNonceAccount(t){const e=new SY;"basePubkey"in t&&"seed"in t?e.add(ZY.createAccountWithSeed({fromPubkey:t.fromPubkey,newAccountPubkey:t.noncePubkey,basePubkey:t.basePubkey,seed:t.seed,lamports:t.lamports,space:WY,programId:this.programId})):e.add(ZY.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.noncePubkey,lamports:t.lamports,space:WY,programId:this.programId}));const n={noncePubkey:t.noncePubkey,authorizedPubkey:t.authorizedPubkey};return e.add(this.nonceInitialize(n)),e}static nonceInitialize(t){const e=RY(GY.InitializeNonceAccount,{authorized:HU(t.authorizedPubkey.toBuffer())}),n={keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:IY,isSigner:!1,isWritable:!1},{pubkey:kY,isSigner:!1,isWritable:!1}],programId:this.programId,data:e};return new LY(n)}static nonceAdvance(t){const e=RY(GY.AdvanceNonceAccount),n={keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:IY,isSigner:!1,isWritable:!1},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:e};return new LY(n)}static nonceWithdraw(t){const e=RY(GY.WithdrawNonceAccount,{lamports:t.lamports});return new LY({keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0},{pubkey:IY,isSigner:!1,isWritable:!1},{pubkey:kY,isSigner:!1,isWritable:!1},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:e})}static nonceAuthorize(t){const e=RY(GY.AuthorizeNonceAccount,{authorized:HU(t.newAuthorizedPubkey.toBuffer())});return new LY({keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:e})}static allocate(t){let e,n;if("basePubkey"in t){e=RY(GY.AllocateWithSeed,{base:HU(t.basePubkey.toBuffer()),seed:t.seed,space:t.space,programId:HU(t.programId.toBuffer())}),n=[{pubkey:t.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1}]}else{e=RY(GY.Allocate,{space:t.space}),n=[{pubkey:t.accountPubkey,isSigner:!0,isWritable:!0}]}return new LY({keys:n,programId:this.programId,data:e})}}ZY.programId=new cY("11111111111111111111111111111111");class VY{constructor(){}static getMinNumSignatures(t){return 2*(Math.ceil(t/VY.chunkSize)+1+1)}static async load(t,e,n,r,i){{const o=await t.getMinimumBalanceForRentExemption(i.length),a=await t.getAccountInfo(n.publicKey,"confirmed");let s=null;if(null!==a){if(a.executable)return console.error("Program load failed, account is already executable"),!1;a.data.length!==i.length&&(s=s||new SY,s.add(ZY.allocate({accountPubkey:n.publicKey,space:i.length}))),a.owner.equals(r)||(s=s||new SY,s.add(ZY.assign({accountPubkey:n.publicKey,programId:r}))),a.lamports<o&&(s=s||new SY,s.add(ZY.transfer({fromPubkey:e.publicKey,toPubkey:n.publicKey,lamports:o-a.lamports})))}else s=(new SY).add(ZY.createAccount({fromPubkey:e.publicKey,newAccountPubkey:n.publicKey,lamports:o>0?o:1,space:i.length,programId:r}));null!==s&&await zY(t,s,[e,n],{commitment:"confirmed"})}const o=PN([DN("instruction"),DN("offset"),DN("bytesLength"),DN("bytesLengthPadding"),RN(jN("byte"),kN(DN(),-8),"bytes")]),a=VY.chunkSize;let s=0,u=i,c=[];for(;u.length>0;){const i=u.slice(0,a),l=p_.alloc(a+16);o.encode({instruction:0,offset:s,bytes:i,bytesLength:0,bytesLengthPadding:0},l);const h=(new SY).add({keys:[{pubkey:n.publicKey,isSigner:!0,isWritable:!0}],programId:r,data:l});if(c.push(zY(t,h,[e,n],{commitment:"confirmed"})),t._rpcEndpoint.includes("solana.com")){const t=4;await PY(1e3/t)}s+=a,u=u.slice(a)}await Promise.all(c);{const i=PN([DN("instruction")]),o=p_.alloc(i.span);i.encode({instruction:1},o);const a=(new SY).add({keys:[{pubkey:n.publicKey,isSigner:!0,isWritable:!0},{pubkey:kY,isSigner:!1,isWritable:!1}],programId:r,data:o});await zY(t,a,[e,n],{commitment:"confirmed"})}return!0}}VY.chunkSize=932;const qY=new cY("BPFLoader2111111111111111111111111111111111");const JY=Object.freeze({RequestUnits:{index:0,layout:PN([jN("instruction"),DN("units"),DN("additionalFee")])},RequestHeapFrame:{index:1,layout:PN([jN("instruction"),DN("bytes")])},SetComputeUnitLimit:{index:2,layout:PN([jN("instruction"),DN("units")])},SetComputeUnitPrice:{index:3,layout:PN([jN("instruction"),QY("microLamports")])}});class KY{constructor(){}static requestUnits(t){const e=RY(JY.RequestUnits,t);return new LY({keys:[],programId:this.programId,data:e})}static requestHeapFrame(t){const e=RY(JY.RequestHeapFrame,t);return new LY({keys:[],programId:this.programId,data:e})}static setComputeUnitLimit(t){const e=RY(JY.SetComputeUnitLimit,t);return new LY({keys:[],programId:this.programId,data:e})}static setComputeUnitPrice(t){const e=RY(JY.SetComputeUnitPrice,{microLamports:BigInt(t.microLamports)});return new LY({keys:[],programId:this.programId,data:e})}}KY.programId=new cY("ComputeBudget111111111111111111111111111111");var XY=Object.prototype.toString,$Y=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};function tQ(t,e){var n,r,i,o,a,s,u;if(!0===t)return"true";if(!1===t)return"false";switch(typeof t){case"object":if(null===t)return null;if(t.toJSON&&"function"==typeof t.toJSON)return tQ(t.toJSON(),e);if("[object Array]"===(u=XY.call(t))){for(i="[",r=t.length-1,n=0;n<r;n++)i+=tQ(t[n],!0)+",";return r>-1&&(i+=tQ(t[n],!0)),i+"]"}if("[object Object]"===u){for(r=(o=$Y(t).sort()).length,i="",n=0;n<r;)void 0!==(s=tQ(t[a=o[n]],!1))&&(i&&(i+=","),i+=JSON.stringify(a)+":"+s),n++;return"{"+i+"}"}return JSON.stringify(t);case"function":case"undefined":return e?null:void 0;case"string":return JSON.stringify(t);default:return isFinite(t)?t:null}}var eQ=function(t){var e=tQ(t,!1);if(void 0!==e)return""+e};function nQ(t){let e=0;for(;t>1;)t/=2,e++;return e}class rQ{constructor(t,e,n,r,i){this.slotsPerEpoch=void 0,this.leaderScheduleSlotOffset=void 0,this.warmup=void 0,this.firstNormalEpoch=void 0,this.firstNormalSlot=void 0,this.slotsPerEpoch=t,this.leaderScheduleSlotOffset=e,this.warmup=n,this.firstNormalEpoch=r,this.firstNormalSlot=i}getEpoch(t){return this.getEpochAndSlotIndex(t)[0]}getEpochAndSlotIndex(t){if(t<this.firstNormalSlot){const e=nQ(function(t){return 0===t?1:(t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,1+(t|=t>>32))}(t+32+1))-nQ(32)-1;return[e,t-(this.getSlotsInEpoch(e)-32)]}{const e=t-this.firstNormalSlot,n=Math.floor(e/this.slotsPerEpoch);return[this.firstNormalEpoch+n,e%this.slotsPerEpoch]}}getFirstSlotInEpoch(t){return t<=this.firstNormalEpoch?32*(Math.pow(2,t)-1):(t-this.firstNormalEpoch)*this.slotsPerEpoch+this.firstNormalSlot}getLastSlotInEpoch(t){return this.getFirstSlotInEpoch(t)+this.getSlotsInEpoch(t)-1}getSlotsInEpoch(t){return t<this.firstNormalEpoch?Math.pow(2,t+nQ(32)):this.slotsPerEpoch}}class iQ extends Error{constructor(t,e){super(t),this.logs=void 0,this.logs=e}}class oQ extends Error{constructor({code:t,message:e,data:n},r){super(null!=r?`${r}: ${e}`:e),this.code=void 0,this.data=void 0,this.code=t,this.data=n,this.name="SolanaJSONRPCError"}}var aQ=globalThis.fetch;class sQ extends Error{constructor(t){super(`Signature ${t} has expired: block height exceeded.`),this.signature=void 0,this.signature=t}}Object.defineProperty(sQ.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});class uQ extends Error{constructor(t,e){super(`Transaction was not confirmed in ${e.toFixed(2)} seconds. It is unknown if it succeeded or failed. Check signature ${t} using the Solana Explorer or CLI tools.`),this.signature=void 0,this.signature=t}}var cQ;Object.defineProperty(uQ.prototype,"name",{value:"TransactionExpiredTimeoutError"});const lQ=pL(rL(cY),cL(),(t=>new cY(t))),hQ=lL([cL(),iL("base64")]),dQ=pL(rL(p_),hQ,(t=>p_.from(t[0],"base64")));function fQ(t){let e,n;if("string"==typeof t)e=t;else if(t){const{commitment:r,...i}=t;e=r,n=i}return{commitment:e,config:n}}function pQ(t){return dL([hL({jsonrpc:iL("2.0"),id:cL(),result:t}),hL({jsonrpc:iL("2.0"),id:cL(),error:hL({code:fL(),message:cL(),data:sL(tL("any",(()=>!0)))})})])}const mQ=pQ(fL());function gQ(t){return pL(pQ(t),mQ,(e=>"error"in e?e:{...e,result:KN(e.result,t)}))}function yQ(t){return gQ(hL({context:hL({slot:aL()}),value:t}))}function bQ(t){return hL({context:hL({slot:aL()}),value:t})}const vQ=hL({foundation:aL(),foundationTerm:aL(),initial:aL(),taper:aL(),terminal:aL()}),wQ=gQ(eL(oL(hL({epoch:aL(),effectiveSlot:aL(),amount:aL(),postBalance:aL()})))),MQ=hL({epoch:aL(),slotIndex:aL(),slotsInEpoch:aL(),absoluteSlot:aL(),blockHeight:sL(aL()),transactionCount:sL(aL())}),_Q=hL({slotsPerEpoch:aL(),leaderScheduleSlotOffset:aL(),warmup:nL(),firstNormalEpoch:aL(),firstNormalSlot:aL()}),EQ=uL(cL(),eL(aL())),NQ=oL(dL([hL({}),cL()])),LQ=hL({err:NQ}),SQ=iL("receivedSignature"),AQ=hL({"solana-core":cL(),"feature-set":sL(aL())}),xQ=yQ(hL({err:oL(dL([hL({}),cL()])),logs:oL(eL(cL())),accounts:sL(oL(eL(oL(hL({executable:nL(),owner:cL(),lamports:aL(),data:eL(cL()),rentEpoch:sL(aL())}))))),unitsConsumed:sL(aL())})),TQ=yQ(hL({byIdentity:uL(cL(),eL(aL())),range:hL({firstSlot:aL(),lastSlot:aL()})}));const IQ=gQ(vQ),kQ=gQ(MQ),jQ=gQ(_Q),CQ=gQ(EQ),DQ=gQ(aL()),OQ=yQ(hL({total:aL(),circulating:aL(),nonCirculating:aL(),nonCirculatingAccounts:eL(lQ)})),zQ=hL({amount:cL(),uiAmount:oL(aL()),decimals:aL(),uiAmountString:sL(cL())}),PQ=yQ(eL(hL({address:lQ,amount:cL(),uiAmount:oL(aL()),decimals:aL(),uiAmountString:sL(cL())}))),RQ=yQ(eL(hL({pubkey:lQ,account:hL({executable:nL(),owner:lQ,lamports:aL(),data:dQ,rentEpoch:aL()})}))),BQ=hL({program:cL(),parsed:fL(),space:aL()}),UQ=yQ(eL(hL({pubkey:lQ,account:hL({executable:nL(),owner:lQ,lamports:aL(),data:BQ,rentEpoch:aL()})}))),FQ=yQ(eL(hL({lamports:aL(),address:lQ}))),WQ=hL({executable:nL(),owner:lQ,lamports:aL(),data:dQ,rentEpoch:aL()}),YQ=hL({pubkey:lQ,account:WQ}),QQ=pL(dL([rL(p_),BQ]),dL([hQ,BQ]),(t=>Array.isArray(t)?KN(t,dQ):t)),HQ=hL({executable:nL(),owner:lQ,lamports:aL(),data:QQ,rentEpoch:aL()}),GQ=hL({pubkey:lQ,account:HQ}),ZQ=hL({state:dL([iL("active"),iL("inactive"),iL("activating"),iL("deactivating")]),active:aL(),inactive:aL()}),VQ=gQ(eL(hL({signature:cL(),slot:aL(),err:NQ,memo:oL(cL()),blockTime:sL(oL(aL()))}))),qQ=gQ(eL(hL({signature:cL(),slot:aL(),err:NQ,memo:oL(cL()),blockTime:sL(oL(aL()))}))),JQ=hL({subscription:aL(),result:bQ(WQ)}),KQ=hL({pubkey:lQ,account:WQ}),XQ=hL({subscription:aL(),result:bQ(KQ)}),$Q=hL({parent:aL(),slot:aL(),root:aL()}),tH=hL({subscription:aL(),result:$Q}),eH=dL([hL({type:dL([iL("firstShredReceived"),iL("completed"),iL("optimisticConfirmation"),iL("root")]),slot:aL(),timestamp:aL()}),hL({type:iL("createdBank"),parent:aL(),slot:aL(),timestamp:aL()}),hL({type:iL("frozen"),slot:aL(),timestamp:aL(),stats:hL({numTransactionEntries:aL(),numSuccessfulTransactions:aL(),numFailedTransactions:aL(),maxTransactionsPerEntry:aL()})}),hL({type:iL("dead"),slot:aL(),timestamp:aL(),err:cL()})]),nH=hL({subscription:aL(),result:eH}),rH=hL({subscription:aL(),result:bQ(dL([LQ,SQ]))}),iH=hL({subscription:aL(),result:aL()}),oH=hL({pubkey:cL(),gossip:oL(cL()),tpu:oL(cL()),rpc:oL(cL()),version:oL(cL())}),aH=hL({votePubkey:cL(),nodePubkey:cL(),activatedStake:aL(),epochVoteAccount:nL(),epochCredits:eL(lL([aL(),aL(),aL()])),commission:aL(),lastVote:aL(),rootSlot:oL(aL())}),sH=gQ(hL({current:eL(aH),delinquent:eL(aH)})),uH=dL([iL("processed"),iL("confirmed"),iL("finalized")]),cH=hL({slot:aL(),confirmations:oL(aL()),err:NQ,confirmationStatus:sL(uH)}),lH=yQ(eL(oL(cH))),hH=gQ(aL()),dH=hL({signatures:eL(cL()),message:hL({accountKeys:eL(cL()),header:hL({numRequiredSignatures:aL(),numReadonlySignedAccounts:aL(),numReadonlyUnsignedAccounts:aL()}),instructions:eL(hL({accounts:eL(aL()),data:cL(),programIdIndex:aL()})),recentBlockhash:cL()})}),fH=hL({parsed:fL(),program:cL(),programId:lQ}),pH=hL({accounts:eL(lQ),data:cL(),programId:lQ}),mH=pL(dL([pH,fH]),dL([hL({parsed:fL(),program:cL(),programId:cL()}),hL({accounts:eL(cL()),data:cL(),programId:cL()})]),(t=>KN(t,"accounts"in t?pH:fH))),gH=hL({signatures:eL(cL()),message:hL({accountKeys:eL(hL({pubkey:lQ,signer:nL(),writable:nL()})),instructions:eL(mH),recentBlockhash:cL()})}),yH=hL({accountIndex:aL(),mint:cL(),owner:sL(cL()),uiTokenAmount:zQ}),bH=hL({err:NQ,fee:aL(),innerInstructions:sL(oL(eL(hL({index:aL(),instructions:eL(hL({accounts:eL(aL()),data:cL(),programIdIndex:aL()}))})))),preBalances:eL(aL()),postBalances:eL(aL()),logMessages:sL(oL(eL(cL()))),preTokenBalances:sL(oL(eL(yH))),postTokenBalances:sL(oL(eL(yH)))}),vH=hL({err:NQ,fee:aL(),innerInstructions:sL(oL(eL(hL({index:aL(),instructions:eL(mH)})))),preBalances:eL(aL()),postBalances:eL(aL()),logMessages:sL(oL(eL(cL()))),preTokenBalances:sL(oL(eL(yH))),postTokenBalances:sL(oL(eL(yH)))}),wH=gQ(oL(hL({blockhash:cL(),previousBlockhash:cL(),parentSlot:aL(),transactions:eL(hL({transaction:dH,meta:oL(bH)})),rewards:sL(eL(hL({pubkey:cL(),lamports:aL(),postBalance:oL(aL()),rewardType:oL(cL())}))),blockTime:oL(aL()),blockHeight:oL(aL())}))),MH=gQ(oL(hL({blockhash:cL(),previousBlockhash:cL(),parentSlot:aL(),transactions:eL(hL({transaction:dH,meta:oL(bH)})),rewards:sL(eL(hL({pubkey:cL(),lamports:aL(),postBalance:oL(aL()),rewardType:oL(cL())}))),blockTime:oL(aL())}))),_H=gQ(oL(hL({blockhash:cL(),previousBlockhash:cL(),parentSlot:aL(),signatures:eL(cL()),blockTime:oL(aL())}))),EH=gQ(oL(hL({slot:aL(),meta:bH,blockTime:sL(oL(aL())),transaction:dH}))),NH=gQ(oL(hL({slot:aL(),transaction:gH,meta:oL(vH),blockTime:sL(oL(aL()))}))),LH=yQ(hL({blockhash:cL(),feeCalculator:hL({lamportsPerSignature:aL()})})),SH=yQ(hL({blockhash:cL(),lastValidBlockHeight:aL()})),AH=gQ(eL(hL({slot:aL(),numTransactions:aL(),numSlots:aL(),samplePeriodSecs:aL()}))),xH=yQ(oL(hL({feeCalculator:hL({lamportsPerSignature:aL()})}))),TH=gQ(cL()),IH=gQ(cL()),kH=hL({err:NQ,logs:eL(cL()),signature:cL()}),jH=hL({result:bQ(kH),subscription:aL()}),CH={"solana-client":`js/${null!==(cQ="0.0.0-development")?cQ:"UNKNOWN"}`};class DH{constructor(t,e){this._commitment=void 0,this._confirmTransactionInitialTimeout=void 0,this._rpcEndpoint=void 0,this._rpcWsEndpoint=void 0,this._rpcClient=void 0,this._rpcRequest=void 0,this._rpcBatchRequest=void 0,this._rpcWebSocket=void 0,this._rpcWebSocketConnected=!1,this._rpcWebSocketHeartbeat=null,this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketGeneration=0,this._disableBlockhashCaching=!1,this._pollingBlockhash=!1,this._blockhashInfo={latestBlockhash:null,lastFetch:0,transactionSignatures:[],simulatedSignatures:[]},this._nextClientSubscriptionId=0,this._subscriptionDisposeFunctionsByClientSubscriptionId={},this._subscriptionCallbacksByServerSubscriptionId={},this._subscriptionsByHash={},this._subscriptionsAutoDisposedByRpc=new Set;let n=new URL(t);n.protocol;let r,i,o,a,s;e&&"string"==typeof e?this._commitment=e:e&&(this._commitment=e.commitment,this._confirmTransactionInitialTimeout=e.confirmTransactionInitialTimeout,r=e.wsEndpoint,i=e.httpHeaders,o=e.fetch,a=e.fetchMiddleware,s=e.disableRetryOnRateLimit),this._rpcEndpoint=t,this._rpcWsEndpoint=r||function(t){let e=new URL(t);const n="https:"===e.protocol;return e.protocol=n?"wss:":"ws:",e.host="",""!==e.port&&(e.port=String(Number(e.port)+1)),e.toString()}(t),this._rpcClient=function(t,e,n,r,i,o){const a=r||aQ;let s;i&&(s=async(t,e)=>{const n=await new Promise(((n,r)=>{try{i(t,e,((t,e)=>n([t,e])))}catch(t){r(t)}}));return await a(...n)});const u=new jz((async(e,r)=>{const i={method:"POST",body:e,agent:void 0,headers:Object.assign({"Content-Type":"application/json"},n||{},CH)};try{let e,n=5,u=500;for(;e=s?await s(t,i):await a(t,i),429===e.status&&!0!==o&&(n-=1,0!==n);)console.log(`Server responded with ${e.status} ${e.statusText}. Retrying after ${u}ms delay...`),await PY(u),u*=2;const c=await e.text();e.ok?r(null,c):r(new Error(`${e.status} ${e.statusText}: ${c}`))}catch(t){t instanceof Error&&r(t)}}),{});return u}(n.toString(),0,i,o,a,s),this._rpcRequest=function(t){return(e,n)=>new Promise(((r,i)=>{t.request(e,n,((t,e)=>{t?i(t):r(e)}))}))}(this._rpcClient),this._rpcBatchRequest=function(t){return e=>new Promise(((n,r)=>{0===e.length&&n([]);const i=e.map((e=>t.request(e.methodName,e.args)));t.request(i,((t,e)=>{t?r(t):n(e)}))}))}(this._rpcClient),this._rpcWebSocket=new gL.Client(this._rpcWsEndpoint,{autoconnect:!1,max_reconnects:1/0}),this._rpcWebSocket.on("open",this._wsOnOpen.bind(this)),this._rpcWebSocket.on("error",this._wsOnError.bind(this)),this._rpcWebSocket.on("close",this._wsOnClose.bind(this)),this._rpcWebSocket.on("accountNotification",this._wsOnAccountNotification.bind(this)),this._rpcWebSocket.on("programNotification",this._wsOnProgramAccountNotification.bind(this)),this._rpcWebSocket.on("slotNotification",this._wsOnSlotNotification.bind(this)),this._rpcWebSocket.on("slotsUpdatesNotification",this._wsOnSlotUpdatesNotification.bind(this)),this._rpcWebSocket.on("signatureNotification",this._wsOnSignatureNotification.bind(this)),this._rpcWebSocket.on("rootNotification",this._wsOnRootNotification.bind(this)),this._rpcWebSocket.on("logsNotification",this._wsOnLogsNotification.bind(this))}get commitment(){return this._commitment}get rpcEndpoint(){return this._rpcEndpoint}async getBalanceAndContext(t,e){const{commitment:n,config:r}=fQ(e),i=this._buildArgs([t.toBase58()],n,void 0,r),o=KN(await this._rpcRequest("getBalance",i),yQ(aL()));if("error"in o)throw new oQ(o.error,`failed to get balance for ${t.toBase58()}`);return o.result}async getBalance(t,e){return await this.getBalanceAndContext(t,e).then((t=>t.value)).catch((e=>{throw new Error("failed to get balance of account "+t.toBase58()+": "+e)}))}async getBlockTime(t){const e=KN(await this._rpcRequest("getBlockTime",[t]),gQ(oL(aL())));if("error"in e)throw new oQ(e.error,`failed to get block time for slot ${t}`);return e.result}async getMinimumLedgerSlot(){const t=KN(await this._rpcRequest("minimumLedgerSlot",[]),gQ(aL()));if("error"in t)throw new oQ(t.error,"failed to get minimum ledger slot");return t.result}async getFirstAvailableBlock(){const t=KN(await this._rpcRequest("getFirstAvailableBlock",[]),DQ);if("error"in t)throw new oQ(t.error,"failed to get first available block");return t.result}async getSupply(t){let e={};e="string"==typeof t?{commitment:t}:t?{...t,commitment:t&&t.commitment||this.commitment}:{commitment:this.commitment};const n=KN(await this._rpcRequest("getSupply",[e]),OQ);if("error"in n)throw new oQ(n.error,"failed to get supply");return n.result}async getTokenSupply(t,e){const n=this._buildArgs([t.toBase58()],e),r=KN(await this._rpcRequest("getTokenSupply",n),yQ(zQ));if("error"in r)throw new oQ(r.error,"failed to get token supply");return r.result}async getTokenAccountBalance(t,e){const n=this._buildArgs([t.toBase58()],e),r=KN(await this._rpcRequest("getTokenAccountBalance",n),yQ(zQ));if("error"in r)throw new oQ(r.error,"failed to get token account balance");return r.result}async getTokenAccountsByOwner(t,e,n){const{commitment:r,config:i}=fQ(n);let o=[t.toBase58()];"mint"in e?o.push({mint:e.mint.toBase58()}):o.push({programId:e.programId.toBase58()});const a=this._buildArgs(o,r,"base64",i),s=KN(await this._rpcRequest("getTokenAccountsByOwner",a),RQ);if("error"in s)throw new oQ(s.error,`failed to get token accounts owned by account ${t.toBase58()}`);return s.result}async getParsedTokenAccountsByOwner(t,e,n){let r=[t.toBase58()];"mint"in e?r.push({mint:e.mint.toBase58()}):r.push({programId:e.programId.toBase58()});const i=this._buildArgs(r,n,"jsonParsed"),o=KN(await this._rpcRequest("getTokenAccountsByOwner",i),UQ);if("error"in o)throw new oQ(o.error,`failed to get token accounts owned by account ${t.toBase58()}`);return o.result}async getLargestAccounts(t){const e={...t,commitment:t&&t.commitment||this.commitment},n=e.filter||e.commitment?[e]:[],r=KN(await this._rpcRequest("getLargestAccounts",n),FQ);if("error"in r)throw new oQ(r.error,"failed to get largest accounts");return r.result}async getTokenLargestAccounts(t,e){const n=this._buildArgs([t.toBase58()],e),r=KN(await this._rpcRequest("getTokenLargestAccounts",n),PQ);if("error"in r)throw new oQ(r.error,"failed to get token largest accounts");return r.result}async getAccountInfoAndContext(t,e){const{commitment:n,config:r}=fQ(e),i=this._buildArgs([t.toBase58()],n,"base64",r),o=KN(await this._rpcRequest("getAccountInfo",i),yQ(oL(WQ)));if("error"in o)throw new oQ(o.error,`failed to get info about account ${t.toBase58()}`);return o.result}async getParsedAccountInfo(t,e){const n=this._buildArgs([t.toBase58()],e,"jsonParsed"),r=KN(await this._rpcRequest("getAccountInfo",n),yQ(oL(HQ)));if("error"in r)throw new oQ(r.error,`failed to get info about account ${t.toBase58()}`);return r.result}async getAccountInfo(t,e){try{return(await this.getAccountInfoAndContext(t,e)).value}catch(e){throw new Error("failed to get info about account "+t.toBase58()+": "+e)}}async getMultipleAccountsInfoAndContext(t,e){const{commitment:n,config:r}=fQ(e),i=t.map((t=>t.toBase58())),o=this._buildArgs([i],n,"base64",r),a=KN(await this._rpcRequest("getMultipleAccounts",o),yQ(eL(oL(WQ))));if("error"in a)throw new oQ(a.error,`failed to get info for accounts ${i}`);return a.result}async getMultipleAccountsInfo(t,e){return(await this.getMultipleAccountsInfoAndContext(t,e)).value}async getStakeActivation(t,e,n){const{commitment:r,config:i}=fQ(e),o=this._buildArgs([t.toBase58()],r,void 0,{...i,epoch:null!=n?n:null==i?void 0:i.epoch}),a=KN(await this._rpcRequest("getStakeActivation",o),gQ(ZQ));if("error"in a)throw new oQ(a.error,`failed to get Stake Activation ${t.toBase58()}`);return a.result}async getProgramAccounts(t,e){const{commitment:n,config:r}=fQ(e),{encoding:i,...o}=r||{},a=this._buildArgs([t.toBase58()],n,i||"base64",o),s=KN(await this._rpcRequest("getProgramAccounts",a),gQ(eL(YQ)));if("error"in s)throw new oQ(s.error,`failed to get accounts owned by program ${t.toBase58()}`);return s.result}async getParsedProgramAccounts(t,e){const{commitment:n,config:r}=fQ(e),i=this._buildArgs([t.toBase58()],n,"jsonParsed",r),o=KN(await this._rpcRequest("getProgramAccounts",i),gQ(eL(GQ)));if("error"in o)throw new oQ(o.error,`failed to get accounts owned by program ${t.toBase58()}`);return o.result}async confirmTransaction(t,e){let n,r;if("string"==typeof t)n=t;else{n=t.signature}try{r=hE.decode(n)}catch(t){throw new Error("signature must be base58 encoded: "+n)}_Y(64===r.length,"signature has invalid length");const i=e||this.commitment;let o,a,s=!1;const u=new Promise(((t,e)=>{try{a=this.onSignature(n,((e,n)=>{a=void 0;const r={context:n,value:e};s=!0,t({__type:EY.PROCESSED,response:r})}),i)}catch(t){e(t)}})),c=new Promise((n=>{if("string"==typeof t){let t=this._confirmTransactionInitialTimeout||6e4;switch(i){case"processed":case"recent":case"single":case"confirmed":case"singleGossip":t=this._confirmTransactionInitialTimeout||3e4}o=setTimeout((()=>n({__type:EY.TIMED_OUT,timeoutMs:t})),t)}else{let r=t;const i=async()=>{try{return await this.getBlockHeight(e)}catch(t){return-1}};(async()=>{let t=await i();if(!s){for(;t<=r.lastValidBlockHeight;){if(await PY(1e3),s)return;if(t=await i(),s)return}n({__type:EY.BLOCKHEIGHT_EXCEEDED})}})()}}));let l;try{const t=await Promise.race([u,c]);switch(t.__type){case EY.BLOCKHEIGHT_EXCEEDED:throw new sQ(n);case EY.PROCESSED:l=t.response;break;case EY.TIMED_OUT:throw new uQ(n,t.timeoutMs/1e3)}}finally{clearTimeout(o),a&&this.removeSignatureListener(a)}return l}async getClusterNodes(){const t=KN(await this._rpcRequest("getClusterNodes",[]),gQ(eL(oH)));if("error"in t)throw new oQ(t.error,"failed to get cluster nodes");return t.result}async getVoteAccounts(t){const e=this._buildArgs([],t),n=KN(await this._rpcRequest("getVoteAccounts",e),sH);if("error"in n)throw new oQ(n.error,"failed to get vote accounts");return n.result}async getSlot(t){const{commitment:e,config:n}=fQ(t),r=this._buildArgs([],e,void 0,n),i=KN(await this._rpcRequest("getSlot",r),gQ(aL()));if("error"in i)throw new oQ(i.error,"failed to get slot");return i.result}async getSlotLeader(t){const{commitment:e,config:n}=fQ(t),r=this._buildArgs([],e,void 0,n),i=KN(await this._rpcRequest("getSlotLeader",r),gQ(cL()));if("error"in i)throw new oQ(i.error,"failed to get slot leader");return i.result}async getSlotLeaders(t,e){const n=[t,e],r=KN(await this._rpcRequest("getSlotLeaders",n),gQ(eL(lQ)));if("error"in r)throw new oQ(r.error,"failed to get slot leaders");return r.result}async getSignatureStatus(t,e){const{context:n,value:r}=await this.getSignatureStatuses([t],e);_Y(1===r.length);return{context:n,value:r[0]}}async getSignatureStatuses(t,e){const n=[t];e&&n.push(e);const r=KN(await this._rpcRequest("getSignatureStatuses",n),lH);if("error"in r)throw new oQ(r.error,"failed to get signature status");return r.result}async getTransactionCount(t){const{commitment:e,config:n}=fQ(t),r=this._buildArgs([],e,void 0,n),i=KN(await this._rpcRequest("getTransactionCount",r),gQ(aL()));if("error"in i)throw new oQ(i.error,"failed to get transaction count");return i.result}async getTotalSupply(t){return(await this.getSupply({commitment:t,excludeNonCirculatingAccountsList:!0})).value.total}async getInflationGovernor(t){const e=this._buildArgs([],t),n=KN(await this._rpcRequest("getInflationGovernor",e),IQ);if("error"in n)throw new oQ(n.error,"failed to get inflation");return n.result}async getInflationReward(t,e,n){const{commitment:r,config:i}=fQ(n),o=this._buildArgs([t.map((t=>t.toBase58()))],r,void 0,{...i,epoch:null!=e?e:null==i?void 0:i.epoch}),a=KN(await this._rpcRequest("getInflationReward",o),wQ);if("error"in a)throw new oQ(a.error,"failed to get inflation reward");return a.result}async getEpochInfo(t){const{commitment:e,config:n}=fQ(t),r=this._buildArgs([],e,void 0,n),i=KN(await this._rpcRequest("getEpochInfo",r),kQ);if("error"in i)throw new oQ(i.error,"failed to get epoch info");return i.result}async getEpochSchedule(){const t=KN(await this._rpcRequest("getEpochSchedule",[]),jQ);if("error"in t)throw new oQ(t.error,"failed to get epoch schedule");const e=t.result;return new rQ(e.slotsPerEpoch,e.leaderScheduleSlotOffset,e.warmup,e.firstNormalEpoch,e.firstNormalSlot)}async getLeaderSchedule(){const t=KN(await this._rpcRequest("getLeaderSchedule",[]),CQ);if("error"in t)throw new oQ(t.error,"failed to get leader schedule");return t.result}async getMinimumBalanceForRentExemption(t,e){const n=this._buildArgs([t],e),r=KN(await this._rpcRequest("getMinimumBalanceForRentExemption",n),hH);return"error"in r?(console.warn("Unable to fetch minimum balance for rent exemption"),0):r.result}async getRecentBlockhashAndContext(t){const e=this._buildArgs([],t),n=KN(await this._rpcRequest("getRecentBlockhash",e),LH);if("error"in n)throw new oQ(n.error,"failed to get recent blockhash");return n.result}async getRecentPerformanceSamples(t){const e=KN(await this._rpcRequest("getRecentPerformanceSamples",t?[t]:[]),AH);if("error"in e)throw new oQ(e.error,"failed to get recent performance samples");return e.result}async getFeeCalculatorForBlockhash(t,e){const n=this._buildArgs([t],e),r=KN(await this._rpcRequest("getFeeCalculatorForBlockhash",n),xH);if("error"in r)throw new oQ(r.error,"failed to get fee calculator");const{context:i,value:o}=r.result;return{context:i,value:null!==o?o.feeCalculator:null}}async getFeeForMessage(t,e){const n=t.serialize().toString("base64"),r=this._buildArgs([n],e),i=KN(await this._rpcRequest("getFeeForMessage",r),yQ(oL(aL())));if("error"in i)throw new oQ(i.error,"failed to get slot");if(null===i.result)throw new Error("invalid blockhash");return i.result}async getRecentBlockhash(t){try{return(await this.getRecentBlockhashAndContext(t)).value}catch(t){throw new Error("failed to get recent blockhash: "+t)}}async getLatestBlockhash(t){try{return(await this.getLatestBlockhashAndContext(t)).value}catch(t){throw new Error("failed to get recent blockhash: "+t)}}async getLatestBlockhashAndContext(t){const{commitment:e,config:n}=fQ(t),r=this._buildArgs([],e,void 0,n),i=KN(await this._rpcRequest("getLatestBlockhash",r),SH);if("error"in i)throw new oQ(i.error,"failed to get latest blockhash");return i.result}async getVersion(){const t=KN(await this._rpcRequest("getVersion",[]),gQ(AQ));if("error"in t)throw new oQ(t.error,"failed to get version");return t.result}async getGenesisHash(){const t=KN(await this._rpcRequest("getGenesisHash",[]),gQ(cL()));if("error"in t)throw new oQ(t.error,"failed to get genesis hash");return t.result}async getBlock(t,e){const n=this._buildArgsAtLeastConfirmed([t],e&&e.commitment),r=KN(await this._rpcRequest("getBlock",n),wH);if("error"in r)throw new oQ(r.error,"failed to get confirmed block");const i=r.result;return i?{...i,transactions:i.transactions.map((({transaction:t,meta:e})=>{const n=new MY(t.message);return{meta:e,transaction:{...t,message:n}}}))}:i}async getBlockHeight(t){const{commitment:e,config:n}=fQ(t),r=this._buildArgs([],e,void 0,n),i=KN(await this._rpcRequest("getBlockHeight",r),gQ(aL()));if("error"in i)throw new oQ(i.error,"failed to get block height information");return i.result}async getBlockProduction(t){let e,n;if("string"==typeof t)n=t;else if(t){const{commitment:r,...i}=t;n=r,e=i}const r=this._buildArgs([],n,"base64",e),i=KN(await this._rpcRequest("getBlockProduction",r),TQ);if("error"in i)throw new oQ(i.error,"failed to get block production information");return i.result}async getTransaction(t,e){const n=this._buildArgsAtLeastConfirmed([t],e&&e.commitment),r=KN(await this._rpcRequest("getTransaction",n),EH);if("error"in r)throw new oQ(r.error,"failed to get transaction");const i=r.result;return i?{...i,transaction:{...i.transaction,message:new MY(i.transaction.message)}}:i}async getParsedTransaction(t,e){const n=this._buildArgsAtLeastConfirmed([t],e,"jsonParsed"),r=KN(await this._rpcRequest("getTransaction",n),NH);if("error"in r)throw new oQ(r.error,"failed to get transaction");return r.result}async getParsedTransactions(t,e){const n=t.map((t=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([t],e,"jsonParsed")})));return(await this._rpcBatchRequest(n)).map((t=>{const e=KN(t,NH);if("error"in e)throw new oQ(e.error,"failed to get transactions");return e.result}))}async getTransactions(t,e){const n=t.map((t=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([t],e)})));return(await this._rpcBatchRequest(n)).map((t=>{const e=KN(t,EH);if("error"in e)throw new oQ(e.error,"failed to get transactions");const n=e.result;return n?{...n,transaction:{...n.transaction,message:new MY(n.transaction.message)}}:n}))}async getConfirmedBlock(t,e){const n=this._buildArgsAtLeastConfirmed([t],e),r=KN(await this._rpcRequest("getConfirmedBlock",n),MH);if("error"in r)throw new oQ(r.error,"failed to get confirmed block");const i=r.result;if(!i)throw new Error("Confirmed block "+t+" not found");const o={...i,transactions:i.transactions.map((({transaction:t,meta:e})=>{const n=new MY(t.message);return{meta:e,transaction:{...t,message:n}}}))};return{...o,transactions:o.transactions.map((({transaction:t,meta:e})=>({meta:e,transaction:SY.populate(t.message,t.signatures)})))}}async getBlocks(t,e,n){const r=this._buildArgsAtLeastConfirmed(void 0!==e?[t,e]:[t],n),i=KN(await this._rpcRequest("getBlocks",r),gQ(eL(aL())));if("error"in i)throw new oQ(i.error,"failed to get blocks");return i.result}async getBlockSignatures(t,e){const n=this._buildArgsAtLeastConfirmed([t],e,void 0,{transactionDetails:"signatures",rewards:!1}),r=KN(await this._rpcRequest("getBlock",n),_H);if("error"in r)throw new oQ(r.error,"failed to get block");const i=r.result;if(!i)throw new Error("Block "+t+" not found");return i}async getConfirmedBlockSignatures(t,e){const n=this._buildArgsAtLeastConfirmed([t],e,void 0,{transactionDetails:"signatures",rewards:!1}),r=KN(await this._rpcRequest("getConfirmedBlock",n),_H);if("error"in r)throw new oQ(r.error,"failed to get confirmed block");const i=r.result;if(!i)throw new Error("Confirmed block "+t+" not found");return i}async getConfirmedTransaction(t,e){const n=this._buildArgsAtLeastConfirmed([t],e),r=KN(await this._rpcRequest("getConfirmedTransaction",n),EH);if("error"in r)throw new oQ(r.error,"failed to get transaction");const i=r.result;if(!i)return i;const o=new MY(i.transaction.message),a=i.transaction.signatures;return{...i,transaction:SY.populate(o,a)}}async getParsedConfirmedTransaction(t,e){const n=this._buildArgsAtLeastConfirmed([t],e,"jsonParsed"),r=KN(await this._rpcRequest("getConfirmedTransaction",n),NH);if("error"in r)throw new oQ(r.error,"failed to get confirmed transaction");return r.result}async getParsedConfirmedTransactions(t,e){const n=t.map((t=>({methodName:"getConfirmedTransaction",args:this._buildArgsAtLeastConfirmed([t],e,"jsonParsed")})));return(await this._rpcBatchRequest(n)).map((t=>{const e=KN(t,NH);if("error"in e)throw new oQ(e.error,"failed to get confirmed transactions");return e.result}))}async getConfirmedSignaturesForAddress(t,e,n){let r={},i=await this.getFirstAvailableBlock();for(;!("until"in r)&&!(--e<=0||e<i);)try{const t=await this.getConfirmedBlockSignatures(e,"finalized");t.signatures.length>0&&(r.until=t.signatures[t.signatures.length-1].toString())}catch(t){if(t instanceof Error&&t.message.includes("skipped"))continue;throw t}let o=await this.getSlot("finalized");for(;!("before"in r||++n>o);)try{const t=await this.getConfirmedBlockSignatures(n);t.signatures.length>0&&(r.before=t.signatures[t.signatures.length-1].toString())}catch(t){if(t instanceof Error&&t.message.includes("skipped"))continue;throw t}return(await this.getConfirmedSignaturesForAddress2(t,r)).map((t=>t.signature))}async getConfirmedSignaturesForAddress2(t,e,n){const r=this._buildArgsAtLeastConfirmed([t.toBase58()],n,void 0,e),i=KN(await this._rpcRequest("getConfirmedSignaturesForAddress2",r),VQ);if("error"in i)throw new oQ(i.error,"failed to get confirmed signatures for address");return i.result}async getSignaturesForAddress(t,e,n){const r=this._buildArgsAtLeastConfirmed([t.toBase58()],n,void 0,e),i=KN(await this._rpcRequest("getSignaturesForAddress",r),qQ);if("error"in i)throw new oQ(i.error,"failed to get signatures for address");return i.result}async getNonceAndContext(t,e){const{context:n,value:r}=await this.getAccountInfoAndContext(t,e);let i=null;return null!==r&&(i=YY.fromAccountData(r.data)),{context:n,value:i}}async getNonce(t,e){return await this.getNonceAndContext(t,e).then((t=>t.value)).catch((e=>{throw new Error("failed to get nonce for account "+t.toBase58()+": "+e)}))}async requestAirdrop(t,e){const n=KN(await this._rpcRequest("requestAirdrop",[t.toBase58(),e]),TH);if("error"in n)throw new oQ(n.error,`airdrop to ${t.toBase58()} failed`);return n.result}async _blockhashWithExpiryBlockHeight(t){if(!t){for(;this._pollingBlockhash;)await PY(100);const t=Date.now()-this._blockhashInfo.lastFetch>=3e4;if(null!==this._blockhashInfo.latestBlockhash&&!t)return this._blockhashInfo.latestBlockhash}return await this._pollNewBlockhash()}async _pollNewBlockhash(){this._pollingBlockhash=!0;try{const t=Date.now(),e=this._blockhashInfo.latestBlockhash,n=e?e.blockhash:null;for(let t=0;t<50;t++){const t=await this.getLatestBlockhash("finalized");if(n!==t.blockhash)return this._blockhashInfo={latestBlockhash:t,lastFetch:Date.now(),transactionSignatures:[],simulatedSignatures:[]},t;await PY(200)}throw new Error(`Unable to obtain a new blockhash after ${Date.now()-t}ms`)}finally{this._pollingBlockhash=!1}}async simulateTransaction(t,e,n){let r;if(t instanceof SY){let e=t;r=new SY,r.feePayer=e.feePayer,r.instructions=t.instructions,r.nonceInfo=e.nonceInfo,r.signatures=e.signatures}else r=SY.populate(t),r._message=r._json=void 0;if(r.nonceInfo&&e)r.sign(...e);else{let t=this._disableBlockhashCaching;for(;;){const n=await this._blockhashWithExpiryBlockHeight(t);if(r.lastValidBlockHeight=n.lastValidBlockHeight,r.recentBlockhash=n.blockhash,!e)break;if(r.sign(...e),!r.signature)throw new Error("!signature");const i=r.signature.toString("base64");if(!this._blockhashInfo.simulatedSignatures.includes(i)&&!this._blockhashInfo.transactionSignatures.includes(i)){this._blockhashInfo.simulatedSignatures.push(i);break}t=!0}}const i=r._compile(),o=i.serialize(),a=r._serialize(o).toString("base64"),s={encoding:"base64",commitment:this.commitment};if(n){const t=(Array.isArray(n)?n:i.nonProgramIds()).map((t=>t.toBase58()));s.accounts={encoding:"base64",addresses:t}}e&&(s.sigVerify=!0);const u=[a,s],c=KN(await this._rpcRequest("simulateTransaction",u),xQ);if("error"in c){let t;if("data"in c.error&&(t=c.error.data.logs,t&&Array.isArray(t))){const e="\n ",n=e+t.join(e);console.error(c.error.message,n)}throw new iQ("failed to simulate transaction: "+c.error.message,t)}return c.result}async sendTransaction(t,e,n){if(t.nonceInfo)t.sign(...e);else{let n=this._disableBlockhashCaching;for(;;){const r=await this._blockhashWithExpiryBlockHeight(n);if(t.lastValidBlockHeight=r.lastValidBlockHeight,t.recentBlockhash=r.blockhash,t.sign(...e),!t.signature)throw new Error("!signature");const i=t.signature.toString("base64");if(!this._blockhashInfo.transactionSignatures.includes(i)){this._blockhashInfo.transactionSignatures.push(i);break}n=!0}}const r=t.serialize();return await this.sendRawTransaction(r,n)}async sendRawTransaction(t,e){const n=HU(t).toString("base64");return await this.sendEncodedTransaction(n,e)}async sendEncodedTransaction(t,e){const n={encoding:"base64"},r=e&&e.skipPreflight,i=e&&e.preflightCommitment||this.commitment;e&&null!=e.maxRetries&&(n.maxRetries=e.maxRetries),e&&null!=e.minContextSlot&&(n.minContextSlot=e.minContextSlot),r&&(n.skipPreflight=r),i&&(n.preflightCommitment=i);const o=[t,n],a=KN(await this._rpcRequest("sendTransaction",o),IH);if("error"in a){let t;throw"data"in a.error&&(t=a.error.data.logs),new iQ("failed to send transaction: "+a.error.message,t)}return a.result}_wsOnOpen(){this._rpcWebSocketConnected=!0,this._rpcWebSocketHeartbeat=setInterval((()=>{this._rpcWebSocket.notify("ping").catch((()=>{}))}),5e3),this._updateSubscriptions()}_wsOnError(t){this._rpcWebSocketConnected=!1,console.error("ws error:",t.message)}_wsOnClose(t){this._rpcWebSocketConnected=!1,this._rpcWebSocketGeneration++,this._rpcWebSocketHeartbeat&&(clearInterval(this._rpcWebSocketHeartbeat),this._rpcWebSocketHeartbeat=null),1e3!==t?(this._subscriptionCallbacksByServerSubscriptionId={},Object.entries(this._subscriptionsByHash).forEach((([t,e])=>{this._subscriptionsByHash[t]={...e,state:"pending"}}))):this._updateSubscriptions()}async _updateSubscriptions(){if(0===Object.keys(this._subscriptionsByHash).length)return void(this._rpcWebSocketConnected&&(this._rpcWebSocketConnected=!1,this._rpcWebSocketIdleTimeout=setTimeout((()=>{this._rpcWebSocketIdleTimeout=null;try{this._rpcWebSocket.close()}catch(t){t instanceof Error&&console.log(`Error when closing socket connection: ${t.message}`)}}),500)));if(null!==this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketConnected=!0),!this._rpcWebSocketConnected)return void this._rpcWebSocket.connect();const t=this._rpcWebSocketGeneration,e=()=>t===this._rpcWebSocketGeneration;await Promise.all(Object.keys(this._subscriptionsByHash).map((async t=>{const n=this._subscriptionsByHash[t];if(void 0!==n)switch(n.state){case"pending":case"unsubscribed":if(0===n.callbacks.size)return delete this._subscriptionsByHash[t],"unsubscribed"===n.state&&delete this._subscriptionCallbacksByServerSubscriptionId[n.serverSubscriptionId],void await this._updateSubscriptions();await(async()=>{const{args:r,method:i}=n;try{this._subscriptionsByHash[t]={...n,state:"subscribing"};const e=await this._rpcWebSocket.call(i,r);this._subscriptionsByHash[t]={...n,serverSubscriptionId:e,state:"subscribed"},this._subscriptionCallbacksByServerSubscriptionId[e]=n.callbacks,await this._updateSubscriptions()}catch(o){if(o instanceof Error&&console.error(`${i} error for argument`,r,o.message),!e())return;this._subscriptionsByHash[t]={...n,state:"pending"},await this._updateSubscriptions()}})();break;case"subscribed":0===n.callbacks.size&&await(async()=>{const{serverSubscriptionId:r,unsubscribeMethod:i}=n;if(this._subscriptionsAutoDisposedByRpc.has(r))this._subscriptionsAutoDisposedByRpc.delete(r);else{this._subscriptionsByHash[t]={...n,state:"unsubscribing"};try{await this._rpcWebSocket.call(i,[r])}catch(r){if(r instanceof Error&&console.error(`${i} error:`,r.message),!e())return;return this._subscriptionsByHash[t]={...n,state:"subscribed"},void await this._updateSubscriptions()}}this._subscriptionsByHash[t]={...n,state:"unsubscribed"},await this._updateSubscriptions()})()}})))}_handleServerNotification(t,e){const n=this._subscriptionCallbacksByServerSubscriptionId[t];void 0!==n&&n.forEach((t=>{try{t(...e)}catch(t){console.error(t)}}))}_wsOnAccountNotification(t){const{result:e,subscription:n}=KN(t,JQ);this._handleServerNotification(n,[e.value,e.context])}_makeSubscription(t,e){const n=this._nextClientSubscriptionId++,r=eQ([t.method,e]),i=this._subscriptionsByHash[r];return void 0===i?this._subscriptionsByHash[r]={...t,args:e,callbacks:new Set([t.callback]),state:"pending"}:i.callbacks.add(t.callback),this._subscriptionDisposeFunctionsByClientSubscriptionId[n]=async()=>{delete this._subscriptionDisposeFunctionsByClientSubscriptionId[n];const e=this._subscriptionsByHash[r];_Y(void 0!==e,`Could not find a \`Subscription\` when tearing down client subscription #${n}`),e.callbacks.delete(t.callback),await this._updateSubscriptions()},this._updateSubscriptions(),n}onAccountChange(t,e,n){const r=this._buildArgs([t.toBase58()],n||this._commitment||"finalized","base64");return this._makeSubscription({callback:e,method:"accountSubscribe",unsubscribeMethod:"accountUnsubscribe"},r)}async removeAccountChangeListener(t){await this._unsubscribeClientSubscription(t,"account change")}_wsOnProgramAccountNotification(t){const{result:e,subscription:n}=KN(t,XQ);this._handleServerNotification(n,[{accountId:e.value.pubkey,accountInfo:e.value.account},e.context])}onProgramAccountChange(t,e,n,r){const i=this._buildArgs([t.toBase58()],n||this._commitment||"finalized","base64",r?{filters:r}:void 0);return this._makeSubscription({callback:e,method:"programSubscribe",unsubscribeMethod:"programUnsubscribe"},i)}async removeProgramAccountChangeListener(t){await this._unsubscribeClientSubscription(t,"program account change")}onLogs(t,e,n){const r=this._buildArgs(["object"==typeof t?{mentions:[t.toString()]}:t],n||this._commitment||"finalized");return this._makeSubscription({callback:e,method:"logsSubscribe",unsubscribeMethod:"logsUnsubscribe"},r)}async removeOnLogsListener(t){await this._unsubscribeClientSubscription(t,"logs")}_wsOnLogsNotification(t){const{result:e,subscription:n}=KN(t,jH);this._handleServerNotification(n,[e.value,e.context])}_wsOnSlotNotification(t){const{result:e,subscription:n}=KN(t,tH);this._handleServerNotification(n,[e])}onSlotChange(t){return this._makeSubscription({callback:t,method:"slotSubscribe",unsubscribeMethod:"slotUnsubscribe"},[])}async removeSlotChangeListener(t){await this._unsubscribeClientSubscription(t,"slot change")}_wsOnSlotUpdatesNotification(t){const{result:e,subscription:n}=KN(t,nH);this._handleServerNotification(n,[e])}onSlotUpdate(t){return this._makeSubscription({callback:t,method:"slotsUpdatesSubscribe",unsubscribeMethod:"slotsUpdatesUnsubscribe"},[])}async removeSlotUpdateListener(t){await this._unsubscribeClientSubscription(t,"slot update")}async _unsubscribeClientSubscription(t,e){const n=this._subscriptionDisposeFunctionsByClientSubscriptionId[t];n?await n():console.warn(`Ignored unsubscribe request because an active subscription with id \`${t}\` for '${e}' events could not be found.`)}_buildArgs(t,e,n,r){const i=e||this._commitment;if(i||n||r){let e={};n&&(e.encoding=n),i&&(e.commitment=i),r&&(e=Object.assign(e,r)),t.push(e)}return t}_buildArgsAtLeastConfirmed(t,e,n,r){const i=e||this._commitment;if(i&&!["confirmed","finalized"].includes(i))throw new Error("Using Connection with default commitment: `"+this._commitment+"`, but method requires at least `confirmed`");return this._buildArgs(t,e,n,r)}_wsOnSignatureNotification(t){const{result:e,subscription:n}=KN(t,rH);"receivedSignature"!==e.value&&this._subscriptionsAutoDisposedByRpc.add(n),this._handleServerNotification(n,"receivedSignature"===e.value?[{type:"received"},e.context]:[{type:"status",result:e.value},e.context])}onSignature(t,e,n){const r=this._buildArgs([t],n||this._commitment||"finalized"),i=this._makeSubscription({callback:(t,n)=>{if("status"===t.type){e(t.result,n);try{this.removeSignatureListener(i)}catch(t){}}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},r);return i}onSignatureWithOptions(t,e,n){const{commitment:r,...i}={...n,commitment:n&&n.commitment||this._commitment||"finalized"},o=this._buildArgs([t],r,void 0,i),a=this._makeSubscription({callback:(t,n)=>{e(t,n);try{this.removeSignatureListener(a)}catch(t){}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},o);return a}async removeSignatureListener(t){await this._unsubscribeClientSubscription(t,"signature result")}_wsOnRootNotification(t){const{result:e,subscription:n}=KN(t,iH);this._handleServerNotification(n,[e])}onRootChange(t){return this._makeSubscription({callback:t,method:"rootSubscribe",unsubscribeMethod:"rootUnsubscribe"},[])}async removeRootChangeListener(t){await this._unsubscribeClientSubscription(t,"root change")}}class OH{constructor(t){this._keypair=void 0,this._keypair=t||aE.sign.keyPair()}static generate(){return new OH(aE.sign.keyPair())}static fromSecretKey(t,e){const n=aE.sign.keyPair.fromSecretKey(t);if(!e||!e.skipValidation){const t=(new TextEncoder).encode("@solana/web3.js-validation-v1"),e=aE.sign.detached(t,n.secretKey);if(!aE.sign.detached.verify(t,e,n.publicKey))throw new Error("provided secretKey is invalid")}return new OH(n)}static fromSeed(t){return new OH(aE.sign.keyPair.fromSeed(t))}get publicKey(){return new cY(this._keypair.publicKey)}get secretKey(){return this._keypair.secretKey}}const zH=PN([jN("numSignatures"),jN("padding"),CN("signatureOffset"),CN("signatureInstructionIndex"),CN("publicKeyOffset"),CN("publicKeyInstructionIndex"),CN("messageDataOffset"),CN("messageDataSize"),CN("messageInstructionIndex")]);class PH{constructor(){}static createInstructionWithPublicKey(t){const{publicKey:e,message:n,signature:r,instructionIndex:i}=t;_Y(32===e.length,`Public Key must be 32 bytes but received ${e.length} bytes`),_Y(64===r.length,`Signature must be 64 bytes but received ${r.length} bytes`);const o=zH.span,a=o+e.length,s=a+r.length,u=p_.alloc(s+n.length),c=null==i?65535:i;return zH.encode({numSignatures:1,padding:0,signatureOffset:a,signatureInstructionIndex:c,publicKeyOffset:o,publicKeyInstructionIndex:c,messageDataOffset:s,messageDataSize:n.length,messageInstructionIndex:c},u),u.fill(e,o),u.fill(r,a),u.fill(n,s),new LY({keys:[],programId:PH.programId,data:u})}static createInstructionWithPrivateKey(t){const{privateKey:e,message:n,instructionIndex:r}=t;_Y(64===e.length,`Private key must be 64 bytes but received ${e.length} bytes`);try{const t=OH.fromSecretKey(e),i=t.publicKey.toBytes(),o=aE.sign.detached(n,t.secretKey);return this.createInstructionWithPublicKey({publicKey:i,message:n,signature:o,instructionIndex:r})}catch(t){throw new Error(`Error creating instruction; ${t}`)}}}PH.programId=new cY("Ed25519SigVerify111111111111111111111111111");const RH=new cY("StakeConfig11111111111111111111111111111111");class BH{constructor(t,e){this.staker=void 0,this.withdrawer=void 0,this.staker=t,this.withdrawer=e}}class UH{constructor(t,e,n){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=t,this.epoch=e,this.custodian=n}}UH.default=new UH(0,0,cY.default);const FH=Object.freeze({Initialize:{index:0,layout:PN([DN("instruction"),((t="authorized")=>PN([yY("staker"),yY("withdrawer")],t))(),((t="lockup")=>PN([zN("unixTimestamp"),zN("epoch"),yY("custodian")],t))()])},Authorize:{index:1,layout:PN([DN("instruction"),yY("newAuthorized"),DN("stakeAuthorizationType")])},Delegate:{index:2,layout:PN([DN("instruction")])},Split:{index:3,layout:PN([DN("instruction"),zN("lamports")])},Withdraw:{index:4,layout:PN([DN("instruction"),zN("lamports")])},Deactivate:{index:5,layout:PN([DN("instruction")])},Merge:{index:7,layout:PN([DN("instruction")])},AuthorizeWithSeed:{index:8,layout:PN([DN("instruction"),yY("newAuthorized"),DN("stakeAuthorizationType"),bY("authoritySeed"),yY("authorityOwner")])}}),WH=Object.freeze({Staker:{index:0},Withdrawer:{index:1}});class YH{constructor(){}static initialize(t){const{stakePubkey:e,authorized:n,lockup:r}=t,i=r||UH.default,o=RY(FH.Initialize,{authorized:{staker:HU(n.staker.toBuffer()),withdrawer:HU(n.withdrawer.toBuffer())},lockup:{unixTimestamp:i.unixTimestamp,epoch:i.epoch,custodian:HU(i.custodian.toBuffer())}}),a={keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:kY,isSigner:!1,isWritable:!1}],programId:this.programId,data:o};return new LY(a)}static createAccountWithSeed(t){const e=new SY;e.add(ZY.createAccountWithSeed({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,basePubkey:t.basePubkey,seed:t.seed,lamports:t.lamports,space:this.space,programId:this.programId}));const{stakePubkey:n,authorized:r,lockup:i}=t;return e.add(this.initialize({stakePubkey:n,authorized:r,lockup:i}))}static createAccount(t){const e=new SY;e.add(ZY.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,lamports:t.lamports,space:this.space,programId:this.programId}));const{stakePubkey:n,authorized:r,lockup:i}=t;return e.add(this.initialize({stakePubkey:n,authorized:r,lockup:i}))}static delegate(t){const{stakePubkey:e,authorizedPubkey:n,votePubkey:r}=t,i=RY(FH.Delegate);return(new SY).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!1},{pubkey:AY,isSigner:!1,isWritable:!1},{pubkey:OY,isSigner:!1,isWritable:!1},{pubkey:RH,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}static authorize(t){const{stakePubkey:e,authorizedPubkey:n,newAuthorizedPubkey:r,stakeAuthorizationType:i,custodianPubkey:o}=t,a=RY(FH.Authorize,{newAuthorized:HU(r.toBuffer()),stakeAuthorizationType:i.index}),s=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:AY,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return o&&s.push({pubkey:o,isSigner:!1,isWritable:!1}),(new SY).add({keys:s,programId:this.programId,data:a})}static authorizeWithSeed(t){const{stakePubkey:e,authorityBase:n,authoritySeed:r,authorityOwner:i,newAuthorizedPubkey:o,stakeAuthorizationType:a,custodianPubkey:s}=t,u=RY(FH.AuthorizeWithSeed,{newAuthorized:HU(o.toBuffer()),stakeAuthorizationType:a.index,authoritySeed:r,authorityOwner:HU(i.toBuffer())}),c=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1},{pubkey:AY,isSigner:!1,isWritable:!1}];return s&&c.push({pubkey:s,isSigner:!1,isWritable:!1}),(new SY).add({keys:c,programId:this.programId,data:u})}static splitInstruction(t){const{stakePubkey:e,authorizedPubkey:n,splitStakePubkey:r,lamports:i}=t,o=RY(FH.Split,{lamports:i});return new LY({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:o})}static split(t){const e=new SY;return e.add(ZY.createAccount({fromPubkey:t.authorizedPubkey,newAccountPubkey:t.splitStakePubkey,lamports:0,space:this.space,programId:this.programId})),e.add(this.splitInstruction(t))}static splitWithSeed(t){const{stakePubkey:e,authorizedPubkey:n,splitStakePubkey:r,basePubkey:i,seed:o,lamports:a}=t,s=new SY;return s.add(ZY.allocate({accountPubkey:r,basePubkey:i,seed:o,space:this.space,programId:this.programId})),s.add(this.splitInstruction({stakePubkey:e,authorizedPubkey:n,splitStakePubkey:r,lamports:a}))}static merge(t){const{stakePubkey:e,sourceStakePubKey:n,authorizedPubkey:r}=t,i=RY(FH.Merge);return(new SY).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:AY,isSigner:!1,isWritable:!1},{pubkey:OY,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}static withdraw(t){const{stakePubkey:e,authorizedPubkey:n,toPubkey:r,lamports:i,custodianPubkey:o}=t,a=RY(FH.Withdraw,{lamports:i}),s=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:AY,isSigner:!1,isWritable:!1},{pubkey:OY,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return o&&s.push({pubkey:o,isSigner:!1,isWritable:!1}),(new SY).add({keys:s,programId:this.programId,data:a})}static deactivate(t){const{stakePubkey:e,authorizedPubkey:n}=t,r=RY(FH.Deactivate);return(new SY).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:AY,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:r})}}YH.programId=new cY("Stake11111111111111111111111111111111111111"),YH.space=200;const{publicKeyCreate:QH,ecdsaSign:HH}=WU,GH=PN([jN("numSignatures"),CN("signatureOffset"),jN("signatureInstructionIndex"),CN("ethAddressOffset"),jN("ethAddressInstructionIndex"),CN("messageDataOffset"),CN("messageDataSize"),jN("messageInstructionIndex"),BN(20,"ethAddress"),BN(64,"signature"),jN("recoveryId")]);class ZH{constructor(){}static publicKeyToEthAddress(t){_Y(64===t.length,`Public key must be 64 bytes but received ${t.length} bytes`);try{return p_.from(QU.keccak_256.update(HU(t)).digest()).slice(-20)}catch(t){throw new Error(`Error constructing Ethereum address: ${t}`)}}static createInstructionWithPublicKey(t){const{publicKey:e,message:n,signature:r,recoveryId:i,instructionIndex:o}=t;return ZH.createInstructionWithEthAddress({ethAddress:ZH.publicKeyToEthAddress(e),message:n,signature:r,recoveryId:i,instructionIndex:o})}static createInstructionWithEthAddress(t){const{ethAddress:e,message:n,signature:r,recoveryId:i,instructionIndex:o=0}=t;let a;a="string"==typeof e?e.startsWith("0x")?p_.from(e.substr(2),"hex"):p_.from(e,"hex"):e,_Y(20===a.length,`Address must be 20 bytes but received ${a.length} bytes`);const s=12+a.length,u=s+r.length+1,c=p_.alloc(GH.span+n.length);return GH.encode({numSignatures:1,signatureOffset:s,signatureInstructionIndex:o,ethAddressOffset:12,ethAddressInstructionIndex:o,messageDataOffset:u,messageDataSize:n.length,messageInstructionIndex:o,signature:HU(r),ethAddress:HU(a),recoveryId:i},c),c.fill(HU(n),GH.span),new LY({keys:[],programId:ZH.programId,data:c})}static createInstructionWithPrivateKey(t){const{privateKey:e,message:n,instructionIndex:r}=t;_Y(32===e.length,`Private key must be 32 bytes but received ${e.length} bytes`);try{const t=HU(e),i=QH(t,!1).slice(1),o=p_.from(QU.keccak_256.update(HU(n)).digest()),{signature:a,recid:s}=HH(o,t);return this.createInstructionWithPublicKey({publicKey:i,message:n,signature:a,recoveryId:s,instructionIndex:r})}catch(t){throw new Error(`Error creating instruction; ${t}`)}}}ZH.programId=new cY("KeccakSecp256k11111111111111111111111111111");const VH=new cY("Va1idator1nfo111111111111111111111111111111"),qH=hL({name:cL(),website:sL(cL()),details:sL(cL()),keybaseUsername:sL(cL())});class JH{constructor(t,e){this.key=void 0,this.info=void 0,this.key=t,this.info=e}static fromConfigData(t){let e=[...t];if(2!==vY(e))return null;const n=[];for(let t=0;t<2;t++){const t=new cY(e.slice(0,32));e=e.slice(32);const r=1===e.slice(0,1)[0];e=e.slice(1),n.push({publicKey:t,isSigner:r})}if(n[0].publicKey.equals(VH)&&n[1].isSigner){const t=bY().decode(p_.from(e)),r=JSON.parse(t);return JN(r,qH),new JH(n[1].publicKey,r)}return null}}const KH=new cY("Vote111111111111111111111111111111111111111"),XH=PN([yY("nodePubkey"),yY("authorizedWithdrawer"),jN("commission"),ON(),RN(PN([ON("slot"),DN("confirmationCount")]),kN(DN(),-8),"votes"),jN("rootSlotValid"),ON("rootSlot"),ON(),RN(PN([ON("epoch"),yY("authorizedVoter")]),kN(DN(),-8),"authorizedVoters"),PN([RN(PN([yY("authorizedPubkey"),ON("epochOfLastAuthorizedSwitch"),ON("targetEpoch")]),32,"buf"),ON("idx"),jN("isEmpty")],"priorVoters"),ON(),RN(PN([ON("epoch"),ON("credits"),ON("prevCredits")]),kN(DN(),-8),"epochCredits"),PN([ON("slot"),ON("timestamp")],"lastTimestamp")]);class $H{constructor(t){this.nodePubkey=void 0,this.authorizedWithdrawer=void 0,this.commission=void 0,this.rootSlot=void 0,this.votes=void 0,this.authorizedVoters=void 0,this.priorVoters=void 0,this.epochCredits=void 0,this.lastTimestamp=void 0,this.nodePubkey=t.nodePubkey,this.authorizedWithdrawer=t.authorizedWithdrawer,this.commission=t.commission,this.rootSlot=t.rootSlot,this.votes=t.votes,this.authorizedVoters=t.authorizedVoters,this.priorVoters=t.priorVoters,this.epochCredits=t.epochCredits,this.lastTimestamp=t.lastTimestamp}static fromAccountData(t){const e=XH.decode(HU(t),4);let n=e.rootSlot;return e.rootSlotValid||(n=null),new $H({nodePubkey:new cY(e.nodePubkey),authorizedWithdrawer:new cY(e.authorizedWithdrawer),commission:e.commission,votes:e.votes,rootSlot:n,authorizedVoters:e.authorizedVoters.map(tG),priorVoters:nG(e.priorVoters),epochCredits:e.epochCredits,lastTimestamp:e.lastTimestamp})}}function tG({authorizedVoter:t,epoch:e}){return{epoch:e,authorizedVoter:new cY(t)}}function eG({authorizedPubkey:t,epochOfLastAuthorizedSwitch:e,targetEpoch:n}){return{authorizedPubkey:new cY(t),epochOfLastAuthorizedSwitch:e,targetEpoch:n}}function nG({buf:t,idx:e,isEmpty:n}){return n?[]:[...t.slice(e+1).map(eG),...t.slice(0,e).map(eG)]}class rG{constructor(t,e,n,r){this.nodePubkey=void 0,this.authorizedVoter=void 0,this.authorizedWithdrawer=void 0,this.commission=void 0,this.nodePubkey=t,this.authorizedVoter=e,this.authorizedWithdrawer=n,this.commission=r}}const iG=Object.freeze({InitializeAccount:{index:0,layout:PN([DN("instruction"),((t="voteInit")=>PN([yY("nodePubkey"),yY("authorizedVoter"),yY("authorizedWithdrawer"),jN("commission")],t))()])},Authorize:{index:1,layout:PN([DN("instruction"),yY("newAuthorized"),DN("voteAuthorizationType")])},Withdraw:{index:3,layout:PN([DN("instruction"),zN("lamports")])}}),oG=Object.freeze({Voter:{index:0},Withdrawer:{index:1}});class aG{constructor(){}static initializeAccount(t){const{votePubkey:e,nodePubkey:n,voteInit:r}=t,i=RY(iG.InitializeAccount,{voteInit:{nodePubkey:HU(r.nodePubkey.toBuffer()),authorizedVoter:HU(r.authorizedVoter.toBuffer()),authorizedWithdrawer:HU(r.authorizedWithdrawer.toBuffer()),commission:r.commission}}),o={keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:kY,isSigner:!1,isWritable:!1},{pubkey:AY,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i};return new LY(o)}static createAccount(t){const e=new SY;return e.add(ZY.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.votePubkey,lamports:t.lamports,space:this.space,programId:this.programId})),e.add(this.initializeAccount({votePubkey:t.votePubkey,nodePubkey:t.voteInit.nodePubkey,voteInit:t.voteInit}))}static authorize(t){const{votePubkey:e,authorizedPubkey:n,newAuthorizedPubkey:r,voteAuthorizationType:i}=t,o=RY(iG.Authorize,{newAuthorized:HU(r.toBuffer()),voteAuthorizationType:i.index}),a=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:AY,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return(new SY).add({keys:a,programId:this.programId,data:o})}static withdraw(t){const{votePubkey:e,authorizedWithdrawerPubkey:n,lamports:r,toPubkey:i}=t,o=RY(iG.Withdraw,{lamports:r}),a=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return(new SY).add({keys:a,programId:this.programId,data:o})}}aG.programId=new cY("Vote111111111111111111111111111111111111111"),aG.space=3731;const sG={http:{devnet:"http://api.devnet.solana.com",testnet:"http://api.testnet.solana.com","mainnet-beta":"http://api.mainnet-beta.solana.com/"},https:{devnet:"https://api.devnet.solana.com",testnet:"https://api.testnet.solana.com","mainnet-beta":"https://api.mainnet-beta.solana.com/"}};var uG=Object.freeze({__proto__:null,Account:class{constructor(t){this._keypair=void 0,this._keypair=t?aE.sign.keyPair.fromSecretKey(HU(t)):aE.sign.keyPair()}get publicKey(){return new cY(this._keypair.publicKey)}get secretKey(){return HU(this._keypair.secretKey)}},Authorized:BH,BLOCKHASH_CACHE_TIMEOUT_MS:3e4,BPF_LOADER_DEPRECATED_PROGRAM_ID:mY,BPF_LOADER_PROGRAM_ID:qY,BpfLoader:class{static getMinNumSignatures(t){return VY.getMinNumSignatures(t)}static load(t,e,n,r,i){return VY.load(t,e,n,i,r)}},COMPUTE_BUDGET_INSTRUCTION_LAYOUTS:JY,ComputeBudgetInstruction:class{constructor(){}static decodeInstructionType(t){this.checkProgramId(t.programId);const e=jN("instruction").decode(t.data);let n;for(const[t,r]of Object.entries(JY))if(r.index==e){n=t;break}if(!n)throw new Error("Instruction type incorrect; not a ComputeBudgetInstruction");return n}static decodeRequestUnits(t){this.checkProgramId(t.programId);const{units:e,additionalFee:n}=BY(JY.RequestUnits,t.data);return{units:e,additionalFee:n}}static decodeRequestHeapFrame(t){this.checkProgramId(t.programId);const{bytes:e}=BY(JY.RequestHeapFrame,t.data);return{bytes:e}}static decodeSetComputeUnitLimit(t){this.checkProgramId(t.programId);const{units:e}=BY(JY.SetComputeUnitLimit,t.data);return{units:e}}static decodeSetComputeUnitPrice(t){this.checkProgramId(t.programId);const{microLamports:e}=BY(JY.SetComputeUnitPrice,t.data);return{microLamports:e}}static checkProgramId(t){if(!t.equals(KY.programId))throw new Error("invalid instruction; programId is not ComputeBudgetProgram")}},ComputeBudgetProgram:KY,Connection:DH,Ed25519Program:PH,Enum:class extends sY{constructor(t){if(super(t),this.enum="",1!==Object.keys(t).length)throw new Error("Enum can only take single value");Object.keys(t).map((t=>{this.enum=t}))}},EpochSchedule:rQ,FeeCalculatorLayout:UY,Keypair:OH,LAMPORTS_PER_SOL:1e9,Loader:VY,Lockup:UH,MAX_SEED_LENGTH:32,Message:MY,NONCE_ACCOUNT_LENGTH:WY,NonceAccount:YY,PACKET_DATA_SIZE:gY,PublicKey:cY,SIGNATURE_LENGTH_IN_BYTES:64,SOLANA_SCHEMA:uY,STAKE_CONFIG_ID:RH,STAKE_INSTRUCTION_LAYOUTS:FH,SYSTEM_INSTRUCTION_LAYOUTS:GY,SYSVAR_CLOCK_PUBKEY:AY,SYSVAR_EPOCH_SCHEDULE_PUBKEY:xY,SYSVAR_INSTRUCTIONS_PUBKEY:TY,SYSVAR_RECENT_BLOCKHASHES_PUBKEY:IY,SYSVAR_RENT_PUBKEY:kY,SYSVAR_REWARDS_PUBKEY:jY,SYSVAR_SLOT_HASHES_PUBKEY:CY,SYSVAR_SLOT_HISTORY_PUBKEY:DY,SYSVAR_STAKE_HISTORY_PUBKEY:OY,Secp256k1Program:ZH,SendTransactionError:iQ,SolanaJSONRPCError:oQ,SolanaJSONRPCErrorCode:{JSON_RPC_SERVER_ERROR_BLOCK_CLEANED_UP:-32001,JSON_RPC_SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE:-32002,JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_VERIFICATION_FAILURE:-32003,JSON_RPC_SERVER_ERROR_BLOCK_NOT_AVAILABLE:-32004,JSON_RPC_SERVER_ERROR_NODE_UNHEALTHY:-32005,JSON_RPC_SERVER_ERROR_TRANSACTION_PRECOMPILE_VERIFICATION_FAILURE:-32006,JSON_RPC_SERVER_ERROR_SLOT_SKIPPED:-32007,JSON_RPC_SERVER_ERROR_NO_SNAPSHOT:-32008,JSON_RPC_SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED:-32009,JSON_RPC_SERVER_ERROR_KEY_EXCLUDED_FROM_SECONDARY_INDEX:-32010,JSON_RPC_SERVER_ERROR_TRANSACTION_HISTORY_NOT_AVAILABLE:-32011,JSON_RPC_SCAN_ERROR:-32012,JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_LEN_MISMATCH:-32013,JSON_RPC_SERVER_ERROR_BLOCK_STATUS_NOT_AVAILABLE_YET:-32014,JSON_RPC_SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION:-32015,JSON_RPC_SERVER_ERROR_MIN_CONTEXT_SLOT_NOT_REACHED:-32016},StakeAuthorizationLayout:WH,StakeInstruction:class{constructor(){}static decodeInstructionType(t){this.checkProgramId(t.programId);const e=DN("instruction").decode(t.data);let n;for(const[t,r]of Object.entries(FH))if(r.index==e){n=t;break}if(!n)throw new Error("Instruction type incorrect; not a StakeInstruction");return n}static decodeInitialize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{authorized:e,lockup:n}=BY(FH.Initialize,t.data);return{stakePubkey:t.keys[0].pubkey,authorized:new BH(new cY(e.staker),new cY(e.withdrawer)),lockup:new UH(n.unixTimestamp,n.epoch,new cY(n.custodian))}}static decodeDelegate(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,6),BY(FH.Delegate,t.data),{stakePubkey:t.keys[0].pubkey,votePubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[5].pubkey}}static decodeAuthorize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{newAuthorized:e,stakeAuthorizationType:n}=BY(FH.Authorize,t.data),r={stakePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey,newAuthorizedPubkey:new cY(e),stakeAuthorizationType:{index:n}};return t.keys.length>3&&(r.custodianPubkey=t.keys[3].pubkey),r}static decodeAuthorizeWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{newAuthorized:e,stakeAuthorizationType:n,authoritySeed:r,authorityOwner:i}=BY(FH.AuthorizeWithSeed,t.data),o={stakePubkey:t.keys[0].pubkey,authorityBase:t.keys[1].pubkey,authoritySeed:r,authorityOwner:new cY(i),newAuthorizedPubkey:new cY(e),stakeAuthorizationType:{index:n}};return t.keys.length>3&&(o.custodianPubkey=t.keys[3].pubkey),o}static decodeSplit(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{lamports:e}=BY(FH.Split,t.data);return{stakePubkey:t.keys[0].pubkey,splitStakePubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[2].pubkey,lamports:e}}static decodeMerge(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3),BY(FH.Merge,t.data),{stakePubkey:t.keys[0].pubkey,sourceStakePubKey:t.keys[1].pubkey,authorizedPubkey:t.keys[4].pubkey}}static decodeWithdraw(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,5);const{lamports:e}=BY(FH.Withdraw,t.data),n={stakePubkey:t.keys[0].pubkey,toPubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[4].pubkey,lamports:e};return t.keys.length>5&&(n.custodianPubkey=t.keys[5].pubkey),n}static decodeDeactivate(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3),BY(FH.Deactivate,t.data),{stakePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey}}static checkProgramId(t){if(!t.equals(YH.programId))throw new Error("invalid instruction; programId is not StakeProgram")}static checkKeyLength(t,e){if(t.length<e)throw new Error(`invalid instruction; found ${t.length} keys, expected at least ${e}`)}},StakeProgram:YH,Struct:sY,SystemInstruction:class{constructor(){}static decodeInstructionType(t){this.checkProgramId(t.programId);const e=DN("instruction").decode(t.data);let n;for(const[t,r]of Object.entries(GY))if(r.index==e){n=t;break}if(!n)throw new Error("Instruction type incorrect; not a SystemInstruction");return n}static decodeCreateAccount(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{lamports:e,space:n,programId:r}=BY(GY.Create,t.data);return{fromPubkey:t.keys[0].pubkey,newAccountPubkey:t.keys[1].pubkey,lamports:e,space:n,programId:new cY(r)}}static decodeTransfer(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{lamports:e}=BY(GY.Transfer,t.data);return{fromPubkey:t.keys[0].pubkey,toPubkey:t.keys[1].pubkey,lamports:e}}static decodeTransferWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{lamports:e,seed:n,programId:r}=BY(GY.TransferWithSeed,t.data);return{fromPubkey:t.keys[0].pubkey,basePubkey:t.keys[1].pubkey,toPubkey:t.keys[2].pubkey,lamports:e,seed:n,programId:new cY(r)}}static decodeAllocate(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,1);const{space:e}=BY(GY.Allocate,t.data);return{accountPubkey:t.keys[0].pubkey,space:e}}static decodeAllocateWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,1);const{base:e,seed:n,space:r,programId:i}=BY(GY.AllocateWithSeed,t.data);return{accountPubkey:t.keys[0].pubkey,basePubkey:new cY(e),seed:n,space:r,programId:new cY(i)}}static decodeAssign(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,1);const{programId:e}=BY(GY.Assign,t.data);return{accountPubkey:t.keys[0].pubkey,programId:new cY(e)}}static decodeAssignWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,1);const{base:e,seed:n,programId:r}=BY(GY.AssignWithSeed,t.data);return{accountPubkey:t.keys[0].pubkey,basePubkey:new cY(e),seed:n,programId:new cY(r)}}static decodeCreateWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{base:e,seed:n,lamports:r,space:i,programId:o}=BY(GY.CreateWithSeed,t.data);return{fromPubkey:t.keys[0].pubkey,newAccountPubkey:t.keys[1].pubkey,basePubkey:new cY(e),seed:n,lamports:r,space:i,programId:new cY(o)}}static decodeNonceInitialize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{authorized:e}=BY(GY.InitializeNonceAccount,t.data);return{noncePubkey:t.keys[0].pubkey,authorizedPubkey:new cY(e)}}static decodeNonceAdvance(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3),BY(GY.AdvanceNonceAccount,t.data),{noncePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey}}static decodeNonceWithdraw(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,5);const{lamports:e}=BY(GY.WithdrawNonceAccount,t.data);return{noncePubkey:t.keys[0].pubkey,toPubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[4].pubkey,lamports:e}}static decodeNonceAuthorize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{authorized:e}=BY(GY.AuthorizeNonceAccount,t.data);return{noncePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[1].pubkey,newAuthorizedPubkey:new cY(e)}}static checkProgramId(t){if(!t.equals(ZY.programId))throw new Error("invalid instruction; programId is not SystemProgram")}static checkKeyLength(t,e){if(t.length<e)throw new Error(`invalid instruction; found ${t.length} keys, expected at least ${e}`)}},SystemProgram:ZY,Transaction:SY,TransactionExpiredBlockheightExceededError:sQ,TransactionExpiredTimeoutError:uQ,TransactionInstruction:LY,get TransactionStatus(){return EY},VALIDATOR_INFO_KEY:VH,VOTE_PROGRAM_ID:KH,ValidatorInfo:JH,VoteAccount:$H,VoteAuthorizationLayout:oG,VoteInit:rG,VoteInstruction:class{constructor(){}static decodeInstructionType(t){this.checkProgramId(t.programId);const e=DN("instruction").decode(t.data);let n;for(const[t,r]of Object.entries(iG))if(r.index==e){n=t;break}if(!n)throw new Error("Instruction type incorrect; not a VoteInstruction");return n}static decodeInitializeAccount(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,4);const{voteInit:e}=BY(iG.InitializeAccount,t.data);return{votePubkey:t.keys[0].pubkey,nodePubkey:t.keys[3].pubkey,voteInit:new rG(new cY(e.nodePubkey),new cY(e.authorizedVoter),new cY(e.authorizedWithdrawer),e.commission)}}static decodeAuthorize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{newAuthorized:e,voteAuthorizationType:n}=BY(iG.Authorize,t.data);return{votePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey,newAuthorizedPubkey:new cY(e),voteAuthorizationType:{index:n}}}static decodeWithdraw(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{lamports:e}=BY(iG.Withdraw,t.data);return{votePubkey:t.keys[0].pubkey,authorizedWithdrawerPubkey:t.keys[2].pubkey,lamports:e,toPubkey:t.keys[1].pubkey}}static checkProgramId(t){if(!t.equals(aG.programId))throw new Error("invalid instruction; programId is not VoteProgram")}static checkKeyLength(t,e){if(t.length<e)throw new Error(`invalid instruction; found ${t.length} keys, expected at least ${e}`)}},VoteProgram:aG,clusterApiUrl:function(t,e){const n=!1===e?"http":"https";if(!t)return sG[n].devnet;const r=sG[n][t];if(!r)throw new Error(`Unknown ${n} cluster: ${t}`);return r},sendAndConfirmRawTransaction:async function(t,e,n,r){let i,o;n&&Object.prototype.hasOwnProperty.call(n,"lastValidBlockHeight")?(i=n,o=r):o=n;const a=o&&{skipPreflight:o.skipPreflight,preflightCommitment:o.preflightCommitment||o.commitment,minContextSlot:o.minContextSlot},s=await t.sendRawTransaction(e,a),u=o&&o.commitment,c=i?t.confirmTransaction(i,u):t.confirmTransaction(s,u),l=(await c).value;if(l.err)throw new Error(`Raw transaction ${s} failed (${JSON.stringify(l)})`);return s},sendAndConfirmTransaction:zY}),cG={};class lG{constructor(t,e){if(!Number.isInteger(t))throw new TypeError("span must be an integer");this.span=t,this.property=e}makeDestinationObject(){return{}}decode(t,e){throw new Error("Layout is abstract")}encode(t,e,n){throw new Error("Layout is abstract")}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 hG(t,e){return e.property?t+"["+e.property+"]":t}cG.Layout=lG,cG.nameWithProperty=hG,cG.bindConstructorLayout=function(t,e){if("function"!=typeof t)throw new TypeError("Class must be constructor");if(t.hasOwnProperty("layout_"))throw new Error("Class is already bound to a layout");if(!(e&&e instanceof lG))throw new TypeError("layout must be a Layout");if(e.hasOwnProperty("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:function(t,n){return e.encode(this,t,n)},writable:!0}),Object.defineProperty(t,"decode",{value:function(t,n){return e.decode(t,n)},writable:!0})};class dG extends lG{isCount(){throw new Error("ExternalLayout is abstract")}}class fG extends dG{constructor(t,e){if(void 0===t&&(t=1),!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){void 0===e&&(e=0);const n=t.length-e;return Math.floor(n/this.elementSpan)}encode(t,e,n){return 0}}class pG extends dG{constructor(t,e,n){if(!(t instanceof lG))throw new TypeError("layout must be a Layout");if(void 0===e)e=0;else if(!Number.isInteger(e))throw new TypeError("offset must be integer or undefined");super(t.span,n||t.property),this.layout=t,this.offset=e}isCount(){return this.layout instanceof mG||this.layout instanceof gG}decode(t,e){return void 0===e&&(e=0),this.layout.decode(t,e+this.offset)}encode(t,e,n){return void 0===n&&(n=0),this.layout.encode(t,e,n+this.offset)}}class mG extends lG{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e){return void 0===e&&(e=0),t.readUIntLE(e,this.span)}encode(t,e,n){return void 0===n&&(n=0),e.writeUIntLE(t,n,this.span),this.span}}class gG extends lG{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e){return void 0===e&&(e=0),t.readUIntBE(e,this.span)}encode(t,e,n){return void 0===n&&(n=0),e.writeUIntBE(t,n,this.span),this.span}}class yG extends lG{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e){return void 0===e&&(e=0),t.readIntLE(e,this.span)}encode(t,e,n){return void 0===n&&(n=0),e.writeIntLE(t,n,this.span),this.span}}class bG extends lG{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e){return void 0===e&&(e=0),t.readIntBE(e,this.span)}encode(t,e,n){return void 0===n&&(n=0),e.writeIntBE(t,n,this.span),this.span}}const vG=Math.pow(2,32);function wG(t){const e=Math.floor(t/vG);return{hi32:e,lo32:t-e*vG}}function MG(t,e){return t*vG+e}class _G extends lG{constructor(t){super(8,t)}decode(t,e){void 0===e&&(e=0);const n=t.readUInt32LE(e);return MG(t.readUInt32LE(e+4),n)}encode(t,e,n){void 0===n&&(n=0);const r=wG(t);return e.writeUInt32LE(r.lo32,n),e.writeUInt32LE(r.hi32,n+4),8}}class EG extends lG{constructor(t){super(8,t)}decode(t,e){void 0===e&&(e=0);return MG(t.readUInt32BE(e),t.readUInt32BE(e+4))}encode(t,e,n){void 0===n&&(n=0);const r=wG(t);return e.writeUInt32BE(r.hi32,n),e.writeUInt32BE(r.lo32,n+4),8}}class NG extends lG{constructor(t){super(8,t)}decode(t,e){void 0===e&&(e=0);const n=t.readUInt32LE(e);return MG(t.readInt32LE(e+4),n)}encode(t,e,n){void 0===n&&(n=0);const r=wG(t);return e.writeUInt32LE(r.lo32,n),e.writeInt32LE(r.hi32,n+4),8}}class LG extends lG{constructor(t){super(8,t)}decode(t,e){void 0===e&&(e=0);return MG(t.readInt32BE(e),t.readUInt32BE(e+4))}encode(t,e,n){void 0===n&&(n=0);const r=wG(t);return e.writeInt32BE(r.hi32,n),e.writeUInt32BE(r.lo32,n+4),8}}class SG extends lG{constructor(t){super(4,t)}decode(t,e){return void 0===e&&(e=0),t.readFloatLE(e)}encode(t,e,n){return void 0===n&&(n=0),e.writeFloatLE(t,n),4}}class AG extends lG{constructor(t){super(4,t)}decode(t,e){return void 0===e&&(e=0),t.readFloatBE(e)}encode(t,e,n){return void 0===n&&(n=0),e.writeFloatBE(t,n),4}}class xG extends lG{constructor(t){super(8,t)}decode(t,e){return void 0===e&&(e=0),t.readDoubleLE(e)}encode(t,e,n){return void 0===n&&(n=0),e.writeDoubleLE(t,n),8}}class TG extends lG{constructor(t){super(8,t)}decode(t,e){return void 0===e&&(e=0),t.readDoubleBE(e)}encode(t,e,n){return void 0===n&&(n=0),e.writeDoubleBE(t,n),8}}class IG extends lG{constructor(t,e,n){if(!(t instanceof lG))throw new TypeError("elementLayout must be a Layout");if(!(e instanceof dG&&e.isCount()||Number.isInteger(e)&&0<=e))throw new TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");let r=-1;!(e instanceof dG)&&0<t.span&&(r=e*t.span),super(r,n),this.elementLayout=t,this.count=e}getSpan(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);let n=0,r=this.count;if(r instanceof dG&&(r=r.decode(t,e)),0<this.elementLayout.span)n=r*this.elementLayout.span;else{let i=0;for(;i<r;)n+=this.elementLayout.getSpan(t,e+n),++i}return n}decode(t,e){void 0===e&&(e=0);const n=[];let r=0,i=this.count;for(i instanceof dG&&(i=i.decode(t,e));r<i;)n.push(this.elementLayout.decode(t,e)),e+=this.elementLayout.getSpan(t,e),r+=1;return n}encode(t,e,n){void 0===n&&(n=0);const r=this.elementLayout,i=t.reduce(((t,i)=>t+r.encode(i,e,n+t)),0);return this.count instanceof dG&&this.count.encode(t.length,e,n),i}}class kG extends lG{constructor(t,e,n){if(!Array.isArray(t)||!t.reduce(((t,e)=>t&&e instanceof lG),!0))throw new TypeError("fields must be array of Layout instances");"boolean"==typeof e&&void 0===n&&(n=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 r=-1;try{r=t.reduce(((t,e)=>t+e.getSpan()),0)}catch(t){}super(r,e),this.fields=t,this.decodePrefixes=!!n}getSpan(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);let n=0;try{n=this.fields.reduce(((n,r)=>{const i=r.getSpan(t,e);return e+=i,n+i}),0)}catch(t){throw new RangeError("indeterminate span")}return n}decode(t,e){void 0===e&&(e=0);const n=this.makeDestinationObject();for(const r of this.fields)if(void 0!==r.property&&(n[r.property]=r.decode(t,e)),e+=r.getSpan(t,e),this.decodePrefixes&&t.length===e)break;return n}encode(t,e,n){void 0===n&&(n=0);const r=n;let i=0,o=0;for(const r of this.fields){let a=r.span;if(o=0<a?a:0,void 0!==r.property){const i=t[r.property];void 0!==i&&(o=r.encode(i,e,n),0>a&&(a=r.getSpan(e,n)))}i=n,n+=a}return i+o-r}fromArray(t){const e=this.makeDestinationObject();for(const n of this.fields)void 0!==n.property&&0<t.length&&(e[n.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 n of this.fields){if(n.property===t)return e;0>n.span?e=-1:0<=e&&(e+=n.span)}}}class jG{constructor(t){this.property=t}decode(){throw new Error("UnionDiscriminator is abstract")}encode(){throw new Error("UnionDiscriminator is abstract")}}class CG extends jG{constructor(t,e){if(!(t instanceof dG&&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,n){return this.layout.encode(t,e,n)}}class DG extends lG{constructor(t,e,n){const r=t instanceof mG||t instanceof gG;if(r)t=new CG(new pG(t));else if(t instanceof dG&&t.isCount())t=new CG(t);else if(!(t instanceof jG))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(void 0===e&&(e=null),!(null===e||e instanceof lG))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&&r&&(i+=t.layout.span)),super(i,n),this.discriminator=t,this.usesPrefixDiscriminator=r,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){if(0<=this.span)return this.span;void 0===e&&(e=0);const n=this.getVariant(t,e);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(t,e)}defaultGetSourceVariant(t){if(t.hasOwnProperty(this.discriminator.property)){if(this.defaultLayout&&t.hasOwnProperty(this.defaultLayout.property))return;const e=this.registry[t[this.discriminator.property]];if(e&&(!e.layout||t.hasOwnProperty(e.property)))return e}else for(const e in this.registry){const n=this.registry[e];if(t.hasOwnProperty(n.property))return n}throw new Error("unable to infer src variant")}decode(t,e){let n;void 0===e&&(e=0);const r=this.discriminator,i=r.decode(t,e);let o=this.registry[i];if(void 0===o){let a=0;o=this.defaultLayout,this.usesPrefixDiscriminator&&(a=r.layout.span),n=this.makeDestinationObject(),n[r.property]=i,n[o.property]=this.defaultLayout.decode(t,e+a)}else n=o.decode(t,e);return n}encode(t,e,n){void 0===n&&(n=0);const r=this.getSourceVariant(t);if(void 0===r){const r=this.discriminator,i=this.defaultLayout;let o=0;return this.usesPrefixDiscriminator&&(o=r.layout.span),r.encode(t[r.property],e,n),o+i.encode(t[i.property],e,n+o)}return r.encode(t,e,n)}addVariant(t,e,n){const r=new OG(this,t,e,n);return this.registry[t]=r,r}getVariant(t,e){let n=t;return p_.isBuffer(t)&&(void 0===e&&(e=0),n=this.discriminator.decode(t,e)),this.registry[n]}}class OG extends lG{constructor(t,e,n,r){if(!(t instanceof DG))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 n&&void 0===r&&(r=n,n=null),n){if(!(n instanceof lG))throw new TypeError("layout must be a Layout");if(null!==t.defaultLayout&&0<=n.span&&n.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if("string"!=typeof r)throw new TypeError("variant must have a String property")}let i=t.span;0>t.span&&(i=n?n.span:0,0<=i&&t.usesPrefixDiscriminator&&(i+=t.discriminator.layout.span)),super(i,r),this.union=t,this.variant=e,this.layout=n||null}getSpan(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);let n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),n+this.layout.getSpan(t,e+n)}decode(t,e){const n=this.makeDestinationObject();if(void 0===e&&(e=0),this!==this.union.getVariant(t,e))throw new Error("variant mismatch");let r=0;return this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(t,e+r):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(t,e,n){void 0===n&&(n=0);let r=0;if(this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout&&!t.hasOwnProperty(this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,e,n);let i=r;if(this.layout&&(this.layout.encode(t[this.property],e,n+r),i+=this.layout.getSpan(e,n+r),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 zG(t){return 0>t&&(t+=4294967296),t}class PG extends lG{constructor(t,e,n){if(!(t instanceof mG||t instanceof gG))throw new TypeError("word must be a UInt or UIntBE layout");if("string"==typeof e&&void 0===n&&(n=e,e=void 0),4<t.span)throw new RangeError("word cannot exceed 32 bits");super(t.span,n),this.word=t,this.msb=!!e,this.fields=[];let r=0;this._packedSetValue=function(t){return r=zG(t),this},this._packedGetValue=function(){return r}}decode(t,e){const n=this.makeDestinationObject();void 0===e&&(e=0);const r=this.word.decode(t,e);this._packedSetValue(r);for(const t of this.fields)void 0!==t.property&&(n[t.property]=t.decode(r));return n}encode(t,e,n){void 0===n&&(n=0);const r=this.word.decode(e,n);this._packedSetValue(r);for(const e of this.fields)if(void 0!==e.property){const n=t[e.property];void 0!==n&&e.encode(n)}return this.word.encode(this._packedGetValue(),e,n)}addField(t,e){const n=new RG(this,t,e);return this.fields.push(n),n}addBoolean(t){const e=new BG(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}}class RG{constructor(t,e,n){if(!(t instanceof PG))throw new TypeError("container must be a BitStructure");if(!Number.isInteger(e)||0>=e)throw new TypeError("bits must be positive integer");const r=8*t.span,i=t.fields.reduce(((t,e)=>t+e.bits),0);if(e+i>r)throw new Error("bits too long for span remainder ("+(r-i)+" of "+r+" 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=r-i-e),this.wordMask=zG(this.valueMask<<this.start),this.property=n}decode(){return zG(this.container._packedGetValue()&this.wordMask)>>>this.start}encode(t){if(!Number.isInteger(t)||t!==zG(t&this.valueMask))throw new TypeError(hG("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const e=this.container._packedGetValue(),n=zG(t<<this.start);this.container._packedSetValue(zG(e&~this.wordMask)|n)}}class BG extends RG{constructor(t,e){super(t,1,e)}decode(t,e){return!!RG.prototype.decode.call(this,t,e)}encode(t){return"boolean"==typeof t&&(t=+t),RG.prototype.encode.call(this,t)}}class UG extends lG{constructor(t,e){if(!(t instanceof dG&&t.isCount()||Number.isInteger(t)&&0<=t))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");let n=-1;t instanceof dG||(n=t),super(n,e),this.length=t}getSpan(t,e){let n=this.span;return 0>n&&(n=this.length.decode(t,e)),n}decode(t,e){void 0===e&&(e=0);let n=this.span;return 0>n&&(n=this.length.decode(t,e)),t.slice(e,e+n)}encode(t,e,n){let r=this.length;if(this.length instanceof dG&&(r=t.length),!p_.isBuffer(t)||r!==t.length)throw new TypeError(hG("Blob.encode",this)+" requires (length "+r+") Buffer as src");if(n+r>e.length)throw new RangeError("encoding overruns Buffer");return e.write(t.toString("hex"),n,r,"hex"),this.length instanceof dG&&this.length.encode(r,e,n),r}}class FG extends lG{constructor(t){super(-1,t)}getSpan(t,e){if(!p_.isBuffer(t))throw new TypeError("b must be a Buffer");void 0===e&&(e=0);let n=e;for(;n<t.length&&0!==t[n];)n+=1;return 1+n-e}decode(t,e,n){void 0===e&&(e=0);let r=this.getSpan(t,e);return t.slice(e,e+r-1).toString("utf-8")}encode(t,e,n){void 0===n&&(n=0),"string"!=typeof t&&(t=t.toString());const r=new p_(t,"utf8"),i=r.length;if(n+i>e.length)throw new RangeError("encoding overruns Buffer");return r.copy(e,n),e[n+i]=0,i+1}}class WG extends lG{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){if(!p_.isBuffer(t))throw new TypeError("b must be a Buffer");return void 0===e&&(e=0),t.length-e}decode(t,e,n){void 0===e&&(e=0);let r=this.getSpan(t,e);if(0<=this.maxSpan&&this.maxSpan<r)throw new RangeError("text length exceeds maxSpan");return t.slice(e,e+r).toString("utf-8")}encode(t,e,n){void 0===n&&(n=0),"string"!=typeof t&&(t=t.toString());const r=new p_(t,"utf8"),i=r.length;if(0<=this.maxSpan&&this.maxSpan<i)throw new RangeError("text length exceeds maxSpan");if(n+i>e.length)throw new RangeError("encoding overruns Buffer");return r.copy(e,n),i}}class YG extends lG{constructor(t,e){super(0,e),this.value=t}decode(t,e,n){return this.value}encode(t,e,n){return 0}}cG.ExternalLayout=dG,cG.GreedyCount=fG,cG.OffsetLayout=pG,cG.UInt=mG,cG.UIntBE=gG,cG.Int=yG,cG.IntBE=bG,cG.Float=SG,cG.FloatBE=AG,cG.Double=xG,cG.DoubleBE=TG,cG.Sequence=IG,cG.Structure=kG,cG.UnionDiscriminator=jG,cG.UnionLayoutDiscriminator=CG,cG.Union=DG,cG.VariantLayout=OG,cG.BitStructure=PG,cG.BitField=RG,cG.Boolean=BG,cG.Blob=UG,cG.CString=FG,cG.UTF8=WG,cG.Constant=YG,cG.greedy=(t,e)=>new fG(t,e),cG.offset=(t,e,n)=>new pG(t,e,n),cG.u8=t=>new mG(1,t),cG.u16=t=>new mG(2,t),cG.u24=t=>new mG(3,t),cG.u32=t=>new mG(4,t),cG.u40=t=>new mG(5,t),cG.u48=t=>new mG(6,t),cG.nu64=t=>new _G(t),cG.u16be=t=>new gG(2,t),cG.u24be=t=>new gG(3,t),cG.u32be=t=>new gG(4,t),cG.u40be=t=>new gG(5,t),cG.u48be=t=>new gG(6,t),cG.nu64be=t=>new EG(t),cG.s8=t=>new yG(1,t),cG.s16=t=>new yG(2,t),cG.s24=t=>new yG(3,t),cG.s32=t=>new yG(4,t),cG.s40=t=>new yG(5,t),cG.s48=t=>new yG(6,t),cG.ns64=t=>new NG(t),cG.s16be=t=>new bG(2,t),cG.s24be=t=>new bG(3,t),cG.s32be=t=>new bG(4,t),cG.s40be=t=>new bG(5,t),cG.s48be=t=>new bG(6,t),cG.ns64be=t=>new LG(t),cG.f32=t=>new SG(t),cG.f32be=t=>new AG(t),cG.f64=t=>new xG(t),cG.f64be=t=>new TG(t),cG.struct=(t,e,n)=>new kG(t,e,n),cG.bits=(t,e,n)=>new PG(t,e,n);var QG=cG.seq=(t,e,n)=>new IG(t,e,n);cG.union=(t,e,n)=>new DG(t,e,n),cG.unionLayoutDiscriminator=(t,e)=>new CG(t,e);var HG=cG.blob=(t,e)=>new UG(t,e);cG.cstr=t=>new FG(t),cG.utf8=(t,e)=>new WG(t,e),cG.const=(t,e)=>new YG(t,e);var GG={},ZG=XM(uG),VG={exports:{}};!function(t,e){function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function r(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}function i(t,e,n){if(i.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(n=e,e=10),this._init(t||0,e||10,n||"be"))}var o;"object"==typeof t?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:tE.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 s(t,e,n){var r=a(t,n);return n-1>=e&&(r|=a(t,n-1)<<4),r}function u(t,e,r,i){for(var o=0,a=0,s=Math.min(t.length,r),u=e;u<s;u++){var c=t.charCodeAt(u)-48;o*=i,a=c>=49?c-49+10:c>=17?c-17+10:c,n(c>=0&&a<i,"Invalid character"),o+=a}return o}function c(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(i.isBN=function(t){return t instanceof i||null!==t&&"object"==typeof t&&t.constructor.wordSize===i.wordSize&&Array.isArray(t.words)},i.max=function(t,e){return t.cmp(e)>0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.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)))},i.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)},i.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,a,s=0;if("be"===r)for(i=t.length-1,o=0;i>=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i<t.length;i+=3)a=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},i.prototype._parseHex=function(t,e,n){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var i,o=0,a=0;if("be"===n)for(r=t.length-1;r>=e;r-=2)i=s(t,e,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(r=(t.length-e)%2==0?e+1:e;r<t.length;r+=2)i=s(t,e,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(t,e,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=e)r++;r--,i=i/e|0;for(var o=t.length-n,a=o%r,s=Math.min(o,o-a)+n,c=0,l=n;l<s;l+=r)c=u(t,l,l+r,e),this.imuln(i),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==a){var h=1;for(c=u(t,l,t.length,e),l=0;l<a;l++)h*=e;this.imuln(h),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}this._strip()},i.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},i.prototype._move=function(t){c(t,this)},i.prototype.clone=function(){var t=new i(null);return this.copy(t),t},i.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},i.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){i.prototype.inspect=l}else i.prototype.inspect=l;function l(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var h=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[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 p(t,e,n){n.negative=e.negative^t.negative;var r=t.length+e.length|0;n.length=r,r=r-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,u=a/67108864|0;n.words[0]=s;for(var c=1;c<r;c++){for(var l=u>>>26,h=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;l+=(a=(i=0|t.words[p])*(o=0|e.words[f])+h)/67108864|0,h=67108863&a}n.words[c]=0|h,u=0|l}return 0!==u?n.words[c]=0|u:n.length--,n._strip()}i.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,a=0;a<this.length;a++){var s=this.words[a],u=(16777215&(s<<i|o)).toString(16);o=s>>>24-i&16777215,(i+=2)>=26&&(i-=26,a--),r=0!==o||a!==this.length-1?h[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=d[t],l=f[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modrn(l).toString(t);r=(p=p.idivn(l)).isZero()?m+r:h[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")},i.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},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},i.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 a=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](a,i),a},i.prototype._toArrayLikeLE=function(t,e){for(var n=0,r=0,i=0,o=0;i<this.length;i++){var a=this.words[i]<<o|r;t[n++]=255&a,n<t.length&&(t[n++]=a>>8&255),n<t.length&&(t[n++]=a>>16&255),6===o?(n<t.length&&(t[n++]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n<t.length)for(t[n++]=r;n<t.length;)t[n++]=0},i.prototype._toArrayLikeBE=function(t,e){for(var n=t.length-1,r=0,i=0,o=0;i<this.length;i++){var a=this.words[i]<<o|r;t[n--]=255&a,n>=0&&(t[n--]=a>>8&255),n>=0&&(t[n--]=a>>16&255),6===o?(n>=0&&(t[n--]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n>=0)for(t[n--]=r;n>=0;)t[n--]=0},Math.clz32?i.prototype._countBits=function(t){return 32-Math.clz32(t)}:i.prototype._countBits=function(t){var e=t,n=0;return e>=4096&&(n+=13,e>>>=13),e>=64&&(n+=7,e>>>=7),e>=8&&(n+=4,e>>>=4),e>=2&&(n+=2,e>>>=2),n+e},i.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,n=0;return 0==(8191&e)&&(n+=13,e>>>=13),0==(127&e)&&(n+=7,e>>>=7),0==(15&e)&&(n+=4,e>>>=4),0==(3&e)&&(n+=2,e>>>=2),0==(1&e)&&n++,n},i.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var n=this._zeroBits(this.words[e]);if(t+=n,26!==n)break}return t},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},i.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return 0!==this.negative},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.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()},i.prototype.ior=function(t){return n(0==(this.negative|t.negative)),this.iuor(t)},i.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},i.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var n=0;n<e.length;n++)this.words[n]=this.words[n]&t.words[n];return this.length=e.length,this._strip()},i.prototype.iand=function(t){return n(0==(this.negative|t.negative)),this.iuand(t)},i.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},i.prototype.iuxor=function(t){var e,n;this.length>t.length?(e=this,n=t):(e=t,n=this);for(var r=0;r<n.length;r++)this.words[r]=e.words[r]^n.words[r];if(this!==e)for(;r<e.length;r++)this.words[r]=e.words[r];return this.length=e.length,this._strip()},i.prototype.ixor=function(t){return n(0==(this.negative|t.negative)),this.iuxor(t)},i.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},i.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()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.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()},i.prototype.iadd=function(t){var e,n,r;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?(n=this,r=t):(n=t,r=this);for(var i=0,o=0;o<r.length;o++)e=(0|n.words[o])+(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<n.length;o++)e=(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;o<n.length;o++)this.words[o]=n.words[o];return this},i.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)},i.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 n,r,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=t):(n=t,r=this);for(var o=0,a=0;a<r.length;a++)o=(e=(0|n.words[a])-(0|r.words[a])+o)>>26,this.words[a]=67108863&e;for(;0!==o&&a<n.length;a++)o=(e=(0|n.words[a])+o)>>26,this.words[a]=67108863&e;if(0===o&&a<n.length&&n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this.length=Math.max(this.length,a),n!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(t){return this.clone().isub(t)};var m=function(t,e,n){var r,i,o,a=t.words,s=e.words,u=n.words,c=0,l=0|a[0],h=8191&l,d=l>>>13,f=0|a[1],p=8191&f,m=f>>>13,g=0|a[2],y=8191&g,b=g>>>13,v=0|a[3],w=8191&v,M=v>>>13,_=0|a[4],E=8191&_,N=_>>>13,L=0|a[5],S=8191&L,A=L>>>13,x=0|a[6],T=8191&x,I=x>>>13,k=0|a[7],j=8191&k,C=k>>>13,D=0|a[8],O=8191&D,z=D>>>13,P=0|a[9],R=8191&P,B=P>>>13,U=0|s[0],F=8191&U,W=U>>>13,Y=0|s[1],Q=8191&Y,H=Y>>>13,G=0|s[2],Z=8191&G,V=G>>>13,q=0|s[3],J=8191&q,K=q>>>13,X=0|s[4],$=8191&X,tt=X>>>13,et=0|s[5],nt=8191&et,rt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ct=st>>>13,lt=0|s[8],ht=8191<,dt=lt>>>13,ft=0|s[9],pt=8191&ft,mt=ft>>>13;n.negative=t.negative^e.negative,n.length=19;var gt=(c+(r=Math.imul(h,F))|0)+((8191&(i=(i=Math.imul(h,W))+Math.imul(d,F)|0))<<13)|0;c=((o=Math.imul(d,W))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(p,F),i=(i=Math.imul(p,W))+Math.imul(m,F)|0,o=Math.imul(m,W);var yt=(c+(r=r+Math.imul(h,Q)|0)|0)+((8191&(i=(i=i+Math.imul(h,H)|0)+Math.imul(d,Q)|0))<<13)|0;c=((o=o+Math.imul(d,H)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,r=Math.imul(y,F),i=(i=Math.imul(y,W))+Math.imul(b,F)|0,o=Math.imul(b,W),r=r+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,H)|0;var bt=(c+(r=r+Math.imul(h,Z)|0)|0)+((8191&(i=(i=i+Math.imul(h,V)|0)+Math.imul(d,Z)|0))<<13)|0;c=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(w,F),i=(i=Math.imul(w,W))+Math.imul(M,F)|0,o=Math.imul(M,W),r=r+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,H)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,H)|0,r=r+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,V)|0;var vt=(c+(r=r+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,K)|0)+Math.imul(d,J)|0))<<13)|0;c=((o=o+Math.imul(d,K)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(E,F),i=(i=Math.imul(E,W))+Math.imul(N,F)|0,o=Math.imul(N,W),r=r+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,H)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,H)|0,r=r+Math.imul(y,Z)|0,i=(i=i+Math.imul(y,V)|0)+Math.imul(b,Z)|0,o=o+Math.imul(b,V)|0,r=r+Math.imul(p,J)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,K)|0;var wt=(c+(r=r+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,tt)|0)+Math.imul(d,$)|0))<<13)|0;c=((o=o+Math.imul(d,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(S,F),i=(i=Math.imul(S,W))+Math.imul(A,F)|0,o=Math.imul(A,W),r=r+Math.imul(E,Q)|0,i=(i=i+Math.imul(E,H)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,H)|0,r=r+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,V)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,V)|0,r=r+Math.imul(y,J)|0,i=(i=i+Math.imul(y,K)|0)+Math.imul(b,J)|0,o=o+Math.imul(b,K)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,tt)|0;var Mt=(c+(r=r+Math.imul(h,nt)|0)|0)+((8191&(i=(i=i+Math.imul(h,rt)|0)+Math.imul(d,nt)|0))<<13)|0;c=((o=o+Math.imul(d,rt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(T,F),i=(i=Math.imul(T,W))+Math.imul(I,F)|0,o=Math.imul(I,W),r=r+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,H)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,H)|0,r=r+Math.imul(E,Z)|0,i=(i=i+Math.imul(E,V)|0)+Math.imul(N,Z)|0,o=o+Math.imul(N,V)|0,r=r+Math.imul(w,J)|0,i=(i=i+Math.imul(w,K)|0)+Math.imul(M,J)|0,o=o+Math.imul(M,K)|0,r=r+Math.imul(y,$)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(b,$)|0,o=o+Math.imul(b,tt)|0,r=r+Math.imul(p,nt)|0,i=(i=i+Math.imul(p,rt)|0)+Math.imul(m,nt)|0,o=o+Math.imul(m,rt)|0;var _t=(c+(r=r+Math.imul(h,ot)|0)|0)+((8191&(i=(i=i+Math.imul(h,at)|0)+Math.imul(d,ot)|0))<<13)|0;c=((o=o+Math.imul(d,at)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,r=Math.imul(j,F),i=(i=Math.imul(j,W))+Math.imul(C,F)|0,o=Math.imul(C,W),r=r+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,H)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,H)|0,r=r+Math.imul(S,Z)|0,i=(i=i+Math.imul(S,V)|0)+Math.imul(A,Z)|0,o=o+Math.imul(A,V)|0,r=r+Math.imul(E,J)|0,i=(i=i+Math.imul(E,K)|0)+Math.imul(N,J)|0,o=o+Math.imul(N,K)|0,r=r+Math.imul(w,$)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,tt)|0,r=r+Math.imul(y,nt)|0,i=(i=i+Math.imul(y,rt)|0)+Math.imul(b,nt)|0,o=o+Math.imul(b,rt)|0,r=r+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,at)|0;var Et=(c+(r=r+Math.imul(h,ut)|0)|0)+((8191&(i=(i=i+Math.imul(h,ct)|0)+Math.imul(d,ut)|0))<<13)|0;c=((o=o+Math.imul(d,ct)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(O,F),i=(i=Math.imul(O,W))+Math.imul(z,F)|0,o=Math.imul(z,W),r=r+Math.imul(j,Q)|0,i=(i=i+Math.imul(j,H)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,H)|0,r=r+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,V)|0)+Math.imul(I,Z)|0,o=o+Math.imul(I,V)|0,r=r+Math.imul(S,J)|0,i=(i=i+Math.imul(S,K)|0)+Math.imul(A,J)|0,o=o+Math.imul(A,K)|0,r=r+Math.imul(E,$)|0,i=(i=i+Math.imul(E,tt)|0)+Math.imul(N,$)|0,o=o+Math.imul(N,tt)|0,r=r+Math.imul(w,nt)|0,i=(i=i+Math.imul(w,rt)|0)+Math.imul(M,nt)|0,o=o+Math.imul(M,rt)|0,r=r+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,at)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,at)|0,r=r+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 Nt=(c+(r=r+Math.imul(h,ht)|0)|0)+((8191&(i=(i=i+Math.imul(h,dt)|0)+Math.imul(d,ht)|0))<<13)|0;c=((o=o+Math.imul(d,dt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,r=Math.imul(R,F),i=(i=Math.imul(R,W))+Math.imul(B,F)|0,o=Math.imul(B,W),r=r+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,H)|0)+Math.imul(z,Q)|0,o=o+Math.imul(z,H)|0,r=r+Math.imul(j,Z)|0,i=(i=i+Math.imul(j,V)|0)+Math.imul(C,Z)|0,o=o+Math.imul(C,V)|0,r=r+Math.imul(T,J)|0,i=(i=i+Math.imul(T,K)|0)+Math.imul(I,J)|0,o=o+Math.imul(I,K)|0,r=r+Math.imul(S,$)|0,i=(i=i+Math.imul(S,tt)|0)+Math.imul(A,$)|0,o=o+Math.imul(A,tt)|0,r=r+Math.imul(E,nt)|0,i=(i=i+Math.imul(E,rt)|0)+Math.imul(N,nt)|0,o=o+Math.imul(N,rt)|0,r=r+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,at)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,at)|0,r=r+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ct)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,ct)|0,r=r+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,dt)|0)+Math.imul(m,ht)|0,o=o+Math.imul(m,dt)|0;var Lt=(c+(r=r+Math.imul(h,pt)|0)|0)+((8191&(i=(i=i+Math.imul(h,mt)|0)+Math.imul(d,pt)|0))<<13)|0;c=((o=o+Math.imul(d,mt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,r=Math.imul(R,Q),i=(i=Math.imul(R,H))+Math.imul(B,Q)|0,o=Math.imul(B,H),r=r+Math.imul(O,Z)|0,i=(i=i+Math.imul(O,V)|0)+Math.imul(z,Z)|0,o=o+Math.imul(z,V)|0,r=r+Math.imul(j,J)|0,i=(i=i+Math.imul(j,K)|0)+Math.imul(C,J)|0,o=o+Math.imul(C,K)|0,r=r+Math.imul(T,$)|0,i=(i=i+Math.imul(T,tt)|0)+Math.imul(I,$)|0,o=o+Math.imul(I,tt)|0,r=r+Math.imul(S,nt)|0,i=(i=i+Math.imul(S,rt)|0)+Math.imul(A,nt)|0,o=o+Math.imul(A,rt)|0,r=r+Math.imul(E,ot)|0,i=(i=i+Math.imul(E,at)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,at)|0,r=r+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,ct)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ct)|0,r=r+Math.imul(y,ht)|0,i=(i=i+Math.imul(y,dt)|0)+Math.imul(b,ht)|0,o=o+Math.imul(b,dt)|0;var St=(c+(r=r+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)+(St>>>26)|0,St&=67108863,r=Math.imul(R,Z),i=(i=Math.imul(R,V))+Math.imul(B,Z)|0,o=Math.imul(B,V),r=r+Math.imul(O,J)|0,i=(i=i+Math.imul(O,K)|0)+Math.imul(z,J)|0,o=o+Math.imul(z,K)|0,r=r+Math.imul(j,$)|0,i=(i=i+Math.imul(j,tt)|0)+Math.imul(C,$)|0,o=o+Math.imul(C,tt)|0,r=r+Math.imul(T,nt)|0,i=(i=i+Math.imul(T,rt)|0)+Math.imul(I,nt)|0,o=o+Math.imul(I,rt)|0,r=r+Math.imul(S,ot)|0,i=(i=i+Math.imul(S,at)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,at)|0,r=r+Math.imul(E,ut)|0,i=(i=i+Math.imul(E,ct)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ct)|0,r=r+Math.imul(w,ht)|0,i=(i=i+Math.imul(w,dt)|0)+Math.imul(M,ht)|0,o=o+Math.imul(M,dt)|0;var At=(c+(r=r+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,mt)|0)+Math.imul(b,pt)|0))<<13)|0;c=((o=o+Math.imul(b,mt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(R,J),i=(i=Math.imul(R,K))+Math.imul(B,J)|0,o=Math.imul(B,K),r=r+Math.imul(O,$)|0,i=(i=i+Math.imul(O,tt)|0)+Math.imul(z,$)|0,o=o+Math.imul(z,tt)|0,r=r+Math.imul(j,nt)|0,i=(i=i+Math.imul(j,rt)|0)+Math.imul(C,nt)|0,o=o+Math.imul(C,rt)|0,r=r+Math.imul(T,ot)|0,i=(i=i+Math.imul(T,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,r=r+Math.imul(S,ut)|0,i=(i=i+Math.imul(S,ct)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,ct)|0,r=r+Math.imul(E,ht)|0,i=(i=i+Math.imul(E,dt)|0)+Math.imul(N,ht)|0,o=o+Math.imul(N,dt)|0;var xt=(c+(r=r+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,mt)|0)+Math.imul(M,pt)|0))<<13)|0;c=((o=o+Math.imul(M,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,r=Math.imul(R,$),i=(i=Math.imul(R,tt))+Math.imul(B,$)|0,o=Math.imul(B,tt),r=r+Math.imul(O,nt)|0,i=(i=i+Math.imul(O,rt)|0)+Math.imul(z,nt)|0,o=o+Math.imul(z,rt)|0,r=r+Math.imul(j,ot)|0,i=(i=i+Math.imul(j,at)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,at)|0,r=r+Math.imul(T,ut)|0,i=(i=i+Math.imul(T,ct)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ct)|0,r=r+Math.imul(S,ht)|0,i=(i=i+Math.imul(S,dt)|0)+Math.imul(A,ht)|0,o=o+Math.imul(A,dt)|0;var Tt=(c+(r=r+Math.imul(E,pt)|0)|0)+((8191&(i=(i=i+Math.imul(E,mt)|0)+Math.imul(N,pt)|0))<<13)|0;c=((o=o+Math.imul(N,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(R,nt),i=(i=Math.imul(R,rt))+Math.imul(B,nt)|0,o=Math.imul(B,rt),r=r+Math.imul(O,ot)|0,i=(i=i+Math.imul(O,at)|0)+Math.imul(z,ot)|0,o=o+Math.imul(z,at)|0,r=r+Math.imul(j,ut)|0,i=(i=i+Math.imul(j,ct)|0)+Math.imul(C,ut)|0,o=o+Math.imul(C,ct)|0,r=r+Math.imul(T,ht)|0,i=(i=i+Math.imul(T,dt)|0)+Math.imul(I,ht)|0,o=o+Math.imul(I,dt)|0;var It=(c+(r=r+Math.imul(S,pt)|0)|0)+((8191&(i=(i=i+Math.imul(S,mt)|0)+Math.imul(A,pt)|0))<<13)|0;c=((o=o+Math.imul(A,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(R,ot),i=(i=Math.imul(R,at))+Math.imul(B,ot)|0,o=Math.imul(B,at),r=r+Math.imul(O,ut)|0,i=(i=i+Math.imul(O,ct)|0)+Math.imul(z,ut)|0,o=o+Math.imul(z,ct)|0,r=r+Math.imul(j,ht)|0,i=(i=i+Math.imul(j,dt)|0)+Math.imul(C,ht)|0,o=o+Math.imul(C,dt)|0;var kt=(c+(r=r+Math.imul(T,pt)|0)|0)+((8191&(i=(i=i+Math.imul(T,mt)|0)+Math.imul(I,pt)|0))<<13)|0;c=((o=o+Math.imul(I,mt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,r=Math.imul(R,ut),i=(i=Math.imul(R,ct))+Math.imul(B,ut)|0,o=Math.imul(B,ct),r=r+Math.imul(O,ht)|0,i=(i=i+Math.imul(O,dt)|0)+Math.imul(z,ht)|0,o=o+Math.imul(z,dt)|0;var jt=(c+(r=r+Math.imul(j,pt)|0)|0)+((8191&(i=(i=i+Math.imul(j,mt)|0)+Math.imul(C,pt)|0))<<13)|0;c=((o=o+Math.imul(C,mt)|0)+(i>>>13)|0)+(jt>>>26)|0,jt&=67108863,r=Math.imul(R,ht),i=(i=Math.imul(R,dt))+Math.imul(B,ht)|0,o=Math.imul(B,dt);var Ct=(c+(r=r+Math.imul(O,pt)|0)|0)+((8191&(i=(i=i+Math.imul(O,mt)|0)+Math.imul(z,pt)|0))<<13)|0;c=((o=o+Math.imul(z,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863;var Dt=(c+(r=Math.imul(R,pt))|0)+((8191&(i=(i=Math.imul(R,mt))+Math.imul(B,pt)|0))<<13)|0;return c=((o=Math.imul(B,mt))+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,u[0]=gt,u[1]=yt,u[2]=bt,u[3]=vt,u[4]=wt,u[5]=Mt,u[6]=_t,u[7]=Et,u[8]=Nt,u[9]=Lt,u[10]=St,u[11]=At,u[12]=xt,u[13]=Tt,u[14]=It,u[15]=kt,u[16]=jt,u[17]=Ct,u[18]=Dt,0!==c&&(u[19]=c,n.length++),n};function g(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var r=0,i=0,o=0;o<n.length-1;o++){var a=i;i=0;for(var s=67108863&r,u=Math.min(o,e.length-1),c=Math.max(0,o-t.length+1);c<=u;c++){var l=o-c,h=(0|t.words[l])*(0|e.words[c]),d=67108863&h;s=67108863&(d=d+s|0),i+=(a=(a=a+(h/67108864|0)|0)+(d>>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n._strip()}function y(t,e,n){return g(t,e,n)}Math.imul||(m=p),i.prototype.mulTo=function(t,e){var n=this.length+t.length;return 10===this.length&&10===t.length?m(this,t,e):n<63?p(this,t,e):n<1024?g(this,t,e):y(this,t,e)},i.prototype.mul=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},i.prototype.mulf=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),y(this,t,e)},i.prototype.imul=function(t){return this.clone().mulTo(t,this)},i.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,a=(67108863&o)+(67108863&r);r>>=26,r+=o/67108864|0,r+=a>>>26,this.words[i]=67108863&a}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():this},i.prototype.muln=function(t){return this.clone().imuln(t)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),n=0;n<e.length;n++){var r=n/26|0,i=n%26;e[n]=t.words[r]>>>i&1}return e}(t);if(0===e.length)return new i(1);for(var n=this,r=0;r<e.length&&0===e[r];r++,n=n.sqr());if(++r<e.length)for(var o=n.sqr();r<e.length;r++,o=o.sqr())0!==e[r]&&(n=n.mul(o));return n},i.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 a=0;for(e=0;e<this.length;e++){var s=this.words[e]&o,u=(0|this.words[e])-s<<r;this.words[e]=u|a,a=s>>>26-r}a&&(this.words[e]=a,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()},i.prototype.ishln=function(t){return n(0===this.negative),this.iushln(t)},i.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,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<<o,u=r;if(i-=a,i=Math.max(0,i),u){for(var c=0;c<a;c++)u.words[c]=this.words[c];u.length=a}if(0===a);else if(this.length>a)for(this.length-=a,c=0;c<this.length;c++)this.words[c]=this.words[c+a];else this.words[0]=0,this.length=1;var l=0;for(c=this.length-1;c>=0&&(0!==l||c>=i);c--){var h=0|this.words[c];this.words[c]=l<<26-o|h>>>o,l=h&s}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},i.prototype.shln=function(t){return this.clone().ishln(t)},i.prototype.ushln=function(t){return this.clone().iushln(t)},i.prototype.shrn=function(t){return this.clone().ishrn(t)},i.prototype.ushrn=function(t){return this.clone().iushrn(t)},i.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))},i.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()},i.prototype.maskn=function(t){return this.clone().imaskn(t)},i.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)},i.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},i.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()},i.prototype.addn=function(t){return this.clone().iaddn(t)},i.prototype.subn=function(t){return this.clone().isubn(t)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(t,e,r){var i,o,a=t.length+r;this._expand(a);var s=0;for(i=0;i<t.length;i++){o=(0|this.words[i+r])+s;var u=(0|t.words[i])*e;s=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i<this.length-r;i++)s=(o=(0|this.words[i+r])+s)>>26,this.words[i+r]=67108863&o;if(0===s)return this._strip();for(n(-1===s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},i.prototype._wordDiv=function(t,e){var n=(this.length,t.length),r=this.clone(),o=t,a=0|o.words[o.length-1];0!=(n=26-this._countBits(a))&&(o=o.ushln(n),r.iushln(n),a=0|o.words[o.length-1]);var s,u=r.length-o.length;if("mod"!==e){(s=new i(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c<s.length;c++)s.words[c]=0}var l=r.clone()._ishlnsubmul(o,1,u);0===l.negative&&(r=l,s&&(s.words[u]=1));for(var h=u-1;h>=0;h--){var d=67108864*(0|r.words[o.length+h])+(0|r.words[o.length+h-1]);for(d=Math.min(d/a|0,67108863),r._ishlnsubmul(o,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(o,1,h),r.isZero()||(r.negative^=1);s&&(s.words[h]=d)}return s&&s._strip(),r._strip(),"div"!==e&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},i.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(o=s.div.neg()),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(t)),{div:o,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new i(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new i(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,a,s},i.prototype.div=function(t){return this.divmod(t,"div",!1).div},i.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},i.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},i.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var n=0!==e.div.negative?e.mod.isub(t):e.mod,r=t.ushrn(1),i=t.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.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},i.prototype.modn=function(t){return this.modrn(t)},i.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},i.prototype.divn=function(t){return this.clone().idivn(t)},i.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 o=new i(1),a=new i(0),s=new i(0),u=new i(1),c=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++c;for(var l=r.clone(),h=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;)(o.isOdd()||a.isOdd())&&(o.iadd(l),a.isub(h)),o.iushrn(1),a.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;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(h)),s.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(s),a.isub(u)):(r.isub(e),s.isub(o),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},i.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 o,a=new i(1),s=new i(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,l=1;0==(e.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(e.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var h=0,d=1;0==(r.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(r.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),a.isub(s)):(r.isub(e),s.isub(a))}return(o=0===e.cmpn(1)?a:s).cmpn(0)<0&&o.iadd(t),o},i.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),n=t.clone();e.negative=0,n.negative=0;for(var r=0;e.isEven()&&n.isEven();r++)e.iushrn(1),n.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=e.cmp(n);if(i<0){var o=e;e=n,n=o}else if(0===i||0===n.cmpn(1))break;e.isub(n)}return n.iushln(r)},i.prototype.invm=function(t){return this.egcd(t).a.umod(t)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(t){return this.words[0]&t},i.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,a=r;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.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},i.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},i.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,n=this.length-1;n>=0;n--){var r=0|this.words[n],i=0|t.words[n];if(r!==i){r<i?e=-1:r>i&&(e=1);break}}return e},i.prototype.gtn=function(t){return 1===this.cmpn(t)},i.prototype.gt=function(t){return 1===this.cmp(t)},i.prototype.gten=function(t){return this.cmpn(t)>=0},i.prototype.gte=function(t){return this.cmp(t)>=0},i.prototype.ltn=function(t){return-1===this.cmpn(t)},i.prototype.lt=function(t){return-1===this.cmp(t)},i.prototype.lten=function(t){return this.cmpn(t)<=0},i.prototype.lte=function(t){return this.cmp(t)<=0},i.prototype.eqn=function(t){return 0===this.cmpn(t)},i.prototype.eq=function(t){return 0===this.cmp(t)},i.red=function(t){return new N(t)},i.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)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(t){return this.red=t,this},i.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.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 i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function M(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function N(t){if("string"==typeof t){var e=i._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 L(t){N.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var e,n=t;do{this.split(n,this.tmp),e=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(e>this.n);var r=e<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):r>0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},r(w,v),w.prototype.split=function(t,e){for(var n=4194303,r=Math.min(t.length,9),i=0;i<r;i++)e.words[i]=t.words[i];if(e.length=r,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&n,i=10;i<t.length;i++){var a=0|t.words[i];t.words[i-10]=(a&n)<<4|o>>>22,o=a}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},w.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n<t.length;n++){var r=0|t.words[n];e+=977*r,t.words[n]=67108863&e,e=64*r+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},r(M,v),r(_,v),r(E,v),E.prototype.imulK=function(t){for(var e=0,n=0;n<t.length;n++){var r=19*(0|t.words[n])+e,i=67108863&r;r>>>=26,t.words[n]=i,e=r}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(b[t])return b[t];var e;if("k256"===t)e=new w;else if("p224"===t)e=new M;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new E}return b[t]=e,e},N.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},N.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")},N.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(c(t,t.umod(this.m)._forceRed(this)),t)},N.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},N.prototype.add=function(t,e){this._verify2(t,e);var n=t.add(e);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},N.prototype.iadd=function(t,e){this._verify2(t,e);var n=t.iadd(e);return n.cmp(this.m)>=0&&n.isub(this.m),n},N.prototype.sub=function(t,e){this._verify2(t,e);var n=t.sub(e);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},N.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},N.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},N.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},N.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},N.prototype.isqr=function(t){return this.imul(t,t.clone())},N.prototype.sqr=function(t){return this.mul(t,t)},N.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 i(1)).iushrn(2);return this.pow(t,r)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);n(!o.isZero());var s=new i(1).toRed(this),u=s.redNeg(),c=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new i(2*l*l).toRed(this);0!==this.pow(l,c).cmp(u);)l.redIAdd(u);for(var h=this.pow(l,o),d=this.pow(t,o.addn(1).iushrn(1)),f=this.pow(t,o),p=a;0!==f.cmp(s);){for(var m=f,g=0;0!==m.cmp(s);g++)m=m.redSqr();n(g<p);var y=this.pow(h,new i(1).iushln(p-g-1));d=d.redMul(y),h=y.redSqr(),f=f.redMul(h),p=g}return d},N.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},N.prototype.pow=function(t,e){if(e.isZero())return new i(1).toRed(this);if(0===e.cmpn(1))return t.clone();var n=new Array(16);n[0]=new i(1).toRed(this),n[1]=t;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],t);var o=n[0],a=0,s=0,u=e.bitLength()%26;for(0===u&&(u=26),r=e.length-1;r>=0;r--){for(var c=e.words[r],l=u-1;l>=0;l--){var h=c>>l&1;o!==n[0]&&(o=this.sqr(o)),0!==h||0!==a?(a<<=1,a|=h,(4==++s||0===r&&0===l)&&(o=this.mul(o,n[a]),s=0,a=0)):s=0}u=26}return o},N.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},N.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new L(t)},r(L,N),L.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},L.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},L.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var n=t.imul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).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)},L.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new i(0)._forceRed(this);var n=t.mul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=n.isub(r).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},L.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(VG,KM),function(t){var e=KM&&KM.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(t,"__esModule",{value:!0}),t.map=t.array=t.rustEnum=t.str=t.vecU8=t.tagged=t.vec=t.bool=t.option=t.publicKey=t.i128=t.u128=t.i64=t.u64=t.struct=t.f64=t.f32=t.i32=t.u32=t.i16=t.u16=t.i8=t.u8=void 0;const n=cG,r=ZG,i=e(VG.exports);var o=cG;Object.defineProperty(t,"u8",{enumerable:!0,get:function(){return o.u8}}),Object.defineProperty(t,"i8",{enumerable:!0,get:function(){return o.s8}}),Object.defineProperty(t,"u16",{enumerable:!0,get:function(){return o.u16}}),Object.defineProperty(t,"i16",{enumerable:!0,get:function(){return o.s16}}),Object.defineProperty(t,"u32",{enumerable:!0,get:function(){return o.u32}}),Object.defineProperty(t,"i32",{enumerable:!0,get:function(){return o.s32}}),Object.defineProperty(t,"f32",{enumerable:!0,get:function(){return o.f32}}),Object.defineProperty(t,"f64",{enumerable:!0,get:function(){return o.f64}}),Object.defineProperty(t,"struct",{enumerable:!0,get:function(){return o.struct}});class a extends n.Layout{constructor(t,e,r){super(t,r),this.blob=n.blob(t),this.signed=e}decode(t,e=0){const n=new i.default(this.blob.decode(t,e),10,"le");return this.signed?n.fromTwos(8*this.span).clone():n}encode(t,e,n=0){return this.signed&&(t=t.toTwos(8*this.span)),this.blob.encode(t.toArrayLike(p_,"le",this.span),e,n)}}function s(t){return new a(8,!1,t)}t.u64=s,t.i64=function(t){return new a(8,!0,t)},t.u128=function(t){return new a(16,!1,t)},t.i128=function(t){return new a(16,!0,t)};class u extends n.Layout{constructor(t,e,n,r){super(t.span,r),this.layout=t,this.decoder=e,this.encoder=n}decode(t,e){return this.decoder(this.layout.decode(t,e))}encode(t,e,n){return this.layout.encode(this.encoder(t),e,n)}getSpan(t,e){return this.layout.getSpan(t,e)}}t.publicKey=function(t){return new u(n.blob(32),(t=>new r.PublicKey(t)),(t=>t.toBuffer()),t)};class c extends n.Layout{constructor(t,e){super(-1,e),this.layout=t,this.discriminator=n.u8()}encode(t,e,n=0){return null==t?this.discriminator.encode(0,e,n):(this.discriminator.encode(1,e,n),this.layout.encode(t,e,n+1)+1)}decode(t,e=0){const n=this.discriminator.decode(t,e);if(0===n)return null;if(1===n)return this.layout.decode(t,e+1);throw new Error("Invalid option "+this.property)}getSpan(t,e=0){const n=this.discriminator.decode(t,e);if(0===n)return 1;if(1===n)return this.layout.getSpan(t,e+1)+1;throw new Error("Invalid option "+this.property)}}function l(t){if(0===t)return!1;if(1===t)return!0;throw new Error("Invalid bool: "+t)}function h(t){return t?1:0}function d(t){const e=n.u32("length"),r=n.struct([e,n.blob(n.offset(e,-e.span),"data")]);return new u(r,(({data:t})=>t),(t=>({data:t})),t)}t.option=function(t,e){return new c(t,e)},t.bool=function(t){return new u(n.u8(),l,h,t)},t.vec=function(t,e){const r=n.u32("length"),i=n.struct([r,n.seq(t,n.offset(r,-r.span),"values")]);return new u(i,(({values:t})=>t),(t=>({values:t})),e)},t.tagged=function(t,e,r){const i=n.struct([s("tag"),e.replicate("data")]);return new u(i,(function({tag:e,data:n}){if(!e.eq(t))throw new Error("Invalid tag, expected: "+t.toString("hex")+", got: "+e.toString("hex"));return n}),(e=>({tag:t,data:e})),r)},t.vecU8=d,t.str=function(t){return new u(d(),(t=>t.toString("utf-8")),(t=>p_.from(t,"utf-8")),t)},t.rustEnum=function(t,e,r){const i=n.union(null!=r?r:n.u8(),e);return t.forEach(((t,e)=>i.addVariant(e,t,t.property))),i},t.array=function(t,e,r){const i=n.struct([n.seq(t,e,"values")]);return new u(i,(({values:t})=>t),(t=>({values:t})),r)};class f extends n.Layout{constructor(t,e,n){super(t.span+e.span,n),this.keyLayout=t,this.valueLayout=e}decode(t,e){e=e||0;return[this.keyLayout.decode(t,e),this.valueLayout.decode(t,e+this.keyLayout.getSpan(t,e))]}encode(t,e,n){n=n||0;const r=this.keyLayout.encode(t[0],e,n);return r+this.valueLayout.encode(t[1],e,n+r)}getSpan(t,e){return this.keyLayout.getSpan(t,e)+this.valueLayout.getSpan(t,e)}}t.map=function(t,e,r){const i=n.u32("length"),o=n.struct([i,n.seq(new f(t,e),n.offset(i,-i.span),"values")]);return new u(o,(({values:t})=>new Map(t)),(t=>({values:Array.from(t.entries())})),r)}}(GG);const qG=tE.Buffer,JG=eE.exports,KG=GG.struct([GG.publicKey("mint"),GG.publicKey("owner"),GG.u64("amount"),GG.u32("delegateOption"),GG.publicKey("delegate"),GG.u8("state"),GG.u32("isNativeOption"),GG.u64("isNative"),GG.u64("delegatedAmount"),GG.u32("closeAuthorityOption"),GG.publicKey("closeAuthority")]);GG.array;var XG=GG.bool;GG.i128,GG.i16,GG.i32,GG.i64,GG.i8,GG.map;var $G=GG.option,tZ=GG.publicKey,eZ=GG.rustEnum,nZ=GG.str,rZ=GG.struct;GG.tagged;var iZ=GG.u128,oZ=GG.u16,aZ=GG.u32,sZ=GG.u64,uZ=GG.u8,cZ=GG.vec;GG.vecU8;var lZ=({provider:t,from:e,to:n,value:r,method:i,api:o,params:a})=>{if(void 0===o)return t.estimateGas({from:e,to:n,value:r});{let s=new Tw(n,o,t),u=s.estimateGas[i],c=(({contract:t,method:e,params:n})=>{let r=t.interface.fragments.find((t=>t.name==e));return n instanceof Array?n:n instanceof Object?r.inputs.map((t=>n[t.name])):void 0})({contract:s,method:i,params:a});return c?u(...c,{from:e,value:r}):u({from:e,value:r})}};let hZ=["ethereum","bsc","polygon","fantom","velas"];hZ.evm=["ethereum","bsc","polygon","fantom","velas"],hZ.solana=[];class dZ extends WM{constructor(t,e,n){super(t),this._network=e,this._endpoint=t,this._endpoints=n}detectNetwork(){return Promise.resolve(nd(this._network).id)}requestChunk(t,e){const n=t.map((t=>t.request));return Gw(e,JSON.stringify(n)).then((e=>{t.forEach(((t,n)=>{const r=e[n];if(r.error){const e=new Error(r.error.message);e.code=r.error.code,e.data=r.error.data,t.reject(e)}else t.resolve(r.result)}))})).catch((e=>{if(e&&"SERVER_ERROR"==e.code){const e=this._endpoints.indexOf(this._endpoint)+1;this._endpoint=e>=this._endpoints.length?this._endpoints[0]:this._endpoints[e],this.requestChunk(t,this._endpoint)}else t.forEach((t=>{t.reject(e)}))}))}send(t,e){const n={method:t,params:e,id:this._nextId++,jsonrpc:"2.0"};null==this._pendingBatch&&(this._pendingBatch=[]);const r={request:n,resolve:null,reject:null},i=new Promise(((t,e)=>{r.resolve=t,r.reject=e}));return this._pendingBatch.push(r),this._pendingBatchAggregator||(this._pendingBatchAggregator=setTimeout((()=>{const t=this._pendingBatch;this._pendingBatch=null,this._pendingBatchAggregator=null;const e=[];for(let n=0;n<Math.ceil(t.length/99);n++)e[n]=t.slice(99*n,99*(n+1));e.forEach((t=>(t.map((t=>t.request)),this.requestChunk(t,this._endpoint))))}),10)),i}}let fZ=()=>"object"==typeof wh?wh:window;const pZ={ethereum:["https://rpc.ankr.com/eth","https://eth.llamarpc.com","https://ethereum.publicnode.com"],bsc:["https://bsc-dataseed.binance.org","https://bsc-dataseed1.ninicoin.io","https://bsc-dataseed3.defibit.io"],polygon:["https://polygon-rpc.com","https://poly-rpc.gateway.pokt.network","https://matic-mainnet.chainstacklabs.com"],fantom:["https://fantom.blockpi.network/v1/rpc/public","https://rpcapi.fantom.network","https://rpc.ftm.tools"],velas:["https://mainnet.velas.com/rpc","https://evmexplorer.velas.com/rpc","https://explorer.velas.com/rpc"]},mZ=()=>(null==fZ()._clientProviders&&(fZ()._clientProviders={}),fZ()._clientProviders),gZ=(t,e)=>{mZ()[t]=e},yZ=async(t,e)=>{let n,r=fZ();if(null==r.fetch||void 0!==Hh&&Hh.env&&"test"==Hh.env.NODE_ENV||void 0!==r.cy)n=e[0];else{let t=await Promise.all(e.map((t=>new Promise((async e=>{let n=(new Date).getTime();setTimeout((()=>e(900)),900);if(!(await fetch(t,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({method:"net_version",id:1,jsonrpc:"2.0"})})).ok)return e(999);let r=(new Date).getTime();e(r-n)})))));const r=Math.min(...t);n=e[t.indexOf(r)]}gZ(t,new dZ(n,t,e))};var bZ=async t=>{let e=mZ();if(e&&e[t])return e[t];let n=fZ();return n._getProviderPromise&&n._getProviderPromise[t]||(n._getProviderPromise||(n._getProviderPromise={}),n._getProviderPromise[t]=new Promise((async e=>{await yZ(t,pZ[t]),e(fZ()._clientProviders[t])}))),await n._getProviderPromise[t]},vZ=yZ;let wZ=()=>(null==fZ()._cacheStore&&_Z(),fZ()._cacheStore),MZ=()=>(null==fZ()._promiseStore&&_Z(),fZ()._promiseStore),_Z=()=>{fZ()._cacheStore={},fZ()._promiseStore={},fZ()._clientProviders={}},EZ=function({key:t}){MZ()[t]=void 0},NZ=function({call:t,key:e,expires:n=0}){return new Promise(((r,i)=>{let o,a=function({key:t}){return MZ()[t]}({key:e=JSON.stringify(e)});if(a)return a.then(r).catch(i);(function({key:t,promise:e}){return MZ()[t]=e,e})({key:e,promise:new Promise(((a,s)=>0===n?t().then((t=>{r(t),a(t)})).catch((t=>{i(t),s(t)})):(o=function({key:t,expires:e}){let n=wZ()[t];if(function(t){let e,n=t[0],r=1;for(;r<t.length;){const i=t[r],o=t[r+1];if(r+=2,("optionalAccess"===i||"optionalCall"===i)&&null==n)return;"access"===i||"optionalAccess"===i?(e=n,n=o(n)):"call"!==i&&"optionalCall"!==i||(n=o(((...t)=>n.call(e,...t))),e=void 0)}return n}([n,"optionalAccess",t=>t.expiresAt])>Date.now())return n.value}({key:e,expires:n}),o?(r(o),a(o),o):void t().then((t=>{t&&function({key:t,value:e,expires:n}){wZ()[t]={expiresAt:Date.now()+n,value:e}}({key:e,value:t,expires:n}),r(t),a(t)})).catch((t=>{i(t),s(t)})))))}).then((()=>{EZ({key:e})})).catch((()=>{EZ({key:e})}))}))},LZ=async function({blockchain:t,from:e,to:n,value:r,method:i,api:o,params:a,cache:s}){if(!hZ.includes(t))throw"Unknown blockchain: "+t;void 0===r&&(r="0");const u=await(async t=>{if(hZ.evm.includes(t))return await bZ(t);throw"Unknown blockchain: "+t})(t);return await NZ({expires:s||0,key:[t,e,n,r,i,a],call:async()=>lZ({provider:u,from:e,to:n,value:r,method:i,api:o,params:a})})};let SZ=({address:t,api:e,method:n,params:r,provider:i,block:o})=>{let a=new Tw(t,e,i),s=(({contract:t,method:e,params:n})=>t.interface.fragments.find((t=>t.name==e)).inputs.map(((t,e)=>Array.isArray(n)?n[e]:n[t.name])))({contract:a,method:n,params:r});return a[n](...s,{blockTag:o})};class AZ extends DH{constructor(t,e,n){super(t),this._network=e,this._endpoint=t,this._endpoints=n}}const xZ={solana:["https://solana-mainnet.phantom.app/YBPpkkN4g91xDiAnTE9r0RcMkjg0sKUIWvAfoFVJ","https://mainnet-beta.solflare.network","https://us-solana1.twnodes.com"]},TZ=()=>(null==fZ()._clientProviders&&(fZ()._clientProviders={}),fZ()._clientProviders),IZ=(t,e)=>{TZ()[t]=e},kZ=async(t,e)=>{let n,r=fZ();if(null==r.fetch||void 0!==Hh&&Hh.env&&"test"==Hh.env.NODE_ENV||void 0!==r.cy)n=e[0];else{let t=await Promise.all(e.map((t=>new Promise((async e=>{let n=(new Date).getTime();setTimeout((()=>e(900)),900);if(!(await fetch(t,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({method:"getIdentity",id:1,jsonrpc:"2.0"})})).ok)return e(999);let r=(new Date).getTime();e(r-n)})))));const r=Math.min(...t);n=e[t.indexOf(r)]}IZ(t,new AZ(n,t,e))};var jZ=async t=>{let e=TZ();if(e&&e[t])return e[t];let n=fZ();return n._getProviderPromise&&n._getProviderPromise[t]||(n._getProviderPromise||(n._getProviderPromise={}),n._getProviderPromise[t]=new Promise((async e=>{await kZ(t,xZ[t]),e(fZ()._clientProviders[t])}))),await n._getProviderPromise[t]},CZ=kZ;var DZ=async({blockchain:t,address:e,api:n,method:r,params:i,block:o})=>{const a=await jZ(t);return null==r||"getAccountInfo"===r?(null==n&&(n=KG),(async({address:t,api:e,method:n,params:r,provider:i,block:o})=>{const a=await i.getAccountInfo(new cY(t));return e.decode(a.data)})({address:e,api:n,method:r,params:i,provider:a,block:o})):"getProgramAccounts"===r?a.getProgramAccounts(new cY(e),i).then((t=>n?t.map((t=>(t.data=n.decode(t.account.data),t))):t)):"getTokenAccountBalance"===r?a.getTokenAccountBalance(new cY(e)):"latestBlockNumber"===r?a.getBlockHeight():"balance"===r?(({address:t,provider:e})=>e.getBalance(new cY(t)))({address:e,provider:a}):void 0};let OZ=["ethereum","bsc","polygon","solana","fantom","velas"];OZ.evm=["ethereum","bsc","polygon","fantom","velas"],OZ.solana=["solana"];let zZ=async function(t,e){let{blockchain:n,address:r,method:i}=(t=>{if("object"==typeof t)return t;let e=t.match(/(?<blockchain>\w+):\/\/(?<part1>[\w\d]+)(\/(?<part2>[\w\d]+)*)?/);return null==e.groups.part2?e.groups.part1.match(/\d/)?{blockchain:e.groups.blockchain,address:e.groups.part1}:{blockchain:e.groups.blockchain,method:e.groups.part1}:{blockchain:e.groups.blockchain,address:e.groups.part1,method:e.groups.part2}})(t),{api:o,params:a,cache:s,block:u}=("object"==typeof t?t:e)||{};return await NZ({expires:s||0,key:[n,r,i,a,u],call:async()=>{if(OZ.evm.includes(n))return(async({blockchain:t,address:e,api:n,method:r,params:i,block:o})=>{const a=await bZ(t);return n?SZ({address:e,api:n,method:r,params:i,provider:a,block:o}):"latestBlockNumber"===r?a.getBlockNumber():"balance"===r?(({address:t,provider:e})=>e.getBalance(t))({address:e,provider:a}):"transactionCount"===r?(({address:t,provider:e})=>e.getTransactionCount(t))({address:e,provider:a}):void 0})({blockchain:n,address:r,api:o,method:i,params:a,block:u});if(OZ.solana.includes(n))return DZ({blockchain:n,address:r,api:o,method:i,params:a,block:u});throw"Unknown blockchain: "+n}})};const PZ=async t=>{if(OZ.evm.includes(t))return await bZ(t);if(OZ.solana.includes(t))return await jZ(t);throw"Unknown blockchain: "+t};let RZ={ethereum:{ZERO:"0x0000000000000000000000000000000000000000",MAXINT:"115792089237316195423570985008687907853269984665640564039457584007913129639935",WRAPPED:"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",NATIVE:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",DECIMALS:18,SYMBOL:"ETH",CURRENCY:"Ether",NAME:"Ethereum",USD:"0x6B175474E89094C44Da98b954EedeAC495271d0F",USD_DECIMALS:18},bsc:{ZERO:"0x0000000000000000000000000000000000000000",MAXINT:"115792089237316195423570985008687907853269984665640564039457584007913129639935",WRAPPED:"0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",NATIVE:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",DECIMALS:18,SYMBOL:"BNB",CURRENCY:"BNB",NAME:"BNB Smart Chain",USD:"0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56",USD_DECIMALS:18},polygon:{ZERO:"0x0000000000000000000000000000000000000000",MAXINT:"115792089237316195423570985008687907853269984665640564039457584007913129639935",WRAPPED:"0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",NATIVE:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",DECIMALS:18,SYMBOL:"MATIC",CURRENCY:"Polygon",NAME:"Polygon",USD:"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",USD_DECIMALS:6},solana:{ZERO:"0",MAXINT:"340282366920938463463374607431768211455",WRAPPED:"So11111111111111111111111111111111111111112",NATIVE:"11111111111111111111111111111111",DECIMALS:9,SYMBOL:"SOL",CURRENCY:"Solana",NAME:"Solana",USD:"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",USD_DECIMALS:6},fantom:{ZERO:"0x0000000000000000000000000000000000000000",MAXINT:"115792089237316195423570985008687907853269984665640564039457584007913129639935",WRAPPED:"0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83",NATIVE:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",DECIMALS:18,SYMBOL:"FTM",CURRENCY:"Fantom",NAME:"Fantom",USD:"0x04068da6c83afcfa0e13ba15a6696662335d5b75",USD_DECIMALS:6},velas:{ZERO:"0x0000000000000000000000000000000000000000",MAXINT:"115792089237316195423570985008687907853269984665640564039457584007913129639935",WRAPPED:"0xc579D1f3CF86749E05CD06f7ADe17856c2CE3126",NATIVE:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",DECIMALS:18,SYMBOL:"VLX",CURRENCY:"Velas",NAME:"Velas",USD:"0xc111c29A988AE0C0087D97b33C6E6766808A3BD3",USD_DECIMALS:18}};var BZ=function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=92)}([function(t,e,n){(function(t){n.d(e,"f",(function(){return s})),n.d(e,"g",(function(){return u})),n.d(e,"i",(function(){return c})),n.d(e,"h",(function(){return l})),n.d(e,"b",(function(){return h})),n.d(e,"c",(function(){return d})),n.d(e,"e",(function(){return f})),n.d(e,"d",(function(){return p})),n.d(e,"o",(function(){return m})),n.d(e,"n",(function(){return g})),n.d(e,"p",(function(){return y})),n.d(e,"A",(function(){return b})),n.d(e,"z",(function(){return v})),n.d(e,"B",(function(){return w})),n.d(e,"v",(function(){return M})),n.d(e,"u",(function(){return _})),n.d(e,"s",(function(){return L})),n.d(e,"r",(function(){return S})),n.d(e,"t",(function(){return A})),n.d(e,"q",(function(){return x})),n.d(e,"m",(function(){return T})),n.d(e,"l",(function(){return I})),n.d(e,"k",(function(){return k})),n.d(e,"j",(function(){return j})),n.d(e,"x",(function(){return D})),n.d(e,"a",(function(){return O})),n.d(e,"y",(function(){return z})),n.d(e,"w",(function(){return P}));var r=n(22),i=n.n(r),o=n(49),a=n.n(o);function s(t){return new Uint8Array(t)}function u(t,e=!1){const n=t.toString("hex");return e?O(n):n}function c(t){return t.toString("utf8")}function l(t){return t.readUIntBE(0,t.length)}function h(t){return a()(t)}function d(t,e=!1){return u(h(t),e)}function f(t){return c(h(t))}function p(t){return l(h(t))}function m(e){return t.from(D(e),"hex")}function g(t){return s(m(t))}function y(t){return c(m(t))}function b(e){return t.from(e,"utf8")}function v(t){return s(b(t))}function w(t,e=!1){return u(b(t),e)}function M(t){return h(N(E(t)))}function _(t){return N(E(t))}function E(t){return C((t>>>0).toString(2))}function N(t){return new Uint8Array(function(t,e=8){const n=C(t).match(new RegExp(`.{${e}}`,"gi"));return Array.from(n||[])}(t).map((t=>parseInt(t,2))))}function L(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}function S(e){return t.isBuffer(e)}function A(t){return i.a.strict(t)&&!S(t)}function x(t){return!A(t)&&!S(t)&&void 0!==t.byteLength}function T(t){return S(t)?"buffer":A(t)?"typed-array":x(t)?"array-buffer":Array.isArray(t)?"array":typeof t}function I(t){return function(t){return!("string"!=typeof t||!new RegExp(/^[01]+$/).test(t))&&t.length%8==0}(t)?"binary":L(t)?"hex":"utf8"}function k(...e){return t.concat(e)}function j(...t){let e=[];return t.forEach((t=>e=e.concat(Array.from(t)))),new Uint8Array([...e])}function C(t,e=8,n="0"){return function(t,e,n="0"){return function(t,e,n,r="0"){const i=e-t.length;let o=t;if(i>0){const e=r.repeat(i);o=n?e+t:t+e}return o}(t,e,!0,n)}(t,function(t,e=8){const n=t%e;return n?(t-n)/e*e+e:t}(t.length,e),n)}function D(t){return t.replace(/^0x/,"")}function O(t){return t.startsWith("0x")?t:"0x"+t}function z(t){return(t=C(t=D(t),2))&&(t=O(t)),t}function P(t){const e=t.startsWith("0x");return t=(t=D(t)).startsWith("0")?t.substring(1):t,e?O(t):t}}).call(this,n(18).Buffer)},function(t,e,n){n.d(e,"g",(function(){return r.detectEnv})),n.d(e,"r",(function(){return r.isMobile})),n.d(e,"m",(function(){return r.isBrowser})),n.d(e,"k",(function(){return r.getLocation})),n.d(e,"i",(function(){return r.getClientMeta})),n.d(e,"B",(function(){return r.setLocal})),n.d(e,"j",(function(){return r.getLocal})),n.d(e,"A",(function(){return r.removeLocal})),n.d(e,"v",(function(){return r.mobileLinkChoiceKey})),n.d(e,"C",(function(){return o})),n.d(e,"b",(function(){return c})),n.d(e,"c",(function(){return l})),n.d(e,"d",(function(){return h})),n.d(e,"e",(function(){return d})),n.d(e,"f",(function(){return f})),n.d(e,"w",(function(){return L})),n.d(e,"x",(function(){return S})),n.d(e,"z",(function(){return g})),n.d(e,"D",(function(){return y})),n.d(e,"h",(function(){return A})),n.d(e,"u",(function(){return j})),n.d(e,"y",(function(){return C})),n.d(e,"l",(function(){return T})),n.d(e,"a",(function(){return I})),n.d(e,"o",(function(){return v})),n.d(e,"q",(function(){return w})),n.d(e,"p",(function(){return M})),n.d(e,"n",(function(){return _})),n.d(e,"s",(function(){return E})),n.d(e,"t",(function(){return N}));var r=n(21);const i=["session_request","session_update","exchange_key","connect","disconnect","display_uri","modal_closed","transport_open","transport_close","transport_error"],o=["eth_sendTransaction","eth_signTransaction","eth_sign","eth_signTypedData","eth_signTypedData_v1","eth_signTypedData_v2","eth_signTypedData_v3","eth_signTypedData_v4","personal_sign","wallet_addEthereumChain","wallet_switchEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode"];var a=n(16),s=n.n(a),u=n(0);function c(t){return u.b(new Uint8Array(t))}function l(t,e){return u.c(new Uint8Array(t),!e)}function h(t){return u.f(t).buffer}function d(t){return u.n(t).buffer}function f(t,e){const n=u.x(u.y(new s.a(t).toString(16)));return e?n:u.a(n)}var p=n(50);function m(t){return u.y(t)}const g=n(51).payloadId;function y(){return((t,e)=>{for(e=t="";t++<36;e+=51*t&52?(15^t?8^Math.random()*(20^t?16:4):4).toString(16):"-");return e})()}function b(t,e){return u.s(t,e)}function v(t){return void 0!==t.method}function w(t){return void 0!==t.result}function M(t){return void 0!==t.error}function _(t){return void 0!==t.event}function E(t){return i.includes(t)||t.startsWith("wc_")}function N(t){return!!t.method.startsWith("wc_")||!o.includes(t.method)}function L(t){var e,n;return(n=t)&&n.length&&!b(t[0])&&(t[0]=(e=t[0],u.B(e,!0))),t}function S(t){if(void 0!==t.type&&"0"!==t.type)return t;if(void 0===t.from||!(e=t.from)||"0x"!==e.toLowerCase().substring(0,2)||!/^(0x)?[0-9a-f]{40}$/i.test(e)||!/^(0x)?[0-9a-f]{40}$/.test(e)&&!/^(0x)?[0-9A-F]{40}$/.test(e)&&e!==function(t){t=Object(u.x)(t.toLowerCase());const e=Object(u.x)(Object(p.keccak_256)((n=t,u.A(n))));var n;let r="";for(let n=0;n<t.length;n++)parseInt(e[n],16)>7?r+=t[n].toUpperCase():r+=t[n];return Object(u.a)(r)}(e))throw new Error("Transaction object must include a valid 'from' value.");var e;function n(t){let e=t;var n;return("number"==typeof t||"string"==typeof t&&!function(t){return""===t||"string"==typeof t&&""===t.trim()}(t))&&(b(t)?"string"==typeof t&&(e=m(t)):e=f(t)),"string"==typeof e&&(n=e,e=u.w(u.a(n))),e}const r={from:m(t.from),to:void 0===t.to?void 0:m(t.to),gasPrice:void 0===t.gasPrice?"":n(t.gasPrice),gas:void 0===t.gas?void 0===t.gasLimit?"":n(t.gasLimit):n(t.gas),value:void 0===t.value?"":n(t.value),nonce:void 0===t.nonce?"":n(t.nonce),data:void 0===t.data?"":m(t.data)||"0x"},i=["gasPrice","gas","value","nonce"];return Object.keys(r).forEach((t=>{(void 0===r[t]||"string"==typeof r[t]&&!r[t].trim().length)&&i.includes(t)&&delete r[t]})),r}function A(t){const e=t.message||"Failed or Rejected Request";let n=-32e3;if(t&&!t.code)switch(e){case"Parse error":n=-32700;break;case"Invalid request":n=-32600;break;case"Method not found":n=-32601;break;case"Invalid params":n=-32602;break;case"Internal error":n=-32603;break;default:n=-32e3}const r={code:n,message:e};return t.data&&(r.data=t.data),r}var x=n(23);function T(t){const e=-1!==t.indexOf("?")?t.indexOf("?"):void 0;return void 0!==e?t.substr(e):""}function I(t,e){let n=k(t);return n=Object.assign(Object.assign({},n),e),function(t){return x.stringify(t)}(n)}function k(t){return x.parse(t)}function j(t){return void 0!==t.bridge}function C(t){const e=t.indexOf(":"),n=-1!==t.indexOf("?")?t.indexOf("?"):void 0,r=t.substring(0,e),i=function(t){const e=t.split("@");return{handshakeTopic:e[0],version:parseInt(e[1],10)}}(t.substring(e+1,n)),o=function(t){const e=k(t);return{key:e.key||"",bridge:e.bridge||""}}(void 0!==n?t.substr(n):"");return Object.assign(Object.assign({protocol:r},i),o)}},function(t,e,n){n.d(e,"b",(function(){return i})),n.d(e,"g",(function(){return o})),n.d(e,"a",(function(){return a})),n.d(e,"f",(function(){return s})),n.d(e,"e",(function(){return u})),n.d(e,"i",(function(){return c})),n.d(e,"j",(function(){return l})),n.d(e,"h",(function(){return r})),n.d(e,"d",(function(){return h})),n.d(e,"c",(function(){return d})),n.d(e,"k",(function(){return f})),n.d(e,"l",(function(){return p}));const r=512,i=256,o=256,a="AES-CBC",s="SHA-"+i,u="HMAC",c="SHA-256",l="SHA-512",h="encrypt",d="decrypt",f="sign",p="verify"},function(t,e,n){n.d(e,"b",(function(){return r})),n.d(e,"d",(function(){return i})),n.d(e,"c",(function(){return o})),n.d(e,"e",(function(){return a})),n.d(e,"f",(function(){return s})),n.d(e,"a",(function(){return u}));const r="INTERNAL_ERROR",i="SERVER_ERROR",o=[-32700,-32600,-32601,-32602,-32603],a=[-32e3,-32099],s={PARSE_ERROR:{code:-32700,message:"Parse error"},INVALID_REQUEST:{code:-32600,message:"Invalid Request"},METHOD_NOT_FOUND:{code:-32601,message:"Method not found"},INVALID_PARAMS:{code:-32602,message:"Invalid params"},[r]:{code:-32603,message:"Internal error"},[i]:{code:-32e3,message:"Server error"}},u=i},function(t,e,n){function r(t){let e;return"undefined"!=typeof window&&void 0!==window[t]&&(e=window[t]),e}function i(t){const e=r(t);if(!e)throw new Error(t+" is not defined in Window");return e}Object.defineProperty(e,"__esModule",{value:!0}),e.getLocalStorage=e.getLocalStorageOrThrow=e.getCrypto=e.getCryptoOrThrow=e.getLocation=e.getLocationOrThrow=e.getNavigator=e.getNavigatorOrThrow=e.getDocument=e.getDocumentOrThrow=e.getFromWindowOrThrow=e.getFromWindow=void 0,e.getFromWindow=r,e.getFromWindowOrThrow=i,e.getDocumentOrThrow=function(){return i("document")},e.getDocument=function(){return r("document")},e.getNavigatorOrThrow=function(){return i("navigator")},e.getNavigator=function(){return r("navigator")},e.getLocationOrThrow=function(){return i("location")},e.getLocation=function(){return r("location")},e.getCryptoOrThrow=function(){return i("crypto")},e.getCrypto=function(){return r("crypto")},e.getLocalStorageOrThrow=function(){return i("localStorage")},e.getLocalStorage=function(){return r("localStorage")}},function(t,e,n){var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||e.hasOwnProperty(n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(67),e),i(n(68),e)},function(t,e,n){n.d(e,"b",(function(){return a})),n.d(e,"a",(function(){return s})),n.d(e,"c",(function(){return u})),n.d(e,"d",(function(){return c})),n.d(e,"e",(function(){return l})),n.d(e,"f",(function(){return h}));var r=n(5),i=n(2);async function o(t,e=i.a){return r.getSubtleCrypto().importKey("raw",t,function(t){return t===i.a?{length:i.b,name:i.a}:{hash:{name:i.f},name:i.e}}(e),!0,function(t){return t===i.a?[i.d,i.c]:[i.k,i.l]}(e))}async function a(t,e,n){const a=r.getSubtleCrypto(),s=await o(e,i.a),u=await a.encrypt({iv:t,name:i.a},s,n);return new Uint8Array(u)}async function s(t,e,n){const a=r.getSubtleCrypto(),s=await o(e,i.a),u=await a.decrypt({iv:t,name:i.a},s,n);return new Uint8Array(u)}async function u(t,e){const n=r.getSubtleCrypto(),a=await o(t,i.e),s=await n.sign({length:i.g,name:i.e},a,e);return new Uint8Array(s)}async function c(t,e){const n=r.getSubtleCrypto(),a=await o(t,i.e),s=await n.sign({length:i.h,name:i.e},a,e);return new Uint8Array(s)}async function l(t){const e=r.getSubtleCrypto(),n=await e.digest({name:i.i},t);return new Uint8Array(n)}async function h(t){const e=r.getSubtleCrypto(),n=await e.digest({name:i.j},t);return new Uint8Array(n)}},function(t,e){var n,r=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(t){if(!t)throw new Error('"version" cannot be null or undefined');if(t<1||t>40)throw new Error('"version" should be in range from 1 to 40');return 4*t+17},e.getSymbolTotalCodewords=function(t){return r[t]},e.getBCHDigit=function(t){for(var e=0;0!==t;)e++,t>>>=1;return e},e.setToSJISFunction=function(t){if("function"!=typeof t)throw new Error('"toSJISFunc" is not a valid function.');n=t},e.isKanjiModeEnabled=function(){return void 0!==n},e.toSJIS=function(t){return n(t)}},function(t,e,n){var r=n(44),i=n(45);e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(t,e){if(!t.ccBits)throw new Error("Invalid mode: "+t);if(!r.isValid(e))throw new Error("Invalid version: "+e);return e>=1&&e<10?t.ccBits[0]:e<27?t.ccBits[1]:t.ccBits[2]},e.getBestModeForData=function(t){return i.testNumeric(t)?e.NUMERIC:i.testAlphanumeric(t)?e.ALPHANUMERIC:i.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(t){if(t&&t.id)return t.id;throw new Error("Invalid mode")},e.isValid=function(t){return t&&t.bit&&t.ccBits},e.from=function(t,n){if(e.isValid(t))return t;try{return function(t){if("string"!=typeof t)throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+t)}}(t)}catch(t){return n}}},function(t,e,n){n.d(e,"c",(function(){return i})),n.d(e,"a",(function(){return o})),n.d(e,"b",(function(){return a}));var r=n(3);function i(t){return r.c.includes(t)}function o(t){return Object.keys(r.f).includes(t)?r.f[t]:r.f[r.a]}function a(t){return Object.values(r.f).find((e=>e.code===t))||r.f[r.a]}},function(t,e,n){var r=n(19);o.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()}catch(t){return!1}}();var i=o.TYPED_ARRAY_SUPPORT?2147483647:1073741823;function o(t,e,n){return o.TYPED_ARRAY_SUPPORT||this instanceof o?"number"==typeof t?u(this,t):function(t,e,n,r){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,n,r){if(n<0||e.byteLength<n)throw new RangeError("'offset' is out of bounds");if(e.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");var i;return i=void 0===n&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,n):new Uint8Array(e,n,r),o.TYPED_ARRAY_SUPPORT?i.__proto__=o.prototype:i=c(t,i),i}(t,e,n,r):"string"==typeof e?function(t,e){var n=0|h(e),r=s(t,n),i=r.write(e);return i!==n&&(r=r.slice(0,i)),r}(t,e):function(t,e){if(o.isBuffer(e)){var n=0|a(e.length),r=s(t,n);return 0===r.length||e.copy(r,0,0,n),r}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(i=e.length)!=i?s(t,0):c(t,e);if("Buffer"===e.type&&Array.isArray(e.data))return c(t,e.data)}var i;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}(this,t,e,n):new o(t,e,n)}function a(t){if(t>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|t}function s(t,e){var n;return o.TYPED_ARRAY_SUPPORT?(n=new Uint8Array(e)).__proto__=o.prototype:(null===(n=t)&&(n=new o(e)),n.length=e),n}function u(t,e){var n=s(t,e<0?0:0|a(e));if(!o.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)n[r]=0;return n}function c(t,e){for(var n=e.length<0?0:0|a(e.length),r=s(t,n),i=0;i<n;i+=1)r[i]=255&e[i];return r}function l(t,e){var n;e=e||1/0;for(var r=t.length,i=null,o=[],a=0;a<r;++a){if((n=t.charCodeAt(a))>55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function h(t){return o.isBuffer(t)?t.length:"undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer)?t.byteLength:("string"!=typeof t&&(t=""+t),0===t.length?0:l(t).length)}o.TYPED_ARRAY_SUPPORT&&(o.prototype.__proto__=Uint8Array.prototype,o.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&o[Symbol.species]===o&&Object.defineProperty(o,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1})),o.prototype.write=function(t,e,n){void 0===e||void 0===n&&"string"==typeof e?(n=this.length,e=0):isFinite(e)&&(e|=0,isFinite(n)?n|=0:n=void 0);var r=this.length-e;if((void 0===n||n>r)&&(n=r),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");return function(t,e,n,r){return function(t,e,n,r){for(var i=0;i<r&&!(i+n>=e.length||i>=t.length);++i)e[i+n]=t[i];return i}(l(e,t.length-n),t,n,r)}(this,t,e,n)},o.prototype.slice=function(t,e){var n,r=this.length;if((t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t),o.TYPED_ARRAY_SUPPORT)(n=this.subarray(t,e)).__proto__=o.prototype;else{var i=e-t;n=new o(i,void 0);for(var a=0;a<i;++a)n[a]=this[a+t]}return n},o.prototype.copy=function(t,e,n,r){if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);var i,a=r-n;if(this===t&&n<e&&e<r)for(i=a-1;i>=0;--i)t[i+e]=this[i+n];else if(a<1e3||!o.TYPED_ARRAY_SUPPORT)for(i=0;i<a;++i)t[i+e]=this[i+n];else Uint8Array.prototype.set.call(t,this.subarray(n,n+a),e);return a},o.prototype.fill=function(t,e,n){if("string"==typeof t){if("string"==typeof e?(e=0,n=this.length):"string"==typeof n&&(n=this.length),1===t.length){var r=t.charCodeAt(0);r<256&&(t=r)}}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;var i;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(i=e;i<n;++i)this[i]=t;else{var a=o.isBuffer(t)?t:new o(t),s=a.length;for(i=0;i<n-e;++i)this[i+e]=a[i%s]}return this},o.concat=function(t,e){if(!r(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return s(null,0);var n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var i=u(null,e),a=0;for(n=0;n<t.length;++n){var c=t[n];if(!o.isBuffer(c))throw new TypeError('"list" argument must be an Array of Buffers');c.copy(i,a),a+=c.length}return i},o.byteLength=h,o.prototype._isBuffer=!0,o.isBuffer=function(t){return!(null==t||!t._isBuffer)},t.exports.alloc=function(t){var e=new o(t);return e.fill(0),e},t.exports.from=function(t){return new o(t)}},function(t,e,n){var r=n(34);n.d(e,"randomBytes",(function(){return r.a}));var i=n(35);n.d(e,"aesCbcDecrypt",(function(){return i.a})),n.d(e,"aesCbcEncrypt",(function(){return i.b}));var o=n(36);n.d(e,"hmacSha256Sign",(function(){return o.a})),n(41),n(15),n(2)},function(t,e){var n,r,i=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(t){if(n===setTimeout)return setTimeout(t,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(t){n=o}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(t){r=a}}();var u,c=[],l=!1,h=-1;function d(){l&&u&&(l=!1,u.length?c=u.concat(c):h=-1,c.length&&f())}function f(){if(!l){var t=s(d);l=!0;for(var e=c.length;e;){for(u=c,c=[];++h<e;)u&&u[h].run();h=-1,e=c.length}u=null,l=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===a||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function m(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];c.push(new p(t,e)),1!==c.length||l||s(f)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=m,i.addListener=m,i.once=m,i.off=m,i.removeListener=m,i.removeAllListeners=m,i.emit=m,i.prependListener=m,i.prependOnceListener=m,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){n.d(e,"a",(function(){return r}));class r{}},function(t,e,n){var r=n(37);n.o(r,"isConstantTime")&&n.d(e,"isConstantTime",(function(){return r.isConstantTime})),n(38);var i=n(39);n.o(i,"isConstantTime")&&n.d(e,"isConstantTime",(function(){return i.isConstantTime}));var o=n(40);n.d(e,"isConstantTime",(function(){return o.a}))},function(t,e,n){(function(t){!function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}function o(t,e,n){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(n=e,e=10),this._init(t||0,e||10,n||"be"))}var a;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{a=n(55).Buffer}catch(t){}function s(t,e,n){for(var r=0,i=Math.min(t.length,n),o=e;o<i;o++){var a=t.charCodeAt(o)-48;r<<=4,r|=a>=49&&a<=54?a-49+10:a>=17&&a<=22?a-17+10:15&a}return r}function u(t,e,n,r){for(var i=0,o=Math.min(t.length,n),a=e;a<o;a++){var s=t.charCodeAt(a)-48;i*=r,i+=s>=49?s-49+10:s>=17?s-17+10:s}return i}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,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&i++,16===e?this._parseHex(t,i):this._parseBase(t,e,i),"-"===t[0]&&(this.negative=1),this.strip(),"le"===n&&this._initArray(this.toArray(),e,n)},o.prototype._initNumber=function(t,e,n){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),e,n)},o.prototype._initArray=function(t,e,n){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,a,s=0;if("be"===n)for(i=t.length-1,o=0;i>=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===n)for(i=0,o=0;i<t.length;i+=3)a=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e){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 r,i,o=0;for(n=t.length-6,r=0;n>=e;n-=6)i=s(t,n,n+6),this.words[r]|=i<<o&67108863,this.words[r+1]|=i>>>26-o&4194303,(o+=24)>=26&&(o-=26,r++);n+6!==e&&(i=s(t,e,n+6),this.words[r]|=i<<o&67108863,this.words[r+1]|=i>>>26-o&4194303),this.strip()},o.prototype._parseBase=function(t,e,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=e)r++;r--,i=i/e|0;for(var o=t.length-n,a=o%r,s=Math.min(o,o-a)+n,c=0,l=n;l<s;l+=r)c=u(t,l,l+r,e),this.imuln(i),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==a){var h=1;for(c=u(t,l,t.length,e),l=0;l<a;l++)h*=e;this.imuln(h),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}},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.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},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var c=["","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"],l=[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],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(t,e,n){n.negative=e.negative^t.negative;var r=t.length+e.length|0;n.length=r,r=r-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,u=a/67108864|0;n.words[0]=s;for(var c=1;c<r;c++){for(var l=u>>>26,h=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;l+=(a=(i=0|t.words[p])*(o=0|e.words[f])+h)/67108864|0,h=67108863&a}n.words[c]=0|h,u=0|l}return 0!==u?n.words[c]=0|u:n.length--,n.strip()}o.prototype.toString=function(t,e){var n;if(e=0|e||1,16===(t=t||10)||"hex"===t){n="";for(var i=0,o=0,a=0;a<this.length;a++){var s=this.words[a],u=(16777215&(s<<i|o)).toString(16);n=0!=(o=s>>>24-i&16777215)||a!==this.length-1?c[6-u.length]+u+n:u+n,(i+=2)>=26&&(i-=26,a--)}for(0!==o&&(n=o.toString(16)+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var d=l[t],f=h[t];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(f).toString(t);n=(p=p.idivn(f)).isZero()?m+n:c[d-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!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&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return r(void 0!==a),this.toArrayLike(a,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,n){var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var a,s,u="le"===e,c=new t(o),l=this.clone();if(u){for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),c[s]=a;for(;s<o;s++)c[s]=0}else{for(s=0;s<o-i;s++)c[s]=0;for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),c[o-s-1]=a}return c},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,n=0;return e>=4096&&(n+=13,e>>>=13),e>=64&&(n+=7,e>>>=7),e>=8&&(n+=4,e>>>=4),e>=2&&(n+=2,e>>>=2),n+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,n=0;return 0==(8191&e)&&(n+=13,e>>>=13),0==(127&e)&&(n+=7,e>>>=7),0==(15&e)&&(n+=4,e>>>=4),0==(3&e)&&(n+=2,e>>>=2),0==(1&e)&&n++,n},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 n=this._zeroBits(this.words[e]);if(t+=n,26!==n)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 r(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 n=0;n<e.length;n++)this.words[n]=this.words[n]&t.words[n];return this.length=e.length,this.strip()},o.prototype.iand=function(t){return r(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,n;this.length>t.length?(e=this,n=t):(e=t,n=this);for(var r=0;r<n.length;r++)this.words[r]=e.words[r]^n.words[r];if(this!==e)for(;r<e.length;r++)this.words[r]=e.words[r];return this.length=e.length,this.strip()},o.prototype.ixor=function(t){return r(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){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),n=t%26;this._expand(e),n>0&&e--;for(var i=0;i<e;i++)this.words[i]=67108863&~this.words[i];return n>0&&(this.words[i]=~this.words[i]&67108863>>26-n),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var n=t/26|0,i=t%26;return this._expand(n+1),this.words[n]=e?this.words[n]|1<<i:this.words[n]&~(1<<i),this.strip()},o.prototype.iadd=function(t){var e,n,r;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?(n=this,r=t):(n=t,r=this);for(var i=0,o=0;o<r.length;o++)e=(0|n.words[o])+(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<n.length;o++)e=(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;o<n.length;o++)this.words[o]=n.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 n,r,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=t):(n=t,r=this);for(var o=0,a=0;a<r.length;a++)o=(e=(0|n.words[a])-(0|r.words[a])+o)>>26,this.words[a]=67108863&e;for(;0!==o&&a<n.length;a++)o=(e=(0|n.words[a])+o)>>26,this.words[a]=67108863&e;if(0===o&&a<n.length&&n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this.length=Math.max(this.length,a),n!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(t){return this.clone().isub(t)};var f=function(t,e,n){var r,i,o,a=t.words,s=e.words,u=n.words,c=0,l=0|a[0],h=8191&l,d=l>>>13,f=0|a[1],p=8191&f,m=f>>>13,g=0|a[2],y=8191&g,b=g>>>13,v=0|a[3],w=8191&v,M=v>>>13,_=0|a[4],E=8191&_,N=_>>>13,L=0|a[5],S=8191&L,A=L>>>13,x=0|a[6],T=8191&x,I=x>>>13,k=0|a[7],j=8191&k,C=k>>>13,D=0|a[8],O=8191&D,z=D>>>13,P=0|a[9],R=8191&P,B=P>>>13,U=0|s[0],F=8191&U,W=U>>>13,Y=0|s[1],Q=8191&Y,H=Y>>>13,G=0|s[2],Z=8191&G,V=G>>>13,q=0|s[3],J=8191&q,K=q>>>13,X=0|s[4],$=8191&X,tt=X>>>13,et=0|s[5],nt=8191&et,rt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ct=st>>>13,lt=0|s[8],ht=8191<,dt=lt>>>13,ft=0|s[9],pt=8191&ft,mt=ft>>>13;n.negative=t.negative^e.negative,n.length=19;var gt=(c+(r=Math.imul(h,F))|0)+((8191&(i=(i=Math.imul(h,W))+Math.imul(d,F)|0))<<13)|0;c=((o=Math.imul(d,W))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(p,F),i=(i=Math.imul(p,W))+Math.imul(m,F)|0,o=Math.imul(m,W);var yt=(c+(r=r+Math.imul(h,Q)|0)|0)+((8191&(i=(i=i+Math.imul(h,H)|0)+Math.imul(d,Q)|0))<<13)|0;c=((o=o+Math.imul(d,H)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,r=Math.imul(y,F),i=(i=Math.imul(y,W))+Math.imul(b,F)|0,o=Math.imul(b,W),r=r+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,H)|0;var bt=(c+(r=r+Math.imul(h,Z)|0)|0)+((8191&(i=(i=i+Math.imul(h,V)|0)+Math.imul(d,Z)|0))<<13)|0;c=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(w,F),i=(i=Math.imul(w,W))+Math.imul(M,F)|0,o=Math.imul(M,W),r=r+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,H)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,H)|0,r=r+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,V)|0;var vt=(c+(r=r+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,K)|0)+Math.imul(d,J)|0))<<13)|0;c=((o=o+Math.imul(d,K)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(E,F),i=(i=Math.imul(E,W))+Math.imul(N,F)|0,o=Math.imul(N,W),r=r+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,H)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,H)|0,r=r+Math.imul(y,Z)|0,i=(i=i+Math.imul(y,V)|0)+Math.imul(b,Z)|0,o=o+Math.imul(b,V)|0,r=r+Math.imul(p,J)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,K)|0;var wt=(c+(r=r+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,tt)|0)+Math.imul(d,$)|0))<<13)|0;c=((o=o+Math.imul(d,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(S,F),i=(i=Math.imul(S,W))+Math.imul(A,F)|0,o=Math.imul(A,W),r=r+Math.imul(E,Q)|0,i=(i=i+Math.imul(E,H)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,H)|0,r=r+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,V)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,V)|0,r=r+Math.imul(y,J)|0,i=(i=i+Math.imul(y,K)|0)+Math.imul(b,J)|0,o=o+Math.imul(b,K)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,tt)|0;var Mt=(c+(r=r+Math.imul(h,nt)|0)|0)+((8191&(i=(i=i+Math.imul(h,rt)|0)+Math.imul(d,nt)|0))<<13)|0;c=((o=o+Math.imul(d,rt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(T,F),i=(i=Math.imul(T,W))+Math.imul(I,F)|0,o=Math.imul(I,W),r=r+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,H)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,H)|0,r=r+Math.imul(E,Z)|0,i=(i=i+Math.imul(E,V)|0)+Math.imul(N,Z)|0,o=o+Math.imul(N,V)|0,r=r+Math.imul(w,J)|0,i=(i=i+Math.imul(w,K)|0)+Math.imul(M,J)|0,o=o+Math.imul(M,K)|0,r=r+Math.imul(y,$)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(b,$)|0,o=o+Math.imul(b,tt)|0,r=r+Math.imul(p,nt)|0,i=(i=i+Math.imul(p,rt)|0)+Math.imul(m,nt)|0,o=o+Math.imul(m,rt)|0;var _t=(c+(r=r+Math.imul(h,ot)|0)|0)+((8191&(i=(i=i+Math.imul(h,at)|0)+Math.imul(d,ot)|0))<<13)|0;c=((o=o+Math.imul(d,at)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,r=Math.imul(j,F),i=(i=Math.imul(j,W))+Math.imul(C,F)|0,o=Math.imul(C,W),r=r+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,H)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,H)|0,r=r+Math.imul(S,Z)|0,i=(i=i+Math.imul(S,V)|0)+Math.imul(A,Z)|0,o=o+Math.imul(A,V)|0,r=r+Math.imul(E,J)|0,i=(i=i+Math.imul(E,K)|0)+Math.imul(N,J)|0,o=o+Math.imul(N,K)|0,r=r+Math.imul(w,$)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,tt)|0,r=r+Math.imul(y,nt)|0,i=(i=i+Math.imul(y,rt)|0)+Math.imul(b,nt)|0,o=o+Math.imul(b,rt)|0,r=r+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,at)|0;var Et=(c+(r=r+Math.imul(h,ut)|0)|0)+((8191&(i=(i=i+Math.imul(h,ct)|0)+Math.imul(d,ut)|0))<<13)|0;c=((o=o+Math.imul(d,ct)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(O,F),i=(i=Math.imul(O,W))+Math.imul(z,F)|0,o=Math.imul(z,W),r=r+Math.imul(j,Q)|0,i=(i=i+Math.imul(j,H)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,H)|0,r=r+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,V)|0)+Math.imul(I,Z)|0,o=o+Math.imul(I,V)|0,r=r+Math.imul(S,J)|0,i=(i=i+Math.imul(S,K)|0)+Math.imul(A,J)|0,o=o+Math.imul(A,K)|0,r=r+Math.imul(E,$)|0,i=(i=i+Math.imul(E,tt)|0)+Math.imul(N,$)|0,o=o+Math.imul(N,tt)|0,r=r+Math.imul(w,nt)|0,i=(i=i+Math.imul(w,rt)|0)+Math.imul(M,nt)|0,o=o+Math.imul(M,rt)|0,r=r+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,at)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,at)|0,r=r+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 Nt=(c+(r=r+Math.imul(h,ht)|0)|0)+((8191&(i=(i=i+Math.imul(h,dt)|0)+Math.imul(d,ht)|0))<<13)|0;c=((o=o+Math.imul(d,dt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,r=Math.imul(R,F),i=(i=Math.imul(R,W))+Math.imul(B,F)|0,o=Math.imul(B,W),r=r+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,H)|0)+Math.imul(z,Q)|0,o=o+Math.imul(z,H)|0,r=r+Math.imul(j,Z)|0,i=(i=i+Math.imul(j,V)|0)+Math.imul(C,Z)|0,o=o+Math.imul(C,V)|0,r=r+Math.imul(T,J)|0,i=(i=i+Math.imul(T,K)|0)+Math.imul(I,J)|0,o=o+Math.imul(I,K)|0,r=r+Math.imul(S,$)|0,i=(i=i+Math.imul(S,tt)|0)+Math.imul(A,$)|0,o=o+Math.imul(A,tt)|0,r=r+Math.imul(E,nt)|0,i=(i=i+Math.imul(E,rt)|0)+Math.imul(N,nt)|0,o=o+Math.imul(N,rt)|0,r=r+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,at)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,at)|0,r=r+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ct)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,ct)|0,r=r+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,dt)|0)+Math.imul(m,ht)|0,o=o+Math.imul(m,dt)|0;var Lt=(c+(r=r+Math.imul(h,pt)|0)|0)+((8191&(i=(i=i+Math.imul(h,mt)|0)+Math.imul(d,pt)|0))<<13)|0;c=((o=o+Math.imul(d,mt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,r=Math.imul(R,Q),i=(i=Math.imul(R,H))+Math.imul(B,Q)|0,o=Math.imul(B,H),r=r+Math.imul(O,Z)|0,i=(i=i+Math.imul(O,V)|0)+Math.imul(z,Z)|0,o=o+Math.imul(z,V)|0,r=r+Math.imul(j,J)|0,i=(i=i+Math.imul(j,K)|0)+Math.imul(C,J)|0,o=o+Math.imul(C,K)|0,r=r+Math.imul(T,$)|0,i=(i=i+Math.imul(T,tt)|0)+Math.imul(I,$)|0,o=o+Math.imul(I,tt)|0,r=r+Math.imul(S,nt)|0,i=(i=i+Math.imul(S,rt)|0)+Math.imul(A,nt)|0,o=o+Math.imul(A,rt)|0,r=r+Math.imul(E,ot)|0,i=(i=i+Math.imul(E,at)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,at)|0,r=r+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,ct)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ct)|0,r=r+Math.imul(y,ht)|0,i=(i=i+Math.imul(y,dt)|0)+Math.imul(b,ht)|0,o=o+Math.imul(b,dt)|0;var St=(c+(r=r+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)+(St>>>26)|0,St&=67108863,r=Math.imul(R,Z),i=(i=Math.imul(R,V))+Math.imul(B,Z)|0,o=Math.imul(B,V),r=r+Math.imul(O,J)|0,i=(i=i+Math.imul(O,K)|0)+Math.imul(z,J)|0,o=o+Math.imul(z,K)|0,r=r+Math.imul(j,$)|0,i=(i=i+Math.imul(j,tt)|0)+Math.imul(C,$)|0,o=o+Math.imul(C,tt)|0,r=r+Math.imul(T,nt)|0,i=(i=i+Math.imul(T,rt)|0)+Math.imul(I,nt)|0,o=o+Math.imul(I,rt)|0,r=r+Math.imul(S,ot)|0,i=(i=i+Math.imul(S,at)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,at)|0,r=r+Math.imul(E,ut)|0,i=(i=i+Math.imul(E,ct)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ct)|0,r=r+Math.imul(w,ht)|0,i=(i=i+Math.imul(w,dt)|0)+Math.imul(M,ht)|0,o=o+Math.imul(M,dt)|0;var At=(c+(r=r+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,mt)|0)+Math.imul(b,pt)|0))<<13)|0;c=((o=o+Math.imul(b,mt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(R,J),i=(i=Math.imul(R,K))+Math.imul(B,J)|0,o=Math.imul(B,K),r=r+Math.imul(O,$)|0,i=(i=i+Math.imul(O,tt)|0)+Math.imul(z,$)|0,o=o+Math.imul(z,tt)|0,r=r+Math.imul(j,nt)|0,i=(i=i+Math.imul(j,rt)|0)+Math.imul(C,nt)|0,o=o+Math.imul(C,rt)|0,r=r+Math.imul(T,ot)|0,i=(i=i+Math.imul(T,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,r=r+Math.imul(S,ut)|0,i=(i=i+Math.imul(S,ct)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,ct)|0,r=r+Math.imul(E,ht)|0,i=(i=i+Math.imul(E,dt)|0)+Math.imul(N,ht)|0,o=o+Math.imul(N,dt)|0;var xt=(c+(r=r+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,mt)|0)+Math.imul(M,pt)|0))<<13)|0;c=((o=o+Math.imul(M,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,r=Math.imul(R,$),i=(i=Math.imul(R,tt))+Math.imul(B,$)|0,o=Math.imul(B,tt),r=r+Math.imul(O,nt)|0,i=(i=i+Math.imul(O,rt)|0)+Math.imul(z,nt)|0,o=o+Math.imul(z,rt)|0,r=r+Math.imul(j,ot)|0,i=(i=i+Math.imul(j,at)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,at)|0,r=r+Math.imul(T,ut)|0,i=(i=i+Math.imul(T,ct)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ct)|0,r=r+Math.imul(S,ht)|0,i=(i=i+Math.imul(S,dt)|0)+Math.imul(A,ht)|0,o=o+Math.imul(A,dt)|0;var Tt=(c+(r=r+Math.imul(E,pt)|0)|0)+((8191&(i=(i=i+Math.imul(E,mt)|0)+Math.imul(N,pt)|0))<<13)|0;c=((o=o+Math.imul(N,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(R,nt),i=(i=Math.imul(R,rt))+Math.imul(B,nt)|0,o=Math.imul(B,rt),r=r+Math.imul(O,ot)|0,i=(i=i+Math.imul(O,at)|0)+Math.imul(z,ot)|0,o=o+Math.imul(z,at)|0,r=r+Math.imul(j,ut)|0,i=(i=i+Math.imul(j,ct)|0)+Math.imul(C,ut)|0,o=o+Math.imul(C,ct)|0,r=r+Math.imul(T,ht)|0,i=(i=i+Math.imul(T,dt)|0)+Math.imul(I,ht)|0,o=o+Math.imul(I,dt)|0;var It=(c+(r=r+Math.imul(S,pt)|0)|0)+((8191&(i=(i=i+Math.imul(S,mt)|0)+Math.imul(A,pt)|0))<<13)|0;c=((o=o+Math.imul(A,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(R,ot),i=(i=Math.imul(R,at))+Math.imul(B,ot)|0,o=Math.imul(B,at),r=r+Math.imul(O,ut)|0,i=(i=i+Math.imul(O,ct)|0)+Math.imul(z,ut)|0,o=o+Math.imul(z,ct)|0,r=r+Math.imul(j,ht)|0,i=(i=i+Math.imul(j,dt)|0)+Math.imul(C,ht)|0,o=o+Math.imul(C,dt)|0;var kt=(c+(r=r+Math.imul(T,pt)|0)|0)+((8191&(i=(i=i+Math.imul(T,mt)|0)+Math.imul(I,pt)|0))<<13)|0;c=((o=o+Math.imul(I,mt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,r=Math.imul(R,ut),i=(i=Math.imul(R,ct))+Math.imul(B,ut)|0,o=Math.imul(B,ct),r=r+Math.imul(O,ht)|0,i=(i=i+Math.imul(O,dt)|0)+Math.imul(z,ht)|0,o=o+Math.imul(z,dt)|0;var jt=(c+(r=r+Math.imul(j,pt)|0)|0)+((8191&(i=(i=i+Math.imul(j,mt)|0)+Math.imul(C,pt)|0))<<13)|0;c=((o=o+Math.imul(C,mt)|0)+(i>>>13)|0)+(jt>>>26)|0,jt&=67108863,r=Math.imul(R,ht),i=(i=Math.imul(R,dt))+Math.imul(B,ht)|0,o=Math.imul(B,dt);var Ct=(c+(r=r+Math.imul(O,pt)|0)|0)+((8191&(i=(i=i+Math.imul(O,mt)|0)+Math.imul(z,pt)|0))<<13)|0;c=((o=o+Math.imul(z,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863;var Dt=(c+(r=Math.imul(R,pt))|0)+((8191&(i=(i=Math.imul(R,mt))+Math.imul(B,pt)|0))<<13)|0;return c=((o=Math.imul(B,mt))+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,u[0]=gt,u[1]=yt,u[2]=bt,u[3]=vt,u[4]=wt,u[5]=Mt,u[6]=_t,u[7]=Et,u[8]=Nt,u[9]=Lt,u[10]=St,u[11]=At,u[12]=xt,u[13]=Tt,u[14]=It,u[15]=kt,u[16]=jt,u[17]=Ct,u[18]=Dt,0!==c&&(u[19]=c,n.length++),n};function p(t,e,n){return(new m).mulp(t,e,n)}function m(t,e){this.x=t,this.y=e}Math.imul||(f=d),o.prototype.mulTo=function(t,e){var n=this.length+t.length;return 10===this.length&&10===t.length?f(this,t,e):n<63?d(this,t,e):n<1024?function(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var r=0,i=0,o=0;o<n.length-1;o++){var a=i;i=0;for(var s=67108863&r,u=Math.min(o,e.length-1),c=Math.max(0,o-t.length+1);c<=u;c++){var l=o-c,h=(0|t.words[l])*(0|e.words[c]),d=67108863&h;s=67108863&(d=d+s|0),i+=(a=(a=a+(h/67108864|0)|0)+(d>>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n.strip()}(this,t,e):p(this,t,e)},m.prototype.makeRBT=function(t){for(var e=new Array(t),n=o.prototype._countBits(t)-1,r=0;r<t;r++)e[r]=this.revBin(r,n,t);return e},m.prototype.revBin=function(t,e,n){if(0===t||t===n-1)return t;for(var r=0,i=0;i<e;i++)r|=(1&t)<<e-i-1,t>>=1;return r},m.prototype.permute=function(t,e,n,r,i,o){for(var a=0;a<o;a++)r[a]=e[t[a]],i[a]=n[t[a]]},m.prototype.transform=function(t,e,n,r,i,o){this.permute(o,t,e,n,r,i);for(var a=1;a<i;a<<=1)for(var s=a<<1,u=Math.cos(2*Math.PI/s),c=Math.sin(2*Math.PI/s),l=0;l<i;l+=s)for(var h=u,d=c,f=0;f<a;f++){var p=n[l+f],m=r[l+f],g=n[l+f+a],y=r[l+f+a],b=h*g-d*y;y=h*y+d*g,g=b,n[l+f]=p+g,r[l+f]=m+y,n[l+f+a]=p-g,r[l+f+a]=m-y,f!==s&&(b=u*h-c*d,d=u*d+c*h,h=b)}},m.prototype.guessLen13b=function(t,e){var n=1|Math.max(e,t),r=1&n,i=0;for(n=n/2|0;n;n>>>=1)i++;return 1<<i+1+r},m.prototype.conjugate=function(t,e,n){if(!(n<=1))for(var r=0;r<n/2;r++){var i=t[r];t[r]=t[n-r-1],t[n-r-1]=i,i=e[r],e[r]=-e[n-r-1],e[n-r-1]=-i}},m.prototype.normalize13b=function(t,e){for(var n=0,r=0;r<e/2;r++){var i=8192*Math.round(t[2*r+1]/e)+Math.round(t[2*r]/e)+n;t[r]=67108863&i,n=i<67108864?0:i/67108864|0}return t},m.prototype.convert13b=function(t,e,n,i){for(var o=0,a=0;a<e;a++)o+=0|t[a],n[2*a]=8191&o,o>>>=13,n[2*a+1]=8191&o,o>>>=13;for(a=2*e;a<i;++a)n[a]=0;r(0===o),r(0==(-8192&o))},m.prototype.stub=function(t){for(var e=new Array(t),n=0;n<t;n++)e[n]=0;return e},m.prototype.mulp=function(t,e,n){var r=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(r),o=this.stub(r),a=new Array(r),s=new Array(r),u=new Array(r),c=new Array(r),l=new Array(r),h=new Array(r),d=n.words;d.length=r,this.convert13b(t.words,t.length,a,r),this.convert13b(e.words,e.length,c,r),this.transform(a,o,s,u,r,i),this.transform(c,o,l,h,r,i);for(var f=0;f<r;f++){var p=s[f]*l[f]-u[f]*h[f];u[f]=s[f]*h[f]+u[f]*l[f],s[f]=p}return this.conjugate(s,u,r),this.transform(s,u,d,o,r,i),this.conjugate(d,o,r),this.normalize13b(d,r),n.negative=t.negative^e.negative,n.length=t.length+e.length,n.strip()},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),p(this,t,e)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.prototype.imuln=function(t){r("number"==typeof t),r(t<67108864);for(var e=0,n=0;n<this.length;n++){var i=(0|this.words[n])*t,o=(67108863&i)+(67108863&e);e>>=26,e+=i/67108864|0,e+=o>>>26,this.words[n]=67108863&o}return 0!==e&&(this.words[n]=e,this.length++),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()),n=0;n<e.length;n++){var r=n/26|0,i=n%26;e[n]=(t.words[r]&1<<i)>>>i}return e}(t);if(0===e.length)return new o(1);for(var n=this,r=0;r<e.length&&0===e[r];r++,n=n.sqr());if(++r<e.length)for(var i=n.sqr();r<e.length;r++,i=i.sqr())0!==e[r]&&(n=n.mul(i));return n},o.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,n=t%26,i=(t-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var a=0;for(e=0;e<this.length;e++){var s=this.words[e]&o,u=(0|this.words[e])-s<<n;this.words[e]=u|a,a=s>>>26-n}a&&(this.words[e]=a,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 r(0===this.negative),this.iushln(t)},o.prototype.iushrn=function(t,e,n){var i;r("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<<o,u=n;if(i-=a,i=Math.max(0,i),u){for(var c=0;c<a;c++)u.words[c]=this.words[c];u.length=a}if(0===a);else if(this.length>a)for(this.length-=a,c=0;c<this.length;c++)this.words[c]=this.words[c+a];else this.words[0]=0,this.length=1;var l=0;for(c=this.length-1;c>=0&&(0!==l||c>=i);c--){var h=0|this.words[c];this.words[c]=l<<26-o|h>>>o,l=h&s}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,n){return r(0===this.negative),this.iushrn(t,e,n)},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){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=1<<e;return!(this.length<=n||!(this.words[n]&i))},o.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==e&&n++,this.length=Math.min(n,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 r("number"==typeof t),r(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},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(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var 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,n){var i,o,a=t.length+n;this._expand(a);var s=0;for(i=0;i<t.length;i++){o=(0|this.words[i+n])+s;var u=(0|t.words[i])*e;s=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+n]=67108863&o}for(;i<this.length-n;i++)s=(o=(0|this.words[i+n])+s)>>26,this.words[i+n]=67108863&o;if(0===s)return this.strip();for(r(-1===s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var n=(this.length,t.length),r=this.clone(),i=t,a=0|i.words[i.length-1];0!=(n=26-this._countBits(a))&&(i=i.ushln(n),r.iushln(n),a=0|i.words[i.length-1]);var s,u=r.length-i.length;if("mod"!==e){(s=new o(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c<s.length;c++)s.words[c]=0}var l=r.clone()._ishlnsubmul(i,1,u);0===l.negative&&(r=l,s&&(s.words[u]=1));for(var h=u-1;h>=0;h--){var d=67108864*(0|r.words[i.length+h])+(0|r.words[i.length+h-1]);for(d=Math.min(d/a|0,67108863),r._ishlnsubmul(i,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(i,1,h),r.isZero()||(r.negative^=1);s&&(s.words[h]=d)}return s&&s.strip(),r.strip(),"div"!==e&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},o.prototype.divmod=function(t,e,n){return r(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(i=s.div.neg()),"div"!==e&&(a=s.mod.neg(),n&&0!==a.negative&&a.iadd(t)),{div:i,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(i=s.div.neg()),{div:i,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),n&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):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.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,a,s},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 n=0!==e.div.negative?e.mod.isub(t):e.mod,r=t.ushrn(1),i=t.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){r(t<=67108863);for(var e=(1<<26)%t,n=0,i=this.length-1;i>=0;i--)n=(e*n+(0|this.words[i]))%t;return n},o.prototype.idivn=function(t){r(t<=67108863);for(var e=0,n=this.length-1;n>=0;n--){var i=(0|this.words[n])+67108864*e;this.words[n]=i/t|0,e=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),a=new o(0),s=new o(0),u=new o(1),c=0;e.isEven()&&n.isEven();)e.iushrn(1),n.iushrn(1),++c;for(var l=n.clone(),h=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()||a.isOdd())&&(i.iadd(l),a.isub(h)),i.iushrn(1),a.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(h)),s.iushrn(1),u.iushrn(1);e.cmp(n)>=0?(e.isub(n),i.isub(s),a.isub(u)):(n.isub(e),s.isub(i),u.isub(a))}return{a:s,b:u,gcd:n.iushln(c)}},o.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,a=new o(1),s=new o(0),u=n.clone();e.cmpn(1)>0&&n.cmpn(1)>0;){for(var c=0,l=1;0==(e.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(e.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var h=0,d=1;0==(n.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(n.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(n)>=0?(e.isub(n),a.isub(s)):(n.isub(e),s.isub(a))}return(i=0===e.cmpn(1)?a:s).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(),n=t.clone();e.negative=0,n.negative=0;for(var r=0;e.isEven()&&n.isEven();r++)e.iushrn(1),n.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=e.cmp(n);if(i<0){var o=e;e=n,n=o}else if(0===i||0===n.cmpn(1))break;e.isub(n)}return n.iushln(r)},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){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<<e;if(this.length<=n)return this._expand(n+1),this.words[n]|=i,this;for(var o=i,a=n;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,n=t<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)e=1;else{n&&(t=-t),r(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,n=this.length-1;n>=0;n--){var r=0|this.words[n],i=0|t.words[n];if(r!==i){r<i?e=-1:r>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 _(t)},o.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return r(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 r(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var g={k256:null,p224:null,p192:null,p25519:null};function y(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 b(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function M(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function _(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function E(t){_.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)}y.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},y.prototype.ireduce=function(t){var e,n=t;do{this.split(n,this.tmp),e=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(e>this.n);var r=e<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):r>0?n.isub(this.p):n.strip(),n},y.prototype.split=function(t,e){t.iushrn(this.n,0,e)},y.prototype.imulK=function(t){return t.imul(this.k)},i(b,y),b.prototype.split=function(t,e){for(var n=Math.min(t.length,9),r=0;r<n;r++)e.words[r]=t.words[r];if(e.length=n,t.length<=9)return t.words[0]=0,void(t.length=1);var i=t.words[9];for(e.words[e.length++]=4194303&i,r=10;r<t.length;r++){var o=0|t.words[r];t.words[r-10]=(4194303&o)<<4|i>>>22,i=o}i>>>=22,t.words[r-10]=i,0===i&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n<t.length;n++){var r=0|t.words[n];e+=977*r,t.words[n]=67108863&e,e=64*r+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(v,y),i(w,y),i(M,y),M.prototype.imulK=function(t){for(var e=0,n=0;n<t.length;n++){var r=19*(0|t.words[n])+e,i=67108863&r;r>>>=26,t.words[n]=i,e=r}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(g[t])return g[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new v;else if("p192"===t)e=new w;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new M}return g[t]=e,e},_.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},_.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},_.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},_.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},_.prototype.add=function(t,e){this._verify2(t,e);var n=t.add(e);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},_.prototype.iadd=function(t,e){this._verify2(t,e);var n=t.iadd(e);return n.cmp(this.m)>=0&&n.isub(this.m),n},_.prototype.sub=function(t,e){this._verify2(t,e);var n=t.sub(e);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},_.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},_.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},_.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},_.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},_.prototype.isqr=function(t){return this.imul(t,t.clone())},_.prototype.sqr=function(t){return this.mul(t,t)},_.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var n=this.m.add(new o(1)).iushrn(2);return this.pow(t,n)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);r(!i.isZero());var s=new o(1).toRed(this),u=s.redNeg(),c=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,c).cmp(u);)l.redIAdd(u);for(var h=this.pow(l,i),d=this.pow(t,i.addn(1).iushrn(1)),f=this.pow(t,i),p=a;0!==f.cmp(s);){for(var m=f,g=0;0!==m.cmp(s);g++)m=m.redSqr();r(g<p);var y=this.pow(h,new o(1).iushln(p-g-1));d=d.redMul(y),h=y.redSqr(),f=f.redMul(h),p=g}return d},_.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},_.prototype.pow=function(t,e){if(e.isZero())return new o(1).toRed(this);if(0===e.cmpn(1))return t.clone();var n=new Array(16);n[0]=new o(1).toRed(this),n[1]=t;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],t);var i=n[0],a=0,s=0,u=e.bitLength()%26;for(0===u&&(u=26),r=e.length-1;r>=0;r--){for(var c=e.words[r],l=u-1;l>=0;l--){var h=c>>l&1;i!==n[0]&&(i=this.sqr(i)),0!==h||0!==a?(a<<=1,a|=h,(4==++s||0===r&&0===l)&&(i=this.mul(i,n[a]),s=0,a=0)):s=0}u=26}return i},_.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},_.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new E(t)},i(E,_),E.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},E.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},E.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var n=t.imul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).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)},E.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var n=t.mul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},E.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,n(54)(t))},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0});const r=n(60);r.__exportStar(n(61),e),r.__exportStar(n(62),e)},function(t,e,n){(function(t){
|
|
56
|
+
t.exports=n=function(){return r},t.exports.__esModule=!0,t.exports.default=t.exports;var r={},i=Object.prototype,o=i.hasOwnProperty,a="function"==typeof Symbol?Symbol:{},s=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function l(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,n){return t[e]=n}}function h(t,e,n,r){var i=e&&e.prototype instanceof p?e:p,o=Object.create(i.prototype),a=new S(r||[]);return o._invoke=function(t,e,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return x()}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var s=E(a,n);if(s){if(s===f)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=d(t,e,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===f)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}(t,n,a),o}function d(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}r.wrap=h;var f={};function p(){}function m(){}function g(){}var y={};l(y,s,(function(){return this}));var b=Object.getPrototypeOf,v=b&&b(b(A([])));v&&v!==i&&o.call(v,s)&&(y=v);var w=g.prototype=p.prototype=Object.create(y);function M(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,n){function r(i,a,s,u){var c=d(t[i],t,a);if("throw"!==c.type){var l=c.arg,h=l.value;return h&&"object"==e(h)&&o.call(h,"__await")?n.resolve(h.__await).then((function(t){r("next",t,s,u)}),(function(t){r("throw",t,s,u)})):n.resolve(h).then((function(t){l.value=t,s(l)}),(function(t){return r("throw",t,s,u)}))}u(c.arg)}var i;this._invoke=function(t,e){function o(){return new n((function(n,i){r(t,e,n,i)}))}return i=i?i.then(o,o):o()}}function E(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,E(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var r=d(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,f;var i=r.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function N(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(N,this),this.reset(!0)}function A(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,r=function e(){for(;++n<t.length;)if(o.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return r.next=r}}return{next:x}}function x(){return{value:void 0,done:!0}}return m.prototype=g,l(w,"constructor",g),l(g,"constructor",m),m.displayName=l(g,c,"GeneratorFunction"),r.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===m||"GeneratorFunction"===(e.displayName||e.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,g):(t.__proto__=g,l(t,c,"GeneratorFunction")),t.prototype=Object.create(w),t},r.awrap=function(t){return{__await:t}},M(_.prototype),l(_.prototype,u,(function(){return this})),r.AsyncIterator=_,r.async=function(t,e,n,i,o){void 0===o&&(o=Promise);var a=new _(h(t,e,n,i),o);return r.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},M(w),l(w,c,"Generator"),l(w,s,(function(){return this})),l(w,"toString",(function(){return"[object Generator]"})),r.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},r.values=A,S.prototype={constructor:S,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(L),!t)for(var e in this)"t"===e.charAt(0)&&o.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(n,r){return a.type="throw",a.arg=t,e.next=n,r&&(e.method="next",e.arg=void 0),!!r}for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=o.call(i,"catchLoc"),u=o.call(i,"finallyLoc");if(s&&u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&o.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,f):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),L(n),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;L(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:A(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},r}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}(pO)),pO.exports}function gO(){if(dO)return hO;dO=1;var t=mO()();hO=t;try{regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}return hO}var yO,bO={exports:{}};function vO(){return yO||(yO=1,function(t){function e(t,e,n,r,i,o,a){try{var s=t[o](a),u=s.value}catch(t){return void n(t)}s.done?e(u):Promise.resolve(u).then(r,i)}t.exports=function(t){return function(){var n=this,r=arguments;return new Promise((function(i,o){var a=t.apply(n,r);function s(t){e(a,i,o,s,u,"next",t)}function u(t){e(a,i,o,s,u,"throw",t)}s(void 0)}))}},t.exports.__esModule=!0,t.exports.default=t.exports}(bO)),bO.exports}var wO,MO,_O={exports:{}};function EO(){return wO||(wO=1,function(t){var e=Object.prototype.hasOwnProperty,n="~";function r(){}function i(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function o(t,e,r,o,a){if("function"!=typeof r)throw new TypeError("The listener must be a function");var s=new i(r,o||t,a),u=n?n+e:e;return t._events[u]?t._events[u].fn?t._events[u]=[t._events[u],s]:t._events[u].push(s):(t._events[u]=s,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new r:delete t._events[e]}function s(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),s.prototype.eventNames=function(){var t,r,i=[];if(0===this._eventsCount)return i;for(r in t=this._events)e.call(t,r)&&i.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(t)):i},s.prototype.listeners=function(t){var e=n?n+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,o=r.length,a=new Array(o);i<o;i++)a[i]=r[i].fn;return a},s.prototype.listenerCount=function(t){var e=n?n+t:t,r=this._events[e];return r?r.fn?1:r.length:0},s.prototype.emit=function(t,e,r,i,o,a){var s=n?n+t:t;if(!this._events[s])return!1;var u,c,l=this._events[s],h=arguments.length;if(l.fn){switch(l.once&&this.removeListener(t,l.fn,void 0,!0),h){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,e),!0;case 3:return l.fn.call(l.context,e,r),!0;case 4:return l.fn.call(l.context,e,r,i),!0;case 5:return l.fn.call(l.context,e,r,i,o),!0;case 6:return l.fn.call(l.context,e,r,i,o,a),!0}for(c=1,u=new Array(h-1);c<h;c++)u[c-1]=arguments[c];l.fn.apply(l.context,u)}else{var d,f=l.length;for(c=0;c<f;c++)switch(l[c].once&&this.removeListener(t,l[c].fn,void 0,!0),h){case 1:l[c].fn.call(l[c].context);break;case 2:l[c].fn.call(l[c].context,e);break;case 3:l[c].fn.call(l[c].context,e,r);break;case 4:l[c].fn.call(l[c].context,e,r,i);break;default:if(!u)for(d=1,u=new Array(h-1);d<h;d++)u[d-1]=arguments[d];l[c].fn.apply(l[c].context,u)}}return!0},s.prototype.on=function(t,e,n){return o(this,t,e,n,!1)},s.prototype.once=function(t,e,n){return o(this,t,e,n,!0)},s.prototype.removeListener=function(t,e,r,i){var o=n?n+t:t;if(!this._events[o])return this;if(!e)return a(this,o),this;var s=this._events[o];if(s.fn)s.fn!==e||i&&!s.once||r&&s.context!==r||a(this,o);else{for(var u=0,c=[],l=s.length;u<l;u++)(s[u].fn!==e||i&&!s[u].once||r&&s[u].context!==r)&&c.push(s[u]);c.length?this._events[o]=1===c.length?c[0]:c:a(this,o)}return this},s.prototype.removeAllListeners=function(t){var e;return t?(e=n?n+t:t,this._events[e]&&a(this,e)):(this._events=new r,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=n,s.EventEmitter=s,t.exports=s}(_O)),_O.exports}function NO(){return MO||(MO=1,function(t){var e=yL.exports;Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=e(gO()),r=e(vO()),i=e(CL()),o=e(EL()),a=e(wL()),s=e(TL()),u=e(RL()),c=e(FL()),l=EO();function h(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=(0,c.default)(t);if(e){var i=(0,c.default)(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return(0,u.default)(this,n)}}var d=function(t){(0,s.default)(f,t);var e,u,c,l,d=h(f);function f(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"ws://localhost:8080",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;(0,o.default)(this,f);var a=r.autoconnect,s=void 0===a||a,u=r.reconnect,c=void 0===u||u,l=r.reconnect_interval,h=void 0===l?1e3:l,p=r.max_reconnects,m=void 0===p?5:p,g=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}(r,["autoconnect","reconnect","reconnect_interval","max_reconnects"]);return(e=d.call(this)).webSocketFactory=t,e.queue={},e.rpc_id=0,e.address=n,e.autoconnect=s,e.ready=!1,e.reconnect=c,e.reconnect_interval=h,e.max_reconnects=m,e.rest_options=g,e.current_reconnects=0,e.generate_request_id=i||function(){return++e.rpc_id},e.autoconnect&&e._connect(e.address,Object.assign({autoconnect:e.autoconnect,reconnect:e.reconnect,reconnect_interval:e.reconnect_interval,max_reconnects:e.max_reconnects},e.rest_options)),e}return(0,a.default)(f,[{key:"connect",value:function(){this.socket||this._connect(this.address,Object.assign({autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects},this.rest_options))}},{key:"call",value:function(t,e,n,r){var o=this;return r||"object"!==(0,i.default)(n)||(r=n,n=null),new Promise((function(i,a){if(!o.ready)return a(new Error("socket not ready"));var s=o.generate_request_id(t,e),u={jsonrpc:"2.0",method:t,params:e||null,id:s};o.socket.send(JSON.stringify(u),r,(function(t){if(t)return a(t);o.queue[s]={promise:[i,a]},n&&(o.queue[s].timeout=setTimeout((function(){delete o.queue[s],a(new Error("reply timeout"))}),n))}))}))}},{key:"login",value:(l=(0,r.default)(n.default.mark((function t(e){var r;return n.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.call("rpc.login",e);case 2:if(r=t.sent){t.next=5;break}throw new Error("authentication failed");case 5:return t.abrupt("return",r);case 6:case"end":return t.stop()}}),t,this)}))),function(t){return l.apply(this,arguments)})},{key:"listMethods",value:(c=(0,r.default)(n.default.mark((function t(){return n.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.call("__listMethods");case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)}))),function(){return c.apply(this,arguments)})},{key:"notify",value:function(t,e){var n=this;return new Promise((function(r,i){if(!n.ready)return i(new Error("socket not ready"));var o={jsonrpc:"2.0",method:t,params:e||null};n.socket.send(JSON.stringify(o),(function(t){if(t)return i(t);r()}))}))}},{key:"subscribe",value:(u=(0,r.default)(n.default.mark((function t(e){var r;return n.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return"string"==typeof e&&(e=[e]),t.next=3,this.call("rpc.on",e);case 3:if(r=t.sent,"string"!=typeof e||"ok"===r[e]){t.next=6;break}throw new Error("Failed subscribing to an event '"+e+"' with: "+r[e]);case 6:return t.abrupt("return",r);case 7:case"end":return t.stop()}}),t,this)}))),function(t){return u.apply(this,arguments)})},{key:"unsubscribe",value:(e=(0,r.default)(n.default.mark((function t(e){var r;return n.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return"string"==typeof e&&(e=[e]),t.next=3,this.call("rpc.off",e);case 3:if(r=t.sent,"string"!=typeof e||"ok"===r[e]){t.next=6;break}throw new Error("Failed unsubscribing from an event with: "+r);case 6:return t.abrupt("return",r);case 7:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})},{key:"close",value:function(t,e){this.socket.close(t||1e3,e)}},{key:"_connect",value:function(t,e){var n=this;this.socket=this.webSocketFactory(t,e),this.socket.addEventListener("open",(function(){n.ready=!0,n.emit("open"),n.current_reconnects=0})),this.socket.addEventListener("message",(function(t){var e=t.data;e instanceof ArrayBuffer&&(e=p_.from(e).toString());try{e=JSON.parse(e)}catch(t){return}if(e.notification&&n.listeners(e.notification).length){if(!Object.keys(e.params).length)return n.emit(e.notification);var r=[e.notification];if(e.params.constructor===Object)r.push(e.params);else for(var i=0;i<e.params.length;i++)r.push(e.params[i]);return Promise.resolve().then((function(){n.emit.apply(n,r)}))}if(!n.queue[e.id])return e.method&&e.params?Promise.resolve().then((function(){n.emit(e.method,e.params)})):void 0;"error"in e=="result"in e&&n.queue[e.id].promise[1](new Error('Server response malformed. Response must include either "result" or "error", but not both.')),n.queue[e.id].timeout&&clearTimeout(n.queue[e.id].timeout),e.error?n.queue[e.id].promise[1](e.error):n.queue[e.id].promise[0](e.result),delete n.queue[e.id]})),this.socket.addEventListener("error",(function(t){return n.emit("error",t)})),this.socket.addEventListener("close",(function(r){var i=r.code,o=r.reason;n.ready&&setTimeout((function(){return n.emit("close",i,o)}),0),n.ready=!1,n.socket=void 0,1e3!==i&&(n.current_reconnects++,n.reconnect&&(n.max_reconnects>n.current_reconnects||0===n.max_reconnects)&&setTimeout((function(){return n._connect(t,e)}),n.reconnect_interval))}))}}]),f}(l.EventEmitter);t.default=d}(fO)),fO}var LO,SO={},AO={exports:{}};var xO,TO,IO={exports:{}},kO={exports:{}},jO={exports:{}};function CO(){return xO||(xO=1,function(t){t.exports=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r},t.exports.__esModule=!0,t.exports.default=t.exports}(jO)),jO.exports}function DO(){return TO||(TO=1,function(t){var e=CO();t.exports=function(t){if(Array.isArray(t))return e(t)},t.exports.__esModule=!0,t.exports.default=t.exports}(kO)),kO.exports}var OO,zO={exports:{}};function PO(){return OO||(OO=1,function(t){t.exports=function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)},t.exports.__esModule=!0,t.exports.default=t.exports}(zO)),zO.exports}var RO,BO={exports:{}};function UO(){return RO||(RO=1,function(t){var e=CO();t.exports=function(t,n){if(t){if("string"==typeof t)return e(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?e(t,n):void 0}},t.exports.__esModule=!0,t.exports.default=t.exports}(BO)),BO.exports}var FO,WO,YO,QO={exports:{}};function HO(){return FO||(FO=1,function(t){t.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},t.exports.__esModule=!0,t.exports.default=t.exports}(QO)),QO.exports}var GO=new Uint8Array(16);function ZO(){if(!YO&&!(YO="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return YO(GO)}var VO=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function qO(t){return"string"==typeof t&&VO.test(t)}for(var JO,KO,XO=[],$O=0;$O<256;++$O)XO.push(($O+256).toString(16).substr(1));function tz(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(XO[t[e+0]]+XO[t[e+1]]+XO[t[e+2]]+XO[t[e+3]]+"-"+XO[t[e+4]]+XO[t[e+5]]+"-"+XO[t[e+6]]+XO[t[e+7]]+"-"+XO[t[e+8]]+XO[t[e+9]]+"-"+XO[t[e+10]]+XO[t[e+11]]+XO[t[e+12]]+XO[t[e+13]]+XO[t[e+14]]+XO[t[e+15]]).toLowerCase();if(!qO(n))throw TypeError("Stringified UUID is invalid");return n}var ez=0,nz=0;function rz(t){if(!qO(t))throw TypeError("Invalid UUID");var e,n=new Uint8Array(16);return n[0]=(e=parseInt(t.slice(0,8),16))>>>24,n[1]=e>>>16&255,n[2]=e>>>8&255,n[3]=255&e,n[4]=(e=parseInt(t.slice(9,13),16))>>>8,n[5]=255&e,n[6]=(e=parseInt(t.slice(14,18),16))>>>8,n[7]=255&e,n[8]=(e=parseInt(t.slice(19,23),16))>>>8,n[9]=255&e,n[10]=(e=parseInt(t.slice(24,36),16))/1099511627776&255,n[11]=e/4294967296&255,n[12]=e>>>24&255,n[13]=e>>>16&255,n[14]=e>>>8&255,n[15]=255&e,n}var iz="6ba7b810-9dad-11d1-80b4-00c04fd430c8",oz="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function az(t,e,n){function r(t,r,i,o){if("string"==typeof t&&(t=function(t){t=unescape(encodeURIComponent(t));for(var e=[],n=0;n<t.length;++n)e.push(t.charCodeAt(n));return e}(t)),"string"==typeof r&&(r=rz(r)),16!==r.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var a=new Uint8Array(16+t.length);if(a.set(r),a.set(t,r.length),(a=n(a))[6]=15&a[6]|e,a[8]=63&a[8]|128,i){o=o||0;for(var s=0;s<16;++s)i[o+s]=a[s];return i}return tz(a)}try{r.name=t}catch(t){}return r.DNS=iz,r.URL=oz,r}function sz(t){return 14+(t+64>>>9<<4)+1}function uz(t,e){var n=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(n>>16)<<16|65535&n}function cz(t,e,n,r,i,o){return uz((a=uz(uz(e,t),uz(r,o)))<<(s=i)|a>>>32-s,n);var a,s}function lz(t,e,n,r,i,o,a){return cz(e&n|~e&r,t,e,i,o,a)}function hz(t,e,n,r,i,o,a){return cz(e&r|n&~r,t,e,i,o,a)}function dz(t,e,n,r,i,o,a){return cz(e^n^r,t,e,i,o,a)}function fz(t,e,n,r,i,o,a){return cz(n^(e|~r),t,e,i,o,a)}var pz=az("v3",48,(function(t){if("string"==typeof t){var e=unescape(encodeURIComponent(t));t=new Uint8Array(e.length);for(var n=0;n<e.length;++n)t[n]=e.charCodeAt(n)}return function(t){for(var e=[],n=32*t.length,r="0123456789abcdef",i=0;i<n;i+=8){var o=t[i>>5]>>>i%32&255,a=parseInt(r.charAt(o>>>4&15)+r.charAt(15&o),16);e.push(a)}return e}(function(t,e){t[e>>5]|=128<<e%32,t[sz(e)-1]=e;for(var n=1732584193,r=-271733879,i=-1732584194,o=271733878,a=0;a<t.length;a+=16){var s=n,u=r,c=i,l=o;n=lz(n,r,i,o,t[a],7,-680876936),o=lz(o,n,r,i,t[a+1],12,-389564586),i=lz(i,o,n,r,t[a+2],17,606105819),r=lz(r,i,o,n,t[a+3],22,-1044525330),n=lz(n,r,i,o,t[a+4],7,-176418897),o=lz(o,n,r,i,t[a+5],12,1200080426),i=lz(i,o,n,r,t[a+6],17,-1473231341),r=lz(r,i,o,n,t[a+7],22,-45705983),n=lz(n,r,i,o,t[a+8],7,1770035416),o=lz(o,n,r,i,t[a+9],12,-1958414417),i=lz(i,o,n,r,t[a+10],17,-42063),r=lz(r,i,o,n,t[a+11],22,-1990404162),n=lz(n,r,i,o,t[a+12],7,1804603682),o=lz(o,n,r,i,t[a+13],12,-40341101),i=lz(i,o,n,r,t[a+14],17,-1502002290),n=hz(n,r=lz(r,i,o,n,t[a+15],22,1236535329),i,o,t[a+1],5,-165796510),o=hz(o,n,r,i,t[a+6],9,-1069501632),i=hz(i,o,n,r,t[a+11],14,643717713),r=hz(r,i,o,n,t[a],20,-373897302),n=hz(n,r,i,o,t[a+5],5,-701558691),o=hz(o,n,r,i,t[a+10],9,38016083),i=hz(i,o,n,r,t[a+15],14,-660478335),r=hz(r,i,o,n,t[a+4],20,-405537848),n=hz(n,r,i,o,t[a+9],5,568446438),o=hz(o,n,r,i,t[a+14],9,-1019803690),i=hz(i,o,n,r,t[a+3],14,-187363961),r=hz(r,i,o,n,t[a+8],20,1163531501),n=hz(n,r,i,o,t[a+13],5,-1444681467),o=hz(o,n,r,i,t[a+2],9,-51403784),i=hz(i,o,n,r,t[a+7],14,1735328473),n=dz(n,r=hz(r,i,o,n,t[a+12],20,-1926607734),i,o,t[a+5],4,-378558),o=dz(o,n,r,i,t[a+8],11,-2022574463),i=dz(i,o,n,r,t[a+11],16,1839030562),r=dz(r,i,o,n,t[a+14],23,-35309556),n=dz(n,r,i,o,t[a+1],4,-1530992060),o=dz(o,n,r,i,t[a+4],11,1272893353),i=dz(i,o,n,r,t[a+7],16,-155497632),r=dz(r,i,o,n,t[a+10],23,-1094730640),n=dz(n,r,i,o,t[a+13],4,681279174),o=dz(o,n,r,i,t[a],11,-358537222),i=dz(i,o,n,r,t[a+3],16,-722521979),r=dz(r,i,o,n,t[a+6],23,76029189),n=dz(n,r,i,o,t[a+9],4,-640364487),o=dz(o,n,r,i,t[a+12],11,-421815835),i=dz(i,o,n,r,t[a+15],16,530742520),n=fz(n,r=dz(r,i,o,n,t[a+2],23,-995338651),i,o,t[a],6,-198630844),o=fz(o,n,r,i,t[a+7],10,1126891415),i=fz(i,o,n,r,t[a+14],15,-1416354905),r=fz(r,i,o,n,t[a+5],21,-57434055),n=fz(n,r,i,o,t[a+12],6,1700485571),o=fz(o,n,r,i,t[a+3],10,-1894986606),i=fz(i,o,n,r,t[a+10],15,-1051523),r=fz(r,i,o,n,t[a+1],21,-2054922799),n=fz(n,r,i,o,t[a+8],6,1873313359),o=fz(o,n,r,i,t[a+15],10,-30611744),i=fz(i,o,n,r,t[a+6],15,-1560198380),r=fz(r,i,o,n,t[a+13],21,1309151649),n=fz(n,r,i,o,t[a+4],6,-145523070),o=fz(o,n,r,i,t[a+11],10,-1120210379),i=fz(i,o,n,r,t[a+2],15,718787259),r=fz(r,i,o,n,t[a+9],21,-343485551),n=uz(n,s),r=uz(r,u),i=uz(i,c),o=uz(o,l)}return[n,r,i,o]}(function(t){if(0===t.length)return[];for(var e=8*t.length,n=new Uint32Array(sz(e)),r=0;r<e;r+=8)n[r>>5]|=(255&t[r/8])<<r%32;return n}(t),8*t.length))})),mz=pz;function gz(t,e,n,r){switch(t){case 0:return e&n^~e&r;case 1:case 3:return e^n^r;case 2:return e&n^e&r^n&r}}function yz(t,e){return t<<e|t>>>32-e}var bz=az("v5",80,(function(t){var e=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof t){var r=unescape(encodeURIComponent(t));t=[];for(var i=0;i<r.length;++i)t.push(r.charCodeAt(i))}else Array.isArray(t)||(t=Array.prototype.slice.call(t));t.push(128);for(var o=t.length/4+2,a=Math.ceil(o/16),s=new Array(a),u=0;u<a;++u){for(var c=new Uint32Array(16),l=0;l<16;++l)c[l]=t[64*u+4*l]<<24|t[64*u+4*l+1]<<16|t[64*u+4*l+2]<<8|t[64*u+4*l+3];s[u]=c}s[a-1][14]=8*(t.length-1)/Math.pow(2,32),s[a-1][14]=Math.floor(s[a-1][14]),s[a-1][15]=8*(t.length-1)&4294967295;for(var h=0;h<a;++h){for(var d=new Uint32Array(80),f=0;f<16;++f)d[f]=s[h][f];for(var p=16;p<80;++p)d[p]=yz(d[p-3]^d[p-8]^d[p-14]^d[p-16],1);for(var m=n[0],g=n[1],y=n[2],b=n[3],v=n[4],w=0;w<80;++w){var M=Math.floor(w/20),_=yz(m,5)+gz(M,g,y,b)+v+e[M]+d[w]>>>0;v=b,b=y,y=yz(g,30)>>>0,g=m,m=_}n[0]=n[0]+m>>>0,n[1]=n[1]+g>>>0,n[2]=n[2]+y>>>0,n[3]=n[3]+b>>>0,n[4]=n[4]+v>>>0}return[n[0]>>24&255,n[0]>>16&255,n[0]>>8&255,255&n[0],n[1]>>24&255,n[1]>>16&255,n[1]>>8&255,255&n[1],n[2]>>24&255,n[2]>>16&255,n[2]>>8&255,255&n[2],n[3]>>24&255,n[3]>>16&255,n[3]>>8&255,255&n[3],n[4]>>24&255,n[4]>>16&255,n[4]>>8&255,255&n[4]]})),vz=bz;var wz,Mz,_z=Object.freeze({__proto__:null,v1:function(t,e,n){var r=e&&n||0,i=e||new Array(16),o=(t=t||{}).node||JO,a=void 0!==t.clockseq?t.clockseq:KO;if(null==o||null==a){var s=t.random||(t.rng||ZO)();null==o&&(o=JO=[1|s[0],s[1],s[2],s[3],s[4],s[5]]),null==a&&(a=KO=16383&(s[6]<<8|s[7]))}var u=void 0!==t.msecs?t.msecs:Date.now(),c=void 0!==t.nsecs?t.nsecs:nz+1,l=u-ez+(c-nz)/1e4;if(l<0&&void 0===t.clockseq&&(a=a+1&16383),(l<0||u>ez)&&void 0===t.nsecs&&(c=0),c>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");ez=u,nz=c,KO=a;var h=(1e4*(268435455&(u+=122192928e5))+c)%4294967296;i[r++]=h>>>24&255,i[r++]=h>>>16&255,i[r++]=h>>>8&255,i[r++]=255&h;var d=u/4294967296*1e4&268435455;i[r++]=d>>>8&255,i[r++]=255&d,i[r++]=d>>>24&15|16,i[r++]=d>>>16&255,i[r++]=a>>>8|128,i[r++]=255&a;for(var f=0;f<6;++f)i[r+f]=o[f];return e||tz(i)},v3:mz,v4:function(t,e,n){var r=(t=t||{}).random||(t.rng||ZO)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,e){n=n||0;for(var i=0;i<16;++i)e[n+i]=r[i];return e}return tz(r)},v5:vz,NIL:"00000000-0000-0000-0000-000000000000",version:function(t){if(!qO(t))throw TypeError("Invalid UUID");return parseInt(t.substr(14,1),16)},validate:qO,stringify:tz,parse:rz}),Ez=XM(_z),Nz={};function Lz(){return Mz||(Mz=1,function(t){var e=yL.exports,n=CL();Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=e(gO()),i=e(CL()),o=e(vO()),a=e((LO||(LO=1,function(t){t.exports=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t},t.exports.__esModule=!0,t.exports.default=t.exports}(AO)),AO.exports)),s=e((WO||(WO=1,function(t){var e=DO(),n=PO(),r=UO(),i=HO();t.exports=function(t){return e(t)||n(t)||r(t)||i()},t.exports.__esModule=!0,t.exports.default=t.exports}(IO)),IO.exports)),u=e(EL()),c=e(wL()),l=e(TL()),h=e(RL()),d=e(FL()),f=EO(),p=cO(),m=Ez,g=e(hT),y=function(t,e){if(!e&&t&&t.__esModule)return t;if(null===t||"object"!==n(t)&&"function"!=typeof t)return{default:t};var r=b(e);if(r&&r.has(t))return r.get(t);var i={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in t)if("default"!==a&&Object.prototype.hasOwnProperty.call(t,a)){var s=o?Object.getOwnPropertyDescriptor(t,a):null;s&&(s.get||s.set)?Object.defineProperty(i,a,s):i[a]=t[a]}i.default=t,r&&r.set(t,i);return i}(function(){if(wz)return Nz;wz=1,Object.defineProperty(Nz,"__esModule",{value:!0}),Nz.createError=function(e,n){var r={code:e,message:t.get(e)||"Internal Server Error"};return n&&(r.data=n),r};var t=new Map([[-32e3,"Event not provided"],[-32600,"Invalid Request"],[-32601,"Method not found"],[-32602,"Invalid params"],[-32603,"Internal error"],[-32604,"Params not found"],[-32605,"Method forbidden"],[-32606,"Event forbidden"],[-32700,"Parse error"]]);return Nz}());function b(t){if("function"!=typeof WeakMap)return null;var e=new WeakMap,n=new WeakMap;return(b=function(t){return t?n:e})(t)}function v(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return w(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return w(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function w(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function M(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=(0,d.default)(t);if(e){var i=(0,d.default)(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return(0,h.default)(this,n)}}var _=function(t){(0,l.default)(h,t);var e,n=M(h);function h(t){var e;return(0,u.default)(this,h),(e=n.call(this)).namespaces={},e.wss=new p.Server(t),e.wss.on("listening",(function(){return e.emit("listening")})),e.wss.on("connection",(function(t,n){var r=g.default.parse(n.url,!0),i=r.pathname;return r.query.socket_id?t._id=r.query.socket_id:t._id=(0,m.v1)(),t._authenticated=!1,t.on("error",(function(n){return e.emit("socket-error",t,n)})),t.on("close",(function(){e.namespaces[i].clients.delete(t._id);for(var n=0,r=Object.keys(e.namespaces[i].events);n<r.length;n++){var o=r[n],a=e.namespaces[i].events[o].sockets.indexOf(t._id);a>=0&&e.namespaces[i].events[o].sockets.splice(a,1)}e.emit("disconnection",t)})),e.namespaces[i]||e._generateNamespace(i),e.namespaces[i].clients.set(t._id,t),e.emit("connection",t,n),e._handleRPC(t,i)})),e.wss.on("error",(function(t){return e.emit("error",t)})),e}return(0,c.default)(h,[{key:"register",value:function(t,e){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"/";return this.namespaces[r]||this._generateNamespace(r),this.namespaces[r].rpc_methods[t]={fn:e,protected:!1},{protected:function(){return n._makeProtectedMethod(t,r)},public:function(){return n._makePublicMethod(t,r)}}}},{key:"setAuth",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/";this.register("rpc.login",t,e)}},{key:"_makeProtectedMethod",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/";this.namespaces[e].rpc_methods[t].protected=!0}},{key:"_makePublicMethod",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/";this.namespaces[e].rpc_methods[t].protected=!1}},{key:"_makeProtectedEvent",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/";this.namespaces[e].events[t].protected=!0}},{key:"_makePublicEvent",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/";this.namespaces[e].events[t].protected=!1}},{key:"closeNamespace",value:function(t){var e=this.namespaces[t];if(e){delete e.rpc_methods,delete e.events;var n,r=v(e.clients.values());try{for(r.s();!(n=r.n()).done;){n.value.close()}}catch(t){r.e(t)}finally{r.f()}delete this.namespaces[t]}}},{key:"event",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/";if(this.namespaces[n]){if(void 0!==this.namespaces[n].events[t])throw new Error("Already registered event ".concat(n).concat(t))}else this._generateNamespace(n);return this.namespaces[n].events[t]={sockets:[],protected:!1},this.on(t,(function(){for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];1===i.length&&i[0]instanceof Object&&(i=i[0]);var a,s=v(e.namespaces[n].events[t].sockets);try{for(s.s();!(a=s.n()).done;){var u=a.value,c=e.namespaces[n].clients.get(u);c&&c.send(JSON.stringify({notification:t,params:i||null}))}}catch(t){s.e(t)}finally{s.f()}})),{protected:function(){return e._makeProtectedEvent(t,n)},public:function(){return e._makePublicEvent(t,n)}}}},{key:"of",value:function(t){this.namespaces[t]||this._generateNamespace(t);var e=this;return{register:function(n,r){if(2!==arguments.length)throw new Error("must provide exactly two arguments");if("string"!=typeof n)throw new Error("name must be a string");if("function"!=typeof r)throw new Error("handler must be a function");return e.register(n,r,t)},event:function(n){if(1!==arguments.length)throw new Error("must provide exactly one argument");if("string"!=typeof n)throw new Error("name must be a string");return e.event(n,t)},get eventList(){return Object.keys(e.namespaces[t].events)},emit:function(n){for(var r=(0,s.default)(e.namespaces[t].clients.keys()),i=arguments.length,o=new Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];for(var u,c=0;u=r[c];++c)e.namespaces[t].clients.get(u).send(JSON.stringify({notification:n,params:o||[]}))},get name(){return t},connected:function(){return(0,s.default)(e.namespaces[t].clients.keys()).reduce((function(n,r){return Object.assign(Object.assign({},n),(0,a.default)({},r,e.namespaces[t].clients.get(r)))}),{})},clients:function(){return e.namespaces[t]}}}},{key:"eventList",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/";return this.namespaces[t]?Object.keys(this.namespaces[t].events):[]}},{key:"createError",value:function(t,e,n){return{code:t,message:e,data:n||null}}},{key:"close",value:function(){var t=this;return new Promise((function(e,n){try{t.wss.close(),t.emit("close"),e()}catch(t){n(t)}}))}},{key:"_handleRPC",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/";t.on("message",function(){var i=(0,o.default)(r.default.mark((function i(o){var a,s,u,c,l,h,d,f;return r.default.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(a={},o instanceof ArrayBuffer&&(a.binary=!0,o=p_.from(o).toString()),1===t.readyState){r.next=4;break}return r.abrupt("return");case 4:r.prev=4,s=JSON.parse(o),r.next=11;break;case 8:return r.prev=8,r.t0=r.catch(4),r.abrupt("return",t.send(JSON.stringify({jsonrpc:"2.0",error:y.createError(-32700,r.t0.toString()),id:null}),a));case 11:if(!Array.isArray(s)){r.next=39;break}if(s.length){r.next=14;break}return r.abrupt("return",t.send(JSON.stringify({jsonrpc:"2.0",error:y.createError(-32600,"Invalid array"),id:null}),a));case 14:u=[],c=v(s),r.prev=16,c.s();case 18:if((l=c.n()).done){r.next=28;break}return h=l.value,r.next=22,e._runMethod(h,t._id,n);case 22:if(d=r.sent){r.next=25;break}return r.abrupt("continue",26);case 25:u.push(d);case 26:r.next=18;break;case 28:r.next=33;break;case 30:r.prev=30,r.t1=r.catch(16),c.e(r.t1);case 33:return r.prev=33,c.f(),r.finish(33);case 36:if(u.length){r.next=38;break}return r.abrupt("return");case 38:return r.abrupt("return",t.send(JSON.stringify(u),a));case 39:return r.next=41,e._runMethod(s,t._id,n);case 41:if(f=r.sent){r.next=44;break}return r.abrupt("return");case 44:return r.abrupt("return",t.send(JSON.stringify(f),a));case 45:case"end":return r.stop()}}),i,null,[[4,8],[16,30,33,36]])})));return function(t){return i.apply(this,arguments)}}())}},{key:"_runMethod",value:(e=(0,o.default)(r.default.mark((function t(e,n){var o,a,s,u,c,l,h,d,f,p,m,g,b,w,M,_=arguments;return r.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(o=_.length>2&&void 0!==_[2]?_[2]:"/","object"===(0,i.default)(e)&&null!==e){t.next=3;break}return t.abrupt("return",{jsonrpc:"2.0",error:y.createError(-32600),id:null});case 3:if("2.0"===e.jsonrpc){t.next=5;break}return t.abrupt("return",{jsonrpc:"2.0",error:y.createError(-32600,"Invalid JSON RPC version"),id:e.id||null});case 5:if(e.method){t.next=7;break}return t.abrupt("return",{jsonrpc:"2.0",error:y.createError(-32602,"Method not specified"),id:e.id||null});case 7:if("string"==typeof e.method){t.next=9;break}return t.abrupt("return",{jsonrpc:"2.0",error:y.createError(-32600,"Invalid method name"),id:e.id||null});case 9:if(!e.params||"string"!=typeof e.params){t.next=11;break}return t.abrupt("return",{jsonrpc:"2.0",error:y.createError(-32600),id:e.id||null});case 11:if("rpc.on"!==e.method){t.next=47;break}if(e.params){t.next=14;break}return t.abrupt("return",{jsonrpc:"2.0",error:y.createError(-32e3),id:e.id||null});case 14:a={},s=Object.keys(this.namespaces[o].events),u=v(e.params),t.prev=17,u.s();case 19:if((c=u.n()).done){t.next=36;break}if(l=c.value,h=s.indexOf(l),d=this.namespaces[o],-1!==h){t.next=26;break}return a[l]="provided event invalid",t.abrupt("continue",34);case 26:if(!0!==d.events[s[h]].protected||!1!==d.clients.get(n)._authenticated){t.next=28;break}return t.abrupt("return",{jsonrpc:"2.0",error:y.createError(-32606),id:e.id||null});case 28:if(!(d.events[s[h]].sockets.indexOf(n)>=0)){t.next=32;break}return a[l]="socket has already been subscribed to event",t.abrupt("continue",34);case 32:d.events[s[h]].sockets.push(n),a[l]="ok";case 34:t.next=19;break;case 36:t.next=41;break;case 38:t.prev=38,t.t0=t.catch(17),u.e(t.t0);case 41:return t.prev=41,u.f(),t.finish(41);case 44:return t.abrupt("return",{jsonrpc:"2.0",result:a,id:e.id||null});case 47:if("rpc.off"!==e.method){t.next=78;break}if(e.params){t.next=50;break}return t.abrupt("return",{jsonrpc:"2.0",error:y.createError(-32e3),id:e.id||null});case 50:f={},p=v(e.params),t.prev=52,p.s();case 54:if((m=p.n()).done){t.next=67;break}if(g=m.value,this.namespaces[o].events[g]){t.next=59;break}return f[g]="provided event invalid",t.abrupt("continue",65);case 59:if(-1!==(b=this.namespaces[o].events[g].sockets.indexOf(n))){t.next=63;break}return f[g]="not subscribed",t.abrupt("continue",65);case 63:this.namespaces[o].events[g].sockets.splice(b,1),f[g]="ok";case 65:t.next=54;break;case 67:t.next=72;break;case 69:t.prev=69,t.t1=t.catch(52),p.e(t.t1);case 72:return t.prev=72,p.f(),t.finish(72);case 75:return t.abrupt("return",{jsonrpc:"2.0",result:f,id:e.id||null});case 78:if("rpc.login"!==e.method){t.next=81;break}if(e.params){t.next=81;break}return t.abrupt("return",{jsonrpc:"2.0",error:y.createError(-32604),id:e.id||null});case 81:if(this.namespaces[o].rpc_methods[e.method]){t.next=83;break}return t.abrupt("return",{jsonrpc:"2.0",error:y.createError(-32601),id:e.id||null});case 83:if(w=null,!0!==this.namespaces[o].rpc_methods[e.method].protected||!1!==this.namespaces[o].clients.get(n)._authenticated){t.next=86;break}return t.abrupt("return",{jsonrpc:"2.0",error:y.createError(-32605),id:e.id||null});case 86:return t.prev=86,t.next=89,this.namespaces[o].rpc_methods[e.method].fn(e.params,n);case 89:w=t.sent,t.next=99;break;case 92:if(t.prev=92,t.t2=t.catch(86),e.id){t.next=96;break}return t.abrupt("return");case 96:if(!(t.t2 instanceof Error)){t.next=98;break}return t.abrupt("return",{jsonrpc:"2.0",error:{code:-32e3,message:t.t2.name,data:t.t2.message},id:e.id});case 98:return t.abrupt("return",{jsonrpc:"2.0",error:t.t2,id:e.id});case 99:if(e.id){t.next=101;break}return t.abrupt("return");case 101:return"rpc.login"===e.method&&!0===w&&((M=this.namespaces[o].clients.get(n))._authenticated=!0,this.namespaces[o].clients.set(n,M)),t.abrupt("return",{jsonrpc:"2.0",result:w,id:e.id});case 103:case"end":return t.stop()}}),t,this,[[17,38,41,44],[52,69,72,75],[86,92]])}))),function(t,n){return e.apply(this,arguments)})},{key:"_generateNamespace",value:function(t){var e=this;this.namespaces[t]={rpc_methods:{__listMethods:{fn:function(){return Object.keys(e.namespaces[t].rpc_methods)},protected:!1}},clients:new Map,events:{}}}}]),h}(f.EventEmitter);t.default=_}(SO)),SO}!function(t){var e=yL.exports;Object.defineProperty(t,"__esModule",{value:!0}),t.Client=void 0,Object.defineProperty(t,"Server",{enumerable:!0,get:function(){return c.default}});var n=e(wL()),r=e(EL()),i=e(TL()),o=e(RL()),a=e(FL()),s=e((KD||(KD=1,function(t){var e=yL.exports;Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(t,e){return new n.default(t,e)};var n=e(cO())}(WL)),WL)),u=e(NO()),c=e(Lz());function l(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=(0,a.default)(t);if(e){var i=(0,a.default)(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return(0,o.default)(this,n)}}var h=function(t){(0,i.default)(o,t);var e=l(o);function o(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"ws://localhost:8080",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;(0,r.default)(this,o);var a=n.autoconnect,u=void 0===a||a,c=n.reconnect,l=void 0===c||c,h=n.reconnect_interval,d=void 0===h?1e3:h,f=n.max_reconnects,p=void 0===f?5:f,m=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}(n,["autoconnect","reconnect","reconnect_interval","max_reconnects"]);return e.call(this,s.default,t,Object.assign({autoconnect:u,reconnect:l,reconnect_interval:d,max_reconnects:p},m),i)}return(0,n.default)(o)}(u.default);t.Client=h}(gL);const Sz=Ez.v4;var Az=function(t,e,n,r){if("string"!=typeof t)throw new TypeError(t+" must be a string");const i="number"==typeof(r=r||{}).version?r.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===n){const t="function"==typeof r.generator?r.generator:function(){return Sz()};o.id=t(o,r)}else 2===i&&null===n?r.notificationIdNull&&(o.id=null):o.id=n;return o};const xz=Ez.v4,Tz=Az,Iz=function(t,e){if(!(this instanceof Iz))return new Iz(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 xz()},version:void 0!==e.version?e.version:2,notificationIdNull:"boolean"==typeof e.notificationIdNull&&e.notificationIdNull},this.callServer=t};var kz=Iz;Iz.prototype.request=function(t,e,n,r){const i=this;let o=null;const a=Array.isArray(t)&&"function"==typeof e;if(1===this.options.version&&a)throw new TypeError("JSON-RPC 1.0 does not support batching");if(a||!a&&t&&"object"==typeof t&&"function"==typeof e)r=e,o=t;else{"function"==typeof n&&(r=n,n=void 0);const i="function"==typeof r;try{o=Tz(t,e,n,{generator:this.options.generator,version:this.options.version,notificationIdNull:this.options.notificationIdNull})}catch(t){if(i)return r(t);throw t}if(!i)return o}let s;try{s=JSON.stringify(o,this.options.replacer)}catch(t){return r(t)}return this.callServer(s,(function(t,e){i._parseResponse(t,e,r)})),o},Iz.prototype._parseResponse=function(t,e,n){if(t)return void n(t);if(!e)return n();let r;try{r=JSON.parse(e,this.options.reviver)}catch(t){return n(t)}if(3===n.length){if(Array.isArray(r)){const t=function(t){return void 0!==t.error},e=function(e){return!t(e)};return n(null,r.filter(t),r.filter(e))}return n(null,r.error,r.result)}n(null,r)};var jz=kz;const Cz="Impossible case. Please create issue.",Dz="The tweak was out of range or the resulted private key is invalid",Oz="The tweak was out of range or equal to zero",zz="Unknow error on context randomization",Pz="Private Key is invalid",Rz="Public Key could not be parsed",Bz="Public Key serialization error",Uz="The sum of the public keys is not valid",Fz="Signature could not be parsed",Wz="The nonce generation function failed, or the private key was invalid",Yz="Public key could not be recover",Qz="Scalar was invalid (zero or overflow)";function Hz(t,e){if(!t)throw new Error(e)}function Gz(t,e,n){if(Hz(e instanceof Uint8Array,`Expected ${t} to be an Uint8Array`),void 0!==n)if(Array.isArray(n)){const r=`Expected ${t} to be an Uint8Array with length [${n.join(", ")}]`;Hz(n.includes(e.length),r)}else{const r=`Expected ${t} to be an Uint8Array with length ${n}`;Hz(e.length===n,r)}}function Zz(t){Hz("Boolean"===qz(t),"Expected compressed to be a Boolean")}function Vz(t=(t=>new Uint8Array(t)),e){return"function"==typeof t&&(t=t(e)),Gz("output",t,e),t}function qz(t){return Object.prototype.toString.call(t).slice(8,-1)}var Jz={},Kz="6.5.4",Xz={},$z={exports:{}};!function(t,e){function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function r(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}function i(t,e,n){if(i.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(n=e,e=10),this._init(t||0,e||10,n||"be"))}var o;"object"==typeof t?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:tE.Buffer}catch(t){}function a(t,e){var n=t.charCodeAt(e);return n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:n-48&15}function s(t,e,n){var r=a(t,n);return n-1>=e&&(r|=a(t,n-1)<<4),r}function u(t,e,n,r){for(var i=0,o=Math.min(t.length,n),a=e;a<o;a++){var s=t.charCodeAt(a)-48;i*=r,i+=s>=49?s-49+10:s>=17?s-17+10:s}return i}i.isBN=function(t){return t instanceof i||null!==t&&"object"==typeof t&&t.constructor.wordSize===i.wordSize&&Array.isArray(t.words)},i.max=function(t,e){return t.cmp(e)>0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.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)))},i.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)},i.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,a,s=0;if("be"===r)for(i=t.length-1,o=0;i>=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i<t.length;i+=3)a=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this.strip()},i.prototype._parseHex=function(t,e,n){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var i,o=0,a=0;if("be"===n)for(r=t.length-1;r>=e;r-=2)i=s(t,e,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(r=(t.length-e)%2==0?e+1:e;r<t.length;r+=2)i=s(t,e,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this.strip()},i.prototype._parseBase=function(t,e,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=e)r++;r--,i=i/e|0;for(var o=t.length-n,a=o%r,s=Math.min(o,o-a)+n,c=0,l=n;l<s;l+=r)c=u(t,l,l+r,e),this.imuln(i),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==a){var h=1;for(c=u(t,l,t.length,e),l=0;l<a;l++)h*=e;this.imuln(h),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}this.strip()},i.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},i.prototype.clone=function(){var t=new i(null);return this.copy(t),t},i.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},i.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var c=["","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"],l=[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],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(t,e,n){n.negative=e.negative^t.negative;var r=t.length+e.length|0;n.length=r,r=r-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,u=a/67108864|0;n.words[0]=s;for(var c=1;c<r;c++){for(var l=u>>>26,h=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;l+=(a=(i=0|t.words[p])*(o=0|e.words[f])+h)/67108864|0,h=67108863&a}n.words[c]=0|h,u=0|l}return 0!==u?n.words[c]=0|u:n.length--,n.strip()}i.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,a=0;a<this.length;a++){var s=this.words[a],u=(16777215&(s<<i|o)).toString(16);r=0!=(o=s>>>24-i&16777215)||a!==this.length-1?c[6-u.length]+u+r:u+r,(i+=2)>=26&&(i-=26,a--)}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 d=l[t],f=h[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(f).toString(t);r=(p=p.idivn(f)).isZero()?m+r:c[d-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")},i.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},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(t,e){return n(void 0!==o),this.toArrayLike(o,t,e)},i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},i.prototype.toArrayLike=function(t,e,r){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"),this.strip();var a,s,u="le"===e,c=new t(o),l=this.clone();if(u){for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),c[s]=a;for(;s<o;s++)c[s]=0}else{for(s=0;s<o-i;s++)c[s]=0;for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),c[o-s-1]=a}return c},Math.clz32?i.prototype._countBits=function(t){return 32-Math.clz32(t)}:i.prototype._countBits=function(t){var e=t,n=0;return e>=4096&&(n+=13,e>>>=13),e>=64&&(n+=7,e>>>=7),e>=8&&(n+=4,e>>>=4),e>=2&&(n+=2,e>>>=2),n+e},i.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,n=0;return 0==(8191&e)&&(n+=13,e>>>=13),0==(127&e)&&(n+=7,e>>>=7),0==(15&e)&&(n+=4,e>>>=4),0==(3&e)&&(n+=2,e>>>=2),0==(1&e)&&n++,n},i.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var n=this._zeroBits(this.words[e]);if(t+=n,26!==n)break}return t},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},i.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return 0!==this.negative},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.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()},i.prototype.ior=function(t){return n(0==(this.negative|t.negative)),this.iuor(t)},i.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},i.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var n=0;n<e.length;n++)this.words[n]=this.words[n]&t.words[n];return this.length=e.length,this.strip()},i.prototype.iand=function(t){return n(0==(this.negative|t.negative)),this.iuand(t)},i.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},i.prototype.iuxor=function(t){var e,n;this.length>t.length?(e=this,n=t):(e=t,n=this);for(var r=0;r<n.length;r++)this.words[r]=e.words[r]^n.words[r];if(this!==e)for(;r<e.length;r++)this.words[r]=e.words[r];return this.length=e.length,this.strip()},i.prototype.ixor=function(t){return n(0==(this.negative|t.negative)),this.iuxor(t)},i.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},i.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()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.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()},i.prototype.iadd=function(t){var e,n,r;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?(n=this,r=t):(n=t,r=this);for(var i=0,o=0;o<r.length;o++)e=(0|n.words[o])+(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<n.length;o++)e=(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;o<n.length;o++)this.words[o]=n.words[o];return this},i.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)},i.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 n,r,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=t):(n=t,r=this);for(var o=0,a=0;a<r.length;a++)o=(e=(0|n.words[a])-(0|r.words[a])+o)>>26,this.words[a]=67108863&e;for(;0!==o&&a<n.length;a++)o=(e=(0|n.words[a])+o)>>26,this.words[a]=67108863&e;if(0===o&&a<n.length&&n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this.length=Math.max(this.length,a),n!==this&&(this.negative=1),this.strip()},i.prototype.sub=function(t){return this.clone().isub(t)};var f=function(t,e,n){var r,i,o,a=t.words,s=e.words,u=n.words,c=0,l=0|a[0],h=8191&l,d=l>>>13,f=0|a[1],p=8191&f,m=f>>>13,g=0|a[2],y=8191&g,b=g>>>13,v=0|a[3],w=8191&v,M=v>>>13,_=0|a[4],E=8191&_,N=_>>>13,L=0|a[5],S=8191&L,A=L>>>13,x=0|a[6],T=8191&x,I=x>>>13,k=0|a[7],j=8191&k,C=k>>>13,D=0|a[8],O=8191&D,z=D>>>13,P=0|a[9],R=8191&P,B=P>>>13,U=0|s[0],F=8191&U,W=U>>>13,Y=0|s[1],Q=8191&Y,H=Y>>>13,G=0|s[2],Z=8191&G,V=G>>>13,q=0|s[3],J=8191&q,K=q>>>13,X=0|s[4],$=8191&X,tt=X>>>13,et=0|s[5],nt=8191&et,rt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ct=st>>>13,lt=0|s[8],ht=8191<,dt=lt>>>13,ft=0|s[9],pt=8191&ft,mt=ft>>>13;n.negative=t.negative^e.negative,n.length=19;var gt=(c+(r=Math.imul(h,F))|0)+((8191&(i=(i=Math.imul(h,W))+Math.imul(d,F)|0))<<13)|0;c=((o=Math.imul(d,W))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(p,F),i=(i=Math.imul(p,W))+Math.imul(m,F)|0,o=Math.imul(m,W);var yt=(c+(r=r+Math.imul(h,Q)|0)|0)+((8191&(i=(i=i+Math.imul(h,H)|0)+Math.imul(d,Q)|0))<<13)|0;c=((o=o+Math.imul(d,H)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,r=Math.imul(y,F),i=(i=Math.imul(y,W))+Math.imul(b,F)|0,o=Math.imul(b,W),r=r+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,H)|0;var bt=(c+(r=r+Math.imul(h,Z)|0)|0)+((8191&(i=(i=i+Math.imul(h,V)|0)+Math.imul(d,Z)|0))<<13)|0;c=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(w,F),i=(i=Math.imul(w,W))+Math.imul(M,F)|0,o=Math.imul(M,W),r=r+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,H)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,H)|0,r=r+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,V)|0;var vt=(c+(r=r+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,K)|0)+Math.imul(d,J)|0))<<13)|0;c=((o=o+Math.imul(d,K)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(E,F),i=(i=Math.imul(E,W))+Math.imul(N,F)|0,o=Math.imul(N,W),r=r+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,H)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,H)|0,r=r+Math.imul(y,Z)|0,i=(i=i+Math.imul(y,V)|0)+Math.imul(b,Z)|0,o=o+Math.imul(b,V)|0,r=r+Math.imul(p,J)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,K)|0;var wt=(c+(r=r+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,tt)|0)+Math.imul(d,$)|0))<<13)|0;c=((o=o+Math.imul(d,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(S,F),i=(i=Math.imul(S,W))+Math.imul(A,F)|0,o=Math.imul(A,W),r=r+Math.imul(E,Q)|0,i=(i=i+Math.imul(E,H)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,H)|0,r=r+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,V)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,V)|0,r=r+Math.imul(y,J)|0,i=(i=i+Math.imul(y,K)|0)+Math.imul(b,J)|0,o=o+Math.imul(b,K)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,tt)|0;var Mt=(c+(r=r+Math.imul(h,nt)|0)|0)+((8191&(i=(i=i+Math.imul(h,rt)|0)+Math.imul(d,nt)|0))<<13)|0;c=((o=o+Math.imul(d,rt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(T,F),i=(i=Math.imul(T,W))+Math.imul(I,F)|0,o=Math.imul(I,W),r=r+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,H)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,H)|0,r=r+Math.imul(E,Z)|0,i=(i=i+Math.imul(E,V)|0)+Math.imul(N,Z)|0,o=o+Math.imul(N,V)|0,r=r+Math.imul(w,J)|0,i=(i=i+Math.imul(w,K)|0)+Math.imul(M,J)|0,o=o+Math.imul(M,K)|0,r=r+Math.imul(y,$)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(b,$)|0,o=o+Math.imul(b,tt)|0,r=r+Math.imul(p,nt)|0,i=(i=i+Math.imul(p,rt)|0)+Math.imul(m,nt)|0,o=o+Math.imul(m,rt)|0;var _t=(c+(r=r+Math.imul(h,ot)|0)|0)+((8191&(i=(i=i+Math.imul(h,at)|0)+Math.imul(d,ot)|0))<<13)|0;c=((o=o+Math.imul(d,at)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,r=Math.imul(j,F),i=(i=Math.imul(j,W))+Math.imul(C,F)|0,o=Math.imul(C,W),r=r+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,H)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,H)|0,r=r+Math.imul(S,Z)|0,i=(i=i+Math.imul(S,V)|0)+Math.imul(A,Z)|0,o=o+Math.imul(A,V)|0,r=r+Math.imul(E,J)|0,i=(i=i+Math.imul(E,K)|0)+Math.imul(N,J)|0,o=o+Math.imul(N,K)|0,r=r+Math.imul(w,$)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,tt)|0,r=r+Math.imul(y,nt)|0,i=(i=i+Math.imul(y,rt)|0)+Math.imul(b,nt)|0,o=o+Math.imul(b,rt)|0,r=r+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,at)|0;var Et=(c+(r=r+Math.imul(h,ut)|0)|0)+((8191&(i=(i=i+Math.imul(h,ct)|0)+Math.imul(d,ut)|0))<<13)|0;c=((o=o+Math.imul(d,ct)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(O,F),i=(i=Math.imul(O,W))+Math.imul(z,F)|0,o=Math.imul(z,W),r=r+Math.imul(j,Q)|0,i=(i=i+Math.imul(j,H)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,H)|0,r=r+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,V)|0)+Math.imul(I,Z)|0,o=o+Math.imul(I,V)|0,r=r+Math.imul(S,J)|0,i=(i=i+Math.imul(S,K)|0)+Math.imul(A,J)|0,o=o+Math.imul(A,K)|0,r=r+Math.imul(E,$)|0,i=(i=i+Math.imul(E,tt)|0)+Math.imul(N,$)|0,o=o+Math.imul(N,tt)|0,r=r+Math.imul(w,nt)|0,i=(i=i+Math.imul(w,rt)|0)+Math.imul(M,nt)|0,o=o+Math.imul(M,rt)|0,r=r+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,at)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,at)|0,r=r+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 Nt=(c+(r=r+Math.imul(h,ht)|0)|0)+((8191&(i=(i=i+Math.imul(h,dt)|0)+Math.imul(d,ht)|0))<<13)|0;c=((o=o+Math.imul(d,dt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,r=Math.imul(R,F),i=(i=Math.imul(R,W))+Math.imul(B,F)|0,o=Math.imul(B,W),r=r+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,H)|0)+Math.imul(z,Q)|0,o=o+Math.imul(z,H)|0,r=r+Math.imul(j,Z)|0,i=(i=i+Math.imul(j,V)|0)+Math.imul(C,Z)|0,o=o+Math.imul(C,V)|0,r=r+Math.imul(T,J)|0,i=(i=i+Math.imul(T,K)|0)+Math.imul(I,J)|0,o=o+Math.imul(I,K)|0,r=r+Math.imul(S,$)|0,i=(i=i+Math.imul(S,tt)|0)+Math.imul(A,$)|0,o=o+Math.imul(A,tt)|0,r=r+Math.imul(E,nt)|0,i=(i=i+Math.imul(E,rt)|0)+Math.imul(N,nt)|0,o=o+Math.imul(N,rt)|0,r=r+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,at)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,at)|0,r=r+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ct)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,ct)|0,r=r+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,dt)|0)+Math.imul(m,ht)|0,o=o+Math.imul(m,dt)|0;var Lt=(c+(r=r+Math.imul(h,pt)|0)|0)+((8191&(i=(i=i+Math.imul(h,mt)|0)+Math.imul(d,pt)|0))<<13)|0;c=((o=o+Math.imul(d,mt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,r=Math.imul(R,Q),i=(i=Math.imul(R,H))+Math.imul(B,Q)|0,o=Math.imul(B,H),r=r+Math.imul(O,Z)|0,i=(i=i+Math.imul(O,V)|0)+Math.imul(z,Z)|0,o=o+Math.imul(z,V)|0,r=r+Math.imul(j,J)|0,i=(i=i+Math.imul(j,K)|0)+Math.imul(C,J)|0,o=o+Math.imul(C,K)|0,r=r+Math.imul(T,$)|0,i=(i=i+Math.imul(T,tt)|0)+Math.imul(I,$)|0,o=o+Math.imul(I,tt)|0,r=r+Math.imul(S,nt)|0,i=(i=i+Math.imul(S,rt)|0)+Math.imul(A,nt)|0,o=o+Math.imul(A,rt)|0,r=r+Math.imul(E,ot)|0,i=(i=i+Math.imul(E,at)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,at)|0,r=r+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,ct)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ct)|0,r=r+Math.imul(y,ht)|0,i=(i=i+Math.imul(y,dt)|0)+Math.imul(b,ht)|0,o=o+Math.imul(b,dt)|0;var St=(c+(r=r+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)+(St>>>26)|0,St&=67108863,r=Math.imul(R,Z),i=(i=Math.imul(R,V))+Math.imul(B,Z)|0,o=Math.imul(B,V),r=r+Math.imul(O,J)|0,i=(i=i+Math.imul(O,K)|0)+Math.imul(z,J)|0,o=o+Math.imul(z,K)|0,r=r+Math.imul(j,$)|0,i=(i=i+Math.imul(j,tt)|0)+Math.imul(C,$)|0,o=o+Math.imul(C,tt)|0,r=r+Math.imul(T,nt)|0,i=(i=i+Math.imul(T,rt)|0)+Math.imul(I,nt)|0,o=o+Math.imul(I,rt)|0,r=r+Math.imul(S,ot)|0,i=(i=i+Math.imul(S,at)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,at)|0,r=r+Math.imul(E,ut)|0,i=(i=i+Math.imul(E,ct)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ct)|0,r=r+Math.imul(w,ht)|0,i=(i=i+Math.imul(w,dt)|0)+Math.imul(M,ht)|0,o=o+Math.imul(M,dt)|0;var At=(c+(r=r+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,mt)|0)+Math.imul(b,pt)|0))<<13)|0;c=((o=o+Math.imul(b,mt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(R,J),i=(i=Math.imul(R,K))+Math.imul(B,J)|0,o=Math.imul(B,K),r=r+Math.imul(O,$)|0,i=(i=i+Math.imul(O,tt)|0)+Math.imul(z,$)|0,o=o+Math.imul(z,tt)|0,r=r+Math.imul(j,nt)|0,i=(i=i+Math.imul(j,rt)|0)+Math.imul(C,nt)|0,o=o+Math.imul(C,rt)|0,r=r+Math.imul(T,ot)|0,i=(i=i+Math.imul(T,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,r=r+Math.imul(S,ut)|0,i=(i=i+Math.imul(S,ct)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,ct)|0,r=r+Math.imul(E,ht)|0,i=(i=i+Math.imul(E,dt)|0)+Math.imul(N,ht)|0,o=o+Math.imul(N,dt)|0;var xt=(c+(r=r+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,mt)|0)+Math.imul(M,pt)|0))<<13)|0;c=((o=o+Math.imul(M,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,r=Math.imul(R,$),i=(i=Math.imul(R,tt))+Math.imul(B,$)|0,o=Math.imul(B,tt),r=r+Math.imul(O,nt)|0,i=(i=i+Math.imul(O,rt)|0)+Math.imul(z,nt)|0,o=o+Math.imul(z,rt)|0,r=r+Math.imul(j,ot)|0,i=(i=i+Math.imul(j,at)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,at)|0,r=r+Math.imul(T,ut)|0,i=(i=i+Math.imul(T,ct)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ct)|0,r=r+Math.imul(S,ht)|0,i=(i=i+Math.imul(S,dt)|0)+Math.imul(A,ht)|0,o=o+Math.imul(A,dt)|0;var Tt=(c+(r=r+Math.imul(E,pt)|0)|0)+((8191&(i=(i=i+Math.imul(E,mt)|0)+Math.imul(N,pt)|0))<<13)|0;c=((o=o+Math.imul(N,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(R,nt),i=(i=Math.imul(R,rt))+Math.imul(B,nt)|0,o=Math.imul(B,rt),r=r+Math.imul(O,ot)|0,i=(i=i+Math.imul(O,at)|0)+Math.imul(z,ot)|0,o=o+Math.imul(z,at)|0,r=r+Math.imul(j,ut)|0,i=(i=i+Math.imul(j,ct)|0)+Math.imul(C,ut)|0,o=o+Math.imul(C,ct)|0,r=r+Math.imul(T,ht)|0,i=(i=i+Math.imul(T,dt)|0)+Math.imul(I,ht)|0,o=o+Math.imul(I,dt)|0;var It=(c+(r=r+Math.imul(S,pt)|0)|0)+((8191&(i=(i=i+Math.imul(S,mt)|0)+Math.imul(A,pt)|0))<<13)|0;c=((o=o+Math.imul(A,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(R,ot),i=(i=Math.imul(R,at))+Math.imul(B,ot)|0,o=Math.imul(B,at),r=r+Math.imul(O,ut)|0,i=(i=i+Math.imul(O,ct)|0)+Math.imul(z,ut)|0,o=o+Math.imul(z,ct)|0,r=r+Math.imul(j,ht)|0,i=(i=i+Math.imul(j,dt)|0)+Math.imul(C,ht)|0,o=o+Math.imul(C,dt)|0;var kt=(c+(r=r+Math.imul(T,pt)|0)|0)+((8191&(i=(i=i+Math.imul(T,mt)|0)+Math.imul(I,pt)|0))<<13)|0;c=((o=o+Math.imul(I,mt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,r=Math.imul(R,ut),i=(i=Math.imul(R,ct))+Math.imul(B,ut)|0,o=Math.imul(B,ct),r=r+Math.imul(O,ht)|0,i=(i=i+Math.imul(O,dt)|0)+Math.imul(z,ht)|0,o=o+Math.imul(z,dt)|0;var jt=(c+(r=r+Math.imul(j,pt)|0)|0)+((8191&(i=(i=i+Math.imul(j,mt)|0)+Math.imul(C,pt)|0))<<13)|0;c=((o=o+Math.imul(C,mt)|0)+(i>>>13)|0)+(jt>>>26)|0,jt&=67108863,r=Math.imul(R,ht),i=(i=Math.imul(R,dt))+Math.imul(B,ht)|0,o=Math.imul(B,dt);var Ct=(c+(r=r+Math.imul(O,pt)|0)|0)+((8191&(i=(i=i+Math.imul(O,mt)|0)+Math.imul(z,pt)|0))<<13)|0;c=((o=o+Math.imul(z,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863;var Dt=(c+(r=Math.imul(R,pt))|0)+((8191&(i=(i=Math.imul(R,mt))+Math.imul(B,pt)|0))<<13)|0;return c=((o=Math.imul(B,mt))+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,u[0]=gt,u[1]=yt,u[2]=bt,u[3]=vt,u[4]=wt,u[5]=Mt,u[6]=_t,u[7]=Et,u[8]=Nt,u[9]=Lt,u[10]=St,u[11]=At,u[12]=xt,u[13]=Tt,u[14]=It,u[15]=kt,u[16]=jt,u[17]=Ct,u[18]=Dt,0!==c&&(u[19]=c,n.length++),n};function p(t,e,n){return(new m).mulp(t,e,n)}function m(t,e){this.x=t,this.y=e}Math.imul||(f=d),i.prototype.mulTo=function(t,e){var n,r=this.length+t.length;return n=10===this.length&&10===t.length?f(this,t,e):r<63?d(this,t,e):r<1024?function(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var r=0,i=0,o=0;o<n.length-1;o++){var a=i;i=0;for(var s=67108863&r,u=Math.min(o,e.length-1),c=Math.max(0,o-t.length+1);c<=u;c++){var l=o-c,h=(0|t.words[l])*(0|e.words[c]),d=67108863&h;s=67108863&(d=d+s|0),i+=(a=(a=a+(h/67108864|0)|0)+(d>>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n.strip()}(this,t,e):p(this,t,e),n},m.prototype.makeRBT=function(t){for(var e=new Array(t),n=i.prototype._countBits(t)-1,r=0;r<t;r++)e[r]=this.revBin(r,n,t);return e},m.prototype.revBin=function(t,e,n){if(0===t||t===n-1)return t;for(var r=0,i=0;i<e;i++)r|=(1&t)<<e-i-1,t>>=1;return r},m.prototype.permute=function(t,e,n,r,i,o){for(var a=0;a<o;a++)r[a]=e[t[a]],i[a]=n[t[a]]},m.prototype.transform=function(t,e,n,r,i,o){this.permute(o,t,e,n,r,i);for(var a=1;a<i;a<<=1)for(var s=a<<1,u=Math.cos(2*Math.PI/s),c=Math.sin(2*Math.PI/s),l=0;l<i;l+=s)for(var h=u,d=c,f=0;f<a;f++){var p=n[l+f],m=r[l+f],g=n[l+f+a],y=r[l+f+a],b=h*g-d*y;y=h*y+d*g,g=b,n[l+f]=p+g,r[l+f]=m+y,n[l+f+a]=p-g,r[l+f+a]=m-y,f!==s&&(b=u*h-c*d,d=u*d+c*h,h=b)}},m.prototype.guessLen13b=function(t,e){var n=1|Math.max(e,t),r=1&n,i=0;for(n=n/2|0;n;n>>>=1)i++;return 1<<i+1+r},m.prototype.conjugate=function(t,e,n){if(!(n<=1))for(var r=0;r<n/2;r++){var i=t[r];t[r]=t[n-r-1],t[n-r-1]=i,i=e[r],e[r]=-e[n-r-1],e[n-r-1]=-i}},m.prototype.normalize13b=function(t,e){for(var n=0,r=0;r<e/2;r++){var i=8192*Math.round(t[2*r+1]/e)+Math.round(t[2*r]/e)+n;t[r]=67108863&i,n=i<67108864?0:i/67108864|0}return t},m.prototype.convert13b=function(t,e,r,i){for(var o=0,a=0;a<e;a++)o+=0|t[a],r[2*a]=8191&o,o>>>=13,r[2*a+1]=8191&o,o>>>=13;for(a=2*e;a<i;++a)r[a]=0;n(0===o),n(0==(-8192&o))},m.prototype.stub=function(t){for(var e=new Array(t),n=0;n<t;n++)e[n]=0;return e},m.prototype.mulp=function(t,e,n){var r=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(r),o=this.stub(r),a=new Array(r),s=new Array(r),u=new Array(r),c=new Array(r),l=new Array(r),h=new Array(r),d=n.words;d.length=r,this.convert13b(t.words,t.length,a,r),this.convert13b(e.words,e.length,c,r),this.transform(a,o,s,u,r,i),this.transform(c,o,l,h,r,i);for(var f=0;f<r;f++){var p=s[f]*l[f]-u[f]*h[f];u[f]=s[f]*h[f]+u[f]*l[f],s[f]=p}return this.conjugate(s,u,r),this.transform(s,u,d,o,r,i),this.conjugate(d,o,r),this.normalize13b(d,r),n.negative=t.negative^e.negative,n.length=t.length+e.length,n.strip()},i.prototype.mul=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},i.prototype.mulf=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),p(this,t,e)},i.prototype.imul=function(t){return this.clone().mulTo(t,this)},i.prototype.imuln=function(t){n("number"==typeof t),n(t<67108864);for(var e=0,r=0;r<this.length;r++){var i=(0|this.words[r])*t,o=(67108863&i)+(67108863&e);e>>=26,e+=i/67108864|0,e+=o>>>26,this.words[r]=67108863&o}return 0!==e&&(this.words[r]=e,this.length++),this},i.prototype.muln=function(t){return this.clone().imuln(t)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),n=0;n<e.length;n++){var r=n/26|0,i=n%26;e[n]=(t.words[r]&1<<i)>>>i}return e}(t);if(0===e.length)return new i(1);for(var n=this,r=0;r<e.length&&0===e[r];r++,n=n.sqr());if(++r<e.length)for(var o=n.sqr();r<e.length;r++,o=o.sqr())0!==e[r]&&(n=n.mul(o));return n},i.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 a=0;for(e=0;e<this.length;e++){var s=this.words[e]&o,u=(0|this.words[e])-s<<r;this.words[e]=u|a,a=s>>>26-r}a&&(this.words[e]=a,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()},i.prototype.ishln=function(t){return n(0===this.negative),this.iushln(t)},i.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,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<<o,u=r;if(i-=a,i=Math.max(0,i),u){for(var c=0;c<a;c++)u.words[c]=this.words[c];u.length=a}if(0===a);else if(this.length>a)for(this.length-=a,c=0;c<this.length;c++)this.words[c]=this.words[c+a];else this.words[0]=0,this.length=1;var l=0;for(c=this.length-1;c>=0&&(0!==l||c>=i);c--){var h=0|this.words[c];this.words[c]=l<<26-o|h>>>o,l=h&s}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},i.prototype.shln=function(t){return this.clone().ishln(t)},i.prototype.ushln=function(t){return this.clone().iushln(t)},i.prototype.shrn=function(t){return this.clone().ishrn(t)},i.prototype.ushrn=function(t){return this.clone().iushrn(t)},i.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))},i.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()},i.prototype.maskn=function(t){return this.clone().imaskn(t)},i.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)},i.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},i.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()},i.prototype.addn=function(t){return this.clone().iaddn(t)},i.prototype.subn=function(t){return this.clone().isubn(t)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(t,e,r){var i,o,a=t.length+r;this._expand(a);var s=0;for(i=0;i<t.length;i++){o=(0|this.words[i+r])+s;var u=(0|t.words[i])*e;s=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i<this.length-r;i++)s=(o=(0|this.words[i+r])+s)>>26,this.words[i+r]=67108863&o;if(0===s)return this.strip();for(n(-1===s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},i.prototype._wordDiv=function(t,e){var n=(this.length,t.length),r=this.clone(),o=t,a=0|o.words[o.length-1];0!=(n=26-this._countBits(a))&&(o=o.ushln(n),r.iushln(n),a=0|o.words[o.length-1]);var s,u=r.length-o.length;if("mod"!==e){(s=new i(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c<s.length;c++)s.words[c]=0}var l=r.clone()._ishlnsubmul(o,1,u);0===l.negative&&(r=l,s&&(s.words[u]=1));for(var h=u-1;h>=0;h--){var d=67108864*(0|r.words[o.length+h])+(0|r.words[o.length+h-1]);for(d=Math.min(d/a|0,67108863),r._ishlnsubmul(o,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(o,1,h),r.isZero()||(r.negative^=1);s&&(s.words[h]=d)}return s&&s.strip(),r.strip(),"div"!==e&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},i.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(o=s.div.neg()),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(t)),{div:o,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new i(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new i(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modn(t.words[0]))}:this._wordDiv(t,e);var o,a,s},i.prototype.div=function(t){return this.divmod(t,"div",!1).div},i.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},i.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},i.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var n=0!==e.div.negative?e.mod.isub(t):e.mod,r=t.ushrn(1),i=t.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modn=function(t){n(t<=67108863);for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},i.prototype.idivn=function(t){n(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},i.prototype.divn=function(t){return this.clone().idivn(t)},i.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 o=new i(1),a=new i(0),s=new i(0),u=new i(1),c=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++c;for(var l=r.clone(),h=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;)(o.isOdd()||a.isOdd())&&(o.iadd(l),a.isub(h)),o.iushrn(1),a.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;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(h)),s.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(s),a.isub(u)):(r.isub(e),s.isub(o),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},i.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 o,a=new i(1),s=new i(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,l=1;0==(e.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(e.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var h=0,d=1;0==(r.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(r.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),a.isub(s)):(r.isub(e),s.isub(a))}return(o=0===e.cmpn(1)?a:s).cmpn(0)<0&&o.iadd(t),o},i.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),n=t.clone();e.negative=0,n.negative=0;for(var r=0;e.isEven()&&n.isEven();r++)e.iushrn(1),n.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=e.cmp(n);if(i<0){var o=e;e=n,n=o}else if(0===i||0===n.cmpn(1))break;e.isub(n)}return n.iushln(r)},i.prototype.invm=function(t){return this.egcd(t).a.umod(t)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(t){return this.words[0]&t},i.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,a=r;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.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},i.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},i.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,n=this.length-1;n>=0;n--){var r=0|this.words[n],i=0|t.words[n];if(r!==i){r<i?e=-1:r>i&&(e=1);break}}return e},i.prototype.gtn=function(t){return 1===this.cmpn(t)},i.prototype.gt=function(t){return 1===this.cmp(t)},i.prototype.gten=function(t){return this.cmpn(t)>=0},i.prototype.gte=function(t){return this.cmp(t)>=0},i.prototype.ltn=function(t){return-1===this.cmpn(t)},i.prototype.lt=function(t){return-1===this.cmp(t)},i.prototype.lten=function(t){return this.cmpn(t)<=0},i.prototype.lte=function(t){return this.cmp(t)<=0},i.prototype.eqn=function(t){return 0===this.cmpn(t)},i.prototype.eq=function(t){return 0===this.cmp(t)},i.red=function(t){return new _(t)},i.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)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(t){return this.red=t,this},i.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var g={k256:null,p224:null,p192:null,p25519:null};function y(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function M(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function _(t){if("string"==typeof t){var e=i._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 E(t){_.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}y.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},y.prototype.ireduce=function(t){var e,n=t;do{this.split(n,this.tmp),e=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(e>this.n);var r=e<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):r>0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},y.prototype.split=function(t,e){t.iushrn(this.n,0,e)},y.prototype.imulK=function(t){return t.imul(this.k)},r(b,y),b.prototype.split=function(t,e){for(var n=4194303,r=Math.min(t.length,9),i=0;i<r;i++)e.words[i]=t.words[i];if(e.length=r,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&n,i=10;i<t.length;i++){var a=0|t.words[i];t.words[i-10]=(a&n)<<4|o>>>22,o=a}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n<t.length;n++){var r=0|t.words[n];e+=977*r,t.words[n]=67108863&e,e=64*r+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},r(v,y),r(w,y),r(M,y),M.prototype.imulK=function(t){for(var e=0,n=0;n<t.length;n++){var r=19*(0|t.words[n])+e,i=67108863&r;r>>>=26,t.words[n]=i,e=r}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(g[t])return g[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new v;else if("p192"===t)e=new w;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new M}return g[t]=e,e},_.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},_.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")},_.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},_.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},_.prototype.add=function(t,e){this._verify2(t,e);var n=t.add(e);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},_.prototype.iadd=function(t,e){this._verify2(t,e);var n=t.iadd(e);return n.cmp(this.m)>=0&&n.isub(this.m),n},_.prototype.sub=function(t,e){this._verify2(t,e);var n=t.sub(e);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},_.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},_.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},_.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},_.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},_.prototype.isqr=function(t){return this.imul(t,t.clone())},_.prototype.sqr=function(t){return this.mul(t,t)},_.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 i(1)).iushrn(2);return this.pow(t,r)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);n(!o.isZero());var s=new i(1).toRed(this),u=s.redNeg(),c=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new i(2*l*l).toRed(this);0!==this.pow(l,c).cmp(u);)l.redIAdd(u);for(var h=this.pow(l,o),d=this.pow(t,o.addn(1).iushrn(1)),f=this.pow(t,o),p=a;0!==f.cmp(s);){for(var m=f,g=0;0!==m.cmp(s);g++)m=m.redSqr();n(g<p);var y=this.pow(h,new i(1).iushln(p-g-1));d=d.redMul(y),h=y.redSqr(),f=f.redMul(h),p=g}return d},_.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},_.prototype.pow=function(t,e){if(e.isZero())return new i(1).toRed(this);if(0===e.cmpn(1))return t.clone();var n=new Array(16);n[0]=new i(1).toRed(this),n[1]=t;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],t);var o=n[0],a=0,s=0,u=e.bitLength()%26;for(0===u&&(u=26),r=e.length-1;r>=0;r--){for(var c=e.words[r],l=u-1;l>=0;l--){var h=c>>l&1;o!==n[0]&&(o=this.sqr(o)),0!==h||0!==a?(a<<=1,a|=h,(4==++s||0===r&&0===l)&&(o=this.mul(o,n[a]),s=0,a=0)):s=0}u=26}return o},_.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},_.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new E(t)},r(E,_),E.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},E.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},E.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var n=t.imul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).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)},E.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new i(0)._forceRed(this);var n=t.mul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=n.isub(r).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},E.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}($z,KM);var tP=eP;function eP(t,e){if(!t)throw new Error(e||"Assertion failed")}eP.equal=function(t,e,n){if(t!=e)throw new Error(n||"Assertion failed: "+t+" != "+e)};var nP={};!function(t){var e=nP;function n(t){return 1===t.length?"0"+t:t}function r(t){for(var e="",r=0;r<t.length;r++)e+=n(t[r].toString(16));return e}e.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var n=[];if("string"!=typeof t){for(var r=0;r<t.length;r++)n[r]=0|t[r];return n}if("hex"===e){(t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t);for(r=0;r<t.length;r+=2)n.push(parseInt(t[r]+t[r+1],16))}else for(r=0;r<t.length;r++){var i=t.charCodeAt(r),o=i>>8,a=255&i;o?n.push(o,a):n.push(a)}return n},e.zero2=n,e.toHex=r,e.encode=function(t,e){return"hex"===e?r(t):t}}(),function(t){var e=Xz,n=$z.exports,r=tP,i=nP;e.assert=r,e.toArray=i.toArray,e.zero2=i.zero2,e.toHex=i.toHex,e.encode=i.encode,e.getNAF=function(t,e,n){var r=new Array(Math.max(t.bitLength(),n)+1);r.fill(0);for(var i=1<<e+1,o=t.clone(),a=0;a<r.length;a++){var s,u=o.andln(i-1);o.isOdd()?(s=u>(i>>1)-1?(i>>1)-u:u,o.isubn(s)):s=0,r[a]=s,o.iushrn(1)}return r},e.getJSF=function(t,e){var n=[[],[]];t=t.clone(),e=e.clone();for(var r,i=0,o=0;t.cmpn(-i)>0||e.cmpn(-o)>0;){var a,s,u=t.andln(3)+i&3,c=e.andln(3)+o&3;3===u&&(u=-1),3===c&&(c=-1),a=0==(1&u)?0:3!==(r=t.andln(7)+i&7)&&5!==r||2!==c?u:-u,n[0].push(a),s=0==(1&c)?0:3!==(r=e.andln(7)+o&7)&&5!==r||2!==u?c:-c,n[1].push(s),2*i===a+1&&(i=1-i),2*o===s+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return n},e.cachedProperty=function(t,e,n){var r="_"+e;t.prototype[e]=function(){return void 0!==this[r]?this[r]:this[r]=n.call(this)}},e.parseBytes=function(t){return"string"==typeof t?e.toArray(t,"hex"):t},e.intFromLE=function(t){return new n(t,"hex","le")}}();var rP,iP={exports:{}};function oP(t){this.rand=t}if(iP.exports=function(t){return rP||(rP=new oP(null)),rP.generate(t)},iP.exports.Rand=oP,oP.prototype.generate=function(t){return this._rand(t)},oP.prototype._rand=function(t){if(this.rand.getBytes)return this.rand.getBytes(t);for(var e=new Uint8Array(t),n=0;n<e.length;n++)e[n]=this.rand.getByte();return e},"object"==typeof self)self.crypto&&self.crypto.getRandomValues?oP.prototype._rand=function(t){var e=new Uint8Array(t);return self.crypto.getRandomValues(e),e}:self.msCrypto&&self.msCrypto.getRandomValues?oP.prototype._rand=function(t){var e=new Uint8Array(t);return self.msCrypto.getRandomValues(e),e}:"object"==typeof window&&(oP.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var aP=oE;if("function"!=typeof aP.randomBytes)throw new Error("Not supported");oP.prototype._rand=function(t){return aP.randomBytes(t)}}catch(t){}var sP={},uP=$z.exports,cP=Xz,lP=cP.getNAF,hP=cP.getJSF,dP=cP.assert;function fP(t,e){this.type=t,this.p=new uP(e.p,16),this.red=e.prime?uP.red(e.prime):uP.mont(this.p),this.zero=new uP(0).toRed(this.red),this.one=new uP(1).toRed(this.red),this.two=new uP(2).toRed(this.red),this.n=e.n&&new uP(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var n=this.n&&this.p.div(this.n);!n||n.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var pP=fP;function mP(t,e){this.curve=t,this.type=e,this.precomputed=null}fP.prototype.point=function(){throw new Error("Not implemented")},fP.prototype.validate=function(){throw new Error("Not implemented")},fP.prototype._fixedNafMul=function(t,e){dP(t.precomputed);var n=t._getDoubles(),r=lP(e,1,this._bitLength),i=(1<<n.step+1)-(n.step%2==0?2:1);i/=3;var o,a,s=[];for(o=0;o<r.length;o+=n.step){a=0;for(var u=o+n.step-1;u>=o;u--)a=(a<<1)+r[u];s.push(a)}for(var c=this.jpoint(null,null,null),l=this.jpoint(null,null,null),h=i;h>0;h--){for(o=0;o<s.length;o++)(a=s[o])===h?l=l.mixedAdd(n.points[o]):a===-h&&(l=l.mixedAdd(n.points[o].neg()));c=c.add(l)}return c.toP()},fP.prototype._wnafMul=function(t,e){var n=4,r=t._getNAFPoints(n);n=r.wnd;for(var i=r.points,o=lP(e,n,this._bitLength),a=this.jpoint(null,null,null),s=o.length-1;s>=0;s--){for(var u=0;s>=0&&0===o[s];s--)u++;if(s>=0&&u++,a=a.dblp(u),s<0)break;var c=o[s];dP(0!==c),a="affine"===t.type?c>0?a.mixedAdd(i[c-1>>1]):a.mixedAdd(i[-c-1>>1].neg()):c>0?a.add(i[c-1>>1]):a.add(i[-c-1>>1].neg())}return"affine"===t.type?a.toP():a},fP.prototype._wnafMulAdd=function(t,e,n,r,i){var o,a,s,u=this._wnafT1,c=this._wnafT2,l=this._wnafT3,h=0;for(o=0;o<r;o++){var d=(s=e[o])._getNAFPoints(t);u[o]=d.wnd,c[o]=d.points}for(o=r-1;o>=1;o-=2){var f=o-1,p=o;if(1===u[f]&&1===u[p]){var m=[e[f],null,null,e[p]];0===e[f].y.cmp(e[p].y)?(m[1]=e[f].add(e[p]),m[2]=e[f].toJ().mixedAdd(e[p].neg())):0===e[f].y.cmp(e[p].y.redNeg())?(m[1]=e[f].toJ().mixedAdd(e[p]),m[2]=e[f].add(e[p].neg())):(m[1]=e[f].toJ().mixedAdd(e[p]),m[2]=e[f].toJ().mixedAdd(e[p].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],y=hP(n[f],n[p]);for(h=Math.max(y[0].length,h),l[f]=new Array(h),l[p]=new Array(h),a=0;a<h;a++){var b=0|y[0][a],v=0|y[1][a];l[f][a]=g[3*(b+1)+(v+1)],l[p][a]=0,c[f]=m}}else l[f]=lP(n[f],u[f],this._bitLength),l[p]=lP(n[p],u[p],this._bitLength),h=Math.max(l[f].length,h),h=Math.max(l[p].length,h)}var w=this.jpoint(null,null,null),M=this._wnafT4;for(o=h;o>=0;o--){for(var _=0;o>=0;){var E=!0;for(a=0;a<r;a++)M[a]=0|l[a][o],0!==M[a]&&(E=!1);if(!E)break;_++,o--}if(o>=0&&_++,w=w.dblp(_),o<0)break;for(a=0;a<r;a++){var N=M[a];0!==N&&(N>0?s=c[a][N-1>>1]:N<0&&(s=c[a][-N-1>>1].neg()),w="affine"===s.type?w.mixedAdd(s):w.add(s))}}for(o=0;o<r;o++)c[o]=null;return i?w:w.toP()},fP.BasePoint=mP,mP.prototype.eq=function(){throw new Error("Not implemented")},mP.prototype.validate=function(){return this.curve.validate(this)},fP.prototype.decodePoint=function(t,e){t=cP.toArray(t,e);var n=this.p.byteLength();if((4===t[0]||6===t[0]||7===t[0])&&t.length-1==2*n)return 6===t[0]?dP(t[t.length-1]%2==0):7===t[0]&&dP(t[t.length-1]%2==1),this.point(t.slice(1,1+n),t.slice(1+n,1+2*n));if((2===t[0]||3===t[0])&&t.length-1===n)return this.pointFromX(t.slice(1,1+n),3===t[0]);throw new Error("Unknown point format")},mP.prototype.encodeCompressed=function(t){return this.encode(t,!0)},mP.prototype._encode=function(t){var e=this.curve.p.byteLength(),n=this.getX().toArray("be",e);return t?[this.getY().isEven()?2:3].concat(n):[4].concat(n,this.getY().toArray("be",e))},mP.prototype.encode=function(t,e){return cP.encode(this._encode(e),t)},mP.prototype.precompute=function(t){if(this.precomputed)return this;var e={doubles:null,naf:null,beta:null};return e.naf=this._getNAFPoints(8),e.doubles=this._getDoubles(4,t),e.beta=this._getBeta(),this.precomputed=e,this},mP.prototype._hasDoubles=function(t){if(!this.precomputed)return!1;var e=this.precomputed.doubles;return!!e&&e.points.length>=Math.ceil((t.bitLength()+1)/e.step)},mP.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],r=this,i=0;i<e;i+=t){for(var o=0;o<t;o++)r=r.dbl();n.push(r)}return{step:t,points:n}},mP.prototype._getNAFPoints=function(t){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var e=[this],n=(1<<t)-1,r=1===n?null:this.dbl(),i=1;i<n;i++)e[i]=e[i-1].add(r);return{wnd:t,points:e}},mP.prototype._getBeta=function(){return null},mP.prototype.dblp=function(t){for(var e=this,n=0;n<t;n++)e=e.dbl();return e};var gP="function"==typeof Object.create?function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:function(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t},yP=XM(Object.freeze({__proto__:null,default:gP})),bP=$z.exports,vP=yP,wP=pP,MP=Xz.assert;function _P(t){wP.call(this,"short",t),this.a=new bP(t.a,16).toRed(this.red),this.b=new bP(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}vP(_P,wP);var EP=_P;function NP(t,e,n,r){wP.BasePoint.call(this,t,"affine"),null===e&&null===n?(this.x=null,this.y=null,this.inf=!0):(this.x=new bP(e,16),this.y=new bP(n,16),r&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function LP(t,e,n,r){wP.BasePoint.call(this,t,"jacobian"),null===e&&null===n&&null===r?(this.x=this.curve.one,this.y=this.curve.one,this.z=new bP(0)):(this.x=new bP(e,16),this.y=new bP(n,16),this.z=new bP(r,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}_P.prototype._getEndomorphism=function(t){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var e,n,r;if(t.beta)e=new bP(t.beta,16).toRed(this.red);else{var i=this._getEndoRoots(this.p);e=(e=i[0].cmp(i[1])<0?i[0]:i[1]).toRed(this.red)}if(t.lambda)n=new bP(t.lambda,16);else{var o=this._getEndoRoots(this.n);0===this.g.mul(o[0]).x.cmp(this.g.x.redMul(e))?n=o[0]:(n=o[1],MP(0===this.g.mul(n).x.cmp(this.g.x.redMul(e))))}return r=t.basis?t.basis.map((function(t){return{a:new bP(t.a,16),b:new bP(t.b,16)}})):this._getEndoBasis(n),{beta:e,lambda:n,basis:r}}},_P.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:bP.mont(t),n=new bP(2).toRed(e).redInvm(),r=n.redNeg(),i=new bP(3).toRed(e).redNeg().redSqrt().redMul(n);return[r.redAdd(i).fromRed(),r.redSub(i).fromRed()]},_P.prototype._getEndoBasis=function(t){for(var e,n,r,i,o,a,s,u,c,l=this.n.ushrn(Math.floor(this.n.bitLength()/2)),h=t,d=this.n.clone(),f=new bP(1),p=new bP(0),m=new bP(0),g=new bP(1),y=0;0!==h.cmpn(0);){var b=d.div(h);u=d.sub(b.mul(h)),c=m.sub(b.mul(f));var v=g.sub(b.mul(p));if(!r&&u.cmp(l)<0)e=s.neg(),n=f,r=u.neg(),i=c;else if(r&&2==++y)break;s=u,d=h,h=u,m=f,f=c,g=p,p=v}o=u.neg(),a=c;var w=r.sqr().add(i.sqr());return o.sqr().add(a.sqr()).cmp(w)>=0&&(o=e,a=n),r.negative&&(r=r.neg(),i=i.neg()),o.negative&&(o=o.neg(),a=a.neg()),[{a:r,b:i},{a:o,b:a}]},_P.prototype._endoSplit=function(t){var e=this.endo.basis,n=e[0],r=e[1],i=r.b.mul(t).divRound(this.n),o=n.b.neg().mul(t).divRound(this.n),a=i.mul(n.a),s=o.mul(r.a),u=i.mul(n.b),c=o.mul(r.b);return{k1:t.sub(a).sub(s),k2:u.add(c).neg()}},_P.prototype.pointFromX=function(t,e){(t=new bP(t,16)).red||(t=t.toRed(this.red));var n=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),r=n.redSqrt();if(0!==r.redSqr().redSub(n).cmp(this.zero))throw new Error("invalid point");var i=r.fromRed().isOdd();return(e&&!i||!e&&i)&&(r=r.redNeg()),this.point(t,r)},_P.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,n=t.y,r=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(r).redIAdd(this.b);return 0===n.redSqr().redISub(i).cmpn(0)},_P.prototype._endoWnafMulAdd=function(t,e,n){for(var r=this._endoWnafT1,i=this._endoWnafT2,o=0;o<t.length;o++){var a=this._endoSplit(e[o]),s=t[o],u=s._getBeta();a.k1.negative&&(a.k1.ineg(),s=s.neg(!0)),a.k2.negative&&(a.k2.ineg(),u=u.neg(!0)),r[2*o]=s,r[2*o+1]=u,i[2*o]=a.k1,i[2*o+1]=a.k2}for(var c=this._wnafMulAdd(1,r,i,2*o,n),l=0;l<2*o;l++)r[l]=null,i[l]=null;return c},vP(NP,wP.BasePoint),_P.prototype.point=function(t,e,n){return new NP(this,t,e,n)},_P.prototype.pointFromJSON=function(t,e){return NP.fromJSON(this,t,e)},NP.prototype._getBeta=function(){if(this.curve.endo){var t=this.precomputed;if(t&&t.beta)return t.beta;var e=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(t){var n=this.curve,r=function(t){return n.point(t.x.redMul(n.endo.beta),t.y)};t.beta=e,e.precomputed={beta:null,naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(r)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(r)}}}return e}},NP.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},NP.fromJSON=function(t,e,n){"string"==typeof e&&(e=JSON.parse(e));var r=t.point(e[0],e[1],n);if(!e[2])return r;function i(e){return t.point(e[0],e[1],n)}var o=e[2];return r.precomputed={beta:null,doubles:o.doubles&&{step:o.doubles.step,points:[r].concat(o.doubles.points.map(i))},naf:o.naf&&{wnd:o.naf.wnd,points:[r].concat(o.naf.points.map(i))}},r},NP.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},NP.prototype.isInfinity=function(){return this.inf},NP.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var n=e.redSqr().redISub(this.x).redISub(t.x),r=e.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,r)},NP.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,n=this.x.redSqr(),r=t.redInvm(),i=n.redAdd(n).redIAdd(n).redIAdd(e).redMul(r),o=i.redSqr().redISub(this.x.redAdd(this.x)),a=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},NP.prototype.getX=function(){return this.x.fromRed()},NP.prototype.getY=function(){return this.y.fromRed()},NP.prototype.mul=function(t){return t=new bP(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},NP.prototype.mulAdd=function(t,e,n){var r=[this,e],i=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i):this.curve._wnafMulAdd(1,r,i,2)},NP.prototype.jmulAdd=function(t,e,n){var r=[this,e],i=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i,!0):this.curve._wnafMulAdd(1,r,i,2,!0)},NP.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},NP.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var n=this.precomputed,r=function(t){return t.neg()};e.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(r)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(r)}}}return e},NP.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},vP(LP,wP.BasePoint),_P.prototype.jpoint=function(t,e,n){return new LP(this,t,e,n)},LP.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),n=this.x.redMul(e),r=this.y.redMul(e).redMul(t);return this.curve.point(n,r)},LP.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},LP.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),n=this.z.redSqr(),r=this.x.redMul(e),i=t.x.redMul(n),o=this.y.redMul(e.redMul(t.z)),a=t.y.redMul(n.redMul(this.z)),s=r.redSub(i),u=o.redSub(a);if(0===s.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=s.redSqr(),l=c.redMul(s),h=r.redMul(c),d=u.redSqr().redIAdd(l).redISub(h).redISub(h),f=u.redMul(h.redISub(d)).redISub(o.redMul(l)),p=this.z.redMul(t.z).redMul(s);return this.curve.jpoint(d,f,p)},LP.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),n=this.x,r=t.x.redMul(e),i=this.y,o=t.y.redMul(e).redMul(this.z),a=n.redSub(r),s=i.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),c=u.redMul(a),l=n.redMul(u),h=s.redSqr().redIAdd(c).redISub(l).redISub(l),d=s.redMul(l.redISub(h)).redISub(i.redMul(c)),f=this.z.redMul(a);return this.curve.jpoint(h,d,f)},LP.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var n=this;for(e=0;e<t;e++)n=n.dbl();return n}var r=this.curve.a,i=this.curve.tinv,o=this.x,a=this.y,s=this.z,u=s.redSqr().redSqr(),c=a.redAdd(a);for(e=0;e<t;e++){var l=o.redSqr(),h=c.redSqr(),d=h.redSqr(),f=l.redAdd(l).redIAdd(l).redIAdd(r.redMul(u)),p=o.redMul(h),m=f.redSqr().redISub(p.redAdd(p)),g=p.redISub(m),y=f.redMul(g);y=y.redIAdd(y).redISub(d);var b=c.redMul(s);e+1<t&&(u=u.redMul(d)),o=m,s=b,c=y}return this.curve.jpoint(o,c.redMul(i),s)},LP.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},LP.prototype._zeroDbl=function(){var t,e,n;if(this.zOne){var r=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),a=this.x.redAdd(i).redSqr().redISub(r).redISub(o);a=a.redIAdd(a);var s=r.redAdd(r).redIAdd(r),u=s.redSqr().redISub(a).redISub(a),c=o.redIAdd(o);c=(c=c.redIAdd(c)).redIAdd(c),t=u,e=s.redMul(a.redISub(u)).redISub(c),n=this.y.redAdd(this.y)}else{var l=this.x.redSqr(),h=this.y.redSqr(),d=h.redSqr(),f=this.x.redAdd(h).redSqr().redISub(l).redISub(d);f=f.redIAdd(f);var p=l.redAdd(l).redIAdd(l),m=p.redSqr(),g=d.redIAdd(d);g=(g=g.redIAdd(g)).redIAdd(g),t=m.redISub(f).redISub(f),e=p.redMul(f.redISub(t)).redISub(g),n=(n=this.y.redMul(this.z)).redIAdd(n)}return this.curve.jpoint(t,e,n)},LP.prototype._threeDbl=function(){var t,e,n;if(this.zOne){var r=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),a=this.x.redAdd(i).redSqr().redISub(r).redISub(o);a=a.redIAdd(a);var s=r.redAdd(r).redIAdd(r).redIAdd(this.curve.a),u=s.redSqr().redISub(a).redISub(a);t=u;var c=o.redIAdd(o);c=(c=c.redIAdd(c)).redIAdd(c),e=s.redMul(a.redISub(u)).redISub(c),n=this.y.redAdd(this.y)}else{var l=this.z.redSqr(),h=this.y.redSqr(),d=this.x.redMul(h),f=this.x.redSub(l).redMul(this.x.redAdd(l));f=f.redAdd(f).redIAdd(f);var p=d.redIAdd(d),m=(p=p.redIAdd(p)).redAdd(p);t=f.redSqr().redISub(m),n=this.y.redAdd(this.z).redSqr().redISub(h).redISub(l);var g=h.redSqr();g=(g=(g=g.redIAdd(g)).redIAdd(g)).redIAdd(g),e=f.redMul(p.redISub(t)).redISub(g)}return this.curve.jpoint(t,e,n)},LP.prototype._dbl=function(){var t=this.curve.a,e=this.x,n=this.y,r=this.z,i=r.redSqr().redSqr(),o=e.redSqr(),a=n.redSqr(),s=o.redAdd(o).redIAdd(o).redIAdd(t.redMul(i)),u=e.redAdd(e),c=(u=u.redIAdd(u)).redMul(a),l=s.redSqr().redISub(c.redAdd(c)),h=c.redISub(l),d=a.redSqr();d=(d=(d=d.redIAdd(d)).redIAdd(d)).redIAdd(d);var f=s.redMul(h).redISub(d),p=n.redAdd(n).redMul(r);return this.curve.jpoint(l,f,p)},LP.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var t=this.x.redSqr(),e=this.y.redSqr(),n=this.z.redSqr(),r=e.redSqr(),i=t.redAdd(t).redIAdd(t),o=i.redSqr(),a=this.x.redAdd(e).redSqr().redISub(t).redISub(r),s=(a=(a=(a=a.redIAdd(a)).redAdd(a).redIAdd(a)).redISub(o)).redSqr(),u=r.redIAdd(r);u=(u=(u=u.redIAdd(u)).redIAdd(u)).redIAdd(u);var c=i.redIAdd(a).redSqr().redISub(o).redISub(s).redISub(u),l=e.redMul(c);l=(l=l.redIAdd(l)).redIAdd(l);var h=this.x.redMul(s).redISub(l);h=(h=h.redIAdd(h)).redIAdd(h);var d=this.y.redMul(c.redMul(u.redISub(c)).redISub(a.redMul(s)));d=(d=(d=d.redIAdd(d)).redIAdd(d)).redIAdd(d);var f=this.z.redAdd(a).redSqr().redISub(n).redISub(s);return this.curve.jpoint(h,d,f)},LP.prototype.mul=function(t,e){return t=new bP(t,e),this.curve._wnafMul(this,t)},LP.prototype.eq=function(t){if("affine"===t.type)return this.eq(t.toJ());if(this===t)return!0;var e=this.z.redSqr(),n=t.z.redSqr();if(0!==this.x.redMul(n).redISub(t.x.redMul(e)).cmpn(0))return!1;var r=e.redMul(this.z),i=n.redMul(t.z);return 0===this.y.redMul(i).redISub(t.y.redMul(r)).cmpn(0)},LP.prototype.eqXToP=function(t){var e=this.z.redSqr(),n=t.toRed(this.curve.red).redMul(e);if(0===this.x.cmp(n))return!0;for(var r=t.clone(),i=this.curve.redN.redMul(e);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(n.redIAdd(i),0===this.x.cmp(n))return!0}},LP.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},LP.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var SP=$z.exports,AP=yP,xP=pP,TP=Xz;function IP(t){xP.call(this,"mont",t),this.a=new SP(t.a,16).toRed(this.red),this.b=new SP(t.b,16).toRed(this.red),this.i4=new SP(4).toRed(this.red).redInvm(),this.two=new SP(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}AP(IP,xP);var kP=IP;function jP(t,e,n){xP.BasePoint.call(this,t,"projective"),null===e&&null===n?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new SP(e,16),this.z=new SP(n,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}IP.prototype.validate=function(t){var e=t.normalize().x,n=e.redSqr(),r=n.redMul(e).redAdd(n.redMul(this.a)).redAdd(e);return 0===r.redSqrt().redSqr().cmp(r)},AP(jP,xP.BasePoint),IP.prototype.decodePoint=function(t,e){return this.point(TP.toArray(t,e),1)},IP.prototype.point=function(t,e){return new jP(this,t,e)},IP.prototype.pointFromJSON=function(t){return jP.fromJSON(this,t)},jP.prototype.precompute=function(){},jP.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},jP.fromJSON=function(t,e){return new jP(t,e[0],e[1]||t.one)},jP.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},jP.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},jP.prototype.dbl=function(){var t=this.x.redAdd(this.z).redSqr(),e=this.x.redSub(this.z).redSqr(),n=t.redSub(e),r=t.redMul(e),i=n.redMul(e.redAdd(this.curve.a24.redMul(n)));return this.curve.point(r,i)},jP.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},jP.prototype.diffAdd=function(t,e){var n=this.x.redAdd(this.z),r=this.x.redSub(this.z),i=t.x.redAdd(t.z),o=t.x.redSub(t.z).redMul(n),a=i.redMul(r),s=e.z.redMul(o.redAdd(a).redSqr()),u=e.x.redMul(o.redISub(a).redSqr());return this.curve.point(s,u)},jP.prototype.mul=function(t){for(var e=t.clone(),n=this,r=this.curve.point(null,null),i=[];0!==e.cmpn(0);e.iushrn(1))i.push(e.andln(1));for(var o=i.length-1;o>=0;o--)0===i[o]?(n=n.diffAdd(r,this),r=r.dbl()):(r=n.diffAdd(r,this),n=n.dbl());return r},jP.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},jP.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},jP.prototype.eq=function(t){return 0===this.getX().cmp(t.getX())},jP.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},jP.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var CP=$z.exports,DP=yP,OP=pP,zP=Xz.assert;function PP(t){this.twisted=1!=(0|t.a),this.mOneA=this.twisted&&-1==(0|t.a),this.extended=this.mOneA,OP.call(this,"edwards",t),this.a=new CP(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new CP(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new CP(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),zP(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|t.c)}DP(PP,OP);var RP=PP;function BP(t,e,n,r,i){OP.BasePoint.call(this,t,"projective"),null===e&&null===n&&null===r?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new CP(e,16),this.y=new CP(n,16),this.z=r?new CP(r,16):this.curve.one,this.t=i&&new CP(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}PP.prototype._mulA=function(t){return this.mOneA?t.redNeg():this.a.redMul(t)},PP.prototype._mulC=function(t){return this.oneC?t:this.c.redMul(t)},PP.prototype.jpoint=function(t,e,n,r){return this.point(t,e,n,r)},PP.prototype.pointFromX=function(t,e){(t=new CP(t,16)).red||(t=t.toRed(this.red));var n=t.redSqr(),r=this.c2.redSub(this.a.redMul(n)),i=this.one.redSub(this.c2.redMul(this.d).redMul(n)),o=r.redMul(i.redInvm()),a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");var s=a.fromRed().isOdd();return(e&&!s||!e&&s)&&(a=a.redNeg()),this.point(t,a)},PP.prototype.pointFromY=function(t,e){(t=new CP(t,16)).red||(t=t.toRed(this.red));var n=t.redSqr(),r=n.redSub(this.c2),i=n.redMul(this.d).redMul(this.c2).redSub(this.a),o=r.redMul(i.redInvm());if(0===o.cmp(this.zero)){if(e)throw new Error("invalid point");return this.point(this.zero,t)}var a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");return a.fromRed().isOdd()!==e&&(a=a.redNeg()),this.point(a,t)},PP.prototype.validate=function(t){if(t.isInfinity())return!0;t.normalize();var e=t.x.redSqr(),n=t.y.redSqr(),r=e.redMul(this.a).redAdd(n),i=this.c2.redMul(this.one.redAdd(this.d.redMul(e).redMul(n)));return 0===r.cmp(i)},DP(BP,OP.BasePoint),PP.prototype.pointFromJSON=function(t){return BP.fromJSON(this,t)},PP.prototype.point=function(t,e,n,r){return new BP(this,t,e,n,r)},BP.fromJSON=function(t,e){return new BP(t,e[0],e[1],e[2])},BP.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},BP.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},BP.prototype._extDbl=function(){var t=this.x.redSqr(),e=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var r=this.curve._mulA(t),i=this.x.redAdd(this.y).redSqr().redISub(t).redISub(e),o=r.redAdd(e),a=o.redSub(n),s=r.redSub(e),u=i.redMul(a),c=o.redMul(s),l=i.redMul(s),h=a.redMul(o);return this.curve.point(u,c,h,l)},BP.prototype._projDbl=function(){var t,e,n,r,i,o,a=this.x.redAdd(this.y).redSqr(),s=this.x.redSqr(),u=this.y.redSqr();if(this.curve.twisted){var c=(r=this.curve._mulA(s)).redAdd(u);this.zOne?(t=a.redSub(s).redSub(u).redMul(c.redSub(this.curve.two)),e=c.redMul(r.redSub(u)),n=c.redSqr().redSub(c).redSub(c)):(i=this.z.redSqr(),o=c.redSub(i).redISub(i),t=a.redSub(s).redISub(u).redMul(o),e=c.redMul(r.redSub(u)),n=c.redMul(o))}else r=s.redAdd(u),i=this.curve._mulC(this.z).redSqr(),o=r.redSub(i).redSub(i),t=this.curve._mulC(a.redISub(r)).redMul(o),e=this.curve._mulC(r).redMul(s.redISub(u)),n=r.redMul(o);return this.curve.point(t,e,n)},BP.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},BP.prototype._extAdd=function(t){var e=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),n=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),r=this.t.redMul(this.curve.dd).redMul(t.t),i=this.z.redMul(t.z.redAdd(t.z)),o=n.redSub(e),a=i.redSub(r),s=i.redAdd(r),u=n.redAdd(e),c=o.redMul(a),l=s.redMul(u),h=o.redMul(u),d=a.redMul(s);return this.curve.point(c,l,d,h)},BP.prototype._projAdd=function(t){var e,n,r=this.z.redMul(t.z),i=r.redSqr(),o=this.x.redMul(t.x),a=this.y.redMul(t.y),s=this.curve.d.redMul(o).redMul(a),u=i.redSub(s),c=i.redAdd(s),l=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(o).redISub(a),h=r.redMul(u).redMul(l);return this.curve.twisted?(e=r.redMul(c).redMul(a.redSub(this.curve._mulA(o))),n=u.redMul(c)):(e=r.redMul(c).redMul(a.redSub(o)),n=this.curve._mulC(u).redMul(c)),this.curve.point(h,e,n)},BP.prototype.add=function(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)},BP.prototype.mul=function(t){return this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)},BP.prototype.mulAdd=function(t,e,n){return this.curve._wnafMulAdd(1,[this,e],[t,n],2,!1)},BP.prototype.jmulAdd=function(t,e,n){return this.curve._wnafMulAdd(1,[this,e],[t,n],2,!0)},BP.prototype.normalize=function(){if(this.zOne)return this;var t=this.z.redInvm();return this.x=this.x.redMul(t),this.y=this.y.redMul(t),this.t&&(this.t=this.t.redMul(t)),this.z=this.curve.one,this.zOne=!0,this},BP.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},BP.prototype.getX=function(){return this.normalize(),this.x.fromRed()},BP.prototype.getY=function(){return this.normalize(),this.y.fromRed()},BP.prototype.eq=function(t){return this===t||0===this.getX().cmp(t.getX())&&0===this.getY().cmp(t.getY())},BP.prototype.eqXToP=function(t){var e=t.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(e))return!0;for(var n=t.clone(),r=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(e.redIAdd(r),0===this.x.cmp(e))return!0}},BP.prototype.toP=BP.prototype.normalize,BP.prototype.mixedAdd=BP.prototype.add,function(t){var e=t;e.base=pP,e.short=EP,e.mont=kP,e.edwards=RP}(sP);var UP={},FP={},WP={},YP=tP,QP=yP;function HP(t,e){return 55296==(64512&t.charCodeAt(e))&&(!(e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1)))}function GP(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function ZP(t){return 1===t.length?"0"+t:t}function VP(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}WP.inherits=QP,WP.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var n=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),i=0;i<t.length;i+=2)n.push(parseInt(t[i]+t[i+1],16))}else for(var r=0,i=0;i<t.length;i++){var o=t.charCodeAt(i);o<128?n[r++]=o:o<2048?(n[r++]=o>>6|192,n[r++]=63&o|128):HP(t,i)?(o=65536+((1023&o)<<10)+(1023&t.charCodeAt(++i)),n[r++]=o>>18|240,n[r++]=o>>12&63|128,n[r++]=o>>6&63|128,n[r++]=63&o|128):(n[r++]=o>>12|224,n[r++]=o>>6&63|128,n[r++]=63&o|128)}else for(i=0;i<t.length;i++)n[i]=0|t[i];return n},WP.toHex=function(t){for(var e="",n=0;n<t.length;n++)e+=ZP(t[n].toString(16));return e},WP.htonl=GP,WP.toHex32=function(t,e){for(var n="",r=0;r<t.length;r++){var i=t[r];"little"===e&&(i=GP(i)),n+=VP(i.toString(16))}return n},WP.zero2=ZP,WP.zero8=VP,WP.join32=function(t,e,n,r){var i=n-e;YP(i%4==0);for(var o=new Array(i/4),a=0,s=e;a<o.length;a++,s+=4){var u;u="big"===r?t[s]<<24|t[s+1]<<16|t[s+2]<<8|t[s+3]:t[s+3]<<24|t[s+2]<<16|t[s+1]<<8|t[s],o[a]=u>>>0}return o},WP.split32=function(t,e){for(var n=new Array(4*t.length),r=0,i=0;r<t.length;r++,i+=4){var o=t[r];"big"===e?(n[i]=o>>>24,n[i+1]=o>>>16&255,n[i+2]=o>>>8&255,n[i+3]=255&o):(n[i+3]=o>>>24,n[i+2]=o>>>16&255,n[i+1]=o>>>8&255,n[i]=255&o)}return n},WP.rotr32=function(t,e){return t>>>e|t<<32-e},WP.rotl32=function(t,e){return t<<e|t>>>32-e},WP.sum32=function(t,e){return t+e>>>0},WP.sum32_3=function(t,e,n){return t+e+n>>>0},WP.sum32_4=function(t,e,n,r){return t+e+n+r>>>0},WP.sum32_5=function(t,e,n,r,i){return t+e+n+r+i>>>0},WP.sum64=function(t,e,n,r){var i=t[e],o=r+t[e+1]>>>0,a=(o<r?1:0)+n+i;t[e]=a>>>0,t[e+1]=o},WP.sum64_hi=function(t,e,n,r){return(e+r>>>0<e?1:0)+t+n>>>0},WP.sum64_lo=function(t,e,n,r){return e+r>>>0},WP.sum64_4_hi=function(t,e,n,r,i,o,a,s){var u=0,c=e;return u+=(c=c+r>>>0)<e?1:0,u+=(c=c+o>>>0)<o?1:0,t+n+i+a+(u+=(c=c+s>>>0)<s?1:0)>>>0},WP.sum64_4_lo=function(t,e,n,r,i,o,a,s){return e+r+o+s>>>0},WP.sum64_5_hi=function(t,e,n,r,i,o,a,s,u,c){var l=0,h=e;return l+=(h=h+r>>>0)<e?1:0,l+=(h=h+o>>>0)<o?1:0,l+=(h=h+s>>>0)<s?1:0,t+n+i+a+u+(l+=(h=h+c>>>0)<c?1:0)>>>0},WP.sum64_5_lo=function(t,e,n,r,i,o,a,s,u,c){return e+r+o+s+c>>>0},WP.rotr64_hi=function(t,e,n){return(e<<32-n|t>>>n)>>>0},WP.rotr64_lo=function(t,e,n){return(t<<32-n|e>>>n)>>>0},WP.shr64_hi=function(t,e,n){return t>>>n},WP.shr64_lo=function(t,e,n){return(t<<32-n|e>>>n)>>>0};var qP={},JP=WP,KP=tP;function XP(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}qP.BlockHash=XP,XP.prototype.update=function(t,e){if(t=JP.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){var n=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-n,t.length),0===this.pending.length&&(this.pending=null),t=JP.join32(t,0,t.length-n,this.endian);for(var r=0;r<t.length;r+=this._delta32)this._update(t,r,r+this._delta32)}return this},XP.prototype.digest=function(t){return this.update(this._pad()),KP(null===this.pending),this._digest(t)},XP.prototype._pad=function(){var t=this.pendingTotal,e=this._delta8,n=e-(t+this.padLength)%e,r=new Array(n+this.padLength);r[0]=128;for(var i=1;i<n;i++)r[i]=0;if(t<<=3,"big"===this.endian){for(var o=8;o<this.padLength;o++)r[i++]=0;r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=t>>>24&255,r[i++]=t>>>16&255,r[i++]=t>>>8&255,r[i++]=255&t}else for(r[i++]=255&t,r[i++]=t>>>8&255,r[i++]=t>>>16&255,r[i++]=t>>>24&255,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,o=8;o<this.padLength;o++)r[i++]=0;return r};var $P={},tR={},eR=WP.rotr32;function nR(t,e,n){return t&e^~t&n}function rR(t,e,n){return t&e^t&n^e&n}function iR(t,e,n){return t^e^n}tR.ft_1=function(t,e,n,r){return 0===t?nR(e,n,r):1===t||3===t?iR(e,n,r):2===t?rR(e,n,r):void 0},tR.ch32=nR,tR.maj32=rR,tR.p32=iR,tR.s0_256=function(t){return eR(t,2)^eR(t,13)^eR(t,22)},tR.s1_256=function(t){return eR(t,6)^eR(t,11)^eR(t,25)},tR.g0_256=function(t){return eR(t,7)^eR(t,18)^t>>>3},tR.g1_256=function(t){return eR(t,17)^eR(t,19)^t>>>10};var oR=WP,aR=qP,sR=tR,uR=oR.rotl32,cR=oR.sum32,lR=oR.sum32_5,hR=sR.ft_1,dR=aR.BlockHash,fR=[1518500249,1859775393,2400959708,3395469782];function pR(){if(!(this instanceof pR))return new pR;dR.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}oR.inherits(pR,dR);var mR=pR;pR.blockSize=512,pR.outSize=160,pR.hmacStrength=80,pR.padLength=64,pR.prototype._update=function(t,e){for(var n=this.W,r=0;r<16;r++)n[r]=t[e+r];for(;r<n.length;r++)n[r]=uR(n[r-3]^n[r-8]^n[r-14]^n[r-16],1);var i=this.h[0],o=this.h[1],a=this.h[2],s=this.h[3],u=this.h[4];for(r=0;r<n.length;r++){var c=~~(r/20),l=lR(uR(i,5),hR(c,o,a,s),u,n[r],fR[c]);u=s,s=a,a=uR(o,30),o=i,i=l}this.h[0]=cR(this.h[0],i),this.h[1]=cR(this.h[1],o),this.h[2]=cR(this.h[2],a),this.h[3]=cR(this.h[3],s),this.h[4]=cR(this.h[4],u)},pR.prototype._digest=function(t){return"hex"===t?oR.toHex32(this.h,"big"):oR.split32(this.h,"big")};var gR=WP,yR=qP,bR=tR,vR=tP,wR=gR.sum32,MR=gR.sum32_4,_R=gR.sum32_5,ER=bR.ch32,NR=bR.maj32,LR=bR.s0_256,SR=bR.s1_256,AR=bR.g0_256,xR=bR.g1_256,TR=yR.BlockHash,IR=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function kR(){if(!(this instanceof kR))return new kR;TR.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=IR,this.W=new Array(64)}gR.inherits(kR,TR);var jR=kR;kR.blockSize=512,kR.outSize=256,kR.hmacStrength=192,kR.padLength=64,kR.prototype._update=function(t,e){for(var n=this.W,r=0;r<16;r++)n[r]=t[e+r];for(;r<n.length;r++)n[r]=MR(xR(n[r-2]),n[r-7],AR(n[r-15]),n[r-16]);var i=this.h[0],o=this.h[1],a=this.h[2],s=this.h[3],u=this.h[4],c=this.h[5],l=this.h[6],h=this.h[7];for(vR(this.k.length===n.length),r=0;r<n.length;r++){var d=_R(h,SR(u),ER(u,c,l),this.k[r],n[r]),f=wR(LR(i),NR(i,o,a));h=l,l=c,c=u,u=wR(s,d),s=a,a=o,o=i,i=wR(d,f)}this.h[0]=wR(this.h[0],i),this.h[1]=wR(this.h[1],o),this.h[2]=wR(this.h[2],a),this.h[3]=wR(this.h[3],s),this.h[4]=wR(this.h[4],u),this.h[5]=wR(this.h[5],c),this.h[6]=wR(this.h[6],l),this.h[7]=wR(this.h[7],h)},kR.prototype._digest=function(t){return"hex"===t?gR.toHex32(this.h,"big"):gR.split32(this.h,"big")};var CR=WP,DR=jR;function OR(){if(!(this instanceof OR))return new OR;DR.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}CR.inherits(OR,DR);var zR=OR;OR.blockSize=512,OR.outSize=224,OR.hmacStrength=192,OR.padLength=64,OR.prototype._digest=function(t){return"hex"===t?CR.toHex32(this.h.slice(0,7),"big"):CR.split32(this.h.slice(0,7),"big")};var PR=WP,RR=qP,BR=tP,UR=PR.rotr64_hi,FR=PR.rotr64_lo,WR=PR.shr64_hi,YR=PR.shr64_lo,QR=PR.sum64,HR=PR.sum64_hi,GR=PR.sum64_lo,ZR=PR.sum64_4_hi,VR=PR.sum64_4_lo,qR=PR.sum64_5_hi,JR=PR.sum64_5_lo,KR=RR.BlockHash,XR=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function $R(){if(!(this instanceof $R))return new $R;KR.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=XR,this.W=new Array(160)}PR.inherits($R,KR);var tB=$R;function eB(t,e,n,r,i){var o=t&n^~t&i;return o<0&&(o+=4294967296),o}function nB(t,e,n,r,i,o){var a=e&r^~e&o;return a<0&&(a+=4294967296),a}function rB(t,e,n,r,i){var o=t&n^t&i^n&i;return o<0&&(o+=4294967296),o}function iB(t,e,n,r,i,o){var a=e&r^e&o^r&o;return a<0&&(a+=4294967296),a}function oB(t,e){var n=UR(t,e,28)^UR(e,t,2)^UR(e,t,7);return n<0&&(n+=4294967296),n}function aB(t,e){var n=FR(t,e,28)^FR(e,t,2)^FR(e,t,7);return n<0&&(n+=4294967296),n}function sB(t,e){var n=UR(t,e,14)^UR(t,e,18)^UR(e,t,9);return n<0&&(n+=4294967296),n}function uB(t,e){var n=FR(t,e,14)^FR(t,e,18)^FR(e,t,9);return n<0&&(n+=4294967296),n}function cB(t,e){var n=UR(t,e,1)^UR(t,e,8)^WR(t,e,7);return n<0&&(n+=4294967296),n}function lB(t,e){var n=FR(t,e,1)^FR(t,e,8)^YR(t,e,7);return n<0&&(n+=4294967296),n}function hB(t,e){var n=UR(t,e,19)^UR(e,t,29)^WR(t,e,6);return n<0&&(n+=4294967296),n}function dB(t,e){var n=FR(t,e,19)^FR(e,t,29)^YR(t,e,6);return n<0&&(n+=4294967296),n}$R.blockSize=1024,$R.outSize=512,$R.hmacStrength=192,$R.padLength=128,$R.prototype._prepareBlock=function(t,e){for(var n=this.W,r=0;r<32;r++)n[r]=t[e+r];for(;r<n.length;r+=2){var i=hB(n[r-4],n[r-3]),o=dB(n[r-4],n[r-3]),a=n[r-14],s=n[r-13],u=cB(n[r-30],n[r-29]),c=lB(n[r-30],n[r-29]),l=n[r-32],h=n[r-31];n[r]=ZR(i,o,a,s,u,c,l,h),n[r+1]=VR(i,o,a,s,u,c,l,h)}},$R.prototype._update=function(t,e){this._prepareBlock(t,e);var n=this.W,r=this.h[0],i=this.h[1],o=this.h[2],a=this.h[3],s=this.h[4],u=this.h[5],c=this.h[6],l=this.h[7],h=this.h[8],d=this.h[9],f=this.h[10],p=this.h[11],m=this.h[12],g=this.h[13],y=this.h[14],b=this.h[15];BR(this.k.length===n.length);for(var v=0;v<n.length;v+=2){var w=y,M=b,_=sB(h,d),E=uB(h,d),N=eB(h,d,f,p,m),L=nB(h,d,f,p,m,g),S=this.k[v],A=this.k[v+1],x=n[v],T=n[v+1],I=qR(w,M,_,E,N,L,S,A,x,T),k=JR(w,M,_,E,N,L,S,A,x,T);w=oB(r,i),M=aB(r,i),_=rB(r,i,o,a,s),E=iB(r,i,o,a,s,u);var j=HR(w,M,_,E),C=GR(w,M,_,E);y=m,b=g,m=f,g=p,f=h,p=d,h=HR(c,l,I,k),d=GR(l,l,I,k),c=s,l=u,s=o,u=a,o=r,a=i,r=HR(I,k,j,C),i=GR(I,k,j,C)}QR(this.h,0,r,i),QR(this.h,2,o,a),QR(this.h,4,s,u),QR(this.h,6,c,l),QR(this.h,8,h,d),QR(this.h,10,f,p),QR(this.h,12,m,g),QR(this.h,14,y,b)},$R.prototype._digest=function(t){return"hex"===t?PR.toHex32(this.h,"big"):PR.split32(this.h,"big")};var fB=WP,pB=tB;function mB(){if(!(this instanceof mB))return new mB;pB.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}fB.inherits(mB,pB);var gB=mB;mB.blockSize=1024,mB.outSize=384,mB.hmacStrength=192,mB.padLength=128,mB.prototype._digest=function(t){return"hex"===t?fB.toHex32(this.h.slice(0,12),"big"):fB.split32(this.h.slice(0,12),"big")},$P.sha1=mR,$P.sha224=zR,$P.sha256=jR,$P.sha384=gB,$P.sha512=tB;var yB={},bB=WP,vB=qP,wB=bB.rotl32,MB=bB.sum32,_B=bB.sum32_3,EB=bB.sum32_4,NB=vB.BlockHash;function LB(){if(!(this instanceof LB))return new LB;NB.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function SB(t,e,n,r){return t<=15?e^n^r:t<=31?e&n|~e&r:t<=47?(e|~n)^r:t<=63?e&r|n&~r:e^(n|~r)}function AB(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function xB(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}bB.inherits(LB,NB),yB.ripemd160=LB,LB.blockSize=512,LB.outSize=160,LB.hmacStrength=192,LB.padLength=64,LB.prototype._update=function(t,e){for(var n=this.h[0],r=this.h[1],i=this.h[2],o=this.h[3],a=this.h[4],s=n,u=r,c=i,l=o,h=a,d=0;d<80;d++){var f=MB(wB(EB(n,SB(d,r,i,o),t[TB[d]+e],AB(d)),kB[d]),a);n=a,a=o,o=wB(i,10),i=r,r=f,f=MB(wB(EB(s,SB(79-d,u,c,l),t[IB[d]+e],xB(d)),jB[d]),h),s=h,h=l,l=wB(c,10),c=u,u=f}f=_B(this.h[1],i,l),this.h[1]=_B(this.h[2],o,h),this.h[2]=_B(this.h[3],a,s),this.h[3]=_B(this.h[4],n,u),this.h[4]=_B(this.h[0],r,c),this.h[0]=f},LB.prototype._digest=function(t){return"hex"===t?bB.toHex32(this.h,"little"):bB.split32(this.h,"little")};var TB=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],IB=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],kB=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],jB=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],CB=WP,DB=tP;function OB(t,e,n){if(!(this instanceof OB))return new OB(t,e,n);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(CB.toArray(e,n))}var zB,PB,RB=OB;OB.prototype._init=function(t){t.length>this.blockSize&&(t=(new this.Hash).update(t).digest()),DB(t.length<=this.blockSize);for(var e=t.length;e<this.blockSize;e++)t.push(0);for(e=0;e<t.length;e++)t[e]^=54;for(this.inner=(new this.Hash).update(t),e=0;e<t.length;e++)t[e]^=106;this.outer=(new this.Hash).update(t)},OB.prototype.update=function(t,e){return this.inner.update(t,e),this},OB.prototype.digest=function(t){return this.outer.update(this.inner.digest()),this.outer.digest(t)},function(t){var e=FP;e.utils=WP,e.common=qP,e.sha=$P,e.ripemd=yB,e.hmac=RB,e.sha1=e.sha.sha1,e.sha256=e.sha.sha256,e.sha224=e.sha.sha224,e.sha384=e.sha.sha384,e.sha512=e.sha.sha512,e.ripemd160=e.ripemd.ripemd160}(),function(t){var e,n=UP,r=FP,i=sP,o=Xz.assert;function a(t){"short"===t.type?this.curve=new i.short(t):"edwards"===t.type?this.curve=new i.edwards(t):this.curve=new i.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,o(this.g.validate(),"Invalid curve"),o(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function s(t,e){Object.defineProperty(n,t,{configurable:!0,enumerable:!0,get:function(){var r=new a(e);return Object.defineProperty(n,t,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=a,s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:r.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:r.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:r.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:r.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:r.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{e=PB?zB:(PB=1,zB={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}})}catch(t){e=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:r.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",e]})}();var BB=FP,UB=nP,FB=tP;function WB(t){if(!(this instanceof WB))return new WB(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=UB.toArray(t.entropy,t.entropyEnc||"hex"),n=UB.toArray(t.nonce,t.nonceEnc||"hex"),r=UB.toArray(t.pers,t.persEnc||"hex");FB(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,n,r)}var YB=WB;WB.prototype._init=function(t,e,n){var r=t.concat(e).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i<this.V.length;i++)this.K[i]=0,this.V[i]=1;this._update(r),this._reseed=1,this.reseedInterval=281474976710656},WB.prototype._hmac=function(){return new BB.hmac(this.hash,this.K)},WB.prototype._update=function(t){var e=this._hmac().update(this.V).update([0]);t&&(e=e.update(t)),this.K=e.digest(),this.V=this._hmac().update(this.V).digest(),t&&(this.K=this._hmac().update(this.V).update([1]).update(t).digest(),this.V=this._hmac().update(this.V).digest())},WB.prototype.reseed=function(t,e,n,r){"string"!=typeof e&&(r=n,n=e,e=null),t=UB.toArray(t,e),n=UB.toArray(n,r),FB(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(n||[])),this._reseed=1},WB.prototype.generate=function(t,e,n,r){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(r=n,n=e,e=null),n&&(n=UB.toArray(n,r||"hex"),this._update(n));for(var i=[];i.length<t;)this.V=this._hmac().update(this.V).digest(),i=i.concat(this.V);var o=i.slice(0,t);return this._update(n),this._reseed++,UB.encode(o,e)};var QB=$z.exports,HB=Xz.assert;function GB(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}var ZB=GB;GB.fromPublic=function(t,e,n){return e instanceof GB?e:new GB(t,{pub:e,pubEnc:n})},GB.fromPrivate=function(t,e,n){return e instanceof GB?e:new GB(t,{priv:e,privEnc:n})},GB.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},GB.prototype.getPublic=function(t,e){return"string"==typeof t&&(e=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),e?this.pub.encode(e,t):this.pub},GB.prototype.getPrivate=function(t){return"hex"===t?this.priv.toString(16,2):this.priv},GB.prototype._importPrivate=function(t,e){this.priv=new QB(t,e||16),this.priv=this.priv.umod(this.ec.curve.n)},GB.prototype._importPublic=function(t,e){if(t.x||t.y)return"mont"===this.ec.curve.type?HB(t.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||HB(t.x&&t.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(t.x,t.y));this.pub=this.ec.curve.decodePoint(t,e)},GB.prototype.derive=function(t){return t.validate()||HB(t.validate(),"public point not validated"),t.mul(this.priv).getX()},GB.prototype.sign=function(t,e,n){return this.ec.sign(t,this,e,n)},GB.prototype.verify=function(t,e){return this.ec.verify(t,e,this)},GB.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var VB=$z.exports,qB=Xz,JB=qB.assert;function KB(t,e){if(t instanceof KB)return t;this._importDER(t,e)||(JB(t.r&&t.s,"Signature without r or s"),this.r=new VB(t.r,16),this.s=new VB(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var XB=KB;function $B(){this.place=0}function tU(t,e){var n=t[e.place++];if(!(128&n))return n;var r=15&n;if(0===r||r>4)return!1;for(var i=0,o=0,a=e.place;o<r;o++,a++)i<<=8,i|=t[a],i>>>=0;return!(i<=127)&&(e.place=a,i)}function eU(t){for(var e=0,n=t.length-1;!t[e]&&!(128&t[e+1])&&e<n;)e++;return 0===e?t:t.slice(e)}function nU(t,e){if(e<128)t.push(e);else{var n=1+(Math.log(e)/Math.LN2>>>3);for(t.push(128|n);--n;)t.push(e>>>(n<<3)&255);t.push(e)}}KB.prototype._importDER=function(t,e){t=qB.toArray(t,e);var n=new $B;if(48!==t[n.place++])return!1;var r=tU(t,n);if(!1===r)return!1;if(r+n.place!==t.length)return!1;if(2!==t[n.place++])return!1;var i=tU(t,n);if(!1===i)return!1;var o=t.slice(n.place,i+n.place);if(n.place+=i,2!==t[n.place++])return!1;var a=tU(t,n);if(!1===a)return!1;if(t.length!==a+n.place)return!1;var s=t.slice(n.place,a+n.place);if(0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}return this.r=new VB(o),this.s=new VB(s),this.recoveryParam=null,!0},KB.prototype.toDER=function(t){var e=this.r.toArray(),n=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&n[0]&&(n=[0].concat(n)),e=eU(e),n=eU(n);!(n[0]||128&n[1]);)n=n.slice(1);var r=[2];nU(r,e.length),(r=r.concat(e)).push(2),nU(r,n.length);var i=r.concat(n),o=[48];return nU(o,i.length),o=o.concat(i),qB.encode(o,t)};var rU=$z.exports,iU=YB,oU=Xz,aU=UP,sU=iP.exports,uU=oU.assert,cU=ZB,lU=XB;function hU(t){if(!(this instanceof hU))return new hU(t);"string"==typeof t&&(uU(Object.prototype.hasOwnProperty.call(aU,t),"Unknown curve "+t),t=aU[t]),t instanceof aU.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var dU=hU;hU.prototype.keyPair=function(t){return new cU(this,t)},hU.prototype.keyFromPrivate=function(t,e){return cU.fromPrivate(this,t,e)},hU.prototype.keyFromPublic=function(t,e){return cU.fromPublic(this,t,e)},hU.prototype.genKeyPair=function(t){t||(t={});for(var e=new iU({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||sU(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),r=this.n.sub(new rU(2));;){var i=new rU(e.generate(n));if(!(i.cmp(r)>0))return i.iaddn(1),this.keyFromPrivate(i)}},hU.prototype._truncateToN=function(t,e){var n=8*t.byteLength()-this.n.bitLength();return n>0&&(t=t.ushrn(n)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},hU.prototype.sign=function(t,e,n,r){"object"==typeof n&&(r=n,n=null),r||(r={}),e=this.keyFromPrivate(e,n),t=this._truncateToN(new rU(t,16));for(var i=this.n.byteLength(),o=e.getPrivate().toArray("be",i),a=t.toArray("be",i),s=new iU({hash:this.hash,entropy:o,nonce:a,pers:r.pers,persEnc:r.persEnc||"utf8"}),u=this.n.sub(new rU(1)),c=0;;c++){var l=r.k?r.k(c):new rU(s.generate(this.n.byteLength()));if(!((l=this._truncateToN(l,!0)).cmpn(1)<=0||l.cmp(u)>=0)){var h=this.g.mul(l);if(!h.isInfinity()){var d=h.getX(),f=d.umod(this.n);if(0!==f.cmpn(0)){var p=l.invm(this.n).mul(f.mul(e.getPrivate()).iadd(t));if(0!==(p=p.umod(this.n)).cmpn(0)){var m=(h.getY().isOdd()?1:0)|(0!==d.cmp(f)?2:0);return r.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),m^=1),new lU({r:f,s:p,recoveryParam:m})}}}}}},hU.prototype.verify=function(t,e,n,r){t=this._truncateToN(new rU(t,16)),n=this.keyFromPublic(n,r);var i=(e=new lU(e,"hex")).r,o=e.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a,s=o.invm(this.n),u=s.mul(t).umod(this.n),c=s.mul(i).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(u,n.getPublic(),c)).isInfinity()&&a.eqXToP(i):!(a=this.g.mulAdd(u,n.getPublic(),c)).isInfinity()&&0===a.getX().umod(this.n).cmp(i)},hU.prototype.recoverPubKey=function(t,e,n,r){uU((3&n)===n,"The recovery param is more than two bits"),e=new lU(e,r);var i=this.n,o=new rU(t),a=e.r,s=e.s,u=1&n,c=n>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&c)throw new Error("Unable to find sencond key candinate");a=c?this.curve.pointFromX(a.add(this.curve.n),u):this.curve.pointFromX(a,u);var l=e.r.invm(i),h=i.sub(o).mul(l).umod(i),d=s.mul(l).umod(i);return this.g.mulAdd(h,a,d)},hU.prototype.getKeyRecoveryParam=function(t,e,n,r){if(null!==(e=new lU(e,r)).recoveryParam)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch(t){continue}if(o.eq(n))return i}throw new Error("Unable to find valid recovery factor")};var fU=Xz,pU=fU.assert,mU=fU.parseBytes,gU=fU.cachedProperty;function yU(t,e){this.eddsa=t,this._secret=mU(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=mU(e.pub)}yU.fromPublic=function(t,e){return e instanceof yU?e:new yU(t,{pub:e})},yU.fromSecret=function(t,e){return e instanceof yU?e:new yU(t,{secret:e})},yU.prototype.secret=function(){return this._secret},gU(yU,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),gU(yU,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),gU(yU,"privBytes",(function(){var t=this.eddsa,e=this.hash(),n=t.encodingLength-1,r=e.slice(0,t.encodingLength);return r[0]&=248,r[n]&=127,r[n]|=64,r})),gU(yU,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),gU(yU,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),gU(yU,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),yU.prototype.sign=function(t){return pU(this._secret,"KeyPair can only verify"),this.eddsa.sign(t,this)},yU.prototype.verify=function(t,e){return this.eddsa.verify(t,e,this)},yU.prototype.getSecret=function(t){return pU(this._secret,"KeyPair is public only"),fU.encode(this.secret(),t)},yU.prototype.getPublic=function(t){return fU.encode(this.pubBytes(),t)};var bU=yU,vU=$z.exports,wU=Xz,MU=wU.assert,_U=wU.cachedProperty,EU=wU.parseBytes;function NU(t,e){this.eddsa=t,"object"!=typeof e&&(e=EU(e)),Array.isArray(e)&&(e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),MU(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof vU&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}_U(NU,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),_U(NU,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),_U(NU,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),_U(NU,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),NU.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},NU.prototype.toHex=function(){return wU.encode(this.toBytes(),"hex").toUpperCase()};var LU=NU,SU=FP,AU=UP,xU=Xz,TU=xU.assert,IU=xU.parseBytes,kU=bU,jU=LU;function CU(t){if(TU("ed25519"===t,"only tested with ed25519 so far"),!(this instanceof CU))return new CU(t);t=AU[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=SU.sha512}var DU=CU;CU.prototype.sign=function(t,e){t=IU(t);var n=this.keyFromSecret(e),r=this.hashInt(n.messagePrefix(),t),i=this.g.mul(r),o=this.encodePoint(i),a=this.hashInt(o,n.pubBytes(),t).mul(n.priv()),s=r.add(a).umod(this.curve.n);return this.makeSignature({R:i,S:s,Rencoded:o})},CU.prototype.verify=function(t,e,n){t=IU(t),e=this.makeSignature(e);var r=this.keyFromPublic(n),i=this.hashInt(e.Rencoded(),r.pubBytes(),t),o=this.g.mul(e.S());return e.R().add(r.pub().mul(i)).eq(o)},CU.prototype.hashInt=function(){for(var t=this.hash(),e=0;e<arguments.length;e++)t.update(arguments[e]);return xU.intFromLE(t.digest()).umod(this.curve.n)},CU.prototype.keyFromPublic=function(t){return kU.fromPublic(this,t)},CU.prototype.keyFromSecret=function(t){return kU.fromSecret(this,t)},CU.prototype.makeSignature=function(t){return t instanceof jU?t:new jU(this,t)},CU.prototype.encodePoint=function(t){var e=t.getY().toArray("le",this.encodingLength);return e[this.encodingLength-1]|=t.getX().isOdd()?128:0,e},CU.prototype.decodePoint=function(t){var e=(t=xU.parseBytes(t)).length-1,n=t.slice(0,e).concat(-129&t[e]),r=0!=(128&t[e]),i=xU.intFromLE(n);return this.curve.pointFromY(i,r)},CU.prototype.encodeInt=function(t){return t.toArray("le",this.encodingLength)},CU.prototype.decodeInt=function(t){return xU.intFromLE(t)},CU.prototype.isPoint=function(t){return t instanceof this.pointClass},function(t){var e=Jz;e.version=Kz,e.utils=Xz,e.rand=iP.exports,e.curve=sP,e.curves=UP,e.ec=dU,e.eddsa=DU}();const OU=new(0,Jz.ec)("secp256k1"),zU=OU.curve,PU=zU.n.constructor;function RU(t){const e=t[0];switch(e){case 2:case 3:return 33!==t.length?null:function(t,e){let n=new PU(e);if(n.cmp(zU.p)>=0)return null;n=n.toRed(zU.red);let r=n.redSqr().redIMul(n).redIAdd(zU.b).redSqrt();return 3===t!==r.isOdd()&&(r=r.redNeg()),OU.keyPair({pub:{x:n,y:r}})}(e,t.subarray(1,33));case 4:case 6:case 7:return 65!==t.length?null:function(t,e,n){let r=new PU(e),i=new PU(n);if(r.cmp(zU.p)>=0||i.cmp(zU.p)>=0)return null;if(r=r.toRed(zU.red),i=i.toRed(zU.red),(6===t||7===t)&&i.isOdd()!==(7===t))return null;const o=r.redSqr().redIMul(r);return i.redSqr().redISub(o.redIAdd(zU.b)).isZero()?OU.keyPair({pub:{x:r,y:i}}):null}(e,t.subarray(1,33),t.subarray(33,65));default:return null}}function BU(t,e){const n=e.encode(null,33===t.length);for(let e=0;e<t.length;++e)t[e]=n[e]}var UU={contextRandomize:()=>0,privateKeyVerify(t){const e=new PU(t);return e.cmp(zU.n)<0&&!e.isZero()?0:1},privateKeyNegate(t){const e=new PU(t),n=zU.n.sub(e).umod(zU.n).toArrayLike(Uint8Array,"be",32);return t.set(n),0},privateKeyTweakAdd(t,e){const n=new PU(e);if(n.cmp(zU.n)>=0)return 1;if(n.iadd(new PU(t)),n.cmp(zU.n)>=0&&n.isub(zU.n),n.isZero())return 1;const r=n.toArrayLike(Uint8Array,"be",32);return t.set(r),0},privateKeyTweakMul(t,e){let n=new PU(e);if(n.cmp(zU.n)>=0||n.isZero())return 1;n.imul(new PU(t)),n.cmp(zU.n)>=0&&(n=n.umod(zU.n));const r=n.toArrayLike(Uint8Array,"be",32);return t.set(r),0},publicKeyVerify:t=>null===RU(t)?1:0,publicKeyCreate(t,e){const n=new PU(e);if(n.cmp(zU.n)>=0||n.isZero())return 1;return BU(t,OU.keyFromPrivate(e).getPublic()),0},publicKeyConvert(t,e){const n=RU(e);if(null===n)return 1;return BU(t,n.getPublic()),0},publicKeyNegate(t,e){const n=RU(e);if(null===n)return 1;const r=n.getPublic();return r.y=r.y.redNeg(),BU(t,r),0},publicKeyCombine(t,e){const n=new Array(e.length);for(let t=0;t<e.length;++t)if(n[t]=RU(e[t]),null===n[t])return 1;let r=n[0].getPublic();for(let t=1;t<n.length;++t)r=r.add(n[t].pub);return r.isInfinity()?2:(BU(t,r),0)},publicKeyTweakAdd(t,e,n){const r=RU(e);if(null===r)return 1;if((n=new PU(n)).cmp(zU.n)>=0)return 2;const i=r.getPublic().add(zU.g.mul(n));return i.isInfinity()?2:(BU(t,i),0)},publicKeyTweakMul(t,e,n){const r=RU(e);if(null===r)return 1;if((n=new PU(n)).cmp(zU.n)>=0||n.isZero())return 2;return BU(t,r.getPublic().mul(n)),0},signatureNormalize(t){const e=new PU(t.subarray(0,32)),n=new PU(t.subarray(32,64));return e.cmp(zU.n)>=0||n.cmp(zU.n)>=0?1:(1===n.cmp(OU.nh)&&t.set(zU.n.sub(n).toArrayLike(Uint8Array,"be",32),32),0)},signatureExport(t,e){const n=e.subarray(0,32),r=e.subarray(32,64);if(new PU(n).cmp(zU.n)>=0)return 1;if(new PU(r).cmp(zU.n)>=0)return 1;const{output:i}=t;let o=i.subarray(4,37);o[0]=0,o.set(n,1);let a=33,s=0;for(;a>1&&0===o[s]&&!(128&o[s+1]);--a,++s);if(o=o.subarray(s),128&o[0])return 1;if(a>1&&0===o[0]&&!(128&o[1]))return 1;let u=i.subarray(39,72);u[0]=0,u.set(r,1);let c=33,l=0;for(;c>1&&0===u[l]&&!(128&u[l+1]);--c,++l);return u=u.subarray(l),128&u[0]||c>1&&0===u[0]&&!(128&u[1])?1:(t.outputlen=6+a+c,i[0]=48,i[1]=t.outputlen-2,i[2]=2,i[3]=o.length,i.set(o,4),i[4+a]=2,i[5+a]=u.length,i.set(u,6+a),0)},signatureImport(t,e){if(e.length<8)return 1;if(e.length>72)return 1;if(48!==e[0])return 1;if(e[1]!==e.length-2)return 1;if(2!==e[2])return 1;const n=e[3];if(0===n)return 1;if(5+n>=e.length)return 1;if(2!==e[4+n])return 1;const r=e[5+n];if(0===r)return 1;if(6+n+r!==e.length)return 1;if(128&e[4])return 1;if(n>1&&0===e[4]&&!(128&e[5]))return 1;if(128&e[n+6])return 1;if(r>1&&0===e[n+6]&&!(128&e[n+7]))return 1;let i=e.subarray(4,4+n);if(33===i.length&&0===i[0]&&(i=i.subarray(1)),i.length>32)return 1;let o=e.subarray(6+n);if(33===o.length&&0===o[0]&&(o=o.slice(1)),o.length>32)throw new Error("S length is too long");let a=new PU(i);a.cmp(zU.n)>=0&&(a=new PU(0));let s=new PU(e.subarray(6+n));return s.cmp(zU.n)>=0&&(s=new PU(0)),t.set(a.toArrayLike(Uint8Array,"be",32),0),t.set(s.toArrayLike(Uint8Array,"be",32),32),0},ecdsaSign(t,e,n,r,i){if(i){const t=i;i=i=>{const o=t(e,n,null,r,i);if(!(o instanceof Uint8Array&&32===o.length))throw new Error("This is the way");return new PU(o)}}const o=new PU(n);if(o.cmp(zU.n)>=0||o.isZero())return 1;let a;try{a=OU.sign(e,n,{canonical:!0,k:i,pers:r})}catch(t){return 1}return t.signature.set(a.r.toArrayLike(Uint8Array,"be",32),0),t.signature.set(a.s.toArrayLike(Uint8Array,"be",32),32),t.recid=a.recoveryParam,0},ecdsaVerify(t,e,n){const r={r:t.subarray(0,32),s:t.subarray(32,64)},i=new PU(r.r),o=new PU(r.s);if(i.cmp(zU.n)>=0||o.cmp(zU.n)>=0)return 1;if(1===o.cmp(OU.nh)||i.isZero()||o.isZero())return 3;const a=RU(n);if(null===a)return 2;const s=a.getPublic();return OU.verify(e,r,s)?0:3},ecdsaRecover(t,e,n,r){const i={r:e.slice(0,32),s:e.slice(32,64)},o=new PU(i.r),a=new PU(i.s);if(o.cmp(zU.n)>=0||a.cmp(zU.n)>=0)return 1;if(o.isZero()||a.isZero())return 2;let s;try{s=OU.recoverPubKey(r,i,n)}catch(t){return 2}return BU(t,s),0},ecdh(t,e,n,r,i,o,a){const s=RU(e);if(null===s)return 1;const u=new PU(n);if(u.cmp(zU.n)>=0||u.isZero())return 2;const c=s.getPublic().mul(u);if(void 0===i){const e=c.encode(null,!0),n=OU.hash().update(e).digest();for(let e=0;e<32;++e)t[e]=n[e]}else{o||(o=new Uint8Array(32));const e=c.getX().toArray("be",32);for(let t=0;t<32;++t)o[t]=e[t];a||(a=new Uint8Array(32));const n=c.getY().toArray("be",32);for(let t=0;t<32;++t)a[t]=n[t];const s=i(o,a,r);if(!(s instanceof Uint8Array&&s.length===t.length))return 2;t.set(s)}return 0}},FU=(t=>({contextRandomize(e){if(Hz(null===e||e instanceof Uint8Array,"Expected seed to be an Uint8Array or null"),null!==e&&Gz("seed",e,32),1===t.contextRandomize(e))throw new Error(zz)},privateKeyVerify:e=>(Gz("private key",e,32),0===t.privateKeyVerify(e)),privateKeyNegate(e){switch(Gz("private key",e,32),t.privateKeyNegate(e)){case 0:return e;case 1:throw new Error(Cz)}},privateKeyTweakAdd(e,n){switch(Gz("private key",e,32),Gz("tweak",n,32),t.privateKeyTweakAdd(e,n)){case 0:return e;case 1:throw new Error(Dz)}},privateKeyTweakMul(e,n){switch(Gz("private key",e,32),Gz("tweak",n,32),t.privateKeyTweakMul(e,n)){case 0:return e;case 1:throw new Error(Oz)}},publicKeyVerify:e=>(Gz("public key",e,[33,65]),0===t.publicKeyVerify(e)),publicKeyCreate(e,n=!0,r){switch(Gz("private key",e,32),Zz(n),r=Vz(r,n?33:65),t.publicKeyCreate(r,e)){case 0:return r;case 1:throw new Error(Pz);case 2:throw new Error(Bz)}},publicKeyConvert(e,n=!0,r){switch(Gz("public key",e,[33,65]),Zz(n),r=Vz(r,n?33:65),t.publicKeyConvert(r,e)){case 0:return r;case 1:throw new Error(Rz);case 2:throw new Error(Bz)}},publicKeyNegate(e,n=!0,r){switch(Gz("public key",e,[33,65]),Zz(n),r=Vz(r,n?33:65),t.publicKeyNegate(r,e)){case 0:return r;case 1:throw new Error(Rz);case 2:throw new Error(Cz);case 3:throw new Error(Bz)}},publicKeyCombine(e,n=!0,r){Hz(Array.isArray(e),"Expected public keys to be an Array"),Hz(e.length>0,"Expected public keys array will have more than zero items");for(const t of e)Gz("public key",t,[33,65]);switch(Zz(n),r=Vz(r,n?33:65),t.publicKeyCombine(r,e)){case 0:return r;case 1:throw new Error(Rz);case 2:throw new Error(Uz);case 3:throw new Error(Bz)}},publicKeyTweakAdd(e,n,r=!0,i){switch(Gz("public key",e,[33,65]),Gz("tweak",n,32),Zz(r),i=Vz(i,r?33:65),t.publicKeyTweakAdd(i,e,n)){case 0:return i;case 1:throw new Error(Rz);case 2:throw new Error(Dz)}},publicKeyTweakMul(e,n,r=!0,i){switch(Gz("public key",e,[33,65]),Gz("tweak",n,32),Zz(r),i=Vz(i,r?33:65),t.publicKeyTweakMul(i,e,n)){case 0:return i;case 1:throw new Error(Rz);case 2:throw new Error(Oz)}},signatureNormalize(e){switch(Gz("signature",e,64),t.signatureNormalize(e)){case 0:return e;case 1:throw new Error(Fz)}},signatureExport(e,n){Gz("signature",e,64);const r={output:n=Vz(n,72),outputlen:72};switch(t.signatureExport(r,e)){case 0:return n.slice(0,r.outputlen);case 1:throw new Error(Fz);case 2:throw new Error(Cz)}},signatureImport(e,n){switch(Gz("signature",e),n=Vz(n,64),t.signatureImport(n,e)){case 0:return n;case 1:throw new Error(Fz);case 2:throw new Error(Cz)}},ecdsaSign(e,n,r={},i){Gz("message",e,32),Gz("private key",n,32),Hz("Object"===qz(r),"Expected options to be an Object"),void 0!==r.data&&Gz("options.data",r.data),void 0!==r.noncefn&&Hz("Function"===qz(r.noncefn),"Expected options.noncefn to be a Function");const o={signature:i=Vz(i,64),recid:null};switch(t.ecdsaSign(o,e,n,r.data,r.noncefn)){case 0:return o;case 1:throw new Error(Wz);case 2:throw new Error(Cz)}},ecdsaVerify(e,n,r){switch(Gz("signature",e,64),Gz("message",n,32),Gz("public key",r,[33,65]),t.ecdsaVerify(e,n,r)){case 0:return!0;case 3:return!1;case 1:throw new Error(Fz);case 2:throw new Error(Rz)}},ecdsaRecover(e,n,r,i=!0,o){switch(Gz("signature",e,64),Hz("Number"===qz(n)&&n>=0&&n<=3,"Expected recovery id to be a Number within interval [0, 3]"),Gz("message",r,32),Zz(i),o=Vz(o,i?33:65),t.ecdsaRecover(o,e,n,r)){case 0:return o;case 1:throw new Error(Fz);case 2:throw new Error(Yz);case 3:throw new Error(Cz)}},ecdh(e,n,r={},i){switch(Gz("public key",e,[33,65]),Gz("private key",n,32),Hz("Object"===qz(r),"Expected options to be an Object"),void 0!==r.data&&Gz("options.data",r.data),void 0!==r.hashfn?(Hz("Function"===qz(r.hashfn),"Expected options.hashfn to be a Function"),void 0!==r.xbuf&&Gz("options.xbuf",r.xbuf,32),void 0!==r.ybuf&&Gz("options.ybuf",r.ybuf,32),Gz("output",i)):i=Vz(i,32),t.ecdh(i,e,n,r.data,r.hashfn,r.xbuf,r.ybuf)){case 0:return i;case 1:throw new Error(Rz);case 2:throw new Error(Qz)}}}))(UU),WU=FU,YU={exports:{}};!function(t){!function(){var e="input is invalid type",n="object"==typeof window,r=n?window:{};r.JS_SHA3_NO_WINDOW&&(n=!1);var i=!n&&"object"==typeof self;!r.JS_SHA3_NO_NODE_JS&&"object"==typeof fS&&fS.versions&&fS.versions.node?r=KM:i&&(r=self);var o=!r.JS_SHA3_NO_COMMON_JS&&t.exports,a=!r.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,s="0123456789abcdef".split(""),u=[4,1024,262144,67108864],c=[0,8,16,24],l=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],h=[224,256,384,512],d=[128,256],f=["hex","buffer","arrayBuffer","array","digest"],p={128:168,256:136};!r.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),!a||!r.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(t){return"object"==typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer});for(var m=function(t,e,n){return function(r){return new I(t,e,t).update(r)[n]()}},g=function(t,e,n){return function(r,i){return new I(t,e,i).update(r)[n]()}},y=function(t,e,n){return function(e,r,i,o){return _["cshake"+t].update(e,r,i,o)[n]()}},b=function(t,e,n){return function(e,r,i,o){return _["kmac"+t].update(e,r,i,o)[n]()}},v=function(t,e,n,r){for(var i=0;i<f.length;++i){var o=f[i];t[o]=e(n,r,o)}return t},w=function(t,e){var n=m(t,e,"hex");return n.create=function(){return new I(t,e,t)},n.update=function(t){return n.create().update(t)},v(n,m,t,e)},M=[{name:"keccak",padding:[1,256,65536,16777216],bits:h,createMethod:w},{name:"sha3",padding:[6,1536,393216,100663296],bits:h,createMethod:w},{name:"shake",padding:[31,7936,2031616,520093696],bits:d,createMethod:function(t,e){var n=g(t,e,"hex");return n.create=function(n){return new I(t,e,n)},n.update=function(t,e){return n.create(e).update(t)},v(n,g,t,e)}},{name:"cshake",padding:u,bits:d,createMethod:function(t,e){var n=p[t],r=y(t,0,"hex");return r.create=function(r,i,o){return i||o?new I(t,e,r).bytepad([i,o],n):_["shake"+t].create(r)},r.update=function(t,e,n,i){return r.create(e,n,i).update(t)},v(r,y,t,e)}},{name:"kmac",padding:u,bits:d,createMethod:function(t,e){var n=p[t],r=b(t,0,"hex");return r.create=function(r,i,o){return new k(t,e,i).bytepad(["KMAC",o],n).bytepad([r],n)},r.update=function(t,e,n,i){return r.create(t,n,i).update(e)},v(r,b,t,e)}}],_={},E=[],N=0;N<M.length;++N)for(var L=M[N],S=L.bits,A=0;A<S.length;++A){var x=L.name+"_"+S[A];if(E.push(x),_[x]=L.createMethod(S[A],L.padding),"sha3"!==L.name){var T=L.name+S[A];E.push(T),_[T]=_[x]}}function I(t,e,n){this.blocks=[],this.s=[],this.padding=e,this.outputBits=n,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(t<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=n>>5,this.extraBytes=(31&n)>>3;for(var r=0;r<50;++r)this.s[r]=0}function k(t,e,n){I.call(this,t,e,n)}I.prototype.update=function(t){if(this.finalized)throw new Error("finalize already called");var n,r=typeof t;if("string"!==r){if("object"!==r)throw new Error(e);if(null===t)throw new Error(e);if(a&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||a&&ArrayBuffer.isView(t)))throw new Error(e);n=!0}for(var i,o,s=this.blocks,u=this.byteCount,l=t.length,h=this.blockCount,d=0,f=this.s;d<l;){if(this.reset)for(this.reset=!1,s[0]=this.block,i=1;i<h+1;++i)s[i]=0;if(n)for(i=this.start;d<l&&i<u;++d)s[i>>2]|=t[d]<<c[3&i++];else for(i=this.start;d<l&&i<u;++d)(o=t.charCodeAt(d))<128?s[i>>2]|=o<<c[3&i++]:o<2048?(s[i>>2]|=(192|o>>6)<<c[3&i++],s[i>>2]|=(128|63&o)<<c[3&i++]):o<55296||o>=57344?(s[i>>2]|=(224|o>>12)<<c[3&i++],s[i>>2]|=(128|o>>6&63)<<c[3&i++],s[i>>2]|=(128|63&o)<<c[3&i++]):(o=65536+((1023&o)<<10|1023&t.charCodeAt(++d)),s[i>>2]|=(240|o>>18)<<c[3&i++],s[i>>2]|=(128|o>>12&63)<<c[3&i++],s[i>>2]|=(128|o>>6&63)<<c[3&i++],s[i>>2]|=(128|63&o)<<c[3&i++]);if(this.lastByteIndex=i,i>=u){for(this.start=i-u,this.block=s[h],i=0;i<h;++i)f[i]^=s[i];j(f),this.reset=!0}else this.start=i}return this},I.prototype.encode=function(t,e){var n=255&t,r=1,i=[n];for(n=255&(t>>=8);n>0;)i.unshift(n),n=255&(t>>=8),++r;return e?i.push(r):i.unshift(r),this.update(i),i.length},I.prototype.encodeString=function(t){var n,r=typeof t;if("string"!==r){if("object"!==r)throw new Error(e);if(null===t)throw new Error(e);if(a&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||a&&ArrayBuffer.isView(t)))throw new Error(e);n=!0}var i=0,o=t.length;if(n)i=o;else for(var s=0;s<t.length;++s){var u=t.charCodeAt(s);u<128?i+=1:u<2048?i+=2:u<55296||u>=57344?i+=3:(u=65536+((1023&u)<<10|1023&t.charCodeAt(++s)),i+=4)}return i+=this.encode(8*i),this.update(t),i},I.prototype.bytepad=function(t,e){for(var n=this.encode(e),r=0;r<t.length;++r)n+=this.encodeString(t[r]);var i=e-n%e,o=[];return o.length=i,this.update(o),this},I.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex,n=this.blockCount,r=this.s;if(t[e>>2]|=this.padding[3&e],this.lastByteIndex===this.byteCount)for(t[0]=t[n],e=1;e<n+1;++e)t[e]=0;for(t[n-1]|=2147483648,e=0;e<n;++e)r[e]^=t[e];j(r)}},I.prototype.toString=I.prototype.hex=function(){this.finalize();for(var t,e=this.blockCount,n=this.s,r=this.outputBlocks,i=this.extraBytes,o=0,a=0,u="";a<r;){for(o=0;o<e&&a<r;++o,++a)t=n[o],u+=s[t>>4&15]+s[15&t]+s[t>>12&15]+s[t>>8&15]+s[t>>20&15]+s[t>>16&15]+s[t>>28&15]+s[t>>24&15];a%e==0&&(j(n),o=0)}return i&&(t=n[o],u+=s[t>>4&15]+s[15&t],i>1&&(u+=s[t>>12&15]+s[t>>8&15]),i>2&&(u+=s[t>>20&15]+s[t>>16&15])),u},I.prototype.arrayBuffer=function(){this.finalize();var t,e=this.blockCount,n=this.s,r=this.outputBlocks,i=this.extraBytes,o=0,a=0,s=this.outputBits>>3;t=i?new ArrayBuffer(r+1<<2):new ArrayBuffer(s);for(var u=new Uint32Array(t);a<r;){for(o=0;o<e&&a<r;++o,++a)u[a]=n[o];a%e==0&&j(n)}return i&&(u[o]=n[o],t=t.slice(0,s)),t},I.prototype.buffer=I.prototype.arrayBuffer,I.prototype.digest=I.prototype.array=function(){this.finalize();for(var t,e,n=this.blockCount,r=this.s,i=this.outputBlocks,o=this.extraBytes,a=0,s=0,u=[];s<i;){for(a=0;a<n&&s<i;++a,++s)t=s<<2,e=r[a],u[t]=255&e,u[t+1]=e>>8&255,u[t+2]=e>>16&255,u[t+3]=e>>24&255;s%n==0&&j(r)}return o&&(t=s<<2,e=r[a],u[t]=255&e,o>1&&(u[t+1]=e>>8&255),o>2&&(u[t+2]=e>>16&255)),u},k.prototype=new I,k.prototype.finalize=function(){return this.encode(this.outputBits,!0),I.prototype.finalize.call(this)};var j=function(t){var e,n,r,i,o,a,s,u,c,h,d,f,p,m,g,y,b,v,w,M,_,E,N,L,S,A,x,T,I,k,j,C,D,O,z,P,R,B,U,F,W,Y,Q,H,G,Z,V,q,J,K,X,$,tt,et,nt,rt,it,ot,at,st,ut,ct,lt;for(r=0;r<48;r+=2)i=t[0]^t[10]^t[20]^t[30]^t[40],o=t[1]^t[11]^t[21]^t[31]^t[41],a=t[2]^t[12]^t[22]^t[32]^t[42],s=t[3]^t[13]^t[23]^t[33]^t[43],u=t[4]^t[14]^t[24]^t[34]^t[44],c=t[5]^t[15]^t[25]^t[35]^t[45],h=t[6]^t[16]^t[26]^t[36]^t[46],d=t[7]^t[17]^t[27]^t[37]^t[47],e=(f=t[8]^t[18]^t[28]^t[38]^t[48])^(a<<1|s>>>31),n=(p=t[9]^t[19]^t[29]^t[39]^t[49])^(s<<1|a>>>31),t[0]^=e,t[1]^=n,t[10]^=e,t[11]^=n,t[20]^=e,t[21]^=n,t[30]^=e,t[31]^=n,t[40]^=e,t[41]^=n,e=i^(u<<1|c>>>31),n=o^(c<<1|u>>>31),t[2]^=e,t[3]^=n,t[12]^=e,t[13]^=n,t[22]^=e,t[23]^=n,t[32]^=e,t[33]^=n,t[42]^=e,t[43]^=n,e=a^(h<<1|d>>>31),n=s^(d<<1|h>>>31),t[4]^=e,t[5]^=n,t[14]^=e,t[15]^=n,t[24]^=e,t[25]^=n,t[34]^=e,t[35]^=n,t[44]^=e,t[45]^=n,e=u^(f<<1|p>>>31),n=c^(p<<1|f>>>31),t[6]^=e,t[7]^=n,t[16]^=e,t[17]^=n,t[26]^=e,t[27]^=n,t[36]^=e,t[37]^=n,t[46]^=e,t[47]^=n,e=h^(i<<1|o>>>31),n=d^(o<<1|i>>>31),t[8]^=e,t[9]^=n,t[18]^=e,t[19]^=n,t[28]^=e,t[29]^=n,t[38]^=e,t[39]^=n,t[48]^=e,t[49]^=n,m=t[0],g=t[1],Z=t[11]<<4|t[10]>>>28,V=t[10]<<4|t[11]>>>28,T=t[20]<<3|t[21]>>>29,I=t[21]<<3|t[20]>>>29,st=t[31]<<9|t[30]>>>23,ut=t[30]<<9|t[31]>>>23,Y=t[40]<<18|t[41]>>>14,Q=t[41]<<18|t[40]>>>14,O=t[2]<<1|t[3]>>>31,z=t[3]<<1|t[2]>>>31,y=t[13]<<12|t[12]>>>20,b=t[12]<<12|t[13]>>>20,q=t[22]<<10|t[23]>>>22,J=t[23]<<10|t[22]>>>22,k=t[33]<<13|t[32]>>>19,j=t[32]<<13|t[33]>>>19,ct=t[42]<<2|t[43]>>>30,lt=t[43]<<2|t[42]>>>30,et=t[5]<<30|t[4]>>>2,nt=t[4]<<30|t[5]>>>2,P=t[14]<<6|t[15]>>>26,R=t[15]<<6|t[14]>>>26,v=t[25]<<11|t[24]>>>21,w=t[24]<<11|t[25]>>>21,K=t[34]<<15|t[35]>>>17,X=t[35]<<15|t[34]>>>17,C=t[45]<<29|t[44]>>>3,D=t[44]<<29|t[45]>>>3,L=t[6]<<28|t[7]>>>4,S=t[7]<<28|t[6]>>>4,rt=t[17]<<23|t[16]>>>9,it=t[16]<<23|t[17]>>>9,B=t[26]<<25|t[27]>>>7,U=t[27]<<25|t[26]>>>7,M=t[36]<<21|t[37]>>>11,_=t[37]<<21|t[36]>>>11,$=t[47]<<24|t[46]>>>8,tt=t[46]<<24|t[47]>>>8,H=t[8]<<27|t[9]>>>5,G=t[9]<<27|t[8]>>>5,A=t[18]<<20|t[19]>>>12,x=t[19]<<20|t[18]>>>12,ot=t[29]<<7|t[28]>>>25,at=t[28]<<7|t[29]>>>25,F=t[38]<<8|t[39]>>>24,W=t[39]<<8|t[38]>>>24,E=t[48]<<14|t[49]>>>18,N=t[49]<<14|t[48]>>>18,t[0]=m^~y&v,t[1]=g^~b&w,t[10]=L^~A&T,t[11]=S^~x&I,t[20]=O^~P&B,t[21]=z^~R&U,t[30]=H^~Z&q,t[31]=G^~V&J,t[40]=et^~rt&ot,t[41]=nt^~it&at,t[2]=y^~v&M,t[3]=b^~w&_,t[12]=A^~T&k,t[13]=x^~I&j,t[22]=P^~B&F,t[23]=R^~U&W,t[32]=Z^~q&K,t[33]=V^~J&X,t[42]=rt^~ot&st,t[43]=it^~at&ut,t[4]=v^~M&E,t[5]=w^~_&N,t[14]=T^~k&C,t[15]=I^~j&D,t[24]=B^~F&Y,t[25]=U^~W&Q,t[34]=q^~K&$,t[35]=J^~X&tt,t[44]=ot^~st&ct,t[45]=at^~ut<,t[6]=M^~E&m,t[7]=_^~N&g,t[16]=k^~C&L,t[17]=j^~D&S,t[26]=F^~Y&O,t[27]=W^~Q&z,t[36]=K^~$&H,t[37]=X^~tt&G,t[46]=st^~ct&et,t[47]=ut^~lt&nt,t[8]=E^~m&y,t[9]=N^~g&b,t[18]=C^~L&A,t[19]=D^~S&x,t[28]=Y^~O&P,t[29]=Q^~z&R,t[38]=$^~H&Z,t[39]=tt^~G&V,t[48]=ct^~et&rt,t[49]=lt^~nt&it,t[0]^=l[r],t[1]^=l[r+1]};if(o)t.exports=_;else for(N=0;N<E.length;++N)r[E[N]]=_[E[N]]}()}(YU);var QU=YU.exports;const HU=t=>p_.isBuffer(t)?t:t instanceof Uint8Array?p_.from(t.buffer,t.byteOffset,t.byteLength):p_.from(t);var GU={},ZU={},VU=qU;function qU(t,e){if(!t)throw new Error(e||"Assertion failed")}qU.equal=function(t,e,n){if(t!=e)throw new Error(n||"Assertion failed: "+t+" != "+e)};var JU={exports:{}};"function"==typeof Object.create?JU.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:JU.exports=function(t,e){if(e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}};var KU=VU,XU=JU.exports;function $U(t,e){return 55296==(64512&t.charCodeAt(e))&&(!(e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1)))}function tF(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function eF(t){return 1===t.length?"0"+t:t}function nF(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}ZU.inherits=XU,ZU.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var n=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),i=0;i<t.length;i+=2)n.push(parseInt(t[i]+t[i+1],16))}else for(var r=0,i=0;i<t.length;i++){var o=t.charCodeAt(i);o<128?n[r++]=o:o<2048?(n[r++]=o>>6|192,n[r++]=63&o|128):$U(t,i)?(o=65536+((1023&o)<<10)+(1023&t.charCodeAt(++i)),n[r++]=o>>18|240,n[r++]=o>>12&63|128,n[r++]=o>>6&63|128,n[r++]=63&o|128):(n[r++]=o>>12|224,n[r++]=o>>6&63|128,n[r++]=63&o|128)}else for(i=0;i<t.length;i++)n[i]=0|t[i];return n},ZU.toHex=function(t){for(var e="",n=0;n<t.length;n++)e+=eF(t[n].toString(16));return e},ZU.htonl=tF,ZU.toHex32=function(t,e){for(var n="",r=0;r<t.length;r++){var i=t[r];"little"===e&&(i=tF(i)),n+=nF(i.toString(16))}return n},ZU.zero2=eF,ZU.zero8=nF,ZU.join32=function(t,e,n,r){var i=n-e;KU(i%4==0);for(var o=new Array(i/4),a=0,s=e;a<o.length;a++,s+=4){var u;u="big"===r?t[s]<<24|t[s+1]<<16|t[s+2]<<8|t[s+3]:t[s+3]<<24|t[s+2]<<16|t[s+1]<<8|t[s],o[a]=u>>>0}return o},ZU.split32=function(t,e){for(var n=new Array(4*t.length),r=0,i=0;r<t.length;r++,i+=4){var o=t[r];"big"===e?(n[i]=o>>>24,n[i+1]=o>>>16&255,n[i+2]=o>>>8&255,n[i+3]=255&o):(n[i+3]=o>>>24,n[i+2]=o>>>16&255,n[i+1]=o>>>8&255,n[i]=255&o)}return n},ZU.rotr32=function(t,e){return t>>>e|t<<32-e},ZU.rotl32=function(t,e){return t<<e|t>>>32-e},ZU.sum32=function(t,e){return t+e>>>0},ZU.sum32_3=function(t,e,n){return t+e+n>>>0},ZU.sum32_4=function(t,e,n,r){return t+e+n+r>>>0},ZU.sum32_5=function(t,e,n,r,i){return t+e+n+r+i>>>0},ZU.sum64=function(t,e,n,r){var i=t[e],o=r+t[e+1]>>>0,a=(o<r?1:0)+n+i;t[e]=a>>>0,t[e+1]=o},ZU.sum64_hi=function(t,e,n,r){return(e+r>>>0<e?1:0)+t+n>>>0},ZU.sum64_lo=function(t,e,n,r){return e+r>>>0},ZU.sum64_4_hi=function(t,e,n,r,i,o,a,s){var u=0,c=e;return u+=(c=c+r>>>0)<e?1:0,u+=(c=c+o>>>0)<o?1:0,t+n+i+a+(u+=(c=c+s>>>0)<s?1:0)>>>0},ZU.sum64_4_lo=function(t,e,n,r,i,o,a,s){return e+r+o+s>>>0},ZU.sum64_5_hi=function(t,e,n,r,i,o,a,s,u,c){var l=0,h=e;return l+=(h=h+r>>>0)<e?1:0,l+=(h=h+o>>>0)<o?1:0,l+=(h=h+s>>>0)<s?1:0,t+n+i+a+u+(l+=(h=h+c>>>0)<c?1:0)>>>0},ZU.sum64_5_lo=function(t,e,n,r,i,o,a,s,u,c){return e+r+o+s+c>>>0},ZU.rotr64_hi=function(t,e,n){return(e<<32-n|t>>>n)>>>0},ZU.rotr64_lo=function(t,e,n){return(t<<32-n|e>>>n)>>>0},ZU.shr64_hi=function(t,e,n){return t>>>n},ZU.shr64_lo=function(t,e,n){return(t<<32-n|e>>>n)>>>0};var rF={},iF=ZU,oF=VU;function aF(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}rF.BlockHash=aF,aF.prototype.update=function(t,e){if(t=iF.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){var n=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-n,t.length),0===this.pending.length&&(this.pending=null),t=iF.join32(t,0,t.length-n,this.endian);for(var r=0;r<t.length;r+=this._delta32)this._update(t,r,r+this._delta32)}return this},aF.prototype.digest=function(t){return this.update(this._pad()),oF(null===this.pending),this._digest(t)},aF.prototype._pad=function(){var t=this.pendingTotal,e=this._delta8,n=e-(t+this.padLength)%e,r=new Array(n+this.padLength);r[0]=128;for(var i=1;i<n;i++)r[i]=0;if(t<<=3,"big"===this.endian){for(var o=8;o<this.padLength;o++)r[i++]=0;r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=t>>>24&255,r[i++]=t>>>16&255,r[i++]=t>>>8&255,r[i++]=255&t}else for(r[i++]=255&t,r[i++]=t>>>8&255,r[i++]=t>>>16&255,r[i++]=t>>>24&255,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,o=8;o<this.padLength;o++)r[i++]=0;return r};var sF={},uF={},cF=ZU.rotr32;function lF(t,e,n){return t&e^~t&n}function hF(t,e,n){return t&e^t&n^e&n}function dF(t,e,n){return t^e^n}uF.ft_1=function(t,e,n,r){return 0===t?lF(e,n,r):1===t||3===t?dF(e,n,r):2===t?hF(e,n,r):void 0},uF.ch32=lF,uF.maj32=hF,uF.p32=dF,uF.s0_256=function(t){return cF(t,2)^cF(t,13)^cF(t,22)},uF.s1_256=function(t){return cF(t,6)^cF(t,11)^cF(t,25)},uF.g0_256=function(t){return cF(t,7)^cF(t,18)^t>>>3},uF.g1_256=function(t){return cF(t,17)^cF(t,19)^t>>>10};var fF=ZU,pF=rF,mF=uF,gF=fF.rotl32,yF=fF.sum32,bF=fF.sum32_5,vF=mF.ft_1,wF=pF.BlockHash,MF=[1518500249,1859775393,2400959708,3395469782];function _F(){if(!(this instanceof _F))return new _F;wF.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}fF.inherits(_F,wF);var EF=_F;_F.blockSize=512,_F.outSize=160,_F.hmacStrength=80,_F.padLength=64,_F.prototype._update=function(t,e){for(var n=this.W,r=0;r<16;r++)n[r]=t[e+r];for(;r<n.length;r++)n[r]=gF(n[r-3]^n[r-8]^n[r-14]^n[r-16],1);var i=this.h[0],o=this.h[1],a=this.h[2],s=this.h[3],u=this.h[4];for(r=0;r<n.length;r++){var c=~~(r/20),l=bF(gF(i,5),vF(c,o,a,s),u,n[r],MF[c]);u=s,s=a,a=gF(o,30),o=i,i=l}this.h[0]=yF(this.h[0],i),this.h[1]=yF(this.h[1],o),this.h[2]=yF(this.h[2],a),this.h[3]=yF(this.h[3],s),this.h[4]=yF(this.h[4],u)},_F.prototype._digest=function(t){return"hex"===t?fF.toHex32(this.h,"big"):fF.split32(this.h,"big")};var NF=ZU,LF=rF,SF=uF,AF=VU,xF=NF.sum32,TF=NF.sum32_4,IF=NF.sum32_5,kF=SF.ch32,jF=SF.maj32,CF=SF.s0_256,DF=SF.s1_256,OF=SF.g0_256,zF=SF.g1_256,PF=LF.BlockHash,RF=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function BF(){if(!(this instanceof BF))return new BF;PF.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=RF,this.W=new Array(64)}NF.inherits(BF,PF);var UF=BF;BF.blockSize=512,BF.outSize=256,BF.hmacStrength=192,BF.padLength=64,BF.prototype._update=function(t,e){for(var n=this.W,r=0;r<16;r++)n[r]=t[e+r];for(;r<n.length;r++)n[r]=TF(zF(n[r-2]),n[r-7],OF(n[r-15]),n[r-16]);var i=this.h[0],o=this.h[1],a=this.h[2],s=this.h[3],u=this.h[4],c=this.h[5],l=this.h[6],h=this.h[7];for(AF(this.k.length===n.length),r=0;r<n.length;r++){var d=IF(h,DF(u),kF(u,c,l),this.k[r],n[r]),f=xF(CF(i),jF(i,o,a));h=l,l=c,c=u,u=xF(s,d),s=a,a=o,o=i,i=xF(d,f)}this.h[0]=xF(this.h[0],i),this.h[1]=xF(this.h[1],o),this.h[2]=xF(this.h[2],a),this.h[3]=xF(this.h[3],s),this.h[4]=xF(this.h[4],u),this.h[5]=xF(this.h[5],c),this.h[6]=xF(this.h[6],l),this.h[7]=xF(this.h[7],h)},BF.prototype._digest=function(t){return"hex"===t?NF.toHex32(this.h,"big"):NF.split32(this.h,"big")};var FF=ZU,WF=UF;function YF(){if(!(this instanceof YF))return new YF;WF.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}FF.inherits(YF,WF);var QF=YF;YF.blockSize=512,YF.outSize=224,YF.hmacStrength=192,YF.padLength=64,YF.prototype._digest=function(t){return"hex"===t?FF.toHex32(this.h.slice(0,7),"big"):FF.split32(this.h.slice(0,7),"big")};var HF=ZU,GF=rF,ZF=VU,VF=HF.rotr64_hi,qF=HF.rotr64_lo,JF=HF.shr64_hi,KF=HF.shr64_lo,XF=HF.sum64,$F=HF.sum64_hi,tW=HF.sum64_lo,eW=HF.sum64_4_hi,nW=HF.sum64_4_lo,rW=HF.sum64_5_hi,iW=HF.sum64_5_lo,oW=GF.BlockHash,aW=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function sW(){if(!(this instanceof sW))return new sW;oW.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=aW,this.W=new Array(160)}HF.inherits(sW,oW);var uW=sW;function cW(t,e,n,r,i){var o=t&n^~t&i;return o<0&&(o+=4294967296),o}function lW(t,e,n,r,i,o){var a=e&r^~e&o;return a<0&&(a+=4294967296),a}function hW(t,e,n,r,i){var o=t&n^t&i^n&i;return o<0&&(o+=4294967296),o}function dW(t,e,n,r,i,o){var a=e&r^e&o^r&o;return a<0&&(a+=4294967296),a}function fW(t,e){var n=VF(t,e,28)^VF(e,t,2)^VF(e,t,7);return n<0&&(n+=4294967296),n}function pW(t,e){var n=qF(t,e,28)^qF(e,t,2)^qF(e,t,7);return n<0&&(n+=4294967296),n}function mW(t,e){var n=VF(t,e,14)^VF(t,e,18)^VF(e,t,9);return n<0&&(n+=4294967296),n}function gW(t,e){var n=qF(t,e,14)^qF(t,e,18)^qF(e,t,9);return n<0&&(n+=4294967296),n}function yW(t,e){var n=VF(t,e,1)^VF(t,e,8)^JF(t,e,7);return n<0&&(n+=4294967296),n}function bW(t,e){var n=qF(t,e,1)^qF(t,e,8)^KF(t,e,7);return n<0&&(n+=4294967296),n}function vW(t,e){var n=VF(t,e,19)^VF(e,t,29)^JF(t,e,6);return n<0&&(n+=4294967296),n}function wW(t,e){var n=qF(t,e,19)^qF(e,t,29)^KF(t,e,6);return n<0&&(n+=4294967296),n}sW.blockSize=1024,sW.outSize=512,sW.hmacStrength=192,sW.padLength=128,sW.prototype._prepareBlock=function(t,e){for(var n=this.W,r=0;r<32;r++)n[r]=t[e+r];for(;r<n.length;r+=2){var i=vW(n[r-4],n[r-3]),o=wW(n[r-4],n[r-3]),a=n[r-14],s=n[r-13],u=yW(n[r-30],n[r-29]),c=bW(n[r-30],n[r-29]),l=n[r-32],h=n[r-31];n[r]=eW(i,o,a,s,u,c,l,h),n[r+1]=nW(i,o,a,s,u,c,l,h)}},sW.prototype._update=function(t,e){this._prepareBlock(t,e);var n=this.W,r=this.h[0],i=this.h[1],o=this.h[2],a=this.h[3],s=this.h[4],u=this.h[5],c=this.h[6],l=this.h[7],h=this.h[8],d=this.h[9],f=this.h[10],p=this.h[11],m=this.h[12],g=this.h[13],y=this.h[14],b=this.h[15];ZF(this.k.length===n.length);for(var v=0;v<n.length;v+=2){var w=y,M=b,_=mW(h,d),E=gW(h,d),N=cW(h,d,f,p,m),L=lW(h,d,f,p,m,g),S=this.k[v],A=this.k[v+1],x=n[v],T=n[v+1],I=rW(w,M,_,E,N,L,S,A,x,T),k=iW(w,M,_,E,N,L,S,A,x,T);w=fW(r,i),M=pW(r,i),_=hW(r,i,o,a,s),E=dW(r,i,o,a,s,u);var j=$F(w,M,_,E),C=tW(w,M,_,E);y=m,b=g,m=f,g=p,f=h,p=d,h=$F(c,l,I,k),d=tW(l,l,I,k),c=s,l=u,s=o,u=a,o=r,a=i,r=$F(I,k,j,C),i=tW(I,k,j,C)}XF(this.h,0,r,i),XF(this.h,2,o,a),XF(this.h,4,s,u),XF(this.h,6,c,l),XF(this.h,8,h,d),XF(this.h,10,f,p),XF(this.h,12,m,g),XF(this.h,14,y,b)},sW.prototype._digest=function(t){return"hex"===t?HF.toHex32(this.h,"big"):HF.split32(this.h,"big")};var MW=ZU,_W=uW;function EW(){if(!(this instanceof EW))return new EW;_W.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}MW.inherits(EW,_W);var NW=EW;EW.blockSize=1024,EW.outSize=384,EW.hmacStrength=192,EW.padLength=128,EW.prototype._digest=function(t){return"hex"===t?MW.toHex32(this.h.slice(0,12),"big"):MW.split32(this.h.slice(0,12),"big")},sF.sha1=EF,sF.sha224=QF,sF.sha256=UF,sF.sha384=NW,sF.sha512=uW;var LW={},SW=ZU,AW=rF,xW=SW.rotl32,TW=SW.sum32,IW=SW.sum32_3,kW=SW.sum32_4,jW=AW.BlockHash;function CW(){if(!(this instanceof CW))return new CW;jW.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function DW(t,e,n,r){return t<=15?e^n^r:t<=31?e&n|~e&r:t<=47?(e|~n)^r:t<=63?e&r|n&~r:e^(n|~r)}function OW(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function zW(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}SW.inherits(CW,jW),LW.ripemd160=CW,CW.blockSize=512,CW.outSize=160,CW.hmacStrength=192,CW.padLength=64,CW.prototype._update=function(t,e){for(var n=this.h[0],r=this.h[1],i=this.h[2],o=this.h[3],a=this.h[4],s=n,u=r,c=i,l=o,h=a,d=0;d<80;d++){var f=TW(xW(kW(n,DW(d,r,i,o),t[PW[d]+e],OW(d)),BW[d]),a);n=a,a=o,o=xW(i,10),i=r,r=f,f=TW(xW(kW(s,DW(79-d,u,c,l),t[RW[d]+e],zW(d)),UW[d]),h),s=h,h=l,l=xW(c,10),c=u,u=f}f=IW(this.h[1],i,l),this.h[1]=IW(this.h[2],o,h),this.h[2]=IW(this.h[3],a,s),this.h[3]=IW(this.h[4],n,u),this.h[4]=IW(this.h[0],r,c),this.h[0]=f},CW.prototype._digest=function(t){return"hex"===t?SW.toHex32(this.h,"little"):SW.split32(this.h,"little")};var PW=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],RW=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],BW=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],UW=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],FW=ZU,WW=VU;function YW(t,e,n){if(!(this instanceof YW))return new YW(t,e,n);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(FW.toArray(e,n))}var QW=YW;YW.prototype._init=function(t){t.length>this.blockSize&&(t=(new this.Hash).update(t).digest()),WW(t.length<=this.blockSize);for(var e=t.length;e<this.blockSize;e++)t.push(0);for(e=0;e<t.length;e++)t[e]^=54;for(this.inner=(new this.Hash).update(t),e=0;e<t.length;e++)t[e]^=106;this.outer=(new this.Hash).update(t)},YW.prototype.update=function(t,e){return this.inner.update(t,e),this},YW.prototype.digest=function(t){return this.outer.update(this.inner.digest()),this.outer.digest(t)},function(t){var e=GU;e.utils=ZU,e.common=rF,e.sha=sF,e.ripemd=LW,e.hmac=QW,e.sha1=e.sha.sha1,e.sha256=e.sha.sha256,e.sha224=e.sha.sha224,e.sha384=e.sha.sha384,e.sha512=e.sha.sha512,e.ripemd160=e.ripemd.ripemd160}();var HW=GU;let GW=!1,ZW=!1;const VW={debug:1,default:2,info:2,warning:3,error:4,off:5};let qW=VW.default,JW=null;const KW=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(n){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var XW,$W;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(XW||(XW={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED"}($W||($W={}));const tY="0123456789abcdef";class eY{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const n=t.toLowerCase();null==VW[n]&&this.throwArgumentError("invalid log level name","logLevel",t),qW>VW[n]||console.log.apply(console,e)}debug(...t){this._log(eY.levels.DEBUG,t)}info(...t){this._log(eY.levels.INFO,t)}warn(...t){this._log(eY.levels.WARNING,t)}makeError(t,e,n){if(ZW)return this.makeError("censored error",e,{});e||(e=eY.errors.UNKNOWN_ERROR),n||(n={});const r=[];Object.keys(n).forEach((t=>{const e=n[t];try{if(e instanceof Uint8Array){let n="";for(let t=0;t<e.length;t++)n+=tY[e[t]>>4],n+=tY[15&e[t]];r.push(t+"=Uint8Array(0x"+n+")")}else r.push(t+"="+JSON.stringify(e))}catch(e){r.push(t+"="+JSON.stringify(n[t].toString()))}})),r.push(`code=${e}`),r.push(`version=${this.version}`);const i=t;let o="";switch(e){case $W.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case $W.CALL_EXCEPTION:case $W.INSUFFICIENT_FUNDS:case $W.MISSING_NEW:case $W.NONCE_EXPIRED:case $W.REPLACEMENT_UNDERPRICED:case $W.TRANSACTION_REPLACED:case $W.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),r.length&&(t+=" ("+r.join(", ")+")");const a=new Error(t);return a.reason=i,a.code=e,Object.keys(n).forEach((function(t){a[t]=n[t]})),a}throwError(t,e,n){throw this.makeError(t,e,n)}throwArgumentError(t,e,n){return this.throwError(t,eY.errors.INVALID_ARGUMENT,{argument:e,value:n})}assert(t,e,n,r){t||this.throwError(e,n,r)}assertArgument(t,e,n,r){t||this.throwArgumentError(e,n,r)}checkNormalize(t){KW&&this.throwError("platform missing String.prototype.normalize",eY.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:KW})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,eY.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,eY.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,n){n=n?": "+n:"",t<e&&this.throwError("missing argument"+n,eY.errors.MISSING_ARGUMENT,{count:t,expectedCount:e}),t>e&&this.throwError("too many arguments"+n,eY.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",eY.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",eY.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",eY.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return JW||(JW=new eY("logger/5.6.0")),JW}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",eY.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),GW){if(!t)return;this.globalLogger().throwError("error censorship permanent",eY.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}ZW=!!t,GW=!!e}static setLogLevel(t){const e=VW[t.toLowerCase()];null!=e?qW=e:eY.globalLogger().warn("invalid log level - "+t)}static from(t){return new eY(t)}}eY.errors=$W,eY.levels=XW;const nY=new eY("bytes/5.6.0");function rY(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return rY(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function iY(t){return"number"==typeof t&&t==t&&t%1==0}function oY(t,e){if(e||(e={}),"number"==typeof t){nY.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),rY(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),function(t){return!!t.toHexString}(t)&&(t=t.toHexString()),function(t,e){if("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/))return!1;if(e&&t.length!==2+2*e)return!1;return!0}(t)){let n=t.substring(2);n.length%2&&("left"===e.hexPad?n="0x0"+n.substring(2):"right"===e.hexPad?n+="0":nY.throwArgumentError("hex data is odd-length","value",t));const r=[];for(let t=0;t<n.length;t+=2)r.push(parseInt(n.substring(t,t+2),16));return rY(new Uint8Array(r))}return function(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(!iY(t.length)||t.length<0)return!1;for(let e=0;e<t.length;e++){const n=t[e];if(!iY(n)||n<0||n>=256)return!1}return!0}(t)?rY(new Uint8Array(t)):nY.throwArgumentError("invalid arrayify value","value",t)}function aY(t){return"0x"+HW.sha256().update(oY(t)).digest("hex")}new eY("sha2/5.6.0");class sY{constructor(t){Object.assign(this,t)}encode(){return p_.from(YE(uY,this))}static decode(t){return GE(uY,this,t)}static decodeUnchecked(t){return IE(uY,this,t)}}const uY=new Map;class cY extends sY{constructor(t){if(super({}),this._bn=void 0,function(t){return void 0!==t._bn}(t))this._bn=t._bn;else{if("string"==typeof t){const e=hE.decode(t);if(32!=e.length)throw new Error("Invalid public key input");this._bn=new nE(e)}else this._bn=new nE(t);if(this._bn.byteLength()>32)throw new Error("Invalid public key input")}}equals(t){return this._bn.eq(t._bn)}toBase58(){return hE.encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){return this.toBuffer()}toBuffer(){const t=this._bn.toArrayLike(p_);if(32===t.length)return t;const e=p_.alloc(32);return t.copy(e,32-t.length),e}toString(){return this.toBase58()}static async createWithSeed(t,e,n){const r=p_.concat([t.toBuffer(),p_.from(e),n.toBuffer()]),i=aY(new Uint8Array(r)).slice(2);return new cY(p_.from(i,"hex"))}static createProgramAddressSync(t,e){let n=p_.alloc(0);t.forEach((function(t){if(t.length>32)throw new TypeError("Max seed length exceeded");n=p_.concat([n,HU(t)])})),n=p_.concat([n,e.toBuffer(),p_.from("ProgramDerivedAddress")]);let r=aY(new Uint8Array(n)).slice(2),i=new nE(r,16).toArray(void 0,32);if(hY(i))throw new Error("Invalid seeds, address must fall off the curve");return new cY(i)}static async createProgramAddress(t,e){return this.createProgramAddressSync(t,e)}static findProgramAddressSync(t,e){let n,r=255;for(;0!=r;){try{const i=t.concat(p_.from([r]));n=this.createProgramAddressSync(i,e)}catch(t){if(t instanceof TypeError)throw t;r--;continue}return[n,r]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(t,e){return this.findProgramAddressSync(t,e)}static isOnCurve(t){return 1==hY(new cY(t).toBytes())}}cY.default=new cY("11111111111111111111111111111111"),uY.set(cY,{kind:"struct",fields:[["_bn","u256"]]});let lY=aE.lowlevel;function hY(t){var e=[lY.gf(),lY.gf(),lY.gf(),lY.gf()],n=lY.gf(),r=lY.gf(),i=lY.gf(),o=lY.gf(),a=lY.gf(),s=lY.gf(),u=lY.gf();return lY.set25519(e[2],dY),lY.unpack25519(e[1],t),lY.S(i,e[1]),lY.M(o,i,lY.D),lY.Z(i,i,e[2]),lY.A(o,e[2],o),lY.S(a,o),lY.S(s,a),lY.M(u,s,a),lY.M(n,u,i),lY.M(n,n,o),lY.pow2523(n,n),lY.M(n,n,i),lY.M(n,n,o),lY.M(n,n,o),lY.M(e[0],n,o),lY.S(r,e[0]),lY.M(r,r,o),pY(r,i)&&lY.M(e[0],e[0],fY),lY.S(r,e[0]),lY.M(r,r,o),pY(r,i)?0:1}let dY=lY.gf([1]),fY=lY.gf([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function pY(t,e){var n=new Uint8Array(32),r=new Uint8Array(32);return lY.pack25519(n,t),lY.pack25519(r,e),lY.crypto_verify_32(n,0,r,0)}const mY=new cY("BPFLoader1111111111111111111111111111111111"),gY=1232,yY=(t="publicKey")=>BN(32,t),bY=(t="string")=>{const e=PN([DN("length"),DN("lengthPadding"),BN(kN(DN(),-8),"chars")],t),n=e.decode.bind(e),r=e.encode.bind(e),i=e;return i.decode=(t,e)=>n(t,e).chars.toString(),i.encode=(t,e,n)=>{const i={chars:p_.from(t,"utf8")};return r(i,e,n)},i.alloc=t=>DN().span+DN().span+p_.from(t,"utf8").length,i};function vY(t){let e=0,n=0;for(;;){let r=t.shift();if(e|=(127&r)<<7*n,n+=1,0==(128&r))break}return e}function wY(t,e){let n=e;for(;;){let e=127&n;if(n>>=7,0==n){t.push(e);break}e|=128,t.push(e)}}class MY{constructor(t){this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=t.header,this.accountKeys=t.accountKeys.map((t=>new cY(t))),this.recentBlockhash=t.recentBlockhash,this.instructions=t.instructions,this.instructions.forEach((t=>this.indexToProgramIds.set(t.programIdIndex,this.accountKeys[t.programIdIndex])))}isAccountSigner(t){return t<this.header.numRequiredSignatures}isAccountWritable(t){return t<this.header.numRequiredSignatures-this.header.numReadonlySignedAccounts||t>=this.header.numRequiredSignatures&&t<this.accountKeys.length-this.header.numReadonlyUnsignedAccounts}isProgramId(t){return this.indexToProgramIds.has(t)}programIds(){return[...this.indexToProgramIds.values()]}nonProgramIds(){return this.accountKeys.filter(((t,e)=>!this.isProgramId(e)))}serialize(){const t=this.accountKeys.length;let e=[];wY(e,t);const n=this.instructions.map((t=>{const{accounts:e,programIdIndex:n}=t,r=Array.from(hE.decode(t.data));let i=[];wY(i,e.length);let o=[];return wY(o,r.length),{programIdIndex:n,keyIndicesCount:p_.from(i),keyIndices:e,dataLength:p_.from(o),data:r}}));let r=[];wY(r,n.length);let i=p_.alloc(gY);p_.from(r).copy(i);let o=r.length;n.forEach((t=>{const e=PN([jN("programIdIndex"),BN(t.keyIndicesCount.length,"keyIndicesCount"),RN(jN("keyIndex"),t.keyIndices.length,"keyIndices"),BN(t.dataLength.length,"dataLength"),RN(jN("userdatum"),t.data.length,"data")]).encode(t,i,o);o+=e})),i=i.slice(0,o);const a=PN([BN(1,"numRequiredSignatures"),BN(1,"numReadonlySignedAccounts"),BN(1,"numReadonlyUnsignedAccounts"),BN(e.length,"keyCount"),RN(yY("key"),t,"keys"),yY("recentBlockhash")]),s={numRequiredSignatures:p_.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:p_.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:p_.from([this.header.numReadonlyUnsignedAccounts]),keyCount:p_.from(e),keys:this.accountKeys.map((t=>HU(t.toBytes()))),recentBlockhash:hE.decode(this.recentBlockhash)};let u=p_.alloc(2048);const c=a.encode(s,u);return i.copy(u,c),u.slice(0,c+i.length)}static from(t){let e=[...t];const n=e.shift(),r=e.shift(),i=e.shift(),o=vY(e);let a=[];for(let t=0;t<o;t++){const t=e.slice(0,32);e=e.slice(32),a.push(hE.encode(p_.from(t)))}const s=e.slice(0,32);e=e.slice(32);const u=vY(e);let c=[];for(let t=0;t<u;t++){const t=e.shift(),n=vY(e),r=e.slice(0,n);e=e.slice(n);const i=vY(e),o=e.slice(0,i),a=hE.encode(p_.from(o));e=e.slice(i),c.push({programIdIndex:t,accounts:r,data:a})}const l={header:{numRequiredSignatures:n,numReadonlySignedAccounts:r,numReadonlyUnsignedAccounts:i},recentBlockhash:hE.encode(p_.from(s)),accountKeys:a,instructions:c};return new MY(l)}}function _Y(t,e){if(!t)throw new Error(e||"Assertion failed")}let EY;!function(t){t[t.BLOCKHEIGHT_EXCEEDED=0]="BLOCKHEIGHT_EXCEEDED",t[t.PROCESSED=1]="PROCESSED",t[t.TIMED_OUT=2]="TIMED_OUT"}(EY||(EY={}));const NY=p_.alloc(64).fill(0);class LY{constructor(t){this.keys=void 0,this.programId=void 0,this.data=p_.alloc(0),this.programId=t.programId,this.keys=t.keys,t.data&&(this.data=t.data)}toJSON(){return{keys:this.keys.map((({pubkey:t,isSigner:e,isWritable:n})=>({pubkey:t.toJSON(),isSigner:e,isWritable:n}))),programId:this.programId.toJSON(),data:[...this.data]}}}class SY{get signature(){return this.signatures.length>0?this.signatures[0].signature:null}constructor(t){if(this.signatures=[],this.feePayer=void 0,this.instructions=[],this.recentBlockhash=void 0,this.lastValidBlockHeight=void 0,this.nonceInfo=void 0,this._message=void 0,this._json=void 0,t)if(t.feePayer&&(this.feePayer=t.feePayer),t.signatures&&(this.signatures=t.signatures),Object.prototype.hasOwnProperty.call(t,"lastValidBlockHeight")){const{blockhash:e,lastValidBlockHeight:n}=t;this.recentBlockhash=e,this.lastValidBlockHeight=n}else{const{recentBlockhash:e,nonceInfo:n}=t;n&&(this.nonceInfo=n),this.recentBlockhash=e}}toJSON(){return{recentBlockhash:this.recentBlockhash||null,feePayer:this.feePayer?this.feePayer.toJSON():null,nonceInfo:this.nonceInfo?{nonce:this.nonceInfo.nonce,nonceInstruction:this.nonceInfo.nonceInstruction.toJSON()}:null,instructions:this.instructions.map((t=>t.toJSON())),signers:this.signatures.map((({publicKey:t})=>t.toJSON()))}}add(...t){if(0===t.length)throw new Error("No instructions");return t.forEach((t=>{"instructions"in t?this.instructions=this.instructions.concat(t.instructions):"data"in t&&"programId"in t&&"keys"in t?this.instructions.push(t):this.instructions.push(new LY(t))})),this}compileMessage(){if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;let t,e,n;if(this.nonceInfo?(t=this.nonceInfo.nonce,e=this.instructions[0]!=this.nonceInfo.nonceInstruction?[this.nonceInfo.nonceInstruction,...this.instructions]:this.instructions):(t=this.recentBlockhash,e=this.instructions),!t)throw new Error("Transaction recentBlockhash required");if(e.length<1&&console.warn("No instructions provided"),this.feePayer)n=this.feePayer;else{if(!(this.signatures.length>0&&this.signatures[0].publicKey))throw new Error("Transaction fee payer required");n=this.signatures[0].publicKey}for(let t=0;t<e.length;t++)if(void 0===e[t].programId)throw new Error(`Transaction instruction index ${t} has undefined program id`);const r=[],i=[];e.forEach((t=>{t.keys.forEach((t=>{i.push({...t})}));const e=t.programId.toString();r.includes(e)||r.push(e)})),r.forEach((t=>{i.push({pubkey:new cY(t),isSigner:!1,isWritable:!1})}));const o=[];i.forEach((t=>{const e=t.pubkey.toString(),n=o.findIndex((t=>t.pubkey.toString()===e));n>-1?(o[n].isWritable=o[n].isWritable||t.isWritable,o[n].isSigner=o[n].isSigner||t.isSigner):o.push(t)})),o.sort((function(t,e){return t.isSigner!==e.isSigner?t.isSigner?-1:1:t.isWritable!==e.isWritable?t.isWritable?-1:1:t.pubkey.toBase58().localeCompare(e.pubkey.toBase58())}));const a=o.findIndex((t=>t.pubkey.equals(n)));if(a>-1){const[t]=o.splice(a,1);t.isSigner=!0,t.isWritable=!0,o.unshift(t)}else o.unshift({pubkey:n,isSigner:!0,isWritable:!0});for(const t of this.signatures){const e=o.findIndex((e=>e.pubkey.equals(t.publicKey)));if(!(e>-1))throw new Error(`unknown signer: ${t.publicKey.toString()}`);o[e].isSigner||(o[e].isSigner=!0,console.warn("Transaction references a signature that is unnecessary, only the fee payer and instruction signer accounts should sign a transaction. This behavior is deprecated and will throw an error in the next major version release."))}let s=0,u=0,c=0;const l=[],h=[];o.forEach((({pubkey:t,isSigner:e,isWritable:n})=>{e?(l.push(t.toString()),s+=1,n||(u+=1)):(h.push(t.toString()),n||(c+=1))}));const d=l.concat(h),f=e.map((t=>{const{data:e,programId:n}=t;return{programIdIndex:d.indexOf(n.toString()),accounts:t.keys.map((t=>d.indexOf(t.pubkey.toString()))),data:hE.encode(e)}}));return f.forEach((t=>{_Y(t.programIdIndex>=0),t.accounts.forEach((t=>_Y(t>=0)))})),new MY({header:{numRequiredSignatures:s,numReadonlySignedAccounts:u,numReadonlyUnsignedAccounts:c},accountKeys:d,recentBlockhash:t,instructions:f})}_compile(){const t=this.compileMessage(),e=t.accountKeys.slice(0,t.header.numRequiredSignatures);if(this.signatures.length===e.length){if(this.signatures.every(((t,n)=>e[n].equals(t.publicKey))))return t}return this.signatures=e.map((t=>({signature:null,publicKey:t}))),t}serializeMessage(){return this._compile().serialize()}async getEstimatedFee(t){return(await t.getFeeForMessage(this.compileMessage())).value}setSigners(...t){if(0===t.length)throw new Error("No signers");const e=new Set;this.signatures=t.filter((t=>{const n=t.toString();return!e.has(n)&&(e.add(n),!0)})).map((t=>({signature:null,publicKey:t})))}sign(...t){if(0===t.length)throw new Error("No signers");const e=new Set,n=[];for(const r of t){const t=r.publicKey.toString();e.has(t)||(e.add(t),n.push(r))}this.signatures=n.map((t=>({signature:null,publicKey:t.publicKey})));const r=this._compile();this._partialSign(r,...n)}partialSign(...t){if(0===t.length)throw new Error("No signers");const e=new Set,n=[];for(const r of t){const t=r.publicKey.toString();e.has(t)||(e.add(t),n.push(r))}const r=this._compile();this._partialSign(r,...n)}_partialSign(t,...e){const n=t.serialize();e.forEach((t=>{const e=aE.sign.detached(n,t.secretKey);this._addSignature(t.publicKey,HU(e))}))}addSignature(t,e){this._compile(),this._addSignature(t,e)}_addSignature(t,e){_Y(64===e.length);const n=this.signatures.findIndex((e=>t.equals(e.publicKey)));if(n<0)throw new Error(`unknown signer: ${t.toString()}`);this.signatures[n].signature=p_.from(e)}verifySignatures(){return this._verifySignatures(this.serializeMessage(),!0)}_verifySignatures(t,e){for(const{signature:n,publicKey:r}of this.signatures)if(null===n){if(e)return!1}else if(!aE.sign.detached.verify(t,n,r.toBuffer()))return!1;return!0}serialize(t){const{requireAllSignatures:e,verifySignatures:n}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},t),r=this.serializeMessage();if(n&&!this._verifySignatures(r,e))throw new Error("Signature verification failed");return this._serialize(r)}_serialize(t){const{signatures:e}=this,n=[];wY(n,e.length);const r=n.length+64*e.length+t.length,i=p_.alloc(r);return _Y(e.length<256),p_.from(n).copy(i,0),e.forEach((({signature:t},e)=>{null!==t&&(_Y(64===t.length,"signature has invalid length"),p_.from(t).copy(i,n.length+64*e))})),t.copy(i,n.length+64*e.length),_Y(i.length<=gY,`Transaction too large: ${i.length} > 1232`),i}get keys(){return _Y(1===this.instructions.length),this.instructions[0].keys.map((t=>t.pubkey))}get programId(){return _Y(1===this.instructions.length),this.instructions[0].programId}get data(){return _Y(1===this.instructions.length),this.instructions[0].data}static from(t){let e=[...t];const n=vY(e);let r=[];for(let t=0;t<n;t++){const t=e.slice(0,64);e=e.slice(64),r.push(hE.encode(p_.from(t)))}return SY.populate(MY.from(e),r)}static populate(t,e=[]){const n=new SY;return n.recentBlockhash=t.recentBlockhash,t.header.numRequiredSignatures>0&&(n.feePayer=t.accountKeys[0]),e.forEach(((e,r)=>{const i={signature:e==hE.encode(NY)?null:hE.decode(e),publicKey:t.accountKeys[r]};n.signatures.push(i)})),t.instructions.forEach((e=>{const r=e.accounts.map((e=>{const r=t.accountKeys[e];return{pubkey:r,isSigner:n.signatures.some((t=>t.publicKey.toString()===r.toString()))||t.isAccountSigner(e),isWritable:t.isAccountWritable(e)}}));n.instructions.push(new LY({keys:r,programId:t.accountKeys[e.programIdIndex],data:hE.decode(e.data)}))})),n._message=t,n._json=n.toJSON(),n}}const AY=new cY("SysvarC1ock11111111111111111111111111111111"),xY=new cY("SysvarEpochSchedu1e111111111111111111111111"),TY=new cY("Sysvar1nstructions1111111111111111111111111"),IY=new cY("SysvarRecentB1ockHashes11111111111111111111"),kY=new cY("SysvarRent111111111111111111111111111111111"),jY=new cY("SysvarRewards111111111111111111111111111111"),CY=new cY("SysvarS1otHashes111111111111111111111111111"),DY=new cY("SysvarS1otHistory11111111111111111111111111"),OY=new cY("SysvarStakeHistory1111111111111111111111111");async function zY(t,e,n,r){const i=r&&{skipPreflight:r.skipPreflight,preflightCommitment:r.preflightCommitment||r.commitment,maxRetries:r.maxRetries,minContextSlot:r.minContextSlot},o=await t.sendTransaction(e,n,i),a=null!=e.recentBlockhash&&null!=e.lastValidBlockHeight?(await t.confirmTransaction({signature:o,blockhash:e.recentBlockhash,lastValidBlockHeight:e.lastValidBlockHeight},r&&r.commitment)).value:(await t.confirmTransaction(o,r&&r.commitment)).value;if(a.err)throw new Error(`Transaction ${o} failed (${JSON.stringify(a)})`);return o}function PY(t){return new Promise((e=>setTimeout(e,t)))}function RY(t,e){const n=t.layout.span>=0?t.layout.span:function(t,e){let n=0;return t.layout.fields.forEach((t=>{t.span>=0?n+=t.span:"function"==typeof t.alloc&&(n+=t.alloc(e[t.property]))})),n}(t,e),r=p_.alloc(n),i=Object.assign({instruction:t.index},e);return t.layout.encode(i,r),r}function BY(t,e){let n;try{n=t.layout.decode(e)}catch(t){throw new Error("invalid instruction; "+t)}if(n.instruction!==t.index)throw new Error(`invalid instruction; instruction index mismatch ${n.instruction} != ${t.index}`);return n}const UY=ON("lamportsPerSignature"),FY=PN([DN("version"),DN("state"),yY("authorizedPubkey"),yY("nonce"),PN([UY],"feeCalculator")]),WY=FY.span;class YY{constructor(t){this.authorizedPubkey=void 0,this.nonce=void 0,this.feeCalculator=void 0,this.authorizedPubkey=t.authorizedPubkey,this.nonce=t.nonce,this.feeCalculator=t.feeCalculator}static fromAccountData(t){const e=FY.decode(HU(t),0);return new YY({authorizedPubkey:new cY(e.authorizedPubkey),nonce:new cY(e.nonce).toString(),feeCalculator:e.feeCalculator})}}const QY=(HY=8,t=>{const e=BN(HY,t),{encode:n,decode:r}=(t=>({decode:t.decode.bind(t),encode:t.encode.bind(t)}))(e),i=e;return i.decode=(t,e)=>{const n=r(t,e);return FN(p_.from(n))},i.encode=(t,e,r)=>{const i=WN(t,HY);return n(i,e,r)},i});var HY;const GY=Object.freeze({Create:{index:0,layout:PN([DN("instruction"),zN("lamports"),zN("space"),yY("programId")])},Assign:{index:1,layout:PN([DN("instruction"),yY("programId")])},Transfer:{index:2,layout:PN([DN("instruction"),QY("lamports")])},CreateWithSeed:{index:3,layout:PN([DN("instruction"),yY("base"),bY("seed"),zN("lamports"),zN("space"),yY("programId")])},AdvanceNonceAccount:{index:4,layout:PN([DN("instruction")])},WithdrawNonceAccount:{index:5,layout:PN([DN("instruction"),zN("lamports")])},InitializeNonceAccount:{index:6,layout:PN([DN("instruction"),yY("authorized")])},AuthorizeNonceAccount:{index:7,layout:PN([DN("instruction"),yY("authorized")])},Allocate:{index:8,layout:PN([DN("instruction"),zN("space")])},AllocateWithSeed:{index:9,layout:PN([DN("instruction"),yY("base"),bY("seed"),zN("space"),yY("programId")])},AssignWithSeed:{index:10,layout:PN([DN("instruction"),yY("base"),bY("seed"),yY("programId")])},TransferWithSeed:{index:11,layout:PN([DN("instruction"),QY("lamports"),bY("seed"),yY("programId")])},UpgradeNonceAccount:{index:12,layout:PN([DN("instruction")])}});class ZY{constructor(){}static createAccount(t){const e=RY(GY.Create,{lamports:t.lamports,space:t.space,programId:HU(t.programId.toBuffer())});return new LY({keys:[{pubkey:t.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:t.newAccountPubkey,isSigner:!0,isWritable:!0}],programId:this.programId,data:e})}static transfer(t){let e,n;if("basePubkey"in t){e=RY(GY.TransferWithSeed,{lamports:BigInt(t.lamports),seed:t.seed,programId:HU(t.programId.toBuffer())}),n=[{pubkey:t.fromPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0}]}else{e=RY(GY.Transfer,{lamports:BigInt(t.lamports)}),n=[{pubkey:t.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0}]}return new LY({keys:n,programId:this.programId,data:e})}static assign(t){let e,n;if("basePubkey"in t){e=RY(GY.AssignWithSeed,{base:HU(t.basePubkey.toBuffer()),seed:t.seed,programId:HU(t.programId.toBuffer())}),n=[{pubkey:t.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1}]}else{e=RY(GY.Assign,{programId:HU(t.programId.toBuffer())}),n=[{pubkey:t.accountPubkey,isSigner:!0,isWritable:!0}]}return new LY({keys:n,programId:this.programId,data:e})}static createAccountWithSeed(t){const e=RY(GY.CreateWithSeed,{base:HU(t.basePubkey.toBuffer()),seed:t.seed,lamports:t.lamports,space:t.space,programId:HU(t.programId.toBuffer())});let n=[{pubkey:t.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:t.newAccountPubkey,isSigner:!1,isWritable:!0}];return t.basePubkey!=t.fromPubkey&&n.push({pubkey:t.basePubkey,isSigner:!0,isWritable:!1}),new LY({keys:n,programId:this.programId,data:e})}static createNonceAccount(t){const e=new SY;"basePubkey"in t&&"seed"in t?e.add(ZY.createAccountWithSeed({fromPubkey:t.fromPubkey,newAccountPubkey:t.noncePubkey,basePubkey:t.basePubkey,seed:t.seed,lamports:t.lamports,space:WY,programId:this.programId})):e.add(ZY.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.noncePubkey,lamports:t.lamports,space:WY,programId:this.programId}));const n={noncePubkey:t.noncePubkey,authorizedPubkey:t.authorizedPubkey};return e.add(this.nonceInitialize(n)),e}static nonceInitialize(t){const e=RY(GY.InitializeNonceAccount,{authorized:HU(t.authorizedPubkey.toBuffer())}),n={keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:IY,isSigner:!1,isWritable:!1},{pubkey:kY,isSigner:!1,isWritable:!1}],programId:this.programId,data:e};return new LY(n)}static nonceAdvance(t){const e=RY(GY.AdvanceNonceAccount),n={keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:IY,isSigner:!1,isWritable:!1},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:e};return new LY(n)}static nonceWithdraw(t){const e=RY(GY.WithdrawNonceAccount,{lamports:t.lamports});return new LY({keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0},{pubkey:IY,isSigner:!1,isWritable:!1},{pubkey:kY,isSigner:!1,isWritable:!1},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:e})}static nonceAuthorize(t){const e=RY(GY.AuthorizeNonceAccount,{authorized:HU(t.newAuthorizedPubkey.toBuffer())});return new LY({keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:e})}static allocate(t){let e,n;if("basePubkey"in t){e=RY(GY.AllocateWithSeed,{base:HU(t.basePubkey.toBuffer()),seed:t.seed,space:t.space,programId:HU(t.programId.toBuffer())}),n=[{pubkey:t.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1}]}else{e=RY(GY.Allocate,{space:t.space}),n=[{pubkey:t.accountPubkey,isSigner:!0,isWritable:!0}]}return new LY({keys:n,programId:this.programId,data:e})}}ZY.programId=new cY("11111111111111111111111111111111");class VY{constructor(){}static getMinNumSignatures(t){return 2*(Math.ceil(t/VY.chunkSize)+1+1)}static async load(t,e,n,r,i){{const o=await t.getMinimumBalanceForRentExemption(i.length),a=await t.getAccountInfo(n.publicKey,"confirmed");let s=null;if(null!==a){if(a.executable)return console.error("Program load failed, account is already executable"),!1;a.data.length!==i.length&&(s=s||new SY,s.add(ZY.allocate({accountPubkey:n.publicKey,space:i.length}))),a.owner.equals(r)||(s=s||new SY,s.add(ZY.assign({accountPubkey:n.publicKey,programId:r}))),a.lamports<o&&(s=s||new SY,s.add(ZY.transfer({fromPubkey:e.publicKey,toPubkey:n.publicKey,lamports:o-a.lamports})))}else s=(new SY).add(ZY.createAccount({fromPubkey:e.publicKey,newAccountPubkey:n.publicKey,lamports:o>0?o:1,space:i.length,programId:r}));null!==s&&await zY(t,s,[e,n],{commitment:"confirmed"})}const o=PN([DN("instruction"),DN("offset"),DN("bytesLength"),DN("bytesLengthPadding"),RN(jN("byte"),kN(DN(),-8),"bytes")]),a=VY.chunkSize;let s=0,u=i,c=[];for(;u.length>0;){const i=u.slice(0,a),l=p_.alloc(a+16);o.encode({instruction:0,offset:s,bytes:i,bytesLength:0,bytesLengthPadding:0},l);const h=(new SY).add({keys:[{pubkey:n.publicKey,isSigner:!0,isWritable:!0}],programId:r,data:l});if(c.push(zY(t,h,[e,n],{commitment:"confirmed"})),t._rpcEndpoint.includes("solana.com")){const t=4;await PY(1e3/t)}s+=a,u=u.slice(a)}await Promise.all(c);{const i=PN([DN("instruction")]),o=p_.alloc(i.span);i.encode({instruction:1},o);const a=(new SY).add({keys:[{pubkey:n.publicKey,isSigner:!0,isWritable:!0},{pubkey:kY,isSigner:!1,isWritable:!1}],programId:r,data:o});await zY(t,a,[e,n],{commitment:"confirmed"})}return!0}}VY.chunkSize=932;const qY=new cY("BPFLoader2111111111111111111111111111111111");const JY=Object.freeze({RequestUnits:{index:0,layout:PN([jN("instruction"),DN("units"),DN("additionalFee")])},RequestHeapFrame:{index:1,layout:PN([jN("instruction"),DN("bytes")])},SetComputeUnitLimit:{index:2,layout:PN([jN("instruction"),DN("units")])},SetComputeUnitPrice:{index:3,layout:PN([jN("instruction"),QY("microLamports")])}});class KY{constructor(){}static requestUnits(t){const e=RY(JY.RequestUnits,t);return new LY({keys:[],programId:this.programId,data:e})}static requestHeapFrame(t){const e=RY(JY.RequestHeapFrame,t);return new LY({keys:[],programId:this.programId,data:e})}static setComputeUnitLimit(t){const e=RY(JY.SetComputeUnitLimit,t);return new LY({keys:[],programId:this.programId,data:e})}static setComputeUnitPrice(t){const e=RY(JY.SetComputeUnitPrice,{microLamports:BigInt(t.microLamports)});return new LY({keys:[],programId:this.programId,data:e})}}KY.programId=new cY("ComputeBudget111111111111111111111111111111");var XY=Object.prototype.toString,$Y=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};function tQ(t,e){var n,r,i,o,a,s,u;if(!0===t)return"true";if(!1===t)return"false";switch(typeof t){case"object":if(null===t)return null;if(t.toJSON&&"function"==typeof t.toJSON)return tQ(t.toJSON(),e);if("[object Array]"===(u=XY.call(t))){for(i="[",r=t.length-1,n=0;n<r;n++)i+=tQ(t[n],!0)+",";return r>-1&&(i+=tQ(t[n],!0)),i+"]"}if("[object Object]"===u){for(r=(o=$Y(t).sort()).length,i="",n=0;n<r;)void 0!==(s=tQ(t[a=o[n]],!1))&&(i&&(i+=","),i+=JSON.stringify(a)+":"+s),n++;return"{"+i+"}"}return JSON.stringify(t);case"function":case"undefined":return e?null:void 0;case"string":return JSON.stringify(t);default:return isFinite(t)?t:null}}var eQ=function(t){var e=tQ(t,!1);if(void 0!==e)return""+e};function nQ(t){let e=0;for(;t>1;)t/=2,e++;return e}class rQ{constructor(t,e,n,r,i){this.slotsPerEpoch=void 0,this.leaderScheduleSlotOffset=void 0,this.warmup=void 0,this.firstNormalEpoch=void 0,this.firstNormalSlot=void 0,this.slotsPerEpoch=t,this.leaderScheduleSlotOffset=e,this.warmup=n,this.firstNormalEpoch=r,this.firstNormalSlot=i}getEpoch(t){return this.getEpochAndSlotIndex(t)[0]}getEpochAndSlotIndex(t){if(t<this.firstNormalSlot){const e=nQ(function(t){return 0===t?1:(t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,1+(t|=t>>32))}(t+32+1))-nQ(32)-1;return[e,t-(this.getSlotsInEpoch(e)-32)]}{const e=t-this.firstNormalSlot,n=Math.floor(e/this.slotsPerEpoch);return[this.firstNormalEpoch+n,e%this.slotsPerEpoch]}}getFirstSlotInEpoch(t){return t<=this.firstNormalEpoch?32*(Math.pow(2,t)-1):(t-this.firstNormalEpoch)*this.slotsPerEpoch+this.firstNormalSlot}getLastSlotInEpoch(t){return this.getFirstSlotInEpoch(t)+this.getSlotsInEpoch(t)-1}getSlotsInEpoch(t){return t<this.firstNormalEpoch?Math.pow(2,t+nQ(32)):this.slotsPerEpoch}}class iQ extends Error{constructor(t,e){super(t),this.logs=void 0,this.logs=e}}class oQ extends Error{constructor({code:t,message:e,data:n},r){super(null!=r?`${r}: ${e}`:e),this.code=void 0,this.data=void 0,this.code=t,this.data=n,this.name="SolanaJSONRPCError"}}var aQ=globalThis.fetch;class sQ extends Error{constructor(t){super(`Signature ${t} has expired: block height exceeded.`),this.signature=void 0,this.signature=t}}Object.defineProperty(sQ.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});class uQ extends Error{constructor(t,e){super(`Transaction was not confirmed in ${e.toFixed(2)} seconds. It is unknown if it succeeded or failed. Check signature ${t} using the Solana Explorer or CLI tools.`),this.signature=void 0,this.signature=t}}var cQ;Object.defineProperty(uQ.prototype,"name",{value:"TransactionExpiredTimeoutError"});const lQ=pL(rL(cY),cL(),(t=>new cY(t))),hQ=lL([cL(),iL("base64")]),dQ=pL(rL(p_),hQ,(t=>p_.from(t[0],"base64")));function fQ(t){let e,n;if("string"==typeof t)e=t;else if(t){const{commitment:r,...i}=t;e=r,n=i}return{commitment:e,config:n}}function pQ(t){return dL([hL({jsonrpc:iL("2.0"),id:cL(),result:t}),hL({jsonrpc:iL("2.0"),id:cL(),error:hL({code:fL(),message:cL(),data:sL(tL("any",(()=>!0)))})})])}const mQ=pQ(fL());function gQ(t){return pL(pQ(t),mQ,(e=>"error"in e?e:{...e,result:KN(e.result,t)}))}function yQ(t){return gQ(hL({context:hL({slot:aL()}),value:t}))}function bQ(t){return hL({context:hL({slot:aL()}),value:t})}const vQ=hL({foundation:aL(),foundationTerm:aL(),initial:aL(),taper:aL(),terminal:aL()}),wQ=gQ(eL(oL(hL({epoch:aL(),effectiveSlot:aL(),amount:aL(),postBalance:aL()})))),MQ=hL({epoch:aL(),slotIndex:aL(),slotsInEpoch:aL(),absoluteSlot:aL(),blockHeight:sL(aL()),transactionCount:sL(aL())}),_Q=hL({slotsPerEpoch:aL(),leaderScheduleSlotOffset:aL(),warmup:nL(),firstNormalEpoch:aL(),firstNormalSlot:aL()}),EQ=uL(cL(),eL(aL())),NQ=oL(dL([hL({}),cL()])),LQ=hL({err:NQ}),SQ=iL("receivedSignature"),AQ=hL({"solana-core":cL(),"feature-set":sL(aL())}),xQ=yQ(hL({err:oL(dL([hL({}),cL()])),logs:oL(eL(cL())),accounts:sL(oL(eL(oL(hL({executable:nL(),owner:cL(),lamports:aL(),data:eL(cL()),rentEpoch:sL(aL())}))))),unitsConsumed:sL(aL())})),TQ=yQ(hL({byIdentity:uL(cL(),eL(aL())),range:hL({firstSlot:aL(),lastSlot:aL()})}));const IQ=gQ(vQ),kQ=gQ(MQ),jQ=gQ(_Q),CQ=gQ(EQ),DQ=gQ(aL()),OQ=yQ(hL({total:aL(),circulating:aL(),nonCirculating:aL(),nonCirculatingAccounts:eL(lQ)})),zQ=hL({amount:cL(),uiAmount:oL(aL()),decimals:aL(),uiAmountString:sL(cL())}),PQ=yQ(eL(hL({address:lQ,amount:cL(),uiAmount:oL(aL()),decimals:aL(),uiAmountString:sL(cL())}))),RQ=yQ(eL(hL({pubkey:lQ,account:hL({executable:nL(),owner:lQ,lamports:aL(),data:dQ,rentEpoch:aL()})}))),BQ=hL({program:cL(),parsed:fL(),space:aL()}),UQ=yQ(eL(hL({pubkey:lQ,account:hL({executable:nL(),owner:lQ,lamports:aL(),data:BQ,rentEpoch:aL()})}))),FQ=yQ(eL(hL({lamports:aL(),address:lQ}))),WQ=hL({executable:nL(),owner:lQ,lamports:aL(),data:dQ,rentEpoch:aL()}),YQ=hL({pubkey:lQ,account:WQ}),QQ=pL(dL([rL(p_),BQ]),dL([hQ,BQ]),(t=>Array.isArray(t)?KN(t,dQ):t)),HQ=hL({executable:nL(),owner:lQ,lamports:aL(),data:QQ,rentEpoch:aL()}),GQ=hL({pubkey:lQ,account:HQ}),ZQ=hL({state:dL([iL("active"),iL("inactive"),iL("activating"),iL("deactivating")]),active:aL(),inactive:aL()}),VQ=gQ(eL(hL({signature:cL(),slot:aL(),err:NQ,memo:oL(cL()),blockTime:sL(oL(aL()))}))),qQ=gQ(eL(hL({signature:cL(),slot:aL(),err:NQ,memo:oL(cL()),blockTime:sL(oL(aL()))}))),JQ=hL({subscription:aL(),result:bQ(WQ)}),KQ=hL({pubkey:lQ,account:WQ}),XQ=hL({subscription:aL(),result:bQ(KQ)}),$Q=hL({parent:aL(),slot:aL(),root:aL()}),tH=hL({subscription:aL(),result:$Q}),eH=dL([hL({type:dL([iL("firstShredReceived"),iL("completed"),iL("optimisticConfirmation"),iL("root")]),slot:aL(),timestamp:aL()}),hL({type:iL("createdBank"),parent:aL(),slot:aL(),timestamp:aL()}),hL({type:iL("frozen"),slot:aL(),timestamp:aL(),stats:hL({numTransactionEntries:aL(),numSuccessfulTransactions:aL(),numFailedTransactions:aL(),maxTransactionsPerEntry:aL()})}),hL({type:iL("dead"),slot:aL(),timestamp:aL(),err:cL()})]),nH=hL({subscription:aL(),result:eH}),rH=hL({subscription:aL(),result:bQ(dL([LQ,SQ]))}),iH=hL({subscription:aL(),result:aL()}),oH=hL({pubkey:cL(),gossip:oL(cL()),tpu:oL(cL()),rpc:oL(cL()),version:oL(cL())}),aH=hL({votePubkey:cL(),nodePubkey:cL(),activatedStake:aL(),epochVoteAccount:nL(),epochCredits:eL(lL([aL(),aL(),aL()])),commission:aL(),lastVote:aL(),rootSlot:oL(aL())}),sH=gQ(hL({current:eL(aH),delinquent:eL(aH)})),uH=dL([iL("processed"),iL("confirmed"),iL("finalized")]),cH=hL({slot:aL(),confirmations:oL(aL()),err:NQ,confirmationStatus:sL(uH)}),lH=yQ(eL(oL(cH))),hH=gQ(aL()),dH=hL({signatures:eL(cL()),message:hL({accountKeys:eL(cL()),header:hL({numRequiredSignatures:aL(),numReadonlySignedAccounts:aL(),numReadonlyUnsignedAccounts:aL()}),instructions:eL(hL({accounts:eL(aL()),data:cL(),programIdIndex:aL()})),recentBlockhash:cL()})}),fH=hL({parsed:fL(),program:cL(),programId:lQ}),pH=hL({accounts:eL(lQ),data:cL(),programId:lQ}),mH=pL(dL([pH,fH]),dL([hL({parsed:fL(),program:cL(),programId:cL()}),hL({accounts:eL(cL()),data:cL(),programId:cL()})]),(t=>KN(t,"accounts"in t?pH:fH))),gH=hL({signatures:eL(cL()),message:hL({accountKeys:eL(hL({pubkey:lQ,signer:nL(),writable:nL()})),instructions:eL(mH),recentBlockhash:cL()})}),yH=hL({accountIndex:aL(),mint:cL(),owner:sL(cL()),uiTokenAmount:zQ}),bH=hL({err:NQ,fee:aL(),innerInstructions:sL(oL(eL(hL({index:aL(),instructions:eL(hL({accounts:eL(aL()),data:cL(),programIdIndex:aL()}))})))),preBalances:eL(aL()),postBalances:eL(aL()),logMessages:sL(oL(eL(cL()))),preTokenBalances:sL(oL(eL(yH))),postTokenBalances:sL(oL(eL(yH)))}),vH=hL({err:NQ,fee:aL(),innerInstructions:sL(oL(eL(hL({index:aL(),instructions:eL(mH)})))),preBalances:eL(aL()),postBalances:eL(aL()),logMessages:sL(oL(eL(cL()))),preTokenBalances:sL(oL(eL(yH))),postTokenBalances:sL(oL(eL(yH)))}),wH=gQ(oL(hL({blockhash:cL(),previousBlockhash:cL(),parentSlot:aL(),transactions:eL(hL({transaction:dH,meta:oL(bH)})),rewards:sL(eL(hL({pubkey:cL(),lamports:aL(),postBalance:oL(aL()),rewardType:oL(cL())}))),blockTime:oL(aL()),blockHeight:oL(aL())}))),MH=gQ(oL(hL({blockhash:cL(),previousBlockhash:cL(),parentSlot:aL(),transactions:eL(hL({transaction:dH,meta:oL(bH)})),rewards:sL(eL(hL({pubkey:cL(),lamports:aL(),postBalance:oL(aL()),rewardType:oL(cL())}))),blockTime:oL(aL())}))),_H=gQ(oL(hL({blockhash:cL(),previousBlockhash:cL(),parentSlot:aL(),signatures:eL(cL()),blockTime:oL(aL())}))),EH=gQ(oL(hL({slot:aL(),meta:bH,blockTime:sL(oL(aL())),transaction:dH}))),NH=gQ(oL(hL({slot:aL(),transaction:gH,meta:oL(vH),blockTime:sL(oL(aL()))}))),LH=yQ(hL({blockhash:cL(),feeCalculator:hL({lamportsPerSignature:aL()})})),SH=yQ(hL({blockhash:cL(),lastValidBlockHeight:aL()})),AH=gQ(eL(hL({slot:aL(),numTransactions:aL(),numSlots:aL(),samplePeriodSecs:aL()}))),xH=yQ(oL(hL({feeCalculator:hL({lamportsPerSignature:aL()})}))),TH=gQ(cL()),IH=gQ(cL()),kH=hL({err:NQ,logs:eL(cL()),signature:cL()}),jH=hL({result:bQ(kH),subscription:aL()}),CH={"solana-client":`js/${null!==(cQ="0.0.0-development")?cQ:"UNKNOWN"}`};class DH{constructor(t,e){this._commitment=void 0,this._confirmTransactionInitialTimeout=void 0,this._rpcEndpoint=void 0,this._rpcWsEndpoint=void 0,this._rpcClient=void 0,this._rpcRequest=void 0,this._rpcBatchRequest=void 0,this._rpcWebSocket=void 0,this._rpcWebSocketConnected=!1,this._rpcWebSocketHeartbeat=null,this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketGeneration=0,this._disableBlockhashCaching=!1,this._pollingBlockhash=!1,this._blockhashInfo={latestBlockhash:null,lastFetch:0,transactionSignatures:[],simulatedSignatures:[]},this._nextClientSubscriptionId=0,this._subscriptionDisposeFunctionsByClientSubscriptionId={},this._subscriptionCallbacksByServerSubscriptionId={},this._subscriptionsByHash={},this._subscriptionsAutoDisposedByRpc=new Set;let n=new URL(t);n.protocol;let r,i,o,a,s;e&&"string"==typeof e?this._commitment=e:e&&(this._commitment=e.commitment,this._confirmTransactionInitialTimeout=e.confirmTransactionInitialTimeout,r=e.wsEndpoint,i=e.httpHeaders,o=e.fetch,a=e.fetchMiddleware,s=e.disableRetryOnRateLimit),this._rpcEndpoint=t,this._rpcWsEndpoint=r||function(t){let e=new URL(t);const n="https:"===e.protocol;return e.protocol=n?"wss:":"ws:",e.host="",""!==e.port&&(e.port=String(Number(e.port)+1)),e.toString()}(t),this._rpcClient=function(t,e,n,r,i,o){const a=r||aQ;let s;i&&(s=async(t,e)=>{const n=await new Promise(((n,r)=>{try{i(t,e,((t,e)=>n([t,e])))}catch(t){r(t)}}));return await a(...n)});const u=new jz((async(e,r)=>{const i={method:"POST",body:e,agent:void 0,headers:Object.assign({"Content-Type":"application/json"},n||{},CH)};try{let e,n=5,u=500;for(;e=s?await s(t,i):await a(t,i),429===e.status&&!0!==o&&(n-=1,0!==n);)console.log(`Server responded with ${e.status} ${e.statusText}. Retrying after ${u}ms delay...`),await PY(u),u*=2;const c=await e.text();e.ok?r(null,c):r(new Error(`${e.status} ${e.statusText}: ${c}`))}catch(t){t instanceof Error&&r(t)}}),{});return u}(n.toString(),0,i,o,a,s),this._rpcRequest=function(t){return(e,n)=>new Promise(((r,i)=>{t.request(e,n,((t,e)=>{t?i(t):r(e)}))}))}(this._rpcClient),this._rpcBatchRequest=function(t){return e=>new Promise(((n,r)=>{0===e.length&&n([]);const i=e.map((e=>t.request(e.methodName,e.args)));t.request(i,((t,e)=>{t?r(t):n(e)}))}))}(this._rpcClient),this._rpcWebSocket=new gL.Client(this._rpcWsEndpoint,{autoconnect:!1,max_reconnects:1/0}),this._rpcWebSocket.on("open",this._wsOnOpen.bind(this)),this._rpcWebSocket.on("error",this._wsOnError.bind(this)),this._rpcWebSocket.on("close",this._wsOnClose.bind(this)),this._rpcWebSocket.on("accountNotification",this._wsOnAccountNotification.bind(this)),this._rpcWebSocket.on("programNotification",this._wsOnProgramAccountNotification.bind(this)),this._rpcWebSocket.on("slotNotification",this._wsOnSlotNotification.bind(this)),this._rpcWebSocket.on("slotsUpdatesNotification",this._wsOnSlotUpdatesNotification.bind(this)),this._rpcWebSocket.on("signatureNotification",this._wsOnSignatureNotification.bind(this)),this._rpcWebSocket.on("rootNotification",this._wsOnRootNotification.bind(this)),this._rpcWebSocket.on("logsNotification",this._wsOnLogsNotification.bind(this))}get commitment(){return this._commitment}get rpcEndpoint(){return this._rpcEndpoint}async getBalanceAndContext(t,e){const{commitment:n,config:r}=fQ(e),i=this._buildArgs([t.toBase58()],n,void 0,r),o=KN(await this._rpcRequest("getBalance",i),yQ(aL()));if("error"in o)throw new oQ(o.error,`failed to get balance for ${t.toBase58()}`);return o.result}async getBalance(t,e){return await this.getBalanceAndContext(t,e).then((t=>t.value)).catch((e=>{throw new Error("failed to get balance of account "+t.toBase58()+": "+e)}))}async getBlockTime(t){const e=KN(await this._rpcRequest("getBlockTime",[t]),gQ(oL(aL())));if("error"in e)throw new oQ(e.error,`failed to get block time for slot ${t}`);return e.result}async getMinimumLedgerSlot(){const t=KN(await this._rpcRequest("minimumLedgerSlot",[]),gQ(aL()));if("error"in t)throw new oQ(t.error,"failed to get minimum ledger slot");return t.result}async getFirstAvailableBlock(){const t=KN(await this._rpcRequest("getFirstAvailableBlock",[]),DQ);if("error"in t)throw new oQ(t.error,"failed to get first available block");return t.result}async getSupply(t){let e={};e="string"==typeof t?{commitment:t}:t?{...t,commitment:t&&t.commitment||this.commitment}:{commitment:this.commitment};const n=KN(await this._rpcRequest("getSupply",[e]),OQ);if("error"in n)throw new oQ(n.error,"failed to get supply");return n.result}async getTokenSupply(t,e){const n=this._buildArgs([t.toBase58()],e),r=KN(await this._rpcRequest("getTokenSupply",n),yQ(zQ));if("error"in r)throw new oQ(r.error,"failed to get token supply");return r.result}async getTokenAccountBalance(t,e){const n=this._buildArgs([t.toBase58()],e),r=KN(await this._rpcRequest("getTokenAccountBalance",n),yQ(zQ));if("error"in r)throw new oQ(r.error,"failed to get token account balance");return r.result}async getTokenAccountsByOwner(t,e,n){const{commitment:r,config:i}=fQ(n);let o=[t.toBase58()];"mint"in e?o.push({mint:e.mint.toBase58()}):o.push({programId:e.programId.toBase58()});const a=this._buildArgs(o,r,"base64",i),s=KN(await this._rpcRequest("getTokenAccountsByOwner",a),RQ);if("error"in s)throw new oQ(s.error,`failed to get token accounts owned by account ${t.toBase58()}`);return s.result}async getParsedTokenAccountsByOwner(t,e,n){let r=[t.toBase58()];"mint"in e?r.push({mint:e.mint.toBase58()}):r.push({programId:e.programId.toBase58()});const i=this._buildArgs(r,n,"jsonParsed"),o=KN(await this._rpcRequest("getTokenAccountsByOwner",i),UQ);if("error"in o)throw new oQ(o.error,`failed to get token accounts owned by account ${t.toBase58()}`);return o.result}async getLargestAccounts(t){const e={...t,commitment:t&&t.commitment||this.commitment},n=e.filter||e.commitment?[e]:[],r=KN(await this._rpcRequest("getLargestAccounts",n),FQ);if("error"in r)throw new oQ(r.error,"failed to get largest accounts");return r.result}async getTokenLargestAccounts(t,e){const n=this._buildArgs([t.toBase58()],e),r=KN(await this._rpcRequest("getTokenLargestAccounts",n),PQ);if("error"in r)throw new oQ(r.error,"failed to get token largest accounts");return r.result}async getAccountInfoAndContext(t,e){const{commitment:n,config:r}=fQ(e),i=this._buildArgs([t.toBase58()],n,"base64",r),o=KN(await this._rpcRequest("getAccountInfo",i),yQ(oL(WQ)));if("error"in o)throw new oQ(o.error,`failed to get info about account ${t.toBase58()}`);return o.result}async getParsedAccountInfo(t,e){const n=this._buildArgs([t.toBase58()],e,"jsonParsed"),r=KN(await this._rpcRequest("getAccountInfo",n),yQ(oL(HQ)));if("error"in r)throw new oQ(r.error,`failed to get info about account ${t.toBase58()}`);return r.result}async getAccountInfo(t,e){try{return(await this.getAccountInfoAndContext(t,e)).value}catch(e){throw new Error("failed to get info about account "+t.toBase58()+": "+e)}}async getMultipleAccountsInfoAndContext(t,e){const{commitment:n,config:r}=fQ(e),i=t.map((t=>t.toBase58())),o=this._buildArgs([i],n,"base64",r),a=KN(await this._rpcRequest("getMultipleAccounts",o),yQ(eL(oL(WQ))));if("error"in a)throw new oQ(a.error,`failed to get info for accounts ${i}`);return a.result}async getMultipleAccountsInfo(t,e){return(await this.getMultipleAccountsInfoAndContext(t,e)).value}async getStakeActivation(t,e,n){const{commitment:r,config:i}=fQ(e),o=this._buildArgs([t.toBase58()],r,void 0,{...i,epoch:null!=n?n:null==i?void 0:i.epoch}),a=KN(await this._rpcRequest("getStakeActivation",o),gQ(ZQ));if("error"in a)throw new oQ(a.error,`failed to get Stake Activation ${t.toBase58()}`);return a.result}async getProgramAccounts(t,e){const{commitment:n,config:r}=fQ(e),{encoding:i,...o}=r||{},a=this._buildArgs([t.toBase58()],n,i||"base64",o),s=KN(await this._rpcRequest("getProgramAccounts",a),gQ(eL(YQ)));if("error"in s)throw new oQ(s.error,`failed to get accounts owned by program ${t.toBase58()}`);return s.result}async getParsedProgramAccounts(t,e){const{commitment:n,config:r}=fQ(e),i=this._buildArgs([t.toBase58()],n,"jsonParsed",r),o=KN(await this._rpcRequest("getProgramAccounts",i),gQ(eL(GQ)));if("error"in o)throw new oQ(o.error,`failed to get accounts owned by program ${t.toBase58()}`);return o.result}async confirmTransaction(t,e){let n,r;if("string"==typeof t)n=t;else{n=t.signature}try{r=hE.decode(n)}catch(t){throw new Error("signature must be base58 encoded: "+n)}_Y(64===r.length,"signature has invalid length");const i=e||this.commitment;let o,a,s=!1;const u=new Promise(((t,e)=>{try{a=this.onSignature(n,((e,n)=>{a=void 0;const r={context:n,value:e};s=!0,t({__type:EY.PROCESSED,response:r})}),i)}catch(t){e(t)}})),c=new Promise((n=>{if("string"==typeof t){let t=this._confirmTransactionInitialTimeout||6e4;switch(i){case"processed":case"recent":case"single":case"confirmed":case"singleGossip":t=this._confirmTransactionInitialTimeout||3e4}o=setTimeout((()=>n({__type:EY.TIMED_OUT,timeoutMs:t})),t)}else{let r=t;const i=async()=>{try{return await this.getBlockHeight(e)}catch(t){return-1}};(async()=>{let t=await i();if(!s){for(;t<=r.lastValidBlockHeight;){if(await PY(1e3),s)return;if(t=await i(),s)return}n({__type:EY.BLOCKHEIGHT_EXCEEDED})}})()}}));let l;try{const t=await Promise.race([u,c]);switch(t.__type){case EY.BLOCKHEIGHT_EXCEEDED:throw new sQ(n);case EY.PROCESSED:l=t.response;break;case EY.TIMED_OUT:throw new uQ(n,t.timeoutMs/1e3)}}finally{clearTimeout(o),a&&this.removeSignatureListener(a)}return l}async getClusterNodes(){const t=KN(await this._rpcRequest("getClusterNodes",[]),gQ(eL(oH)));if("error"in t)throw new oQ(t.error,"failed to get cluster nodes");return t.result}async getVoteAccounts(t){const e=this._buildArgs([],t),n=KN(await this._rpcRequest("getVoteAccounts",e),sH);if("error"in n)throw new oQ(n.error,"failed to get vote accounts");return n.result}async getSlot(t){const{commitment:e,config:n}=fQ(t),r=this._buildArgs([],e,void 0,n),i=KN(await this._rpcRequest("getSlot",r),gQ(aL()));if("error"in i)throw new oQ(i.error,"failed to get slot");return i.result}async getSlotLeader(t){const{commitment:e,config:n}=fQ(t),r=this._buildArgs([],e,void 0,n),i=KN(await this._rpcRequest("getSlotLeader",r),gQ(cL()));if("error"in i)throw new oQ(i.error,"failed to get slot leader");return i.result}async getSlotLeaders(t,e){const n=[t,e],r=KN(await this._rpcRequest("getSlotLeaders",n),gQ(eL(lQ)));if("error"in r)throw new oQ(r.error,"failed to get slot leaders");return r.result}async getSignatureStatus(t,e){const{context:n,value:r}=await this.getSignatureStatuses([t],e);_Y(1===r.length);return{context:n,value:r[0]}}async getSignatureStatuses(t,e){const n=[t];e&&n.push(e);const r=KN(await this._rpcRequest("getSignatureStatuses",n),lH);if("error"in r)throw new oQ(r.error,"failed to get signature status");return r.result}async getTransactionCount(t){const{commitment:e,config:n}=fQ(t),r=this._buildArgs([],e,void 0,n),i=KN(await this._rpcRequest("getTransactionCount",r),gQ(aL()));if("error"in i)throw new oQ(i.error,"failed to get transaction count");return i.result}async getTotalSupply(t){return(await this.getSupply({commitment:t,excludeNonCirculatingAccountsList:!0})).value.total}async getInflationGovernor(t){const e=this._buildArgs([],t),n=KN(await this._rpcRequest("getInflationGovernor",e),IQ);if("error"in n)throw new oQ(n.error,"failed to get inflation");return n.result}async getInflationReward(t,e,n){const{commitment:r,config:i}=fQ(n),o=this._buildArgs([t.map((t=>t.toBase58()))],r,void 0,{...i,epoch:null!=e?e:null==i?void 0:i.epoch}),a=KN(await this._rpcRequest("getInflationReward",o),wQ);if("error"in a)throw new oQ(a.error,"failed to get inflation reward");return a.result}async getEpochInfo(t){const{commitment:e,config:n}=fQ(t),r=this._buildArgs([],e,void 0,n),i=KN(await this._rpcRequest("getEpochInfo",r),kQ);if("error"in i)throw new oQ(i.error,"failed to get epoch info");return i.result}async getEpochSchedule(){const t=KN(await this._rpcRequest("getEpochSchedule",[]),jQ);if("error"in t)throw new oQ(t.error,"failed to get epoch schedule");const e=t.result;return new rQ(e.slotsPerEpoch,e.leaderScheduleSlotOffset,e.warmup,e.firstNormalEpoch,e.firstNormalSlot)}async getLeaderSchedule(){const t=KN(await this._rpcRequest("getLeaderSchedule",[]),CQ);if("error"in t)throw new oQ(t.error,"failed to get leader schedule");return t.result}async getMinimumBalanceForRentExemption(t,e){const n=this._buildArgs([t],e),r=KN(await this._rpcRequest("getMinimumBalanceForRentExemption",n),hH);return"error"in r?(console.warn("Unable to fetch minimum balance for rent exemption"),0):r.result}async getRecentBlockhashAndContext(t){const e=this._buildArgs([],t),n=KN(await this._rpcRequest("getRecentBlockhash",e),LH);if("error"in n)throw new oQ(n.error,"failed to get recent blockhash");return n.result}async getRecentPerformanceSamples(t){const e=KN(await this._rpcRequest("getRecentPerformanceSamples",t?[t]:[]),AH);if("error"in e)throw new oQ(e.error,"failed to get recent performance samples");return e.result}async getFeeCalculatorForBlockhash(t,e){const n=this._buildArgs([t],e),r=KN(await this._rpcRequest("getFeeCalculatorForBlockhash",n),xH);if("error"in r)throw new oQ(r.error,"failed to get fee calculator");const{context:i,value:o}=r.result;return{context:i,value:null!==o?o.feeCalculator:null}}async getFeeForMessage(t,e){const n=t.serialize().toString("base64"),r=this._buildArgs([n],e),i=KN(await this._rpcRequest("getFeeForMessage",r),yQ(oL(aL())));if("error"in i)throw new oQ(i.error,"failed to get slot");if(null===i.result)throw new Error("invalid blockhash");return i.result}async getRecentBlockhash(t){try{return(await this.getRecentBlockhashAndContext(t)).value}catch(t){throw new Error("failed to get recent blockhash: "+t)}}async getLatestBlockhash(t){try{return(await this.getLatestBlockhashAndContext(t)).value}catch(t){throw new Error("failed to get recent blockhash: "+t)}}async getLatestBlockhashAndContext(t){const{commitment:e,config:n}=fQ(t),r=this._buildArgs([],e,void 0,n),i=KN(await this._rpcRequest("getLatestBlockhash",r),SH);if("error"in i)throw new oQ(i.error,"failed to get latest blockhash");return i.result}async getVersion(){const t=KN(await this._rpcRequest("getVersion",[]),gQ(AQ));if("error"in t)throw new oQ(t.error,"failed to get version");return t.result}async getGenesisHash(){const t=KN(await this._rpcRequest("getGenesisHash",[]),gQ(cL()));if("error"in t)throw new oQ(t.error,"failed to get genesis hash");return t.result}async getBlock(t,e){const n=this._buildArgsAtLeastConfirmed([t],e&&e.commitment),r=KN(await this._rpcRequest("getBlock",n),wH);if("error"in r)throw new oQ(r.error,"failed to get confirmed block");const i=r.result;return i?{...i,transactions:i.transactions.map((({transaction:t,meta:e})=>{const n=new MY(t.message);return{meta:e,transaction:{...t,message:n}}}))}:i}async getBlockHeight(t){const{commitment:e,config:n}=fQ(t),r=this._buildArgs([],e,void 0,n),i=KN(await this._rpcRequest("getBlockHeight",r),gQ(aL()));if("error"in i)throw new oQ(i.error,"failed to get block height information");return i.result}async getBlockProduction(t){let e,n;if("string"==typeof t)n=t;else if(t){const{commitment:r,...i}=t;n=r,e=i}const r=this._buildArgs([],n,"base64",e),i=KN(await this._rpcRequest("getBlockProduction",r),TQ);if("error"in i)throw new oQ(i.error,"failed to get block production information");return i.result}async getTransaction(t,e){const n=this._buildArgsAtLeastConfirmed([t],e&&e.commitment),r=KN(await this._rpcRequest("getTransaction",n),EH);if("error"in r)throw new oQ(r.error,"failed to get transaction");const i=r.result;return i?{...i,transaction:{...i.transaction,message:new MY(i.transaction.message)}}:i}async getParsedTransaction(t,e){const n=this._buildArgsAtLeastConfirmed([t],e,"jsonParsed"),r=KN(await this._rpcRequest("getTransaction",n),NH);if("error"in r)throw new oQ(r.error,"failed to get transaction");return r.result}async getParsedTransactions(t,e){const n=t.map((t=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([t],e,"jsonParsed")})));return(await this._rpcBatchRequest(n)).map((t=>{const e=KN(t,NH);if("error"in e)throw new oQ(e.error,"failed to get transactions");return e.result}))}async getTransactions(t,e){const n=t.map((t=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([t],e)})));return(await this._rpcBatchRequest(n)).map((t=>{const e=KN(t,EH);if("error"in e)throw new oQ(e.error,"failed to get transactions");const n=e.result;return n?{...n,transaction:{...n.transaction,message:new MY(n.transaction.message)}}:n}))}async getConfirmedBlock(t,e){const n=this._buildArgsAtLeastConfirmed([t],e),r=KN(await this._rpcRequest("getConfirmedBlock",n),MH);if("error"in r)throw new oQ(r.error,"failed to get confirmed block");const i=r.result;if(!i)throw new Error("Confirmed block "+t+" not found");const o={...i,transactions:i.transactions.map((({transaction:t,meta:e})=>{const n=new MY(t.message);return{meta:e,transaction:{...t,message:n}}}))};return{...o,transactions:o.transactions.map((({transaction:t,meta:e})=>({meta:e,transaction:SY.populate(t.message,t.signatures)})))}}async getBlocks(t,e,n){const r=this._buildArgsAtLeastConfirmed(void 0!==e?[t,e]:[t],n),i=KN(await this._rpcRequest("getBlocks",r),gQ(eL(aL())));if("error"in i)throw new oQ(i.error,"failed to get blocks");return i.result}async getBlockSignatures(t,e){const n=this._buildArgsAtLeastConfirmed([t],e,void 0,{transactionDetails:"signatures",rewards:!1}),r=KN(await this._rpcRequest("getBlock",n),_H);if("error"in r)throw new oQ(r.error,"failed to get block");const i=r.result;if(!i)throw new Error("Block "+t+" not found");return i}async getConfirmedBlockSignatures(t,e){const n=this._buildArgsAtLeastConfirmed([t],e,void 0,{transactionDetails:"signatures",rewards:!1}),r=KN(await this._rpcRequest("getConfirmedBlock",n),_H);if("error"in r)throw new oQ(r.error,"failed to get confirmed block");const i=r.result;if(!i)throw new Error("Confirmed block "+t+" not found");return i}async getConfirmedTransaction(t,e){const n=this._buildArgsAtLeastConfirmed([t],e),r=KN(await this._rpcRequest("getConfirmedTransaction",n),EH);if("error"in r)throw new oQ(r.error,"failed to get transaction");const i=r.result;if(!i)return i;const o=new MY(i.transaction.message),a=i.transaction.signatures;return{...i,transaction:SY.populate(o,a)}}async getParsedConfirmedTransaction(t,e){const n=this._buildArgsAtLeastConfirmed([t],e,"jsonParsed"),r=KN(await this._rpcRequest("getConfirmedTransaction",n),NH);if("error"in r)throw new oQ(r.error,"failed to get confirmed transaction");return r.result}async getParsedConfirmedTransactions(t,e){const n=t.map((t=>({methodName:"getConfirmedTransaction",args:this._buildArgsAtLeastConfirmed([t],e,"jsonParsed")})));return(await this._rpcBatchRequest(n)).map((t=>{const e=KN(t,NH);if("error"in e)throw new oQ(e.error,"failed to get confirmed transactions");return e.result}))}async getConfirmedSignaturesForAddress(t,e,n){let r={},i=await this.getFirstAvailableBlock();for(;!("until"in r)&&!(--e<=0||e<i);)try{const t=await this.getConfirmedBlockSignatures(e,"finalized");t.signatures.length>0&&(r.until=t.signatures[t.signatures.length-1].toString())}catch(t){if(t instanceof Error&&t.message.includes("skipped"))continue;throw t}let o=await this.getSlot("finalized");for(;!("before"in r||++n>o);)try{const t=await this.getConfirmedBlockSignatures(n);t.signatures.length>0&&(r.before=t.signatures[t.signatures.length-1].toString())}catch(t){if(t instanceof Error&&t.message.includes("skipped"))continue;throw t}return(await this.getConfirmedSignaturesForAddress2(t,r)).map((t=>t.signature))}async getConfirmedSignaturesForAddress2(t,e,n){const r=this._buildArgsAtLeastConfirmed([t.toBase58()],n,void 0,e),i=KN(await this._rpcRequest("getConfirmedSignaturesForAddress2",r),VQ);if("error"in i)throw new oQ(i.error,"failed to get confirmed signatures for address");return i.result}async getSignaturesForAddress(t,e,n){const r=this._buildArgsAtLeastConfirmed([t.toBase58()],n,void 0,e),i=KN(await this._rpcRequest("getSignaturesForAddress",r),qQ);if("error"in i)throw new oQ(i.error,"failed to get signatures for address");return i.result}async getNonceAndContext(t,e){const{context:n,value:r}=await this.getAccountInfoAndContext(t,e);let i=null;return null!==r&&(i=YY.fromAccountData(r.data)),{context:n,value:i}}async getNonce(t,e){return await this.getNonceAndContext(t,e).then((t=>t.value)).catch((e=>{throw new Error("failed to get nonce for account "+t.toBase58()+": "+e)}))}async requestAirdrop(t,e){const n=KN(await this._rpcRequest("requestAirdrop",[t.toBase58(),e]),TH);if("error"in n)throw new oQ(n.error,`airdrop to ${t.toBase58()} failed`);return n.result}async _blockhashWithExpiryBlockHeight(t){if(!t){for(;this._pollingBlockhash;)await PY(100);const t=Date.now()-this._blockhashInfo.lastFetch>=3e4;if(null!==this._blockhashInfo.latestBlockhash&&!t)return this._blockhashInfo.latestBlockhash}return await this._pollNewBlockhash()}async _pollNewBlockhash(){this._pollingBlockhash=!0;try{const t=Date.now(),e=this._blockhashInfo.latestBlockhash,n=e?e.blockhash:null;for(let t=0;t<50;t++){const t=await this.getLatestBlockhash("finalized");if(n!==t.blockhash)return this._blockhashInfo={latestBlockhash:t,lastFetch:Date.now(),transactionSignatures:[],simulatedSignatures:[]},t;await PY(200)}throw new Error(`Unable to obtain a new blockhash after ${Date.now()-t}ms`)}finally{this._pollingBlockhash=!1}}async simulateTransaction(t,e,n){let r;if(t instanceof SY){let e=t;r=new SY,r.feePayer=e.feePayer,r.instructions=t.instructions,r.nonceInfo=e.nonceInfo,r.signatures=e.signatures}else r=SY.populate(t),r._message=r._json=void 0;if(r.nonceInfo&&e)r.sign(...e);else{let t=this._disableBlockhashCaching;for(;;){const n=await this._blockhashWithExpiryBlockHeight(t);if(r.lastValidBlockHeight=n.lastValidBlockHeight,r.recentBlockhash=n.blockhash,!e)break;if(r.sign(...e),!r.signature)throw new Error("!signature");const i=r.signature.toString("base64");if(!this._blockhashInfo.simulatedSignatures.includes(i)&&!this._blockhashInfo.transactionSignatures.includes(i)){this._blockhashInfo.simulatedSignatures.push(i);break}t=!0}}const i=r._compile(),o=i.serialize(),a=r._serialize(o).toString("base64"),s={encoding:"base64",commitment:this.commitment};if(n){const t=(Array.isArray(n)?n:i.nonProgramIds()).map((t=>t.toBase58()));s.accounts={encoding:"base64",addresses:t}}e&&(s.sigVerify=!0);const u=[a,s],c=KN(await this._rpcRequest("simulateTransaction",u),xQ);if("error"in c){let t;if("data"in c.error&&(t=c.error.data.logs,t&&Array.isArray(t))){const e="\n ",n=e+t.join(e);console.error(c.error.message,n)}throw new iQ("failed to simulate transaction: "+c.error.message,t)}return c.result}async sendTransaction(t,e,n){if(t.nonceInfo)t.sign(...e);else{let n=this._disableBlockhashCaching;for(;;){const r=await this._blockhashWithExpiryBlockHeight(n);if(t.lastValidBlockHeight=r.lastValidBlockHeight,t.recentBlockhash=r.blockhash,t.sign(...e),!t.signature)throw new Error("!signature");const i=t.signature.toString("base64");if(!this._blockhashInfo.transactionSignatures.includes(i)){this._blockhashInfo.transactionSignatures.push(i);break}n=!0}}const r=t.serialize();return await this.sendRawTransaction(r,n)}async sendRawTransaction(t,e){const n=HU(t).toString("base64");return await this.sendEncodedTransaction(n,e)}async sendEncodedTransaction(t,e){const n={encoding:"base64"},r=e&&e.skipPreflight,i=e&&e.preflightCommitment||this.commitment;e&&null!=e.maxRetries&&(n.maxRetries=e.maxRetries),e&&null!=e.minContextSlot&&(n.minContextSlot=e.minContextSlot),r&&(n.skipPreflight=r),i&&(n.preflightCommitment=i);const o=[t,n],a=KN(await this._rpcRequest("sendTransaction",o),IH);if("error"in a){let t;throw"data"in a.error&&(t=a.error.data.logs),new iQ("failed to send transaction: "+a.error.message,t)}return a.result}_wsOnOpen(){this._rpcWebSocketConnected=!0,this._rpcWebSocketHeartbeat=setInterval((()=>{this._rpcWebSocket.notify("ping").catch((()=>{}))}),5e3),this._updateSubscriptions()}_wsOnError(t){this._rpcWebSocketConnected=!1,console.error("ws error:",t.message)}_wsOnClose(t){this._rpcWebSocketConnected=!1,this._rpcWebSocketGeneration++,this._rpcWebSocketHeartbeat&&(clearInterval(this._rpcWebSocketHeartbeat),this._rpcWebSocketHeartbeat=null),1e3!==t?(this._subscriptionCallbacksByServerSubscriptionId={},Object.entries(this._subscriptionsByHash).forEach((([t,e])=>{this._subscriptionsByHash[t]={...e,state:"pending"}}))):this._updateSubscriptions()}async _updateSubscriptions(){if(0===Object.keys(this._subscriptionsByHash).length)return void(this._rpcWebSocketConnected&&(this._rpcWebSocketConnected=!1,this._rpcWebSocketIdleTimeout=setTimeout((()=>{this._rpcWebSocketIdleTimeout=null;try{this._rpcWebSocket.close()}catch(t){t instanceof Error&&console.log(`Error when closing socket connection: ${t.message}`)}}),500)));if(null!==this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketConnected=!0),!this._rpcWebSocketConnected)return void this._rpcWebSocket.connect();const t=this._rpcWebSocketGeneration,e=()=>t===this._rpcWebSocketGeneration;await Promise.all(Object.keys(this._subscriptionsByHash).map((async t=>{const n=this._subscriptionsByHash[t];if(void 0!==n)switch(n.state){case"pending":case"unsubscribed":if(0===n.callbacks.size)return delete this._subscriptionsByHash[t],"unsubscribed"===n.state&&delete this._subscriptionCallbacksByServerSubscriptionId[n.serverSubscriptionId],void await this._updateSubscriptions();await(async()=>{const{args:r,method:i}=n;try{this._subscriptionsByHash[t]={...n,state:"subscribing"};const e=await this._rpcWebSocket.call(i,r);this._subscriptionsByHash[t]={...n,serverSubscriptionId:e,state:"subscribed"},this._subscriptionCallbacksByServerSubscriptionId[e]=n.callbacks,await this._updateSubscriptions()}catch(o){if(o instanceof Error&&console.error(`${i} error for argument`,r,o.message),!e())return;this._subscriptionsByHash[t]={...n,state:"pending"},await this._updateSubscriptions()}})();break;case"subscribed":0===n.callbacks.size&&await(async()=>{const{serverSubscriptionId:r,unsubscribeMethod:i}=n;if(this._subscriptionsAutoDisposedByRpc.has(r))this._subscriptionsAutoDisposedByRpc.delete(r);else{this._subscriptionsByHash[t]={...n,state:"unsubscribing"};try{await this._rpcWebSocket.call(i,[r])}catch(r){if(r instanceof Error&&console.error(`${i} error:`,r.message),!e())return;return this._subscriptionsByHash[t]={...n,state:"subscribed"},void await this._updateSubscriptions()}}this._subscriptionsByHash[t]={...n,state:"unsubscribed"},await this._updateSubscriptions()})()}})))}_handleServerNotification(t,e){const n=this._subscriptionCallbacksByServerSubscriptionId[t];void 0!==n&&n.forEach((t=>{try{t(...e)}catch(t){console.error(t)}}))}_wsOnAccountNotification(t){const{result:e,subscription:n}=KN(t,JQ);this._handleServerNotification(n,[e.value,e.context])}_makeSubscription(t,e){const n=this._nextClientSubscriptionId++,r=eQ([t.method,e]),i=this._subscriptionsByHash[r];return void 0===i?this._subscriptionsByHash[r]={...t,args:e,callbacks:new Set([t.callback]),state:"pending"}:i.callbacks.add(t.callback),this._subscriptionDisposeFunctionsByClientSubscriptionId[n]=async()=>{delete this._subscriptionDisposeFunctionsByClientSubscriptionId[n];const e=this._subscriptionsByHash[r];_Y(void 0!==e,`Could not find a \`Subscription\` when tearing down client subscription #${n}`),e.callbacks.delete(t.callback),await this._updateSubscriptions()},this._updateSubscriptions(),n}onAccountChange(t,e,n){const r=this._buildArgs([t.toBase58()],n||this._commitment||"finalized","base64");return this._makeSubscription({callback:e,method:"accountSubscribe",unsubscribeMethod:"accountUnsubscribe"},r)}async removeAccountChangeListener(t){await this._unsubscribeClientSubscription(t,"account change")}_wsOnProgramAccountNotification(t){const{result:e,subscription:n}=KN(t,XQ);this._handleServerNotification(n,[{accountId:e.value.pubkey,accountInfo:e.value.account},e.context])}onProgramAccountChange(t,e,n,r){const i=this._buildArgs([t.toBase58()],n||this._commitment||"finalized","base64",r?{filters:r}:void 0);return this._makeSubscription({callback:e,method:"programSubscribe",unsubscribeMethod:"programUnsubscribe"},i)}async removeProgramAccountChangeListener(t){await this._unsubscribeClientSubscription(t,"program account change")}onLogs(t,e,n){const r=this._buildArgs(["object"==typeof t?{mentions:[t.toString()]}:t],n||this._commitment||"finalized");return this._makeSubscription({callback:e,method:"logsSubscribe",unsubscribeMethod:"logsUnsubscribe"},r)}async removeOnLogsListener(t){await this._unsubscribeClientSubscription(t,"logs")}_wsOnLogsNotification(t){const{result:e,subscription:n}=KN(t,jH);this._handleServerNotification(n,[e.value,e.context])}_wsOnSlotNotification(t){const{result:e,subscription:n}=KN(t,tH);this._handleServerNotification(n,[e])}onSlotChange(t){return this._makeSubscription({callback:t,method:"slotSubscribe",unsubscribeMethod:"slotUnsubscribe"},[])}async removeSlotChangeListener(t){await this._unsubscribeClientSubscription(t,"slot change")}_wsOnSlotUpdatesNotification(t){const{result:e,subscription:n}=KN(t,nH);this._handleServerNotification(n,[e])}onSlotUpdate(t){return this._makeSubscription({callback:t,method:"slotsUpdatesSubscribe",unsubscribeMethod:"slotsUpdatesUnsubscribe"},[])}async removeSlotUpdateListener(t){await this._unsubscribeClientSubscription(t,"slot update")}async _unsubscribeClientSubscription(t,e){const n=this._subscriptionDisposeFunctionsByClientSubscriptionId[t];n?await n():console.warn(`Ignored unsubscribe request because an active subscription with id \`${t}\` for '${e}' events could not be found.`)}_buildArgs(t,e,n,r){const i=e||this._commitment;if(i||n||r){let e={};n&&(e.encoding=n),i&&(e.commitment=i),r&&(e=Object.assign(e,r)),t.push(e)}return t}_buildArgsAtLeastConfirmed(t,e,n,r){const i=e||this._commitment;if(i&&!["confirmed","finalized"].includes(i))throw new Error("Using Connection with default commitment: `"+this._commitment+"`, but method requires at least `confirmed`");return this._buildArgs(t,e,n,r)}_wsOnSignatureNotification(t){const{result:e,subscription:n}=KN(t,rH);"receivedSignature"!==e.value&&this._subscriptionsAutoDisposedByRpc.add(n),this._handleServerNotification(n,"receivedSignature"===e.value?[{type:"received"},e.context]:[{type:"status",result:e.value},e.context])}onSignature(t,e,n){const r=this._buildArgs([t],n||this._commitment||"finalized"),i=this._makeSubscription({callback:(t,n)=>{if("status"===t.type){e(t.result,n);try{this.removeSignatureListener(i)}catch(t){}}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},r);return i}onSignatureWithOptions(t,e,n){const{commitment:r,...i}={...n,commitment:n&&n.commitment||this._commitment||"finalized"},o=this._buildArgs([t],r,void 0,i),a=this._makeSubscription({callback:(t,n)=>{e(t,n);try{this.removeSignatureListener(a)}catch(t){}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},o);return a}async removeSignatureListener(t){await this._unsubscribeClientSubscription(t,"signature result")}_wsOnRootNotification(t){const{result:e,subscription:n}=KN(t,iH);this._handleServerNotification(n,[e])}onRootChange(t){return this._makeSubscription({callback:t,method:"rootSubscribe",unsubscribeMethod:"rootUnsubscribe"},[])}async removeRootChangeListener(t){await this._unsubscribeClientSubscription(t,"root change")}}class OH{constructor(t){this._keypair=void 0,this._keypair=t||aE.sign.keyPair()}static generate(){return new OH(aE.sign.keyPair())}static fromSecretKey(t,e){const n=aE.sign.keyPair.fromSecretKey(t);if(!e||!e.skipValidation){const t=(new TextEncoder).encode("@solana/web3.js-validation-v1"),e=aE.sign.detached(t,n.secretKey);if(!aE.sign.detached.verify(t,e,n.publicKey))throw new Error("provided secretKey is invalid")}return new OH(n)}static fromSeed(t){return new OH(aE.sign.keyPair.fromSeed(t))}get publicKey(){return new cY(this._keypair.publicKey)}get secretKey(){return this._keypair.secretKey}}const zH=PN([jN("numSignatures"),jN("padding"),CN("signatureOffset"),CN("signatureInstructionIndex"),CN("publicKeyOffset"),CN("publicKeyInstructionIndex"),CN("messageDataOffset"),CN("messageDataSize"),CN("messageInstructionIndex")]);class PH{constructor(){}static createInstructionWithPublicKey(t){const{publicKey:e,message:n,signature:r,instructionIndex:i}=t;_Y(32===e.length,`Public Key must be 32 bytes but received ${e.length} bytes`),_Y(64===r.length,`Signature must be 64 bytes but received ${r.length} bytes`);const o=zH.span,a=o+e.length,s=a+r.length,u=p_.alloc(s+n.length),c=null==i?65535:i;return zH.encode({numSignatures:1,padding:0,signatureOffset:a,signatureInstructionIndex:c,publicKeyOffset:o,publicKeyInstructionIndex:c,messageDataOffset:s,messageDataSize:n.length,messageInstructionIndex:c},u),u.fill(e,o),u.fill(r,a),u.fill(n,s),new LY({keys:[],programId:PH.programId,data:u})}static createInstructionWithPrivateKey(t){const{privateKey:e,message:n,instructionIndex:r}=t;_Y(64===e.length,`Private key must be 64 bytes but received ${e.length} bytes`);try{const t=OH.fromSecretKey(e),i=t.publicKey.toBytes(),o=aE.sign.detached(n,t.secretKey);return this.createInstructionWithPublicKey({publicKey:i,message:n,signature:o,instructionIndex:r})}catch(t){throw new Error(`Error creating instruction; ${t}`)}}}PH.programId=new cY("Ed25519SigVerify111111111111111111111111111");const RH=new cY("StakeConfig11111111111111111111111111111111");class BH{constructor(t,e){this.staker=void 0,this.withdrawer=void 0,this.staker=t,this.withdrawer=e}}class UH{constructor(t,e,n){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=t,this.epoch=e,this.custodian=n}}UH.default=new UH(0,0,cY.default);const FH=Object.freeze({Initialize:{index:0,layout:PN([DN("instruction"),((t="authorized")=>PN([yY("staker"),yY("withdrawer")],t))(),((t="lockup")=>PN([zN("unixTimestamp"),zN("epoch"),yY("custodian")],t))()])},Authorize:{index:1,layout:PN([DN("instruction"),yY("newAuthorized"),DN("stakeAuthorizationType")])},Delegate:{index:2,layout:PN([DN("instruction")])},Split:{index:3,layout:PN([DN("instruction"),zN("lamports")])},Withdraw:{index:4,layout:PN([DN("instruction"),zN("lamports")])},Deactivate:{index:5,layout:PN([DN("instruction")])},Merge:{index:7,layout:PN([DN("instruction")])},AuthorizeWithSeed:{index:8,layout:PN([DN("instruction"),yY("newAuthorized"),DN("stakeAuthorizationType"),bY("authoritySeed"),yY("authorityOwner")])}}),WH=Object.freeze({Staker:{index:0},Withdrawer:{index:1}});class YH{constructor(){}static initialize(t){const{stakePubkey:e,authorized:n,lockup:r}=t,i=r||UH.default,o=RY(FH.Initialize,{authorized:{staker:HU(n.staker.toBuffer()),withdrawer:HU(n.withdrawer.toBuffer())},lockup:{unixTimestamp:i.unixTimestamp,epoch:i.epoch,custodian:HU(i.custodian.toBuffer())}}),a={keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:kY,isSigner:!1,isWritable:!1}],programId:this.programId,data:o};return new LY(a)}static createAccountWithSeed(t){const e=new SY;e.add(ZY.createAccountWithSeed({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,basePubkey:t.basePubkey,seed:t.seed,lamports:t.lamports,space:this.space,programId:this.programId}));const{stakePubkey:n,authorized:r,lockup:i}=t;return e.add(this.initialize({stakePubkey:n,authorized:r,lockup:i}))}static createAccount(t){const e=new SY;e.add(ZY.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,lamports:t.lamports,space:this.space,programId:this.programId}));const{stakePubkey:n,authorized:r,lockup:i}=t;return e.add(this.initialize({stakePubkey:n,authorized:r,lockup:i}))}static delegate(t){const{stakePubkey:e,authorizedPubkey:n,votePubkey:r}=t,i=RY(FH.Delegate);return(new SY).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!1},{pubkey:AY,isSigner:!1,isWritable:!1},{pubkey:OY,isSigner:!1,isWritable:!1},{pubkey:RH,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}static authorize(t){const{stakePubkey:e,authorizedPubkey:n,newAuthorizedPubkey:r,stakeAuthorizationType:i,custodianPubkey:o}=t,a=RY(FH.Authorize,{newAuthorized:HU(r.toBuffer()),stakeAuthorizationType:i.index}),s=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:AY,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return o&&s.push({pubkey:o,isSigner:!1,isWritable:!1}),(new SY).add({keys:s,programId:this.programId,data:a})}static authorizeWithSeed(t){const{stakePubkey:e,authorityBase:n,authoritySeed:r,authorityOwner:i,newAuthorizedPubkey:o,stakeAuthorizationType:a,custodianPubkey:s}=t,u=RY(FH.AuthorizeWithSeed,{newAuthorized:HU(o.toBuffer()),stakeAuthorizationType:a.index,authoritySeed:r,authorityOwner:HU(i.toBuffer())}),c=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1},{pubkey:AY,isSigner:!1,isWritable:!1}];return s&&c.push({pubkey:s,isSigner:!1,isWritable:!1}),(new SY).add({keys:c,programId:this.programId,data:u})}static splitInstruction(t){const{stakePubkey:e,authorizedPubkey:n,splitStakePubkey:r,lamports:i}=t,o=RY(FH.Split,{lamports:i});return new LY({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:o})}static split(t){const e=new SY;return e.add(ZY.createAccount({fromPubkey:t.authorizedPubkey,newAccountPubkey:t.splitStakePubkey,lamports:0,space:this.space,programId:this.programId})),e.add(this.splitInstruction(t))}static splitWithSeed(t){const{stakePubkey:e,authorizedPubkey:n,splitStakePubkey:r,basePubkey:i,seed:o,lamports:a}=t,s=new SY;return s.add(ZY.allocate({accountPubkey:r,basePubkey:i,seed:o,space:this.space,programId:this.programId})),s.add(this.splitInstruction({stakePubkey:e,authorizedPubkey:n,splitStakePubkey:r,lamports:a}))}static merge(t){const{stakePubkey:e,sourceStakePubKey:n,authorizedPubkey:r}=t,i=RY(FH.Merge);return(new SY).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:AY,isSigner:!1,isWritable:!1},{pubkey:OY,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}static withdraw(t){const{stakePubkey:e,authorizedPubkey:n,toPubkey:r,lamports:i,custodianPubkey:o}=t,a=RY(FH.Withdraw,{lamports:i}),s=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:AY,isSigner:!1,isWritable:!1},{pubkey:OY,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return o&&s.push({pubkey:o,isSigner:!1,isWritable:!1}),(new SY).add({keys:s,programId:this.programId,data:a})}static deactivate(t){const{stakePubkey:e,authorizedPubkey:n}=t,r=RY(FH.Deactivate);return(new SY).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:AY,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:r})}}YH.programId=new cY("Stake11111111111111111111111111111111111111"),YH.space=200;const{publicKeyCreate:QH,ecdsaSign:HH}=WU,GH=PN([jN("numSignatures"),CN("signatureOffset"),jN("signatureInstructionIndex"),CN("ethAddressOffset"),jN("ethAddressInstructionIndex"),CN("messageDataOffset"),CN("messageDataSize"),jN("messageInstructionIndex"),BN(20,"ethAddress"),BN(64,"signature"),jN("recoveryId")]);class ZH{constructor(){}static publicKeyToEthAddress(t){_Y(64===t.length,`Public key must be 64 bytes but received ${t.length} bytes`);try{return p_.from(QU.keccak_256.update(HU(t)).digest()).slice(-20)}catch(t){throw new Error(`Error constructing Ethereum address: ${t}`)}}static createInstructionWithPublicKey(t){const{publicKey:e,message:n,signature:r,recoveryId:i,instructionIndex:o}=t;return ZH.createInstructionWithEthAddress({ethAddress:ZH.publicKeyToEthAddress(e),message:n,signature:r,recoveryId:i,instructionIndex:o})}static createInstructionWithEthAddress(t){const{ethAddress:e,message:n,signature:r,recoveryId:i,instructionIndex:o=0}=t;let a;a="string"==typeof e?e.startsWith("0x")?p_.from(e.substr(2),"hex"):p_.from(e,"hex"):e,_Y(20===a.length,`Address must be 20 bytes but received ${a.length} bytes`);const s=12+a.length,u=s+r.length+1,c=p_.alloc(GH.span+n.length);return GH.encode({numSignatures:1,signatureOffset:s,signatureInstructionIndex:o,ethAddressOffset:12,ethAddressInstructionIndex:o,messageDataOffset:u,messageDataSize:n.length,messageInstructionIndex:o,signature:HU(r),ethAddress:HU(a),recoveryId:i},c),c.fill(HU(n),GH.span),new LY({keys:[],programId:ZH.programId,data:c})}static createInstructionWithPrivateKey(t){const{privateKey:e,message:n,instructionIndex:r}=t;_Y(32===e.length,`Private key must be 32 bytes but received ${e.length} bytes`);try{const t=HU(e),i=QH(t,!1).slice(1),o=p_.from(QU.keccak_256.update(HU(n)).digest()),{signature:a,recid:s}=HH(o,t);return this.createInstructionWithPublicKey({publicKey:i,message:n,signature:a,recoveryId:s,instructionIndex:r})}catch(t){throw new Error(`Error creating instruction; ${t}`)}}}ZH.programId=new cY("KeccakSecp256k11111111111111111111111111111");const VH=new cY("Va1idator1nfo111111111111111111111111111111"),qH=hL({name:cL(),website:sL(cL()),details:sL(cL()),keybaseUsername:sL(cL())});class JH{constructor(t,e){this.key=void 0,this.info=void 0,this.key=t,this.info=e}static fromConfigData(t){let e=[...t];if(2!==vY(e))return null;const n=[];for(let t=0;t<2;t++){const t=new cY(e.slice(0,32));e=e.slice(32);const r=1===e.slice(0,1)[0];e=e.slice(1),n.push({publicKey:t,isSigner:r})}if(n[0].publicKey.equals(VH)&&n[1].isSigner){const t=bY().decode(p_.from(e)),r=JSON.parse(t);return JN(r,qH),new JH(n[1].publicKey,r)}return null}}const KH=new cY("Vote111111111111111111111111111111111111111"),XH=PN([yY("nodePubkey"),yY("authorizedWithdrawer"),jN("commission"),ON(),RN(PN([ON("slot"),DN("confirmationCount")]),kN(DN(),-8),"votes"),jN("rootSlotValid"),ON("rootSlot"),ON(),RN(PN([ON("epoch"),yY("authorizedVoter")]),kN(DN(),-8),"authorizedVoters"),PN([RN(PN([yY("authorizedPubkey"),ON("epochOfLastAuthorizedSwitch"),ON("targetEpoch")]),32,"buf"),ON("idx"),jN("isEmpty")],"priorVoters"),ON(),RN(PN([ON("epoch"),ON("credits"),ON("prevCredits")]),kN(DN(),-8),"epochCredits"),PN([ON("slot"),ON("timestamp")],"lastTimestamp")]);class $H{constructor(t){this.nodePubkey=void 0,this.authorizedWithdrawer=void 0,this.commission=void 0,this.rootSlot=void 0,this.votes=void 0,this.authorizedVoters=void 0,this.priorVoters=void 0,this.epochCredits=void 0,this.lastTimestamp=void 0,this.nodePubkey=t.nodePubkey,this.authorizedWithdrawer=t.authorizedWithdrawer,this.commission=t.commission,this.rootSlot=t.rootSlot,this.votes=t.votes,this.authorizedVoters=t.authorizedVoters,this.priorVoters=t.priorVoters,this.epochCredits=t.epochCredits,this.lastTimestamp=t.lastTimestamp}static fromAccountData(t){const e=XH.decode(HU(t),4);let n=e.rootSlot;return e.rootSlotValid||(n=null),new $H({nodePubkey:new cY(e.nodePubkey),authorizedWithdrawer:new cY(e.authorizedWithdrawer),commission:e.commission,votes:e.votes,rootSlot:n,authorizedVoters:e.authorizedVoters.map(tG),priorVoters:nG(e.priorVoters),epochCredits:e.epochCredits,lastTimestamp:e.lastTimestamp})}}function tG({authorizedVoter:t,epoch:e}){return{epoch:e,authorizedVoter:new cY(t)}}function eG({authorizedPubkey:t,epochOfLastAuthorizedSwitch:e,targetEpoch:n}){return{authorizedPubkey:new cY(t),epochOfLastAuthorizedSwitch:e,targetEpoch:n}}function nG({buf:t,idx:e,isEmpty:n}){return n?[]:[...t.slice(e+1).map(eG),...t.slice(0,e).map(eG)]}class rG{constructor(t,e,n,r){this.nodePubkey=void 0,this.authorizedVoter=void 0,this.authorizedWithdrawer=void 0,this.commission=void 0,this.nodePubkey=t,this.authorizedVoter=e,this.authorizedWithdrawer=n,this.commission=r}}const iG=Object.freeze({InitializeAccount:{index:0,layout:PN([DN("instruction"),((t="voteInit")=>PN([yY("nodePubkey"),yY("authorizedVoter"),yY("authorizedWithdrawer"),jN("commission")],t))()])},Authorize:{index:1,layout:PN([DN("instruction"),yY("newAuthorized"),DN("voteAuthorizationType")])},Withdraw:{index:3,layout:PN([DN("instruction"),zN("lamports")])}}),oG=Object.freeze({Voter:{index:0},Withdrawer:{index:1}});class aG{constructor(){}static initializeAccount(t){const{votePubkey:e,nodePubkey:n,voteInit:r}=t,i=RY(iG.InitializeAccount,{voteInit:{nodePubkey:HU(r.nodePubkey.toBuffer()),authorizedVoter:HU(r.authorizedVoter.toBuffer()),authorizedWithdrawer:HU(r.authorizedWithdrawer.toBuffer()),commission:r.commission}}),o={keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:kY,isSigner:!1,isWritable:!1},{pubkey:AY,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i};return new LY(o)}static createAccount(t){const e=new SY;return e.add(ZY.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.votePubkey,lamports:t.lamports,space:this.space,programId:this.programId})),e.add(this.initializeAccount({votePubkey:t.votePubkey,nodePubkey:t.voteInit.nodePubkey,voteInit:t.voteInit}))}static authorize(t){const{votePubkey:e,authorizedPubkey:n,newAuthorizedPubkey:r,voteAuthorizationType:i}=t,o=RY(iG.Authorize,{newAuthorized:HU(r.toBuffer()),voteAuthorizationType:i.index}),a=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:AY,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return(new SY).add({keys:a,programId:this.programId,data:o})}static withdraw(t){const{votePubkey:e,authorizedWithdrawerPubkey:n,lamports:r,toPubkey:i}=t,o=RY(iG.Withdraw,{lamports:r}),a=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return(new SY).add({keys:a,programId:this.programId,data:o})}}aG.programId=new cY("Vote111111111111111111111111111111111111111"),aG.space=3731;const sG={http:{devnet:"http://api.devnet.solana.com",testnet:"http://api.testnet.solana.com","mainnet-beta":"http://api.mainnet-beta.solana.com/"},https:{devnet:"https://api.devnet.solana.com",testnet:"https://api.testnet.solana.com","mainnet-beta":"https://api.mainnet-beta.solana.com/"}};var uG=Object.freeze({__proto__:null,Account:class{constructor(t){this._keypair=void 0,this._keypair=t?aE.sign.keyPair.fromSecretKey(HU(t)):aE.sign.keyPair()}get publicKey(){return new cY(this._keypair.publicKey)}get secretKey(){return HU(this._keypair.secretKey)}},Authorized:BH,BLOCKHASH_CACHE_TIMEOUT_MS:3e4,BPF_LOADER_DEPRECATED_PROGRAM_ID:mY,BPF_LOADER_PROGRAM_ID:qY,BpfLoader:class{static getMinNumSignatures(t){return VY.getMinNumSignatures(t)}static load(t,e,n,r,i){return VY.load(t,e,n,i,r)}},COMPUTE_BUDGET_INSTRUCTION_LAYOUTS:JY,ComputeBudgetInstruction:class{constructor(){}static decodeInstructionType(t){this.checkProgramId(t.programId);const e=jN("instruction").decode(t.data);let n;for(const[t,r]of Object.entries(JY))if(r.index==e){n=t;break}if(!n)throw new Error("Instruction type incorrect; not a ComputeBudgetInstruction");return n}static decodeRequestUnits(t){this.checkProgramId(t.programId);const{units:e,additionalFee:n}=BY(JY.RequestUnits,t.data);return{units:e,additionalFee:n}}static decodeRequestHeapFrame(t){this.checkProgramId(t.programId);const{bytes:e}=BY(JY.RequestHeapFrame,t.data);return{bytes:e}}static decodeSetComputeUnitLimit(t){this.checkProgramId(t.programId);const{units:e}=BY(JY.SetComputeUnitLimit,t.data);return{units:e}}static decodeSetComputeUnitPrice(t){this.checkProgramId(t.programId);const{microLamports:e}=BY(JY.SetComputeUnitPrice,t.data);return{microLamports:e}}static checkProgramId(t){if(!t.equals(KY.programId))throw new Error("invalid instruction; programId is not ComputeBudgetProgram")}},ComputeBudgetProgram:KY,Connection:DH,Ed25519Program:PH,Enum:class extends sY{constructor(t){if(super(t),this.enum="",1!==Object.keys(t).length)throw new Error("Enum can only take single value");Object.keys(t).map((t=>{this.enum=t}))}},EpochSchedule:rQ,FeeCalculatorLayout:UY,Keypair:OH,LAMPORTS_PER_SOL:1e9,Loader:VY,Lockup:UH,MAX_SEED_LENGTH:32,Message:MY,NONCE_ACCOUNT_LENGTH:WY,NonceAccount:YY,PACKET_DATA_SIZE:gY,PublicKey:cY,SIGNATURE_LENGTH_IN_BYTES:64,SOLANA_SCHEMA:uY,STAKE_CONFIG_ID:RH,STAKE_INSTRUCTION_LAYOUTS:FH,SYSTEM_INSTRUCTION_LAYOUTS:GY,SYSVAR_CLOCK_PUBKEY:AY,SYSVAR_EPOCH_SCHEDULE_PUBKEY:xY,SYSVAR_INSTRUCTIONS_PUBKEY:TY,SYSVAR_RECENT_BLOCKHASHES_PUBKEY:IY,SYSVAR_RENT_PUBKEY:kY,SYSVAR_REWARDS_PUBKEY:jY,SYSVAR_SLOT_HASHES_PUBKEY:CY,SYSVAR_SLOT_HISTORY_PUBKEY:DY,SYSVAR_STAKE_HISTORY_PUBKEY:OY,Secp256k1Program:ZH,SendTransactionError:iQ,SolanaJSONRPCError:oQ,SolanaJSONRPCErrorCode:{JSON_RPC_SERVER_ERROR_BLOCK_CLEANED_UP:-32001,JSON_RPC_SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE:-32002,JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_VERIFICATION_FAILURE:-32003,JSON_RPC_SERVER_ERROR_BLOCK_NOT_AVAILABLE:-32004,JSON_RPC_SERVER_ERROR_NODE_UNHEALTHY:-32005,JSON_RPC_SERVER_ERROR_TRANSACTION_PRECOMPILE_VERIFICATION_FAILURE:-32006,JSON_RPC_SERVER_ERROR_SLOT_SKIPPED:-32007,JSON_RPC_SERVER_ERROR_NO_SNAPSHOT:-32008,JSON_RPC_SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED:-32009,JSON_RPC_SERVER_ERROR_KEY_EXCLUDED_FROM_SECONDARY_INDEX:-32010,JSON_RPC_SERVER_ERROR_TRANSACTION_HISTORY_NOT_AVAILABLE:-32011,JSON_RPC_SCAN_ERROR:-32012,JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_LEN_MISMATCH:-32013,JSON_RPC_SERVER_ERROR_BLOCK_STATUS_NOT_AVAILABLE_YET:-32014,JSON_RPC_SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION:-32015,JSON_RPC_SERVER_ERROR_MIN_CONTEXT_SLOT_NOT_REACHED:-32016},StakeAuthorizationLayout:WH,StakeInstruction:class{constructor(){}static decodeInstructionType(t){this.checkProgramId(t.programId);const e=DN("instruction").decode(t.data);let n;for(const[t,r]of Object.entries(FH))if(r.index==e){n=t;break}if(!n)throw new Error("Instruction type incorrect; not a StakeInstruction");return n}static decodeInitialize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{authorized:e,lockup:n}=BY(FH.Initialize,t.data);return{stakePubkey:t.keys[0].pubkey,authorized:new BH(new cY(e.staker),new cY(e.withdrawer)),lockup:new UH(n.unixTimestamp,n.epoch,new cY(n.custodian))}}static decodeDelegate(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,6),BY(FH.Delegate,t.data),{stakePubkey:t.keys[0].pubkey,votePubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[5].pubkey}}static decodeAuthorize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{newAuthorized:e,stakeAuthorizationType:n}=BY(FH.Authorize,t.data),r={stakePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey,newAuthorizedPubkey:new cY(e),stakeAuthorizationType:{index:n}};return t.keys.length>3&&(r.custodianPubkey=t.keys[3].pubkey),r}static decodeAuthorizeWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{newAuthorized:e,stakeAuthorizationType:n,authoritySeed:r,authorityOwner:i}=BY(FH.AuthorizeWithSeed,t.data),o={stakePubkey:t.keys[0].pubkey,authorityBase:t.keys[1].pubkey,authoritySeed:r,authorityOwner:new cY(i),newAuthorizedPubkey:new cY(e),stakeAuthorizationType:{index:n}};return t.keys.length>3&&(o.custodianPubkey=t.keys[3].pubkey),o}static decodeSplit(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{lamports:e}=BY(FH.Split,t.data);return{stakePubkey:t.keys[0].pubkey,splitStakePubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[2].pubkey,lamports:e}}static decodeMerge(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3),BY(FH.Merge,t.data),{stakePubkey:t.keys[0].pubkey,sourceStakePubKey:t.keys[1].pubkey,authorizedPubkey:t.keys[4].pubkey}}static decodeWithdraw(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,5);const{lamports:e}=BY(FH.Withdraw,t.data),n={stakePubkey:t.keys[0].pubkey,toPubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[4].pubkey,lamports:e};return t.keys.length>5&&(n.custodianPubkey=t.keys[5].pubkey),n}static decodeDeactivate(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3),BY(FH.Deactivate,t.data),{stakePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey}}static checkProgramId(t){if(!t.equals(YH.programId))throw new Error("invalid instruction; programId is not StakeProgram")}static checkKeyLength(t,e){if(t.length<e)throw new Error(`invalid instruction; found ${t.length} keys, expected at least ${e}`)}},StakeProgram:YH,Struct:sY,SystemInstruction:class{constructor(){}static decodeInstructionType(t){this.checkProgramId(t.programId);const e=DN("instruction").decode(t.data);let n;for(const[t,r]of Object.entries(GY))if(r.index==e){n=t;break}if(!n)throw new Error("Instruction type incorrect; not a SystemInstruction");return n}static decodeCreateAccount(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{lamports:e,space:n,programId:r}=BY(GY.Create,t.data);return{fromPubkey:t.keys[0].pubkey,newAccountPubkey:t.keys[1].pubkey,lamports:e,space:n,programId:new cY(r)}}static decodeTransfer(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{lamports:e}=BY(GY.Transfer,t.data);return{fromPubkey:t.keys[0].pubkey,toPubkey:t.keys[1].pubkey,lamports:e}}static decodeTransferWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{lamports:e,seed:n,programId:r}=BY(GY.TransferWithSeed,t.data);return{fromPubkey:t.keys[0].pubkey,basePubkey:t.keys[1].pubkey,toPubkey:t.keys[2].pubkey,lamports:e,seed:n,programId:new cY(r)}}static decodeAllocate(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,1);const{space:e}=BY(GY.Allocate,t.data);return{accountPubkey:t.keys[0].pubkey,space:e}}static decodeAllocateWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,1);const{base:e,seed:n,space:r,programId:i}=BY(GY.AllocateWithSeed,t.data);return{accountPubkey:t.keys[0].pubkey,basePubkey:new cY(e),seed:n,space:r,programId:new cY(i)}}static decodeAssign(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,1);const{programId:e}=BY(GY.Assign,t.data);return{accountPubkey:t.keys[0].pubkey,programId:new cY(e)}}static decodeAssignWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,1);const{base:e,seed:n,programId:r}=BY(GY.AssignWithSeed,t.data);return{accountPubkey:t.keys[0].pubkey,basePubkey:new cY(e),seed:n,programId:new cY(r)}}static decodeCreateWithSeed(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{base:e,seed:n,lamports:r,space:i,programId:o}=BY(GY.CreateWithSeed,t.data);return{fromPubkey:t.keys[0].pubkey,newAccountPubkey:t.keys[1].pubkey,basePubkey:new cY(e),seed:n,lamports:r,space:i,programId:new cY(o)}}static decodeNonceInitialize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{authorized:e}=BY(GY.InitializeNonceAccount,t.data);return{noncePubkey:t.keys[0].pubkey,authorizedPubkey:new cY(e)}}static decodeNonceAdvance(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3),BY(GY.AdvanceNonceAccount,t.data),{noncePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey}}static decodeNonceWithdraw(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,5);const{lamports:e}=BY(GY.WithdrawNonceAccount,t.data);return{noncePubkey:t.keys[0].pubkey,toPubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[4].pubkey,lamports:e}}static decodeNonceAuthorize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);const{authorized:e}=BY(GY.AuthorizeNonceAccount,t.data);return{noncePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[1].pubkey,newAuthorizedPubkey:new cY(e)}}static checkProgramId(t){if(!t.equals(ZY.programId))throw new Error("invalid instruction; programId is not SystemProgram")}static checkKeyLength(t,e){if(t.length<e)throw new Error(`invalid instruction; found ${t.length} keys, expected at least ${e}`)}},SystemProgram:ZY,Transaction:SY,TransactionExpiredBlockheightExceededError:sQ,TransactionExpiredTimeoutError:uQ,TransactionInstruction:LY,get TransactionStatus(){return EY},VALIDATOR_INFO_KEY:VH,VOTE_PROGRAM_ID:KH,ValidatorInfo:JH,VoteAccount:$H,VoteAuthorizationLayout:oG,VoteInit:rG,VoteInstruction:class{constructor(){}static decodeInstructionType(t){this.checkProgramId(t.programId);const e=DN("instruction").decode(t.data);let n;for(const[t,r]of Object.entries(iG))if(r.index==e){n=t;break}if(!n)throw new Error("Instruction type incorrect; not a VoteInstruction");return n}static decodeInitializeAccount(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,4);const{voteInit:e}=BY(iG.InitializeAccount,t.data);return{votePubkey:t.keys[0].pubkey,nodePubkey:t.keys[3].pubkey,voteInit:new rG(new cY(e.nodePubkey),new cY(e.authorizedVoter),new cY(e.authorizedWithdrawer),e.commission)}}static decodeAuthorize(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{newAuthorized:e,voteAuthorizationType:n}=BY(iG.Authorize,t.data);return{votePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey,newAuthorizedPubkey:new cY(e),voteAuthorizationType:{index:n}}}static decodeWithdraw(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);const{lamports:e}=BY(iG.Withdraw,t.data);return{votePubkey:t.keys[0].pubkey,authorizedWithdrawerPubkey:t.keys[2].pubkey,lamports:e,toPubkey:t.keys[1].pubkey}}static checkProgramId(t){if(!t.equals(aG.programId))throw new Error("invalid instruction; programId is not VoteProgram")}static checkKeyLength(t,e){if(t.length<e)throw new Error(`invalid instruction; found ${t.length} keys, expected at least ${e}`)}},VoteProgram:aG,clusterApiUrl:function(t,e){const n=!1===e?"http":"https";if(!t)return sG[n].devnet;const r=sG[n][t];if(!r)throw new Error(`Unknown ${n} cluster: ${t}`);return r},sendAndConfirmRawTransaction:async function(t,e,n,r){let i,o;n&&Object.prototype.hasOwnProperty.call(n,"lastValidBlockHeight")?(i=n,o=r):o=n;const a=o&&{skipPreflight:o.skipPreflight,preflightCommitment:o.preflightCommitment||o.commitment,minContextSlot:o.minContextSlot},s=await t.sendRawTransaction(e,a),u=o&&o.commitment,c=i?t.confirmTransaction(i,u):t.confirmTransaction(s,u),l=(await c).value;if(l.err)throw new Error(`Raw transaction ${s} failed (${JSON.stringify(l)})`);return s},sendAndConfirmTransaction:zY}),cG={};class lG{constructor(t,e){if(!Number.isInteger(t))throw new TypeError("span must be an integer");this.span=t,this.property=e}makeDestinationObject(){return{}}decode(t,e){throw new Error("Layout is abstract")}encode(t,e,n){throw new Error("Layout is abstract")}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 hG(t,e){return e.property?t+"["+e.property+"]":t}cG.Layout=lG,cG.nameWithProperty=hG,cG.bindConstructorLayout=function(t,e){if("function"!=typeof t)throw new TypeError("Class must be constructor");if(t.hasOwnProperty("layout_"))throw new Error("Class is already bound to a layout");if(!(e&&e instanceof lG))throw new TypeError("layout must be a Layout");if(e.hasOwnProperty("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:function(t,n){return e.encode(this,t,n)},writable:!0}),Object.defineProperty(t,"decode",{value:function(t,n){return e.decode(t,n)},writable:!0})};class dG extends lG{isCount(){throw new Error("ExternalLayout is abstract")}}class fG extends dG{constructor(t,e){if(void 0===t&&(t=1),!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){void 0===e&&(e=0);const n=t.length-e;return Math.floor(n/this.elementSpan)}encode(t,e,n){return 0}}class pG extends dG{constructor(t,e,n){if(!(t instanceof lG))throw new TypeError("layout must be a Layout");if(void 0===e)e=0;else if(!Number.isInteger(e))throw new TypeError("offset must be integer or undefined");super(t.span,n||t.property),this.layout=t,this.offset=e}isCount(){return this.layout instanceof mG||this.layout instanceof gG}decode(t,e){return void 0===e&&(e=0),this.layout.decode(t,e+this.offset)}encode(t,e,n){return void 0===n&&(n=0),this.layout.encode(t,e,n+this.offset)}}class mG extends lG{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e){return void 0===e&&(e=0),t.readUIntLE(e,this.span)}encode(t,e,n){return void 0===n&&(n=0),e.writeUIntLE(t,n,this.span),this.span}}class gG extends lG{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e){return void 0===e&&(e=0),t.readUIntBE(e,this.span)}encode(t,e,n){return void 0===n&&(n=0),e.writeUIntBE(t,n,this.span),this.span}}class yG extends lG{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e){return void 0===e&&(e=0),t.readIntLE(e,this.span)}encode(t,e,n){return void 0===n&&(n=0),e.writeIntLE(t,n,this.span),this.span}}class bG extends lG{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e){return void 0===e&&(e=0),t.readIntBE(e,this.span)}encode(t,e,n){return void 0===n&&(n=0),e.writeIntBE(t,n,this.span),this.span}}const vG=Math.pow(2,32);function wG(t){const e=Math.floor(t/vG);return{hi32:e,lo32:t-e*vG}}function MG(t,e){return t*vG+e}class _G extends lG{constructor(t){super(8,t)}decode(t,e){void 0===e&&(e=0);const n=t.readUInt32LE(e);return MG(t.readUInt32LE(e+4),n)}encode(t,e,n){void 0===n&&(n=0);const r=wG(t);return e.writeUInt32LE(r.lo32,n),e.writeUInt32LE(r.hi32,n+4),8}}class EG extends lG{constructor(t){super(8,t)}decode(t,e){void 0===e&&(e=0);return MG(t.readUInt32BE(e),t.readUInt32BE(e+4))}encode(t,e,n){void 0===n&&(n=0);const r=wG(t);return e.writeUInt32BE(r.hi32,n),e.writeUInt32BE(r.lo32,n+4),8}}class NG extends lG{constructor(t){super(8,t)}decode(t,e){void 0===e&&(e=0);const n=t.readUInt32LE(e);return MG(t.readInt32LE(e+4),n)}encode(t,e,n){void 0===n&&(n=0);const r=wG(t);return e.writeUInt32LE(r.lo32,n),e.writeInt32LE(r.hi32,n+4),8}}class LG extends lG{constructor(t){super(8,t)}decode(t,e){void 0===e&&(e=0);return MG(t.readInt32BE(e),t.readUInt32BE(e+4))}encode(t,e,n){void 0===n&&(n=0);const r=wG(t);return e.writeInt32BE(r.hi32,n),e.writeUInt32BE(r.lo32,n+4),8}}class SG extends lG{constructor(t){super(4,t)}decode(t,e){return void 0===e&&(e=0),t.readFloatLE(e)}encode(t,e,n){return void 0===n&&(n=0),e.writeFloatLE(t,n),4}}class AG extends lG{constructor(t){super(4,t)}decode(t,e){return void 0===e&&(e=0),t.readFloatBE(e)}encode(t,e,n){return void 0===n&&(n=0),e.writeFloatBE(t,n),4}}class xG extends lG{constructor(t){super(8,t)}decode(t,e){return void 0===e&&(e=0),t.readDoubleLE(e)}encode(t,e,n){return void 0===n&&(n=0),e.writeDoubleLE(t,n),8}}class TG extends lG{constructor(t){super(8,t)}decode(t,e){return void 0===e&&(e=0),t.readDoubleBE(e)}encode(t,e,n){return void 0===n&&(n=0),e.writeDoubleBE(t,n),8}}class IG extends lG{constructor(t,e,n){if(!(t instanceof lG))throw new TypeError("elementLayout must be a Layout");if(!(e instanceof dG&&e.isCount()||Number.isInteger(e)&&0<=e))throw new TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");let r=-1;!(e instanceof dG)&&0<t.span&&(r=e*t.span),super(r,n),this.elementLayout=t,this.count=e}getSpan(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);let n=0,r=this.count;if(r instanceof dG&&(r=r.decode(t,e)),0<this.elementLayout.span)n=r*this.elementLayout.span;else{let i=0;for(;i<r;)n+=this.elementLayout.getSpan(t,e+n),++i}return n}decode(t,e){void 0===e&&(e=0);const n=[];let r=0,i=this.count;for(i instanceof dG&&(i=i.decode(t,e));r<i;)n.push(this.elementLayout.decode(t,e)),e+=this.elementLayout.getSpan(t,e),r+=1;return n}encode(t,e,n){void 0===n&&(n=0);const r=this.elementLayout,i=t.reduce(((t,i)=>t+r.encode(i,e,n+t)),0);return this.count instanceof dG&&this.count.encode(t.length,e,n),i}}class kG extends lG{constructor(t,e,n){if(!Array.isArray(t)||!t.reduce(((t,e)=>t&&e instanceof lG),!0))throw new TypeError("fields must be array of Layout instances");"boolean"==typeof e&&void 0===n&&(n=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 r=-1;try{r=t.reduce(((t,e)=>t+e.getSpan()),0)}catch(t){}super(r,e),this.fields=t,this.decodePrefixes=!!n}getSpan(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);let n=0;try{n=this.fields.reduce(((n,r)=>{const i=r.getSpan(t,e);return e+=i,n+i}),0)}catch(t){throw new RangeError("indeterminate span")}return n}decode(t,e){void 0===e&&(e=0);const n=this.makeDestinationObject();for(const r of this.fields)if(void 0!==r.property&&(n[r.property]=r.decode(t,e)),e+=r.getSpan(t,e),this.decodePrefixes&&t.length===e)break;return n}encode(t,e,n){void 0===n&&(n=0);const r=n;let i=0,o=0;for(const r of this.fields){let a=r.span;if(o=0<a?a:0,void 0!==r.property){const i=t[r.property];void 0!==i&&(o=r.encode(i,e,n),0>a&&(a=r.getSpan(e,n)))}i=n,n+=a}return i+o-r}fromArray(t){const e=this.makeDestinationObject();for(const n of this.fields)void 0!==n.property&&0<t.length&&(e[n.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 n of this.fields){if(n.property===t)return e;0>n.span?e=-1:0<=e&&(e+=n.span)}}}class jG{constructor(t){this.property=t}decode(){throw new Error("UnionDiscriminator is abstract")}encode(){throw new Error("UnionDiscriminator is abstract")}}class CG extends jG{constructor(t,e){if(!(t instanceof dG&&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,n){return this.layout.encode(t,e,n)}}class DG extends lG{constructor(t,e,n){const r=t instanceof mG||t instanceof gG;if(r)t=new CG(new pG(t));else if(t instanceof dG&&t.isCount())t=new CG(t);else if(!(t instanceof jG))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(void 0===e&&(e=null),!(null===e||e instanceof lG))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&&r&&(i+=t.layout.span)),super(i,n),this.discriminator=t,this.usesPrefixDiscriminator=r,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){if(0<=this.span)return this.span;void 0===e&&(e=0);const n=this.getVariant(t,e);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(t,e)}defaultGetSourceVariant(t){if(t.hasOwnProperty(this.discriminator.property)){if(this.defaultLayout&&t.hasOwnProperty(this.defaultLayout.property))return;const e=this.registry[t[this.discriminator.property]];if(e&&(!e.layout||t.hasOwnProperty(e.property)))return e}else for(const e in this.registry){const n=this.registry[e];if(t.hasOwnProperty(n.property))return n}throw new Error("unable to infer src variant")}decode(t,e){let n;void 0===e&&(e=0);const r=this.discriminator,i=r.decode(t,e);let o=this.registry[i];if(void 0===o){let a=0;o=this.defaultLayout,this.usesPrefixDiscriminator&&(a=r.layout.span),n=this.makeDestinationObject(),n[r.property]=i,n[o.property]=this.defaultLayout.decode(t,e+a)}else n=o.decode(t,e);return n}encode(t,e,n){void 0===n&&(n=0);const r=this.getSourceVariant(t);if(void 0===r){const r=this.discriminator,i=this.defaultLayout;let o=0;return this.usesPrefixDiscriminator&&(o=r.layout.span),r.encode(t[r.property],e,n),o+i.encode(t[i.property],e,n+o)}return r.encode(t,e,n)}addVariant(t,e,n){const r=new OG(this,t,e,n);return this.registry[t]=r,r}getVariant(t,e){let n=t;return p_.isBuffer(t)&&(void 0===e&&(e=0),n=this.discriminator.decode(t,e)),this.registry[n]}}class OG extends lG{constructor(t,e,n,r){if(!(t instanceof DG))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 n&&void 0===r&&(r=n,n=null),n){if(!(n instanceof lG))throw new TypeError("layout must be a Layout");if(null!==t.defaultLayout&&0<=n.span&&n.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if("string"!=typeof r)throw new TypeError("variant must have a String property")}let i=t.span;0>t.span&&(i=n?n.span:0,0<=i&&t.usesPrefixDiscriminator&&(i+=t.discriminator.layout.span)),super(i,r),this.union=t,this.variant=e,this.layout=n||null}getSpan(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);let n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),n+this.layout.getSpan(t,e+n)}decode(t,e){const n=this.makeDestinationObject();if(void 0===e&&(e=0),this!==this.union.getVariant(t,e))throw new Error("variant mismatch");let r=0;return this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(t,e+r):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(t,e,n){void 0===n&&(n=0);let r=0;if(this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout&&!t.hasOwnProperty(this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,e,n);let i=r;if(this.layout&&(this.layout.encode(t[this.property],e,n+r),i+=this.layout.getSpan(e,n+r),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 zG(t){return 0>t&&(t+=4294967296),t}class PG extends lG{constructor(t,e,n){if(!(t instanceof mG||t instanceof gG))throw new TypeError("word must be a UInt or UIntBE layout");if("string"==typeof e&&void 0===n&&(n=e,e=void 0),4<t.span)throw new RangeError("word cannot exceed 32 bits");super(t.span,n),this.word=t,this.msb=!!e,this.fields=[];let r=0;this._packedSetValue=function(t){return r=zG(t),this},this._packedGetValue=function(){return r}}decode(t,e){const n=this.makeDestinationObject();void 0===e&&(e=0);const r=this.word.decode(t,e);this._packedSetValue(r);for(const t of this.fields)void 0!==t.property&&(n[t.property]=t.decode(r));return n}encode(t,e,n){void 0===n&&(n=0);const r=this.word.decode(e,n);this._packedSetValue(r);for(const e of this.fields)if(void 0!==e.property){const n=t[e.property];void 0!==n&&e.encode(n)}return this.word.encode(this._packedGetValue(),e,n)}addField(t,e){const n=new RG(this,t,e);return this.fields.push(n),n}addBoolean(t){const e=new BG(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}}class RG{constructor(t,e,n){if(!(t instanceof PG))throw new TypeError("container must be a BitStructure");if(!Number.isInteger(e)||0>=e)throw new TypeError("bits must be positive integer");const r=8*t.span,i=t.fields.reduce(((t,e)=>t+e.bits),0);if(e+i>r)throw new Error("bits too long for span remainder ("+(r-i)+" of "+r+" 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=r-i-e),this.wordMask=zG(this.valueMask<<this.start),this.property=n}decode(){return zG(this.container._packedGetValue()&this.wordMask)>>>this.start}encode(t){if(!Number.isInteger(t)||t!==zG(t&this.valueMask))throw new TypeError(hG("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const e=this.container._packedGetValue(),n=zG(t<<this.start);this.container._packedSetValue(zG(e&~this.wordMask)|n)}}class BG extends RG{constructor(t,e){super(t,1,e)}decode(t,e){return!!RG.prototype.decode.call(this,t,e)}encode(t){return"boolean"==typeof t&&(t=+t),RG.prototype.encode.call(this,t)}}class UG extends lG{constructor(t,e){if(!(t instanceof dG&&t.isCount()||Number.isInteger(t)&&0<=t))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");let n=-1;t instanceof dG||(n=t),super(n,e),this.length=t}getSpan(t,e){let n=this.span;return 0>n&&(n=this.length.decode(t,e)),n}decode(t,e){void 0===e&&(e=0);let n=this.span;return 0>n&&(n=this.length.decode(t,e)),t.slice(e,e+n)}encode(t,e,n){let r=this.length;if(this.length instanceof dG&&(r=t.length),!p_.isBuffer(t)||r!==t.length)throw new TypeError(hG("Blob.encode",this)+" requires (length "+r+") Buffer as src");if(n+r>e.length)throw new RangeError("encoding overruns Buffer");return e.write(t.toString("hex"),n,r,"hex"),this.length instanceof dG&&this.length.encode(r,e,n),r}}class FG extends lG{constructor(t){super(-1,t)}getSpan(t,e){if(!p_.isBuffer(t))throw new TypeError("b must be a Buffer");void 0===e&&(e=0);let n=e;for(;n<t.length&&0!==t[n];)n+=1;return 1+n-e}decode(t,e,n){void 0===e&&(e=0);let r=this.getSpan(t,e);return t.slice(e,e+r-1).toString("utf-8")}encode(t,e,n){void 0===n&&(n=0),"string"!=typeof t&&(t=t.toString());const r=new p_(t,"utf8"),i=r.length;if(n+i>e.length)throw new RangeError("encoding overruns Buffer");return r.copy(e,n),e[n+i]=0,i+1}}class WG extends lG{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){if(!p_.isBuffer(t))throw new TypeError("b must be a Buffer");return void 0===e&&(e=0),t.length-e}decode(t,e,n){void 0===e&&(e=0);let r=this.getSpan(t,e);if(0<=this.maxSpan&&this.maxSpan<r)throw new RangeError("text length exceeds maxSpan");return t.slice(e,e+r).toString("utf-8")}encode(t,e,n){void 0===n&&(n=0),"string"!=typeof t&&(t=t.toString());const r=new p_(t,"utf8"),i=r.length;if(0<=this.maxSpan&&this.maxSpan<i)throw new RangeError("text length exceeds maxSpan");if(n+i>e.length)throw new RangeError("encoding overruns Buffer");return r.copy(e,n),i}}class YG extends lG{constructor(t,e){super(0,e),this.value=t}decode(t,e,n){return this.value}encode(t,e,n){return 0}}cG.ExternalLayout=dG,cG.GreedyCount=fG,cG.OffsetLayout=pG,cG.UInt=mG,cG.UIntBE=gG,cG.Int=yG,cG.IntBE=bG,cG.Float=SG,cG.FloatBE=AG,cG.Double=xG,cG.DoubleBE=TG,cG.Sequence=IG,cG.Structure=kG,cG.UnionDiscriminator=jG,cG.UnionLayoutDiscriminator=CG,cG.Union=DG,cG.VariantLayout=OG,cG.BitStructure=PG,cG.BitField=RG,cG.Boolean=BG,cG.Blob=UG,cG.CString=FG,cG.UTF8=WG,cG.Constant=YG,cG.greedy=(t,e)=>new fG(t,e),cG.offset=(t,e,n)=>new pG(t,e,n),cG.u8=t=>new mG(1,t),cG.u16=t=>new mG(2,t),cG.u24=t=>new mG(3,t),cG.u32=t=>new mG(4,t),cG.u40=t=>new mG(5,t),cG.u48=t=>new mG(6,t),cG.nu64=t=>new _G(t),cG.u16be=t=>new gG(2,t),cG.u24be=t=>new gG(3,t),cG.u32be=t=>new gG(4,t),cG.u40be=t=>new gG(5,t),cG.u48be=t=>new gG(6,t),cG.nu64be=t=>new EG(t),cG.s8=t=>new yG(1,t),cG.s16=t=>new yG(2,t),cG.s24=t=>new yG(3,t),cG.s32=t=>new yG(4,t),cG.s40=t=>new yG(5,t),cG.s48=t=>new yG(6,t),cG.ns64=t=>new NG(t),cG.s16be=t=>new bG(2,t),cG.s24be=t=>new bG(3,t),cG.s32be=t=>new bG(4,t),cG.s40be=t=>new bG(5,t),cG.s48be=t=>new bG(6,t),cG.ns64be=t=>new LG(t),cG.f32=t=>new SG(t),cG.f32be=t=>new AG(t),cG.f64=t=>new xG(t),cG.f64be=t=>new TG(t),cG.struct=(t,e,n)=>new kG(t,e,n),cG.bits=(t,e,n)=>new PG(t,e,n);var QG=cG.seq=(t,e,n)=>new IG(t,e,n);cG.union=(t,e,n)=>new DG(t,e,n),cG.unionLayoutDiscriminator=(t,e)=>new CG(t,e);var HG=cG.blob=(t,e)=>new UG(t,e);cG.cstr=t=>new FG(t),cG.utf8=(t,e)=>new WG(t,e),cG.const=(t,e)=>new YG(t,e);var GG={},ZG=XM(uG),VG={exports:{}};!function(t,e){function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function r(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}function i(t,e,n){if(i.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(n=e,e=10),this._init(t||0,e||10,n||"be"))}var o;"object"==typeof t?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:tE.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 s(t,e,n){var r=a(t,n);return n-1>=e&&(r|=a(t,n-1)<<4),r}function u(t,e,r,i){for(var o=0,a=0,s=Math.min(t.length,r),u=e;u<s;u++){var c=t.charCodeAt(u)-48;o*=i,a=c>=49?c-49+10:c>=17?c-17+10:c,n(c>=0&&a<i,"Invalid character"),o+=a}return o}function c(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(i.isBN=function(t){return t instanceof i||null!==t&&"object"==typeof t&&t.constructor.wordSize===i.wordSize&&Array.isArray(t.words)},i.max=function(t,e){return t.cmp(e)>0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.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)))},i.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)},i.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,a,s=0;if("be"===r)for(i=t.length-1,o=0;i>=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i<t.length;i+=3)a=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},i.prototype._parseHex=function(t,e,n){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var i,o=0,a=0;if("be"===n)for(r=t.length-1;r>=e;r-=2)i=s(t,e,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(r=(t.length-e)%2==0?e+1:e;r<t.length;r+=2)i=s(t,e,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(t,e,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=e)r++;r--,i=i/e|0;for(var o=t.length-n,a=o%r,s=Math.min(o,o-a)+n,c=0,l=n;l<s;l+=r)c=u(t,l,l+r,e),this.imuln(i),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==a){var h=1;for(c=u(t,l,t.length,e),l=0;l<a;l++)h*=e;this.imuln(h),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}this._strip()},i.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},i.prototype._move=function(t){c(t,this)},i.prototype.clone=function(){var t=new i(null);return this.copy(t),t},i.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},i.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){i.prototype.inspect=l}else i.prototype.inspect=l;function l(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var h=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[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 p(t,e,n){n.negative=e.negative^t.negative;var r=t.length+e.length|0;n.length=r,r=r-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,u=a/67108864|0;n.words[0]=s;for(var c=1;c<r;c++){for(var l=u>>>26,h=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;l+=(a=(i=0|t.words[p])*(o=0|e.words[f])+h)/67108864|0,h=67108863&a}n.words[c]=0|h,u=0|l}return 0!==u?n.words[c]=0|u:n.length--,n._strip()}i.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,a=0;a<this.length;a++){var s=this.words[a],u=(16777215&(s<<i|o)).toString(16);o=s>>>24-i&16777215,(i+=2)>=26&&(i-=26,a--),r=0!==o||a!==this.length-1?h[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=d[t],l=f[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modrn(l).toString(t);r=(p=p.idivn(l)).isZero()?m+r:h[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")},i.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},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},i.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 a=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](a,i),a},i.prototype._toArrayLikeLE=function(t,e){for(var n=0,r=0,i=0,o=0;i<this.length;i++){var a=this.words[i]<<o|r;t[n++]=255&a,n<t.length&&(t[n++]=a>>8&255),n<t.length&&(t[n++]=a>>16&255),6===o?(n<t.length&&(t[n++]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n<t.length)for(t[n++]=r;n<t.length;)t[n++]=0},i.prototype._toArrayLikeBE=function(t,e){for(var n=t.length-1,r=0,i=0,o=0;i<this.length;i++){var a=this.words[i]<<o|r;t[n--]=255&a,n>=0&&(t[n--]=a>>8&255),n>=0&&(t[n--]=a>>16&255),6===o?(n>=0&&(t[n--]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n>=0)for(t[n--]=r;n>=0;)t[n--]=0},Math.clz32?i.prototype._countBits=function(t){return 32-Math.clz32(t)}:i.prototype._countBits=function(t){var e=t,n=0;return e>=4096&&(n+=13,e>>>=13),e>=64&&(n+=7,e>>>=7),e>=8&&(n+=4,e>>>=4),e>=2&&(n+=2,e>>>=2),n+e},i.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,n=0;return 0==(8191&e)&&(n+=13,e>>>=13),0==(127&e)&&(n+=7,e>>>=7),0==(15&e)&&(n+=4,e>>>=4),0==(3&e)&&(n+=2,e>>>=2),0==(1&e)&&n++,n},i.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var n=this._zeroBits(this.words[e]);if(t+=n,26!==n)break}return t},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},i.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return 0!==this.negative},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.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()},i.prototype.ior=function(t){return n(0==(this.negative|t.negative)),this.iuor(t)},i.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},i.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var n=0;n<e.length;n++)this.words[n]=this.words[n]&t.words[n];return this.length=e.length,this._strip()},i.prototype.iand=function(t){return n(0==(this.negative|t.negative)),this.iuand(t)},i.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},i.prototype.iuxor=function(t){var e,n;this.length>t.length?(e=this,n=t):(e=t,n=this);for(var r=0;r<n.length;r++)this.words[r]=e.words[r]^n.words[r];if(this!==e)for(;r<e.length;r++)this.words[r]=e.words[r];return this.length=e.length,this._strip()},i.prototype.ixor=function(t){return n(0==(this.negative|t.negative)),this.iuxor(t)},i.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},i.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()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.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()},i.prototype.iadd=function(t){var e,n,r;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?(n=this,r=t):(n=t,r=this);for(var i=0,o=0;o<r.length;o++)e=(0|n.words[o])+(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<n.length;o++)e=(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;o<n.length;o++)this.words[o]=n.words[o];return this},i.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)},i.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 n,r,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=t):(n=t,r=this);for(var o=0,a=0;a<r.length;a++)o=(e=(0|n.words[a])-(0|r.words[a])+o)>>26,this.words[a]=67108863&e;for(;0!==o&&a<n.length;a++)o=(e=(0|n.words[a])+o)>>26,this.words[a]=67108863&e;if(0===o&&a<n.length&&n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this.length=Math.max(this.length,a),n!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(t){return this.clone().isub(t)};var m=function(t,e,n){var r,i,o,a=t.words,s=e.words,u=n.words,c=0,l=0|a[0],h=8191&l,d=l>>>13,f=0|a[1],p=8191&f,m=f>>>13,g=0|a[2],y=8191&g,b=g>>>13,v=0|a[3],w=8191&v,M=v>>>13,_=0|a[4],E=8191&_,N=_>>>13,L=0|a[5],S=8191&L,A=L>>>13,x=0|a[6],T=8191&x,I=x>>>13,k=0|a[7],j=8191&k,C=k>>>13,D=0|a[8],O=8191&D,z=D>>>13,P=0|a[9],R=8191&P,B=P>>>13,U=0|s[0],F=8191&U,W=U>>>13,Y=0|s[1],Q=8191&Y,H=Y>>>13,G=0|s[2],Z=8191&G,V=G>>>13,q=0|s[3],J=8191&q,K=q>>>13,X=0|s[4],$=8191&X,tt=X>>>13,et=0|s[5],nt=8191&et,rt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ct=st>>>13,lt=0|s[8],ht=8191<,dt=lt>>>13,ft=0|s[9],pt=8191&ft,mt=ft>>>13;n.negative=t.negative^e.negative,n.length=19;var gt=(c+(r=Math.imul(h,F))|0)+((8191&(i=(i=Math.imul(h,W))+Math.imul(d,F)|0))<<13)|0;c=((o=Math.imul(d,W))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(p,F),i=(i=Math.imul(p,W))+Math.imul(m,F)|0,o=Math.imul(m,W);var yt=(c+(r=r+Math.imul(h,Q)|0)|0)+((8191&(i=(i=i+Math.imul(h,H)|0)+Math.imul(d,Q)|0))<<13)|0;c=((o=o+Math.imul(d,H)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,r=Math.imul(y,F),i=(i=Math.imul(y,W))+Math.imul(b,F)|0,o=Math.imul(b,W),r=r+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,H)|0;var bt=(c+(r=r+Math.imul(h,Z)|0)|0)+((8191&(i=(i=i+Math.imul(h,V)|0)+Math.imul(d,Z)|0))<<13)|0;c=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(w,F),i=(i=Math.imul(w,W))+Math.imul(M,F)|0,o=Math.imul(M,W),r=r+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,H)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,H)|0,r=r+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,V)|0;var vt=(c+(r=r+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,K)|0)+Math.imul(d,J)|0))<<13)|0;c=((o=o+Math.imul(d,K)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(E,F),i=(i=Math.imul(E,W))+Math.imul(N,F)|0,o=Math.imul(N,W),r=r+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,H)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,H)|0,r=r+Math.imul(y,Z)|0,i=(i=i+Math.imul(y,V)|0)+Math.imul(b,Z)|0,o=o+Math.imul(b,V)|0,r=r+Math.imul(p,J)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,K)|0;var wt=(c+(r=r+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,tt)|0)+Math.imul(d,$)|0))<<13)|0;c=((o=o+Math.imul(d,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(S,F),i=(i=Math.imul(S,W))+Math.imul(A,F)|0,o=Math.imul(A,W),r=r+Math.imul(E,Q)|0,i=(i=i+Math.imul(E,H)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,H)|0,r=r+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,V)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,V)|0,r=r+Math.imul(y,J)|0,i=(i=i+Math.imul(y,K)|0)+Math.imul(b,J)|0,o=o+Math.imul(b,K)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,tt)|0;var Mt=(c+(r=r+Math.imul(h,nt)|0)|0)+((8191&(i=(i=i+Math.imul(h,rt)|0)+Math.imul(d,nt)|0))<<13)|0;c=((o=o+Math.imul(d,rt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(T,F),i=(i=Math.imul(T,W))+Math.imul(I,F)|0,o=Math.imul(I,W),r=r+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,H)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,H)|0,r=r+Math.imul(E,Z)|0,i=(i=i+Math.imul(E,V)|0)+Math.imul(N,Z)|0,o=o+Math.imul(N,V)|0,r=r+Math.imul(w,J)|0,i=(i=i+Math.imul(w,K)|0)+Math.imul(M,J)|0,o=o+Math.imul(M,K)|0,r=r+Math.imul(y,$)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(b,$)|0,o=o+Math.imul(b,tt)|0,r=r+Math.imul(p,nt)|0,i=(i=i+Math.imul(p,rt)|0)+Math.imul(m,nt)|0,o=o+Math.imul(m,rt)|0;var _t=(c+(r=r+Math.imul(h,ot)|0)|0)+((8191&(i=(i=i+Math.imul(h,at)|0)+Math.imul(d,ot)|0))<<13)|0;c=((o=o+Math.imul(d,at)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,r=Math.imul(j,F),i=(i=Math.imul(j,W))+Math.imul(C,F)|0,o=Math.imul(C,W),r=r+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,H)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,H)|0,r=r+Math.imul(S,Z)|0,i=(i=i+Math.imul(S,V)|0)+Math.imul(A,Z)|0,o=o+Math.imul(A,V)|0,r=r+Math.imul(E,J)|0,i=(i=i+Math.imul(E,K)|0)+Math.imul(N,J)|0,o=o+Math.imul(N,K)|0,r=r+Math.imul(w,$)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,tt)|0,r=r+Math.imul(y,nt)|0,i=(i=i+Math.imul(y,rt)|0)+Math.imul(b,nt)|0,o=o+Math.imul(b,rt)|0,r=r+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,at)|0;var Et=(c+(r=r+Math.imul(h,ut)|0)|0)+((8191&(i=(i=i+Math.imul(h,ct)|0)+Math.imul(d,ut)|0))<<13)|0;c=((o=o+Math.imul(d,ct)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(O,F),i=(i=Math.imul(O,W))+Math.imul(z,F)|0,o=Math.imul(z,W),r=r+Math.imul(j,Q)|0,i=(i=i+Math.imul(j,H)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,H)|0,r=r+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,V)|0)+Math.imul(I,Z)|0,o=o+Math.imul(I,V)|0,r=r+Math.imul(S,J)|0,i=(i=i+Math.imul(S,K)|0)+Math.imul(A,J)|0,o=o+Math.imul(A,K)|0,r=r+Math.imul(E,$)|0,i=(i=i+Math.imul(E,tt)|0)+Math.imul(N,$)|0,o=o+Math.imul(N,tt)|0,r=r+Math.imul(w,nt)|0,i=(i=i+Math.imul(w,rt)|0)+Math.imul(M,nt)|0,o=o+Math.imul(M,rt)|0,r=r+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,at)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,at)|0,r=r+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 Nt=(c+(r=r+Math.imul(h,ht)|0)|0)+((8191&(i=(i=i+Math.imul(h,dt)|0)+Math.imul(d,ht)|0))<<13)|0;c=((o=o+Math.imul(d,dt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,r=Math.imul(R,F),i=(i=Math.imul(R,W))+Math.imul(B,F)|0,o=Math.imul(B,W),r=r+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,H)|0)+Math.imul(z,Q)|0,o=o+Math.imul(z,H)|0,r=r+Math.imul(j,Z)|0,i=(i=i+Math.imul(j,V)|0)+Math.imul(C,Z)|0,o=o+Math.imul(C,V)|0,r=r+Math.imul(T,J)|0,i=(i=i+Math.imul(T,K)|0)+Math.imul(I,J)|0,o=o+Math.imul(I,K)|0,r=r+Math.imul(S,$)|0,i=(i=i+Math.imul(S,tt)|0)+Math.imul(A,$)|0,o=o+Math.imul(A,tt)|0,r=r+Math.imul(E,nt)|0,i=(i=i+Math.imul(E,rt)|0)+Math.imul(N,nt)|0,o=o+Math.imul(N,rt)|0,r=r+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,at)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,at)|0,r=r+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ct)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,ct)|0,r=r+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,dt)|0)+Math.imul(m,ht)|0,o=o+Math.imul(m,dt)|0;var Lt=(c+(r=r+Math.imul(h,pt)|0)|0)+((8191&(i=(i=i+Math.imul(h,mt)|0)+Math.imul(d,pt)|0))<<13)|0;c=((o=o+Math.imul(d,mt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,r=Math.imul(R,Q),i=(i=Math.imul(R,H))+Math.imul(B,Q)|0,o=Math.imul(B,H),r=r+Math.imul(O,Z)|0,i=(i=i+Math.imul(O,V)|0)+Math.imul(z,Z)|0,o=o+Math.imul(z,V)|0,r=r+Math.imul(j,J)|0,i=(i=i+Math.imul(j,K)|0)+Math.imul(C,J)|0,o=o+Math.imul(C,K)|0,r=r+Math.imul(T,$)|0,i=(i=i+Math.imul(T,tt)|0)+Math.imul(I,$)|0,o=o+Math.imul(I,tt)|0,r=r+Math.imul(S,nt)|0,i=(i=i+Math.imul(S,rt)|0)+Math.imul(A,nt)|0,o=o+Math.imul(A,rt)|0,r=r+Math.imul(E,ot)|0,i=(i=i+Math.imul(E,at)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,at)|0,r=r+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,ct)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ct)|0,r=r+Math.imul(y,ht)|0,i=(i=i+Math.imul(y,dt)|0)+Math.imul(b,ht)|0,o=o+Math.imul(b,dt)|0;var St=(c+(r=r+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)+(St>>>26)|0,St&=67108863,r=Math.imul(R,Z),i=(i=Math.imul(R,V))+Math.imul(B,Z)|0,o=Math.imul(B,V),r=r+Math.imul(O,J)|0,i=(i=i+Math.imul(O,K)|0)+Math.imul(z,J)|0,o=o+Math.imul(z,K)|0,r=r+Math.imul(j,$)|0,i=(i=i+Math.imul(j,tt)|0)+Math.imul(C,$)|0,o=o+Math.imul(C,tt)|0,r=r+Math.imul(T,nt)|0,i=(i=i+Math.imul(T,rt)|0)+Math.imul(I,nt)|0,o=o+Math.imul(I,rt)|0,r=r+Math.imul(S,ot)|0,i=(i=i+Math.imul(S,at)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,at)|0,r=r+Math.imul(E,ut)|0,i=(i=i+Math.imul(E,ct)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ct)|0,r=r+Math.imul(w,ht)|0,i=(i=i+Math.imul(w,dt)|0)+Math.imul(M,ht)|0,o=o+Math.imul(M,dt)|0;var At=(c+(r=r+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,mt)|0)+Math.imul(b,pt)|0))<<13)|0;c=((o=o+Math.imul(b,mt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(R,J),i=(i=Math.imul(R,K))+Math.imul(B,J)|0,o=Math.imul(B,K),r=r+Math.imul(O,$)|0,i=(i=i+Math.imul(O,tt)|0)+Math.imul(z,$)|0,o=o+Math.imul(z,tt)|0,r=r+Math.imul(j,nt)|0,i=(i=i+Math.imul(j,rt)|0)+Math.imul(C,nt)|0,o=o+Math.imul(C,rt)|0,r=r+Math.imul(T,ot)|0,i=(i=i+Math.imul(T,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,r=r+Math.imul(S,ut)|0,i=(i=i+Math.imul(S,ct)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,ct)|0,r=r+Math.imul(E,ht)|0,i=(i=i+Math.imul(E,dt)|0)+Math.imul(N,ht)|0,o=o+Math.imul(N,dt)|0;var xt=(c+(r=r+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,mt)|0)+Math.imul(M,pt)|0))<<13)|0;c=((o=o+Math.imul(M,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,r=Math.imul(R,$),i=(i=Math.imul(R,tt))+Math.imul(B,$)|0,o=Math.imul(B,tt),r=r+Math.imul(O,nt)|0,i=(i=i+Math.imul(O,rt)|0)+Math.imul(z,nt)|0,o=o+Math.imul(z,rt)|0,r=r+Math.imul(j,ot)|0,i=(i=i+Math.imul(j,at)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,at)|0,r=r+Math.imul(T,ut)|0,i=(i=i+Math.imul(T,ct)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ct)|0,r=r+Math.imul(S,ht)|0,i=(i=i+Math.imul(S,dt)|0)+Math.imul(A,ht)|0,o=o+Math.imul(A,dt)|0;var Tt=(c+(r=r+Math.imul(E,pt)|0)|0)+((8191&(i=(i=i+Math.imul(E,mt)|0)+Math.imul(N,pt)|0))<<13)|0;c=((o=o+Math.imul(N,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(R,nt),i=(i=Math.imul(R,rt))+Math.imul(B,nt)|0,o=Math.imul(B,rt),r=r+Math.imul(O,ot)|0,i=(i=i+Math.imul(O,at)|0)+Math.imul(z,ot)|0,o=o+Math.imul(z,at)|0,r=r+Math.imul(j,ut)|0,i=(i=i+Math.imul(j,ct)|0)+Math.imul(C,ut)|0,o=o+Math.imul(C,ct)|0,r=r+Math.imul(T,ht)|0,i=(i=i+Math.imul(T,dt)|0)+Math.imul(I,ht)|0,o=o+Math.imul(I,dt)|0;var It=(c+(r=r+Math.imul(S,pt)|0)|0)+((8191&(i=(i=i+Math.imul(S,mt)|0)+Math.imul(A,pt)|0))<<13)|0;c=((o=o+Math.imul(A,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(R,ot),i=(i=Math.imul(R,at))+Math.imul(B,ot)|0,o=Math.imul(B,at),r=r+Math.imul(O,ut)|0,i=(i=i+Math.imul(O,ct)|0)+Math.imul(z,ut)|0,o=o+Math.imul(z,ct)|0,r=r+Math.imul(j,ht)|0,i=(i=i+Math.imul(j,dt)|0)+Math.imul(C,ht)|0,o=o+Math.imul(C,dt)|0;var kt=(c+(r=r+Math.imul(T,pt)|0)|0)+((8191&(i=(i=i+Math.imul(T,mt)|0)+Math.imul(I,pt)|0))<<13)|0;c=((o=o+Math.imul(I,mt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,r=Math.imul(R,ut),i=(i=Math.imul(R,ct))+Math.imul(B,ut)|0,o=Math.imul(B,ct),r=r+Math.imul(O,ht)|0,i=(i=i+Math.imul(O,dt)|0)+Math.imul(z,ht)|0,o=o+Math.imul(z,dt)|0;var jt=(c+(r=r+Math.imul(j,pt)|0)|0)+((8191&(i=(i=i+Math.imul(j,mt)|0)+Math.imul(C,pt)|0))<<13)|0;c=((o=o+Math.imul(C,mt)|0)+(i>>>13)|0)+(jt>>>26)|0,jt&=67108863,r=Math.imul(R,ht),i=(i=Math.imul(R,dt))+Math.imul(B,ht)|0,o=Math.imul(B,dt);var Ct=(c+(r=r+Math.imul(O,pt)|0)|0)+((8191&(i=(i=i+Math.imul(O,mt)|0)+Math.imul(z,pt)|0))<<13)|0;c=((o=o+Math.imul(z,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863;var Dt=(c+(r=Math.imul(R,pt))|0)+((8191&(i=(i=Math.imul(R,mt))+Math.imul(B,pt)|0))<<13)|0;return c=((o=Math.imul(B,mt))+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,u[0]=gt,u[1]=yt,u[2]=bt,u[3]=vt,u[4]=wt,u[5]=Mt,u[6]=_t,u[7]=Et,u[8]=Nt,u[9]=Lt,u[10]=St,u[11]=At,u[12]=xt,u[13]=Tt,u[14]=It,u[15]=kt,u[16]=jt,u[17]=Ct,u[18]=Dt,0!==c&&(u[19]=c,n.length++),n};function g(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var r=0,i=0,o=0;o<n.length-1;o++){var a=i;i=0;for(var s=67108863&r,u=Math.min(o,e.length-1),c=Math.max(0,o-t.length+1);c<=u;c++){var l=o-c,h=(0|t.words[l])*(0|e.words[c]),d=67108863&h;s=67108863&(d=d+s|0),i+=(a=(a=a+(h/67108864|0)|0)+(d>>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n._strip()}function y(t,e,n){return g(t,e,n)}Math.imul||(m=p),i.prototype.mulTo=function(t,e){var n=this.length+t.length;return 10===this.length&&10===t.length?m(this,t,e):n<63?p(this,t,e):n<1024?g(this,t,e):y(this,t,e)},i.prototype.mul=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},i.prototype.mulf=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),y(this,t,e)},i.prototype.imul=function(t){return this.clone().mulTo(t,this)},i.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,a=(67108863&o)+(67108863&r);r>>=26,r+=o/67108864|0,r+=a>>>26,this.words[i]=67108863&a}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():this},i.prototype.muln=function(t){return this.clone().imuln(t)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),n=0;n<e.length;n++){var r=n/26|0,i=n%26;e[n]=t.words[r]>>>i&1}return e}(t);if(0===e.length)return new i(1);for(var n=this,r=0;r<e.length&&0===e[r];r++,n=n.sqr());if(++r<e.length)for(var o=n.sqr();r<e.length;r++,o=o.sqr())0!==e[r]&&(n=n.mul(o));return n},i.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 a=0;for(e=0;e<this.length;e++){var s=this.words[e]&o,u=(0|this.words[e])-s<<r;this.words[e]=u|a,a=s>>>26-r}a&&(this.words[e]=a,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()},i.prototype.ishln=function(t){return n(0===this.negative),this.iushln(t)},i.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,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<<o,u=r;if(i-=a,i=Math.max(0,i),u){for(var c=0;c<a;c++)u.words[c]=this.words[c];u.length=a}if(0===a);else if(this.length>a)for(this.length-=a,c=0;c<this.length;c++)this.words[c]=this.words[c+a];else this.words[0]=0,this.length=1;var l=0;for(c=this.length-1;c>=0&&(0!==l||c>=i);c--){var h=0|this.words[c];this.words[c]=l<<26-o|h>>>o,l=h&s}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},i.prototype.shln=function(t){return this.clone().ishln(t)},i.prototype.ushln=function(t){return this.clone().iushln(t)},i.prototype.shrn=function(t){return this.clone().ishrn(t)},i.prototype.ushrn=function(t){return this.clone().iushrn(t)},i.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))},i.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()},i.prototype.maskn=function(t){return this.clone().imaskn(t)},i.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)},i.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},i.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()},i.prototype.addn=function(t){return this.clone().iaddn(t)},i.prototype.subn=function(t){return this.clone().isubn(t)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(t,e,r){var i,o,a=t.length+r;this._expand(a);var s=0;for(i=0;i<t.length;i++){o=(0|this.words[i+r])+s;var u=(0|t.words[i])*e;s=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i<this.length-r;i++)s=(o=(0|this.words[i+r])+s)>>26,this.words[i+r]=67108863&o;if(0===s)return this._strip();for(n(-1===s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},i.prototype._wordDiv=function(t,e){var n=(this.length,t.length),r=this.clone(),o=t,a=0|o.words[o.length-1];0!=(n=26-this._countBits(a))&&(o=o.ushln(n),r.iushln(n),a=0|o.words[o.length-1]);var s,u=r.length-o.length;if("mod"!==e){(s=new i(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c<s.length;c++)s.words[c]=0}var l=r.clone()._ishlnsubmul(o,1,u);0===l.negative&&(r=l,s&&(s.words[u]=1));for(var h=u-1;h>=0;h--){var d=67108864*(0|r.words[o.length+h])+(0|r.words[o.length+h-1]);for(d=Math.min(d/a|0,67108863),r._ishlnsubmul(o,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(o,1,h),r.isZero()||(r.negative^=1);s&&(s.words[h]=d)}return s&&s._strip(),r._strip(),"div"!==e&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},i.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(o=s.div.neg()),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(t)),{div:o,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new i(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new i(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,a,s},i.prototype.div=function(t){return this.divmod(t,"div",!1).div},i.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},i.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},i.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var n=0!==e.div.negative?e.mod.isub(t):e.mod,r=t.ushrn(1),i=t.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.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},i.prototype.modn=function(t){return this.modrn(t)},i.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},i.prototype.divn=function(t){return this.clone().idivn(t)},i.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 o=new i(1),a=new i(0),s=new i(0),u=new i(1),c=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++c;for(var l=r.clone(),h=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;)(o.isOdd()||a.isOdd())&&(o.iadd(l),a.isub(h)),o.iushrn(1),a.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;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(h)),s.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(s),a.isub(u)):(r.isub(e),s.isub(o),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},i.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 o,a=new i(1),s=new i(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,l=1;0==(e.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(e.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var h=0,d=1;0==(r.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(r.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),a.isub(s)):(r.isub(e),s.isub(a))}return(o=0===e.cmpn(1)?a:s).cmpn(0)<0&&o.iadd(t),o},i.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),n=t.clone();e.negative=0,n.negative=0;for(var r=0;e.isEven()&&n.isEven();r++)e.iushrn(1),n.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=e.cmp(n);if(i<0){var o=e;e=n,n=o}else if(0===i||0===n.cmpn(1))break;e.isub(n)}return n.iushln(r)},i.prototype.invm=function(t){return this.egcd(t).a.umod(t)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(t){return this.words[0]&t},i.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,a=r;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.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},i.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},i.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,n=this.length-1;n>=0;n--){var r=0|this.words[n],i=0|t.words[n];if(r!==i){r<i?e=-1:r>i&&(e=1);break}}return e},i.prototype.gtn=function(t){return 1===this.cmpn(t)},i.prototype.gt=function(t){return 1===this.cmp(t)},i.prototype.gten=function(t){return this.cmpn(t)>=0},i.prototype.gte=function(t){return this.cmp(t)>=0},i.prototype.ltn=function(t){return-1===this.cmpn(t)},i.prototype.lt=function(t){return-1===this.cmp(t)},i.prototype.lten=function(t){return this.cmpn(t)<=0},i.prototype.lte=function(t){return this.cmp(t)<=0},i.prototype.eqn=function(t){return 0===this.cmpn(t)},i.prototype.eq=function(t){return 0===this.cmp(t)},i.red=function(t){return new N(t)},i.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)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(t){return this.red=t,this},i.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.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 i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function M(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function N(t){if("string"==typeof t){var e=i._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 L(t){N.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var e,n=t;do{this.split(n,this.tmp),e=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(e>this.n);var r=e<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):r>0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},r(w,v),w.prototype.split=function(t,e){for(var n=4194303,r=Math.min(t.length,9),i=0;i<r;i++)e.words[i]=t.words[i];if(e.length=r,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&n,i=10;i<t.length;i++){var a=0|t.words[i];t.words[i-10]=(a&n)<<4|o>>>22,o=a}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},w.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n<t.length;n++){var r=0|t.words[n];e+=977*r,t.words[n]=67108863&e,e=64*r+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},r(M,v),r(_,v),r(E,v),E.prototype.imulK=function(t){for(var e=0,n=0;n<t.length;n++){var r=19*(0|t.words[n])+e,i=67108863&r;r>>>=26,t.words[n]=i,e=r}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(b[t])return b[t];var e;if("k256"===t)e=new w;else if("p224"===t)e=new M;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new E}return b[t]=e,e},N.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},N.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")},N.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(c(t,t.umod(this.m)._forceRed(this)),t)},N.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},N.prototype.add=function(t,e){this._verify2(t,e);var n=t.add(e);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},N.prototype.iadd=function(t,e){this._verify2(t,e);var n=t.iadd(e);return n.cmp(this.m)>=0&&n.isub(this.m),n},N.prototype.sub=function(t,e){this._verify2(t,e);var n=t.sub(e);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},N.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},N.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},N.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},N.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},N.prototype.isqr=function(t){return this.imul(t,t.clone())},N.prototype.sqr=function(t){return this.mul(t,t)},N.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 i(1)).iushrn(2);return this.pow(t,r)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);n(!o.isZero());var s=new i(1).toRed(this),u=s.redNeg(),c=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new i(2*l*l).toRed(this);0!==this.pow(l,c).cmp(u);)l.redIAdd(u);for(var h=this.pow(l,o),d=this.pow(t,o.addn(1).iushrn(1)),f=this.pow(t,o),p=a;0!==f.cmp(s);){for(var m=f,g=0;0!==m.cmp(s);g++)m=m.redSqr();n(g<p);var y=this.pow(h,new i(1).iushln(p-g-1));d=d.redMul(y),h=y.redSqr(),f=f.redMul(h),p=g}return d},N.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},N.prototype.pow=function(t,e){if(e.isZero())return new i(1).toRed(this);if(0===e.cmpn(1))return t.clone();var n=new Array(16);n[0]=new i(1).toRed(this),n[1]=t;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],t);var o=n[0],a=0,s=0,u=e.bitLength()%26;for(0===u&&(u=26),r=e.length-1;r>=0;r--){for(var c=e.words[r],l=u-1;l>=0;l--){var h=c>>l&1;o!==n[0]&&(o=this.sqr(o)),0!==h||0!==a?(a<<=1,a|=h,(4==++s||0===r&&0===l)&&(o=this.mul(o,n[a]),s=0,a=0)):s=0}u=26}return o},N.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},N.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new L(t)},r(L,N),L.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},L.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},L.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var n=t.imul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).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)},L.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new i(0)._forceRed(this);var n=t.mul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=n.isub(r).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},L.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(VG,KM),function(t){var e=KM&&KM.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(t,"__esModule",{value:!0}),t.map=t.array=t.rustEnum=t.str=t.vecU8=t.tagged=t.vec=t.bool=t.option=t.publicKey=t.i128=t.u128=t.i64=t.u64=t.struct=t.f64=t.f32=t.i32=t.u32=t.i16=t.u16=t.i8=t.u8=void 0;const n=cG,r=ZG,i=e(VG.exports);var o=cG;Object.defineProperty(t,"u8",{enumerable:!0,get:function(){return o.u8}}),Object.defineProperty(t,"i8",{enumerable:!0,get:function(){return o.s8}}),Object.defineProperty(t,"u16",{enumerable:!0,get:function(){return o.u16}}),Object.defineProperty(t,"i16",{enumerable:!0,get:function(){return o.s16}}),Object.defineProperty(t,"u32",{enumerable:!0,get:function(){return o.u32}}),Object.defineProperty(t,"i32",{enumerable:!0,get:function(){return o.s32}}),Object.defineProperty(t,"f32",{enumerable:!0,get:function(){return o.f32}}),Object.defineProperty(t,"f64",{enumerable:!0,get:function(){return o.f64}}),Object.defineProperty(t,"struct",{enumerable:!0,get:function(){return o.struct}});class a extends n.Layout{constructor(t,e,r){super(t,r),this.blob=n.blob(t),this.signed=e}decode(t,e=0){const n=new i.default(this.blob.decode(t,e),10,"le");return this.signed?n.fromTwos(8*this.span).clone():n}encode(t,e,n=0){return this.signed&&(t=t.toTwos(8*this.span)),this.blob.encode(t.toArrayLike(p_,"le",this.span),e,n)}}function s(t){return new a(8,!1,t)}t.u64=s,t.i64=function(t){return new a(8,!0,t)},t.u128=function(t){return new a(16,!1,t)},t.i128=function(t){return new a(16,!0,t)};class u extends n.Layout{constructor(t,e,n,r){super(t.span,r),this.layout=t,this.decoder=e,this.encoder=n}decode(t,e){return this.decoder(this.layout.decode(t,e))}encode(t,e,n){return this.layout.encode(this.encoder(t),e,n)}getSpan(t,e){return this.layout.getSpan(t,e)}}t.publicKey=function(t){return new u(n.blob(32),(t=>new r.PublicKey(t)),(t=>t.toBuffer()),t)};class c extends n.Layout{constructor(t,e){super(-1,e),this.layout=t,this.discriminator=n.u8()}encode(t,e,n=0){return null==t?this.discriminator.encode(0,e,n):(this.discriminator.encode(1,e,n),this.layout.encode(t,e,n+1)+1)}decode(t,e=0){const n=this.discriminator.decode(t,e);if(0===n)return null;if(1===n)return this.layout.decode(t,e+1);throw new Error("Invalid option "+this.property)}getSpan(t,e=0){const n=this.discriminator.decode(t,e);if(0===n)return 1;if(1===n)return this.layout.getSpan(t,e+1)+1;throw new Error("Invalid option "+this.property)}}function l(t){if(0===t)return!1;if(1===t)return!0;throw new Error("Invalid bool: "+t)}function h(t){return t?1:0}function d(t){const e=n.u32("length"),r=n.struct([e,n.blob(n.offset(e,-e.span),"data")]);return new u(r,(({data:t})=>t),(t=>({data:t})),t)}t.option=function(t,e){return new c(t,e)},t.bool=function(t){return new u(n.u8(),l,h,t)},t.vec=function(t,e){const r=n.u32("length"),i=n.struct([r,n.seq(t,n.offset(r,-r.span),"values")]);return new u(i,(({values:t})=>t),(t=>({values:t})),e)},t.tagged=function(t,e,r){const i=n.struct([s("tag"),e.replicate("data")]);return new u(i,(function({tag:e,data:n}){if(!e.eq(t))throw new Error("Invalid tag, expected: "+t.toString("hex")+", got: "+e.toString("hex"));return n}),(e=>({tag:t,data:e})),r)},t.vecU8=d,t.str=function(t){return new u(d(),(t=>t.toString("utf-8")),(t=>p_.from(t,"utf-8")),t)},t.rustEnum=function(t,e,r){const i=n.union(null!=r?r:n.u8(),e);return t.forEach(((t,e)=>i.addVariant(e,t,t.property))),i},t.array=function(t,e,r){const i=n.struct([n.seq(t,e,"values")]);return new u(i,(({values:t})=>t),(t=>({values:t})),r)};class f extends n.Layout{constructor(t,e,n){super(t.span+e.span,n),this.keyLayout=t,this.valueLayout=e}decode(t,e){e=e||0;return[this.keyLayout.decode(t,e),this.valueLayout.decode(t,e+this.keyLayout.getSpan(t,e))]}encode(t,e,n){n=n||0;const r=this.keyLayout.encode(t[0],e,n);return r+this.valueLayout.encode(t[1],e,n+r)}getSpan(t,e){return this.keyLayout.getSpan(t,e)+this.valueLayout.getSpan(t,e)}}t.map=function(t,e,r){const i=n.u32("length"),o=n.struct([i,n.seq(new f(t,e),n.offset(i,-i.span),"values")]);return new u(o,(({values:t})=>new Map(t)),(t=>({values:Array.from(t.entries())})),r)}}(GG);const qG=tE.Buffer,JG=eE.exports,KG=GG.struct([GG.publicKey("mint"),GG.publicKey("owner"),GG.u64("amount"),GG.u32("delegateOption"),GG.publicKey("delegate"),GG.u8("state"),GG.u32("isNativeOption"),GG.u64("isNative"),GG.u64("delegatedAmount"),GG.u32("closeAuthorityOption"),GG.publicKey("closeAuthority")]);GG.array;var XG=GG.bool;GG.i128,GG.i16,GG.i32,GG.i64,GG.i8,GG.map;var $G=GG.option,tZ=GG.publicKey,eZ=GG.rustEnum,nZ=GG.str,rZ=GG.struct;GG.tagged;var iZ=GG.u128,oZ=GG.u16,aZ=GG.u32,sZ=GG.u64,uZ=GG.u8,cZ=GG.vec;GG.vecU8;var lZ=({provider:t,from:e,to:n,value:r,method:i,api:o,params:a})=>{if(void 0===o)return t.estimateGas({from:e,to:n,value:r});{let s=new Tw(n,o,t),u=s.estimateGas[i],c=(({contract:t,method:e,params:n})=>{let r=t.interface.fragments.find((t=>t.name==e));return n instanceof Array?n:n instanceof Object?r.inputs.map((t=>n[t.name])):void 0})({contract:s,method:i,params:a});return c?u(...c,{from:e,value:r}):u({from:e,value:r})}};let hZ=["ethereum","bsc","polygon","fantom","velas"];hZ.evm=["ethereum","bsc","polygon","fantom","velas"],hZ.solana=[];class dZ extends WM{constructor(t,e,n){super(t),this._network=e,this._endpoint=t,this._endpoints=n}detectNetwork(){return Promise.resolve(nd(this._network).id)}requestChunk(t,e){const n=t.map((t=>t.request));return Gw(e,JSON.stringify(n)).then((e=>{t.forEach(((t,n)=>{const r=e[n];if(r.error){const e=new Error(r.error.message);e.code=r.error.code,e.data=r.error.data,t.reject(e)}else t.resolve(r.result)}))})).catch((e=>{if(e&&"SERVER_ERROR"==e.code){const e=this._endpoints.indexOf(this._endpoint)+1;this._endpoint=e>=this._endpoints.length?this._endpoints[0]:this._endpoints[e],this.requestChunk(t,this._endpoint)}else t.forEach((t=>{t.reject(e)}))}))}send(t,e){const n={method:t,params:e,id:this._nextId++,jsonrpc:"2.0"};null==this._pendingBatch&&(this._pendingBatch=[]);const r={request:n,resolve:null,reject:null},i=new Promise(((t,e)=>{r.resolve=t,r.reject=e}));return this._pendingBatch.push(r),this._pendingBatchAggregator||(this._pendingBatchAggregator=setTimeout((()=>{const t=this._pendingBatch;this._pendingBatch=null,this._pendingBatchAggregator=null;const e=[];for(let n=0;n<Math.ceil(t.length/99);n++)e[n]=t.slice(99*n,99*(n+1));e.forEach((t=>(t.map((t=>t.request)),this.requestChunk(t,this._endpoint))))}),10)),i}}let fZ=()=>"object"==typeof wh?wh:window;const pZ={ethereum:["https://rpc.ankr.com/eth","https://eth.llamarpc.com","https://ethereum.publicnode.com"],bsc:["https://bsc-dataseed.binance.org","https://bsc-dataseed1.ninicoin.io","https://bsc-dataseed3.defibit.io"],polygon:["https://polygon-rpc.com","https://poly-rpc.gateway.pokt.network","https://matic-mainnet.chainstacklabs.com"],fantom:["https://fantom.blockpi.network/v1/rpc/public","https://rpcapi.fantom.network","https://rpc.ftm.tools"],velas:["https://mainnet.velas.com/rpc","https://evmexplorer.velas.com/rpc","https://explorer.velas.com/rpc"]},mZ=()=>(null==fZ()._clientProviders&&(fZ()._clientProviders={}),fZ()._clientProviders),gZ=(t,e)=>{mZ()[t]=e},yZ=async(t,e)=>{let n,r=fZ();if(null==r.fetch||void 0!==Hh&&Hh.env&&"test"==Hh.env.NODE_ENV||void 0!==r.cy)n=e[0];else{let t=await Promise.all(e.map((t=>new Promise((async e=>{let n=(new Date).getTime();setTimeout((()=>e(900)),900);if(!(await fetch(t,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({method:"net_version",id:1,jsonrpc:"2.0"})})).ok)return e(999);let r=(new Date).getTime();e(r-n)})))));const r=Math.min(...t);n=e[t.indexOf(r)]}gZ(t,new dZ(n,t,e))};var bZ=async t=>{let e=mZ();if(e&&e[t])return e[t];let n=fZ();return n._getProviderPromise&&n._getProviderPromise[t]||(n._getProviderPromise||(n._getProviderPromise={}),n._getProviderPromise[t]=new Promise((async e=>{await yZ(t,pZ[t]),e(fZ()._clientProviders[t])}))),await n._getProviderPromise[t]},vZ=yZ;let wZ=()=>(null==fZ()._cacheStore&&_Z(),fZ()._cacheStore),MZ=()=>(null==fZ()._promiseStore&&_Z(),fZ()._promiseStore),_Z=()=>{fZ()._cacheStore={},fZ()._promiseStore={},fZ()._clientProviders={}},EZ=function({key:t}){MZ()[t]=void 0},NZ=function({call:t,key:e,expires:n=0}){return new Promise(((r,i)=>{let o,a=function({key:t}){return MZ()[t]}({key:e=JSON.stringify(e)});if(a)return a.then(r).catch(i);(function({key:t,promise:e}){return MZ()[t]=e,e})({key:e,promise:new Promise(((a,s)=>0===n?t().then((t=>{r(t),a(t)})).catch((t=>{i(t),s(t)})):(o=function({key:t,expires:e}){let n=wZ()[t];if(function(t){let e,n=t[0],r=1;for(;r<t.length;){const i=t[r],o=t[r+1];if(r+=2,("optionalAccess"===i||"optionalCall"===i)&&null==n)return;"access"===i||"optionalAccess"===i?(e=n,n=o(n)):"call"!==i&&"optionalCall"!==i||(n=o(((...t)=>n.call(e,...t))),e=void 0)}return n}([n,"optionalAccess",t=>t.expiresAt])>Date.now())return n.value}({key:e,expires:n}),o?(r(o),a(o),o):void t().then((t=>{t&&function({key:t,value:e,expires:n}){wZ()[t]={expiresAt:Date.now()+n,value:e}}({key:e,value:t,expires:n}),r(t),a(t)})).catch((t=>{i(t),s(t)})))))}).then((()=>{EZ({key:e})})).catch((()=>{EZ({key:e})}))}))},LZ=async function({blockchain:t,from:e,to:n,value:r,method:i,api:o,params:a,cache:s}){if(!hZ.includes(t))throw"Unknown blockchain: "+t;void 0===r&&(r="0");const u=await(async t=>{if(hZ.evm.includes(t))return await bZ(t);throw"Unknown blockchain: "+t})(t);return await NZ({expires:s||0,key:[t,e,n,r,i,a],call:async()=>lZ({provider:u,from:e,to:n,value:r,method:i,api:o,params:a})})};let SZ=({address:t,api:e,method:n,params:r,provider:i,block:o})=>{let a=new Tw(t,e,i),s=(({contract:t,method:e,params:n})=>t.interface.fragments.find((t=>t.name==e)).inputs.map(((t,e)=>Array.isArray(n)?n[e]:n[t.name])))({contract:a,method:n,params:r});return a[n](...s,{blockTag:o})};class AZ extends DH{constructor(t,e,n){super(t),this._network=e,this._endpoint=t,this._endpoints=n}}const xZ={solana:["https://solana-mainnet.phantom.app/YBPpkkN4g91xDiAnTE9r0RcMkjg0sKUIWvAfoFVJ","https://mainnet-beta.solflare.network","https://us-solana1.twnodes.com"]},TZ=()=>(null==fZ()._clientProviders&&(fZ()._clientProviders={}),fZ()._clientProviders),IZ=(t,e)=>{TZ()[t]=e},kZ=async(t,e)=>{let n,r=fZ();if(null==r.fetch||void 0!==Hh&&Hh.env&&"test"==Hh.env.NODE_ENV||void 0!==r.cy)n=e[0];else{let t=await Promise.all(e.map((t=>new Promise((async e=>{let n=(new Date).getTime();setTimeout((()=>e(900)),900);if(!(await fetch(t,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({method:"getIdentity",id:1,jsonrpc:"2.0"})})).ok)return e(999);let r=(new Date).getTime();e(r-n)})))));const r=Math.min(...t);n=e[t.indexOf(r)]}IZ(t,new AZ(n,t,e))};var jZ=async t=>{let e=TZ();if(e&&e[t])return e[t];let n=fZ();return n._getProviderPromise&&n._getProviderPromise[t]||(n._getProviderPromise||(n._getProviderPromise={}),n._getProviderPromise[t]=new Promise((async e=>{await kZ(t,xZ[t]),e(fZ()._clientProviders[t])}))),await n._getProviderPromise[t]},CZ=kZ;var DZ=async({blockchain:t,address:e,api:n,method:r,params:i,block:o})=>{const a=await jZ(t);return null==r||"getAccountInfo"===r?(null==n&&(n=KG),(async({address:t,api:e,method:n,params:r,provider:i,block:o})=>{const a=await i.getAccountInfo(new cY(t));return e.decode(a.data)})({address:e,api:n,method:r,params:i,provider:a,block:o})):"getProgramAccounts"===r?a.getProgramAccounts(new cY(e),i).then((t=>n?t.map((t=>(t.data=n.decode(t.account.data),t))):t)):"getTokenAccountBalance"===r?a.getTokenAccountBalance(new cY(e)):"latestBlockNumber"===r?a.getBlockHeight():"balance"===r?(({address:t,provider:e})=>e.getBalance(new cY(t)))({address:e,provider:a}):void 0};let OZ=["ethereum","bsc","polygon","solana","fantom","velas"];OZ.evm=["ethereum","bsc","polygon","fantom","velas"],OZ.solana=["solana"];let zZ=async function(t,e){let{blockchain:n,address:r,method:i}=(t=>{if("object"==typeof t)return t;let e=t.match(/(?<blockchain>\w+):\/\/(?<part1>[\w\d]+)(\/(?<part2>[\w\d]+)*)?/);return null==e.groups.part2?e.groups.part1.match(/\d/)?{blockchain:e.groups.blockchain,address:e.groups.part1}:{blockchain:e.groups.blockchain,method:e.groups.part1}:{blockchain:e.groups.blockchain,address:e.groups.part1,method:e.groups.part2}})(t),{api:o,params:a,cache:s,block:u}=("object"==typeof t?t:e)||{};return await NZ({expires:s||0,key:[n,r,i,a,u],call:async()=>{if(OZ.evm.includes(n))return(async({blockchain:t,address:e,api:n,method:r,params:i,block:o})=>{const a=await bZ(t);return n?SZ({address:e,api:n,method:r,params:i,provider:a,block:o}):"latestBlockNumber"===r?a.getBlockNumber():"balance"===r?(({address:t,provider:e})=>e.getBalance(t))({address:e,provider:a}):"transactionCount"===r?(({address:t,provider:e})=>e.getTransactionCount(t))({address:e,provider:a}):void 0})({blockchain:n,address:r,api:o,method:i,params:a,block:u});if(OZ.solana.includes(n))return DZ({blockchain:n,address:r,api:o,method:i,params:a,block:u});throw"Unknown blockchain: "+n}})};const PZ=async t=>{if(OZ.evm.includes(t))return await bZ(t);if(OZ.solana.includes(t))return await jZ(t);throw"Unknown blockchain: "+t};let RZ={ethereum:{ZERO:"0x0000000000000000000000000000000000000000",MAXINT:"115792089237316195423570985008687907853269984665640564039457584007913129639935",WRAPPED:"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",NATIVE:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",DECIMALS:18,SYMBOL:"ETH",CURRENCY:"Ether",NAME:"Ethereum",USD:"0xdAC17F958D2ee523a2206206994597C13D831ec7",USD_DECIMALS:6},bsc:{ZERO:"0x0000000000000000000000000000000000000000",MAXINT:"115792089237316195423570985008687907853269984665640564039457584007913129639935",WRAPPED:"0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",NATIVE:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",DECIMALS:18,SYMBOL:"BNB",CURRENCY:"BNB",NAME:"BNB Smart Chain",USD:"0x55d398326f99059fF775485246999027B3197955",USD_DECIMALS:18},polygon:{ZERO:"0x0000000000000000000000000000000000000000",MAXINT:"115792089237316195423570985008687907853269984665640564039457584007913129639935",WRAPPED:"0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",NATIVE:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",DECIMALS:18,SYMBOL:"MATIC",CURRENCY:"Polygon",NAME:"Polygon",USD:"0xc2132D05D31c914a87C6611C10748AEb04B58e8F",USD_DECIMALS:6},solana:{ZERO:"0",MAXINT:"340282366920938463463374607431768211455",WRAPPED:"So11111111111111111111111111111111111111112",NATIVE:"11111111111111111111111111111111",DECIMALS:9,SYMBOL:"SOL",CURRENCY:"Solana",NAME:"Solana",USD:"Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",USD_DECIMALS:6},fantom:{ZERO:"0x0000000000000000000000000000000000000000",MAXINT:"115792089237316195423570985008687907853269984665640564039457584007913129639935",WRAPPED:"0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83",NATIVE:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",DECIMALS:18,SYMBOL:"FTM",CURRENCY:"Fantom",NAME:"Fantom",USD:"0x9879aBDea01a879644185341F7aF7d8343556B7a",USD_DECIMALS:18},velas:{ZERO:"0x0000000000000000000000000000000000000000",MAXINT:"115792089237316195423570985008687907853269984665640564039457584007913129639935",WRAPPED:"0xc579D1f3CF86749E05CD06f7ADe17856c2CE3126",NATIVE:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",DECIMALS:18,SYMBOL:"VLX",CURRENCY:"Velas",NAME:"Velas",USD:"0x01445C31581c354b7338AC35693AB2001B50b9aE",USD_DECIMALS:6}};var BZ=function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=92)}([function(t,e,n){(function(t){n.d(e,"f",(function(){return s})),n.d(e,"g",(function(){return u})),n.d(e,"i",(function(){return c})),n.d(e,"h",(function(){return l})),n.d(e,"b",(function(){return h})),n.d(e,"c",(function(){return d})),n.d(e,"e",(function(){return f})),n.d(e,"d",(function(){return p})),n.d(e,"o",(function(){return m})),n.d(e,"n",(function(){return g})),n.d(e,"p",(function(){return y})),n.d(e,"A",(function(){return b})),n.d(e,"z",(function(){return v})),n.d(e,"B",(function(){return w})),n.d(e,"v",(function(){return M})),n.d(e,"u",(function(){return _})),n.d(e,"s",(function(){return L})),n.d(e,"r",(function(){return S})),n.d(e,"t",(function(){return A})),n.d(e,"q",(function(){return x})),n.d(e,"m",(function(){return T})),n.d(e,"l",(function(){return I})),n.d(e,"k",(function(){return k})),n.d(e,"j",(function(){return j})),n.d(e,"x",(function(){return D})),n.d(e,"a",(function(){return O})),n.d(e,"y",(function(){return z})),n.d(e,"w",(function(){return P}));var r=n(22),i=n.n(r),o=n(49),a=n.n(o);function s(t){return new Uint8Array(t)}function u(t,e=!1){const n=t.toString("hex");return e?O(n):n}function c(t){return t.toString("utf8")}function l(t){return t.readUIntBE(0,t.length)}function h(t){return a()(t)}function d(t,e=!1){return u(h(t),e)}function f(t){return c(h(t))}function p(t){return l(h(t))}function m(e){return t.from(D(e),"hex")}function g(t){return s(m(t))}function y(t){return c(m(t))}function b(e){return t.from(e,"utf8")}function v(t){return s(b(t))}function w(t,e=!1){return u(b(t),e)}function M(t){return h(N(E(t)))}function _(t){return N(E(t))}function E(t){return C((t>>>0).toString(2))}function N(t){return new Uint8Array(function(t,e=8){const n=C(t).match(new RegExp(`.{${e}}`,"gi"));return Array.from(n||[])}(t).map((t=>parseInt(t,2))))}function L(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}function S(e){return t.isBuffer(e)}function A(t){return i.a.strict(t)&&!S(t)}function x(t){return!A(t)&&!S(t)&&void 0!==t.byteLength}function T(t){return S(t)?"buffer":A(t)?"typed-array":x(t)?"array-buffer":Array.isArray(t)?"array":typeof t}function I(t){return function(t){return!("string"!=typeof t||!new RegExp(/^[01]+$/).test(t))&&t.length%8==0}(t)?"binary":L(t)?"hex":"utf8"}function k(...e){return t.concat(e)}function j(...t){let e=[];return t.forEach((t=>e=e.concat(Array.from(t)))),new Uint8Array([...e])}function C(t,e=8,n="0"){return function(t,e,n="0"){return function(t,e,n,r="0"){const i=e-t.length;let o=t;if(i>0){const e=r.repeat(i);o=n?e+t:t+e}return o}(t,e,!0,n)}(t,function(t,e=8){const n=t%e;return n?(t-n)/e*e+e:t}(t.length,e),n)}function D(t){return t.replace(/^0x/,"")}function O(t){return t.startsWith("0x")?t:"0x"+t}function z(t){return(t=C(t=D(t),2))&&(t=O(t)),t}function P(t){const e=t.startsWith("0x");return t=(t=D(t)).startsWith("0")?t.substring(1):t,e?O(t):t}}).call(this,n(18).Buffer)},function(t,e,n){n.d(e,"g",(function(){return r.detectEnv})),n.d(e,"r",(function(){return r.isMobile})),n.d(e,"m",(function(){return r.isBrowser})),n.d(e,"k",(function(){return r.getLocation})),n.d(e,"i",(function(){return r.getClientMeta})),n.d(e,"B",(function(){return r.setLocal})),n.d(e,"j",(function(){return r.getLocal})),n.d(e,"A",(function(){return r.removeLocal})),n.d(e,"v",(function(){return r.mobileLinkChoiceKey})),n.d(e,"C",(function(){return o})),n.d(e,"b",(function(){return c})),n.d(e,"c",(function(){return l})),n.d(e,"d",(function(){return h})),n.d(e,"e",(function(){return d})),n.d(e,"f",(function(){return f})),n.d(e,"w",(function(){return L})),n.d(e,"x",(function(){return S})),n.d(e,"z",(function(){return g})),n.d(e,"D",(function(){return y})),n.d(e,"h",(function(){return A})),n.d(e,"u",(function(){return j})),n.d(e,"y",(function(){return C})),n.d(e,"l",(function(){return T})),n.d(e,"a",(function(){return I})),n.d(e,"o",(function(){return v})),n.d(e,"q",(function(){return w})),n.d(e,"p",(function(){return M})),n.d(e,"n",(function(){return _})),n.d(e,"s",(function(){return E})),n.d(e,"t",(function(){return N}));var r=n(21);const i=["session_request","session_update","exchange_key","connect","disconnect","display_uri","modal_closed","transport_open","transport_close","transport_error"],o=["eth_sendTransaction","eth_signTransaction","eth_sign","eth_signTypedData","eth_signTypedData_v1","eth_signTypedData_v2","eth_signTypedData_v3","eth_signTypedData_v4","personal_sign","wallet_addEthereumChain","wallet_switchEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode"];var a=n(16),s=n.n(a),u=n(0);function c(t){return u.b(new Uint8Array(t))}function l(t,e){return u.c(new Uint8Array(t),!e)}function h(t){return u.f(t).buffer}function d(t){return u.n(t).buffer}function f(t,e){const n=u.x(u.y(new s.a(t).toString(16)));return e?n:u.a(n)}var p=n(50);function m(t){return u.y(t)}const g=n(51).payloadId;function y(){return((t,e)=>{for(e=t="";t++<36;e+=51*t&52?(15^t?8^Math.random()*(20^t?16:4):4).toString(16):"-");return e})()}function b(t,e){return u.s(t,e)}function v(t){return void 0!==t.method}function w(t){return void 0!==t.result}function M(t){return void 0!==t.error}function _(t){return void 0!==t.event}function E(t){return i.includes(t)||t.startsWith("wc_")}function N(t){return!!t.method.startsWith("wc_")||!o.includes(t.method)}function L(t){var e,n;return(n=t)&&n.length&&!b(t[0])&&(t[0]=(e=t[0],u.B(e,!0))),t}function S(t){if(void 0!==t.type&&"0"!==t.type)return t;if(void 0===t.from||!(e=t.from)||"0x"!==e.toLowerCase().substring(0,2)||!/^(0x)?[0-9a-f]{40}$/i.test(e)||!/^(0x)?[0-9a-f]{40}$/.test(e)&&!/^(0x)?[0-9A-F]{40}$/.test(e)&&e!==function(t){t=Object(u.x)(t.toLowerCase());const e=Object(u.x)(Object(p.keccak_256)((n=t,u.A(n))));var n;let r="";for(let n=0;n<t.length;n++)parseInt(e[n],16)>7?r+=t[n].toUpperCase():r+=t[n];return Object(u.a)(r)}(e))throw new Error("Transaction object must include a valid 'from' value.");var e;function n(t){let e=t;var n;return("number"==typeof t||"string"==typeof t&&!function(t){return""===t||"string"==typeof t&&""===t.trim()}(t))&&(b(t)?"string"==typeof t&&(e=m(t)):e=f(t)),"string"==typeof e&&(n=e,e=u.w(u.a(n))),e}const r={from:m(t.from),to:void 0===t.to?void 0:m(t.to),gasPrice:void 0===t.gasPrice?"":n(t.gasPrice),gas:void 0===t.gas?void 0===t.gasLimit?"":n(t.gasLimit):n(t.gas),value:void 0===t.value?"":n(t.value),nonce:void 0===t.nonce?"":n(t.nonce),data:void 0===t.data?"":m(t.data)||"0x"},i=["gasPrice","gas","value","nonce"];return Object.keys(r).forEach((t=>{(void 0===r[t]||"string"==typeof r[t]&&!r[t].trim().length)&&i.includes(t)&&delete r[t]})),r}function A(t){const e=t.message||"Failed or Rejected Request";let n=-32e3;if(t&&!t.code)switch(e){case"Parse error":n=-32700;break;case"Invalid request":n=-32600;break;case"Method not found":n=-32601;break;case"Invalid params":n=-32602;break;case"Internal error":n=-32603;break;default:n=-32e3}const r={code:n,message:e};return t.data&&(r.data=t.data),r}var x=n(23);function T(t){const e=-1!==t.indexOf("?")?t.indexOf("?"):void 0;return void 0!==e?t.substr(e):""}function I(t,e){let n=k(t);return n=Object.assign(Object.assign({},n),e),function(t){return x.stringify(t)}(n)}function k(t){return x.parse(t)}function j(t){return void 0!==t.bridge}function C(t){const e=t.indexOf(":"),n=-1!==t.indexOf("?")?t.indexOf("?"):void 0,r=t.substring(0,e),i=function(t){const e=t.split("@");return{handshakeTopic:e[0],version:parseInt(e[1],10)}}(t.substring(e+1,n)),o=function(t){const e=k(t);return{key:e.key||"",bridge:e.bridge||""}}(void 0!==n?t.substr(n):"");return Object.assign(Object.assign({protocol:r},i),o)}},function(t,e,n){n.d(e,"b",(function(){return i})),n.d(e,"g",(function(){return o})),n.d(e,"a",(function(){return a})),n.d(e,"f",(function(){return s})),n.d(e,"e",(function(){return u})),n.d(e,"i",(function(){return c})),n.d(e,"j",(function(){return l})),n.d(e,"h",(function(){return r})),n.d(e,"d",(function(){return h})),n.d(e,"c",(function(){return d})),n.d(e,"k",(function(){return f})),n.d(e,"l",(function(){return p}));const r=512,i=256,o=256,a="AES-CBC",s="SHA-"+i,u="HMAC",c="SHA-256",l="SHA-512",h="encrypt",d="decrypt",f="sign",p="verify"},function(t,e,n){n.d(e,"b",(function(){return r})),n.d(e,"d",(function(){return i})),n.d(e,"c",(function(){return o})),n.d(e,"e",(function(){return a})),n.d(e,"f",(function(){return s})),n.d(e,"a",(function(){return u}));const r="INTERNAL_ERROR",i="SERVER_ERROR",o=[-32700,-32600,-32601,-32602,-32603],a=[-32e3,-32099],s={PARSE_ERROR:{code:-32700,message:"Parse error"},INVALID_REQUEST:{code:-32600,message:"Invalid Request"},METHOD_NOT_FOUND:{code:-32601,message:"Method not found"},INVALID_PARAMS:{code:-32602,message:"Invalid params"},[r]:{code:-32603,message:"Internal error"},[i]:{code:-32e3,message:"Server error"}},u=i},function(t,e,n){function r(t){let e;return"undefined"!=typeof window&&void 0!==window[t]&&(e=window[t]),e}function i(t){const e=r(t);if(!e)throw new Error(t+" is not defined in Window");return e}Object.defineProperty(e,"__esModule",{value:!0}),e.getLocalStorage=e.getLocalStorageOrThrow=e.getCrypto=e.getCryptoOrThrow=e.getLocation=e.getLocationOrThrow=e.getNavigator=e.getNavigatorOrThrow=e.getDocument=e.getDocumentOrThrow=e.getFromWindowOrThrow=e.getFromWindow=void 0,e.getFromWindow=r,e.getFromWindowOrThrow=i,e.getDocumentOrThrow=function(){return i("document")},e.getDocument=function(){return r("document")},e.getNavigatorOrThrow=function(){return i("navigator")},e.getNavigator=function(){return r("navigator")},e.getLocationOrThrow=function(){return i("location")},e.getLocation=function(){return r("location")},e.getCryptoOrThrow=function(){return i("crypto")},e.getCrypto=function(){return r("crypto")},e.getLocalStorageOrThrow=function(){return i("localStorage")},e.getLocalStorage=function(){return r("localStorage")}},function(t,e,n){var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||e.hasOwnProperty(n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(67),e),i(n(68),e)},function(t,e,n){n.d(e,"b",(function(){return a})),n.d(e,"a",(function(){return s})),n.d(e,"c",(function(){return u})),n.d(e,"d",(function(){return c})),n.d(e,"e",(function(){return l})),n.d(e,"f",(function(){return h}));var r=n(5),i=n(2);async function o(t,e=i.a){return r.getSubtleCrypto().importKey("raw",t,function(t){return t===i.a?{length:i.b,name:i.a}:{hash:{name:i.f},name:i.e}}(e),!0,function(t){return t===i.a?[i.d,i.c]:[i.k,i.l]}(e))}async function a(t,e,n){const a=r.getSubtleCrypto(),s=await o(e,i.a),u=await a.encrypt({iv:t,name:i.a},s,n);return new Uint8Array(u)}async function s(t,e,n){const a=r.getSubtleCrypto(),s=await o(e,i.a),u=await a.decrypt({iv:t,name:i.a},s,n);return new Uint8Array(u)}async function u(t,e){const n=r.getSubtleCrypto(),a=await o(t,i.e),s=await n.sign({length:i.g,name:i.e},a,e);return new Uint8Array(s)}async function c(t,e){const n=r.getSubtleCrypto(),a=await o(t,i.e),s=await n.sign({length:i.h,name:i.e},a,e);return new Uint8Array(s)}async function l(t){const e=r.getSubtleCrypto(),n=await e.digest({name:i.i},t);return new Uint8Array(n)}async function h(t){const e=r.getSubtleCrypto(),n=await e.digest({name:i.j},t);return new Uint8Array(n)}},function(t,e){var n,r=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(t){if(!t)throw new Error('"version" cannot be null or undefined');if(t<1||t>40)throw new Error('"version" should be in range from 1 to 40');return 4*t+17},e.getSymbolTotalCodewords=function(t){return r[t]},e.getBCHDigit=function(t){for(var e=0;0!==t;)e++,t>>>=1;return e},e.setToSJISFunction=function(t){if("function"!=typeof t)throw new Error('"toSJISFunc" is not a valid function.');n=t},e.isKanjiModeEnabled=function(){return void 0!==n},e.toSJIS=function(t){return n(t)}},function(t,e,n){var r=n(44),i=n(45);e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(t,e){if(!t.ccBits)throw new Error("Invalid mode: "+t);if(!r.isValid(e))throw new Error("Invalid version: "+e);return e>=1&&e<10?t.ccBits[0]:e<27?t.ccBits[1]:t.ccBits[2]},e.getBestModeForData=function(t){return i.testNumeric(t)?e.NUMERIC:i.testAlphanumeric(t)?e.ALPHANUMERIC:i.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(t){if(t&&t.id)return t.id;throw new Error("Invalid mode")},e.isValid=function(t){return t&&t.bit&&t.ccBits},e.from=function(t,n){if(e.isValid(t))return t;try{return function(t){if("string"!=typeof t)throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+t)}}(t)}catch(t){return n}}},function(t,e,n){n.d(e,"c",(function(){return i})),n.d(e,"a",(function(){return o})),n.d(e,"b",(function(){return a}));var r=n(3);function i(t){return r.c.includes(t)}function o(t){return Object.keys(r.f).includes(t)?r.f[t]:r.f[r.a]}function a(t){return Object.values(r.f).find((e=>e.code===t))||r.f[r.a]}},function(t,e,n){var r=n(19);o.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()}catch(t){return!1}}();var i=o.TYPED_ARRAY_SUPPORT?2147483647:1073741823;function o(t,e,n){return o.TYPED_ARRAY_SUPPORT||this instanceof o?"number"==typeof t?u(this,t):function(t,e,n,r){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,n,r){if(n<0||e.byteLength<n)throw new RangeError("'offset' is out of bounds");if(e.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");var i;return i=void 0===n&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,n):new Uint8Array(e,n,r),o.TYPED_ARRAY_SUPPORT?i.__proto__=o.prototype:i=c(t,i),i}(t,e,n,r):"string"==typeof e?function(t,e){var n=0|h(e),r=s(t,n),i=r.write(e);return i!==n&&(r=r.slice(0,i)),r}(t,e):function(t,e){if(o.isBuffer(e)){var n=0|a(e.length),r=s(t,n);return 0===r.length||e.copy(r,0,0,n),r}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(i=e.length)!=i?s(t,0):c(t,e);if("Buffer"===e.type&&Array.isArray(e.data))return c(t,e.data)}var i;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}(this,t,e,n):new o(t,e,n)}function a(t){if(t>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|t}function s(t,e){var n;return o.TYPED_ARRAY_SUPPORT?(n=new Uint8Array(e)).__proto__=o.prototype:(null===(n=t)&&(n=new o(e)),n.length=e),n}function u(t,e){var n=s(t,e<0?0:0|a(e));if(!o.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)n[r]=0;return n}function c(t,e){for(var n=e.length<0?0:0|a(e.length),r=s(t,n),i=0;i<n;i+=1)r[i]=255&e[i];return r}function l(t,e){var n;e=e||1/0;for(var r=t.length,i=null,o=[],a=0;a<r;++a){if((n=t.charCodeAt(a))>55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function h(t){return o.isBuffer(t)?t.length:"undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer)?t.byteLength:("string"!=typeof t&&(t=""+t),0===t.length?0:l(t).length)}o.TYPED_ARRAY_SUPPORT&&(o.prototype.__proto__=Uint8Array.prototype,o.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&o[Symbol.species]===o&&Object.defineProperty(o,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1})),o.prototype.write=function(t,e,n){void 0===e||void 0===n&&"string"==typeof e?(n=this.length,e=0):isFinite(e)&&(e|=0,isFinite(n)?n|=0:n=void 0);var r=this.length-e;if((void 0===n||n>r)&&(n=r),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");return function(t,e,n,r){return function(t,e,n,r){for(var i=0;i<r&&!(i+n>=e.length||i>=t.length);++i)e[i+n]=t[i];return i}(l(e,t.length-n),t,n,r)}(this,t,e,n)},o.prototype.slice=function(t,e){var n,r=this.length;if((t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t),o.TYPED_ARRAY_SUPPORT)(n=this.subarray(t,e)).__proto__=o.prototype;else{var i=e-t;n=new o(i,void 0);for(var a=0;a<i;++a)n[a]=this[a+t]}return n},o.prototype.copy=function(t,e,n,r){if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);var i,a=r-n;if(this===t&&n<e&&e<r)for(i=a-1;i>=0;--i)t[i+e]=this[i+n];else if(a<1e3||!o.TYPED_ARRAY_SUPPORT)for(i=0;i<a;++i)t[i+e]=this[i+n];else Uint8Array.prototype.set.call(t,this.subarray(n,n+a),e);return a},o.prototype.fill=function(t,e,n){if("string"==typeof t){if("string"==typeof e?(e=0,n=this.length):"string"==typeof n&&(n=this.length),1===t.length){var r=t.charCodeAt(0);r<256&&(t=r)}}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;var i;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(i=e;i<n;++i)this[i]=t;else{var a=o.isBuffer(t)?t:new o(t),s=a.length;for(i=0;i<n-e;++i)this[i+e]=a[i%s]}return this},o.concat=function(t,e){if(!r(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return s(null,0);var n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var i=u(null,e),a=0;for(n=0;n<t.length;++n){var c=t[n];if(!o.isBuffer(c))throw new TypeError('"list" argument must be an Array of Buffers');c.copy(i,a),a+=c.length}return i},o.byteLength=h,o.prototype._isBuffer=!0,o.isBuffer=function(t){return!(null==t||!t._isBuffer)},t.exports.alloc=function(t){var e=new o(t);return e.fill(0),e},t.exports.from=function(t){return new o(t)}},function(t,e,n){var r=n(34);n.d(e,"randomBytes",(function(){return r.a}));var i=n(35);n.d(e,"aesCbcDecrypt",(function(){return i.a})),n.d(e,"aesCbcEncrypt",(function(){return i.b}));var o=n(36);n.d(e,"hmacSha256Sign",(function(){return o.a})),n(41),n(15),n(2)},function(t,e){var n,r,i=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(t){if(n===setTimeout)return setTimeout(t,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(t){n=o}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(t){r=a}}();var u,c=[],l=!1,h=-1;function d(){l&&u&&(l=!1,u.length?c=u.concat(c):h=-1,c.length&&f())}function f(){if(!l){var t=s(d);l=!0;for(var e=c.length;e;){for(u=c,c=[];++h<e;)u&&u[h].run();h=-1,e=c.length}u=null,l=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===a||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function m(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];c.push(new p(t,e)),1!==c.length||l||s(f)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=m,i.addListener=m,i.once=m,i.off=m,i.removeListener=m,i.removeAllListeners=m,i.emit=m,i.prependListener=m,i.prependOnceListener=m,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){n.d(e,"a",(function(){return r}));class r{}},function(t,e,n){var r=n(37);n.o(r,"isConstantTime")&&n.d(e,"isConstantTime",(function(){return r.isConstantTime})),n(38);var i=n(39);n.o(i,"isConstantTime")&&n.d(e,"isConstantTime",(function(){return i.isConstantTime}));var o=n(40);n.d(e,"isConstantTime",(function(){return o.a}))},function(t,e,n){(function(t){!function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}function o(t,e,n){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(n=e,e=10),this._init(t||0,e||10,n||"be"))}var a;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{a=n(55).Buffer}catch(t){}function s(t,e,n){for(var r=0,i=Math.min(t.length,n),o=e;o<i;o++){var a=t.charCodeAt(o)-48;r<<=4,r|=a>=49&&a<=54?a-49+10:a>=17&&a<=22?a-17+10:15&a}return r}function u(t,e,n,r){for(var i=0,o=Math.min(t.length,n),a=e;a<o;a++){var s=t.charCodeAt(a)-48;i*=r,i+=s>=49?s-49+10:s>=17?s-17+10:s}return i}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,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&i++,16===e?this._parseHex(t,i):this._parseBase(t,e,i),"-"===t[0]&&(this.negative=1),this.strip(),"le"===n&&this._initArray(this.toArray(),e,n)},o.prototype._initNumber=function(t,e,n){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),e,n)},o.prototype._initArray=function(t,e,n){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,a,s=0;if("be"===n)for(i=t.length-1,o=0;i>=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===n)for(i=0,o=0;i<t.length;i+=3)a=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e){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 r,i,o=0;for(n=t.length-6,r=0;n>=e;n-=6)i=s(t,n,n+6),this.words[r]|=i<<o&67108863,this.words[r+1]|=i>>>26-o&4194303,(o+=24)>=26&&(o-=26,r++);n+6!==e&&(i=s(t,e,n+6),this.words[r]|=i<<o&67108863,this.words[r+1]|=i>>>26-o&4194303),this.strip()},o.prototype._parseBase=function(t,e,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=e)r++;r--,i=i/e|0;for(var o=t.length-n,a=o%r,s=Math.min(o,o-a)+n,c=0,l=n;l<s;l+=r)c=u(t,l,l+r,e),this.imuln(i),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==a){var h=1;for(c=u(t,l,t.length,e),l=0;l<a;l++)h*=e;this.imuln(h),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}},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.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},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var c=["","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"],l=[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],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(t,e,n){n.negative=e.negative^t.negative;var r=t.length+e.length|0;n.length=r,r=r-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,u=a/67108864|0;n.words[0]=s;for(var c=1;c<r;c++){for(var l=u>>>26,h=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;l+=(a=(i=0|t.words[p])*(o=0|e.words[f])+h)/67108864|0,h=67108863&a}n.words[c]=0|h,u=0|l}return 0!==u?n.words[c]=0|u:n.length--,n.strip()}o.prototype.toString=function(t,e){var n;if(e=0|e||1,16===(t=t||10)||"hex"===t){n="";for(var i=0,o=0,a=0;a<this.length;a++){var s=this.words[a],u=(16777215&(s<<i|o)).toString(16);n=0!=(o=s>>>24-i&16777215)||a!==this.length-1?c[6-u.length]+u+n:u+n,(i+=2)>=26&&(i-=26,a--)}for(0!==o&&(n=o.toString(16)+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var d=l[t],f=h[t];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(f).toString(t);n=(p=p.idivn(f)).isZero()?m+n:c[d-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!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&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return r(void 0!==a),this.toArrayLike(a,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,n){var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var a,s,u="le"===e,c=new t(o),l=this.clone();if(u){for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),c[s]=a;for(;s<o;s++)c[s]=0}else{for(s=0;s<o-i;s++)c[s]=0;for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),c[o-s-1]=a}return c},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,n=0;return e>=4096&&(n+=13,e>>>=13),e>=64&&(n+=7,e>>>=7),e>=8&&(n+=4,e>>>=4),e>=2&&(n+=2,e>>>=2),n+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,n=0;return 0==(8191&e)&&(n+=13,e>>>=13),0==(127&e)&&(n+=7,e>>>=7),0==(15&e)&&(n+=4,e>>>=4),0==(3&e)&&(n+=2,e>>>=2),0==(1&e)&&n++,n},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 n=this._zeroBits(this.words[e]);if(t+=n,26!==n)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 r(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 n=0;n<e.length;n++)this.words[n]=this.words[n]&t.words[n];return this.length=e.length,this.strip()},o.prototype.iand=function(t){return r(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,n;this.length>t.length?(e=this,n=t):(e=t,n=this);for(var r=0;r<n.length;r++)this.words[r]=e.words[r]^n.words[r];if(this!==e)for(;r<e.length;r++)this.words[r]=e.words[r];return this.length=e.length,this.strip()},o.prototype.ixor=function(t){return r(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){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),n=t%26;this._expand(e),n>0&&e--;for(var i=0;i<e;i++)this.words[i]=67108863&~this.words[i];return n>0&&(this.words[i]=~this.words[i]&67108863>>26-n),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var n=t/26|0,i=t%26;return this._expand(n+1),this.words[n]=e?this.words[n]|1<<i:this.words[n]&~(1<<i),this.strip()},o.prototype.iadd=function(t){var e,n,r;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?(n=this,r=t):(n=t,r=this);for(var i=0,o=0;o<r.length;o++)e=(0|n.words[o])+(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<n.length;o++)e=(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;o<n.length;o++)this.words[o]=n.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 n,r,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=t):(n=t,r=this);for(var o=0,a=0;a<r.length;a++)o=(e=(0|n.words[a])-(0|r.words[a])+o)>>26,this.words[a]=67108863&e;for(;0!==o&&a<n.length;a++)o=(e=(0|n.words[a])+o)>>26,this.words[a]=67108863&e;if(0===o&&a<n.length&&n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this.length=Math.max(this.length,a),n!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(t){return this.clone().isub(t)};var f=function(t,e,n){var r,i,o,a=t.words,s=e.words,u=n.words,c=0,l=0|a[0],h=8191&l,d=l>>>13,f=0|a[1],p=8191&f,m=f>>>13,g=0|a[2],y=8191&g,b=g>>>13,v=0|a[3],w=8191&v,M=v>>>13,_=0|a[4],E=8191&_,N=_>>>13,L=0|a[5],S=8191&L,A=L>>>13,x=0|a[6],T=8191&x,I=x>>>13,k=0|a[7],j=8191&k,C=k>>>13,D=0|a[8],O=8191&D,z=D>>>13,P=0|a[9],R=8191&P,B=P>>>13,U=0|s[0],F=8191&U,W=U>>>13,Y=0|s[1],Q=8191&Y,H=Y>>>13,G=0|s[2],Z=8191&G,V=G>>>13,q=0|s[3],J=8191&q,K=q>>>13,X=0|s[4],$=8191&X,tt=X>>>13,et=0|s[5],nt=8191&et,rt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ct=st>>>13,lt=0|s[8],ht=8191<,dt=lt>>>13,ft=0|s[9],pt=8191&ft,mt=ft>>>13;n.negative=t.negative^e.negative,n.length=19;var gt=(c+(r=Math.imul(h,F))|0)+((8191&(i=(i=Math.imul(h,W))+Math.imul(d,F)|0))<<13)|0;c=((o=Math.imul(d,W))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(p,F),i=(i=Math.imul(p,W))+Math.imul(m,F)|0,o=Math.imul(m,W);var yt=(c+(r=r+Math.imul(h,Q)|0)|0)+((8191&(i=(i=i+Math.imul(h,H)|0)+Math.imul(d,Q)|0))<<13)|0;c=((o=o+Math.imul(d,H)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,r=Math.imul(y,F),i=(i=Math.imul(y,W))+Math.imul(b,F)|0,o=Math.imul(b,W),r=r+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,H)|0;var bt=(c+(r=r+Math.imul(h,Z)|0)|0)+((8191&(i=(i=i+Math.imul(h,V)|0)+Math.imul(d,Z)|0))<<13)|0;c=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(w,F),i=(i=Math.imul(w,W))+Math.imul(M,F)|0,o=Math.imul(M,W),r=r+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,H)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,H)|0,r=r+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,V)|0;var vt=(c+(r=r+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,K)|0)+Math.imul(d,J)|0))<<13)|0;c=((o=o+Math.imul(d,K)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(E,F),i=(i=Math.imul(E,W))+Math.imul(N,F)|0,o=Math.imul(N,W),r=r+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,H)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,H)|0,r=r+Math.imul(y,Z)|0,i=(i=i+Math.imul(y,V)|0)+Math.imul(b,Z)|0,o=o+Math.imul(b,V)|0,r=r+Math.imul(p,J)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,K)|0;var wt=(c+(r=r+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,tt)|0)+Math.imul(d,$)|0))<<13)|0;c=((o=o+Math.imul(d,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(S,F),i=(i=Math.imul(S,W))+Math.imul(A,F)|0,o=Math.imul(A,W),r=r+Math.imul(E,Q)|0,i=(i=i+Math.imul(E,H)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,H)|0,r=r+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,V)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,V)|0,r=r+Math.imul(y,J)|0,i=(i=i+Math.imul(y,K)|0)+Math.imul(b,J)|0,o=o+Math.imul(b,K)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,tt)|0;var Mt=(c+(r=r+Math.imul(h,nt)|0)|0)+((8191&(i=(i=i+Math.imul(h,rt)|0)+Math.imul(d,nt)|0))<<13)|0;c=((o=o+Math.imul(d,rt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(T,F),i=(i=Math.imul(T,W))+Math.imul(I,F)|0,o=Math.imul(I,W),r=r+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,H)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,H)|0,r=r+Math.imul(E,Z)|0,i=(i=i+Math.imul(E,V)|0)+Math.imul(N,Z)|0,o=o+Math.imul(N,V)|0,r=r+Math.imul(w,J)|0,i=(i=i+Math.imul(w,K)|0)+Math.imul(M,J)|0,o=o+Math.imul(M,K)|0,r=r+Math.imul(y,$)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(b,$)|0,o=o+Math.imul(b,tt)|0,r=r+Math.imul(p,nt)|0,i=(i=i+Math.imul(p,rt)|0)+Math.imul(m,nt)|0,o=o+Math.imul(m,rt)|0;var _t=(c+(r=r+Math.imul(h,ot)|0)|0)+((8191&(i=(i=i+Math.imul(h,at)|0)+Math.imul(d,ot)|0))<<13)|0;c=((o=o+Math.imul(d,at)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,r=Math.imul(j,F),i=(i=Math.imul(j,W))+Math.imul(C,F)|0,o=Math.imul(C,W),r=r+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,H)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,H)|0,r=r+Math.imul(S,Z)|0,i=(i=i+Math.imul(S,V)|0)+Math.imul(A,Z)|0,o=o+Math.imul(A,V)|0,r=r+Math.imul(E,J)|0,i=(i=i+Math.imul(E,K)|0)+Math.imul(N,J)|0,o=o+Math.imul(N,K)|0,r=r+Math.imul(w,$)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,tt)|0,r=r+Math.imul(y,nt)|0,i=(i=i+Math.imul(y,rt)|0)+Math.imul(b,nt)|0,o=o+Math.imul(b,rt)|0,r=r+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,at)|0;var Et=(c+(r=r+Math.imul(h,ut)|0)|0)+((8191&(i=(i=i+Math.imul(h,ct)|0)+Math.imul(d,ut)|0))<<13)|0;c=((o=o+Math.imul(d,ct)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(O,F),i=(i=Math.imul(O,W))+Math.imul(z,F)|0,o=Math.imul(z,W),r=r+Math.imul(j,Q)|0,i=(i=i+Math.imul(j,H)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,H)|0,r=r+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,V)|0)+Math.imul(I,Z)|0,o=o+Math.imul(I,V)|0,r=r+Math.imul(S,J)|0,i=(i=i+Math.imul(S,K)|0)+Math.imul(A,J)|0,o=o+Math.imul(A,K)|0,r=r+Math.imul(E,$)|0,i=(i=i+Math.imul(E,tt)|0)+Math.imul(N,$)|0,o=o+Math.imul(N,tt)|0,r=r+Math.imul(w,nt)|0,i=(i=i+Math.imul(w,rt)|0)+Math.imul(M,nt)|0,o=o+Math.imul(M,rt)|0,r=r+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,at)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,at)|0,r=r+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 Nt=(c+(r=r+Math.imul(h,ht)|0)|0)+((8191&(i=(i=i+Math.imul(h,dt)|0)+Math.imul(d,ht)|0))<<13)|0;c=((o=o+Math.imul(d,dt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,r=Math.imul(R,F),i=(i=Math.imul(R,W))+Math.imul(B,F)|0,o=Math.imul(B,W),r=r+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,H)|0)+Math.imul(z,Q)|0,o=o+Math.imul(z,H)|0,r=r+Math.imul(j,Z)|0,i=(i=i+Math.imul(j,V)|0)+Math.imul(C,Z)|0,o=o+Math.imul(C,V)|0,r=r+Math.imul(T,J)|0,i=(i=i+Math.imul(T,K)|0)+Math.imul(I,J)|0,o=o+Math.imul(I,K)|0,r=r+Math.imul(S,$)|0,i=(i=i+Math.imul(S,tt)|0)+Math.imul(A,$)|0,o=o+Math.imul(A,tt)|0,r=r+Math.imul(E,nt)|0,i=(i=i+Math.imul(E,rt)|0)+Math.imul(N,nt)|0,o=o+Math.imul(N,rt)|0,r=r+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,at)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,at)|0,r=r+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ct)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,ct)|0,r=r+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,dt)|0)+Math.imul(m,ht)|0,o=o+Math.imul(m,dt)|0;var Lt=(c+(r=r+Math.imul(h,pt)|0)|0)+((8191&(i=(i=i+Math.imul(h,mt)|0)+Math.imul(d,pt)|0))<<13)|0;c=((o=o+Math.imul(d,mt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,r=Math.imul(R,Q),i=(i=Math.imul(R,H))+Math.imul(B,Q)|0,o=Math.imul(B,H),r=r+Math.imul(O,Z)|0,i=(i=i+Math.imul(O,V)|0)+Math.imul(z,Z)|0,o=o+Math.imul(z,V)|0,r=r+Math.imul(j,J)|0,i=(i=i+Math.imul(j,K)|0)+Math.imul(C,J)|0,o=o+Math.imul(C,K)|0,r=r+Math.imul(T,$)|0,i=(i=i+Math.imul(T,tt)|0)+Math.imul(I,$)|0,o=o+Math.imul(I,tt)|0,r=r+Math.imul(S,nt)|0,i=(i=i+Math.imul(S,rt)|0)+Math.imul(A,nt)|0,o=o+Math.imul(A,rt)|0,r=r+Math.imul(E,ot)|0,i=(i=i+Math.imul(E,at)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,at)|0,r=r+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,ct)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ct)|0,r=r+Math.imul(y,ht)|0,i=(i=i+Math.imul(y,dt)|0)+Math.imul(b,ht)|0,o=o+Math.imul(b,dt)|0;var St=(c+(r=r+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)+(St>>>26)|0,St&=67108863,r=Math.imul(R,Z),i=(i=Math.imul(R,V))+Math.imul(B,Z)|0,o=Math.imul(B,V),r=r+Math.imul(O,J)|0,i=(i=i+Math.imul(O,K)|0)+Math.imul(z,J)|0,o=o+Math.imul(z,K)|0,r=r+Math.imul(j,$)|0,i=(i=i+Math.imul(j,tt)|0)+Math.imul(C,$)|0,o=o+Math.imul(C,tt)|0,r=r+Math.imul(T,nt)|0,i=(i=i+Math.imul(T,rt)|0)+Math.imul(I,nt)|0,o=o+Math.imul(I,rt)|0,r=r+Math.imul(S,ot)|0,i=(i=i+Math.imul(S,at)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,at)|0,r=r+Math.imul(E,ut)|0,i=(i=i+Math.imul(E,ct)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ct)|0,r=r+Math.imul(w,ht)|0,i=(i=i+Math.imul(w,dt)|0)+Math.imul(M,ht)|0,o=o+Math.imul(M,dt)|0;var At=(c+(r=r+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,mt)|0)+Math.imul(b,pt)|0))<<13)|0;c=((o=o+Math.imul(b,mt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(R,J),i=(i=Math.imul(R,K))+Math.imul(B,J)|0,o=Math.imul(B,K),r=r+Math.imul(O,$)|0,i=(i=i+Math.imul(O,tt)|0)+Math.imul(z,$)|0,o=o+Math.imul(z,tt)|0,r=r+Math.imul(j,nt)|0,i=(i=i+Math.imul(j,rt)|0)+Math.imul(C,nt)|0,o=o+Math.imul(C,rt)|0,r=r+Math.imul(T,ot)|0,i=(i=i+Math.imul(T,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,r=r+Math.imul(S,ut)|0,i=(i=i+Math.imul(S,ct)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,ct)|0,r=r+Math.imul(E,ht)|0,i=(i=i+Math.imul(E,dt)|0)+Math.imul(N,ht)|0,o=o+Math.imul(N,dt)|0;var xt=(c+(r=r+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,mt)|0)+Math.imul(M,pt)|0))<<13)|0;c=((o=o+Math.imul(M,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,r=Math.imul(R,$),i=(i=Math.imul(R,tt))+Math.imul(B,$)|0,o=Math.imul(B,tt),r=r+Math.imul(O,nt)|0,i=(i=i+Math.imul(O,rt)|0)+Math.imul(z,nt)|0,o=o+Math.imul(z,rt)|0,r=r+Math.imul(j,ot)|0,i=(i=i+Math.imul(j,at)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,at)|0,r=r+Math.imul(T,ut)|0,i=(i=i+Math.imul(T,ct)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ct)|0,r=r+Math.imul(S,ht)|0,i=(i=i+Math.imul(S,dt)|0)+Math.imul(A,ht)|0,o=o+Math.imul(A,dt)|0;var Tt=(c+(r=r+Math.imul(E,pt)|0)|0)+((8191&(i=(i=i+Math.imul(E,mt)|0)+Math.imul(N,pt)|0))<<13)|0;c=((o=o+Math.imul(N,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(R,nt),i=(i=Math.imul(R,rt))+Math.imul(B,nt)|0,o=Math.imul(B,rt),r=r+Math.imul(O,ot)|0,i=(i=i+Math.imul(O,at)|0)+Math.imul(z,ot)|0,o=o+Math.imul(z,at)|0,r=r+Math.imul(j,ut)|0,i=(i=i+Math.imul(j,ct)|0)+Math.imul(C,ut)|0,o=o+Math.imul(C,ct)|0,r=r+Math.imul(T,ht)|0,i=(i=i+Math.imul(T,dt)|0)+Math.imul(I,ht)|0,o=o+Math.imul(I,dt)|0;var It=(c+(r=r+Math.imul(S,pt)|0)|0)+((8191&(i=(i=i+Math.imul(S,mt)|0)+Math.imul(A,pt)|0))<<13)|0;c=((o=o+Math.imul(A,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(R,ot),i=(i=Math.imul(R,at))+Math.imul(B,ot)|0,o=Math.imul(B,at),r=r+Math.imul(O,ut)|0,i=(i=i+Math.imul(O,ct)|0)+Math.imul(z,ut)|0,o=o+Math.imul(z,ct)|0,r=r+Math.imul(j,ht)|0,i=(i=i+Math.imul(j,dt)|0)+Math.imul(C,ht)|0,o=o+Math.imul(C,dt)|0;var kt=(c+(r=r+Math.imul(T,pt)|0)|0)+((8191&(i=(i=i+Math.imul(T,mt)|0)+Math.imul(I,pt)|0))<<13)|0;c=((o=o+Math.imul(I,mt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,r=Math.imul(R,ut),i=(i=Math.imul(R,ct))+Math.imul(B,ut)|0,o=Math.imul(B,ct),r=r+Math.imul(O,ht)|0,i=(i=i+Math.imul(O,dt)|0)+Math.imul(z,ht)|0,o=o+Math.imul(z,dt)|0;var jt=(c+(r=r+Math.imul(j,pt)|0)|0)+((8191&(i=(i=i+Math.imul(j,mt)|0)+Math.imul(C,pt)|0))<<13)|0;c=((o=o+Math.imul(C,mt)|0)+(i>>>13)|0)+(jt>>>26)|0,jt&=67108863,r=Math.imul(R,ht),i=(i=Math.imul(R,dt))+Math.imul(B,ht)|0,o=Math.imul(B,dt);var Ct=(c+(r=r+Math.imul(O,pt)|0)|0)+((8191&(i=(i=i+Math.imul(O,mt)|0)+Math.imul(z,pt)|0))<<13)|0;c=((o=o+Math.imul(z,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863;var Dt=(c+(r=Math.imul(R,pt))|0)+((8191&(i=(i=Math.imul(R,mt))+Math.imul(B,pt)|0))<<13)|0;return c=((o=Math.imul(B,mt))+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,u[0]=gt,u[1]=yt,u[2]=bt,u[3]=vt,u[4]=wt,u[5]=Mt,u[6]=_t,u[7]=Et,u[8]=Nt,u[9]=Lt,u[10]=St,u[11]=At,u[12]=xt,u[13]=Tt,u[14]=It,u[15]=kt,u[16]=jt,u[17]=Ct,u[18]=Dt,0!==c&&(u[19]=c,n.length++),n};function p(t,e,n){return(new m).mulp(t,e,n)}function m(t,e){this.x=t,this.y=e}Math.imul||(f=d),o.prototype.mulTo=function(t,e){var n=this.length+t.length;return 10===this.length&&10===t.length?f(this,t,e):n<63?d(this,t,e):n<1024?function(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var r=0,i=0,o=0;o<n.length-1;o++){var a=i;i=0;for(var s=67108863&r,u=Math.min(o,e.length-1),c=Math.max(0,o-t.length+1);c<=u;c++){var l=o-c,h=(0|t.words[l])*(0|e.words[c]),d=67108863&h;s=67108863&(d=d+s|0),i+=(a=(a=a+(h/67108864|0)|0)+(d>>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n.strip()}(this,t,e):p(this,t,e)},m.prototype.makeRBT=function(t){for(var e=new Array(t),n=o.prototype._countBits(t)-1,r=0;r<t;r++)e[r]=this.revBin(r,n,t);return e},m.prototype.revBin=function(t,e,n){if(0===t||t===n-1)return t;for(var r=0,i=0;i<e;i++)r|=(1&t)<<e-i-1,t>>=1;return r},m.prototype.permute=function(t,e,n,r,i,o){for(var a=0;a<o;a++)r[a]=e[t[a]],i[a]=n[t[a]]},m.prototype.transform=function(t,e,n,r,i,o){this.permute(o,t,e,n,r,i);for(var a=1;a<i;a<<=1)for(var s=a<<1,u=Math.cos(2*Math.PI/s),c=Math.sin(2*Math.PI/s),l=0;l<i;l+=s)for(var h=u,d=c,f=0;f<a;f++){var p=n[l+f],m=r[l+f],g=n[l+f+a],y=r[l+f+a],b=h*g-d*y;y=h*y+d*g,g=b,n[l+f]=p+g,r[l+f]=m+y,n[l+f+a]=p-g,r[l+f+a]=m-y,f!==s&&(b=u*h-c*d,d=u*d+c*h,h=b)}},m.prototype.guessLen13b=function(t,e){var n=1|Math.max(e,t),r=1&n,i=0;for(n=n/2|0;n;n>>>=1)i++;return 1<<i+1+r},m.prototype.conjugate=function(t,e,n){if(!(n<=1))for(var r=0;r<n/2;r++){var i=t[r];t[r]=t[n-r-1],t[n-r-1]=i,i=e[r],e[r]=-e[n-r-1],e[n-r-1]=-i}},m.prototype.normalize13b=function(t,e){for(var n=0,r=0;r<e/2;r++){var i=8192*Math.round(t[2*r+1]/e)+Math.round(t[2*r]/e)+n;t[r]=67108863&i,n=i<67108864?0:i/67108864|0}return t},m.prototype.convert13b=function(t,e,n,i){for(var o=0,a=0;a<e;a++)o+=0|t[a],n[2*a]=8191&o,o>>>=13,n[2*a+1]=8191&o,o>>>=13;for(a=2*e;a<i;++a)n[a]=0;r(0===o),r(0==(-8192&o))},m.prototype.stub=function(t){for(var e=new Array(t),n=0;n<t;n++)e[n]=0;return e},m.prototype.mulp=function(t,e,n){var r=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(r),o=this.stub(r),a=new Array(r),s=new Array(r),u=new Array(r),c=new Array(r),l=new Array(r),h=new Array(r),d=n.words;d.length=r,this.convert13b(t.words,t.length,a,r),this.convert13b(e.words,e.length,c,r),this.transform(a,o,s,u,r,i),this.transform(c,o,l,h,r,i);for(var f=0;f<r;f++){var p=s[f]*l[f]-u[f]*h[f];u[f]=s[f]*h[f]+u[f]*l[f],s[f]=p}return this.conjugate(s,u,r),this.transform(s,u,d,o,r,i),this.conjugate(d,o,r),this.normalize13b(d,r),n.negative=t.negative^e.negative,n.length=t.length+e.length,n.strip()},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),p(this,t,e)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.prototype.imuln=function(t){r("number"==typeof t),r(t<67108864);for(var e=0,n=0;n<this.length;n++){var i=(0|this.words[n])*t,o=(67108863&i)+(67108863&e);e>>=26,e+=i/67108864|0,e+=o>>>26,this.words[n]=67108863&o}return 0!==e&&(this.words[n]=e,this.length++),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()),n=0;n<e.length;n++){var r=n/26|0,i=n%26;e[n]=(t.words[r]&1<<i)>>>i}return e}(t);if(0===e.length)return new o(1);for(var n=this,r=0;r<e.length&&0===e[r];r++,n=n.sqr());if(++r<e.length)for(var i=n.sqr();r<e.length;r++,i=i.sqr())0!==e[r]&&(n=n.mul(i));return n},o.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,n=t%26,i=(t-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var a=0;for(e=0;e<this.length;e++){var s=this.words[e]&o,u=(0|this.words[e])-s<<n;this.words[e]=u|a,a=s>>>26-n}a&&(this.words[e]=a,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 r(0===this.negative),this.iushln(t)},o.prototype.iushrn=function(t,e,n){var i;r("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<<o,u=n;if(i-=a,i=Math.max(0,i),u){for(var c=0;c<a;c++)u.words[c]=this.words[c];u.length=a}if(0===a);else if(this.length>a)for(this.length-=a,c=0;c<this.length;c++)this.words[c]=this.words[c+a];else this.words[0]=0,this.length=1;var l=0;for(c=this.length-1;c>=0&&(0!==l||c>=i);c--){var h=0|this.words[c];this.words[c]=l<<26-o|h>>>o,l=h&s}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,n){return r(0===this.negative),this.iushrn(t,e,n)},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){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=1<<e;return!(this.length<=n||!(this.words[n]&i))},o.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==e&&n++,this.length=Math.min(n,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 r("number"==typeof t),r(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},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(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var 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,n){var i,o,a=t.length+n;this._expand(a);var s=0;for(i=0;i<t.length;i++){o=(0|this.words[i+n])+s;var u=(0|t.words[i])*e;s=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+n]=67108863&o}for(;i<this.length-n;i++)s=(o=(0|this.words[i+n])+s)>>26,this.words[i+n]=67108863&o;if(0===s)return this.strip();for(r(-1===s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var n=(this.length,t.length),r=this.clone(),i=t,a=0|i.words[i.length-1];0!=(n=26-this._countBits(a))&&(i=i.ushln(n),r.iushln(n),a=0|i.words[i.length-1]);var s,u=r.length-i.length;if("mod"!==e){(s=new o(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c<s.length;c++)s.words[c]=0}var l=r.clone()._ishlnsubmul(i,1,u);0===l.negative&&(r=l,s&&(s.words[u]=1));for(var h=u-1;h>=0;h--){var d=67108864*(0|r.words[i.length+h])+(0|r.words[i.length+h-1]);for(d=Math.min(d/a|0,67108863),r._ishlnsubmul(i,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(i,1,h),r.isZero()||(r.negative^=1);s&&(s.words[h]=d)}return s&&s.strip(),r.strip(),"div"!==e&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},o.prototype.divmod=function(t,e,n){return r(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(i=s.div.neg()),"div"!==e&&(a=s.mod.neg(),n&&0!==a.negative&&a.iadd(t)),{div:i,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(i=s.div.neg()),{div:i,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),n&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):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.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,a,s},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 n=0!==e.div.negative?e.mod.isub(t):e.mod,r=t.ushrn(1),i=t.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){r(t<=67108863);for(var e=(1<<26)%t,n=0,i=this.length-1;i>=0;i--)n=(e*n+(0|this.words[i]))%t;return n},o.prototype.idivn=function(t){r(t<=67108863);for(var e=0,n=this.length-1;n>=0;n--){var i=(0|this.words[n])+67108864*e;this.words[n]=i/t|0,e=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),a=new o(0),s=new o(0),u=new o(1),c=0;e.isEven()&&n.isEven();)e.iushrn(1),n.iushrn(1),++c;for(var l=n.clone(),h=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()||a.isOdd())&&(i.iadd(l),a.isub(h)),i.iushrn(1),a.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(h)),s.iushrn(1),u.iushrn(1);e.cmp(n)>=0?(e.isub(n),i.isub(s),a.isub(u)):(n.isub(e),s.isub(i),u.isub(a))}return{a:s,b:u,gcd:n.iushln(c)}},o.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,a=new o(1),s=new o(0),u=n.clone();e.cmpn(1)>0&&n.cmpn(1)>0;){for(var c=0,l=1;0==(e.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(e.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var h=0,d=1;0==(n.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(n.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(n)>=0?(e.isub(n),a.isub(s)):(n.isub(e),s.isub(a))}return(i=0===e.cmpn(1)?a:s).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(),n=t.clone();e.negative=0,n.negative=0;for(var r=0;e.isEven()&&n.isEven();r++)e.iushrn(1),n.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=e.cmp(n);if(i<0){var o=e;e=n,n=o}else if(0===i||0===n.cmpn(1))break;e.isub(n)}return n.iushln(r)},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){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<<e;if(this.length<=n)return this._expand(n+1),this.words[n]|=i,this;for(var o=i,a=n;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,n=t<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)e=1;else{n&&(t=-t),r(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,n=this.length-1;n>=0;n--){var r=0|this.words[n],i=0|t.words[n];if(r!==i){r<i?e=-1:r>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 _(t)},o.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return r(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 r(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var g={k256:null,p224:null,p192:null,p25519:null};function y(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 b(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function M(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function _(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function E(t){_.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)}y.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},y.prototype.ireduce=function(t){var e,n=t;do{this.split(n,this.tmp),e=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(e>this.n);var r=e<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):r>0?n.isub(this.p):n.strip(),n},y.prototype.split=function(t,e){t.iushrn(this.n,0,e)},y.prototype.imulK=function(t){return t.imul(this.k)},i(b,y),b.prototype.split=function(t,e){for(var n=Math.min(t.length,9),r=0;r<n;r++)e.words[r]=t.words[r];if(e.length=n,t.length<=9)return t.words[0]=0,void(t.length=1);var i=t.words[9];for(e.words[e.length++]=4194303&i,r=10;r<t.length;r++){var o=0|t.words[r];t.words[r-10]=(4194303&o)<<4|i>>>22,i=o}i>>>=22,t.words[r-10]=i,0===i&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n<t.length;n++){var r=0|t.words[n];e+=977*r,t.words[n]=67108863&e,e=64*r+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(v,y),i(w,y),i(M,y),M.prototype.imulK=function(t){for(var e=0,n=0;n<t.length;n++){var r=19*(0|t.words[n])+e,i=67108863&r;r>>>=26,t.words[n]=i,e=r}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(g[t])return g[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new v;else if("p192"===t)e=new w;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new M}return g[t]=e,e},_.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},_.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},_.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},_.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},_.prototype.add=function(t,e){this._verify2(t,e);var n=t.add(e);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},_.prototype.iadd=function(t,e){this._verify2(t,e);var n=t.iadd(e);return n.cmp(this.m)>=0&&n.isub(this.m),n},_.prototype.sub=function(t,e){this._verify2(t,e);var n=t.sub(e);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},_.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},_.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},_.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},_.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},_.prototype.isqr=function(t){return this.imul(t,t.clone())},_.prototype.sqr=function(t){return this.mul(t,t)},_.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var n=this.m.add(new o(1)).iushrn(2);return this.pow(t,n)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);r(!i.isZero());var s=new o(1).toRed(this),u=s.redNeg(),c=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,c).cmp(u);)l.redIAdd(u);for(var h=this.pow(l,i),d=this.pow(t,i.addn(1).iushrn(1)),f=this.pow(t,i),p=a;0!==f.cmp(s);){for(var m=f,g=0;0!==m.cmp(s);g++)m=m.redSqr();r(g<p);var y=this.pow(h,new o(1).iushln(p-g-1));d=d.redMul(y),h=y.redSqr(),f=f.redMul(h),p=g}return d},_.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},_.prototype.pow=function(t,e){if(e.isZero())return new o(1).toRed(this);if(0===e.cmpn(1))return t.clone();var n=new Array(16);n[0]=new o(1).toRed(this),n[1]=t;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],t);var i=n[0],a=0,s=0,u=e.bitLength()%26;for(0===u&&(u=26),r=e.length-1;r>=0;r--){for(var c=e.words[r],l=u-1;l>=0;l--){var h=c>>l&1;i!==n[0]&&(i=this.sqr(i)),0!==h||0!==a?(a<<=1,a|=h,(4==++s||0===r&&0===l)&&(i=this.mul(i,n[a]),s=0,a=0)):s=0}u=26}return i},_.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},_.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new E(t)},i(E,_),E.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},E.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},E.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var n=t.imul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).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)},E.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var n=t.mul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},E.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,n(54)(t))},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0});const r=n(60);r.__exportStar(n(61),e),r.__exportStar(n(62),e)},function(t,e,n){(function(t){
|
|
57
57
|
/*!
|
|
58
58
|
* The buffer module from node.js, for the browser.
|
|
59
59
|
*
|