text: (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[888],{1556:function(t,r,e){"use strict";e.d(r,{Sg:function(){return u},zt:function(){return a}});var n=e(6731),i=e(6881),o=e(1581);var s=function(t,r,e,n){return new(e||(e=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(r){o(r)}}function h(t){try{u(n.throw(t))}catch(r){o(r)}}function u(t){var r;t.done?i(t.value):(r=t.value,r instanceof e?r:new e((function(t){t(r)}))).then(s,h)}u((n=n.apply(t,r||[])).next())}))};const h=new o.Yd("abstract-provider/5.5.1");class u extends i.dk{static isForkEvent(t){return!(!t||!t._isForkEvent)}}class a{constructor(){h.checkAbstract(new.target,a),(0,i.zG)(this,"_isProvider",!0)}getFeeData(){return s(this,void 0,void 0,(function*(){const{block:t,gasPrice:r}=yield(0,i.mE)({block:this.getBlock("latest"),gasPrice:this.getGasPrice().catch((t=>null))});let e=null,o=null;return t&&t.baseFeePerGas&&(o=n.O$.from("2500000000"),e=t.baseFeePerGas.mul(2).add(o)),{maxFeePerGas:e,maxPriorityFeePerGas:o,gasPrice:r}}))}addListener(t,r){return this.on(t,r)}removeListener(t,r){return this.off(t,r)}static isProvider(t){return!(!t||!t._isProvider)}}},8088:function(t,r,e){"use strict";e.d(r,{E:function(){return a},b:function(){return l}});var n=e(6881),i=e(1581);var o=function(t,r,e,n){return new(e||(e=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(r){o(r)}}function h(t){try{u(n.throw(t))}catch(r){o(r)}}function u(t){var r;t.done?i(t.value):(r=t.value,r instanceof e?r:new e((function(t){t(r)}))).then(s,h)}u((n=n.apply(t,r||[])).next())}))};const s=new i.Yd("abstract-signer/5.5.0"),h=["accessList","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],u=[i.Yd.errors.INSUFFICIENT_FUNDS,i.Yd.errors.NONCE_EXPIRED,i.Yd.errors.REPLACEMENT_UNDERPRICED];class a{constructor(){s.checkAbstract(new.target,a),(0,n.zG)(this,"_isSigner",!0)}getBalance(t){return o(this,void 0,void 0,(function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),t)}))}getTransactionCount(t){return o(this,void 0,void 0,(function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),t)}))}estimateGas(t){return o(this,void 0,void 0,(function*(){this._checkProvider("estimateGas");const r=yield(0,n.mE)(this.checkTransaction(t));return yield this.provider.estimateGas(r)}))}call(t,r){return o(this,void 0,void 0,(function*(){this._checkProvider("call");const e=yield(0,n.mE)(this.checkTransaction(t));return yield this.provider.call(e,r)}))}sendTransaction(t){return o(this,void 0,void 0,(function*(){this._checkProvider("sendTransaction");const r=yield this.populateTransaction(t),e=yield this.signTransaction(r);return yield this.provider.sendTransaction(e)}))}getChainId(){return o(this,void 0,void 0,(function*(){this._checkProvider("getChainId");return(yield this.provider.getNetwork()).chainId}))}getGasPrice(){return o(this,void 0,void 0,(function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()}))}getFeeData(){return o(this,void 0,void 0,(function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()}))}resolveName(t){return o(this,void 0,void 0,(function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(t)}))}checkTransaction(t){for(const e in t)-1===h.indexOf(e)&&s.throwArgumentError("invalid transaction key: "+e,"transaction",t);const r=(0,n.DC)(t);return null==r.from?r.from=this.getAddress():r.from=Promise.all([Promise.resolve(r.from),this.getAddress()]).then((r=>(r[0].toLowerCase()!==r[1].toLowerCase()&&s.throwArgumentError("from address mismatch","transaction",t),r[0]))),r}populateTransaction(t){return o(this,void 0,void 0,(function*(){const r=yield(0,n.mE)(this.checkTransaction(t));null!=r.to&&(r.to=Promise.resolve(r.to).then((t=>o(this,void 0,void 0,(function*(){if(null==t)return null;const r=yield this.resolveName(t);return null==r&&s.throwArgumentError("provided ENS name resolves to null","tx.to",t),r})))),r.to.catch((t=>{})));const e=null!=r.maxFeePerGas||null!=r.maxPriorityFeePerGas;if(null==r.gasPrice||2!==r.type&&!e?0!==r.type&&1!==r.type||!e||s.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",t):s.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",t),2!==r.type&&null!=r.type||null==r.maxFeePerGas||null==r.maxPriorityFeePerGas)if(0===r.type||1===r.type)null==r.gasPrice&&(r.gasPrice=this.getGasPrice());else{const t=yield this.getFeeData();if(null==r.type)if(null!=t.maxFeePerGas&&null!=t.maxPriorityFeePerGas)if(r.type=2,null!=r.gasPrice){const t=r.gasPrice;delete r.gasPrice,r.maxFeePerGas=t,r.maxPriorityFeePerGas=t}else null==r.maxFeePerGas&&(r.maxFeePerGas=t.maxFeePerGas),null==r.maxPriorityFeePerGas&&(r.maxPriorityFeePerGas=t.maxPriorityFeePerGas);else null!=t.gasPrice?(e&&s.throwError("network does not support EIP-1559",i.Yd.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),null==r.gasPrice&&(r.gasPrice=t.gasPrice),r.type=0):s.throwError("failed to get consistent fee data",i.Yd.errors.UNSUPPORTED_OPERATION,{operation:"signer.getFeeData"});else 2===r.type&&(null==r.maxFeePerGas&&(r.maxFeePerGas=t.maxFeePerGas),null==r.maxPriorityFeePerGas&&(r.maxPriorityFeePerGas=t.maxPriorityFeePerGas))}else r.type=2;return null==r.nonce&&(r.nonce=this.getTransactionCount("pending")),null==r.gasLimit&&(r.gasLimit=this.estimateGas(r).catch((t=>{if(u.indexOf(t.code)>=0)throw t;return s.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",i.Yd.errors.UNPREDICTABLE_GAS_LIMIT,{error:t,tx:r})}))),null==r.chainId?r.chainId=this.getChainId():r.chainId=Promise.all([Promise.resolve(r.chainId),this.getChainId()]).then((r=>(0!==r[1]&&r[0]!==r[1]&&s.throwArgumentError("chainId address mismatch","transaction",t),r[0]))),yield(0,n.mE)(r)}))}_checkProvider(t){this.provider||s.throwError("missing provider",i.Yd.errors.UNSUPPORTED_OPERATION,{operation:t||"_checkProvider"})}static isSigner(t){return!(!t||!t._isSigner)}}class l extends a{constructor(t,r){s.checkNew(new.target,l),super(),(0,n.zG)(this,"address",t),(0,n.zG)(this,"provider",r||null)}getAddress(){return Promise.resolve(this.address)}_fail(t,r){return Promise.resolve().then((()=>{s.throwError(t,i.Yd.errors.UNSUPPORTED_OPERATION,{operation:r})}))}signMessage(t){return this._fail("VoidSigner cannot sign messages","signMessage")}signTransaction(t){return this._fail("VoidSigner cannot sign transactions","signTransaction")}_signTypedData(t,r,e){return this._fail("VoidSigner cannot sign typed data","signTypedData")}connect(t){return new l(this.address,t)}}},9485:function(t,r,e){"use strict";e.d(r,{Kn:function(){return d},CR:function(){return m}});var n=e(6441),i=e(6731),o=e(8197),s=e(9052);const h=new(e(1581).Yd)("address/5.5.0");function u(t){(0,n.A7)(t,20)||h.throwArgumentError("invalid address","address",t);const r=(t=t.toLowerCase()).substring(2).split(""),e=new Uint8Array(40);for(let n=0;n<40;n++)e[n]=r[n].charCodeAt(0);const i=(0,n.lE)((0,o.w)(e));for(let n=0;n<40;n+=2)i[n>>1]>>4>=8&&(r[n]=r[n].toUpperCase()),(15&i[n>>1])>=8&&(r[n+1]=r[n+1].toUpperCase());return"0x"+r.join("")}const a={};for(let p=0;p<10;p++)a[String(p)]=String(p);for(let p=0;p<26;p++)a[String.fromCharCode(65+p)]=String(10+p);const l=Math.floor((f=9007199254740991,Math.log10?Math.log10(f):Math.log(f)/Math.LN10));var f;function c(t){let r=(t=(t=t.toUpperCase()).substring(4)+t.substring(0,2)+"00").split("").map((t=>a[t])).join("");for(;r.length>=l;){let t=r.substring(0,l);r=parseInt(t,10)%97+r.substring(t.length)}let e=String(98-parseInt(r,10)%97);for(;e.length<2;)e="0"+e;return e}function d(t){let r=null;if("string"!==typeof t&&h.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==t.substring(0,2)&&(t="0x"+t),r=u(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&r!==t&&h.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==c(t)&&h.throwArgumentError("bad icap checksum","address",t),r=(0,i.g$)(t.substring(4));r.length<40;)r="0"+r;r=u("0x"+r)}else h.throwArgumentError("invalid address","address",t);return r}function m(t){let r=null;try{r=d(t.from)}catch(u){h.throwArgumentError("missing from address","transaction",t)}const e=(0,n.G1)((0,n.lE)(i.O$.from(t.nonce).toHexString()));return d((0,n.p3)((0,o.w)((0,s.c)([r,e])),12))}},6731:function(t,r,e){"use strict";e.d(r,{O$:function(){return c},g$:function(){return v}});var n=e(3877),i=e.n(n),o=e(6441),s=e(1581);var h=i().BN;const u=new s.Yd("bignumber/5.5.0"),a={},l=9007199254740991;let f=!1;class c{constructor(t,r){u.checkNew(new.target,c),t!==a&&u.throwError("cannot call constructor directly; use BigNumber.from",s.Yd.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=r,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return m(p(this).fromTwos(t))}toTwos(t){return m(p(this).toTwos(t))}abs(){return"-"===this._hex[0]?c.from(this._hex.substring(1)):this}add(t){return m(p(this).add(p(t)))}sub(t){return m(p(this).sub(p(t)))}div(t){return c.from(t).isZero()&&g("division by zero","div"),m(p(this).div(p(t)))}mul(t){return m(p(this).mul(p(t)))}mod(t){const r=p(t);return r.isNeg()&&g("cannot modulo negative values","mod"),m(p(this).umod(r))}pow(t){const r=p(t);return r.isNeg()&&g("cannot raise to negative values","pow"),m(p(this).pow(r))}and(t){const r=p(t);return(this.isNegative()||r.isNeg())&&g("cannot 'and' negative values","and"),m(p(this).and(r))}or(t){const r=p(t);return(this.isNegative()||r.isNeg())&&g("cannot 'or' negative values","or"),m(p(this).or(r))}xor(t){const r=p(t);return(this.isNegative()||r.isNeg())&&g("cannot 'xor' negative values","xor"),m(p(this).xor(r))}mask(t){return(this.isNegative()||t<0)&&g("cannot mask negative values","mask"),m(p(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&g("cannot shift negative values","shl"),m(p(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&g("cannot shift negative values","shr"),m(p(this).shrn(t))}eq(t){return p(this).eq(p(t))}lt(t){return p(this).lt(p(t))}lte(t){return p(this).lte(p(t))}gt(t){return p(this).gt(p(t))}gte(t){return p(this).gte(p(t))}isNegative(){return"-"===this._hex[0]}isZero(){return p(this).isZero()}toNumber(){try{return p(this).toNumber()}catch(t){g("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return u.throwError("this platform does not support BigInt",s.Yd.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?f||(f=!0,u.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?u.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",s.Yd.errors.UNEXPECTED_ARGUMENT,{}):u.throwError("BigNumber.toString does not accept parameters",s.Yd.errors.UNEXPECTED_ARGUMENT,{})),p(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof c)return t;if("string"===typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new c(a,d(t)):t.match(/^-?[0-9]+$/)?new c(a,d(new h(t))):u.throwArgumentError("invalid BigNumber string","value",t);if("number"===typeof t)return t%1&&g("underflow","BigNumber.from",t),(t>=l||t<=-l)&&g("overflow","BigNumber.from",t),c.from(String(t));const r=t;if("bigint"===typeof r)return c.from(r.toString());if((0,o._t)(r))return c.from((0,o.Dv)(r));if(r)if(r.toHexString){const t=r.toHexString();if("string"===typeof t)return c.from(t)}else{let t=r._hex;if(null==t&&"BigNumber"===r.type&&(t=r.hex),"string"===typeof t&&((0,o.A7)(t)||"-"===t[0]&&(0,o.A7)(t.substring(1))))return c.from(t)}return u.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function d(t){if("string"!==typeof t)return d(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&u.throwArgumentError("invalid hex","value",t),"0x00"===(t=d(t))?t:"-"+t;if("0x"!==t.substring(0,2)&&(t="0x"+t),"0x"===t)return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&"0x00"===t.substring(0,4);)t="0x"+t.substring(4);return t}function m(t){return c.from(d(t))}function p(t){const r=c.from(t).toHexString();return"-"===r[0]?new h("-"+r.substring(3),16):new h(r.substring(2),16)}function g(t,r,e){const n={fault:t,operation:r};return null!=e&&(n.value=e),u.throwError(t,s.Yd.errors.NUMERIC_FAULT,n)}function v(t){return new h(t,36).toString(16)}},3877:function(t,r,e){!function(t,r){"use strict";function n(t,r){if(!t)throw new Error(r||"Assertion failed")}function i(t,r){t.super_=r;var e=function(){};e.prototype=r.prototype,t.prototype=new e,t.prototype.constructor=t}function o(t,r,e){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==r&&"be"!==r||(e=r,r=10),this._init(t||0,r||10,e||"be"))}var s;"object"===typeof t?t.exports=o:r.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!==typeof window&&"undefined"!==typeof window.Buffer?window.Buffer:e(8677).Buffer}catch(k){}function h(t,r){var e=t.charCodeAt(r);return e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:e-48&15}function u(t,r,e){var n=h(t,e);return e-1>=r&&(n|=h(t,e-1)<<4),n}function a(t,r,e,n){for(var i=0,o=Math.min(t.length,e),s=r;s<o;s++){var h=t.charCodeAt(s)-48;i*=n,i+=h>=49?h-49+10:h>=17?h-17+10:h}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,r){return t.cmp(r)>0?t:r},o.min=function(t,r){return t.cmp(r)<0?t:r},o.prototype._init=function(t,r,e){if("number"===typeof t)return this._initNumber(t,r,e);if("object"===typeof t)return this._initArray(t,r,e);"hex"===r&&(r=16),n(r===(0|r)&&r>=2&&r<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<t.length&&(16===r?this._parseHex(t,i,e):(this._parseBase(t,r,i),"le"===e&&this._initArray(this.toArray(),r,e)))},o.prototype._initNumber=function(t,r,e){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"===e&&this._initArray(this.toArray(),r,e)},o.prototype._initArray=function(t,r,e){if(n("number"===typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,s,h=0;if("be"===e)for(i=t.length-1,o=0;i>=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<<h&67108863,this.words[o+1]=s>>>26-h&67108863,(h+=24)>=26&&(h-=26,o++);else if("le"===e)for(i=0,o=0;i<t.length;i+=3)s=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=s<<h&67108863,this.words[o+1]=s>>>26-h&67108863,(h+=24)>=26&&(h-=26,o++);return this.strip()},o.prototype._parseHex=function(t,r,e){this.length=Math.ceil((t.length-r)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var i,o=0,s=0;if("be"===e)for(n=t.length-1;n>=r;n-=2)i=u(t,r,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(t.length-r)%2===0?r+1:r;n<t.length;n+=2)i=u(t,r,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this.strip()},o.prototype._parseBase=function(t,r,e){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=r)n++;n--,i=i/r|0;for(var o=t.length-e,s=o%n,h=Math.min(o,o-s)+e,u=0,l=e;l<h;l+=n)u=a(t,l,l+n,r),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var f=1;for(u=a(t,l,t.length,r),l=0;l<s;l++)f*=r;this.imuln(f),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},o.prototype.copy=function(t){t.words=new Array(this.length);for(var r=0;r<this.length;r++)t.words[r]=this.words[r];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 l=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],c=[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,r,e){e.negative=r.negative^t.negative;var n=t.length+r.length|0;e.length=n,n=n-1|0;var i=0|t.words[0],o=0|r.words[0],s=i*o,h=67108863&s,u=s/67108864|0;e.words[0]=h;for(var a=1;a<n;a++){for(var l=u>>>26,f=67108863&u,c=Math.min(a,r.length-1),d=Math.max(0,a-t.length+1);d<=c;d++){var m=a-d|0;l+=(s=(i=0|t.words[m])*(o=0|r.words[d])+f)/67108864|0,f=67108863&s}e.words[a]=0|f,u=0|l}return 0!==u?e.words[a]=0|u:e.length--,e.strip()}o.prototype.toString=function(t,r){var e;if(r=0|r||1,16===(t=t||10)||"hex"===t){e="";for(var i=0,o=0,s=0;s<this.length;s++){var h=this.words[s],u=(16777215&(h<<i|o)).toString(16);e=0!==(o=h>>>24-i&16777215)||s!==this.length-1?l[6-u.length]+u+e:u+e,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(e=o.toString(16)+e);e.length%r!==0;)e="0"+e;return 0!==this.negative&&(e="-"+e),e}if(t===(0|t)&&t>=2&&t<=36){var a=f[t],d=c[t];e="";var m=this.clone();for(m.negative=0;!m.isZero();){var p=m.modn(d).toString(t);e=(m=m.idivn(d)).isZero()?p+e:l[a-p.length]+p+e}for(this.isZero()&&(e="0"+e);e.length%r!==0;)e="0"+e;return 0!==this.negative&&(e="-"+e),e}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,r){return n("undefined"!==typeof s),this.toArrayLike(s,t,r)},o.prototype.toArray=function(t,r){return this.toArrayLike(Array,t,r)},o.prototype.toArrayLike=function(t,r,e){var i=this.byteLength(),o=e||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0"),this.strip();var s,h,u="le"===r,a=new t(o),l=this.clone();if(u){for(h=0;!l.isZero();h++)s=l.andln(255),l.iushrn(8),a[h]=s;for(;h<o;h++)a[h]=0}else{for(h=0;h<o-i;h++)a[h]=0;for(h=0;!l.isZero();h++)s=l.andln(255),l.iushrn(8),a[o-h-1]=s}return a},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var r=t,e=0;return r>=4096&&(e+=13,r>>>=13),r>=64&&(e+=7,r>>>=7),r>=8&&(e+=4,r>>>=4),r>=2&&(e+=2,r>>>=2),e+r},o.prototype._zeroBits=function(t){if(0===t)return 26;var r=t,e=0;return 0===(8191&r)&&(e+=13,r>>>=13),0===(127&r)&&(e+=7,r>>>=7),0===(15&r)&&(e+=4,r>>>=4),0===(3&r)&&(e+=2,r>>>=2),0===(1&r)&&e++,e},o.prototype.bitLength=function(){var t=this.words[this.length-1],r=this._countBits(t);return 26*(this.length-1)+r},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,r=0;r<this.length;r++){var e=this._zeroBits(this.words[r]);if(t+=e,26!==e)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 r=0;r<t.length;r++)this.words[r]=this.words[r]|t.words[r];return this.strip()},o.prototype.ior=function(t){return n(0===(this.negative|t.negative)),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var r;r=this.length>t.length?t:this;for(var e=0;e<r.length;e++)this.words[e]=this.words[e]&t.words[e];return this.length=r.length,this.strip()},o.prototype.iand=function(t){return n(0===(this.negative|t.negative)),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var r,e;this.length>t.length?(r=this,e=t):(r=t,e=this);for(var n=0;n<e.length;n++)this.words[n]=r.words[n]^e.words[n];if(this!==r)for(;n<r.length;n++)this.words[n]=r.words[n];return this.length=r.length,this.strip()},o.prototype.ixor=function(t){return n(0===(this.negative|t.negative)),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"===typeof t&&t>=0);var r=0|Math.ceil(t/26),e=t%26;this._expand(r),e>0&&r--;for(var i=0;i<r;i++)this.words[i]=67108863&~this.words[i];return e>0&&(this.words[i]=~this.words[i]&67108863>>26-e),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,r){n("number"===typeof t&&t>=0);var e=t/26|0,i=t%26;return this._expand(e+1),this.words[e]=r?this.words[e]|1<<i:this.words[e]&~(1<<i),this.strip()},o.prototype.iadd=function(t){var r,e,n;if(0!==this.negative&&0===t.negative)return this.negative=0,r=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,r=this.isub(t),t.negative=1,r._normSign();this.length>t.length?(e=this,n=t):(e=t,n=this);for(var i=0,o=0;o<n.length;o++)r=(0|e.words[o])+(0|n.words[o])+i,this.words[o]=67108863&r,i=r>>>26;for(;0!==i&&o<e.length;o++)r=(0|e.words[o])+i,this.words[o]=67108863&r,i=r>>>26;if(this.length=e.length,0!==i)this.words[this.length]=i,this.length++;else if(e!==this)for(;o<e.length;o++)this.words[o]=e.words[o];return this},o.prototype.add=function(t){var r;return 0!==t.negative&&0===this.negative?(t.negative=0,r=this.sub(t),t.negative^=1,r):0===t.negative&&0!==this.negative?(this.negative=0,r=t.sub(this),this.negative=1,r):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 r=this.iadd(t);return t.negative=1,r._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var e,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(e=this,n=t):(e=t,n=this);for(var o=0,s=0;s<n.length;s++)o=(r=(0|e.words[s])-(0|n.words[s])+o)>>26,this.words[s]=67108863&r;for(;0!==o&&s<e.length;s++)o=(r=(0|e.words[s])+o)>>26,this.words[s]=67108863&r;if(0===o&&s<e.length&&e!==this)for(;s<e.length;s++)this.words[s]=e.words[s];return this.length=Math.max(this.length,s),e!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(t){return this.clone().isub(t)};var m=function(t,r,e){var n,i,o,s=t.words,h=r.words,u=e.words,a=0,l=0|s[0],f=8191&l,c=l>>>13,d=0|s[1],m=8191&d,p=d>>>13,g=0|s[2],v=8191&g,y=g>>>13,w=0|s[3],b=8191&w,M=w>>>13,_=0|s[4],E=8191&_,A=_>>>13,k=0|s[5],N=8191&k,x=k>>>13,P=0|s[6],I=8191&P,R=P>>>13,S=0|s[7],T=8191&S,O=S>>>13,B=0|s[8],C=8191&B,F=B>>>13,L=0|s[9],D=8191&L,U=L>>>13,z=0|h[0],q=8191&z,G=z>>>13,j=0|h[1],$=8191&j,Y=j>>>13,H=0|h[2],V=8191&H,Z=H>>>13,K=0|h[3],J=8191&K,W=K>>>13,X=0|h[4],Q=8191&X,tt=X>>>13,rt=0|h[5],et=8191&rt,nt=rt>>>13,it=0|h[6],ot=8191&it,st=it>>>13,ht=0|h[7],ut=8191&ht,at=ht>>>13,lt=0|h[8],ft=8191&lt,ct=lt>>>13,dt=0|h[9],mt=8191&dt,pt=dt>>>13;e.negative=t.negative^r.negative,e.length=19;var gt=(a+(n=Math.imul(f,q))|0)+((8191&(i=(i=Math.imul(f,G))+Math.imul(c,q)|0))<<13)|0;a=((o=Math.imul(c,G))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(m,q),i=(i=Math.imul(m,G))+Math.imul(p,q)|0,o=Math.imul(p,G);var vt=(a+(n=n+Math.imul(f,$)|0)|0)+((8191&(i=(i=i+Math.imul(f,Y)|0)+Math.imul(c,$)|0))<<13)|0;a=((o=o+Math.imul(c,Y)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(v,q),i=(i=Math.imul(v,G))+Math.imul(y,q)|0,o=Math.imul(y,G),n=n+Math.imul(m,$)|0,i=(i=i+Math.imul(m,Y)|0)+Math.imul(p,$)|0,o=o+Math.imul(p,Y)|0;var yt=(a+(n=n+Math.imul(f,V)|0)|0)+((8191&(i=(i=i+Math.imul(f,Z)|0)+Math.imul(c,V)|0))<<13)|0;a=((o=o+Math.imul(c,Z)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(b,q),i=(i=Math.imul(b,G))+Math.imul(M,q)|0,o=Math.imul(M,G),n=n+Math.imul(v,$)|0,i=(i=i+Math.imul(v,Y)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,Y)|0,n=n+Math.imul(m,V)|0,i=(i=i+Math.imul(m,Z)|0)+Math.imul(p,V)|0,o=o+Math.imul(p,Z)|0;var wt=(a+(n=n+Math.imul(f,J)|0)|0)+((8191&(i=(i=i+Math.imul(f,W)|0)+Math.imul(c,J)|0))<<13)|0;a=((o=o+Math.imul(c,W)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(E,q),i=(i=Math.imul(E,G))+Math.imul(A,q)|0,o=Math.imul(A,G),n=n+Math.imul(b,$)|0,i=(i=i+Math.imul(b,Y)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,Y)|0,n=n+Math.imul(v,V)|0,i=(i=i+Math.imul(v,Z)|0)+Math.imul(y,V)|0,o=o+Math.imul(y,Z)|0,n=n+Math.imul(m,J)|0,i=(i=i+Math.imul(m,W)|0)+Math.imul(p,J)|0,o=o+Math.imul(p,W)|0;var bt=(a+(n=n+Math.imul(f,Q)|0)|0)+((8191&(i=(i=i+Math.imul(f,tt)|0)+Math.imul(c,Q)|0))<<13)|0;a=((o=o+Math.imul(c,tt)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(N,q),i=(i=Math.imul(N,G))+Math.imul(x,q)|0,o=Math.imul(x,G),n=n+Math.imul(E,$)|0,i=(i=i+Math.imul(E,Y)|0)+Math.imul(A,$)|0,o=o+Math.imul(A,Y)|0,n=n+Math.imul(b,V)|0,i=(i=i+Math.imul(b,Z)|0)+Math.imul(M,V)|0,o=o+Math.imul(M,Z)|0,n=n+Math.imul(v,J)|0,i=(i=i+Math.imul(v,W)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,W)|0,n=n+Math.imul(m,Q)|0,i=(i=i+Math.imul(m,tt)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,tt)|0;var Mt=(a+(n=n+Math.imul(f,et)|0)|0)+((8191&(i=(i=i+Math.imul(f,nt)|0)+Math.imul(c,et)|0))<<13)|0;a=((o=o+Math.imul(c,nt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(I,q),i=(i=Math.imul(I,G))+Math.imul(R,q)|0,o=Math.imul(R,G),n=n+Math.imul(N,$)|0,i=(i=i+Math.imul(N,Y)|0)+Math.imul(x,$)|0,o=o+Math.imul(x,Y)|0,n=n+Math.imul(E,V)|0,i=(i=i+Math.imul(E,Z)|0)+Math.imul(A,V)|0,o=o+Math.imul(A,Z)|0,n=n+Math.imul(b,J)|0,i=(i=i+Math.imul(b,W)|0)+Math.imul(M,J)|0,o=o+Math.imul(M,W)|0,n=n+Math.imul(v,Q)|0,i=(i=i+Math.imul(v,tt)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,tt)|0,n=n+Math.imul(m,et)|0,i=(i=i+Math.imul(m,nt)|0)+Math.imul(p,et)|0,o=o+Math.imul(p,nt)|0;var _t=(a+(n=n+Math.imul(f,ot)|0)|0)+((8191&(i=(i=i+Math.imul(f,st)|0)+Math.imul(c,ot)|0))<<13)|0;a=((o=o+Math.imul(c,st)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(T,q),i=(i=Math.imul(T,G))+Math.imul(O,q)|0,o=Math.imul(O,G),n=n+Math.imul(I,$)|0,i=(i=i+Math.imul(I,Y)|0)+Math.imul(R,$)|0,o=o+Math.imul(R,Y)|0,n=n+Math.imul(N,V)|0,i=(i=i+Math.imul(N,Z)|0)+Math.imul(x,V)|0,o=o+Math.imul(x,Z)|0,n=n+Math.imul(E,J)|0,i=(i=i+Math.imul(E,W)|0)+Math.imul(A,J)|0,o=o+Math.imul(A,W)|0,n=n+Math.imul(b,Q)|0,i=(i=i+Math.imul(b,tt)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,tt)|0,n=n+Math.imul(v,et)|0,i=(i=i+Math.imul(v,nt)|0)+Math.imul(y,et)|0,o=o+Math.imul(y,nt)|0,n=n+Math.imul(m,ot)|0,i=(i=i+Math.imul(m,st)|0)+Math.imul(p,ot)|0,o=o+Math.imul(p,st)|0;var Et=(a+(n=n+Math.imul(f,ut)|0)|0)+((8191&(i=(i=i+Math.imul(f,at)|0)+Math.imul(c,ut)|0))<<13)|0;a=((o=o+Math.imul(c,at)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(C,q),i=(i=Math.imul(C,G))+Math.imul(F,q)|0,o=Math.imul(F,G),n=n+Math.imul(T,$)|0,i=(i=i+Math.imul(T,Y)|0)+Math.imul(O,$)|0,o=o+Math.imul(O,Y)|0,n=n+Math.imul(I,V)|0,i=(i=i+Math.imul(I,Z)|0)+Math.imul(R,V)|0,o=o+Math.imul(R,Z)|0,n=n+Math.imul(N,J)|0,i=(i=i+Math.imul(N,W)|0)+Math.imul(x,J)|0,o=o+Math.imul(x,W)|0,n=n+Math.imul(E,Q)|0,i=(i=i+Math.imul(E,tt)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,tt)|0,n=n+Math.imul(b,et)|0,i=(i=i+Math.imul(b,nt)|0)+Math.imul(M,et)|0,o=o+Math.imul(M,nt)|0,n=n+Math.imul(v,ot)|0,i=(i=i+Math.imul(v,st)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,st)|0,n=n+Math.imul(m,ut)|0,i=(i=i+Math.imul(m,at)|0)+Math.imul(p,ut)|0,o=o+Math.imul(p,at)|0;var At=(a+(n=n+Math.imul(f,ft)|0)|0)+((8191&(i=(i=i+Math.imul(f,ct)|0)+Math.imul(c,ft)|0))<<13)|0;a=((o=o+Math.imul(c,ct)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(D,q),i=(i=Math.imul(D,G))+Math.imul(U,q)|0,o=Math.imul(U,G),n=n+Math.imul(C,$)|0,i=(i=i+Math.imul(C,Y)|0)+Math.imul(F,$)|0,o=o+Math.imul(F,Y)|0,n=n+Math.imul(T,V)|0,i=(i=i+Math.imul(T,Z)|0)+Math.imul(O,V)|0,o=o+Math.imul(O,Z)|0,n=n+Math.imul(I,J)|0,i=(i=i+Math.imul(I,W)|0)+Math.imul(R,J)|0,o=o+Math.imul(R,W)|0,n=n+Math.imul(N,Q)|0,i=(i=i+Math.imul(N,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,n=n+Math.imul(E,et)|0,i=(i=i+Math.imul(E,nt)|0)+Math.imul(A,et)|0,o=o+Math.imul(A,nt)|0,n=n+Math.imul(b,ot)|0,i=(i=i+Math.imul(b,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|0,n=n+Math.imul(v,ut)|0,i=(i=i+Math.imul(v,at)|0)+Math.imul(y,ut)|0,o=o+Math.imul(y,at)|0,n=n+Math.imul(m,ft)|0,i=(i=i+Math.imul(m,ct)|0)+Math.imul(p,ft)|0,o=o+Math.imul(p,ct)|0;var kt=(a+(n=n+Math.imul(f,mt)|0)|0)+((8191&(i=(i=i+Math.imul(f,pt)|0)+Math.imul(c,mt)|0))<<13)|0;a=((o=o+Math.imul(c,pt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(D,$),i=(i=Math.imul(D,Y))+Math.imul(U,$)|0,o=Math.imul(U,Y),n=n+Math.imul(C,V)|0,i=(i=i+Math.imul(C,Z)|0)+Math.imul(F,V)|0,o=o+Math.imul(F,Z)|0,n=n+Math.imul(T,J)|0,i=(i=i+Math.imul(T,W)|0)+Math.imul(O,J)|0,o=o+Math.imul(O,W)|0,n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,tt)|0,n=n+Math.imul(N,et)|0,i=(i=i+Math.imul(N,nt)|0)+Math.imul(x,et)|0,o=o+Math.imul(x,nt)|0,n=n+Math.imul(E,ot)|0,i=(i=i+Math.imul(E,st)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,st)|0,n=n+Math.imul(b,ut)|0,i=(i=i+Math.imul(b,at)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,at)|0,n=n+Math.imul(v,ft)|0,i=(i=i+Math.imul(v,ct)|0)+Math.imul(y,ft)|0,o=o+Math.imul(y,ct)|0;var Nt=(a+(n=n+Math.imul(m,mt)|0)|0)+((8191&(i=(i=i+Math.imul(m,pt)|0)+Math.imul(p,mt)|0))<<13)|0;a=((o=o+Math.imul(p,pt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(D,V),i=(i=Math.imul(D,Z))+Math.imul(U,V)|0,o=Math.imul(U,Z),n=n+Math.imul(C,J)|0,i=(i=i+Math.imul(C,W)|0)+Math.imul(F,J)|0,o=o+Math.imul(F,W)|0,n=n+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,tt)|0)+Math.imul(O,Q)|0,o=o+Math.imul(O,tt)|0,n=n+Math.imul(I,et)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(R,et)|0,o=o+Math.imul(R,nt)|0,n=n+Math.imul(N,ot)|0,i=(i=i+Math.imul(N,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,n=n+Math.imul(E,ut)|0,i=(i=i+Math.imul(E,at)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,at)|0,n=n+Math.imul(b,ft)|0,i=(i=i+Math.imul(b,ct)|0)+Math.imul(M,ft)|0,o=o+Math.imul(M,ct)|0;var xt=(a+(n=n+Math.imul(v,mt)|0)|0)+((8191&(i=(i=i+Math.imul(v,pt)|0)+Math.imul(y,mt)|0))<<13)|0;a=((o=o+Math.imul(y,pt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(D,J),i=(i=Math.imul(D,W))+Math.imul(U,J)|0,o=Math.imul(U,W),n=n+Math.imul(C,Q)|0,i=(i=i+Math.imul(C,tt)|0)+Math.imul(F,Q)|0,o=o+Math.imul(F,tt)|0,n=n+Math.imul(T,et)|0,i=(i=i+Math.imul(T,nt)|0)+Math.imul(O,et)|0,o=o+Math.imul(O,nt)|0,n=n+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,st)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,st)|0,n=n+Math.imul(N,ut)|0,i=(i=i+Math.imul(N,at)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,at)|0,n=n+Math.imul(E,ft)|0,i=(i=i+Math.imul(E,ct)|0)+Math.imul(A,ft)|0,o=o+Math.imul(A,ct)|0;var Pt=(a+(n=n+Math.imul(b,mt)|0)|0)+((8191&(i=(i=i+Math.imul(b,pt)|0)+Math.imul(M,mt)|0))<<13)|0;a=((o=o+Math.imul(M,pt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(D,Q),i=(i=Math.imul(D,tt))+Math.imul(U,Q)|0,o=Math.imul(U,tt),n=n+Math.imul(C,et)|0,i=(i=i+Math.imul(C,nt)|0)+Math.imul(F,et)|0,o=o+Math.imul(F,nt)|0,n=n+Math.imul(T,ot)|0,i=(i=i+Math.imul(T,st)|0)+Math.imul(O,ot)|0,o=o+Math.imul(O,st)|0,n=n+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,at)|0)+Math.imul(R,ut)|0,o=o+Math.imul(R,at)|0,n=n+Math.imul(N,ft)|0,i=(i=i+Math.imul(N,ct)|0)+Math.imul(x,ft)|0,o=o+Math.imul(x,ct)|0;var It=(a+(n=n+Math.imul(E,mt)|0)|0)+((8191&(i=(i=i+Math.imul(E,pt)|0)+Math.imul(A,mt)|0))<<13)|0;a=((o=o+Math.imul(A,pt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(D,et),i=(i=Math.imul(D,nt))+Math.imul(U,et)|0,o=Math.imul(U,nt),n=n+Math.imul(C,ot)|0,i=(i=i+Math.imul(C,st)|0)+Math.imul(F,ot)|0,o=o+Math.imul(F,st)|0,n=n+Math.imul(T,ut)|0,i=(i=i+Math.imul(T,at)|0)+Math.imul(O,ut)|0,o=o+Math.imul(O,at)|0,n=n+Math.imul(I,ft)|0,i=(i=i+Math.imul(I,ct)|0)+Math.imul(R,ft)|0,o=o+Math.imul(R,ct)|0;var Rt=(a+(n=n+Math.imul(N,mt)|0)|0)+((8191&(i=(i=i+Math.imul(N,pt)|0)+Math.imul(x,mt)|0))<<13)|0;a=((o=o+Math.imul(x,pt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(D,ot),i=(i=Math.imul(D,st))+Math.imul(U,ot)|0,o=Math.imul(U,st),n=n+Math.imul(C,ut)|0,i=(i=i+Math.imul(C,at)|0)+Math.imul(F,ut)|0,o=o+Math.imul(F,at)|0,n=n+Math.imul(T,ft)|0,i=(i=i+Math.imul(T,ct)|0)+Math.imul(O,ft)|0,o=o+Math.imul(O,ct)|0;var St=(a+(n=n+Math.imul(I,mt)|0)|0)+((8191&(i=(i=i+Math.imul(I,pt)|0)+Math.imul(R,mt)|0))<<13)|0;a=((o=o+Math.imul(R,pt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(D,ut),i=(i=Math.imul(D,at))+Math.imul(U,ut)|0,o=Math.imul(U,at),n=n+Math.imul(C,ft)|0,i=(i=i+Math.imul(C,ct)|0)+Math.imul(F,ft)|0,o=o+Math.imul(F,ct)|0;var Tt=(a+(n=n+Math.imul(T,mt)|0)|0)+((8191&(i=(i=i+Math.imul(T,pt)|0)+Math.imul(O,mt)|0))<<13)|0;a=((o=o+Math.imul(O,pt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(D,ft),i=(i=Math.imul(D,ct))+Math.imul(U,ft)|0,o=Math.imul(U,ct);var Ot=(a+(n=n+Math.imul(C,mt)|0)|0)+((8191&(i=(i=i+Math.imul(C,pt)|0)+Math.imul(F,mt)|0))<<13)|0;a=((o=o+Math.imul(F,pt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863;var Bt=(a+(n=Math.imul(D,mt))|0)+((8191&(i=(i=Math.imul(D,pt))+Math.imul(U,mt)|0))<<13)|0;return a=((o=Math.imul(U,pt))+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,u[0]=gt,u[1]=vt,u[2]=yt,u[3]=wt,u[4]=bt,u[5]=Mt,u[6]=_t,u[7]=Et,u[8]=At,u[9]=kt,u[10]=Nt,u[11]=xt,u[12]=Pt,u[13]=It,u[14]=Rt,u[15]=St,u[16]=Tt,u[17]=Ot,u[18]=Bt,0!==a&&(u[19]=a,e.length++),e};function p(t,r,e){return(new g).mulp(t,r,e)}function g(t,r){this.x=t,this.y=r}Math.imul||(m=d),o.prototype.mulTo=function(t,r){var e,n=this.length+t.length;return e=10===this.length&&10===t.length?m(this,t,r):n<63?d(this,t,r):n<1024?function(t,r,e){e.negative=r.negative^t.negative,e.length=t.length+r.length;for(var n=0,i=0,o=0;o<e.length-1;o++){var s=i;i=0;for(var h=67108863&n,u=Math.min(o,r.length-1),a=Math.max(0,o-t.length+1);a<=u;a++){var l=o-a,f=(0|t.words[l])*(0|r.words[a]),c=67108863&f;h=67108863&(c=c+h|0),i+=(s=(s=s+(f/67108864|0)|0)+(c>>>26)|0)>>>26,s&=67108863}e.words[o]=h,n=s,s=i}return 0!==n?e.words[o]=n:e.length--,e.strip()}(this,t,r):p(this,t,r),e},g.prototype.makeRBT=function(t){for(var r=new Array(t),e=o.prototype._countBits(t)-1,n=0;n<t;n++)r[n]=this.revBin(n,e,t);return r},g.prototype.revBin=function(t,r,e){if(0===t||t===e-1)return t;for(var n=0,i=0;i<r;i++)n|=(1&t)<<r-i-1,t>>=1;return n},g.prototype.permute=function(t,r,e,n,i,o){for(var s=0;s<o;s++)n[s]=r[t[s]],i[s]=e[t[s]]},g.prototype.transform=function(t,r,e,n,i,o){this.permute(o,t,r,e,n,i);for(var s=1;s<i;s<<=1)for(var h=s<<1,u=Math.cos(2*Math.PI/h),a=Math.sin(2*Math.PI/h),l=0;l<i;l+=h)for(var f=u,c=a,d=0;d<s;d++){var m=e[l+d],p=n[l+d],g=e[l+d+s],v=n[l+d+s],y=f*g-c*v;v=f*v+c*g,g=y,e[l+d]=m+g,n[l+d]=p+v,e[l+d+s]=m-g,n[l+d+s]=p-v,d!==h&&(y=u*f-a*c,c=u*c+a*f,f=y)}},g.prototype.guessLen13b=function(t,r){var e=1|Math.max(r,t),n=1&e,i=0;for(e=e/2|0;e;e>>>=1)i++;return 1<<i+1+n},g.prototype.conjugate=function(t,r,e){if(!(e<=1))for(var n=0;n<e/2;n++){var i=t[n];t[n]=t[e-n-1],t[e-n-1]=i,i=r[n],r[n]=-r[e-n-1],r[e-n-1]=-i}},g.prototype.normalize13b=function(t,r){for(var e=0,n=0;n<r/2;n++){var i=8192*Math.round(t[2*n+1]/r)+Math.round(t[2*n]/r)+e;t[n]=67108863&i,e=i<67108864?0:i/67108864|0}return t},g.prototype.convert13b=function(t,r,e,i){for(var o=0,s=0;s<r;s++)o+=0|t[s],e[2*s]=8191&o,o>>>=13,e[2*s+1]=8191&o,o>>>=13;for(s=2*r;s<i;++s)e[s]=0;n(0===o),n(0===(-8192&o))},g.prototype.stub=function(t){for(var r=new Array(t),e=0;e<t;e++)r[e]=0;return r},g.prototype.mulp=function(t,r,e){var n=2*this.guessLen13b(t.length,r.length),i=this.makeRBT(n),o=this.stub(n),s=new Array(n),h=new Array(n),u=new Array(n),a=new Array(n),l=new Array(n),f=new Array(n),c=e.words;c.length=n,this.convert13b(t.words,t.length,s,n),this.convert13b(r.words,r.length,a,n),this.transform(s,o,h,u,n,i),this.transform(a,o,l,f,n,i);for(var d=0;d<n;d++){var m=h[d]*l[d]-u[d]*f[d];u[d]=h[d]*f[d]+u[d]*l[d],h[d]=m}return this.conjugate(h,u,n),this.transform(h,u,c,o,n,i),this.conjugate(c,o,n),this.normalize13b(c,n),e.negative=t.negative^r.negative,e.length=t.length+r.length,e.strip()},o.prototype.mul=function(t){var r=new o(null);return r.words=new Array(this.length+t.length),this.mulTo(t,r)},o.prototype.mulf=function(t){var r=new o(null);return r.words=new Array(this.length+t.length),p(this,t,r)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.prototype.imuln=function(t){n("number"===typeof t),n(t<67108864);for(var r=0,e=0;e<this.length;e++){var i=(0|this.words[e])*t,o=(67108863&i)+(67108863&r);r>>=26,r+=i/67108864|0,r+=o>>>26,this.words[e]=67108863&o}return 0!==r&&(this.words[e]=r,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 r=function(t){for(var r=new Array(t.bitLength()),e=0;e<r.length;e++){var n=e/26|0,i=e%26;r[e]=(t.words[n]&1<<i)>>>i}return r}(t);if(0===r.length)return new o(1);for(var e=this,n=0;n<r.length&&0===r[n];n++,e=e.sqr());if(++n<r.length)for(var i=e.sqr();n<r.length;n++,i=i.sqr())0!==r[n]&&(e=e.mul(i));return e},o.prototype.iushln=function(t){n("number"===typeof t&&t>=0);var r,e=t%26,i=(t-e)/26,o=67108863>>>26-e<<26-e;if(0!==e){var s=0;for(r=0;r<this.length;r++){var h=this.words[r]&o,u=(0|this.words[r])-h<<e;this.words[r]=u|s,s=h>>>26-e}s&&(this.words[r]=s,this.length++)}if(0!==i){for(r=this.length-1;r>=0;r--)this.words[r+i]=this.words[r];for(r=0;r<i;r++)this.words[r]=0;this.length+=i}return this.strip()},o.prototype.ishln=function(t){return n(0===this.negative),this.iushln(t)},o.prototype.iushrn=function(t,r,e){var i;n("number"===typeof t&&t>=0),i=r?(r-r%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),h=67108863^67108863>>>o<<o,u=e;if(i-=s,i=Math.max(0,i),u){for(var a=0;a<s;a++)u.words[a]=this.words[a];u.length=s}if(0===s);else if(this.length>s)for(this.length-=s,a=0;a<this.length;a++)this.words[a]=this.words[a+s];else this.words[0]=0,this.length=1;var l=0;for(a=this.length-1;a>=0&&(0!==l||a>=i);a--){var f=0|this.words[a];this.words[a]=l<<26-o|f>>>o,l=f&h}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,r,e){return n(0===this.negative),this.iushrn(t,r,e)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"===typeof t&&t>=0);var r=t%26,e=(t-r)/26,i=1<<r;return!(this.length<=e)&&!!(this.words[e]&i)},o.prototype.imaskn=function(t){n("number"===typeof t&&t>=0);var r=t%26,e=(t-r)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=e)return this;if(0!==r&&e++,this.length=Math.min(e,this.length),0!==r){var i=67108863^67108863>>>r<<r;this.words[this.length-1]&=i}return this.strip()},o.prototype.maskn=function(t){return this.clone().imaskn(t)},o.prototype.iaddn=function(t){return n("number"===typeof t),n(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},o.prototype._iaddn=function(t){this.words[0]+=t;for(var r=0;r<this.length&&this.words[r]>=67108864;r++)this.words[r]-=67108864,r===this.length-1?this.words[r+1]=1:this.words[r+1]++;return this.length=Math.max(this.length,r+1),this},o.prototype.isubn=function(t){if(n("number"===typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var r=0;r<this.length&&this.words[r]<0;r++)this.words[r]+=67108864,this.words[r+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,r,e){var i,o,s=t.length+e;this._expand(s);var h=0;for(i=0;i<t.length;i++){o=(0|this.words[i+e])+h;var u=(0|t.words[i])*r;h=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+e]=67108863&o}for(;i<this.length-e;i++)h=(o=(0|this.words[i+e])+h)>>26,this.words[i+e]=67108863&o;if(0===h)return this.strip();for(n(-1===h),h=0,i=0;i<this.length;i++)h=(o=-(0|this.words[i])+h)>>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,r){var e=(this.length,t.length),n=this.clone(),i=t,s=0|i.words[i.length-1];0!==(e=26-this._countBits(s))&&(i=i.ushln(e),n.iushln(e),s=0|i.words[i.length-1]);var h,u=n.length-i.length;if("mod"!==r){(h=new o(null)).length=u+1,h.words=new Array(h.length);for(var a=0;a<h.length;a++)h.words[a]=0}var l=n.clone()._ishlnsubmul(i,1,u);0===l.negative&&(n=l,h&&(h.words[u]=1));for(var f=u-1;f>=0;f--){var c=67108864*(0|n.words[i.length+f])+(0|n.words[i.length+f-1]);for(c=Math.min(c/s|0,67108863),n._ishlnsubmul(i,c,f);0!==n.negative;)c--,n.negative=0,n._ishlnsubmul(i,1,f),n.isZero()||(n.negative^=1);h&&(h.words[f]=c)}return h&&h.strip(),n.strip(),"div"!==r&&0!==e&&n.iushrn(e),{div:h||null,mod:n}},o.prototype.divmod=function(t,r,e){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(h=this.neg().divmod(t,r),"mod"!==r&&(i=h.div.neg()),"div"!==r&&(s=h.mod.neg(),e&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(h=this.divmod(t.neg(),r),"mod"!==r&&(i=h.div.neg()),{div:i,mod:h.mod}):0!==(this.negative&t.negative)?(h=this.neg().divmod(t.neg(),r),"div"!==r&&(s=h.mod.neg(),e&&0!==s.negative&&s.isub(t)),{div:h.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===r?{div:this.divn(t.words[0]),mod:null}:"mod"===r?{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,r);var i,s,h},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 r=this.divmod(t);if(r.mod.isZero())return r.div;var e=0!==r.div.negative?r.mod.isub(t):r.mod,n=t.ushrn(1),i=t.andln(1),o=e.cmp(n);return o<0||1===i&&0===o?r.div:0!==r.div.negative?r.div.isubn(1):r.div.iaddn(1)},o.prototype.modn=function(t){n(t<=67108863);for(var r=(1<<26)%t,e=0,i=this.length-1;i>=0;i--)e=(r*e+(0|this.words[i]))%t;return e},o.prototype.idivn=function(t){n(t<=67108863);for(var r=0,e=this.length-1;e>=0;e--){var i=(0|this.words[e])+67108864*r;this.words[e]=i/t|0,r=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var r=this,e=t.clone();r=0!==r.negative?r.umod(t):r.clone();for(var i=new o(1),s=new o(0),h=new o(0),u=new o(1),a=0;r.isEven()&&e.isEven();)r.iushrn(1),e.iushrn(1),++a;for(var l=e.clone(),f=r.clone();!r.isZero();){for(var c=0,d=1;0===(r.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(r.iushrn(c);c-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(l),s.isub(f)),i.iushrn(1),s.iushrn(1);for(var m=0,p=1;0===(e.words[0]&p)&&m<26;++m,p<<=1);if(m>0)for(e.iushrn(m);m-- >0;)(h.isOdd()||u.isOdd())&&(h.iadd(l),u.isub(f)),h.iushrn(1),u.iushrn(1);r.cmp(e)>=0?(r.isub(e),i.isub(h),s.isub(u)):(e.isub(r),h.isub(i),u.isub(s))}return{a:h,b:u,gcd:e.iushln(a)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var r=this,e=t.clone();r=0!==r.negative?r.umod(t):r.clone();for(var i,s=new o(1),h=new o(0),u=e.clone();r.cmpn(1)>0&&e.cmpn(1)>0;){for(var a=0,l=1;0===(r.words[0]&l)&&a<26;++a,l<<=1);if(a>0)for(r.iushrn(a);a-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var f=0,c=1;0===(e.words[0]&c)&&f<26;++f,c<<=1);if(f>0)for(e.iushrn(f);f-- >0;)h.isOdd()&&h.iadd(u),h.iushrn(1);r.cmp(e)>=0?(r.isub(e),s.isub(h)):(e.isub(r),h.isub(s))}return(i=0===r.cmpn(1)?s:h).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 r=this.clone(),e=t.clone();r.negative=0,e.negative=0;for(var n=0;r.isEven()&&e.isEven();n++)r.iushrn(1),e.iushrn(1);for(;;){for(;r.isEven();)r.iushrn(1);for(;e.isEven();)e.iushrn(1);var i=r.cmp(e);if(i<0){var o=r;r=e,e=o}else if(0===i||0===e.cmpn(1))break;r.isub(e)}return e.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0===(1&this.words[0])},o.prototype.isOdd=function(){return 1===(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"===typeof t);var r=t%26,e=(t-r)/26,i=1<<r;if(this.length<=e)return this._expand(e+1),this.words[e]|=i,this;for(var o=i,s=e;0!==o&&s<this.length;s++){var h=0|this.words[s];o=(h+=o)>>>26,h&=67108863,this.words[s]=h}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var r,e=t<0;if(0!==this.negative&&!e)return-1;if(0===this.negative&&e)return 1;if(this.strip(),this.length>1)r=1;else{e&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];r=i===t?0:i<t?-1:1}return 0!==this.negative?0|-r:r},o.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var r=this.ucmp(t);return 0!==this.negative?0|-r:r},o.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var r=0,e=this.length-1;e>=0;e--){var n=0|this.words[e],i=0|t.words[e];if(n!==i){n<i?r=-1:n>i&&(r=1);break}}return r},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 E(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function y(t,r){this.name=t,this.p=new o(r,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function b(){y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function M(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(t){if("string"===typeof t){var r=o._prime(t);this.m=r.p,this.prime=r}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function A(t){E.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 r,e=t;do{this.split(e,this.tmp),r=(e=(e=this.imulK(e)).iadd(this.tmp)).bitLength()}while(r>this.n);var n=r<this.n?-1:e.ucmp(this.p);return 0===n?(e.words[0]=0,e.length=1):n>0?e.isub(this.p):void 0!==e.strip?e.strip():e._strip(),e},y.prototype.split=function(t,r){t.iushrn(this.n,0,r)},y.prototype.imulK=function(t){return t.imul(this.k)},i(w,y),w.prototype.split=function(t,r){for(var e=4194303,n=Math.min(t.length,9),i=0;i<n;i++)r.words[i]=t.words[i];if(r.length=n,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(r.words[r.length++]=o&e,i=10;i<t.length;i++){var s=0|t.words[i];t.words[i-10]=(s&e)<<4|o>>>22,o=s}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 r=0,e=0;e<t.length;e++){var n=0|t.words[e];r+=977*n,t.words[e]=67108863&r,r=64*n+(r/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(b,y),i(M,y),i(_,y),_.prototype.imulK=function(t){for(var r=0,e=0;e<t.length;e++){var n=19*(0|t.words[e])+r,i=67108863&n;n>>>=26,t.words[e]=i,r=n}return 0!==r&&(t.words[t.length++]=r),t},o._prime=function(t){if(v[t])return v[t];var r;if("k256"===t)r=new w;else if("p224"===t)r=new b;else if("p192"===t)r=new M;else{if("p25519"!==t)throw new Error("Unknown prime "+t);r=new _}return v[t]=r,r},E.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},E.prototype._verify2=function(t,r){n(0===(t.negative|r.negative),"red works only with positives"),n(t.red&&t.red===r.red,"red works only with red numbers")},E.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},E.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},E.prototype.add=function(t,r){this._verify2(t,r);var e=t.add(r);return e.cmp(this.m)>=0&&e.isub(this.m),e._forceRed(this)},E.prototype.iadd=function(t,r){this._verify2(t,r);var e=t.iadd(r);return e.cmp(this.m)>=0&&e.isub(this.m),e},E.prototype.sub=function(t,r){this._verify2(t,r);var e=t.sub(r);return e.cmpn(0)<0&&e.iadd(this.m),e._forceRed(this)},E.prototype.isub=function(t,r){this._verify2(t,r);var e=t.isub(r);return e.cmpn(0)<0&&e.iadd(this.m),e},E.prototype.shl=function(t,r){return this._verify1(t),this.imod(t.ushln(r))},E.prototype.imul=function(t,r){return this._verify2(t,r),this.imod(t.imul(r))},E.prototype.mul=function(t,r){return this._verify2(t,r),this.imod(t.mul(r))},E.prototype.isqr=function(t){return this.imul(t,t.clone())},E.prototype.sqr=function(t){return this.mul(t,t)},E.prototype.sqrt=function(t){if(t.isZero())return t.clone();var r=this.m.andln(3);if(n(r%2===1),3===r){var e=this.m.add(new o(1)).iushrn(2);return this.pow(t,e)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var h=new o(1).toRed(this),u=h.redNeg(),a=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,a).cmp(u);)l.redIAdd(u);for(var f=this.pow(l,i),c=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),m=s;0!==d.cmp(h);){for(var p=d,g=0;0!==p.cmp(h);g++)p=p.redSqr();n(g<m);var v=this.pow(f,new o(1).iushln(m-g-1));c=c.redMul(v),f=v.redSqr(),d=d.redMul(f),m=g}return c},E.prototype.invm=function(t){var r=t._invmp(this.m);return 0!==r.negative?(r.negative=0,this.imod(r).redNeg()):this.imod(r)},E.prototype.pow=function(t,r){if(r.isZero())return new o(1).toRed(this);if(0===r.cmpn(1))return t.clone();var e=new Array(16);e[0]=new o(1).toRed(this),e[1]=t;for(var n=2;n<e.length;n++)e[n]=this.mul(e[n-1],t);var i=e[0],s=0,h=0,u=r.bitLength()%26;for(0===u&&(u=26),n=r.length-1;n>=0;n--){for(var a=r.words[n],l=u-1;l>=0;l--){var f=a>>l&1;i!==e[0]&&(i=this.sqr(i)),0!==f||0!==s?(s<<=1,s|=f,(4===++h||0===n&&0===l)&&(i=this.mul(i,e[s]),h=0,s=0)):h=0}u=26}return i},E.prototype.convertTo=function(t){var r=t.umod(this.m);return r===t?r.clone():r},E.prototype.convertFrom=function(t){var r=t.clone();return r.red=null,r},o.mont=function(t){return new A(t)},i(A,E),A.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},A.prototype.convertFrom=function(t){var r=this.imod(t.mul(this.rinv));return r.red=null,r},A.prototype.imul=function(t,r){if(t.isZero()||r.isZero())return t.words[0]=0,t.length=1,t;var e=t.imul(r),n=e.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=e.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},A.prototype.mul=function(t,r){if(t.isZero()||r.isZero())return new o(0)._forceRed(this);var e=t.mul(r),n=e.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=e.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},A.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=e.nmd(t),this)},6441:function(t,r,e){"use strict";e.d(r,{lE:function(){return a},zo:function(){return l},xs:function(){return v},E1:function(){return p},p3:function(){return g},$P:function(){return y},$m:function(){return w},Dv:function(){return m},_t:function(){return u},Zq:function(){return s},A7:function(){return c},N:function(){return b},G1:function(){return f}});const n=new(e(1581).Yd)("bytes/5.5.0");function i(t){return!!t.toHexString}function o(t){return t.slice||(t.slice=function(){const r=Array.prototype.slice.call(arguments);return o(new Uint8Array(Array.prototype.slice.apply(t,r)))}),t}function s(t){return c(t)&&!(t.length%2)||u(t)}function h(t){return"number"===typeof t&&t==t&&t%1===0}function u(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"===typeof t)return!1;if(!h(t.length)||t.length<0)return!1;for(let r=0;r<t.length;r++){const e=t[r];if(!h(e)||e<0||e>=256)return!1}return!0}function a(t,r){if(r||(r={}),"number"===typeof t){n.checkSafeUint53(t,"invalid arrayify value");const r=[];for(;t;)r.unshift(255&t),t=parseInt(String(t/256));return 0===r.length&&r.push(0),o(new Uint8Array(r))}if(r.allowMissingPrefix&&"string"===typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),i(t)&&(t=t.toHexString()),c(t)){let e=t.substring(2);e.length%2&&("left"===r.hexPad?e="0x0"+e.substring(2):"right"===r.hexPad?e+="0":n.throwArgumentError("hex data is odd-length","value",t));const i=[];for(let t=0;t<e.length;t+=2)i.push(parseInt(e.substring(t,t+2),16));return o(new Uint8Array(i))}return u(t)?o(new Uint8Array(t)):n.throwArgumentError("invalid arrayify value","value",t)}function l(t){const r=t.map((t=>a(t))),e=r.reduce(((t,r)=>t+r.length),0),n=new Uint8Array(e);return r.reduce(((t,r)=>(n.set(r,t),t+r.length)),0),o(n)}function f(t){let r=a(t);if(0===r.length)return r;let e=0;for(;e<r.length&&0===r[e];)e++;return e&&(r=r.slice(e)),r}function c(t,r){return!("string"!==typeof t||!t.match(/^0x[0-9A-Fa-f]*$/))&&(!r||t.length===2+2*r)}const d="0123456789abcdef";function m(t,r){if(r||(r={}),"number"===typeof t){n.checkSafeUint53(t,"invalid hexlify value");let r="";for(;t;)r=d[15&t]+r,t=Math.floor(t/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if("bigint"===typeof t)return(t=t.toString(16)).length%2?"0x0"+t:"0x"+t;if(r.allowMissingPrefix&&"string"===typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),i(t))return t.toHexString();if(c(t))return t.length%2&&("left"===r.hexPad?t="0x0"+t.substring(2):"right"===r.hexPad?t+="0":n.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(u(t)){let r="0x";for(let e=0;e<t.length;e++){let n=t[e];r+=d[(240&n)>>4]+d[15&n]}return r}return n.throwArgumentError("invalid hexlify value","value",t)}function p(t){if("string"!==typeof t)t=m(t);else if(!c(t)||t.length%2)return null;return(t.length-2)/2}function g(t,r,e){return"string"!==typeof t?t=m(t):(!c(t)||t.length%2)&&n.throwArgumentError("invalid hexData","value",t),r=2+2*r,null!=e?"0x"+t.substring(r,2+2*e):"0x"+t.substring(r)}function v(t){let r="0x";return t.forEach((t=>{r+=m(t).substring(2)})),r}function y(t){const r=function(t){"string"!==typeof t&&(t=m(t));c(t)||n.throwArgumentError("invalid hex string","value",t);t=t.substring(2);let r=0;for(;r<t.length&&"0"===t[r];)r++;return"0x"+t.substring(r)}(m(t,{hexPad:"left"}));return"0x"===r?"0x0":r}function w(t,r){for("string"!==typeof t?t=m(t):c(t)||n.throwArgumentError("invalid hex string","value",t),t.length>2*r+2&&n.throwArgumentError("value out of range","value",arguments[1]);t.length<2*r+2;)t="0x0"+t.substring(2);return t}function b(t){const r={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0};if(s(t)){const e=a(t);65!==e.length&&n.throwArgumentError("invalid signature string; must be 65 bytes","signature",t),r.r=m(e.slice(0,32)),r.s=m(e.slice(32,64)),r.v=e[64],r.v<27&&(0===r.v||1===r.v?r.v+=27:n.throwArgumentError("signature invalid v byte","signature",t)),r.recoveryParam=1-r.v%2,r.recoveryParam&&(e[32]|=128),r._vs=m(e.slice(32,64))}else{if(r.r=t.r,r.s=t.s,r.v=t.v,r.recoveryParam=t.recoveryParam,r._vs=t._vs,null!=r._vs){const e=function(t,r){(t=a(t)).length>r&&n.throwArgumentError("value out of range","value",arguments[0]);const e=new Uint8Array(r);return e.set(t,r-t.length),o(e)}(a(r._vs),32);r._vs=m(e);const i=e[0]>=128?1:0;null==r.recoveryParam?r.recoveryParam=i:r.recoveryParam!==i&&n.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),e[0]&=127;const s=m(e);null==r.s?r.s=s:r.s!==s&&n.throwArgumentError("signature v mismatch _vs","signature",t)}if(null==r.recoveryParam)null==r.v?n.throwArgumentError("signature missing v and recoveryParam","signature",t):0===r.v||1===r.v?r.recoveryParam=r.v:r.recoveryParam=1-r.v%2;else if(null==r.v)r.v=27+r.recoveryParam;else{const e=0===r.v||1===r.v?r.v:1-r.v%2;r.recoveryParam!==e&&n.throwArgumentError("signature recoveryParam mismatch v","signature",t)}null!=r.r&&c(r.r)?r.r=w(r.r,32):n.throwArgumentError("signature missing or invalid r","signature",t),null!=r.s&&c(r.s)?r.s=w(r.s,32):n.throwArgumentError("signature missing or invalid s","signature",t);const e=a(r.s);e[0]>=128&&n.throwArgumentError("signature s out of range","signature",t),r.recoveryParam&&(e[0]|=128);const i=m(e);r._vs&&(c(r._vs)||n.throwArgumentError("signature invalid _vs","signature",t),r._vs=w(r._vs,32)),null==r._vs?r._vs=i:r._vs!==i&&n.throwArgumentError("signature _vs mismatch v and s","signature",t)}return r}},1046:function(t,r,e){"use strict";e.d(r,{tL:function(){return i},_Y:function(){return o},fh:function(){return s},Bz:function(){return h}});var n=e(6731);const i=n.O$.from(-1),o=n.O$.from(0),s=n.O$.from(1),h=n.O$.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")},2046:function(t,r,e){"use strict";e.d(r,{id:function(){return o}});var n=e(8197),i=e(9251);function o(t){return(0,n.w)((0,i.Y0)(t))}},8197:function(t,r,e){"use strict";e.d(r,{w:function(){return s}});var n=e(1094),i=e.n(n),o=e(6441);function s(t){return"0x"+i().keccak_256((0,o.lE)(t))}},1581:function(t,r,e){"use strict";e.d(r,{Yd:function(){return c}});let n=!1,i=!1;const o={debug:1,default:2,info:2,warning:3,error:4,off:5};let s=o.default,h=null;const u=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((r=>{try{if("test"!=="test".normalize(r))throw new Error("bad normalize")}catch(e){t.push(r)}})),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 a,l;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(a||(a={})),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"}(l||(l={}));const f="0123456789abcdef";class c{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,r){const e=t.toLowerCase();null==o[e]&&this.throwArgumentError("invalid log level name","logLevel",t),s>o[e]||console.log.apply(console,r)}debug(...t){this._log(c.levels.DEBUG,t)}info(...t){this._log(c.levels.INFO,t)}warn(...t){this._log(c.levels.WARNING,t)}makeError(t,r,e){if(i)return this.makeError("censored error",r,{});r||(r=c.errors.UNKNOWN_ERROR),e||(e={});const n=[];Object.keys(e).forEach((t=>{const r=e[t];try{if(r instanceof Uint8Array){let e="";for(let t=0;t<r.length;t++)e+=f[r[t]>>4],e+=f[15&r[t]];n.push(t+"=Uint8Array(0x"+e+")")}else n.push(t+"="+JSON.stringify(r))}catch(s){n.push(t+"="+JSON.stringify(e[t].toString()))}})),n.push(`code=${r}`),n.push(`version=${this.version}`);const o=t;n.length&&(t+=" ("+n.join(", ")+")");const s=new Error(t);return s.reason=o,s.code=r,Object.keys(e).forEach((function(t){s[t]=e[t]})),s}throwError(t,r,e){throw this.makeError(t,r,e)}throwArgumentError(t,r,e){return this.throwError(t,c.errors.INVALID_ARGUMENT,{argument:r,value:e})}assert(t,r,e,n){t||this.throwError(r,e,n)}assertArgument(t,r,e,n){t||this.throwArgumentError(r,e,n)}checkNormalize(t){null==t&&(t="platform missing String.prototype.normalize"),u&&this.throwError("platform missing String.prototype.normalize",c.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:u})}checkSafeUint53(t,r){"number"===typeof t&&(null==r&&(r="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(r,c.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(r,c.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,r,e){e=e?": "+e:"",t<r&&this.throwError("missing argument"+e,c.errors.MISSING_ARGUMENT,{count:t,expectedCount:r}),t>r&&this.throwError("too many arguments"+e,c.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:r})}checkNew(t,r){t!==Object&&null!=t||this.throwError("missing new",c.errors.MISSING_NEW,{name:r.name})}checkAbstract(t,r){t===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",c.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",c.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return h||(h=new c("logger/5.5.0")),h}static setCensorship(t,r){if(!t&&r&&this.globalLogger().throwError("cannot permanently disable censorship",c.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),n){if(!t)return;this.globalLogger().throwError("error censorship permanent",c.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}i=!!t,n=!!r}static setLogLevel(t){const r=o[t.toLowerCase()];null!=r?s=r:c.globalLogger().warn("invalid log level - "+t)}static from(t){return new c(t)}}c.errors=l,c.levels=a},6881:function(t,r,e){"use strict";e.d(r,{dk:function(){return p},uj:function(){return a},p$:function(){return m},zG:function(){return s},tu:function(){return h},mE:function(){return u},DC:function(){return l}});var n=e(1581);var i=function(t,r,e,n){return new(e||(e=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(r){o(r)}}function h(t){try{u(n.throw(t))}catch(r){o(r)}}function u(t){var r;t.done?i(t.value):(r=t.value,r instanceof e?r:new e((function(t){t(r)}))).then(s,h)}u((n=n.apply(t,r||[])).next())}))};const o=new n.Yd("properties/5.5.0");function s(t,r,e){Object.defineProperty(t,r,{enumerable:!0,value:e,writable:!1})}function h(t,r){for(let e=0;e<32;e++){if(t[r])return t[r];if(!t.prototype||"object"!==typeof t.prototype)break;t=Object.getPrototypeOf(t.prototype).constructor}return null}function u(t){return i(this,void 0,void 0,(function*(){const r=Object.keys(t).map((r=>{const e=t[r];return Promise.resolve(e).then((t=>({key:r,value:t})))}));return(yield Promise.all(r)).reduce(((t,r)=>(t[r.key]=r.value,t)),{})}))}function a(t,r){t&&"object"===typeof t||o.throwArgumentError("invalid object","object",t),Object.keys(t).forEach((e=>{r[e]||o.throwArgumentError("invalid object key - "+e,"transaction:"+e,t)}))}function l(t){const r={};for(const e in t)r[e]=t[e];return r}const f={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function c(t){if(void 0===t||null===t||f[typeof t])return!0;if(Array.isArray(t)||"object"===typeof t){if(!Object.isFrozen(t))return!1;const e=Object.keys(t);for(let n=0;n<e.length;n++){let i=null;try{i=t[e[n]]}catch(r){continue}if(!c(i))return!1}return!0}return o.throwArgumentError("Cannot deepCopy "+typeof t,"object",t)}function d(t){if(c(t))return t;if(Array.isArray(t))return Object.freeze(t.map((t=>m(t))));if("object"===typeof t){const r={};for(const e in t){const n=t[e];void 0!==n&&s(r,e,m(n))}return r}return o.throwArgumentError("Cannot deepCopy "+typeof t,"object",t)}function m(t){return d(t)}class p{constructor(t){for(const r in t)this[r]=m(t[r])}}},4216:function(t,r,e){"use strict";e.d(r,{i:function(){return n}});const n="providers/5.5.0"},8156:function(t,r,e){"use strict";e.d(r,{r:function(){return Zt}});var n=e(8088),i=e(6731),o=e(6441),s=e(9485),h=e(8197),u=e(6881),a=e(1581);const l="hash/5.5.0";var f=e(2046),c=function(t,r,e,n){return new(e||(e=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(r){o(r)}}function h(t){try{u(n.throw(t))}catch(r){o(r)}}function u(t){var r;t.done?i(t.value):(r=t.value,r instanceof e?r:new e((function(t){t(r)}))).then(s,h)}u((n=n.apply(t,r||[])).next())}))};const d=new a.Yd(l),m=new Uint8Array(32);m.fill(0);const p=i.O$.from(-1),g=i.O$.from(0),v=i.O$.from(1),y=i.O$.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const w=(0,o.$m)(v.toHexString(),32),b=(0,o.$m)(g.toHexString(),32),M={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},_=["name","version","chainId","verifyingContract","salt"];function E(t){return function(r){return"string"!==typeof r&&d.throwArgumentError(`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,r),r}}const A={name:E("name"),version:E("version"),chainId:function(t){try{return i.O$.from(t).toString()}catch(r){}return d.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",t)},verifyingContract:function(t){try{return(0,s.Kn)(t).toLowerCase()}catch(r){}return d.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){try{const r=(0,o.lE)(t);if(32!==r.length)throw new Error("bad length");return(0,o.Dv)(r)}catch(r){}return d.throwArgumentError('invalid domain value "salt"',"domain.salt",t)}};function k(t){{const r=t.match(/^(u?)int(\d*)$/);if(r){const e=""===r[1],n=parseInt(r[2]||"256");(n%8!==0||n>256||r[2]&&r[2]!==String(n))&&d.throwArgumentError("invalid numeric width","type",t);const s=y.mask(e?n-1:n),h=e?s.add(v).mul(p):g;return function(r){const e=i.O$.from(r);return(e.lt(h)||e.gt(s))&&d.throwArgumentError(`value out-of-bounds for ${t}`,"value",r),(0,o.$m)(e.toTwos(256).toHexString(),32)}}}{const r=t.match(/^bytes(\d+)$/);if(r){const e=parseInt(r[1]);return(0===e||e>32||r[1]!==String(e))&&d.throwArgumentError("invalid bytes width","type",t),function(r){return(0,o.lE)(r).length!==e&&d.throwArgumentError(`invalid length for ${t}`,"value",r),function(t){const r=(0,o.lE)(t),e=r.length%32;return e?(0,o.xs)([r,m.slice(e)]):(0,o.Dv)(r)}(r)}}}switch(t){case"address":return function(t){return(0,o.$m)((0,s.Kn)(t),32)};case"bool":return function(t){return t?w:b};case"bytes":return function(t){return(0,h.w)(t)};case"string":return function(t){return(0,f.id)(t)}}return null}function N(t,r){return`${t}(${r.map((({name:t,type:r})=>r+" "+t)).join(",")})`}class x{constructor(t){(0,u.zG)(this,"types",Object.freeze((0,u.p$)(t))),(0,u.zG)(this,"_encoderCache",{}),(0,u.zG)(this,"_types",{});const r={},e={},n={};Object.keys(t).forEach((t=>{r[t]={},e[t]=[],n[t]={}}));for(const o in t){const n={};t[o].forEach((i=>{n[i.name]&&d.throwArgumentError(`duplicate variable name ${JSON.stringify(i.name)} in ${JSON.stringify(o)}`,"types",t),n[i.name]=!0;const s=i.type.match(/^([^\x5b]*)(\x5b|$)/)[1];s===o&&d.throwArgumentError(`circular type reference to ${JSON.stringify(s)}`,"types",t);k(s)||(e[s]||d.throwArgumentError(`unknown type ${JSON.stringify(s)}`,"types",t),e[s].push(o),r[o][s]=!0)}))}const i=Object.keys(e).filter((t=>0===e[t].length));0===i.length?d.throwArgumentError("missing primary type","types",t):i.length>1&&d.throwArgumentError(`ambiguous primary types or unused types: ${i.map((t=>JSON.stringify(t))).join(", ")}`,"types",t),(0,u.zG)(this,"primaryType",i[0]),function i(o,s){s[o]&&d.throwArgumentError(`circular type reference to ${JSON.stringify(o)}`,"types",t),s[o]=!0,Object.keys(r[o]).forEach((t=>{e[t]&&(i(t,s),Object.keys(s).forEach((r=>{n[r][t]=!0})))})),delete s[o]}(this.primaryType,{});for(const o in n){const r=Object.keys(n[o]);r.sort(),this._types[o]=N(o,t[o])+r.map((r=>N(r,t[r]))).join("")}}getEncoder(t){let r=this._encoderCache[t];return r||(r=this._encoderCache[t]=this._getEncoder(t)),r}_getEncoder(t){{const r=k(t);if(r)return r}const r=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(r){const t=r[1],e=this.getEncoder(t),n=parseInt(r[3]);return r=>{n>=0&&r.length!==n&&d.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",r);let i=r.map(e);return this._types[t]&&(i=i.map(h.w)),(0,h.w)((0,o.xs)(i))}}const e=this.types[t];if(e){const r=(0,f.id)(this._types[t]);return t=>{const n=e.map((({name:r,type:e})=>{const n=this.getEncoder(e)(t[r]);return this._types[e]?(0,h.w)(n):n}));return n.unshift(r),(0,o.xs)(n)}}return d.throwArgumentError(`unknown type: ${t}`,"type",t)}encodeType(t){const r=this._types[t];return r||d.throwArgumentError(`unknown type: ${JSON.stringify(t)}`,"name",t),r}encodeData(t,r){return this.getEncoder(t)(r)}hashStruct(t,r){return(0,h.w)(this.encodeData(t,r))}encode(t){return this.encodeData(this.primaryType,t)}hash(t){return this.hashStruct(this.primaryType,t)}_visit(t,r,e){if(k(t))return e(t,r);const n=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(n){const t=n[1],i=parseInt(n[3]);return i>=0&&r.length!==i&&d.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",r),r.map((r=>this._visit(t,r,e)))}const i=this.types[t];return i?i.reduce(((t,{name:n,type:i})=>(t[n]=this._visit(i,r[n],e),t)),{}):d.throwArgumentError(`unknown type: ${t}`,"type",t)}visit(t,r){return this._visit(this.primaryType,t,r)}static from(t){return new x(t)}static getPrimaryType(t){return x.from(t).primaryType}static hashStruct(t,r,e){return x.from(r).hashStruct(t,e)}static hashDomain(t){const r=[];for(const e in t){const n=M[e];n||d.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(e)}`,"domain",t),r.push({name:e,type:n})}return r.sort(((t,r)=>_.indexOf(t.name)-_.indexOf(r.name))),x.hashStruct("EIP712Domain",{EIP712Domain:r},t)}static encode(t,r,e){return(0,o.xs)(["0x1901",x.hashDomain(t),x.from(r).hash(e)])}static hash(t,r,e){return(0,h.w)(x.encode(t,r,e))}static resolveNames(t,r,e,n){return c(this,void 0,void 0,(function*(){t=(0,u.DC)(t);const i={};t.verifyingContract&&!(0,o.A7)(t.verifyingContract,20)&&(i[t.verifyingContract]="0x");const s=x.from(r);s.visit(e,((t,r)=>("address"!==t||(0,o.A7)(r,20)||(i[r]="0x"),r)));for(const t in i)i[t]=yield n(t);return t.verifyingContract&&i[t.verifyingContract]&&(t.verifyingContract=i[t.verifyingContract]),e=s.visit(e,((t,r)=>"address"===t&&i[r]?i[r]:r)),{domain:t,value:e}}))}static getPayload(t,r,e){x.hashDomain(t);const n={},s=[];_.forEach((r=>{const e=t[r];null!=e&&(n[r]=A[r](e),s.push({name:r,type:M[r]}))}));const h=x.from(r),a=(0,u.DC)(r);return a.EIP712Domain?d.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",r):a.EIP712Domain=s,h.encode(e),{types:a,domain:n,primaryType:h.primaryType,message:h.visit(e,((t,r)=>{if(t.match(/^bytes(\d*)/))return(0,o.Dv)((0,o.lE)(r));if(t.match(/^u?int/))return i.O$.from(r).toString();switch(t){case"address":return r.toLowerCase();case"bool":return!!r;case"string":return"string"!==typeof r&&d.throwArgumentError("invalid string","value",r),r}return d.throwArgumentError("unsupported type","type",t)}))}}}var P=e(9251),I=e(639);function R(t){t=(0,o.lE)(t);let r="";for(let e=0;e<t.length;e++)r+=String.fromCharCode(t[e]);return btoa(r)}var S=function(t,r,e,n){return new(e||(e=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(r){o(r)}}function h(t){try{u(n.throw(t))}catch(r){o(r)}}function u(t){var r;t.done?i(t.value):(r=t.value,r instanceof e?r:new e((function(t){t(r)}))).then(s,h)}u((n=n.apply(t,r||[])).next())}))};function T(t,r){return S(this,void 0,void 0,(function*(){null==r&&(r={});const e={method:r.method||"GET",headers:r.headers||{},body:r.body||void 0};!0!==r.skipFetchSetup&&(e.mode="cors",e.cache="no-cache",e.credentials="same-origin",e.redirect="follow",e.referrer="client");const n=yield fetch(t,e),i=yield n.arrayBuffer(),s={};return n.headers.forEach?n.headers.forEach(((t,r)=>{s[r.toLowerCase()]=t})):n.headers.keys().forEach((t=>{s[t.toLowerCase()]=n.headers.get(t)})),{headers:s,statusCode:n.status,statusMessage:n.statusText,body:(0,o.lE)(new Uint8Array(i))}}))}var O=function(t,r,e,n){return new(e||(e=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(r){o(r)}}function h(t){try{u(n.throw(t))}catch(r){o(r)}}function u(t){var r;t.done?i(t.value):(r=t.value,r instanceof e?r:new e((function(t){t(r)}))).then(s,h)}u((n=n.apply(t,r||[])).next())}))};const B=new a.Yd("web/5.5.0");function C(t){return new Promise((r=>{setTimeout(r,t)}))}function F(t,r){if(null==t)return null;if("string"===typeof t)return t;if((0,o.Zq)(t)){if(r&&("text"===r.split("/")[0]||"application/json"===r.split(";")[0].trim()))try{return(0,P.ZN)(t)}catch(e){}return(0,o.Dv)(t)}return t}function L(t,r,e){let n=null;if(null!=r){n=(0,P.Y0)(r);const e="string"===typeof t?{url:t}:(0,u.DC)(t);if(e.headers){0!==Object.keys(e.headers).filter((t=>"content-type"===t.toLowerCase())).length||(e.headers=(0,u.DC)(e.headers),e.headers["content-type"]="application/json")}else e.headers={"content-type":"application/json"};t=e}return function(t,r,e){const n="object"===typeof t&&null!=t.throttleLimit?t.throttleLimit:12;B.assertArgument(n>0&&n%1===0,"invalid connection throttle limit","connection.throttleLimit",n);const i="object"===typeof t?t.throttleCallback:null,o="object"===typeof t&&"number"===typeof t.throttleSlotInterval?t.throttleSlotInterval:100;B.assertArgument(o>0&&o%1===0,"invalid connection throttle slot interval","connection.throttleSlotInterval",o);const s={};let h=null;const u={method:"GET"};let l=!1,f=12e4;if("string"===typeof t)h=t;else if("object"===typeof t){if(null!=t&&null!=t.url||B.throwArgumentError("missing URL","connection.url",t),h=t.url,"number"===typeof t.timeout&&t.timeout>0&&(f=t.timeout),t.headers)for(const r in t.headers)s[r.toLowerCase()]={key:r,value:String(t.headers[r])},["if-none-match","if-modified-since"].indexOf(r.toLowerCase())>=0&&(l=!0);if(u.allowGzip=!!t.allowGzip,null!=t.user&&null!=t.password){"https:"!==h.substring(0,6)&&!0!==t.allowInsecureAuthentication&&B.throwError("basic authentication requires a secure https url",a.Yd.errors.INVALID_ARGUMENT,{argument:"url",url:h,user:t.user,password:"[REDACTED]"});const r=t.user+":"+t.password;s.authorization={key:"Authorization",value:"Basic "+R((0,P.Y0)(r))}}}r&&(u.method="POST",u.body=r,null==s["content-type"]&&(s["content-type"]={key:"Content-Type",value:"application/octet-stream"}),null==s["content-length"]&&(s["content-length"]={key:"Content-Length",value:String(r.length)}));const c={};Object.keys(s).forEach((t=>{const r=s[t];c[r.key]=r.value})),u.headers=c;const d=function(){let t=null;return{promise:new Promise((function(r,e){f&&(t=setTimeout((()=>{null!=t&&(t=null,e(B.makeError("timeout",a.Yd.errors.TIMEOUT,{requestBody:F(u.body,c["content-type"]),requestMethod:u.method,timeout:f,url:h})))}),f))})),cancel:function(){null!=t&&(clearTimeout(t),t=null)}}}(),m=function(){return O(this,void 0,void 0,(function*(){for(let r=0;r<n;r++){let s=null;try{if(s=yield T(h,u),429===s.statusCode&&r<n){let t=!0;if(i&&(t=yield i(r,h)),t){let t=0;const e=s.headers["retry-after"];t="string"===typeof e&&e.match(/^[1-9][0-9]*$/)?1e3*parseInt(e):o*parseInt(String(Math.random()*Math.pow(2,r))),yield C(t);continue}}}catch(t){s=t.response,null==s&&(d.cancel(),B.throwError("missing response",a.Yd.errors.SERVER_ERROR,{requestBody:F(u.body,c["content-type"]),requestMethod:u.method,serverError:t,url:h}))}let f=s.body;if(l&&304===s.statusCode?f=null:(s.statusCode<200||s.statusCode>=300)&&(d.cancel(),B.throwError("bad response",a.Yd.errors.SERVER_ERROR,{status:s.statusCode,headers:s.headers,body:F(f,s.headers?s.headers["content-type"]:null),requestBody:F(u.body,c["content-type"]),requestMethod:u.method,url:h})),e)try{const t=yield e(f,s);return d.cancel(),t}catch(t){if(t.throttleRetry&&r<n){let t=!0;if(i&&(t=yield i(r,h)),t){const t=o*parseInt(String(Math.random()*Math.pow(2,r)));yield C(t);continue}}d.cancel(),B.throwError("processing response error",a.Yd.errors.SERVER_ERROR,{body:F(f,s.headers?s.headers["content-type"]:null),error:t,requestBody:F(u.body,c["content-type"]),requestMethod:u.method,url:h})}return d.cancel(),f}return B.throwError("failed response",a.Yd.errors.SERVER_ERROR,{requestBody:F(u.body,c["content-type"]),requestMethod:u.method,url:h})}))}();return Promise.race([d.promise,m])}(t,n,((t,r)=>{let n=null;if(null!=t)try{n=JSON.parse((0,P.ZN)(t))}catch(i){B.throwError("invalid JSON",a.Yd.errors.SERVER_ERROR,{body:t,error:i})}return e&&(n=e(n,r)),n}))}function D(t,r){return r||(r={}),null==(r=(0,u.DC)(r)).floor&&(r.floor=0),null==r.ceiling&&(r.ceiling=1e4),null==r.interval&&(r.interval=250),new Promise((function(e,n){let i=null,o=!1;const s=()=>!o&&(o=!0,i&&clearTimeout(i),!0);r.timeout&&(i=setTimeout((()=>{s()&&n(new Error("timeout"))}),r.timeout));const h=r.retryLimit;let u=0;!function i(){return t().then((function(t){if(void 0!==t)s()&&e(t);else if(r.oncePoll)r.oncePoll.once("poll",i);else if(r.onceBlock)r.onceBlock.once("block",i);else if(!o){if(u++,u>h)return void(s()&&n(new Error("retry limit reached")));let t=r.interval*parseInt(String(Math.random()*Math.pow(2,u)));t<r.floor&&(t=r.floor),t>r.ceiling&&(t=r.ceiling),setTimeout(i,t)}return null}),(function(t){s()&&n(t)}))}()}))}var U=e(4216),z=e(1556);class q{constructor(t){(0,u.zG)(this,"alphabet",t),(0,u.zG)(this,"base",t.length),(0,u.zG)(this,"_alphabetMap",{}),(0,u.zG)(this,"_leader",t.charAt(0));for(let r=0;r<t.length;r++)this._alphabetMap[t.charAt(r)]=r}encode(t){let r=(0,o.lE)(t);if(0===r.length)return"";let e=[0];for(let i=0;i<r.length;++i){let t=r[i];for(let r=0;r<e.length;++r)t+=e[r]<<8,e[r]=t%this.base,t=t/this.base|0;for(;t>0;)e.push(t%this.base),t=t/this.base|0}let n="";for(let i=0;0===r[i]&&i<r.length-1;++i)n+=this._leader;for(let i=e.length-1;i>=0;--i)n+=this.alphabet[e[i]];return n}decode(t){if("string"!==typeof t)throw new TypeError("Expected String");let r=[];if(0===t.length)return new Uint8Array(r);r.push(0);for(let e=0;e<t.length;e++){let n=this._alphabetMap[t[e]];if(void 0===n)throw new Error("Non-base"+this.base+" character");let i=n;for(let t=0;t<r.length;++t)i+=r[t]*this.base,r[t]=255&i,i>>=8;for(;i>0;)r.push(255&i),i>>=8}for(let e=0;t[e]===this._leader&&e<t.length-1;++e)r.push(0);return(0,o.lE)(new Uint8Array(r.reverse()))}}new q("abcdefghijklmnopqrstuvwxyz234567");const G=new q("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");function j(t,r){r||(r=function(t){return[parseInt(t,16)]});let e=0,n={};return t.split(",").forEach((t=>{let i=t.split(":");e+=parseInt(i[0],16),n[e]=r(i[1])})),n}function $(t){let r=0;return t.split(",").map((t=>{let e=t.split("-");1===e.length?e[1]="0":""===e[1]&&(e[1]="1");let n=r+parseInt(e[0],16);return r=parseInt(e[1],16),{l:n,h:r}}))}function Y(t,r){let e=0;for(let n=0;n<r.length;n++){let i=r[n];if(e+=i.l,t>=e&&t<=e+i.h&&(t-e)%(i.d||1)===0){if(i.e&&-1!==i.e.indexOf(t-e))continue;return i}}return null}const H=$("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),V="ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map((t=>parseInt(t,16))),Z=[{h:25,s:32,l:65},{h:30,s:32,e:[23],l:127},{h:54,s:1,e:[48],l:64,d:2},{h:14,s:1,l:57,d:2},{h:44,s:1,l:17,d:2},{h:10,s:1,e:[2,6,8],l:61,d:2},{h:16,s:1,l:68,d:2},{h:84,s:1,e:[18,24,66],l:19,d:2},{h:26,s:32,e:[17],l:435},{h:22,s:1,l:71,d:2},{h:15,s:80,l:40},{h:31,s:32,l:16},{h:32,s:1,l:80,d:2},{h:52,s:1,l:42,d:2},{h:12,s:1,l:55,d:2},{h:40,s:1,e:[38],l:15,d:2},{h:14,s:1,l:48,d:2},{h:37,s:48,l:49},{h:148,s:1,l:6351,d:2},{h:88,s:1,l:160,d:2},{h:15,s:16,l:704},{h:25,s:26,l:854},{h:25,s:32,l:55915},{h:37,s:40,l:1247},{h:25,s:-119711,l:53248},{h:25,s:-119763,l:52},{h:25,s:-119815,l:52},{h:25,s:-119867,e:[1,4,5,7,8,11,12,17],l:52},{h:25,s:-119919,l:52},{h:24,s:-119971,e:[2,7,8,17],l:52},{h:24,s:-120023,e:[2,7,13,15,16,17],l:52},{h:25,s:-120075,l:52},{h:25,s:-120127,l:52},{h:25,s:-120179,l:52},{h:25,s:-120231,l:52},{h:25,s:-120283,l:52},{h:25,s:-120335,l:52},{h:24,s:-119543,e:[17],l:56},{h:24,s:-119601,e:[17],l:58},{h:24,s:-119659,e:[17],l:58},{h:24,s:-119717,e:[17],l:58},{h:24,s:-119775,e:[17],l:58}],K=j("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),J=j("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),W=j("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",(function(t){if(t.length%4!==0)throw new Error("bad data");let r=[];for(let e=0;e<t.length;e+=4)r.push(parseInt(t.substring(e,e+4),16));return r})),X=$("80-20,2a0-,39c,32,f71,18e,7f2-f,19-7,30-4,7-5,f81-b,5,a800-20ff,4d1-1f,110,fa-6,d174-7,2e84-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,2,1f-5f,ff7f-20001");function Q(t){if(t.match(/^[a-z0-9-]*$/i)&&t.length<=59)return t.toLowerCase();let r=(0,P.XL)(t);var e;e=r.map((t=>{if(V.indexOf(t)>=0)return[];if(t>=65024&&t<=65039)return[];let r=function(t){let r=Y(t,Z);if(r)return[t+r.s];let e=K[t];if(e)return e;let n=J[t];return n?[t+n[0]]:W[t]||null}(t);return r||[t]})),r=e.reduce(((t,r)=>(r.forEach((r=>{t.push(r)})),t)),[]),r=(0,P.XL)((0,P.uu)(r),P.Uj.NFKC),r.forEach((t=>{if(Y(t,X))throw new Error("STRINGPREP_CONTAINS_PROHIBITED")})),r.forEach((t=>{if(Y(t,H))throw new Error("STRINGPREP_CONTAINS_UNASSIGNED")}));let n=(0,P.uu)(r);if("-"===n.substring(0,1)||"--"===n.substring(2,4)||"-"===n.substring(n.length-1))throw new Error("invalid hyphen");if(n.length>63)throw new Error("too long");return n}const tt=new a.Yd(l),rt=new Uint8Array(32);rt.fill(0);const et=new RegExp("^((.*)\\.)?([^.]+)$");function nt(t){"string"!==typeof t&&tt.throwArgumentError("invalid ENS name; not a string","name",t);let r=t,e=rt;for(;r.length;){const n=r.match(et);null!=n&&""!==n[2]||tt.throwArgumentError("invalid ENS address; missing component","name",t);const i=(0,P.Y0)(Q(n[3]));e=(0,h.w)((0,o.zo)([e,(0,h.w)(i)])),r=n[2]||""}return(0,o.Dv)(e)}const it=new a.Yd("networks/5.5.0");function ot(t){const r=function(r,e){null==e&&(e={});const n=[];if(r.InfuraProvider)try{n.push(new r.InfuraProvider(t,e.infura))}catch(i){}if(r.EtherscanProvider)try{n.push(new r.EtherscanProvider(t,e.etherscan))}catch(i){}if(r.AlchemyProvider)try{n.push(new r.AlchemyProvider(t,e.alchemy))}catch(i){}if(r.PocketProvider){const e=["goerli","ropsten","rinkeby"];try{const i=new r.PocketProvider(t);i.network&&-1===e.indexOf(i.network.name)&&n.push(i)}catch(i){}}if(r.CloudflareProvider)try{n.push(new r.CloudflareProvider(t))}catch(i){}if(0===n.length)return null;if(r.FallbackProvider){let i=1;return null!=e.quorum?i=e.quorum:"homestead"===t&&(i=2),new r.FallbackProvider(n,i)}return n[0]};return r.renetwork=function(t){return ot(t)},r}function st(t,r){const e=function(e,n){return e.JsonRpcProvider?new e.JsonRpcProvider(t,r):null};return e.renetwork=function(r){return st(t,r)},e}const ht={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:ot("homestead")},ut={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:ot("ropsten")},at={chainId:63,name:"classicMordor",_defaultProvider:st("https://www.ethercluster.com/mordor","classicMordor")},lt={unspecified:{chainId:0,name:"unspecified"},homestead:ht,mainnet:ht,morden:{chainId:2,name:"morden"},ropsten:ut,testnet:ut,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:ot("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:ot("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:ot("goerli")},classic:{chainId:61,name:"classic",_defaultProvider:st("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor:at,classicTestnet:at,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:st("https://www.ethercluster.com/kotti","classicKotti")},xdai:{chainId:100,name:"xdai"},matic:{chainId:137,name:"matic"},maticmum:{chainId:80001,name:"maticmum"},bnb:{chainId:56,name:"bnb"},bnbt:{chainId:97,name:"bnbt"}};var ft=e(3715),ct=e.n(ft);new a.Yd("sha2/5.5.0");function dt(t){return"0x"+ct().sha256().update((0,o.lE)(t)).digest("hex")}var mt=e(2882),pt=e.n(mt);const gt=new a.Yd(U.i);class vt{constructor(){gt.checkNew(new.target,vt),this.formats=this.getDefaultFormats()}getDefaultFormats(){const t={},r=this.address.bind(this),e=this.bigNumber.bind(this),n=this.blockTag.bind(this),i=this.data.bind(this),o=this.hash.bind(this),s=this.hex.bind(this),h=this.number.bind(this),a=this.type.bind(this);return t.transaction={hash:o,type:a,accessList:vt.allowNull(this.accessList.bind(this),null),blockHash:vt.allowNull(o,null),blockNumber:vt.allowNull(h,null),transactionIndex:vt.allowNull(h,null),confirmations:vt.allowNull(h,null),from:r,gasPrice:vt.allowNull(e),maxPriorityFeePerGas:vt.allowNull(e),maxFeePerGas:vt.allowNull(e),gasLimit:e,to:vt.allowNull(r,null),value:e,nonce:h,data:i,r:vt.allowNull(this.uint256),s:vt.allowNull(this.uint256),v:vt.allowNull(h),creates:vt.allowNull(r,null),raw:vt.allowNull(i)},t.transactionRequest={from:vt.allowNull(r),nonce:vt.allowNull(h),gasLimit:vt.allowNull(e),gasPrice:vt.allowNull(e),maxPriorityFeePerGas:vt.allowNull(e),maxFeePerGas:vt.allowNull(e),to:vt.allowNull(r),value:vt.allowNull(e),data:vt.allowNull((t=>this.data(t,!0))),type:vt.allowNull(h),accessList:vt.allowNull(this.accessList.bind(this),null)},t.receiptLog={transactionIndex:h,blockNumber:h,transactionHash:o,address:r,topics:vt.arrayOf(o),data:i,logIndex:h,blockHash:o},t.receipt={to:vt.allowNull(this.address,null),from:vt.allowNull(this.address,null),contractAddress:vt.allowNull(r,null),transactionIndex:h,root:vt.allowNull(s),gasUsed:e,logsBloom:vt.allowNull(i),blockHash:o,transactionHash:o,logs:vt.arrayOf(this.receiptLog.bind(this)),blockNumber:h,confirmations:vt.allowNull(h,null),cumulativeGasUsed:e,effectiveGasPrice:vt.allowNull(e),status:vt.allowNull(h),type:a},t.block={hash:o,parentHash:o,number:h,timestamp:h,nonce:vt.allowNull(s),difficulty:this.difficulty.bind(this),gasLimit:e,gasUsed:e,miner:r,extraData:i,transactions:vt.allowNull(vt.arrayOf(o)),baseFeePerGas:vt.allowNull(e)},t.blockWithTransactions=(0,u.DC)(t.block),t.blockWithTransactions.transactions=vt.allowNull(vt.arrayOf(this.transactionResponse.bind(this))),t.filter={fromBlock:vt.allowNull(n,void 0),toBlock:vt.allowNull(n,void 0),blockHash:vt.allowNull(o,void 0),address:vt.allowNull(r,void 0),topics:vt.allowNull(this.topics.bind(this),void 0)},t.filterLog={blockNumber:vt.allowNull(h),blockHash:vt.allowNull(o),transactionIndex:h,removed:vt.allowNull(this.boolean.bind(this)),address:r,data:vt.allowFalsish(i,"0x"),topics:vt.arrayOf(o),transactionHash:o,logIndex:h},t}accessList(t){return(0,I.z7)(t||[])}number(t){return"0x"===t?0:i.O$.from(t).toNumber()}type(t){return"0x"===t||null==t?0:i.O$.from(t).toNumber()}bigNumber(t){return i.O$.from(t)}boolean(t){if("boolean"===typeof t)return t;if("string"===typeof t){if("true"===(t=t.toLowerCase()))return!0;if("false"===t)return!1}throw new Error("invalid boolean - "+t)}hex(t,r){return"string"===typeof t&&(r||"0x"===t.substring(0,2)||(t="0x"+t),(0,o.A7)(t))?t.toLowerCase():gt.throwArgumentError("invalid hash","value",t)}data(t,r){const e=this.hex(t,r);if(e.length%2!==0)throw new Error("invalid data; odd-length - "+t);return e}address(t){return(0,s.Kn)(t)}callAddress(t){if(!(0,o.A7)(t,32))return null;const r=(0,s.Kn)((0,o.p3)(t,12));return"0x0000000000000000000000000000000000000000"===r?null:r}contractAddress(t){return(0,s.CR)(t)}blockTag(t){if(null==t)return"latest";if("earliest"===t)return"0x0";if("latest"===t||"pending"===t)return t;if("number"===typeof t||(0,o.A7)(t))return(0,o.$P)(t);throw new Error("invalid blockTag")}hash(t,r){const e=this.hex(t,r);return 32!==(0,o.E1)(e)?gt.throwArgumentError("invalid hash","value",t):e}difficulty(t){if(null==t)return null;const r=i.O$.from(t);try{return r.toNumber()}catch(e){}return null}uint256(t){if(!(0,o.A7)(t))throw new Error("invalid uint256");return(0,o.$m)(t,32)}_block(t,r){null!=t.author&&null==t.miner&&(t.miner=t.author);const e=null!=t._difficulty?t._difficulty:t.difficulty,n=vt.check(r,t);return n._difficulty=null==e?null:i.O$.from(e),n}block(t){return this._block(t,this.formats.block)}blockWithTransactions(t){return this._block(t,this.formats.blockWithTransactions)}transactionRequest(t){return vt.check(this.formats.transactionRequest,t)}transactionResponse(t){null!=t.gas&&null==t.gasLimit&&(t.gasLimit=t.gas),t.to&&i.O$.from(t.to).isZero()&&(t.to="0x0000000000000000000000000000000000000000"),null!=t.input&&null==t.data&&(t.data=t.input),null==t.to&&null==t.creates&&(t.creates=this.contractAddress(t)),1!==t.type&&2!==t.type||null!=t.accessList||(t.accessList=[]);const r=vt.check(this.formats.transaction,t);if(null!=t.chainId){let e=t.chainId;(0,o.A7)(e)&&(e=i.O$.from(e).toNumber()),r.chainId=e}else{let e=t.networkId;null==e&&null==r.v&&(e=t.chainId),(0,o.A7)(e)&&(e=i.O$.from(e).toNumber()),"number"!==typeof e&&null!=r.v&&(e=(r.v-35)/2,e<0&&(e=0),e=parseInt(e)),"number"!==typeof e&&(e=0),r.chainId=e}return r.blockHash&&"x"===r.blockHash.replace(/0/g,"")&&(r.blockHash=null),r}transaction(t){return(0,I.Qc)(t)}receiptLog(t){return vt.check(this.formats.receiptLog,t)}receipt(t){const r=vt.check(this.formats.receipt,t);if(null!=r.root)if(r.root.length<=4){const t=i.O$.from(r.root).toNumber();0===t||1===t?(null!=r.status&&r.status!==t&&gt.throwArgumentError("alt-root-status/status mismatch","value",{root:r.root,status:r.status}),r.status=t,delete r.root):gt.throwArgumentError("invalid alt-root-status","value.root",r.root)}else 66!==r.root.length&&gt.throwArgumentError("invalid root hash","value.root",r.root);return null!=r.status&&(r.byzantium=!0),r}topics(t){return Array.isArray(t)?t.map((t=>this.topics(t))):null!=t?this.hash(t,!0):null}filter(t){return vt.check(this.formats.filter,t)}filterLog(t){return vt.check(this.formats.filterLog,t)}static check(t,r){const e={};for(const i in t)try{const n=t[i](r[i]);void 0!==n&&(e[i]=n)}catch(n){throw n.checkKey=i,n.checkValue=r[i],n}return e}static allowNull(t,r){return function(e){return null==e?r:t(e)}}static allowFalsish(t,r){return function(e){return e?t(e):r}}static arrayOf(t){return function(r){if(!Array.isArray(r))throw new Error("not an array");const e=[];return r.forEach((function(r){e.push(t(r))})),e}}}var yt=function(t,r,e,n){return new(e||(e=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(r){o(r)}}function h(t){try{u(n.throw(t))}catch(r){o(r)}}function u(t){var r;t.done?i(t.value):(r=t.value,r instanceof e?r:new e((function(t){t(r)}))).then(s,h)}u((n=n.apply(t,r||[])).next())}))};const wt=new a.Yd(U.i);function bt(t){return null==t?"null":(32!==(0,o.E1)(t)&&wt.throwArgumentError("invalid topic","topic",t),t.toLowerCase())}function Mt(t){for(t=t.slice();t.length>0&&null==t[t.length-1];)t.pop();return t.map((t=>{if(Array.isArray(t)){const r={};t.forEach((t=>{r[bt(t)]=!0}));const e=Object.keys(r);return e.sort(),e.join("|")}return bt(t)})).join("&")}function _t(t){if("string"===typeof t){if(t=t.toLowerCase(),32===(0,o.E1)(t))return"tx:"+t;if(-1===t.indexOf(":"))return t}else{if(Array.isArray(t))return"filter:*:"+Mt(t);if(z.Sg.isForkEvent(t))throw wt.warn("not implemented"),new Error("not implemented");if(t&&"object"===typeof t)return"filter:"+(t.address||"*")+":"+Mt(t.topics||[])}throw new Error("invalid event - "+t)}function Et(){return(new Date).getTime()}function At(t){return new Promise((r=>{setTimeout(r,t)}))}const kt=["block","network","pending","poll"];class Nt{constructor(t,r,e){(0,u.zG)(this,"tag",t),(0,u.zG)(this,"listener",r),(0,u.zG)(this,"once",e)}get event(){switch(this.type){case"tx":return this.hash;case"filter":return this.filter}return this.tag}get type(){return this.tag.split(":")[0]}get hash(){const t=this.tag.split(":");return"tx"!==t[0]?null:t[1]}get filter(){const t=this.tag.split(":");if("filter"!==t[0])return null;const r=t[1],e=""===(n=t[2])?[]:n.split(/&/g).map((t=>{if(""===t)return[];const r=t.split("|").map((t=>"null"===t?null:t));return 1===r.length?r[0]:r}));var n;const i={};return e.length>0&&(i.topics=e),r&&"*"!==r&&(i.address=r),i}pollable(){return this.tag.indexOf(":")>=0||kt.indexOf(this.tag)>=0}}const xt={0:{symbol:"btc",p2pkh:0,p2sh:5,prefix:"bc"},2:{symbol:"ltc",p2pkh:48,p2sh:50,prefix:"ltc"},3:{symbol:"doge",p2pkh:30,p2sh:22},60:{symbol:"eth",ilk:"eth"},61:{symbol:"etc",ilk:"eth"},700:{symbol:"xdai",ilk:"eth"}};function Pt(t){return(0,o.$m)(i.O$.from(t).toHexString(),32)}function It(t){return G.encode((0,o.zo)([t,(0,o.p3)(dt(dt(t)),0,4)]))}const Rt=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),new RegExp("^(ipfs)://(.*)$","i"),new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function St(t){try{return(0,P.ZN)(Tt(t))}catch(r){}return null}function Tt(t){if("0x"===t)return null;const r=i.O$.from((0,o.p3)(t,0,32)).toNumber(),e=i.O$.from((0,o.p3)(t,r,r+32)).toNumber();return(0,o.p3)(t,r+32,r+32+e)}class Ot{constructor(t,r,e,n){(0,u.zG)(this,"provider",t),(0,u.zG)(this,"name",e),(0,u.zG)(this,"address",t.formatter.address(r)),(0,u.zG)(this,"_resolvedAddress",n)}_fetchBytes(t,r){return yt(this,void 0,void 0,(function*(){const e={to:this.address,data:(0,o.xs)([t,nt(this.name),r||"0x"])};try{return Tt(yield this.provider.call(e))}catch(n){return n.code,a.Yd.errors.CALL_EXCEPTION,null}}))}_getAddress(t,r){const e=xt[String(t)];if(null==e&&wt.throwError(`unsupported coin type: ${t}`,a.Yd.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${t})`}),"eth"===e.ilk)return this.provider.formatter.address(r);const n=(0,o.lE)(r);if(null!=e.p2pkh){const t=r.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/);if(t){const r=parseInt(t[1],16);if(t[2].length===2*r&&r>=1&&r<=75)return It((0,o.zo)([[e.p2pkh],"0x"+t[2]]))}}if(null!=e.p2sh){const t=r.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);if(t){const r=parseInt(t[1],16);if(t[2].length===2*r&&r>=1&&r<=75)return It((0,o.zo)([[e.p2sh],"0x"+t[2]]))}}if(null!=e.prefix){const t=n[1];let r=n[0];if(0===r?20!==t&&32!==t&&(r=-1):r=-1,r>=0&&n.length===2+t&&t>=1&&t<=75){const t=pt().toWords(n.slice(2));return t.unshift(r),pt().encode(e.prefix,t)}}return null}getAddress(t){return yt(this,void 0,void 0,(function*(){if(null==t&&(t=60),60===t)try{const t={to:this.address,data:"0x3b3b57de"+nt(this.name).substring(2)},r=yield this.provider.call(t);return"0x"===r||"0x0000000000000000000000000000000000000000000000000000000000000000"===r?null:this.provider.formatter.callAddress(r)}catch(n){if(n.code===a.Yd.errors.CALL_EXCEPTION)return null;throw n}const r=yield this._fetchBytes("0xf1cb7e06",Pt(t));if(null==r||"0x"===r)return null;const e=this._getAddress(t,r);return null==e&&wt.throwError("invalid or unsupported coin data",a.Yd.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${t})`,coinType:t,data:r}),e}))}getAvatar(){return yt(this,void 0,void 0,(function*(){const t=[];try{const r=yield this.getText("avatar");if(null==r)return null;for(let e=0;e<Rt.length;e++){const n=r.match(Rt[e]);if(null!=n)switch(n[1]){case"https":return t.push({type:"url",content:r}),{linkage:t,url:r};case"data":return t.push({type:"data",content:r}),{linkage:t,url:r};case"ipfs":return t.push({type:"ipfs",content:r}),{linkage:t,url:`https://gateway.ipfs.io/ipfs/${r.substring(7)}`};case"erc721":case"erc1155":{const e="erc721"===n[1]?"0xc87b56dd":"0x0e89341c";t.push({type:n[1],content:r});const s=this._resolvedAddress||(yield this.getAddress()),h=(n[2]||"").split("/");if(2!==h.length)return null;const u=yield this.provider.formatter.address(h[0]),a=(0,o.$m)(i.O$.from(h[1]).toHexString(),32);if("erc721"===n[1]){const r=this.provider.formatter.callAddress(yield this.provider.call({to:u,data:(0,o.xs)(["0x6352211e",a])}));if(s!==r)return null;t.push({type:"owner",content:r})}else if("erc1155"===n[1]){const r=i.O$.from(yield this.provider.call({to:u,data:(0,o.xs)(["0x00fdd58e",(0,o.$m)(s,32),a])}));if(r.isZero())return null;t.push({type:"balance",content:r.toString()})}const l={to:this.provider.formatter.address(h[0]),data:(0,o.xs)([e,a])};let f=St(yield this.provider.call(l));if(null==f)return null;t.push({type:"metadata-url",content:f}),"erc1155"===n[1]&&(f=f.replace("{id}",a.substring(2)));const c=yield L(f);return c&&"string"===typeof c.image&&c.image.match(/^https:\/\//i)?(t.push({type:"metadata",content:JSON.stringify(c)}),t.push({type:"url",content:c.image}),{linkage:t,url:c.image}):null}}}}catch(r){}return null}))}getContentHash(){return yt(this,void 0,void 0,(function*(){const t=yield this._fetchBytes("0xbc1c58d1");if(null==t||"0x"===t)return null;const r=t.match(/^0xe3010170(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(r){const t=parseInt(r[3],16);if(r[4].length===2*t)return"ipfs://"+G.encode("0x"+r[1])}const e=t.match(/^0xe40101fa011b20([0-9a-f]*)$/);return e&&64===e[1].length?"bzz://"+e[1]:wt.throwError("invalid or unsupported content hash data",a.Yd.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:t})}))}getText(t){return yt(this,void 0,void 0,(function*(){let r=(0,P.Y0)(t);r=(0,o.zo)([Pt(64),Pt(r.length),r]),r.length%32!==0&&(r=(0,o.zo)([r,(0,o.$m)("0x",32-t.length%32)]));const e=yield this._fetchBytes("0x59d1d43c",(0,o.Dv)(r));return null==e||"0x"===e?null:(0,P.ZN)(e)}))}}let Bt=null,Ct=1;class Ft extends z.zt{constructor(t){if(wt.checkNew(new.target,z.zt),super(),this._events=[],this._emitted={block:-2},this.formatter=new.target.getFormatter(),(0,u.zG)(this,"anyNetwork","any"===t),this.anyNetwork&&(t=this.detectNetwork()),t instanceof Promise)this._networkPromise=t,t.catch((t=>{})),this._ready().catch((t=>{}));else{const r=(0,u.tu)(new.target,"getNetwork")(t);r?((0,u.zG)(this,"_network",r),this.emit("network",r,null)):wt.throwArgumentError("invalid network","network",t)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return yt(this,void 0,void 0,(function*(){if(null==this._network){let r=null;if(this._networkPromise)try{r=yield this._networkPromise}catch(t){}null==r&&(r=yield this.detectNetwork()),r||wt.throwError("no network detected",a.Yd.errors.UNKNOWN_ERROR,{}),null==this._network&&(this.anyNetwork?this._network=r:(0,u.zG)(this,"_network",r),this.emit("network",r,null))}return this._network}))}get ready(){return D((()=>this._ready().then((t=>t),(t=>{if(t.code!==a.Yd.errors.NETWORK_ERROR||"noNetwork"!==t.event)throw t}))))}static getFormatter(){return null==Bt&&(Bt=new vt),Bt}static getNetwork(t){return function(t){if(null==t)return null;if("number"===typeof t){for(const r in lt){const e=lt[r];if(e.chainId===t)return{name:e.name,chainId:e.chainId,ensAddress:e.ensAddress||null,_defaultProvider:e._defaultProvider||null}}return{chainId:t,name:"unknown"}}if("string"===typeof t){const r=lt[t];return null==r?null:{name:r.name,chainId:r.chainId,ensAddress:r.ensAddress,_defaultProvider:r._defaultProvider||null}}const r=lt[t.name];if(!r)return"number"!==typeof t.chainId&&it.throwArgumentError("invalid network chainId","network",t),t;0!==t.chainId&&t.chainId!==r.chainId&&it.throwArgumentError("network chainId mismatch","network",t);let e=t._defaultProvider||null;var n;return null==e&&r._defaultProvider&&(e=(n=r._defaultProvider)&&"function"===typeof n.renetwork?r._defaultProvider.renetwork(t):r._defaultProvider),{name:t.name,chainId:r.chainId,ensAddress:t.ensAddress||r.ensAddress||null,_defaultProvider:e}}(null==t?"homestead":t)}_getInternalBlockNumber(t){return yt(this,void 0,void 0,(function*(){if(yield this._ready(),t>0)for(;this._internalBlockNumber;){const r=this._internalBlockNumber;try{const e=yield r;if(Et()-e.respTime<=t)return e.blockNumber;break}catch(n){if(this._internalBlockNumber===r)break}}const r=Et(),e=(0,u.mE)({blockNumber:this.perform("getBlockNumber",{}),networkError:this.getNetwork().then((t=>null),(t=>t))}).then((({blockNumber:t,networkError:n})=>{if(n)throw this._internalBlockNumber===e&&(this._internalBlockNumber=null),n;const o=Et();return(t=i.O$.from(t).toNumber())<this._maxInternalBlockNumber&&(t=this._maxInternalBlockNumber),this._maxInternalBlockNumber=t,this._setFastBlockNumber(t),{blockNumber:t,reqTime:r,respTime:o}}));return this._internalBlockNumber=e,e.catch((t=>{this._internalBlockNumber===e&&(this._internalBlockNumber=null)})),(yield e).blockNumber}))}poll(){return yt(this,void 0,void 0,(function*(){const t=Ct++,r=[];let e=null;try{e=yield this._getInternalBlockNumber(100+this.pollingInterval/2)}catch(n){return void this.emit("error",n)}if(this._setFastBlockNumber(e),this.emit("poll",t,e),e!==this._lastBlockNumber){if(-2===this._emitted.block&&(this._emitted.block=e-1),Math.abs(this._emitted.block-e)>1e3)wt.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${e})`),this.emit("error",wt.makeError("network block skew detected",a.Yd.errors.NETWORK_ERROR,{blockNumber:e,event:"blockSkew",previousBlockNumber:this._emitted.block})),this.emit("block",e);else for(let t=this._emitted.block+1;t<=e;t++)this.emit("block",t);this._emitted.block!==e&&(this._emitted.block=e,Object.keys(this._emitted).forEach((t=>{if("block"===t)return;const r=this._emitted[t];"pending"!==r&&e-r>12&&delete this._emitted[t]}))),-2===this._lastBlockNumber&&(this._lastBlockNumber=e-1),this._events.forEach((t=>{switch(t.type){case"tx":{const e=t.hash;let n=this.getTransactionReceipt(e).then((t=>t&&null!=t.blockNumber?(this._emitted["t:"+e]=t.blockNumber,this.emit(e,t),null):null)).catch((t=>{this.emit("error",t)}));r.push(n);break}case"filter":{const n=t.filter;n.fromBlock=this._lastBlockNumber+1,n.toBlock=e;const i=this.getLogs(n).then((t=>{0!==t.length&&t.forEach((t=>{this._emitted["b:"+t.blockHash]=t.blockNumber,this._emitted["t:"+t.transactionHash]=t.blockNumber,this.emit(n,t)}))})).catch((t=>{this.emit("error",t)}));r.push(i);break}}})),this._lastBlockNumber=e,Promise.all(r).then((()=>{this.emit("didPoll",t)})).catch((t=>{this.emit("error",t)}))}else this.emit("didPoll",t)}))}resetEventsBlock(t){this._lastBlockNumber=t-1,this.polling&&this.poll()}get network(){return this._network}detectNetwork(){return yt(this,void 0,void 0,(function*(){return wt.throwError("provider does not support network detection",a.Yd.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})}))}getNetwork(){return yt(this,void 0,void 0,(function*(){const t=yield this._ready(),r=yield this.detectNetwork();if(t.chainId!==r.chainId){if(this.anyNetwork)return this._network=r,this._lastBlockNumber=-2,this._fastBlockNumber=null,this._fastBlockNumberPromise=null,this._fastQueryDate=0,this._emitted.block=-2,this._maxInternalBlockNumber=-1024,this._internalBlockNumber=null,this.emit("network",r,t),yield At(0),this._network;const e=wt.makeError("underlying network changed",a.Yd.errors.NETWORK_ERROR,{event:"changed",network:t,detectedNetwork:r});throw this.emit("error",e),e}return t}))}get blockNumber(){return this._getInternalBlockNumber(100+this.pollingInterval/2).then((t=>{this._setFastBlockNumber(t)}),(t=>{})),null!=this._fastBlockNumber?this._fastBlockNumber:-1}get polling(){return null!=this._poller}set polling(t){t&&!this._poller?(this._poller=setInterval((()=>{this.poll()}),this.pollingInterval),this._bootstrapPoll||(this._bootstrapPoll=setTimeout((()=>{this.poll(),this._bootstrapPoll=setTimeout((()=>{this._poller||this.poll(),this._bootstrapPoll=null}),this.pollingInterval)}),0))):!t&&this._poller&&(clearInterval(this._poller),this._poller=null)}get pollingInterval(){return this._pollingInterval}set pollingInterval(t){if("number"!==typeof t||t<=0||parseInt(String(t))!=t)throw new Error("invalid polling interval");this._pollingInterval=t,this._poller&&(clearInterval(this._poller),this._poller=setInterval((()=>{this.poll()}),this._pollingInterval))}_getFastBlockNumber(){const t=Et();return t-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=t,this._fastBlockNumberPromise=this.getBlockNumber().then((t=>((null==this._fastBlockNumber||t>this._fastBlockNumber)&&(this._fastBlockNumber=t),this._fastBlockNumber)))),this._fastBlockNumberPromise}_setFastBlockNumber(t){null!=this._fastBlockNumber&&t<this._fastBlockNumber||(this._fastQueryDate=Et(),(null==this._fastBlockNumber||t>this._fastBlockNumber)&&(this._fastBlockNumber=t,this._fastBlockNumberPromise=Promise.resolve(t)))}waitForTransaction(t,r,e){return yt(this,void 0,void 0,(function*(){return this._waitForTransaction(t,null==r?1:r,e||0,null)}))}_waitForTransaction(t,r,e,n){return yt(this,void 0,void 0,(function*(){const i=yield this.getTransactionReceipt(t);return(i?i.confirmations:0)>=r?i:new Promise(((i,o)=>{const s=[];let h=!1;const u=function(){return!!h||(h=!0,s.forEach((t=>{t()})),!1)},l=t=>{t.confirmations<r||u()||i(t)};if(this.on(t,l),s.push((()=>{this.removeListener(t,l)})),n){let e=n.startBlock,i=null;const l=s=>yt(this,void 0,void 0,(function*(){h||(yield At(1e3),this.getTransactionCount(n.from).then((f=>yt(this,void 0,void 0,(function*(){if(!h){if(f<=n.nonce)e=s;else{{const r=yield this.getTransaction(t);if(r&&null!=r.blockNumber)return}for(null==i&&(i=e-3,i<n.startBlock&&(i=n.startBlock));i<=s;){if(h)return;const e=yield this.getBlockWithTransactions(i);for(let i=0;i<e.transactions.length;i++){const s=e.transactions[i];if(s.hash===t)return;if(s.from===n.from&&s.nonce===n.nonce){if(h)return;const e=yield this.waitForTransaction(s.hash,r);if(u())return;let i="replaced";return s.data===n.data&&s.to===n.to&&s.value.eq(n.value)?i="repriced":"0x"===s.data&&s.from===s.to&&s.value.isZero()&&(i="cancelled"),void o(wt.makeError("transaction was replaced",a.Yd.errors.TRANSACTION_REPLACED,{cancelled:"replaced"===i||"cancelled"===i,reason:i,replacement:this._wrapTransaction(s),hash:t,receipt:e}))}}i++}}h||this.once("block",l)}}))),(t=>{h||this.once("block",l)})))}));if(h)return;this.once("block",l),s.push((()=>{this.removeListener("block",l)}))}if("number"===typeof e&&e>0){const t=setTimeout((()=>{u()||o(wt.makeError("timeout exceeded",a.Yd.errors.TIMEOUT,{timeout:e}))}),e);t.unref&&t.unref(),s.push((()=>{clearTimeout(t)}))}}))}))}getBlockNumber(){return yt(this,void 0,void 0,(function*(){return this._getInternalBlockNumber(0)}))}getGasPrice(){return yt(this,void 0,void 0,(function*(){yield this.getNetwork();const t=yield this.perform("getGasPrice",{});try{return i.O$.from(t)}catch(r){return wt.throwError("bad result from backend",a.Yd.errors.SERVER_ERROR,{method:"getGasPrice",result:t,error:r})}}))}getBalance(t,r){return yt(this,void 0,void 0,(function*(){yield this.getNetwork();const e=yield(0,u.mE)({address:this._getAddress(t),blockTag:this._getBlockTag(r)}),n=yield this.perform("getBalance",e);try{return i.O$.from(n)}catch(o){return wt.throwError("bad result from backend",a.Yd.errors.SERVER_ERROR,{method:"getBalance",params:e,result:n,error:o})}}))}getTransactionCount(t,r){return yt(this,void 0,void 0,(function*(){yield this.getNetwork();const e=yield(0,u.mE)({address:this._getAddress(t),blockTag:this._getBlockTag(r)}),n=yield this.perform("getTransactionCount",e);try{return i.O$.from(n).toNumber()}catch(o){return wt.throwError("bad result from backend",a.Yd.errors.SERVER_ERROR,{method:"getTransactionCount",params:e,result:n,error:o})}}))}getCode(t,r){return yt(this,void 0,void 0,(function*(){yield this.getNetwork();const e=yield(0,u.mE)({address:this._getAddress(t),blockTag:this._getBlockTag(r)}),n=yield this.perform("getCode",e);try{return(0,o.Dv)(n)}catch(i){return wt.throwError("bad result from backend",a.Yd.errors.SERVER_ERROR,{method:"getCode",params:e,result:n,error:i})}}))}getStorageAt(t,r,e){return yt(this,void 0,void 0,(function*(){yield this.getNetwork();const n=yield(0,u.mE)({address:this._getAddress(t),blockTag:this._getBlockTag(e),position:Promise.resolve(r).then((t=>(0,o.$P)(t)))}),i=yield this.perform("getStorageAt",n);try{return(0,o.Dv)(i)}catch(s){return wt.throwError("bad result from backend",a.Yd.errors.SERVER_ERROR,{method:"getStorageAt",params:n,result:i,error:s})}}))}_wrapTransaction(t,r,e){if(null!=r&&32!==(0,o.E1)(r))throw new Error("invalid response - sendTransaction");const n=t;return null!=r&&t.hash!==r&&wt.throwError("Transaction hash mismatch from Provider.sendTransaction.",a.Yd.errors.UNKNOWN_ERROR,{expectedHash:t.hash,returnedHash:r}),n.wait=(r,n)=>yt(this,void 0,void 0,(function*(){let i;null==r&&(r=1),null==n&&(n=0),0!==r&&null!=e&&(i={data:t.data,from:t.from,nonce:t.nonce,to:t.to,value:t.value,startBlock:e});const o=yield this._waitForTransaction(t.hash,r,n,i);return null==o&&0===r?null:(this._emitted["t:"+t.hash]=o.blockNumber,0===o.status&&wt.throwError("transaction failed",a.Yd.errors.CALL_EXCEPTION,{transactionHash:t.hash,transaction:t,receipt:o}),o)})),n}sendTransaction(t){return yt(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield Promise.resolve(t).then((t=>(0,o.Dv)(t))),e=this.formatter.transaction(t);null==e.confirmations&&(e.confirmations=0);const n=yield this._getInternalBlockNumber(100+2*this.pollingInterval);try{const t=yield this.perform("sendTransaction",{signedTransaction:r});return this._wrapTransaction(e,t,n)}catch(i){throw i.transaction=e,i.transactionHash=e.hash,i}}))}_getTransactionRequest(t){return yt(this,void 0,void 0,(function*(){const r=yield t,e={};return["from","to"].forEach((t=>{null!=r[t]&&(e[t]=Promise.resolve(r[t]).then((t=>t?this._getAddress(t):null)))})),["gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","value"].forEach((t=>{null!=r[t]&&(e[t]=Promise.resolve(r[t]).then((t=>t?i.O$.from(t):null)))})),["type"].forEach((t=>{null!=r[t]&&(e[t]=Promise.resolve(r[t]).then((t=>null!=t?t:null)))})),r.accessList&&(e.accessList=this.formatter.accessList(r.accessList)),["data"].forEach((t=>{null!=r[t]&&(e[t]=Promise.resolve(r[t]).then((t=>t?(0,o.Dv)(t):null)))})),this.formatter.transactionRequest(yield(0,u.mE)(e))}))}_getFilter(t){return yt(this,void 0,void 0,(function*(){t=yield t;const r={};return null!=t.address&&(r.address=this._getAddress(t.address)),["blockHash","topics"].forEach((e=>{null!=t[e]&&(r[e]=t[e])})),["fromBlock","toBlock"].forEach((e=>{null!=t[e]&&(r[e]=this._getBlockTag(t[e]))})),this.formatter.filter(yield(0,u.mE)(r))}))}call(t,r){return yt(this,void 0,void 0,(function*(){yield this.getNetwork();const e=yield(0,u.mE)({transaction:this._getTransactionRequest(t),blockTag:this._getBlockTag(r)}),n=yield this.perform("call",e);try{return(0,o.Dv)(n)}catch(i){return wt.throwError("bad result from backend",a.Yd.errors.SERVER_ERROR,{method:"call",params:e,result:n,error:i})}}))}estimateGas(t){return yt(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield(0,u.mE)({transaction:this._getTransactionRequest(t)}),e=yield this.perform("estimateGas",r);try{return i.O$.from(e)}catch(n){return wt.throwError("bad result from backend",a.Yd.errors.SERVER_ERROR,{method:"estimateGas",params:r,result:e,error:n})}}))}_getAddress(t){return yt(this,void 0,void 0,(function*(){"string"!==typeof(t=yield t)&&wt.throwArgumentError("invalid address or ENS name","name",t);const r=yield this.resolveName(t);return null==r&&wt.throwError("ENS name not configured",a.Yd.errors.UNSUPPORTED_OPERATION,{operation:`resolveName(${JSON.stringify(t)})`}),r}))}_getBlock(t,r){return yt(this,void 0,void 0,(function*(){yield this.getNetwork(),t=yield t;let e=-128;const n={includeTransactions:!!r};if((0,o.A7)(t,32))n.blockHash=t;else try{n.blockTag=yield this._getBlockTag(t),(0,o.A7)(n.blockTag)&&(e=parseInt(n.blockTag.substring(2),16))}catch(i){wt.throwArgumentError("invalid block hash or block tag","blockHashOrBlockTag",t)}return D((()=>yt(this,void 0,void 0,(function*(){const t=yield this.perform("getBlock",n);if(null==t)return null!=n.blockHash&&null==this._emitted["b:"+n.blockHash]||null!=n.blockTag&&e>this._emitted.block?null:void 0;if(r){let r=null;for(let n=0;n<t.transactions.length;n++){const e=t.transactions[n];if(null==e.blockNumber)e.confirmations=0;else if(null==e.confirmations){null==r&&(r=yield this._getInternalBlockNumber(100+2*this.pollingInterval));let t=r-e.blockNumber+1;t<=0&&(t=1),e.confirmations=t}}const e=this.formatter.blockWithTransactions(t);return e.transactions=e.transactions.map((t=>this._wrapTransaction(t))),e}return this.formatter.block(t)}))),{oncePoll:this})}))}getBlock(t){return this._getBlock(t,!1)}getBlockWithTransactions(t){return this._getBlock(t,!0)}getTransaction(t){return yt(this,void 0,void 0,(function*(){yield this.getNetwork(),t=yield t;const r={transactionHash:this.formatter.hash(t,!0)};return D((()=>yt(this,void 0,void 0,(function*(){const e=yield this.perform("getTransaction",r);if(null==e)return null==this._emitted["t:"+t]?null:void 0;const n=this.formatter.transactionResponse(e);if(null==n.blockNumber)n.confirmations=0;else if(null==n.confirmations){let t=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-n.blockNumber+1;t<=0&&(t=1),n.confirmations=t}return this._wrapTransaction(n)}))),{oncePoll:this})}))}getTransactionReceipt(t){return yt(this,void 0,void 0,(function*(){yield this.getNetwork(),t=yield t;const r={transactionHash:this.formatter.hash(t,!0)};return D((()=>yt(this,void 0,void 0,(function*(){const e=yield this.perform("getTransactionReceipt",r);if(null==e)return null==this._emitted["t:"+t]?null:void 0;if(null==e.blockHash)return;const n=this.formatter.receipt(e);if(null==n.blockNumber)n.confirmations=0;else if(null==n.confirmations){let t=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-n.blockNumber+1;t<=0&&(t=1),n.confirmations=t}return n}))),{oncePoll:this})}))}getLogs(t){return yt(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield(0,u.mE)({filter:this._getFilter(t)}),e=yield this.perform("getLogs",r);return e.forEach((t=>{null==t.removed&&(t.removed=!1)})),vt.arrayOf(this.formatter.filterLog.bind(this.formatter))(e)}))}getEtherPrice(){return yt(this,void 0,void 0,(function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})}))}_getBlockTag(t){return yt(this,void 0,void 0,(function*(){if("number"===typeof(t=yield t)&&t<0){t%1&&wt.throwArgumentError("invalid BlockTag","blockTag",t);let r=yield this._getInternalBlockNumber(100+2*this.pollingInterval);return r+=t,r<0&&(r=0),this.formatter.blockTag(r)}return this.formatter.blockTag(t)}))}getResolver(t){return yt(this,void 0,void 0,(function*(){try{const r=yield this._getResolver(t);return null==r?null:new Ot(this,r,t)}catch(r){return r.code,a.Yd.errors.CALL_EXCEPTION,null}}))}_getResolver(t){return yt(this,void 0,void 0,(function*(){const r=yield this.getNetwork();r.ensAddress||wt.throwError("network does not support ENS",a.Yd.errors.UNSUPPORTED_OPERATION,{operation:"ENS",network:r.name});const e={to:r.ensAddress,data:"0x0178b8bf"+nt(t).substring(2)};try{return this.formatter.callAddress(yield this.call(e))}catch(n){if(n.code===a.Yd.errors.CALL_EXCEPTION)return null;throw n}}))}resolveName(t){return yt(this,void 0,void 0,(function*(){t=yield t;try{return Promise.resolve(this.formatter.address(t))}catch(e){if((0,o.A7)(t))throw e}"string"!==typeof t&&wt.throwArgumentError("invalid ENS name","name",t);const r=yield this.getResolver(t);return r?yield r.getAddress():null}))}lookupAddress(t){return yt(this,void 0,void 0,(function*(){t=yield t;const r=(t=this.formatter.address(t)).substring(2).toLowerCase()+".addr.reverse",e=yield this._getResolver(r);if(!e)return null;let n=(0,o.lE)(yield this.call({to:e,data:"0x691f3431"+nt(r).substring(2)}));if(n.length<32||!i.O$.from(n.slice(0,32)).eq(32))return null;if(n=n.slice(32),n.length<32)return null;const s=i.O$.from(n.slice(0,32)).toNumber();if(n=n.slice(32),s>n.length)return null;const h=(0,P.ZN)(n.slice(0,s));return(yield this.resolveName(h))!=t?null:h}))}getAvatar(t){return yt(this,void 0,void 0,(function*(){let r=null;if((0,o.A7)(t)){const e=this.formatter.address(t),n=e.substring(2).toLowerCase()+".addr.reverse",i=yield this._getResolver(n);if(!i)return null;r=new Ot(this,i,"_",e)}else r=yield this.getResolver(t);const e=yield r.getAvatar();return null==e?null:e.url}))}perform(t,r){return wt.throwError(t+" not implemented",a.Yd.errors.NOT_IMPLEMENTED,{operation:t})}_startEvent(t){this.polling=this._events.filter((t=>t.pollable())).length>0}_stopEvent(t){this.polling=this._events.filter((t=>t.pollable())).length>0}_addEventListener(t,r,e){const n=new Nt(_t(t),r,e);return this._events.push(n),this._startEvent(n),this}on(t,r){return this._addEventListener(t,r,!1)}once(t,r){return this._addEventListener(t,r,!0)}emit(t,...r){let e=!1,n=[],i=_t(t);return this._events=this._events.filter((t=>t.tag!==i||(setTimeout((()=>{t.listener.apply(this,r)}),0),e=!0,!t.once||(n.push(t),!1)))),n.forEach((t=>{this._stopEvent(t)})),e}listenerCount(t){if(!t)return this._events.length;let r=_t(t);return this._events.filter((t=>t.tag===r)).length}listeners(t){if(null==t)return this._events.map((t=>t.listener));let r=_t(t);return this._events.filter((t=>t.tag===r)).map((t=>t.listener))}off(t,r){if(null==r)return this.removeAllListeners(t);const e=[];let n=!1,i=_t(t);return this._events=this._events.filter((t=>t.tag!==i||t.listener!=r||(!!n||(n=!0,e.push(t),!1)))),e.forEach((t=>{this._stopEvent(t)})),this}removeAllListeners(t){let r=[];if(null==t)r=this._events,this._events=[];else{const e=_t(t);this._events=this._events.filter((t=>t.tag!==e||(r.push(t),!1)))}return r.forEach((t=>{this._stopEvent(t)})),this}}var Lt=function(t,r,e,n){return new(e||(e=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(r){o(r)}}function h(t){try{u(n.throw(t))}catch(r){o(r)}}function u(t){var r;t.done?i(t.value):(r=t.value,r instanceof e?r:new e((function(t){t(r)}))).then(s,h)}u((n=n.apply(t,r||[])).next())}))};const Dt=new a.Yd(U.i),Ut=["call","estimateGas"];function zt(t,r,e){if("call"===t&&r.code===a.Yd.errors.SERVER_ERROR){const t=r.error;if(t&&t.message.match("reverted")&&(0,o.A7)(t.data))return t.data;Dt.throwError("missing revert data in call exception",a.Yd.errors.CALL_EXCEPTION,{error:r,data:"0x"})}let n=r.message;r.code===a.Yd.errors.SERVER_ERROR&&r.error&&"string"===typeof r.error.message?n=r.error.message:"string"===typeof r.body?n=r.body:"string"===typeof r.responseText&&(n=r.responseText),n=(n||"").toLowerCase();const i=e.transaction||e.signedTransaction;throw n.match(/insufficient funds|base fee exceeds gas limit/)&&Dt.throwError("insufficient funds for intrinsic transaction cost",a.Yd.errors.INSUFFICIENT_FUNDS,{error:r,method:t,transaction:i}),n.match(/nonce too low/)&&Dt.throwError("nonce has already been used",a.Yd.errors.NONCE_EXPIRED,{error:r,method:t,transaction:i}),n.match(/replacement transaction underpriced/)&&Dt.throwError("replacement fee too low",a.Yd.errors.REPLACEMENT_UNDERPRICED,{error:r,method:t,transaction:i}),n.match(/only replay-protected/)&&Dt.throwError("legacy pre-eip-155 transactions not supported",a.Yd.errors.UNSUPPORTED_OPERATION,{error:r,method:t,transaction:i}),Ut.indexOf(t)>=0&&n.match(/gas required exceeds allowance|always failing transaction|execution reverted/)&&Dt.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",a.Yd.errors.UNPREDICTABLE_GAS_LIMIT,{error:r,method:t,transaction:i}),r}function qt(t){return new Promise((function(r){setTimeout(r,t)}))}function Gt(t){if(t.error){const r=new Error(t.error.message);throw r.code=t.error.code,r.data=t.error.data,r}return t.result}function jt(t){return t?t.toLowerCase():t}const $t={};class Yt extends n.E{constructor(t,r,e){if(Dt.checkNew(new.target,Yt),super(),t!==$t)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");(0,u.zG)(this,"provider",r),null==e&&(e=0),"string"===typeof e?((0,u.zG)(this,"_address",this.provider.formatter.address(e)),(0,u.zG)(this,"_index",null)):"number"===typeof e?((0,u.zG)(this,"_index",e),(0,u.zG)(this,"_address",null)):Dt.throwArgumentError("invalid address or index","addressOrIndex",e)}connect(t){return Dt.throwError("cannot alter JSON-RPC Signer connection",a.Yd.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new Ht($t,this.provider,this._address||this._index)}getAddress(){return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then((t=>(t.length<=this._index&&Dt.throwError("unknown account #"+this._index,a.Yd.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(t[this._index]))))}sendUncheckedTransaction(t){t=(0,u.DC)(t);const r=this.getAddress().then((t=>(t&&(t=t.toLowerCase()),t)));if(null==t.gasLimit){const e=(0,u.DC)(t);e.from=r,t.gasLimit=this.provider.estimateGas(e)}return null!=t.to&&(t.to=Promise.resolve(t.to).then((t=>Lt(this,void 0,void 0,(function*(){if(null==t)return null;const r=yield this.provider.resolveName(t);return null==r&&Dt.throwArgumentError("provided ENS name resolves to null","tx.to",t),r}))))),(0,u.mE)({tx:(0,u.mE)(t),sender:r}).then((({tx:r,sender:e})=>{null!=r.from?r.from.toLowerCase()!==e&&Dt.throwArgumentError("from address mismatch","transaction",t):r.from=e;const n=this.provider.constructor.hexlifyTransaction(r,{from:!0});return this.provider.send("eth_sendTransaction",[n]).then((t=>t),(t=>zt("sendTransaction",t,n)))}))}signTransaction(t){return Dt.throwError("signing transactions is unsupported",a.Yd.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(t){return Lt(this,void 0,void 0,(function*(){const r=yield this.provider._getInternalBlockNumber(100+2*this.provider.pollingInterval),e=yield this.sendUncheckedTransaction(t);try{return yield D((()=>Lt(this,void 0,void 0,(function*(){const t=yield this.provider.getTransaction(e);if(null!==t)return this.provider._wrapTransaction(t,e,r)}))),{oncePoll:this.provider})}catch(n){throw n.transactionHash=e,n}}))}signMessage(t){return Lt(this,void 0,void 0,(function*(){const r="string"===typeof t?(0,P.Y0)(t):t,e=yield this.getAddress();return yield this.provider.send("personal_sign",[(0,o.Dv)(r),e.toLowerCase()])}))}_legacySignMessage(t){return Lt(this,void 0,void 0,(function*(){const r="string"===typeof t?(0,P.Y0)(t):t,e=yield this.getAddress();return yield this.provider.send("eth_sign",[e.toLowerCase(),(0,o.Dv)(r)])}))}_signTypedData(t,r,e){return Lt(this,void 0,void 0,(function*(){const n=yield x.resolveNames(t,r,e,(t=>this.provider.resolveName(t))),i=yield this.getAddress();return yield this.provider.send("eth_signTypedData_v4",[i.toLowerCase(),JSON.stringify(x.getPayload(n.domain,r,n.value))])}))}unlock(t){return Lt(this,void 0,void 0,(function*(){const r=this.provider,e=yield this.getAddress();return r.send("personal_unlockAccount",[e.toLowerCase(),t,null])}))}}class Ht extends Yt{sendTransaction(t){return this.sendUncheckedTransaction(t).then((t=>({hash:t,nonce:null,gasLimit:null,gasPrice:null,data:null,value:null,chainId:null,confirmations:0,from:null,wait:r=>this.provider.waitForTransaction(t,r)})))}}const Vt={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0};class Zt extends Ft{constructor(t,r){Dt.checkNew(new.target,Zt);let e=r;null==e&&(e=new Promise(((t,r)=>{setTimeout((()=>{this.detectNetwork().then((r=>{t(r)}),(t=>{r(t)}))}),0)}))),super(e),t||(t=(0,u.tu)(this.constructor,"defaultUrl")()),"string"===typeof t?(0,u.zG)(this,"connection",Object.freeze({url:t})):(0,u.zG)(this,"connection",Object.freeze((0,u.DC)(t))),this._nextId=42}get _cache(){return null==this._eventLoopCache&&(this._eventLoopCache={}),this._eventLoopCache}static defaultUrl(){return"http://localhost:8545"}detectNetwork(){return this._cache.detectNetwork||(this._cache.detectNetwork=this._uncachedDetectNetwork(),setTimeout((()=>{this._cache.detectNetwork=null}),0)),this._cache.detectNetwork}_uncachedDetectNetwork(){return Lt(this,void 0,void 0,(function*(){yield qt(0);let t=null;try{t=yield this.send("eth_chainId",[])}catch(r){try{t=yield this.send("net_version",[])}catch(r){}}if(null!=t){const e=(0,u.tu)(this.constructor,"getNetwork");try{return e(i.O$.from(t).toNumber())}catch(r){return Dt.throwError("could not detect network",a.Yd.errors.NETWORK_ERROR,{chainId:t,event:"invalidNetwork",serverError:r})}}return Dt.throwError("could not detect network",a.Yd.errors.NETWORK_ERROR,{event:"noNetwork"})}))}getSigner(t){return new Yt($t,this,t)}getUncheckedSigner(t){return this.getSigner(t).connectUnchecked()}listAccounts(){return this.send("eth_accounts",[]).then((t=>t.map((t=>this.formatter.address(t)))))}send(t,r){const e={method:t,params:r,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:(0,u.p$)(e),provider:this});const n=["eth_chainId","eth_blockNumber"].indexOf(t)>=0;if(n&&this._cache[t])return this._cache[t];const i=L(this.connection,JSON.stringify(e),Gt).then((t=>(this.emit("debug",{action:"response",request:e,response:t,provider:this}),t)),(t=>{throw this.emit("debug",{action:"response",error:t,request:e,provider:this}),t}));return n&&(this._cache[t]=i,setTimeout((()=>{this._cache[t]=null}),0)),i}prepareRequest(t,r){switch(t){case"getBlockNumber":return["eth_blockNumber",[]];case"getGasPrice":return["eth_gasPrice",[]];case"getBalance":return["eth_getBalance",[jt(r.address),r.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[jt(r.address),r.blockTag]];case"getCode":return["eth_getCode",[jt(r.address),r.blockTag]];case"getStorageAt":return["eth_getStorageAt",[jt(r.address),r.position,r.blockTag]];case"sendTransaction":return["eth_sendRawTransaction",[r.signedTransaction]];case"getBlock":return r.blockTag?["eth_getBlockByNumber",[r.blockTag,!!r.includeTransactions]]:r.blockHash?["eth_getBlockByHash",[r.blockHash,!!r.includeTransactions]]:null;case"getTransaction":return["eth_getTransactionByHash",[r.transactionHash]];case"getTransactionReceipt":return["eth_getTransactionReceipt",[r.transactionHash]];case"call":return["eth_call",[(0,u.tu)(this.constructor,"hexlifyTransaction")(r.transaction,{from:!0}),r.blockTag]];case"estimateGas":return["eth_estimateGas",[(0,u.tu)(this.constructor,"hexlifyTransaction")(r.transaction,{from:!0})]];case"getLogs":return r.filter&&null!=r.filter.address&&(r.filter.address=jt(r.filter.address)),["eth_getLogs",[r.filter]]}return null}perform(t,r){return Lt(this,void 0,void 0,(function*(){if("call"===t||"estimateGas"===t){const t=r.transaction;if(t&&null!=t.type&&i.O$.from(t.type).isZero()&&null==t.maxFeePerGas&&null==t.maxPriorityFeePerGas){const e=yield this.getFeeData();null==e.maxFeePerGas&&null==e.maxPriorityFeePerGas&&((r=(0,u.DC)(r)).transaction=(0,u.DC)(t),delete r.transaction.type)}}const e=this.prepareRequest(t,r);null==e&&Dt.throwError(t+" not implemented",a.Yd.errors.NOT_IMPLEMENTED,{operation:t});try{return yield this.send(e[0],e[1])}catch(n){return zt(t,n,r)}}))}_startEvent(t){"pending"===t.tag&&this._startPending(),super._startEvent(t)}_startPending(){if(null!=this._pendingFilter)return;const t=this,r=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=r,r.then((function(e){return function n(){t.send("eth_getFilterChanges",[e]).then((function(e){if(t._pendingFilter!=r)return null;let n=Promise.resolve();return e.forEach((function(r){t._emitted["t:"+r.toLowerCase()]="pending",n=n.then((function(){return t.getTransaction(r).then((function(r){return t.emit("pending",r),null}))}))})),n.then((function(){return qt(1e3)}))})).then((function(){if(t._pendingFilter==r)return setTimeout((function(){n()}),0),null;t.send("eth_uninstallFilter",[e])})).catch((t=>{}))}(),e})).catch((t=>{}))}_stopEvent(t){"pending"===t.tag&&0===this.listenerCount("pending")&&(this._pendingFilter=null),super._stopEvent(t)}static hexlifyTransaction(t,r){const e=(0,u.DC)(Vt);if(r)for(const i in r)r[i]&&(e[i]=!0);(0,u.uj)(t,e);const n={};return["gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach((function(r){if(null==t[r])return;const e=(0,o.$P)(t[r]);"gasLimit"===r&&(r="gas"),n[r]=e})),["from","to","data"].forEach((function(r){null!=t[r]&&(n[r]=(0,o.Dv)(t[r]))})),t.accessList&&(n.accessList=(0,I.z7)(t.accessList)),n}}},241:function(t,r,e){"use strict";e.d(r,{Q:function(){return l}});var n=e(6881),i=e(1581),o=e(4216),s=e(8156);const h=new i.Yd(o.i);let u=1;function a(t,r){const e="Web3LegacyFetcher";return function(t,i){const o={method:t,params:i,id:u++,jsonrpc:"2.0"};return new Promise(((t,i)=>{this.emit("debug",{action:"request",fetcher:e,request:(0,n.p$)(o),provider:this}),r(o,((r,n)=>{if(r)return this.emit("debug",{action:"response",fetcher:e,error:r,request:o,provider:this}),i(r);if(this.emit("debug",{action:"response",fetcher:e,request:o,response:n,provider:this}),n.error){const t=new Error(n.error.message);return t.code=n.error.code,t.data=n.error.data,i(t)}t(n.result)}))}))}}class l extends s.r{constructor(t,r){h.checkNew(new.target,l),null==t&&h.throwArgumentError("missing provider","provider",t);let e=null,i=null,o=null;"function"===typeof t?(e="unknown:",i=t):(e=t.host||t.path||"",!e&&t.isMetaMask&&(e="metamask"),o=t,t.request?(""===e&&(e="eip-1193:"),i=function(t){return function(r,e){null==e&&(e=[]);const i={method:r,params:e};return this.emit("debug",{action:"request",fetcher:"Eip1193Fetcher",request:(0,n.p$)(i),provider:this}),t.request(i).then((t=>(this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:i,response:t,provider:this}),t)),(t=>{throw this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:i,error:t,provider:this}),t}))}}(t)):t.sendAsync?i=a(0,t.sendAsync.bind(t)):t.send?i=a(0,t.send.bind(t)):h.throwArgumentError("unsupported provider","provider",t),e||(e="unknown:")),super(e,r),(0,n.zG)(this,"jsonRpcFetchFunc",i),(0,n.zG)(this,"provider",o)}send(t,r){return this.jsonRpcFetchFunc(t,r)}}},9052:function(t,r,e){"use strict";e.d(r,{J:function(){return c},c:function(){return a}});var n=e(6441),i=e(1581);const o=new i.Yd("rlp/5.5.0");function s(t){const r=[];for(;t;)r.unshift(255&t),t>>=8;return r}function h(t,r,e){let n=0;for(let i=0;i<e;i++)n=256*n+t[r+i];return n}function u(t){if(Array.isArray(t)){let r=[];if(t.forEach((function(t){r=r.concat(u(t))})),r.length<=55)return r.unshift(192+r.length),r;const e=s(r.length);return e.unshift(247+e.length),e.concat(r)}(0,n.Zq)(t)||o.throwArgumentError("RLP object must be BytesLike","object",t);const r=Array.prototype.slice.call((0,n.lE)(t));if(1===r.length&&r[0]<=127)return r;if(r.length<=55)return r.unshift(128+r.length),r;const e=s(r.length);return e.unshift(183+e.length),e.concat(r)}function a(t){return(0,n.Dv)(u(t))}function l(t,r,e,n){const s=[];for(;e<r+1+n;){const h=f(t,e);s.push(h.result),(e+=h.consumed)>r+1+n&&o.throwError("child data too short",i.Yd.errors.BUFFER_OVERRUN,{})}return{consumed:1+n,result:s}}function f(t,r){if(0===t.length&&o.throwError("data too short",i.Yd.errors.BUFFER_OVERRUN,{}),t[r]>=248){const e=t[r]-247;r+1+e>t.length&&o.throwError("data short segment too short",i.Yd.errors.BUFFER_OVERRUN,{});const n=h(t,r+1,e);return r+1+e+n>t.length&&o.throwError("data long segment too short",i.Yd.errors.BUFFER_OVERRUN,{}),l(t,r,r+1+e,e+n)}if(t[r]>=192){const e=t[r]-192;return r+1+e>t.length&&o.throwError("data array too short",i.Yd.errors.BUFFER_OVERRUN,{}),l(t,r,r+1,e)}if(t[r]>=184){const e=t[r]-183;r+1+e>t.length&&o.throwError("data array too short",i.Yd.errors.BUFFER_OVERRUN,{});const s=h(t,r+1,e);r+1+e+s>t.length&&o.throwError("data array too short",i.Yd.errors.BUFFER_OVERRUN,{});return{consumed:1+e+s,result:(0,n.Dv)(t.slice(r+1+e,r+1+e+s))}}if(t[r]>=128){const e=t[r]-128;r+1+e>t.length&&o.throwError("data too short",i.Yd.errors.BUFFER_OVERRUN,{});return{consumed:1+e,result:(0,n.Dv)(t.slice(r+1,r+1+e))}}return{consumed:1,result:(0,n.Dv)(t[r])}}function c(t){const r=(0,n.lE)(t),e=f(r,0);return e.consumed!==r.length&&o.throwArgumentError("invalid rlp data","data",t),e.result}},2500:function(t,r,e){!function(t,r){"use strict";function n(t,r){if(!t)throw new Error(r||"Assertion failed")}function i(t,r){t.super_=r;var e=function(){};e.prototype=r.prototype,t.prototype=new e,t.prototype.constructor=t}function o(t,r,e){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==r&&"be"!==r||(e=r,r=10),this._init(t||0,r||10,e||"be"))}var s;"object"===typeof t?t.exports=o:r.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!==typeof window&&"undefined"!==typeof window.Buffer?window.Buffer:e(2808).Buffer}catch(k){}function h(t,r){var e=t.charCodeAt(r);return e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:e-48&15}function u(t,r,e){var n=h(t,e);return e-1>=r&&(n|=h(t,e-1)<<4),n}function a(t,r,e,n){for(var i=0,o=Math.min(t.length,e),s=r;s<o;s++){var h=t.charCodeAt(s)-48;i*=n,i+=h>=49?h-49+10:h>=17?h-17+10:h}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,r){return t.cmp(r)>0?t:r},o.min=function(t,r){return t.cmp(r)<0?t:r},o.prototype._init=function(t,r,e){if("number"===typeof t)return this._initNumber(t,r,e);if("object"===typeof t)return this._initArray(t,r,e);"hex"===r&&(r=16),n(r===(0|r)&&r>=2&&r<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<t.length&&(16===r?this._parseHex(t,i,e):(this._parseBase(t,r,i),"le"===e&&this._initArray(this.toArray(),r,e)))},o.prototype._initNumber=function(t,r,e){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"===e&&this._initArray(this.toArray(),r,e)},o.prototype._initArray=function(t,r,e){if(n("number"===typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,s,h=0;if("be"===e)for(i=t.length-1,o=0;i>=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<<h&67108863,this.words[o+1]=s>>>26-h&67108863,(h+=24)>=26&&(h-=26,o++);else if("le"===e)for(i=0,o=0;i<t.length;i+=3)s=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=s<<h&67108863,this.words[o+1]=s>>>26-h&67108863,(h+=24)>=26&&(h-=26,o++);return this.strip()},o.prototype._parseHex=function(t,r,e){this.length=Math.ceil((t.length-r)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var i,o=0,s=0;if("be"===e)for(n=t.length-1;n>=r;n-=2)i=u(t,r,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(t.length-r)%2===0?r+1:r;n<t.length;n+=2)i=u(t,r,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this.strip()},o.prototype._parseBase=function(t,r,e){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=r)n++;n--,i=i/r|0;for(var o=t.length-e,s=o%n,h=Math.min(o,o-s)+e,u=0,l=e;l<h;l+=n)u=a(t,l,l+n,r),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var f=1;for(u=a(t,l,t.length,r),l=0;l<s;l++)f*=r;this.imuln(f),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},o.prototype.copy=function(t){t.words=new Array(this.length);for(var r=0;r<this.length;r++)t.words[r]=this.words[r];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 l=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],c=[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,r,e){e.negative=r.negative^t.negative;var n=t.length+r.length|0;e.length=n,n=n-1|0;var i=0|t.words[0],o=0|r.words[0],s=i*o,h=67108863&s,u=s/67108864|0;e.words[0]=h;for(var a=1;a<n;a++){for(var l=u>>>26,f=67108863&u,c=Math.min(a,r.length-1),d=Math.max(0,a-t.length+1);d<=c;d++){var m=a-d|0;l+=(s=(i=0|t.words[m])*(o=0|r.words[d])+f)/67108864|0,f=67108863&s}e.words[a]=0|f,u=0|l}return 0!==u?e.words[a]=0|u:e.length--,e.strip()}o.prototype.toString=function(t,r){var e;if(r=0|r||1,16===(t=t||10)||"hex"===t){e="";for(var i=0,o=0,s=0;s<this.length;s++){var h=this.words[s],u=(16777215&(h<<i|o)).toString(16);e=0!==(o=h>>>24-i&16777215)||s!==this.length-1?l[6-u.length]+u+e:u+e,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(e=o.toString(16)+e);e.length%r!==0;)e="0"+e;return 0!==this.negative&&(e="-"+e),e}if(t===(0|t)&&t>=2&&t<=36){var a=f[t],d=c[t];e="";var m=this.clone();for(m.negative=0;!m.isZero();){var p=m.modn(d).toString(t);e=(m=m.idivn(d)).isZero()?p+e:l[a-p.length]+p+e}for(this.isZero()&&(e="0"+e);e.length%r!==0;)e="0"+e;return 0!==this.negative&&(e="-"+e),e}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,r){return n("undefined"!==typeof s),this.toArrayLike(s,t,r)},o.prototype.toArray=function(t,r){return this.toArrayLike(Array,t,r)},o.prototype.toArrayLike=function(t,r,e){var i=this.byteLength(),o=e||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0"),this.strip();var s,h,u="le"===r,a=new t(o),l=this.clone();if(u){for(h=0;!l.isZero();h++)s=l.andln(255),l.iushrn(8),a[h]=s;for(;h<o;h++)a[h]=0}else{for(h=0;h<o-i;h++)a[h]=0;for(h=0;!l.isZero();h++)s=l.andln(255),l.iushrn(8),a[o-h-1]=s}return a},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var r=t,e=0;return r>=4096&&(e+=13,r>>>=13),r>=64&&(e+=7,r>>>=7),r>=8&&(e+=4,r>>>=4),r>=2&&(e+=2,r>>>=2),e+r},o.prototype._zeroBits=function(t){if(0===t)return 26;var r=t,e=0;return 0===(8191&r)&&(e+=13,r>>>=13),0===(127&r)&&(e+=7,r>>>=7),0===(15&r)&&(e+=4,r>>>=4),0===(3&r)&&(e+=2,r>>>=2),0===(1&r)&&e++,e},o.prototype.bitLength=function(){var t=this.words[this.length-1],r=this._countBits(t);return 26*(this.length-1)+r},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,r=0;r<this.length;r++){var e=this._zeroBits(this.words[r]);if(t+=e,26!==e)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 r=0;r<t.length;r++)this.words[r]=this.words[r]|t.words[r];return this.strip()},o.prototype.ior=function(t){return n(0===(this.negative|t.negative)),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var r;r=this.length>t.length?t:this;for(var e=0;e<r.length;e++)this.words[e]=this.words[e]&t.words[e];return this.length=r.length,this.strip()},o.prototype.iand=function(t){return n(0===(this.negative|t.negative)),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var r,e;this.length>t.length?(r=this,e=t):(r=t,e=this);for(var n=0;n<e.length;n++)this.words[n]=r.words[n]^e.words[n];if(this!==r)for(;n<r.length;n++)this.words[n]=r.words[n];return this.length=r.length,this.strip()},o.prototype.ixor=function(t){return n(0===(this.negative|t.negative)),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"===typeof t&&t>=0);var r=0|Math.ceil(t/26),e=t%26;this._expand(r),e>0&&r--;for(var i=0;i<r;i++)this.words[i]=67108863&~this.words[i];return e>0&&(this.words[i]=~this.words[i]&67108863>>26-e),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,r){n("number"===typeof t&&t>=0);var e=t/26|0,i=t%26;return this._expand(e+1),this.words[e]=r?this.words[e]|1<<i:this.words[e]&~(1<<i),this.strip()},o.prototype.iadd=function(t){var r,e,n;if(0!==this.negative&&0===t.negative)return this.negative=0,r=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,r=this.isub(t),t.negative=1,r._normSign();this.length>t.length?(e=this,n=t):(e=t,n=this);for(var i=0,o=0;o<n.length;o++)r=(0|e.words[o])+(0|n.words[o])+i,this.words[o]=67108863&r,i=r>>>26;for(;0!==i&&o<e.length;o++)r=(0|e.words[o])+i,this.words[o]=67108863&r,i=r>>>26;if(this.length=e.length,0!==i)this.words[this.length]=i,this.length++;else if(e!==this)for(;o<e.length;o++)this.words[o]=e.words[o];return this},o.prototype.add=function(t){var r;return 0!==t.negative&&0===this.negative?(t.negative=0,r=this.sub(t),t.negative^=1,r):0===t.negative&&0!==this.negative?(this.negative=0,r=t.sub(this),this.negative=1,r):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 r=this.iadd(t);return t.negative=1,r._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var e,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(e=this,n=t):(e=t,n=this);for(var o=0,s=0;s<n.length;s++)o=(r=(0|e.words[s])-(0|n.words[s])+o)>>26,this.words[s]=67108863&r;for(;0!==o&&s<e.length;s++)o=(r=(0|e.words[s])+o)>>26,this.words[s]=67108863&r;if(0===o&&s<e.length&&e!==this)for(;s<e.length;s++)this.words[s]=e.words[s];return this.length=Math.max(this.length,s),e!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(t){return this.clone().isub(t)};var m=function(t,r,e){var n,i,o,s=t.words,h=r.words,u=e.words,a=0,l=0|s[0],f=8191&l,c=l>>>13,d=0|s[1],m=8191&d,p=d>>>13,g=0|s[2],v=8191&g,y=g>>>13,w=0|s[3],b=8191&w,M=w>>>13,_=0|s[4],E=8191&_,A=_>>>13,k=0|s[5],N=8191&k,x=k>>>13,P=0|s[6],I=8191&P,R=P>>>13,S=0|s[7],T=8191&S,O=S>>>13,B=0|s[8],C=8191&B,F=B>>>13,L=0|s[9],D=8191&L,U=L>>>13,z=0|h[0],q=8191&z,G=z>>>13,j=0|h[1],$=8191&j,Y=j>>>13,H=0|h[2],V=8191&H,Z=H>>>13,K=0|h[3],J=8191&K,W=K>>>13,X=0|h[4],Q=8191&X,tt=X>>>13,rt=0|h[5],et=8191&rt,nt=rt>>>13,it=0|h[6],ot=8191&it,st=it>>>13,ht=0|h[7],ut=8191&ht,at=ht>>>13,lt=0|h[8],ft=8191&lt,ct=lt>>>13,dt=0|h[9],mt=8191&dt,pt=dt>>>13;e.negative=t.negative^r.negative,e.length=19;var gt=(a+(n=Math.imul(f,q))|0)+((8191&(i=(i=Math.imul(f,G))+Math.imul(c,q)|0))<<13)|0;a=((o=Math.imul(c,G))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(m,q),i=(i=Math.imul(m,G))+Math.imul(p,q)|0,o=Math.imul(p,G);var vt=(a+(n=n+Math.imul(f,$)|0)|0)+((8191&(i=(i=i+Math.imul(f,Y)|0)+Math.imul(c,$)|0))<<13)|0;a=((o=o+Math.imul(c,Y)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(v,q),i=(i=Math.imul(v,G))+Math.imul(y,q)|0,o=Math.imul(y,G),n=n+Math.imul(m,$)|0,i=(i=i+Math.imul(m,Y)|0)+Math.imul(p,$)|0,o=o+Math.imul(p,Y)|0;var yt=(a+(n=n+Math.imul(f,V)|0)|0)+((8191&(i=(i=i+Math.imul(f,Z)|0)+Math.imul(c,V)|0))<<13)|0;a=((o=o+Math.imul(c,Z)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(b,q),i=(i=Math.imul(b,G))+Math.imul(M,q)|0,o=Math.imul(M,G),n=n+Math.imul(v,$)|0,i=(i=i+Math.imul(v,Y)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,Y)|0,n=n+Math.imul(m,V)|0,i=(i=i+Math.imul(m,Z)|0)+Math.imul(p,V)|0,o=o+Math.imul(p,Z)|0;var wt=(a+(n=n+Math.imul(f,J)|0)|0)+((8191&(i=(i=i+Math.imul(f,W)|0)+Math.imul(c,J)|0))<<13)|0;a=((o=o+Math.imul(c,W)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(E,q),i=(i=Math.imul(E,G))+Math.imul(A,q)|0,o=Math.imul(A,G),n=n+Math.imul(b,$)|0,i=(i=i+Math.imul(b,Y)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,Y)|0,n=n+Math.imul(v,V)|0,i=(i=i+Math.imul(v,Z)|0)+Math.imul(y,V)|0,o=o+Math.imul(y,Z)|0,n=n+Math.imul(m,J)|0,i=(i=i+Math.imul(m,W)|0)+Math.imul(p,J)|0,o=o+Math.imul(p,W)|0;var bt=(a+(n=n+Math.imul(f,Q)|0)|0)+((8191&(i=(i=i+Math.imul(f,tt)|0)+Math.imul(c,Q)|0))<<13)|0;a=((o=o+Math.imul(c,tt)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(N,q),i=(i=Math.imul(N,G))+Math.imul(x,q)|0,o=Math.imul(x,G),n=n+Math.imul(E,$)|0,i=(i=i+Math.imul(E,Y)|0)+Math.imul(A,$)|0,o=o+Math.imul(A,Y)|0,n=n+Math.imul(b,V)|0,i=(i=i+Math.imul(b,Z)|0)+Math.imul(M,V)|0,o=o+Math.imul(M,Z)|0,n=n+Math.imul(v,J)|0,i=(i=i+Math.imul(v,W)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,W)|0,n=n+Math.imul(m,Q)|0,i=(i=i+Math.imul(m,tt)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,tt)|0;var Mt=(a+(n=n+Math.imul(f,et)|0)|0)+((8191&(i=(i=i+Math.imul(f,nt)|0)+Math.imul(c,et)|0))<<13)|0;a=((o=o+Math.imul(c,nt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(I,q),i=(i=Math.imul(I,G))+Math.imul(R,q)|0,o=Math.imul(R,G),n=n+Math.imul(N,$)|0,i=(i=i+Math.imul(N,Y)|0)+Math.imul(x,$)|0,o=o+Math.imul(x,Y)|0,n=n+Math.imul(E,V)|0,i=(i=i+Math.imul(E,Z)|0)+Math.imul(A,V)|0,o=o+Math.imul(A,Z)|0,n=n+Math.imul(b,J)|0,i=(i=i+Math.imul(b,W)|0)+Math.imul(M,J)|0,o=o+Math.imul(M,W)|0,n=n+Math.imul(v,Q)|0,i=(i=i+Math.imul(v,tt)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,tt)|0,n=n+Math.imul(m,et)|0,i=(i=i+Math.imul(m,nt)|0)+Math.imul(p,et)|0,o=o+Math.imul(p,nt)|0;var _t=(a+(n=n+Math.imul(f,ot)|0)|0)+((8191&(i=(i=i+Math.imul(f,st)|0)+Math.imul(c,ot)|0))<<13)|0;a=((o=o+Math.imul(c,st)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(T,q),i=(i=Math.imul(T,G))+Math.imul(O,q)|0,o=Math.imul(O,G),n=n+Math.imul(I,$)|0,i=(i=i+Math.imul(I,Y)|0)+Math.imul(R,$)|0,o=o+Math.imul(R,Y)|0,n=n+Math.imul(N,V)|0,i=(i=i+Math.imul(N,Z)|0)+Math.imul(x,V)|0,o=o+Math.imul(x,Z)|0,n=n+Math.imul(E,J)|0,i=(i=i+Math.imul(E,W)|0)+Math.imul(A,J)|0,o=o+Math.imul(A,W)|0,n=n+Math.imul(b,Q)|0,i=(i=i+Math.imul(b,tt)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,tt)|0,n=n+Math.imul(v,et)|0,i=(i=i+Math.imul(v,nt)|0)+Math.imul(y,et)|0,o=o+Math.imul(y,nt)|0,n=n+Math.imul(m,ot)|0,i=(i=i+Math.imul(m,st)|0)+Math.imul(p,ot)|0,o=o+Math.imul(p,st)|0;var Et=(a+(n=n+Math.imul(f,ut)|0)|0)+((8191&(i=(i=i+Math.imul(f,at)|0)+Math.imul(c,ut)|0))<<13)|0;a=((o=o+Math.imul(c,at)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(C,q),i=(i=Math.imul(C,G))+Math.imul(F,q)|0,o=Math.imul(F,G),n=n+Math.imul(T,$)|0,i=(i=i+Math.imul(T,Y)|0)+Math.imul(O,$)|0,o=o+Math.imul(O,Y)|0,n=n+Math.imul(I,V)|0,i=(i=i+Math.imul(I,Z)|0)+Math.imul(R,V)|0,o=o+Math.imul(R,Z)|0,n=n+Math.imul(N,J)|0,i=(i=i+Math.imul(N,W)|0)+Math.imul(x,J)|0,o=o+Math.imul(x,W)|0,n=n+Math.imul(E,Q)|0,i=(i=i+Math.imul(E,tt)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,tt)|0,n=n+Math.imul(b,et)|0,i=(i=i+Math.imul(b,nt)|0)+Math.imul(M,et)|0,o=o+Math.imul(M,nt)|0,n=n+Math.imul(v,ot)|0,i=(i=i+Math.imul(v,st)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,st)|0,n=n+Math.imul(m,ut)|0,i=(i=i+Math.imul(m,at)|0)+Math.imul(p,ut)|0,o=o+Math.imul(p,at)|0;var At=(a+(n=n+Math.imul(f,ft)|0)|0)+((8191&(i=(i=i+Math.imul(f,ct)|0)+Math.imul(c,ft)|0))<<13)|0;a=((o=o+Math.imul(c,ct)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(D,q),i=(i=Math.imul(D,G))+Math.imul(U,q)|0,o=Math.imul(U,G),n=n+Math.imul(C,$)|0,i=(i=i+Math.imul(C,Y)|0)+Math.imul(F,$)|0,o=o+Math.imul(F,Y)|0,n=n+Math.imul(T,V)|0,i=(i=i+Math.imul(T,Z)|0)+Math.imul(O,V)|0,o=o+Math.imul(O,Z)|0,n=n+Math.imul(I,J)|0,i=(i=i+Math.imul(I,W)|0)+Math.imul(R,J)|0,o=o+Math.imul(R,W)|0,n=n+Math.imul(N,Q)|0,i=(i=i+Math.imul(N,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,n=n+Math.imul(E,et)|0,i=(i=i+Math.imul(E,nt)|0)+Math.imul(A,et)|0,o=o+Math.imul(A,nt)|0,n=n+Math.imul(b,ot)|0,i=(i=i+Math.imul(b,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|0,n=n+Math.imul(v,ut)|0,i=(i=i+Math.imul(v,at)|0)+Math.imul(y,ut)|0,o=o+Math.imul(y,at)|0,n=n+Math.imul(m,ft)|0,i=(i=i+Math.imul(m,ct)|0)+Math.imul(p,ft)|0,o=o+Math.imul(p,ct)|0;var kt=(a+(n=n+Math.imul(f,mt)|0)|0)+((8191&(i=(i=i+Math.imul(f,pt)|0)+Math.imul(c,mt)|0))<<13)|0;a=((o=o+Math.imul(c,pt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(D,$),i=(i=Math.imul(D,Y))+Math.imul(U,$)|0,o=Math.imul(U,Y),n=n+Math.imul(C,V)|0,i=(i=i+Math.imul(C,Z)|0)+Math.imul(F,V)|0,o=o+Math.imul(F,Z)|0,n=n+Math.imul(T,J)|0,i=(i=i+Math.imul(T,W)|0)+Math.imul(O,J)|0,o=o+Math.imul(O,W)|0,n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,tt)|0,n=n+Math.imul(N,et)|0,i=(i=i+Math.imul(N,nt)|0)+Math.imul(x,et)|0,o=o+Math.imul(x,nt)|0,n=n+Math.imul(E,ot)|0,i=(i=i+Math.imul(E,st)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,st)|0,n=n+Math.imul(b,ut)|0,i=(i=i+Math.imul(b,at)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,at)|0,n=n+Math.imul(v,ft)|0,i=(i=i+Math.imul(v,ct)|0)+Math.imul(y,ft)|0,o=o+Math.imul(y,ct)|0;var Nt=(a+(n=n+Math.imul(m,mt)|0)|0)+((8191&(i=(i=i+Math.imul(m,pt)|0)+Math.imul(p,mt)|0))<<13)|0;a=((o=o+Math.imul(p,pt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(D,V),i=(i=Math.imul(D,Z))+Math.imul(U,V)|0,o=Math.imul(U,Z),n=n+Math.imul(C,J)|0,i=(i=i+Math.imul(C,W)|0)+Math.imul(F,J)|0,o=o+Math.imul(F,W)|0,n=n+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,tt)|0)+Math.imul(O,Q)|0,o=o+Math.imul(O,tt)|0,n=n+Math.imul(I,et)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(R,et)|0,o=o+Math.imul(R,nt)|0,n=n+Math.imul(N,ot)|0,i=(i=i+Math.imul(N,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,n=n+Math.imul(E,ut)|0,i=(i=i+Math.imul(E,at)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,at)|0,n=n+Math.imul(b,ft)|0,i=(i=i+Math.imul(b,ct)|0)+Math.imul(M,ft)|0,o=o+Math.imul(M,ct)|0;var xt=(a+(n=n+Math.imul(v,mt)|0)|0)+((8191&(i=(i=i+Math.imul(v,pt)|0)+Math.imul(y,mt)|0))<<13)|0;a=((o=o+Math.imul(y,pt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(D,J),i=(i=Math.imul(D,W))+Math.imul(U,J)|0,o=Math.imul(U,W),n=n+Math.imul(C,Q)|0,i=(i=i+Math.imul(C,tt)|0)+Math.imul(F,Q)|0,o=o+Math.imul(F,tt)|0,n=n+Math.imul(T,et)|0,i=(i=i+Math.imul(T,nt)|0)+Math.imul(O,et)|0,o=o+Math.imul(O,nt)|0,n=n+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,st)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,st)|0,n=n+Math.imul(N,ut)|0,i=(i=i+Math.imul(N,at)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,at)|0,n=n+Math.imul(E,ft)|0,i=(i=i+Math.imul(E,ct)|0)+Math.imul(A,ft)|0,o=o+Math.imul(A,ct)|0;var Pt=(a+(n=n+Math.imul(b,mt)|0)|0)+((8191&(i=(i=i+Math.imul(b,pt)|0)+Math.imul(M,mt)|0))<<13)|0;a=((o=o+Math.imul(M,pt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(D,Q),i=(i=Math.imul(D,tt))+Math.imul(U,Q)|0,o=Math.imul(U,tt),n=n+Math.imul(C,et)|0,i=(i=i+Math.imul(C,nt)|0)+Math.imul(F,et)|0,o=o+Math.imul(F,nt)|0,n=n+Math.imul(T,ot)|0,i=(i=i+Math.imul(T,st)|0)+Math.imul(O,ot)|0,o=o+Math.imul(O,st)|0,n=n+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,at)|0)+Math.imul(R,ut)|0,o=o+Math.imul(R,at)|0,n=n+Math.imul(N,ft)|0,i=(i=i+Math.imul(N,ct)|0)+Math.imul(x,ft)|0,o=o+Math.imul(x,ct)|0;var It=(a+(n=n+Math.imul(E,mt)|0)|0)+((8191&(i=(i=i+Math.imul(E,pt)|0)+Math.imul(A,mt)|0))<<13)|0;a=((o=o+Math.imul(A,pt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(D,et),i=(i=Math.imul(D,nt))+Math.imul(U,et)|0,o=Math.imul(U,nt),n=n+Math.imul(C,ot)|0,i=(i=i+Math.imul(C,st)|0)+Math.imul(F,ot)|0,o=o+Math.imul(F,st)|0,n=n+Math.imul(T,ut)|0,i=(i=i+Math.imul(T,at)|0)+Math.imul(O,ut)|0,o=o+Math.imul(O,at)|0,n=n+Math.imul(I,ft)|0,i=(i=i+Math.imul(I,ct)|0)+Math.imul(R,ft)|0,o=o+Math.imul(R,ct)|0;var Rt=(a+(n=n+Math.imul(N,mt)|0)|0)+((8191&(i=(i=i+Math.imul(N,pt)|0)+Math.imul(x,mt)|0))<<13)|0;a=((o=o+Math.imul(x,pt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(D,ot),i=(i=Math.imul(D,st))+Math.imul(U,ot)|0,o=Math.imul(U,st),n=n+Math.imul(C,ut)|0,i=(i=i+Math.imul(C,at)|0)+Math.imul(F,ut)|0,o=o+Math.imul(F,at)|0,n=n+Math.imul(T,ft)|0,i=(i=i+Math.imul(T,ct)|0)+Math.imul(O,ft)|0,o=o+Math.imul(O,ct)|0;var St=(a+(n=n+Math.imul(I,mt)|0)|0)+((8191&(i=(i=i+Math.imul(I,pt)|0)+Math.imul(R,mt)|0))<<13)|0;a=((o=o+Math.imul(R,pt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(D,ut),i=(i=Math.imul(D,at))+Math.imul(U,ut)|0,o=Math.imul(U,at),n=n+Math.imul(C,ft)|0,i=(i=i+Math.imul(C,ct)|0)+Math.imul(F,ft)|0,o=o+Math.imul(F,ct)|0;var Tt=(a+(n=n+Math.imul(T,mt)|0)|0)+((8191&(i=(i=i+Math.imul(T,pt)|0)+Math.imul(O,mt)|0))<<13)|0;a=((o=o+Math.imul(O,pt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(D,ft),i=(i=Math.imul(D,ct))+Math.imul(U,ft)|0,o=Math.imul(U,ct);var Ot=(a+(n=n+Math.imul(C,mt)|0)|0)+((8191&(i=(i=i+Math.imul(C,pt)|0)+Math.imul(F,mt)|0))<<13)|0;a=((o=o+Math.imul(F,pt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863;var Bt=(a+(n=Math.imul(D,mt))|0)+((8191&(i=(i=Math.imul(D,pt))+Math.imul(U,mt)|0))<<13)|0;return a=((o=Math.imul(U,pt))+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,u[0]=gt,u[1]=vt,u[2]=yt,u[3]=wt,u[4]=bt,u[5]=Mt,u[6]=_t,u[7]=Et,u[8]=At,u[9]=kt,u[10]=Nt,u[11]=xt,u[12]=Pt,u[13]=It,u[14]=Rt,u[15]=St,u[16]=Tt,u[17]=Ot,u[18]=Bt,0!==a&&(u[19]=a,e.length++),e};function p(t,r,e){return(new g).mulp(t,r,e)}function g(t,r){this.x=t,this.y=r}Math.imul||(m=d),o.prototype.mulTo=function(t,r){var e,n=this.length+t.length;return e=10===this.length&&10===t.length?m(this,t,r):n<63?d(this,t,r):n<1024?function(t,r,e){e.negative=r.negative^t.negative,e.length=t.length+r.length;for(var n=0,i=0,o=0;o<e.length-1;o++){var s=i;i=0;for(var h=67108863&n,u=Math.min(o,r.length-1),a=Math.max(0,o-t.length+1);a<=u;a++){var l=o-a,f=(0|t.words[l])*(0|r.words[a]),c=67108863&f;h=67108863&(c=c+h|0),i+=(s=(s=s+(f/67108864|0)|0)+(c>>>26)|0)>>>26,s&=67108863}e.words[o]=h,n=s,s=i}return 0!==n?e.words[o]=n:e.length--,e.strip()}(this,t,r):p(this,t,r),e},g.prototype.makeRBT=function(t){for(var r=new Array(t),e=o.prototype._countBits(t)-1,n=0;n<t;n++)r[n]=this.revBin(n,e,t);return r},g.prototype.revBin=function(t,r,e){if(0===t||t===e-1)return t;for(var n=0,i=0;i<r;i++)n|=(1&t)<<r-i-1,t>>=1;return n},g.prototype.permute=function(t,r,e,n,i,o){for(var s=0;s<o;s++)n[s]=r[t[s]],i[s]=e[t[s]]},g.prototype.transform=function(t,r,e,n,i,o){this.permute(o,t,r,e,n,i);for(var s=1;s<i;s<<=1)for(var h=s<<1,u=Math.cos(2*Math.PI/h),a=Math.sin(2*Math.PI/h),l=0;l<i;l+=h)for(var f=u,c=a,d=0;d<s;d++){var m=e[l+d],p=n[l+d],g=e[l+d+s],v=n[l+d+s],y=f*g-c*v;v=f*v+c*g,g=y,e[l+d]=m+g,n[l+d]=p+v,e[l+d+s]=m-g,n[l+d+s]=p-v,d!==h&&(y=u*f-a*c,c=u*c+a*f,f=y)}},g.prototype.guessLen13b=function(t,r){var e=1|Math.max(r,t),n=1&e,i=0;for(e=e/2|0;e;e>>>=1)i++;return 1<<i+1+n},g.prototype.conjugate=function(t,r,e){if(!(e<=1))for(var n=0;n<e/2;n++){var i=t[n];t[n]=t[e-n-1],t[e-n-1]=i,i=r[n],r[n]=-r[e-n-1],r[e-n-1]=-i}},g.prototype.normalize13b=function(t,r){for(var e=0,n=0;n<r/2;n++){var i=8192*Math.round(t[2*n+1]/r)+Math.round(t[2*n]/r)+e;t[n]=67108863&i,e=i<67108864?0:i/67108864|0}return t},g.prototype.convert13b=function(t,r,e,i){for(var o=0,s=0;s<r;s++)o+=0|t[s],e[2*s]=8191&o,o>>>=13,e[2*s+1]=8191&o,o>>>=13;for(s=2*r;s<i;++s)e[s]=0;n(0===o),n(0===(-8192&o))},g.prototype.stub=function(t){for(var r=new Array(t),e=0;e<t;e++)r[e]=0;return r},g.prototype.mulp=function(t,r,e){var n=2*this.guessLen13b(t.length,r.length),i=this.makeRBT(n),o=this.stub(n),s=new Array(n),h=new Array(n),u=new Array(n),a=new Array(n),l=new Array(n),f=new Array(n),c=e.words;c.length=n,this.convert13b(t.words,t.length,s,n),this.convert13b(r.words,r.length,a,n),this.transform(s,o,h,u,n,i),this.transform(a,o,l,f,n,i);for(var d=0;d<n;d++){var m=h[d]*l[d]-u[d]*f[d];u[d]=h[d]*f[d]+u[d]*l[d],h[d]=m}return this.conjugate(h,u,n),this.transform(h,u,c,o,n,i),this.conjugate(c,o,n),this.normalize13b(c,n),e.negative=t.negative^r.negative,e.length=t.length+r.length,e.strip()},o.prototype.mul=function(t){var r=new o(null);return r.words=new Array(this.length+t.length),this.mulTo(t,r)},o.prototype.mulf=function(t){var r=new o(null);return r.words=new Array(this.length+t.length),p(this,t,r)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.prototype.imuln=function(t){n("number"===typeof t),n(t<67108864);for(var r=0,e=0;e<this.length;e++){var i=(0|this.words[e])*t,o=(67108863&i)+(67108863&r);r>>=26,r+=i/67108864|0,r+=o>>>26,this.words[e]=67108863&o}return 0!==r&&(this.words[e]=r,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 r=function(t){for(var r=new Array(t.bitLength()),e=0;e<r.length;e++){var n=e/26|0,i=e%26;r[e]=(t.words[n]&1<<i)>>>i}return r}(t);if(0===r.length)return new o(1);for(var e=this,n=0;n<r.length&&0===r[n];n++,e=e.sqr());if(++n<r.length)for(var i=e.sqr();n<r.length;n++,i=i.sqr())0!==r[n]&&(e=e.mul(i));return e},o.prototype.iushln=function(t){n("number"===typeof t&&t>=0);var r,e=t%26,i=(t-e)/26,o=67108863>>>26-e<<26-e;if(0!==e){var s=0;for(r=0;r<this.length;r++){var h=this.words[r]&o,u=(0|this.words[r])-h<<e;this.words[r]=u|s,s=h>>>26-e}s&&(this.words[r]=s,this.length++)}if(0!==i){for(r=this.length-1;r>=0;r--)this.words[r+i]=this.words[r];for(r=0;r<i;r++)this.words[r]=0;this.length+=i}return this.strip()},o.prototype.ishln=function(t){return n(0===this.negative),this.iushln(t)},o.prototype.iushrn=function(t,r,e){var i;n("number"===typeof t&&t>=0),i=r?(r-r%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),h=67108863^67108863>>>o<<o,u=e;if(i-=s,i=Math.max(0,i),u){for(var a=0;a<s;a++)u.words[a]=this.words[a];u.length=s}if(0===s);else if(this.length>s)for(this.length-=s,a=0;a<this.length;a++)this.words[a]=this.words[a+s];else this.words[0]=0,this.length=1;var l=0;for(a=this.length-1;a>=0&&(0!==l||a>=i);a--){var f=0|this.words[a];this.words[a]=l<<26-o|f>>>o,l=f&h}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,r,e){return n(0===this.negative),this.iushrn(t,r,e)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"===typeof t&&t>=0);var r=t%26,e=(t-r)/26,i=1<<r;return!(this.length<=e)&&!!(this.words[e]&i)},o.prototype.imaskn=function(t){n("number"===typeof t&&t>=0);var r=t%26,e=(t-r)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=e)return this;if(0!==r&&e++,this.length=Math.min(e,this.length),0!==r){var i=67108863^67108863>>>r<<r;this.words[this.length-1]&=i}return this.strip()},o.prototype.maskn=function(t){return this.clone().imaskn(t)},o.prototype.iaddn=function(t){return n("number"===typeof t),n(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},o.prototype._iaddn=function(t){this.words[0]+=t;for(var r=0;r<this.length&&this.words[r]>=67108864;r++)this.words[r]-=67108864,r===this.length-1?this.words[r+1]=1:this.words[r+1]++;return this.length=Math.max(this.length,r+1),this},o.prototype.isubn=function(t){if(n("number"===typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var r=0;r<this.length&&this.words[r]<0;r++)this.words[r]+=67108864,this.words[r+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,r,e){var i,o,s=t.length+e;this._expand(s);var h=0;for(i=0;i<t.length;i++){o=(0|this.words[i+e])+h;var u=(0|t.words[i])*r;h=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+e]=67108863&o}for(;i<this.length-e;i++)h=(o=(0|this.words[i+e])+h)>>26,this.words[i+e]=67108863&o;if(0===h)return this.strip();for(n(-1===h),h=0,i=0;i<this.length;i++)h=(o=-(0|this.words[i])+h)>>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,r){var e=(this.length,t.length),n=this.clone(),i=t,s=0|i.words[i.length-1];0!==(e=26-this._countBits(s))&&(i=i.ushln(e),n.iushln(e),s=0|i.words[i.length-1]);var h,u=n.length-i.length;if("mod"!==r){(h=new o(null)).length=u+1,h.words=new Array(h.length);for(var a=0;a<h.length;a++)h.words[a]=0}var l=n.clone()._ishlnsubmul(i,1,u);0===l.negative&&(n=l,h&&(h.words[u]=1));for(var f=u-1;f>=0;f--){var c=67108864*(0|n.words[i.length+f])+(0|n.words[i.length+f-1]);for(c=Math.min(c/s|0,67108863),n._ishlnsubmul(i,c,f);0!==n.negative;)c--,n.negative=0,n._ishlnsubmul(i,1,f),n.isZero()||(n.negative^=1);h&&(h.words[f]=c)}return h&&h.strip(),n.strip(),"div"!==r&&0!==e&&n.iushrn(e),{div:h||null,mod:n}},o.prototype.divmod=function(t,r,e){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(h=this.neg().divmod(t,r),"mod"!==r&&(i=h.div.neg()),"div"!==r&&(s=h.mod.neg(),e&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(h=this.divmod(t.neg(),r),"mod"!==r&&(i=h.div.neg()),{div:i,mod:h.mod}):0!==(this.negative&t.negative)?(h=this.neg().divmod(t.neg(),r),"div"!==r&&(s=h.mod.neg(),e&&0!==s.negative&&s.isub(t)),{div:h.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===r?{div:this.divn(t.words[0]),mod:null}:"mod"===r?{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,r);var i,s,h},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 r=this.divmod(t);if(r.mod.isZero())return r.div;var e=0!==r.div.negative?r.mod.isub(t):r.mod,n=t.ushrn(1),i=t.andln(1),o=e.cmp(n);return o<0||1===i&&0===o?r.div:0!==r.div.negative?r.div.isubn(1):r.div.iaddn(1)},o.prototype.modn=function(t){n(t<=67108863);for(var r=(1<<26)%t,e=0,i=this.length-1;i>=0;i--)e=(r*e+(0|this.words[i]))%t;return e},o.prototype.idivn=function(t){n(t<=67108863);for(var r=0,e=this.length-1;e>=0;e--){var i=(0|this.words[e])+67108864*r;this.words[e]=i/t|0,r=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var r=this,e=t.clone();r=0!==r.negative?r.umod(t):r.clone();for(var i=new o(1),s=new o(0),h=new o(0),u=new o(1),a=0;r.isEven()&&e.isEven();)r.iushrn(1),e.iushrn(1),++a;for(var l=e.clone(),f=r.clone();!r.isZero();){for(var c=0,d=1;0===(r.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(r.iushrn(c);c-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(l),s.isub(f)),i.iushrn(1),s.iushrn(1);for(var m=0,p=1;0===(e.words[0]&p)&&m<26;++m,p<<=1);if(m>0)for(e.iushrn(m);m-- >0;)(h.isOdd()||u.isOdd())&&(h.iadd(l),u.isub(f)),h.iushrn(1),u.iushrn(1);r.cmp(e)>=0?(r.isub(e),i.isub(h),s.isub(u)):(e.isub(r),h.isub(i),u.isub(s))}return{a:h,b:u,gcd:e.iushln(a)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var r=this,e=t.clone();r=0!==r.negative?r.umod(t):r.clone();for(var i,s=new o(1),h=new o(0),u=e.clone();r.cmpn(1)>0&&e.cmpn(1)>0;){for(var a=0,l=1;0===(r.words[0]&l)&&a<26;++a,l<<=1);if(a>0)for(r.iushrn(a);a-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var f=0,c=1;0===(e.words[0]&c)&&f<26;++f,c<<=1);if(f>0)for(e.iushrn(f);f-- >0;)h.isOdd()&&h.iadd(u),h.iushrn(1);r.cmp(e)>=0?(r.isub(e),s.isub(h)):(e.isub(r),h.isub(s))}return(i=0===r.cmpn(1)?s:h).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 r=this.clone(),e=t.clone();r.negative=0,e.negative=0;for(var n=0;r.isEven()&&e.isEven();n++)r.iushrn(1),e.iushrn(1);for(;;){for(;r.isEven();)r.iushrn(1);for(;e.isEven();)e.iushrn(1);var i=r.cmp(e);if(i<0){var o=r;r=e,e=o}else if(0===i||0===e.cmpn(1))break;r.isub(e)}return e.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0===(1&this.words[0])},o.prototype.isOdd=function(){return 1===(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"===typeof t);var r=t%26,e=(t-r)/26,i=1<<r;if(this.length<=e)return this._expand(e+1),this.words[e]|=i,this;for(var o=i,s=e;0!==o&&s<this.length;s++){var h=0|this.words[s];o=(h+=o)>>>26,h&=67108863,this.words[s]=h}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var r,e=t<0;if(0!==this.negative&&!e)return-1;if(0===this.negative&&e)return 1;if(this.strip(),this.length>1)r=1;else{e&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];r=i===t?0:i<t?-1:1}return 0!==this.negative?0|-r:r},o.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var r=this.ucmp(t);return 0!==this.negative?0|-r:r},o.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var r=0,e=this.length-1;e>=0;e--){var n=0|this.words[e],i=0|t.words[e];if(n!==i){n<i?r=-1:n>i&&(r=1);break}}return r},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 E(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function y(t,r){this.name=t,this.p=new o(r,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function b(){y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function M(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(t){if("string"===typeof t){var r=o._prime(t);this.m=r.p,this.prime=r}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function A(t){E.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 r,e=t;do{this.split(e,this.tmp),r=(e=(e=this.imulK(e)).iadd(this.tmp)).bitLength()}while(r>this.n);var n=r<this.n?-1:e.ucmp(this.p);return 0===n?(e.words[0]=0,e.length=1):n>0?e.isub(this.p):void 0!==e.strip?e.strip():e._strip(),e},y.prototype.split=function(t,r){t.iushrn(this.n,0,r)},y.prototype.imulK=function(t){return t.imul(this.k)},i(w,y),w.prototype.split=function(t,r){for(var e=4194303,n=Math.min(t.length,9),i=0;i<n;i++)r.words[i]=t.words[i];if(r.length=n,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(r.words[r.length++]=o&e,i=10;i<t.length;i++){var s=0|t.words[i];t.words[i-10]=(s&e)<<4|o>>>22,o=s}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 r=0,e=0;e<t.length;e++){var n=0|t.words[e];r+=977*n,t.words[e]=67108863&r,r=64*n+(r/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(b,y),i(M,y),i(_,y),_.prototype.imulK=function(t){for(var r=0,e=0;e<t.length;e++){var n=19*(0|t.words[e])+r,i=67108863&n;n>>>=26,t.words[e]=i,r=n}return 0!==r&&(t.words[t.length++]=r),t},o._prime=function(t){if(v[t])return v[t];var r;if("k256"===t)r=new w;else if("p224"===t)r=new b;else if("p192"===t)r=new M;else{if("p25519"!==t)throw new Error("Unknown prime "+t);r=new _}return v[t]=r,r},E.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},E.prototype._verify2=function(t,r){n(0===(t.negative|r.negative),"red works only with positives"),n(t.red&&t.red===r.red,"red works only with red numbers")},E.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},E.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},E.prototype.add=function(t,r){this._verify2(t,r);var e=t.add(r);return e.cmp(this.m)>=0&&e.isub(this.m),e._forceRed(this)},E.prototype.iadd=function(t,r){this._verify2(t,r);var e=t.iadd(r);return e.cmp(this.m)>=0&&e.isub(this.m),e},E.prototype.sub=function(t,r){this._verify2(t,r);var e=t.sub(r);return e.cmpn(0)<0&&e.iadd(this.m),e._forceRed(this)},E.prototype.isub=function(t,r){this._verify2(t,r);var e=t.isub(r);return e.cmpn(0)<0&&e.iadd(this.m),e},E.prototype.shl=function(t,r){return this._verify1(t),this.imod(t.ushln(r))},E.prototype.imul=function(t,r){return this._verify2(t,r),this.imod(t.imul(r))},E.prototype.mul=function(t,r){return this._verify2(t,r),this.imod(t.mul(r))},E.prototype.isqr=function(t){return this.imul(t,t.clone())},E.prototype.sqr=function(t){return this.mul(t,t)},E.prototype.sqrt=function(t){if(t.isZero())return t.clone();var r=this.m.andln(3);if(n(r%2===1),3===r){var e=this.m.add(new o(1)).iushrn(2);return this.pow(t,e)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var h=new o(1).toRed(this),u=h.redNeg(),a=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,a).cmp(u);)l.redIAdd(u);for(var f=this.pow(l,i),c=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),m=s;0!==d.cmp(h);){for(var p=d,g=0;0!==p.cmp(h);g++)p=p.redSqr();n(g<m);var v=this.pow(f,new o(1).iushln(m-g-1));c=c.redMul(v),f=v.redSqr(),d=d.redMul(f),m=g}return c},E.prototype.invm=function(t){var r=t._invmp(this.m);return 0!==r.negative?(r.negative=0,this.imod(r).redNeg()):this.imod(r)},E.prototype.pow=function(t,r){if(r.isZero())return new o(1).toRed(this);if(0===r.cmpn(1))return t.clone();var e=new Array(16);e[0]=new o(1).toRed(this),e[1]=t;for(var n=2;n<e.length;n++)e[n]=this.mul(e[n-1],t);var i=e[0],s=0,h=0,u=r.bitLength()%26;for(0===u&&(u=26),n=r.length-1;n>=0;n--){for(var a=r.words[n],l=u-1;l>=0;l--){var f=a>>l&1;i!==e[0]&&(i=this.sqr(i)),0!==f||0!==s?(s<<=1,s|=f,(4===++h||0===n&&0===l)&&(i=this.mul(i,e[s]),h=0,s=0)):h=0}u=26}return i},E.prototype.convertTo=function(t){var r=t.umod(this.m);return r===t?r.clone():r},E.prototype.convertFrom=function(t){var r=t.clone();return r.red=null,r},o.mont=function(t){return new A(t)},i(A,E),A.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},A.prototype.convertFrom=function(t){var r=this.imod(t.mul(this.rinv));return r.red=null,r},A.prototype.imul=function(t,r){if(t.isZero()||r.isZero())return t.words[0]=0,t.length=1,t;var e=t.imul(r),n=e.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=e.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},A.prototype.mul=function(t,r){if(t.isZero()||r.isZero())return new o(0)._forceRed(this);var e=t.mul(r),n=e.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=e.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},A.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=e.nmd(t),this)},9251:function(t,r,e){"use strict";e.d(r,{Uj:function(){return o},uu:function(){return f},Y0:function(){return l},XL:function(){return d},ZN:function(){return c}});var n=e(6441);const i=new(e(1581).Yd)("strings/5.5.0");var o,s;function h(t,r,e,n,i){if(t===s.BAD_PREFIX||t===s.UNEXPECTED_CONTINUE){let t=0;for(let n=r+1;n<e.length&&e[n]>>6===2;n++)t++;return t}return t===s.OVERRUN?e.length-r-1:0}!function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"}(o||(o={})),function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"}(s||(s={}));const u=Object.freeze({error:function(t,r,e,n,o){return i.throwArgumentError(`invalid codepoint at offset ${r}; ${t}`,"bytes",e)},ignore:h,replace:function(t,r,e,n,i){return t===s.OVERLONG?(n.push(i),0):(n.push(65533),h(t,r,e))}});function a(t,r){null==r&&(r=u.error),t=(0,n.lE)(t);const e=[];let i=0;for(;i<t.length;){const n=t[i++];if(n>>7===0){e.push(n);continue}let o=null,h=null;if(192===(224&n))o=1,h=127;else if(224===(240&n))o=2,h=2047;else{if(240!==(248&n)){i+=r(128===(192&n)?s.UNEXPECTED_CONTINUE:s.BAD_PREFIX,i-1,t,e);continue}o=3,h=65535}if(i-1+o>=t.length){i+=r(s.OVERRUN,i-1,t,e);continue}let u=n&(1<<8-o-1)-1;for(let a=0;a<o;a++){let n=t[i];if(128!=(192&n)){i+=r(s.MISSING_CONTINUE,i,t,e),u=null;break}u=u<<6|63&n,i++}null!==u&&(u>1114111?i+=r(s.OUT_OF_RANGE,i-1-o,t,e,u):u>=55296&&u<=57343?i+=r(s.UTF16_SURROGATE,i-1-o,t,e,u):u<=h?i+=r(s.OVERLONG,i-1-o,t,e,u):e.push(u))}return e}function l(t,r=o.current){r!=o.current&&(i.checkNormalize(),t=t.normalize(r));let e=[];for(let n=0;n<t.length;n++){const r=t.charCodeAt(n);if(r<128)e.push(r);else if(r<2048)e.push(r>>6|192),e.push(63&r|128);else if(55296==(64512&r)){n++;const i=t.charCodeAt(n);if(n>=t.length||56320!==(64512&i))throw new Error("invalid utf-8 string");const o=65536+((1023&r)<<10)+(1023&i);e.push(o>>18|240),e.push(o>>12&63|128),e.push(o>>6&63|128),e.push(63&o|128)}else e.push(r>>12|224),e.push(r>>6&63|128),e.push(63&r|128)}return(0,n.lE)(e)}function f(t){return t.map((t=>t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10&1023),56320+(1023&t))))).join("")}function c(t,r){return f(a(t,r))}function d(t,r=o.current){return a(l(t,r))}},639:function(t,r,e){"use strict";e.d(r,{z7:function(){return at},Qc:function(){return mt}});var n=e(9485),i=e(6731),o=e(6441),s=e(1046),h=e(8197),u=e(9052),a=e(2500),l=e.n(a),f=e(3715),c=e.n(f);"undefined"!==typeof globalThis?globalThis:"undefined"!==typeof window?window:"undefined"!==typeof e.g?e.g:"undefined"!==typeof self&&self;function d(t,r,e){return e={path:r,exports:{},require:function(t,r){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}((void 0===r||null===r)&&e.path)}},t(e,e.exports),e.exports}var m=p;function p(t,r){if(!t)throw new Error(r||"Assertion failed")}p.equal=function(t,r,e){if(t!=r)throw new Error(e||"Assertion failed: "+t+" != "+r)};var g=d((function(t,r){var e=r;function n(t){return 1===t.length?"0"+t:t}function i(t){for(var r="",e=0;e<t.length;e++)r+=n(t[e].toString(16));return r}e.toArray=function(t,r){if(Array.isArray(t))return t.slice();if(!t)return[];var e=[];if("string"!==typeof t){for(var n=0;n<t.length;n++)e[n]=0|t[n];return e}if("hex"===r){(t=t.replace(/[^a-z0-9]+/gi,"")).length%2!==0&&(t="0"+t);for(n=0;n<t.length;n+=2)e.push(parseInt(t[n]+t[n+1],16))}else for(n=0;n<t.length;n++){var i=t.charCodeAt(n),o=i>>8,s=255&i;o?e.push(o,s):e.push(s)}return e},e.zero2=n,e.toHex=i,e.encode=function(t,r){return"hex"===r?i(t):t}})),v=d((function(t,r){var e=r;e.assert=m,e.toArray=g.toArray,e.zero2=g.zero2,e.toHex=g.toHex,e.encode=g.encode,e.getNAF=function(t,r,e){var n=new Array(Math.max(t.bitLength(),e)+1);n.fill(0);for(var i=1<<r+1,o=t.clone(),s=0;s<n.length;s++){var h,u=o.andln(i-1);o.isOdd()?(h=u>(i>>1)-1?(i>>1)-u:u,o.isubn(h)):h=0,n[s]=h,o.iushrn(1)}return n},e.getJSF=function(t,r){var e=[[],[]];t=t.clone(),r=r.clone();for(var n,i=0,o=0;t.cmpn(-i)>0||r.cmpn(-o)>0;){var s,h,u=t.andln(3)+i&3,a=r.andln(3)+o&3;3===u&&(u=-1),3===a&&(a=-1),s=0===(1&u)?0:3!==(n=t.andln(7)+i&7)&&5!==n||2!==a?u:-u,e[0].push(s),h=0===(1&a)?0:3!==(n=r.andln(7)+o&7)&&5!==n||2!==u?a:-a,e[1].push(h),2*i===s+1&&(i=1-i),2*o===h+1&&(o=1-o),t.iushrn(1),r.iushrn(1)}return e},e.cachedProperty=function(t,r,e){var n="_"+r;t.prototype[r]=function(){return void 0!==this[n]?this[n]:this[n]=e.call(this)}},e.parseBytes=function(t){return"string"===typeof t?e.toArray(t,"hex"):t},e.intFromLE=function(t){return new(l())(t,"hex","le")}})),y=v.getNAF,w=v.getJSF,b=v.assert;function M(t,r){this.type=t,this.p=new(l())(r.p,16),this.red=r.prime?l().red(r.prime):l().mont(this.p),this.zero=new(l())(0).toRed(this.red),this.one=new(l())(1).toRed(this.red),this.two=new(l())(2).toRed(this.red),this.n=r.n&&new(l())(r.n,16),this.g=r.g&&this.pointFromJSON(r.g,r.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 e=this.n&&this.p.div(this.n);!e||e.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var _=M;function E(t,r){this.curve=t,this.type=r,this.precomputed=null}M.prototype.point=function(){throw new Error("Not implemented")},M.prototype.validate=function(){throw new Error("Not implemented")},M.prototype._fixedNafMul=function(t,r){b(t.precomputed);var e=t._getDoubles(),n=y(r,1,this._bitLength),i=(1<<e.step+1)-(e.step%2===0?2:1);i/=3;var o,s,h=[];for(o=0;o<n.length;o+=e.step){s=0;for(var u=o+e.step-1;u>=o;u--)s=(s<<1)+n[u];h.push(s)}for(var a=this.jpoint(null,null,null),l=this.jpoint(null,null,null),f=i;f>0;f--){for(o=0;o<h.length;o++)(s=h[o])===f?l=l.mixedAdd(e.points[o]):s===-f&&(l=l.mixedAdd(e.points[o].neg()));a=a.add(l)}return a.toP()},M.prototype._wnafMul=function(t,r){var e=4,n=t._getNAFPoints(e);e=n.wnd;for(var i=n.points,o=y(r,e,this._bitLength),s=this.jpoint(null,null,null),h=o.length-1;h>=0;h--){for(var u=0;h>=0&&0===o[h];h--)u++;if(h>=0&&u++,s=s.dblp(u),h<0)break;var a=o[h];b(0!==a),s="affine"===t.type?a>0?s.mixedAdd(i[a-1>>1]):s.mixedAdd(i[-a-1>>1].neg()):a>0?s.add(i[a-1>>1]):s.add(i[-a-1>>1].neg())}return"affine"===t.type?s.toP():s},M.prototype._wnafMulAdd=function(t,r,e,n,i){var o,s,h,u=this._wnafT1,a=this._wnafT2,l=this._wnafT3,f=0;for(o=0;o<n;o++){var c=(h=r[o])._getNAFPoints(t);u[o]=c.wnd,a[o]=c.points}for(o=n-1;o>=1;o-=2){var d=o-1,m=o;if(1===u[d]&&1===u[m]){var p=[r[d],null,null,r[m]];0===r[d].y.cmp(r[m].y)?(p[1]=r[d].add(r[m]),p[2]=r[d].toJ().mixedAdd(r[m].neg())):0===r[d].y.cmp(r[m].y.redNeg())?(p[1]=r[d].toJ().mixedAdd(r[m]),p[2]=r[d].add(r[m].neg())):(p[1]=r[d].toJ().mixedAdd(r[m]),p[2]=r[d].toJ().mixedAdd(r[m].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],v=w(e[d],e[m]);for(f=Math.max(v[0].length,f),l[d]=new Array(f),l[m]=new Array(f),s=0;s<f;s++){var b=0|v[0][s],M=0|v[1][s];l[d][s]=g[3*(b+1)+(M+1)],l[m][s]=0,a[d]=p}}else l[d]=y(e[d],u[d],this._bitLength),l[m]=y(e[m],u[m],this._bitLength),f=Math.max(l[d].length,f),f=Math.max(l[m].length,f)}var _=this.jpoint(null,null,null),E=this._wnafT4;for(o=f;o>=0;o--){for(var A=0;o>=0;){var k=!0;for(s=0;s<n;s++)E[s]=0|l[s][o],0!==E[s]&&(k=!1);if(!k)break;A++,o--}if(o>=0&&A++,_=_.dblp(A),o<0)break;for(s=0;s<n;s++){var N=E[s];0!==N&&(N>0?h=a[s][N-1>>1]:N<0&&(h=a[s][-N-1>>1].neg()),_="affine"===h.type?_.mixedAdd(h):_.add(h))}}for(o=0;o<n;o++)a[o]=null;return i?_:_.toP()},M.BasePoint=E,E.prototype.eq=function(){throw new Error("Not implemented")},E.prototype.validate=function(){return this.curve.validate(this)},M.prototype.decodePoint=function(t,r){t=v.toArray(t,r);var e=this.p.byteLength();if((4===t[0]||6===t[0]||7===t[0])&&t.length-1===2*e)return 6===t[0]?b(t[t.length-1]%2===0):7===t[0]&&b(t[t.length-1]%2===1),this.point(t.slice(1,1+e),t.slice(1+e,1+2*e));if((2===t[0]||3===t[0])&&t.length-1===e)return this.pointFromX(t.slice(1,1+e),3===t[0]);throw new Error("Unknown point format")},E.prototype.encodeCompressed=function(t){return this.encode(t,!0)},E.prototype._encode=function(t){var r=this.curve.p.byteLength(),e=this.getX().toArray("be",r);return t?[this.getY().isEven()?2:3].concat(e):[4].concat(e,this.getY().toArray("be",r))},E.prototype.encode=function(t,r){return v.encode(this._encode(r),t)},E.prototype.precompute=function(t){if(this.precomputed)return this;var r={doubles:null,naf:null,beta:null};return r.naf=this._getNAFPoints(8),r.doubles=this._getDoubles(4,t),r.beta=this._getBeta(),this.precomputed=r,this},E.prototype._hasDoubles=function(t){if(!this.precomputed)return!1;var r=this.precomputed.doubles;return!!r&&r.points.length>=Math.ceil((t.bitLength()+1)/r.step)},E.prototype._getDoubles=function(t,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var e=[this],n=this,i=0;i<r;i+=t){for(var o=0;o<t;o++)n=n.dbl();e.push(n)}return{step:t,points:e}},E.prototype._getNAFPoints=function(t){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var r=[this],e=(1<<t)-1,n=1===e?null:this.dbl(),i=1;i<e;i++)r[i]=r[i-1].add(n);return{wnd:t,points:r}},E.prototype._getBeta=function(){return null},E.prototype.dblp=function(t){for(var r=this,e=0;e<t;e++)r=r.dbl();return r};var A=d((function(t){"function"===typeof Object.create?t.exports=function(t,r){r&&(t.super_=r,t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,r){if(r){t.super_=r;var e=function(){};e.prototype=r.prototype,t.prototype=new e,t.prototype.constructor=t}}})),k=v.assert;function N(t){_.call(this,"short",t),this.a=new(l())(t.a,16).toRed(this.red),this.b=new(l())(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)}A(N,_);var x=N;function P(t,r,e,n){_.BasePoint.call(this,t,"affine"),null===r&&null===e?(this.x=null,this.y=null,this.inf=!0):(this.x=new(l())(r,16),this.y=new(l())(e,16),n&&(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 I(t,r,e,n){_.BasePoint.call(this,t,"jacobian"),null===r&&null===e&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new(l())(0)):(this.x=new(l())(r,16),this.y=new(l())(e,16),this.z=new(l())(n,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}N.prototype._getEndomorphism=function(t){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var r,e;if(t.beta)r=new(l())(t.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);r=(r=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(t.lambda)e=new(l())(t.lambda,16);else{var i=this._getEndoRoots(this.n);0===this.g.mul(i[0]).x.cmp(this.g.x.redMul(r))?e=i[0]:(e=i[1],k(0===this.g.mul(e).x.cmp(this.g.x.redMul(r))))}return{beta:r,lambda:e,basis:t.basis?t.basis.map((function(t){return{a:new(l())(t.a,16),b:new(l())(t.b,16)}})):this._getEndoBasis(e)}}},N.prototype._getEndoRoots=function(t){var r=t===this.p?this.red:l().mont(t),e=new(l())(2).toRed(r).redInvm(),n=e.redNeg(),i=new(l())(3).toRed(r).redNeg().redSqrt().redMul(e);return[n.redAdd(i).fromRed(),n.redSub(i).fromRed()]},N.prototype._getEndoBasis=function(t){for(var r,e,n,i,o,s,h,u,a,f=this.n.ushrn(Math.floor(this.n.bitLength()/2)),c=t,d=this.n.clone(),m=new(l())(1),p=new(l())(0),g=new(l())(0),v=new(l())(1),y=0;0!==c.cmpn(0);){var w=d.div(c);u=d.sub(w.mul(c)),a=g.sub(w.mul(m));var b=v.sub(w.mul(p));if(!n&&u.cmp(f)<0)r=h.neg(),e=m,n=u.neg(),i=a;else if(n&&2===++y)break;h=u,d=c,c=u,g=m,m=a,v=p,p=b}o=u.neg(),s=a;var M=n.sqr().add(i.sqr());return o.sqr().add(s.sqr()).cmp(M)>=0&&(o=r,s=e),n.negative&&(n=n.neg(),i=i.neg()),o.negative&&(o=o.neg(),s=s.neg()),[{a:n,b:i},{a:o,b:s}]},N.prototype._endoSplit=function(t){var r=this.endo.basis,e=r[0],n=r[1],i=n.b.mul(t).divRound(this.n),o=e.b.neg().mul(t).divRound(this.n),s=i.mul(e.a),h=o.mul(n.a),u=i.mul(e.b),a=o.mul(n.b);return{k1:t.sub(s).sub(h),k2:u.add(a).neg()}},N.prototype.pointFromX=function(t,r){(t=new(l())(t,16)).red||(t=t.toRed(this.red));var e=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),n=e.redSqrt();if(0!==n.redSqr().redSub(e).cmp(this.zero))throw new Error("invalid point");var i=n.fromRed().isOdd();return(r&&!i||!r&&i)&&(n=n.redNeg()),this.point(t,n)},N.prototype.validate=function(t){if(t.inf)return!0;var r=t.x,e=t.y,n=this.a.redMul(r),i=r.redSqr().redMul(r).redIAdd(n).redIAdd(this.b);return 0===e.redSqr().redISub(i).cmpn(0)},N.prototype._endoWnafMulAdd=function(t,r,e){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o<t.length;o++){var s=this._endoSplit(r[o]),h=t[o],u=h._getBeta();s.k1.negative&&(s.k1.ineg(),h=h.neg(!0)),s.k2.negative&&(s.k2.ineg(),u=u.neg(!0)),n[2*o]=h,n[2*o+1]=u,i[2*o]=s.k1,i[2*o+1]=s.k2}for(var a=this._wnafMulAdd(1,n,i,2*o,e),l=0;l<2*o;l++)n[l]=null,i[l]=null;return a},A(P,_.BasePoint),N.prototype.point=function(t,r,e){return new P(this,t,r,e)},N.prototype.pointFromJSON=function(t,r){return P.fromJSON(this,t,r)},P.prototype._getBeta=function(){if(this.curve.endo){var t=this.precomputed;if(t&&t.beta)return t.beta;var r=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(t){var e=this.curve,n=function(t){return e.point(t.x.redMul(e.endo.beta),t.y)};t.beta=r,r.precomputed={beta:null,naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(n)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(n)}}}return r}},P.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]},P.fromJSON=function(t,r,e){"string"===typeof r&&(r=JSON.parse(r));var n=t.point(r[0],r[1],e);if(!r[2])return n;function i(r){return t.point(r[0],r[1],e)}var o=r[2];return n.precomputed={beta:null,doubles:o.doubles&&{step:o.doubles.step,points:[n].concat(o.doubles.points.map(i))},naf:o.naf&&{wnd:o.naf.wnd,points:[n].concat(o.naf.points.map(i))}},n},P.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)+">"},P.prototype.isInfinity=function(){return this.inf},P.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 r=this.y.redSub(t.y);0!==r.cmpn(0)&&(r=r.redMul(this.x.redSub(t.x).redInvm()));var e=r.redSqr().redISub(this.x).redISub(t.x),n=r.redMul(this.x.redSub(e)).redISub(this.y);return this.curve.point(e,n)},P.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 r=this.curve.a,e=this.x.redSqr(),n=t.redInvm(),i=e.redAdd(e).redIAdd(e).redIAdd(r).redMul(n),o=i.redSqr().redISub(this.x.redAdd(this.x)),s=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,s)},P.prototype.getX=function(){return this.x.fromRed()},P.prototype.getY=function(){return this.y.fromRed()},P.prototype.mul=function(t){return t=new(l())(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)},P.prototype.mulAdd=function(t,r,e){var n=[this,r],i=[t,e];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},P.prototype.jmulAdd=function(t,r,e){var n=[this,r],i=[t,e];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},P.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))},P.prototype.neg=function(t){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var e=this.precomputed,n=function(t){return t.neg()};r.precomputed={naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(n)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(n)}}}return r},P.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},A(I,_.BasePoint),N.prototype.jpoint=function(t,r,e){return new I(this,t,r,e)},I.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),r=t.redSqr(),e=this.x.redMul(r),n=this.y.redMul(r).redMul(t);return this.curve.point(e,n)},I.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},I.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var r=t.z.redSqr(),e=this.z.redSqr(),n=this.x.redMul(r),i=t.x.redMul(e),o=this.y.redMul(r.redMul(t.z)),s=t.y.redMul(e.redMul(this.z)),h=n.redSub(i),u=o.redSub(s);if(0===h.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var a=h.redSqr(),l=a.redMul(h),f=n.redMul(a),c=u.redSqr().redIAdd(l).redISub(f).redISub(f),d=u.redMul(f.redISub(c)).redISub(o.redMul(l)),m=this.z.redMul(t.z).redMul(h);return this.curve.jpoint(c,d,m)},I.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var r=this.z.redSqr(),e=this.x,n=t.x.redMul(r),i=this.y,o=t.y.redMul(r).redMul(this.z),s=e.redSub(n),h=i.redSub(o);if(0===s.cmpn(0))return 0!==h.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=s.redSqr(),a=u.redMul(s),l=e.redMul(u),f=h.redSqr().redIAdd(a).redISub(l).redISub(l),c=h.redMul(l.redISub(f)).redISub(i.redMul(a)),d=this.z.redMul(s);return this.curve.jpoint(f,c,d)},I.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var e=this;for(r=0;r<t;r++)e=e.dbl();return e}var n=this.curve.a,i=this.curve.tinv,o=this.x,s=this.y,h=this.z,u=h.redSqr().redSqr(),a=s.redAdd(s);for(r=0;r<t;r++){var l=o.redSqr(),f=a.redSqr(),c=f.redSqr(),d=l.redAdd(l).redIAdd(l).redIAdd(n.redMul(u)),m=o.redMul(f),p=d.redSqr().redISub(m.redAdd(m)),g=m.redISub(p),v=d.redMul(g);v=v.redIAdd(v).redISub(c);var y=a.redMul(h);r+1<t&&(u=u.redMul(c)),o=p,h=y,a=v}return this.curve.jpoint(o,a.redMul(i),h)},I.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},I.prototype._zeroDbl=function(){var t,r,e;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),s=this.x.redAdd(i).redSqr().redISub(n).redISub(o);s=s.redIAdd(s);var h=n.redAdd(n).redIAdd(n),u=h.redSqr().redISub(s).redISub(s),a=o.redIAdd(o);a=(a=a.redIAdd(a)).redIAdd(a),t=u,r=h.redMul(s.redISub(u)).redISub(a),e=this.y.redAdd(this.y)}else{var l=this.x.redSqr(),f=this.y.redSqr(),c=f.redSqr(),d=this.x.redAdd(f).redSqr().redISub(l).redISub(c);d=d.redIAdd(d);var m=l.redAdd(l).redIAdd(l),p=m.redSqr(),g=c.redIAdd(c);g=(g=g.redIAdd(g)).redIAdd(g),t=p.redISub(d).redISub(d),r=m.redMul(d.redISub(t)).redISub(g),e=(e=this.y.redMul(this.z)).redIAdd(e)}return this.curve.jpoint(t,r,e)},I.prototype._threeDbl=function(){var t,r,e;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),s=this.x.redAdd(i).redSqr().redISub(n).redISub(o);s=s.redIAdd(s);var h=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),u=h.redSqr().redISub(s).redISub(s);t=u;var a=o.redIAdd(o);a=(a=a.redIAdd(a)).redIAdd(a),r=h.redMul(s.redISub(u)).redISub(a),e=this.y.redAdd(this.y)}else{var l=this.z.redSqr(),f=this.y.redSqr(),c=this.x.redMul(f),d=this.x.redSub(l).redMul(this.x.redAdd(l));d=d.redAdd(d).redIAdd(d);var m=c.redIAdd(c),p=(m=m.redIAdd(m)).redAdd(m);t=d.redSqr().redISub(p),e=this.y.redAdd(this.z).redSqr().redISub(f).redISub(l);var g=f.redSqr();g=(g=(g=g.redIAdd(g)).redIAdd(g)).redIAdd(g),r=d.redMul(m.redISub(t)).redISub(g)}return this.curve.jpoint(t,r,e)},I.prototype._dbl=function(){var t=this.curve.a,r=this.x,e=this.y,n=this.z,i=n.redSqr().redSqr(),o=r.redSqr(),s=e.redSqr(),h=o.redAdd(o).redIAdd(o).redIAdd(t.redMul(i)),u=r.redAdd(r),a=(u=u.redIAdd(u)).redMul(s),l=h.redSqr().redISub(a.redAdd(a)),f=a.redISub(l),c=s.redSqr();c=(c=(c=c.redIAdd(c)).redIAdd(c)).redIAdd(c);var d=h.redMul(f).redISub(c),m=e.redAdd(e).redMul(n);return this.curve.jpoint(l,d,m)},I.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var t=this.x.redSqr(),r=this.y.redSqr(),e=this.z.redSqr(),n=r.redSqr(),i=t.redAdd(t).redIAdd(t),o=i.redSqr(),s=this.x.redAdd(r).redSqr().redISub(t).redISub(n),h=(s=(s=(s=s.redIAdd(s)).redAdd(s).redIAdd(s)).redISub(o)).redSqr(),u=n.redIAdd(n);u=(u=(u=u.redIAdd(u)).redIAdd(u)).redIAdd(u);var a=i.redIAdd(s).redSqr().redISub(o).redISub(h).redISub(u),l=r.redMul(a);l=(l=l.redIAdd(l)).redIAdd(l);var f=this.x.redMul(h).redISub(l);f=(f=f.redIAdd(f)).redIAdd(f);var c=this.y.redMul(a.redMul(u.redISub(a)).redISub(s.redMul(h)));c=(c=(c=c.redIAdd(c)).redIAdd(c)).redIAdd(c);var d=this.z.redAdd(s).redSqr().redISub(e).redISub(h);return this.curve.jpoint(f,c,d)},I.prototype.mul=function(t,r){return t=new(l())(t,r),this.curve._wnafMul(this,t)},I.prototype.eq=function(t){if("affine"===t.type)return this.eq(t.toJ());if(this===t)return!0;var r=this.z.redSqr(),e=t.z.redSqr();if(0!==this.x.redMul(e).redISub(t.x.redMul(r)).cmpn(0))return!1;var n=r.redMul(this.z),i=e.redMul(t.z);return 0===this.y.redMul(i).redISub(t.y.redMul(n)).cmpn(0)},I.prototype.eqXToP=function(t){var r=this.z.redSqr(),e=t.toRed(this.curve.red).redMul(r);if(0===this.x.cmp(e))return!0;for(var n=t.clone(),i=this.curve.redN.redMul(r);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(e.redIAdd(i),0===this.x.cmp(e))return!0}},I.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)+">"},I.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var R=d((function(t,r){var e=r;e.base=_,e.short=x,e.mont=null,e.edwards=null})),S=d((function(t,r){var e,n=r,i=v.assert;function o(t){"short"===t.type?this.curve=new R.short(t):"edwards"===t.type?this.curve=new R.edwards(t):this.curve=new R.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function s(t,r){Object.defineProperty(n,t,{configurable:!0,enumerable:!0,get:function(){var e=new o(r);return Object.defineProperty(n,t,{configurable:!0,enumerable:!0,value:e}),e}})}n.PresetCurve=o,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:c().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:c().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:c().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:c().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:c().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:c().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:c().sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{e=null.crash()}catch(h){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:c().sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",e]})}));function T(t){if(!(this instanceof T))return new T(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 r=g.toArray(t.entropy,t.entropyEnc||"hex"),e=g.toArray(t.nonce,t.nonceEnc||"hex"),n=g.toArray(t.pers,t.persEnc||"hex");m(r.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(r,e,n)}var O=T;T.prototype._init=function(t,r,e){var n=t.concat(r).concat(e);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(n),this._reseed=1,this.reseedInterval=281474976710656},T.prototype._hmac=function(){return new(c().hmac)(this.hash,this.K)},T.prototype._update=function(t){var r=this._hmac().update(this.V).update([0]);t&&(r=r.update(t)),this.K=r.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())},T.prototype.reseed=function(t,r,e,n){"string"!==typeof r&&(n=e,e=r,r=null),t=g.toArray(t,r),e=g.toArray(e,n),m(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(e||[])),this._reseed=1},T.prototype.generate=function(t,r,e,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!==typeof r&&(n=e,e=r,r=null),e&&(e=g.toArray(e,n||"hex"),this._update(e));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(e),this._reseed++,g.encode(o,r)};var B=v.assert;function C(t,r){this.ec=t,this.priv=null,this.pub=null,r.priv&&this._importPrivate(r.priv,r.privEnc),r.pub&&this._importPublic(r.pub,r.pubEnc)}var F=C;C.fromPublic=function(t,r,e){return r instanceof C?r:new C(t,{pub:r,pubEnc:e})},C.fromPrivate=function(t,r,e){return r instanceof C?r:new C(t,{priv:r,privEnc:e})},C.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"}},C.prototype.getPublic=function(t,r){return"string"===typeof t&&(r=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),r?this.pub.encode(r,t):this.pub},C.prototype.getPrivate=function(t){return"hex"===t?this.priv.toString(16,2):this.priv},C.prototype._importPrivate=function(t,r){this.priv=new(l())(t,r||16),this.priv=this.priv.umod(this.ec.curve.n)},C.prototype._importPublic=function(t,r){if(t.x||t.y)return"mont"===this.ec.curve.type?B(t.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||B(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,r)},C.prototype.derive=function(t){return t.validate()||B(t.validate(),"public point not validated"),t.mul(this.priv).getX()},C.prototype.sign=function(t,r,e){return this.ec.sign(t,this,r,e)},C.prototype.verify=function(t,r){return this.ec.verify(t,r,this)},C.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var L=v.assert;function D(t,r){if(t instanceof D)return t;this._importDER(t,r)||(L(t.r&&t.s,"Signature without r or s"),this.r=new(l())(t.r,16),this.s=new(l())(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var U=D;function z(){this.place=0}function q(t,r){var e=t[r.place++];if(!(128&e))return e;var n=15&e;if(0===n||n>4)return!1;for(var i=0,o=0,s=r.place;o<n;o++,s++)i<<=8,i|=t[s],i>>>=0;return!(i<=127)&&(r.place=s,i)}function G(t){for(var r=0,e=t.length-1;!t[r]&&!(128&t[r+1])&&r<e;)r++;return 0===r?t:t.slice(r)}function j(t,r){if(r<128)t.push(r);else{var e=1+(Math.log(r)/Math.LN2>>>3);for(t.push(128|e);--e;)t.push(r>>>(e<<3)&255);t.push(r)}}D.prototype._importDER=function(t,r){t=v.toArray(t,r);var e=new z;if(48!==t[e.place++])return!1;var n=q(t,e);if(!1===n)return!1;if(n+e.place!==t.length)return!1;if(2!==t[e.place++])return!1;var i=q(t,e);if(!1===i)return!1;var o=t.slice(e.place,i+e.place);if(e.place+=i,2!==t[e.place++])return!1;var s=q(t,e);if(!1===s)return!1;if(t.length!==s+e.place)return!1;var h=t.slice(e.place,s+e.place);if(0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===h[0]){if(!(128&h[1]))return!1;h=h.slice(1)}return this.r=new(l())(o),this.s=new(l())(h),this.recoveryParam=null,!0},D.prototype.toDER=function(t){var r=this.r.toArray(),e=this.s.toArray();for(128&r[0]&&(r=[0].concat(r)),128&e[0]&&(e=[0].concat(e)),r=G(r),e=G(e);!e[0]&&!(128&e[1]);)e=e.slice(1);var n=[2];j(n,r.length),(n=n.concat(r)).push(2),j(n,e.length);var i=n.concat(e),o=[48];return j(o,i.length),o=o.concat(i),v.encode(o,t)};var $=function(){throw new Error("unsupported")},Y=v.assert;function H(t){if(!(this instanceof H))return new H(t);"string"===typeof t&&(Y(Object.prototype.hasOwnProperty.call(S,t),"Unknown curve "+t),t=S[t]),t instanceof S.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 V=H;H.prototype.keyPair=function(t){return new F(this,t)},H.prototype.keyFromPrivate=function(t,r){return F.fromPrivate(this,t,r)},H.prototype.keyFromPublic=function(t,r){return F.fromPublic(this,t,r)},H.prototype.genKeyPair=function(t){t||(t={});for(var r=new O({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||$(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),e=this.n.byteLength(),n=this.n.sub(new(l())(2));;){var i=new(l())(r.generate(e));if(!(i.cmp(n)>0))return i.iaddn(1),this.keyFromPrivate(i)}},H.prototype._truncateToN=function(t,r){var e=8*t.byteLength()-this.n.bitLength();return e>0&&(t=t.ushrn(e)),!r&&t.cmp(this.n)>=0?t.sub(this.n):t},H.prototype.sign=function(t,r,e,n){"object"===typeof e&&(n=e,e=null),n||(n={}),r=this.keyFromPrivate(r,e),t=this._truncateToN(new(l())(t,16));for(var i=this.n.byteLength(),o=r.getPrivate().toArray("be",i),s=t.toArray("be",i),h=new O({hash:this.hash,entropy:o,nonce:s,pers:n.pers,persEnc:n.persEnc||"utf8"}),u=this.n.sub(new(l())(1)),a=0;;a++){var f=n.k?n.k(a):new(l())(h.generate(this.n.byteLength()));if(!((f=this._truncateToN(f,!0)).cmpn(1)<=0||f.cmp(u)>=0)){var c=this.g.mul(f);if(!c.isInfinity()){var d=c.getX(),m=d.umod(this.n);if(0!==m.cmpn(0)){var p=f.invm(this.n).mul(m.mul(r.getPrivate()).iadd(t));if(0!==(p=p.umod(this.n)).cmpn(0)){var g=(c.getY().isOdd()?1:0)|(0!==d.cmp(m)?2:0);return n.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),g^=1),new U({r:m,s:p,recoveryParam:g})}}}}}},H.prototype.verify=function(t,r,e,n){t=this._truncateToN(new(l())(t,16)),e=this.keyFromPublic(e,n);var i=(r=new U(r,"hex")).r,o=r.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 s,h=o.invm(this.n),u=h.mul(t).umod(this.n),a=h.mul(i).umod(this.n);return this.curve._maxwellTrick?!(s=this.g.jmulAdd(u,e.getPublic(),a)).isInfinity()&&s.eqXToP(i):!(s=this.g.mulAdd(u,e.getPublic(),a)).isInfinity()&&0===s.getX().umod(this.n).cmp(i)},H.prototype.recoverPubKey=function(t,r,e,n){Y((3&e)===e,"The recovery param is more than two bits"),r=new U(r,n);var i=this.n,o=new(l())(t),s=r.r,h=r.s,u=1&e,a=e>>1;if(s.cmp(this.curve.p.umod(this.curve.n))>=0&&a)throw new Error("Unable to find sencond key candinate");s=a?this.curve.pointFromX(s.add(this.curve.n),u):this.curve.pointFromX(s,u);var f=r.r.invm(i),c=i.sub(o).mul(f).umod(i),d=h.mul(f).umod(i);return this.g.mulAdd(c,s,d)},H.prototype.getKeyRecoveryParam=function(t,r,e,n){if(null!==(r=new U(r,n)).recoveryParam)return r.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,r,i)}catch(t){continue}if(o.eq(e))return i}throw new Error("Unable to find valid recovery factor")};var Z=d((function(t,r){var e=r;e.version="6.5.4",e.utils=v,e.rand=function(){throw new Error("unsupported")},e.curve=R,e.curves=S,e.ec=V,e.eddsa=null})).ec,K=e(6881),J=e(1581);const W=new J.Yd("signing-key/5.5.0");let X=null;function Q(){return X||(X=new Z("secp256k1")),X}class tt{constructor(t){(0,K.zG)(this,"curve","secp256k1"),(0,K.zG)(this,"privateKey",(0,o.Dv)(t));const r=Q().keyFromPrivate((0,o.lE)(this.privateKey));(0,K.zG)(this,"publicKey","0x"+r.getPublic(!1,"hex")),(0,K.zG)(this,"compressedPublicKey","0x"+r.getPublic(!0,"hex")),(0,K.zG)(this,"_isSigningKey",!0)}_addPoint(t){const r=Q().keyFromPublic((0,o.lE)(this.publicKey)),e=Q().keyFromPublic((0,o.lE)(t));return"0x"+r.pub.add(e.pub).encodeCompressed("hex")}signDigest(t){const r=Q().keyFromPrivate((0,o.lE)(this.privateKey)),e=(0,o.lE)(t);32!==e.length&&W.throwArgumentError("bad digest length","digest",t);const n=r.sign(e,{canonical:!0});return(0,o.N)({recoveryParam:n.recoveryParam,r:(0,o.$m)("0x"+n.r.toString(16),32),s:(0,o.$m)("0x"+n.s.toString(16),32)})}computeSharedSecret(t){const r=Q().keyFromPrivate((0,o.lE)(this.privateKey)),e=Q().keyFromPublic((0,o.lE)(rt(t)));return(0,o.$m)("0x"+r.derive(e.getPublic()).toString(16),32)}static isSigningKey(t){return!(!t||!t._isSigningKey)}}function rt(t,r){const e=(0,o.lE)(t);if(32===e.length){const t=new tt(e);return r?"0x"+Q().keyFromPrivate(e).getPublic(!0,"hex"):t.publicKey}return 33===e.length?r?(0,o.Dv)(e):"0x"+Q().keyFromPublic(e).getPublic(!1,"hex"):65===e.length?r?"0x"+Q().keyFromPublic(e).getPublic(!0,"hex"):(0,o.Dv)(e):W.throwArgumentError("invalid public or private key","key","[REDACTED]")}const et=new J.Yd("transactions/5.5.0");var nt;function it(t){return"0x"===t?null:(0,n.Kn)(t)}function ot(t){return"0x"===t?s._Y:i.O$.from(t)}!function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"}(nt||(nt={}));function st(t,r){return function(t){const r=rt(t);return(0,n.Kn)((0,o.p3)((0,h.w)((0,o.p3)(r,1)),12))}(function(t,r){const e=(0,o.N)(r),n={r:(0,o.lE)(e.r),s:(0,o.lE)(e.s)};return"0x"+Q().recoverPubKey((0,o.lE)(t),n,e.recoveryParam).encode("hex",!1)}((0,o.lE)(t),r))}function ht(t,r){const e=(0,o.G1)(i.O$.from(t).toHexString());return e.length>32&&et.throwArgumentError("invalid length for "+r,"transaction:"+r,t),e}function ut(t,r){return{address:(0,n.Kn)(t),storageKeys:(r||[]).map(((r,e)=>(32!==(0,o.E1)(r)&&et.throwArgumentError("invalid access list storageKey",`accessList[${t}:${e}]`,r),r.toLowerCase())))}}function at(t){if(Array.isArray(t))return t.map(((t,r)=>Array.isArray(t)?(t.length>2&&et.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${r}]`,t),ut(t[0],t[1])):ut(t.address,t.storageKeys)));const r=Object.keys(t).map((r=>{const e=t[r].reduce(((t,r)=>(t[r]=!0,t)),{});return ut(r,Object.keys(e).sort())}));return r.sort(((t,r)=>t.address.localeCompare(r.address))),r}function lt(t){return at(t).map((t=>[t.address,t.storageKeys]))}function ft(t,r){if(null!=t.gasPrice){const r=i.O$.from(t.gasPrice),e=i.O$.from(t.maxFeePerGas||0);r.eq(e)||et.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:r,maxFeePerGas:e})}const e=[ht(t.chainId||0,"chainId"),ht(t.nonce||0,"nonce"),ht(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),ht(t.maxFeePerGas||0,"maxFeePerGas"),ht(t.gasLimit||0,"gasLimit"),null!=t.to?(0,n.Kn)(t.to):"0x",ht(t.value||0,"value"),t.data||"0x",lt(t.accessList||[])];if(r){const t=(0,o.N)(r);e.push(ht(t.recoveryParam,"recoveryParam")),e.push((0,o.G1)(t.r)),e.push((0,o.G1)(t.s))}return(0,o.xs)(["0x02",u.c(e)])}function ct(t,r){const e=[ht(t.chainId||0,"chainId"),ht(t.nonce||0,"nonce"),ht(t.gasPrice||0,"gasPrice"),ht(t.gasLimit||0,"gasLimit"),null!=t.to?(0,n.Kn)(t.to):"0x",ht(t.value||0,"value"),t.data||"0x",lt(t.accessList||[])];if(r){const t=(0,o.N)(r);e.push(ht(t.recoveryParam,"recoveryParam")),e.push((0,o.G1)(t.r)),e.push((0,o.G1)(t.s))}return(0,o.xs)(["0x01",u.c(e)])}function dt(t,r,e){try{const e=ot(r[0]).toNumber();if(0!==e&&1!==e)throw new Error("bad recid");t.v=e}catch(n){et.throwArgumentError("invalid v for transaction type: 1","v",r[0])}t.r=(0,o.$m)(r[1],32),t.s=(0,o.$m)(r[2],32);try{const r=(0,h.w)(e(t));t.from=st(r,{r:t.r,s:t.s,recoveryParam:t.v})}catch(n){console.log(n)}}function mt(t){const r=(0,o.lE)(t);if(r[0]>127)return function(t){const r=u.J(t);9!==r.length&&6!==r.length&&et.throwArgumentError("invalid raw transaction","rawTransaction",t);const e={nonce:ot(r[0]).toNumber(),gasPrice:ot(r[1]),gasLimit:ot(r[2]),to:it(r[3]),value:ot(r[4]),data:r[5],chainId:0};if(6===r.length)return e;try{e.v=i.O$.from(r[6]).toNumber()}catch(n){return console.log(n),e}if(e.r=(0,o.$m)(r[7],32),e.s=(0,o.$m)(r[8],32),i.O$.from(e.r).isZero()&&i.O$.from(e.s).isZero())e.chainId=e.v,e.v=0;else{e.chainId=Math.floor((e.v-35)/2),e.chainId<0&&(e.chainId=0);let i=e.v-27;const s=r.slice(0,6);0!==e.chainId&&(s.push((0,o.Dv)(e.chainId)),s.push("0x"),s.push("0x"),i-=2*e.chainId+8);const a=(0,h.w)(u.c(s));try{e.from=st(a,{r:(0,o.Dv)(e.r),s:(0,o.Dv)(e.s),recoveryParam:i})}catch(n){console.log(n)}e.hash=(0,h.w)(t)}return e.type=null,e}(r);switch(r[0]){case 1:return function(t){const r=u.J(t.slice(1));8!==r.length&&11!==r.length&&et.throwArgumentError("invalid component count for transaction type: 1","payload",(0,o.Dv)(t));const e={type:1,chainId:ot(r[0]).toNumber(),nonce:ot(r[1]).toNumber(),gasPrice:ot(r[2]),gasLimit:ot(r[3]),to:it(r[4]),value:ot(r[5]),data:r[6],accessList:at(r[7])};return 8===r.length||(e.hash=(0,h.w)(t),dt(e,r.slice(8),ct)),e}(r);case 2:return function(t){const r=u.J(t.slice(1));9!==r.length&&12!==r.length&&et.throwArgumentError("invalid component count for transaction type: 2","payload",(0,o.Dv)(t));const e=ot(r[2]),n=ot(r[3]),i={type:2,chainId:ot(r[0]).toNumber(),nonce:ot(r[1]).toNumber(),maxPriorityFeePerGas:e,maxFeePerGas:n,gasPrice:null,gasLimit:ot(r[4]),to:it(r[5]),value:ot(r[6]),data:r[7],accessList:at(r[8])};return 9===r.length||(i.hash=(0,h.w)(t),dt(i,r.slice(9),ft)),i}(r)}return et.throwError(`unsupported transaction type: ${r[0]}`,J.Yd.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:r[0]})}},9795:function(t,r,e){"use strict";e.d(r,{Ht:function(){return x},Ge:function(){return P}});var n=e(7294),i="Invariant failed";function o(t,r){if(!t)throw new Error(i)}var s=e(3653),h=e(6441),u=e(8197);function a(){return a=Object.assign||function(t){for(var r=1;r<arguments.length;r++){var e=arguments[r];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t},a.apply(this,arguments)}function l(t,r){t.prototype=Object.create(r.prototype),t.prototype.constructor=t,c(t,r)}function f(t){return f=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},f(t)}function c(t,r){return c=Object.setPrototypeOf||function(t,r){return t.__proto__=r,t},c(t,r)}function d(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}function m(t,r,e){return m=d()?Reflect.construct:function(t,r,e){var n=[null];n.push.apply(n,r);var i=new(Function.bind.apply(t,n));return e&&c(i,e.prototype),i},m.apply(null,arguments)}function p(t){var r="function"===typeof Map?new Map:void 0;return p=function(t){if(null===t||(e=t,-1===Function.toString.call(e).indexOf("[native code]")))return t;var e;if("function"!==typeof t)throw new TypeError("Super expression must either be null or a function");if("undefined"!==typeof r){if(r.has(t))return r.get(t);r.set(t,n)}function n(){return m(t,arguments,f(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),c(n,t)},p(t)}"undefined"!==typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!==typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));function g(t,r){try{var e=t()}catch(n){return r(n)}return e&&e.then?e.then(void 0,r):e}function v(t){if("string"===typeof t){t=t.replace(/^Ox/,"0x");var r=Number.parseInt(t,"0x"===t.trim().substring(0,2)?16:10);return Number.isNaN(r)&&o(!1),r}return Number.isInteger(t)||o(!1),t}function y(t){"string"===typeof t&&t.match(/^(0x)?[0-9a-fA-F]{40}$/)||o(!1);for(var r="0x"===t.substring(0,2)?t:"0x"+t,e=r.toLowerCase().substring(2).split(""),n=new Uint8Array(40),i=0;i<40;i++)n[i]=e[i].charCodeAt(0);for(var s=(0,h.lE)((0,u.w)(n)),a=0;a<40;a+=2)s[a>>1]>>4>=8&&(e[a]=e[a].toUpperCase()),(15&s[a>>1])>=8&&(e[a+1]=e[a+1].toUpperCase());var l="0x"+e.join("");return r.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&r!==l&&o(!1),l}var w,b=function(t,r){try{var e=function(e){return Promise.resolve(Promise.all([void 0===r.chainId?t.getChainId():r.chainId,void 0===r.account?t.getAccount():r.account])).then((function(r){var n=r[0],i=r[1],o=v(n);if(t.supportedChainIds&&!t.supportedChainIds.includes(o))throw new _(o,t.supportedChainIds);var s=null===i?i:y(i);return{provider:e,chainId:o,account:s}}))},n=void 0===r.provider;return Promise.resolve(n?Promise.resolve(t.getProvider()).then(e):e(r.provider))}catch(i){return Promise.reject(i)}},M=function(t){function r(){var r;return(r=t.call(this)||this).name=r.constructor.name,r}return l(r,t),r}(p(Error)),_=function(t){function r(r,e){var n;return(n=t.call(this)||this).name=n.constructor.name,n.message="Unsupported chain id: "+r+". Supported chain ids are: "+e+".",n}return l(r,t),r}(p(Error));function E(t,r){var e=r.type,n=r.payload;switch(e){case w.ACTIVATE_CONNECTOR:return{connector:n.connector,provider:n.provider,chainId:n.chainId,account:n.account,onError:n.onError};case w.UPDATE:var i=n.provider,o=n.chainId,s=n.account;return a({},t,void 0===i?{}:{provider:i},void 0===o?{}:{chainId:o},void 0===s?{}:{account:s});case w.UPDATE_FROM_ERROR:var h=n.provider,u=n.chainId,l=n.account;return a({},t,void 0===h?{}:{provider:h},void 0===u?{}:{chainId:u},void 0===l?{}:{account:l},{error:void 0});case w.ERROR:var f=n.error;return{connector:t.connector,error:f,onError:t.onError};case w.ERROR_FROM_ACTIVATION:return{connector:n.connector,error:n.error};case w.DEACTIVATE_CONNECTOR:return{}}}!function(t){t[t.ACTIVATE_CONNECTOR=0]="ACTIVATE_CONNECTOR",t[t.UPDATE=1]="UPDATE",t[t.UPDATE_FROM_ERROR=2]="UPDATE_FROM_ERROR",t[t.ERROR=3]="ERROR",t[t.ERROR_FROM_ACTIVATION=4]="ERROR_FROM_ACTIVATION",t[t.DEACTIVATE_CONNECTOR=5]="DEACTIVATE_CONNECTOR"}(w||(w={}));var A="primary",k={};function N(t){k[t]&&o(!1),k[t]=(0,n.createContext)({activate:function(){try{return o(!1),Promise.resolve()}catch(t){return Promise.reject(t)}},setError:function(){o(!1)},deactivate:function(){o(!1)},active:!1}),k[t].displayName="Web3ReactContext - "+t;var r=k[t].Provider;return function(t){var e=t.getLibrary,i=t.children,o=function(){var t=(0,n.useReducer)(E,{}),r=t[0],e=t[1],i=r.connector,o=r.provider,h=r.chainId,u=r.account,l=r.onError,f=r.error,c=(0,n.useRef)(-1);c.current+=1;var d=(0,n.useCallback)((function(t,r,n){void 0===n&&(n=!1);try{var i=c.current,o=!1;return Promise.resolve(g((function(){return Promise.resolve(t.activate().then((function(t){return o=!0,t}))).then((function(n){return Promise.resolve(b(t,n)).then((function(n){if(c.current>i)throw new M;e({type:w.ACTIVATE_CONNECTOR,payload:a({connector:t},n,{onError:r})})}))}))}),(function(i){if(i instanceof M)o&&t.deactivate();else{if(n)throw o&&t.deactivate(),i;r?(o&&t.deactivate(),r(i)):e({type:w.ERROR_FROM_ACTIVATION,payload:{connector:t,error:i}})}})))}catch(s){return Promise.reject(s)}}),[]),m=(0,n.useCallback)((function(t){e({type:w.ERROR,payload:{error:t}})}),[]),p=(0,n.useCallback)((function(){e({type:w.DEACTIVATE_CONNECTOR})}),[]),A=(0,n.useCallback)((function(t){try{if(!i)throw Error("This should never happen, it's just so Typescript stops complaining");var r=c.current;return Promise.resolve(function(){if(f)return g((function(){return Promise.resolve(b(i,t)).then((function(t){if(c.current>r)throw new M;e({type:w.UPDATE_FROM_ERROR,payload:t})}))}),(function(t){t instanceof M||(l?l(t):e({type:w.ERROR,payload:{error:t}}))}));var n=void 0===t.chainId?void 0:v(t.chainId);if(void 0!==n&&i.supportedChainIds&&!i.supportedChainIds.includes(n)){var o=new _(n,i.supportedChainIds);l?l(o):e({type:w.ERROR,payload:{error:o}})}else{var s="string"===typeof t.account?y(t.account):t.account;e({type:w.UPDATE,payload:{provider:t.provider,chainId:n,account:s}})}}())}catch(n){return Promise.reject(n)}}),[i,f,l]),k=(0,n.useCallback)((function(t){l?l(t):e({type:w.ERROR,payload:{error:t}})}),[l]),N=(0,n.useCallback)((function(){e({type:w.DEACTIVATE_CONNECTOR})}),[]);return(0,n.useEffect)((function(){return function(){i&&i.deactivate()}}),[i]),(0,n.useEffect)((function(){return i&&i.on(s._.Update,A).on(s._.Error,k).on(s._.Deactivate,N),function(){i&&i.off(s._.Update,A).off(s._.Error,k).off(s._.Deactivate,N)}}),[i,A,k,N]),{connector:i,provider:o,chainId:h,account:u,activate:d,setError:m,deactivate:p,error:f}}(),h=o.connector,u=o.provider,l=o.chainId,f=o.account,c=o.activate,d=o.setError,m=o.deactivate,p=o.error,A=void 0!==h&&void 0!==l&&void 0!==f&&!p,k=(0,n.useMemo)((function(){return A&&void 0!==l&&Number.isInteger(l)&&h?e(u,h):void 0}),[A,e,u,h,l]),N={connector:h,library:k,chainId:l,account:f,activate:c,setError:d,deactivate:m,active:A,error:p};return n.createElement(r,{value:N},i)}}var x=N(A);function P(t){return(0,n.useContext)(function(t){return void 0===t&&(t=A),Object.keys(k).includes(t)||o(!1),k[t]}(t))}},3653:function(t,r,e){"use strict";var n;e.d(r,{_:function(){return n}}),function(t){t.Update="Web3ReactUpdate",t.Error="Web3ReactError",t.Deactivate="Web3ReactDeactivate"}(n||(n={}))},2882:function(t){"use strict";for(var r="qpzry9x8gf2tvdw0s3jn54khce6mua7l",e={},n=0;n<r.length;n++){var i=r.charAt(n);if(void 0!==e[i])throw new TypeError(i+" is ambiguous");e[i]=n}function o(t){var r=t>>25;return(33554431&t)<<5^996825010&-(r>>0&1)^642813549&-(r>>1&1)^513874426&-(r>>2&1)^1027748829&-(r>>3&1)^705979059&-(r>>4&1)}function s(t){for(var r=1,e=0;e<t.length;++e){var n=t.charCodeAt(e);if(n<33||n>126)return"Invalid prefix ("+t+")";r=o(r)^n>>5}for(r=o(r),e=0;e<t.length;++e){var i=t.charCodeAt(e);r=o(r)^31&i}return r}function h(t,r){if(r=r||90,t.length<8)return t+" too short";if(t.length>r)return"Exceeds length limit";var n=t.toLowerCase(),i=t.toUpperCase();if(t!==n&&t!==i)return"Mixed-case string "+t;var h=(t=n).lastIndexOf("1");if(-1===h)return"No separator character for "+t;if(0===h)return"Missing prefix for "+t;var u=t.slice(0,h),a=t.slice(h+1);if(a.length<6)return"Data too short";var l=s(u);if("string"===typeof l)return l;for(var f=[],c=0;c<a.length;++c){var d=a.charAt(c),m=e[d];if(void 0===m)return"Unknown character "+d;l=o(l)^m,c+6>=a.length||f.push(m)}return 1!==l?"Invalid checksum for "+t:{prefix:u,words:f}}function u(t,r,e,n){for(var i=0,o=0,s=(1<<e)-1,h=[],u=0;u<t.length;++u)for(i=i<<r|t[u],o+=r;o>=e;)o-=e,h.push(i>>o&s);if(n)o>0&&h.push(i<<e-o&s);else{if(o>=r)return"Excess padding";if(i<<e-o&s)return"Non-zero padding"}return h}t.exports={decodeUnsafe:function(){var t=h.apply(null,arguments);if("object"===typeof t)return t},decode:function(t){var r=h.apply(null,arguments);if("object"===typeof r)return r;throw new Error(r)},encode:function(t,e,n){if(n=n||90,t.length+7+e.length>n)throw new TypeError("Exceeds length limit");var i=s(t=t.toLowerCase());if("string"===typeof i)throw new Error(i);for(var h=t+"1",u=0;u<e.length;++u){var a=e[u];if(a>>5!==0)throw new Error("Non 5-bit word");i=o(i)^a,h+=r.charAt(a)}for(u=0;u<6;++u)i=o(i);for(i^=1,u=0;u<6;++u){h+=r.charAt(i>>5*(5-u)&31)}return h},toWordsUnsafe:function(t){var r=u(t,8,5,!0);if(Array.isArray(r))return r},toWords:function(t){var r=u(t,8,5,!0);if(Array.isArray(r))return r;throw new Error(r)},fromWordsUnsafe:function(t){var r=u(t,5,8,!1);if(Array.isArray(r))return r},fromWords:function(t){var r=u(t,5,8,!1);if(Array.isArray(r))return r;throw new Error(r)}}},3715:function(t,r,e){var n=r;n.utils=e(6436),n.common=e(5772),n.sha=e(9041),n.ripemd=e(2949),n.hmac=e(2344),n.sha1=n.sha.sha1,n.sha256=n.sha.sha256,n.sha224=n.sha.sha224,n.sha384=n.sha.sha384,n.sha512=n.sha.sha512,n.ripemd160=n.ripemd.ripemd160},5772:function(t,r,e){"use strict";var n=e(6436),i=e(9746);function o(){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}r.BlockHash=o,o.prototype.update=function(t,r){if(t=n.toArray(t,r),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){var e=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-e,t.length),0===this.pending.length&&(this.pending=null),t=n.join32(t,0,t.length-e,this.endian);for(var i=0;i<t.length;i+=this._delta32)this._update(t,i,i+this._delta32)}return this},o.prototype.digest=function(t){return this.update(this._pad()),i(null===this.pending),this._digest(t)},o.prototype._pad=function(){var t=this.pendingTotal,r=this._delta8,e=r-(t+this.padLength)%r,n=new Array(e+this.padLength);n[0]=128;for(var i=1;i<e;i++)n[i]=0;if(t<<=3,"big"===this.endian){for(var o=8;o<this.padLength;o++)n[i++]=0;n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=t>>>24&255,n[i++]=t>>>16&255,n[i++]=t>>>8&255,n[i++]=255&t}else for(n[i++]=255&t,n[i++]=t>>>8&255,n[i++]=t>>>16&255,n[i++]=t>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,o=8;o<this.padLength;o++)n[i++]=0;return n}},2344:function(t,r,e){"use strict";var n=e(6436),i=e(9746);function o(t,r,e){if(!(this instanceof o))return new o(t,r,e);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(n.toArray(r,e))}t.exports=o,o.prototype._init=function(t){t.length>this.blockSize&&(t=(new this.Hash).update(t).digest()),i(t.length<=this.blockSize);for(var r=t.length;r<this.blockSize;r++)t.push(0);for(r=0;r<t.length;r++)t[r]^=54;for(this.inner=(new this.Hash).update(t),r=0;r<t.length;r++)t[r]^=106;this.outer=(new this.Hash).update(t)},o.prototype.update=function(t,r){return this.inner.update(t,r),this},o.prototype.digest=function(t){return this.outer.update(this.inner.digest()),this.outer.digest(t)}},2949:function(t,r,e){"use strict";var n=e(6436),i=e(5772),o=n.rotl32,s=n.sum32,h=n.sum32_3,u=n.sum32_4,a=i.BlockHash;function l(){if(!(this instanceof l))return new l;a.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function f(t,r,e,n){return t<=15?r^e^n:t<=31?r&e|~r&n:t<=47?(r|~e)^n:t<=63?r&n|e&~n:r^(e|~n)}function c(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function d(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}n.inherits(l,a),r.ripemd160=l,l.blockSize=512,l.outSize=160,l.hmacStrength=192,l.padLength=64,l.prototype._update=function(t,r){for(var e=this.h[0],n=this.h[1],i=this.h[2],a=this.h[3],l=this.h[4],y=e,w=n,b=i,M=a,_=l,E=0;E<80;E++){var A=s(o(u(e,f(E,n,i,a),t[m[E]+r],c(E)),g[E]),l);e=l,l=a,a=o(i,10),i=n,n=A,A=s(o(u(y,f(79-E,w,b,M),t[p[E]+r],d(E)),v[E]),_),y=_,_=M,M=o(b,10),b=w,w=A}A=h(this.h[1],i,M),this.h[1]=h(this.h[2],a,_),this.h[2]=h(this.h[3],l,y),this.h[3]=h(this.h[4],e,w),this.h[4]=h(this.h[0],n,b),this.h[0]=A},l.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h,"little"):n.split32(this.h,"little")};var m=[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],p=[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],g=[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],v=[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]},9041:function(t,r,e){"use strict";r.sha1=e(4761),r.sha224=e(799),r.sha256=e(9344),r.sha384=e(772),r.sha512=e(5900)},4761:function(t,r,e){"use strict";var n=e(6436),i=e(5772),o=e(7038),s=n.rotl32,h=n.sum32,u=n.sum32_5,a=o.ft_1,l=i.BlockHash,f=[1518500249,1859775393,2400959708,3395469782];function c(){if(!(this instanceof c))return new c;l.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}n.inherits(c,l),t.exports=c,c.blockSize=512,c.outSize=160,c.hmacStrength=80,c.padLength=64,c.prototype._update=function(t,r){for(var e=this.W,n=0;n<16;n++)e[n]=t[r+n];for(;n<e.length;n++)e[n]=s(e[n-3]^e[n-8]^e[n-14]^e[n-16],1);var i=this.h[0],o=this.h[1],l=this.h[2],c=this.h[3],d=this.h[4];for(n=0;n<e.length;n++){var m=~~(n/20),p=u(s(i,5),a(m,o,l,c),d,e[n],f[m]);d=c,c=l,l=s(o,30),o=i,i=p}this.h[0]=h(this.h[0],i),this.h[1]=h(this.h[1],o),this.h[2]=h(this.h[2],l),this.h[3]=h(this.h[3],c),this.h[4]=h(this.h[4],d)},c.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h,"big"):n.split32(this.h,"big")}},799:function(t,r,e){"use strict";var n=e(6436),i=e(9344);function o(){if(!(this instanceof o))return new o;i.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}n.inherits(o,i),t.exports=o,o.blockSize=512,o.outSize=224,o.hmacStrength=192,o.padLength=64,o.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h.slice(0,7),"big"):n.split32(this.h.slice(0,7),"big")}},9344:function(t,r,e){"use strict";var n=e(6436),i=e(5772),o=e(7038),s=e(9746),h=n.sum32,u=n.sum32_4,a=n.sum32_5,l=o.ch32,f=o.maj32,c=o.s0_256,d=o.s1_256,m=o.g0_256,p=o.g1_256,g=i.BlockHash,v=[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 y(){if(!(this instanceof y))return new y;g.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=v,this.W=new Array(64)}n.inherits(y,g),t.exports=y,y.blockSize=512,y.outSize=256,y.hmacStrength=192,y.padLength=64,y.prototype._update=function(t,r){for(var e=this.W,n=0;n<16;n++)e[n]=t[r+n];for(;n<e.length;n++)e[n]=u(p(e[n-2]),e[n-7],m(e[n-15]),e[n-16]);var i=this.h[0],o=this.h[1],g=this.h[2],v=this.h[3],y=this.h[4],w=this.h[5],b=this.h[6],M=this.h[7];for(s(this.k.length===e.length),n=0;n<e.length;n++){var _=a(M,d(y),l(y,w,b),this.k[n],e[n]),E=h(c(i),f(i,o,g));M=b,b=w,w=y,y=h(v,_),v=g,g=o,o=i,i=h(_,E)}this.h[0]=h(this.h[0],i),this.h[1]=h(this.h[1],o),this.h[2]=h(this.h[2],g),this.h[3]=h(this.h[3],v),this.h[4]=h(this.h[4],y),this.h[5]=h(this.h[5],w),this.h[6]=h(this.h[6],b),this.h[7]=h(this.h[7],M)},y.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h,"big"):n.split32(this.h,"big")}},772:function(t,r,e){"use strict";var n=e(6436),i=e(5900);function o(){if(!(this instanceof o))return new o;i.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}n.inherits(o,i),t.exports=o,o.blockSize=1024,o.outSize=384,o.hmacStrength=192,o.padLength=128,o.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h.slice(0,12),"big"):n.split32(this.h.slice(0,12),"big")}},5900:function(t,r,e){"use strict";var n=e(6436),i=e(5772),o=e(9746),s=n.rotr64_hi,h=n.rotr64_lo,u=n.shr64_hi,a=n.shr64_lo,l=n.sum64,f=n.sum64_hi,c=n.sum64_lo,d=n.sum64_4_hi,m=n.sum64_4_lo,p=n.sum64_5_hi,g=n.sum64_5_lo,v=i.BlockHash,y=[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 w(){if(!(this instanceof w))return new w;v.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=y,this.W=new Array(160)}function b(t,r,e,n,i){var o=t&e^~t&i;return o<0&&(o+=4294967296),o}function M(t,r,e,n,i,o){var s=r&n^~r&o;return s<0&&(s+=4294967296),s}function _(t,r,e,n,i){var o=t&e^t&i^e&i;return o<0&&(o+=4294967296),o}function E(t,r,e,n,i,o){var s=r&n^r&o^n&o;return s<0&&(s+=4294967296),s}function A(t,r){var e=s(t,r,28)^s(r,t,2)^s(r,t,7);return e<0&&(e+=4294967296),e}function k(t,r){var e=h(t,r,28)^h(r,t,2)^h(r,t,7);return e<0&&(e+=4294967296),e}function N(t,r){var e=s(t,r,14)^s(t,r,18)^s(r,t,9);return e<0&&(e+=4294967296),e}function x(t,r){var e=h(t,r,14)^h(t,r,18)^h(r,t,9);return e<0&&(e+=4294967296),e}function P(t,r){var e=s(t,r,1)^s(t,r,8)^u(t,r,7);return e<0&&(e+=4294967296),e}function I(t,r){var e=h(t,r,1)^h(t,r,8)^a(t,r,7);return e<0&&(e+=4294967296),e}function R(t,r){var e=s(t,r,19)^s(r,t,29)^u(t,r,6);return e<0&&(e+=4294967296),e}function S(t,r){var e=h(t,r,19)^h(r,t,29)^a(t,r,6);return e<0&&(e+=4294967296),e}n.inherits(w,v),t.exports=w,w.blockSize=1024,w.outSize=512,w.hmacStrength=192,w.padLength=128,w.prototype._prepareBlock=function(t,r){for(var e=this.W,n=0;n<32;n++)e[n]=t[r+n];for(;n<e.length;n+=2){var i=R(e[n-4],e[n-3]),o=S(e[n-4],e[n-3]),s=e[n-14],h=e[n-13],u=P(e[n-30],e[n-29]),a=I(e[n-30],e[n-29]),l=e[n-32],f=e[n-31];e[n]=d(i,o,s,h,u,a,l,f),e[n+1]=m(i,o,s,h,u,a,l,f)}},w.prototype._update=function(t,r){this._prepareBlock(t,r);var e=this.W,n=this.h[0],i=this.h[1],s=this.h[2],h=this.h[3],u=this.h[4],a=this.h[5],d=this.h[6],m=this.h[7],v=this.h[8],y=this.h[9],w=this.h[10],P=this.h[11],I=this.h[12],R=this.h[13],S=this.h[14],T=this.h[15];o(this.k.length===e.length);for(var O=0;O<e.length;O+=2){var B=S,C=T,F=N(v,y),L=x(v,y),D=b(v,y,w,P,I),U=M(v,y,w,P,I,R),z=this.k[O],q=this.k[O+1],G=e[O],j=e[O+1],$=p(B,C,F,L,D,U,z,q,G,j),Y=g(B,C,F,L,D,U,z,q,G,j);B=A(n,i),C=k(n,i),F=_(n,i,s,h,u),L=E(n,i,s,h,u,a);var H=f(B,C,F,L),V=c(B,C,F,L);S=I,T=R,I=w,R=P,w=v,P=y,v=f(d,m,$,Y),y=c(m,m,$,Y),d=u,m=a,u=s,a=h,s=n,h=i,n=f($,Y,H,V),i=c($,Y,H,V)}l(this.h,0,n,i),l(this.h,2,s,h),l(this.h,4,u,a),l(this.h,6,d,m),l(this.h,8,v,y),l(this.h,10,w,P),l(this.h,12,I,R),l(this.h,14,S,T)},w.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h,"big"):n.split32(this.h,"big")}},7038:function(t,r,e){"use strict";var n=e(6436).rotr32;function i(t,r,e){return t&r^~t&e}function o(t,r,e){return t&r^t&e^r&e}function s(t,r,e){return t^r^e}r.ft_1=function(t,r,e,n){return 0===t?i(r,e,n):1===t||3===t?s(r,e,n):2===t?o(r,e,n):void 0},r.ch32=i,r.maj32=o,r.p32=s,r.s0_256=function(t){return n(t,2)^n(t,13)^n(t,22)},r.s1_256=function(t){return n(t,6)^n(t,11)^n(t,25)},r.g0_256=function(t){return n(t,7)^n(t,18)^t>>>3},r.g1_256=function(t){return n(t,17)^n(t,19)^t>>>10}},6436:function(t,r,e){"use strict";var n=e(9746),i=e(5717);function o(t,r){return 55296===(64512&t.charCodeAt(r))&&(!(r<0||r+1>=t.length)&&56320===(64512&t.charCodeAt(r+1)))}function s(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function h(t){return 1===t.length?"0"+t:t}function u(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}r.inherits=i,r.toArray=function(t,r){if(Array.isArray(t))return t.slice();if(!t)return[];var e=[];if("string"===typeof t)if(r){if("hex"===r)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!==0&&(t="0"+t),i=0;i<t.length;i+=2)e.push(parseInt(t[i]+t[i+1],16))}else for(var n=0,i=0;i<t.length;i++){var s=t.charCodeAt(i);s<128?e[n++]=s:s<2048?(e[n++]=s>>6|192,e[n++]=63&s|128):o(t,i)?(s=65536+((1023&s)<<10)+(1023&t.charCodeAt(++i)),e[n++]=s>>18|240,e[n++]=s>>12&63|128,e[n++]=s>>6&63|128,e[n++]=63&s|128):(e[n++]=s>>12|224,e[n++]=s>>6&63|128,e[n++]=63&s|128)}else for(i=0;i<t.length;i++)e[i]=0|t[i];return e},r.toHex=function(t){for(var r="",e=0;e<t.length;e++)r+=h(t[e].toString(16));return r},r.htonl=s,r.toHex32=function(t,r){for(var e="",n=0;n<t.length;n++){var i=t[n];"little"===r&&(i=s(i)),e+=u(i.toString(16))}return e},r.zero2=h,r.zero8=u,r.join32=function(t,r,e,i){var o=e-r;n(o%4===0);for(var s=new Array(o/4),h=0,u=r;h<s.length;h++,u+=4){var a;a="big"===i?t[u]<<24|t[u+1]<<16|t[u+2]<<8|t[u+3]:t[u+3]<<24|t[u+2]<<16|t[u+1]<<8|t[u],s[h]=a>>>0}return s},r.split32=function(t,r){for(var e=new Array(4*t.length),n=0,i=0;n<t.length;n++,i+=4){var o=t[n];"big"===r?(e[i]=o>>>24,e[i+1]=o>>>16&255,e[i+2]=o>>>8&255,e[i+3]=255&o):(e[i+3]=o>>>24,e[i+2]=o>>>16&255,e[i+1]=o>>>8&255,e[i]=255&o)}return e},r.rotr32=function(t,r){return t>>>r|t<<32-r},r.rotl32=function(t,r){return t<<r|t>>>32-r},r.sum32=function(t,r){return t+r>>>0},r.sum32_3=function(t,r,e){return t+r+e>>>0},r.sum32_4=function(t,r,e,n){return t+r+e+n>>>0},r.sum32_5=function(t,r,e,n,i){return t+r+e+n+i>>>0},r.sum64=function(t,r,e,n){var i=t[r],o=n+t[r+1]>>>0,s=(o<n?1:0)+e+i;t[r]=s>>>0,t[r+1]=o},r.sum64_hi=function(t,r,e,n){return(r+n>>>0<r?1:0)+t+e>>>0},r.sum64_lo=function(t,r,e,n){return r+n>>>0},r.sum64_4_hi=function(t,r,e,n,i,o,s,h){var u=0,a=r;return u+=(a=a+n>>>0)<r?1:0,u+=(a=a+o>>>0)<o?1:0,t+e+i+s+(u+=(a=a+h>>>0)<h?1:0)>>>0},r.sum64_4_lo=function(t,r,e,n,i,o,s,h){return r+n+o+h>>>0},r.sum64_5_hi=function(t,r,e,n,i,o,s,h,u,a){var l=0,f=r;return l+=(f=f+n>>>0)<r?1:0,l+=(f=f+o>>>0)<o?1:0,l+=(f=f+h>>>0)<h?1:0,t+e+i+s+u+(l+=(f=f+a>>>0)<a?1:0)>>>0},r.sum64_5_lo=function(t,r,e,n,i,o,s,h,u,a){return r+n+o+h+a>>>0},r.rotr64_hi=function(t,r,e){return(r<<32-e|t>>>e)>>>0},r.rotr64_lo=function(t,r,e){return(t<<32-e|r>>>e)>>>0},r.shr64_hi=function(t,r,e){return t>>>e},r.shr64_lo=function(t,r,e){return(t<<32-e|r>>>e)>>>0}},5717:function(t){"function"===typeof Object.create?t.exports=function(t,r){r&&(t.super_=r,t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,r){if(r){t.super_=r;var e=function(){};e.prototype=r.prototype,t.prototype=new e,t.prototype.constructor=t}}},1094:function(t,r,e){var n,i=e(3454);!function(){"use strict";var o="input is invalid type",s="object"===typeof window,h=s?window:{};h.JS_SHA3_NO_WINDOW&&(s=!1);var u=!s&&"object"===typeof self;!h.JS_SHA3_NO_NODE_JS&&"object"===typeof i&&i.versions&&i.versions.node?h=e.g:u&&(h=self);var a=!h.JS_SHA3_NO_COMMON_JS&&t.exports,l=e.amdO,f=!h.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!==typeof ArrayBuffer,c="0123456789abcdef".split(""),d=[4,1024,262144,67108864],m=[0,8,16,24],p=[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],g=[224,256,384,512],v=[128,256],y=["hex","buffer","arrayBuffer","array","digest"],w={128:168,256:136};!h.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),!f||!h.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 b=function(t,r,e){return function(n){return new C(t,r,t).update(n)[e]()}},M=function(t,r,e){return function(n,i){return new C(t,r,i).update(n)[e]()}},_=function(t,r,e){return function(r,n,i,o){return x["cshake"+t].update(r,n,i,o)[e]()}},E=function(t,r,e){return function(r,n,i,o){return x["kmac"+t].update(r,n,i,o)[e]()}},A=function(t,r,e,n){for(var i=0;i<y.length;++i){var o=y[i];t[o]=r(e,n,o)}return t},k=function(t,r){var e=b(t,r,"hex");return e.create=function(){return new C(t,r,t)},e.update=function(t){return e.create().update(t)},A(e,b,t,r)},N=[{name:"keccak",padding:[1,256,65536,16777216],bits:g,createMethod:k},{name:"sha3",padding:[6,1536,393216,100663296],bits:g,createMethod:k},{name:"shake",padding:[31,7936,2031616,520093696],bits:v,createMethod:function(t,r){var e=M(t,r,"hex");return e.create=function(e){return new C(t,r,e)},e.update=function(t,r){return e.create(r).update(t)},A(e,M,t,r)}},{name:"cshake",padding:d,bits:v,createMethod:function(t,r){var e=w[t],n=_(t,0,"hex");return n.create=function(n,i,o){return i||o?new C(t,r,n).bytepad([i,o],e):x["shake"+t].create(n)},n.update=function(t,r,e,i){return n.create(r,e,i).update(t)},A(n,_,t,r)}},{name:"kmac",padding:d,bits:v,createMethod:function(t,r){var e=w[t],n=E(t,0,"hex");return n.create=function(n,i,o){return new F(t,r,i).bytepad(["KMAC",o],e).bytepad([n],e)},n.update=function(t,r,e,i){return n.create(t,e,i).update(r)},A(n,E,t,r)}}],x={},P=[],I=0;I<N.length;++I)for(var R=N[I],S=R.bits,T=0;T<S.length;++T){var O=R.name+"_"+S[T];if(P.push(O),x[O]=R.createMethod(S[T],R.padding),"sha3"!==R.name){var B=R.name+S[T];P.push(B),x[B]=x[O]}}function C(t,r,e){this.blocks=[],this.s=[],this.padding=r,this.outputBits=e,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=e>>5,this.extraBytes=(31&e)>>3;for(var n=0;n<50;++n)this.s[n]=0}function F(t,r,e){C.call(this,t,r,e)}C.prototype.update=function(t){if(this.finalized)throw new Error("finalize already called");var r,e=typeof t;if("string"!==e){if("object"!==e)throw new Error(o);if(null===t)throw new Error(o);if(f&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!Array.isArray(t)&&(!f||!ArrayBuffer.isView(t)))throw new Error(o);r=!0}for(var n,i,s=this.blocks,h=this.byteCount,u=t.length,a=this.blockCount,l=0,c=this.s;l<u;){if(this.reset)for(this.reset=!1,s[0]=this.block,n=1;n<a+1;++n)s[n]=0;if(r)for(n=this.start;l<u&&n<h;++l)s[n>>2]|=t[l]<<m[3&n++];else for(n=this.start;l<u&&n<h;++l)(i=t.charCodeAt(l))<128?s[n>>2]|=i<<m[3&n++]:i<2048?(s[n>>2]|=(192|i>>6)<<m[3&n++],s[n>>2]|=(128|63&i)<<m[3&n++]):i<55296||i>=57344?(s[n>>2]|=(224|i>>12)<<m[3&n++],s[n>>2]|=(128|i>>6&63)<<m[3&n++],s[n>>2]|=(128|63&i)<<m[3&n++]):(i=65536+((1023&i)<<10|1023&t.charCodeAt(++l)),s[n>>2]|=(240|i>>18)<<m[3&n++],s[n>>2]|=(128|i>>12&63)<<m[3&n++],s[n>>2]|=(128|i>>6&63)<<m[3&n++],s[n>>2]|=(128|63&i)<<m[3&n++]);if(this.lastByteIndex=n,n>=h){for(this.start=n-h,this.block=s[a],n=0;n<a;++n)c[n]^=s[n];L(c),this.reset=!0}else this.start=n}return this},C.prototype.encode=function(t,r){var e=255&t,n=1,i=[e];for(e=255&(t>>=8);e>0;)i.unshift(e),e=255&(t>>=8),++n;return r?i.push(n):i.unshift(n),this.update(i),i.length},C.prototype.encodeString=function(t){var r,e=typeof t;if("string"!==e){if("object"!==e)throw new Error(o);if(null===t)throw new Error(o);if(f&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!Array.isArray(t)&&(!f||!ArrayBuffer.isView(t)))throw new Error(o);r=!0}var n=0,i=t.length;if(r)n=i;else for(var s=0;s<t.length;++s){var h=t.charCodeAt(s);h<128?n+=1:h<2048?n+=2:h<55296||h>=57344?n+=3:(h=65536+((1023&h)<<10|1023&t.charCodeAt(++s)),n+=4)}return n+=this.encode(8*n),this.update(t),n},C.prototype.bytepad=function(t,r){for(var e=this.encode(r),n=0;n<t.length;++n)e+=this.encodeString(t[n]);var i=r-e%r,o=[];return o.length=i,this.update(o),this},C.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,r=this.lastByteIndex,e=this.blockCount,n=this.s;if(t[r>>2]|=this.padding[3&r],this.lastByteIndex===this.byteCount)for(t[0]=t[e],r=1;r<e+1;++r)t[r]=0;for(t[e-1]|=2147483648,r=0;r<e;++r)n[r]^=t[r];L(n)}},C.prototype.toString=C.prototype.hex=function(){this.finalize();for(var t,r=this.blockCount,e=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,s=0,h="";s<n;){for(o=0;o<r&&s<n;++o,++s)t=e[o],h+=c[t>>4&15]+c[15&t]+c[t>>12&15]+c[t>>8&15]+c[t>>20&15]+c[t>>16&15]+c[t>>28&15]+c[t>>24&15];s%r===0&&(L(e),o=0)}return i&&(t=e[o],h+=c[t>>4&15]+c[15&t],i>1&&(h+=c[t>>12&15]+c[t>>8&15]),i>2&&(h+=c[t>>20&15]+c[t>>16&15])),h},C.prototype.arrayBuffer=function(){this.finalize();var t,r=this.blockCount,e=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,s=0,h=this.outputBits>>3;t=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(h);for(var u=new Uint32Array(t);s<n;){for(o=0;o<r&&s<n;++o,++s)u[s]=e[o];s%r===0&&L(e)}return i&&(u[o]=e[o],t=t.slice(0,h)),t},C.prototype.buffer=C.prototype.arrayBuffer,C.prototype.digest=C.prototype.array=function(){this.finalize();for(var t,r,e=this.blockCount,n=this.s,i=this.outputBlocks,o=this.extraBytes,s=0,h=0,u=[];h<i;){for(s=0;s<e&&h<i;++s,++h)t=h<<2,r=n[s],u[t]=255&r,u[t+1]=r>>8&255,u[t+2]=r>>16&255,u[t+3]=r>>24&255;h%e===0&&L(n)}return o&&(t=h<<2,r=n[s],u[t]=255&r,o>1&&(u[t+1]=r>>8&255),o>2&&(u[t+2]=r>>16&255)),u},F.prototype=new C,F.prototype.finalize=function(){return this.encode(this.outputBits,!0),C.prototype.finalize.call(this)};var L=function(t){var r,e,n,i,o,s,h,u,a,l,f,c,d,m,g,v,y,w,b,M,_,E,A,k,N,x,P,I,R,S,T,O,B,C,F,L,D,U,z,q,G,j,$,Y,H,V,Z,K,J,W,X,Q,tt,rt,et,nt,it,ot,st,ht,ut,at,lt;for(n=0;n<48;n+=2)i=t[0]^t[10]^t[20]^t[30]^t[40],o=t[1]^t[11]^t[21]^t[31]^t[41],s=t[2]^t[12]^t[22]^t[32]^t[42],h=t[3]^t[13]^t[23]^t[33]^t[43],u=t[4]^t[14]^t[24]^t[34]^t[44],a=t[5]^t[15]^t[25]^t[35]^t[45],l=t[6]^t[16]^t[26]^t[36]^t[46],f=t[7]^t[17]^t[27]^t[37]^t[47],r=(c=t[8]^t[18]^t[28]^t[38]^t[48])^(s<<1|h>>>31),e=(d=t[9]^t[19]^t[29]^t[39]^t[49])^(h<<1|s>>>31),t[0]^=r,t[1]^=e,t[10]^=r,t[11]^=e,t[20]^=r,t[21]^=e,t[30]^=r,t[31]^=e,t[40]^=r,t[41]^=e,r=i^(u<<1|a>>>31),e=o^(a<<1|u>>>31),t[2]^=r,t[3]^=e,t[12]^=r,t[13]^=e,t[22]^=r,t[23]^=e,t[32]^=r,t[33]^=e,t[42]^=r,t[43]^=e,r=s^(l<<1|f>>>31),e=h^(f<<1|l>>>31),t[4]^=r,t[5]^=e,t[14]^=r,t[15]^=e,t[24]^=r,t[25]^=e,t[34]^=r,t[35]^=e,t[44]^=r,t[45]^=e,r=u^(c<<1|d>>>31),e=a^(d<<1|c>>>31),t[6]^=r,t[7]^=e,t[16]^=r,t[17]^=e,t[26]^=r,t[27]^=e,t[36]^=r,t[37]^=e,t[46]^=r,t[47]^=e,r=l^(i<<1|o>>>31),e=f^(o<<1|i>>>31),t[8]^=r,t[9]^=e,t[18]^=r,t[19]^=e,t[28]^=r,t[29]^=e,t[38]^=r,t[39]^=e,t[48]^=r,t[49]^=e,m=t[0],g=t[1],V=t[11]<<4|t[10]>>>28,Z=t[10]<<4|t[11]>>>28,I=t[20]<<3|t[21]>>>29,R=t[21]<<3|t[20]>>>29,ht=t[31]<<9|t[30]>>>23,ut=t[30]<<9|t[31]>>>23,j=t[40]<<18|t[41]>>>14,$=t[41]<<18|t[40]>>>14,C=t[2]<<1|t[3]>>>31,F=t[3]<<1|t[2]>>>31,v=t[13]<<12|t[12]>>>20,y=t[12]<<12|t[13]>>>20,K=t[22]<<10|t[23]>>>22,J=t[23]<<10|t[22]>>>22,S=t[33]<<13|t[32]>>>19,T=t[32]<<13|t[33]>>>19,at=t[42]<<2|t[43]>>>30,lt=t[43]<<2|t[42]>>>30,rt=t[5]<<30|t[4]>>>2,et=t[4]<<30|t[5]>>>2,L=t[14]<<6|t[15]>>>26,D=t[15]<<6|t[14]>>>26,w=t[25]<<11|t[24]>>>21,b=t[24]<<11|t[25]>>>21,W=t[34]<<15|t[35]>>>17,X=t[35]<<15|t[34]>>>17,O=t[45]<<29|t[44]>>>3,B=t[44]<<29|t[45]>>>3,k=t[6]<<28|t[7]>>>4,N=t[7]<<28|t[6]>>>4,nt=t[17]<<23|t[16]>>>9,it=t[16]<<23|t[17]>>>9,U=t[26]<<25|t[27]>>>7,z=t[27]<<25|t[26]>>>7,M=t[36]<<21|t[37]>>>11,_=t[37]<<21|t[36]>>>11,Q=t[47]<<24|t[46]>>>8,tt=t[46]<<24|t[47]>>>8,Y=t[8]<<27|t[9]>>>5,H=t[9]<<27|t[8]>>>5,x=t[18]<<20|t[19]>>>12,P=t[19]<<20|t[18]>>>12,ot=t[29]<<7|t[28]>>>25,st=t[28]<<7|t[29]>>>25,q=t[38]<<8|t[39]>>>24,G=t[39]<<8|t[38]>>>24,E=t[48]<<14|t[49]>>>18,A=t[49]<<14|t[48]>>>18,t[0]=m^~v&w,t[1]=g^~y&b,t[10]=k^~x&I,t[11]=N^~P&R,t[20]=C^~L&U,t[21]=F^~D&z,t[30]=Y^~V&K,t[31]=H^~Z&J,t[40]=rt^~nt&ot,t[41]=et^~it&st,t[2]=v^~w&M,t[3]=y^~b&_,t[12]=x^~I&S,t[13]=P^~R&T,t[22]=L^~U&q,t[23]=D^~z&G,t[32]=V^~K&W,t[33]=Z^~J&X,t[42]=nt^~ot&ht,t[43]=it^~st&ut,t[4]=w^~M&E,t[5]=b^~_&A,t[14]=I^~S&O,t[15]=R^~T&B,t[24]=U^~q&j,t[25]=z^~G&$,t[34]=K^~W&Q,t[35]=J^~X&tt,t[44]=ot^~ht&at,t[45]=st^~ut&lt,t[6]=M^~E&m,t[7]=_^~A&g,t[16]=S^~O&k,t[17]=T^~B&N,t[26]=q^~j&C,t[27]=G^~$&F,t[36]=W^~Q&Y,t[37]=X^~tt&H,t[46]=ht^~at&rt,t[47]=ut^~lt&et,t[8]=E^~m&v,t[9]=A^~g&y,t[18]=O^~k&x,t[19]=B^~N&P,t[28]=j^~C&L,t[29]=$^~F&D,t[38]=Q^~Y&V,t[39]=tt^~H&Z,t[48]=at^~rt&nt,t[49]=lt^~et&it,t[0]^=p[n],t[1]^=p[n+1]};if(a)t.exports=x;else{for(I=0;I<P.length;++I)h[P[I]]=x[P[I]];l&&(void 0===(n=function(){return x}.call(r,e,r,t))||(t.exports=n))}}()},9746:function(t){function r(t,r){if(!t)throw new Error(r||"Assertion failed")}t.exports=r,r.equal=function(t,r,e){if(t!=r)throw new Error(e||"Assertion failed: "+t+" != "+r)}},3454:function(t,r,e){"use strict";var n,i;t.exports=(null===(n=e.g.process)||void 0===n?void 0:n.env)&&"object"===typeof(null===(i=e.g.process)||void 0===i?void 0:i.env)?e.g.process:e(7663)},6363:function(t,r,e){(window.__NEXT_P=window.__NEXT_P||[]).push(["/_app",function(){return e(5656)}])},9663:function(t,r,e){"use strict";e.d(r,{G:function(){return s},z:function(){return h}});var n=e(5893),i=e(7294),o=(0,i.createContext)({});function s(t){var r=t.children,e=(0,i.useState)(""),s=e[0],h=e[1],u=(0,i.useState)(""),a=u[0],l=u[1],f=(0,i.useState)(!1),c=f[0],d=f[1];return(0,n.jsx)(o.Provider,{value:{message:s,errMsg:a,isConnecting:c,setMessage:h,setErrMsg:l,setIsConnecting:d},children:r})}function h(){return(0,i.useContext)(o)}},5656:function(t,r,e){"use strict";e.r(r);var n=e(5893),i=(e(906),e(9795)),o=e(241),s=e(9663);function h(t,r,e){return r in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}function u(t){for(var r=1;r<arguments.length;r++){var e=null!=arguments[r]?arguments[r]:{},n=Object.keys(e);"function"===typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(e).filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})))),n.forEach((function(r){h(t,r,e[r])}))}return t}function a(t){return new o.Q(t)}r.default=function(t){var r=t.Component,e=t.pageProps;return(0,n.jsx)(i.Ht,{getLibrary:a,children:(0,n.jsx)(s.G,{children:(0,n.jsx)(r,u({},e))})})}},906:function(){},7663:function(t){!function(){var r={162:function(t){var r,e,n=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function s(t){if(r===setTimeout)return setTimeout(t,0);if((r===i||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(n){try{return r.call(null,t,0)}catch(n){return r.call(this,t,0)}}}!function(){try{r="function"===typeof setTimeout?setTimeout:i}catch(t){r=i}try{e="function"===typeof clearTimeout?clearTimeout:o}catch(t){e=o}}();var h,u=[],a=!1,l=-1;function f(){a&&h&&(a=!1,h.length?u=h.concat(u):l=-1,u.length&&c())}function c(){if(!a){var t=s(f);a=!0;for(var r=u.length;r;){for(h=u,u=[];++l<r;)h&&h[l].run();l=-1,r=u.length}h=null,a=!1,function(t){if(e===clearTimeout)return clearTimeout(t);if((e===o||!e)&&clearTimeout)return e=clearTimeout,clearTimeout(t);try{e(t)}catch(r){try{return e.call(null,t)}catch(r){return e.call(this,t)}}}(t)}}function d(t,r){this.fun=t,this.array=r}function m(){}n.nextTick=function(t){var r=new Array(arguments.length-1);if(arguments.length>1)for(var e=1;e<arguments.length;e++)r[e-1]=arguments[e];u.push(new d(t,r)),1!==u.length||a||s(c)},d.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=m,n.addListener=m,n.once=m,n.off=m,n.removeListener=m,n.removeAllListeners=m,n.emit=m,n.prependListener=m,n.prependOnceListener=m,n.listeners=function(t){return[]},n.binding=function(t){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(t){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}}},e={};function n(t){var i=e[t];if(void 0!==i)return i.exports;var o=e[t]={exports:{}},s=!0;try{r[t](o,o.exports,n),s=!1}finally{s&&delete e[t]}return o.exports}n.ab="//";var i=n(162);t.exports=i}()},8677:function(){},2808:function(){}},function(t){var r=function(r){return t(t.s=r)};t.O(0,[774,179],(function(){return r(6363),r(387)}));var e=t.O();_N_E=e}]);