>>=26,e.words[r]=i,t=n}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(w[e])return w[e];var t;if("k256"===e)t=new A;else if("p224"===e)t=new I;else if("p192"===e)t=new j;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new N}return w[e]=t,t},x.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},x.prototype._verify2=function(e,t){n(0===(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},x.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(l(e,e.umod(this.m)._forceRed(this)),e)},x.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},x.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},x.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},x.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},x.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},x.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},x.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},x.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},x.prototype.isqr=function(e){return this.imul(e,e.clone())},x.prototype.sqr=function(e){return this.mul(e,e)},x.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2===1),3===t){var r=this.m.add(new o(1)).iushrn(2);return this.pow(e,r)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);n(!i.isZero());var u=new o(1).toRed(this),s=u.redNeg(),c=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,c).cmp(s);)l.redIAdd(s);for(var f=this.pow(l,i),d=this.pow(e,i.addn(1).iushrn(1)),h=this.pow(e,i),p=a;0!==h.cmp(u);){for(var g=h,v=0;0!==g.cmp(u);v++)g=g.redSqr();n(v=0;n--){for(var c=t.words[n],l=s-1;l>=0;l--){var f=c>>l&1;i!==r[0]&&(i=this.sqr(i)),0!==f||0!==a?(a<<=1,a|=f,(4===++u||0===n&&0===l)&&(i=this.mul(i,r[a]),u=0,a=0)):u=0}s=26}return i},x.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},x.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new k(e)},i(k,x),k.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},k.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},k.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},k.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},k.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,this)}).call(this,r(72)(e))},function(e,t,r){"use strict";e.exports=r(367)},function(e,t){"function"===typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},function(e,t){function r(e){function t(e){if(Object(e)!==e)return Promise.reject(new TypeError(e+" is not an object."));var t=e.done;return Promise.resolve(e.value).then((function(e){return{value:e,done:t}}))}return r=function(e){this.s=e,this.n=e.next},r.prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(e){var r=this.s.return;return void 0===r?Promise.resolve({value:e,done:!0}):t(r.apply(this.s,arguments))},throw:function(e){var r=this.s.return;return void 0===r?Promise.reject(e):t(r.apply(this.s,arguments))}},new r(e)}e.exports=function(e){var t,n,i,o=2;for("undefined"!=typeof Symbol&&(n=Symbol.asyncIterator,i=Symbol.iterator);o--;){if(n&&null!=(t=e[n]))return t.call(e);if(i&&null!=(t=e[i]))return new r(t.call(e));n="@@asyncIterator",i="@@iterator"}throw new TypeError("Object is not async iterable")},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,r){var n=r(426);e.exports=function(e){return function(){return new n(e.apply(this,arguments))}},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,r){var n=r(163);e.exports=function(e){return new n(e,0)},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,r){var n=r(156);e.exports=function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&n(e,t)},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t){var r,n,i=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function u(e){if(r===setTimeout)return setTimeout(e,0);if((r===o||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"===typeof setTimeout?setTimeout:o}catch(e){r=o}try{n="function"===typeof clearTimeout?clearTimeout:a}catch(e){n=a}}();var s,c=[],l=!1,f=-1;function d(){l&&s&&(l=!1,s.length?c=s.concat(c):f=-1,c.length&&h())}function h(){if(!l){var e=u(d);l=!0;for(var t=c.length;t;){for(s=c,c=[];++f1)for(var r=1;r=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return u=e.done,e},e:function(e){s=!0,a=e},f:function(){try{u||null==r.return||r.return()}finally{if(s)throw a}}}},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(120);var i=r(107);function o(e){return function(e){if(Array.isArray(e))return Object(n.a)(e)}(e)||function(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Object(i.a)(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}},function(e,t,r){var n=r(3)();e.exports=n;try{regeneratorRuntime=n}catch(i){"object"===typeof globalThis?globalThis.regeneratorRuntime=n:Function("r","regeneratorRuntime = r")(n)}},function(e,t,r){var n=t;n.utils=r(69),n.common=r(114),n.sha=r(687),n.ripemd=r(691),n.hmac=r(692),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},,function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.objectToCamel=function(e){if(null==e)return e;var t=/^[A-Z]+$/;return Object.keys(e).reduce((function(r,n){return t.test(n)?r[n.toLowerCase()]=e[n]:t.test(n[0])?r[n[0].toLowerCase()+n.slice(1)]=e[n]:r[n]=e[n],r}),{})}},function(e,t,r){var n=r(376),i=r(377),o=r(152),a=r(378);e.exports=function(e,t){return n(e)||i(e,t)||o(e,t)||a()},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,r){"use strict";r.d(t,"b",(function(){return o})),r.d(t,"d",(function(){return a})),r.d(t,"c",(function(){return u})),r.d(t,"e",(function(){return s})),r.d(t,"f",(function(){return c})),r.d(t,"a",(function(){return l}));var n,i=r(20),o="INTERNAL_ERROR",a="SERVER_ERROR",u=[-32700,-32600,-32601,-32602,-32603],s=[-32e3,-32099],c=(n={},Object(i.a)(n,"PARSE_ERROR",{code:-32700,message:"Parse error"}),Object(i.a)(n,"INVALID_REQUEST",{code:-32600,message:"Invalid Request"}),Object(i.a)(n,"METHOD_NOT_FOUND",{code:-32601,message:"Method not found"}),Object(i.a)(n,"INVALID_PARAMS",{code:-32602,message:"Invalid params"}),Object(i.a)(n,o,{code:-32603,message:"Internal error"}),Object(i.a)(n,a,{code:-32e3,message:"Server error"}),n),l=a},function(e,t,r){"use strict";var n,i="object"===typeof Reflect?Reflect:null,o=i&&"function"===typeof i.apply?i.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};n=i&&"function"===typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var a=Number.isNaN||function(e){return e!==e};function u(){u.init.call(this)}e.exports=u,e.exports.once=function(e,t){return new Promise((function(r,n){function i(r){e.removeListener(t,o),n(r)}function o(){"function"===typeof e.removeListener&&e.removeListener("error",i),r([].slice.call(arguments))}y(e,t,o,{once:!0}),"error"!==t&&function(e,t,r){"function"===typeof e.on&&y(e,"error",t,r)}(e,i,{once:!0})}))},u.EventEmitter=u,u.prototype._events=void 0,u.prototype._eventsCount=0,u.prototype._maxListeners=void 0;var s=10;function c(e){if("function"!==typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function l(e){return void 0===e._maxListeners?u.defaultMaxListeners:e._maxListeners}function f(e,t,r,n){var i,o,a,u;if(c(r),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),a=o[t]),void 0===a)a=o[t]=r,++e._eventsCount;else if("function"===typeof a?a=o[t]=n?[r,a]:[a,r]:n?a.unshift(r):a.push(r),(i=l(e))>0&&a.length>i&&!a.warned){a.warned=!0;var s=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");s.name="MaxListenersExceededWarning",s.emitter=e,s.type=t,s.count=a.length,u=s,console&&console.warn&&console.warn(u)}return e}function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function h(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=d.bind(n);return i.listener=r,n.wrapFn=i,i}function p(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"===typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r0&&(a=t[0]),a instanceof Error)throw a;var u=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw u.context=a,u}var s=i[e];if(void 0===s)return!1;if("function"===typeof s)o(s,this,t);else{var c=s.length,l=v(s,c);for(r=0;r=0;o--)if(r[o]===t||r[o].listener===t){a=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1=0;n--)this.removeListener(e,t[n]);return this},u.prototype.listeners=function(e){return p(this,e,!0)},u.prototype.rawListeners=function(e){return p(this,e,!1)},u.listenerCount=function(e,t){return"function"===typeof e.listenerCount?e.listenerCount(t):g.call(e,t)},u.prototype.listenerCount=g,u.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(610);n.__exportStar(r(611),t),n.__exportStar(r(612),t)},function(e,t,r){var n=r(163);e.exports=function(e){var t={},r=!1;function i(t,i){return r=!0,i=new Promise((function(r){r(e[t](i))})),{done:!1,value:new n(i,1)}}return t["undefined"!=typeof Symbol&&Symbol.iterator||"@@iterator"]=function(){return this},t.next=function(e){return r?(r=!1,e):i("next",e)},"function"==typeof e.throw&&(t.throw=function(e){if(r)throw r=!1,e;return i("throw",e)}),"function"==typeof e.return&&(t.return=function(e){return r?(r=!1,e):i("return",e)}),t},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,r){(function(e){function r(e){return Object.prototype.toString.call(e)}t.isArray=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===r(e)},t.isBoolean=function(e){return"boolean"===typeof e},t.isNull=function(e){return null===e},t.isNullOrUndefined=function(e){return null==e},t.isNumber=function(e){return"number"===typeof e},t.isString=function(e){return"string"===typeof e},t.isSymbol=function(e){return"symbol"===typeof e},t.isUndefined=function(e){return void 0===e},t.isRegExp=function(e){return"[object RegExp]"===r(e)},t.isObject=function(e){return"object"===typeof e&&null!==e},t.isDate=function(e){return"[object Date]"===r(e)},t.isError=function(e){return"[object Error]"===r(e)||e instanceof Error},t.isFunction=function(e){return"function"===typeof e},t.isPrimitive=function(e){return null===e||"boolean"===typeof e||"number"===typeof e||"string"===typeof e||"symbol"===typeof e||"undefined"===typeof e},t.isBuffer=e.isBuffer}).call(this,r(21).Buffer)},function(e,t,r){"use strict";var n=r(17).default,i=r(18).default;Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(t,r,i){n(this,e),this.major=t,this.majorEncoded=t<<5,this.name=r,this.terminal=i}return i(e,[{key:"toString",value:function(){return"Type[".concat(this.major,"].").concat(this.name)}},{key:"compare",value:function(e){return this.majore.major?1:0}}]),e}();o.uint=new o(0,"uint",!0),o.negint=new o(1,"negint",!0),o.bytes=new o(2,"bytes",!0),o.string=new o(3,"string",!0),o.array=new o(4,"array",!1),o.map=new o(5,"map",!1),o.tag=new o(6,"tag",!1),o.float=new o(7,"float",!0),o.false=new o(7,"false",!0),o.true=new o(7,"true",!0),o.null=new o(7,"null",!0),o.undefined=new o(7,"undefined",!0),o.break=new o(7,"break",!0);var a=function(){function e(t,r,i){n(this,e),this.type=t,this.value=r,this.encodedLength=i,this.encodedBytes=void 0,this.byteValue=void 0}return i(e,[{key:"toString",value:function(){return"Token[".concat(this.type,"].").concat(this.value)}}]),e}();t.Token=a,t.Type=o},function(e,t,r){"use strict";var n=r(3).default,i=r(6).default,o=r(17).default,a=r(18).default,u=r(413),s=r(160),c=r(161),l=r(22).CID,f=r(125).base58btc,d=r(55),h=Symbol.for("nodejs.util.inspect.custom"),p=r(82).toString,g=r(421).equals,v=new Map,y=Symbol.for("@multiformats/js-multiaddr/multiaddr"),m=function(){function e(t){if(o(this,e),null==t&&(t=""),Object.defineProperty(this,y,{value:!0}),t instanceof Uint8Array)this.bytes=u.fromBytes(t);else if("string"===typeof t){if(t.length>0&&"/"!==t.charAt(0))throw new Error('multiaddr "'.concat(t,'" must start with a "/"'));this.bytes=u.fromString(t)}else{if(!e.isMultiaddr(t))throw new Error("addr must be a string, Buffer, or another Multiaddr");this.bytes=u.fromBytes(t.bytes)}}return a(e,[{key:"toString",value:function(){return u.bytesToString(this.bytes)}},{key:"toJSON",value:function(){return this.toString()}},{key:"toOptions",value:function(){var e={},t=this.toString().split("/");return e.family="ip4"===t[1]?4:6,e.host=t[2],e.transport=t[3],e.port=parseInt(t[4]),e}},{key:"protos",value:function(){return this.protoCodes().map((function(e){return Object.assign({},s(e))}))}},{key:"protoCodes",value:function(){for(var e=[],t=this.bytes,r=0;r=0;n--)if(r[n][0]===t)return new e(u.tuplesToBytes(r.slice(0,n)));return this}},{key:"getPeerId",value:function(){try{var e=this.stringTuples().filter((function(e){return e[0]===s.names.ipfs.code})),t=e.pop();if(t&&t[1]){var r=t[1];return"Q"===r[0]||"1"===r[0]?p(f.decode("z".concat(r)),"base58btc"):p(l.parse(r).multihash.bytes,"base58btc")}return null}catch(n){return null}}},{key:"getPath",value:function(){var e=null;try{(e=this.stringTuples().filter((function(e){return!!s(e[0]).path}))[0][1])||(e=null)}catch(t){e=null}return e}},{key:"equals",value:function(e){return g(this.bytes,e.bytes)}},{key:"resolve",value:function(){var t=i(n().mark((function t(){var r,i,o;return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=this.protos().find((function(e){return e.resolvable}))){t.next=3;break}return t.abrupt("return",[this]);case 3:if(i=v.get(r.name)){t.next=6;break}throw d(new Error("no available resolver for ".concat(r.name)),"ERR_NO_AVAILABLE_RESOLVER");case 6:return t.next=8,i(this);case 8:return o=t.sent,t.abrupt("return",o.map((function(t){return new e(t)})));case 10:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}()},{key:"nodeAddress",value:function(){var e=this.protoCodes(),t=this.protoNames(),r=this.toString().split("/").slice(1);if(r.length<4)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6}/{address}/{tcp, udp}/{port}".');if(4!==e[0]&&41!==e[0]&&54!==e[0]&&55!==e[0])throw new Error("no protocol with name: \"'".concat(t[0],'\'". Must have a valid family name: "{ip4, ip6, dns4, dns6}".'));if("tcp"!==r[2]&&"udp"!==r[2])throw new Error("no protocol with name: \"'".concat(t[1],'\'". Must have a valid transport protocol: "{tcp, udp}".'));return{family:41===e[0]||55===e[0]?6:4,address:r[1],port:parseInt(r[3])}}},{key:"isThinWaistAddress",value:function(e){var t=(e||this).protos();return 2===t.length&&((4===t[0].code||41===t[0].code)&&(6===t[1].code||273===t[1].code))}},{key:h,value:function(){return""}},{key:"inspect",value:function(){return""}}],[{key:"fromNodeAddress",value:function(t,r){if(!t)throw new Error("requires node address object");if(!r)throw new Error("requires transport protocol");var n;switch(t.family){case 4:n="ip4";break;case 6:n="ip6";break;default:throw Error("Invalid addr family. Got '".concat(t.family,"' instead of 4 or 6"))}return new e("/"+[n,t.address,r,t.port].join("/"))}},{key:"isName",value:function(t){return!!e.isMultiaddr(t)&&t.protos().some((function(e){return e.resolvable}))}},{key:"isMultiaddr",value:function(t){return t instanceof e||Boolean(t&&t[y])}}]),e}();m.protocols=s,m.resolvers=v,e.exports={Multiaddr:m,multiaddr:function(e){return new m(e)},protocols:s,resolvers:v}},function(e,t,r){(function(e){!function(e,t){"use strict";function n(e,t){if(!e)throw new Error(t||"Assertion failed")}function i(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function o(e,t,r){if(o.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var a;"object"===typeof e?e.exports=o:t.BN=o,o.BN=o,o.wordSize=26;try{a=r(608).Buffer}catch(j){}function u(e,t,r){for(var n=0,i=Math.min(e.length,r),o=t;o=49&&a<=54?a-49+10:a>=17&&a<=22?a-17+10:15&a}return n}function s(e,t,r,n){for(var i=0,o=Math.min(e.length,r),a=t;a=49?u-49+10:u>=17?u-17+10:u}return i}o.isBN=function(e){return e instanceof o||null!==e&&"object"===typeof e&&e.constructor.wordSize===o.wordSize&&Array.isArray(e.words)},o.max=function(e,t){return e.cmp(t)>0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,t,r){if("number"===typeof e)return this._initNumber(e,t,r);if("object"===typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&i++,16===t?this._parseHex(e,i):this._parseBase(e,t,i),"-"===e[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),t,r)},o.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(n(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},o.prototype._initArray=function(e,t,r){if(n("number"===typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var i=0;i=0;i-=3)a=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=a<>>26-u&67108863,(u+=24)>=26&&(u-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-u&67108863,(u+=24)>=26&&(u-=26,o++);return this.strip()},o.prototype._parseHex=function(e,t){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r=t;r-=6)i=u(e,r,r+6),this.words[n]|=i<>>26-o&4194303,(o+=24)>=26&&(o-=26,n++);r+6!==t&&(i=u(e,t,r+6),this.words[n]|=i<>>26-o&4194303),this.strip()},o.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=t)n++;n--,i=i/t|0;for(var o=e.length-r,a=o%n,u=Math.min(o,o-a)+r,c=0,l=r;l1&&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?""};var c=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var i=0|e.words[0],o=0|t.words[0],a=i*o,u=67108863&a,s=a/67108864|0;r.words[0]=u;for(var c=1;c>>26,f=67108863&s,d=Math.min(c,t.length-1),h=Math.max(0,c-e.length+1);h<=d;h++){var p=c-h|0;l+=(a=(i=0|e.words[p])*(o=0|t.words[h])+f)/67108864|0,f=67108863&a}r.words[c]=0|f,s=0|l}return 0!==s?r.words[c]=0|s:r.length--,r.strip()}o.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var i=0,o=0,a=0;a>>24-i&16777215)||a!==this.length-1?c[6-s.length]+s+r:s+r,(i+=2)>=26&&(i-=26,a--)}for(0!==o&&(r=o.toString(16)+r);r.length%t!==0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var d=l[e],h=f[e];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var g=p.modn(h).toString(e);r=(p=p.idivn(h)).isZero()?g+r:c[d-g.length]+g+r}for(this.isZero()&&(r="0"+r);r.length%t!==0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(e,t){return n("undefined"!==typeof a),this.toArrayLike(a,e,t)},o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},o.prototype.toArrayLike=function(e,t,r){var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0"),this.strip();var a,u,s="le"===t,c=new e(o),l=this.clone();if(s){for(u=0;!l.isZero();u++)a=l.andln(255),l.iushrn(8),c[u]=a;for(;u=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0===(8191&t)&&(r+=13,t>>>=13),0===(127&t)&&(r+=7,t>>>=7),0===(15&t)&&(r+=4,t>>>=4),0===(3&t)&&(r+=2,t>>>=2),0===(1&t)&&r++,r},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;ne.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){n("number"===typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){n("number"===typeof e&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,n=e):(r=e,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,n,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=e):(r=e,n=this);for(var o=0,a=0;a>26,this.words[a]=67108863&t;for(;0!==o&&a>26,this.words[a]=67108863&t;if(0===o&&a>>13,h=0|a[1],p=8191&h,g=h>>>13,v=0|a[2],y=8191&v,m=v>>>13,b=0|a[3],w=8191&b,M=b>>>13,A=0|a[4],I=8191&A,j=A>>>13,N=0|a[5],x=8191&N,k=N>>>13,E=0|a[6],D=8191&E,T=E>>>13,S=0|a[7],O=8191&S,_=S>>>13,C=0|a[8],L=8191&C,z=C>>>13,P=0|a[9],R=8191&P,B=P>>>13,U=0|u[0],Q=8191&U,Y=U>>>13,F=0|u[1],G=8191&F,W=F>>>13,Z=0|u[2],H=8191&Z,V=Z>>>13,q=0|u[3],K=8191&q,J=q>>>13,X=0|u[4],$=8191&X,ee=X>>>13,te=0|u[5],re=8191&te,ne=te>>>13,ie=0|u[6],oe=8191&ie,ae=ie>>>13,ue=0|u[7],se=8191&ue,ce=ue>>>13,le=0|u[8],fe=8191&le,de=le>>>13,he=0|u[9],pe=8191&he,ge=he>>>13;r.negative=e.negative^t.negative,r.length=19;var ve=(c+(n=Math.imul(f,Q))|0)+((8191&(i=(i=Math.imul(f,Y))+Math.imul(d,Q)|0))<<13)|0;c=((o=Math.imul(d,Y))+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(p,Q),i=(i=Math.imul(p,Y))+Math.imul(g,Q)|0,o=Math.imul(g,Y);var ye=(c+(n=n+Math.imul(f,G)|0)|0)+((8191&(i=(i=i+Math.imul(f,W)|0)+Math.imul(d,G)|0))<<13)|0;c=((o=o+Math.imul(d,W)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(y,Q),i=(i=Math.imul(y,Y))+Math.imul(m,Q)|0,o=Math.imul(m,Y),n=n+Math.imul(p,G)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(g,G)|0,o=o+Math.imul(g,W)|0;var me=(c+(n=n+Math.imul(f,H)|0)|0)+((8191&(i=(i=i+Math.imul(f,V)|0)+Math.imul(d,H)|0))<<13)|0;c=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(me>>>26)|0,me&=67108863,n=Math.imul(w,Q),i=(i=Math.imul(w,Y))+Math.imul(M,Q)|0,o=Math.imul(M,Y),n=n+Math.imul(y,G)|0,i=(i=i+Math.imul(y,W)|0)+Math.imul(m,G)|0,o=o+Math.imul(m,W)|0,n=n+Math.imul(p,H)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(g,H)|0,o=o+Math.imul(g,V)|0;var be=(c+(n=n+Math.imul(f,K)|0)|0)+((8191&(i=(i=i+Math.imul(f,J)|0)+Math.imul(d,K)|0))<<13)|0;c=((o=o+Math.imul(d,J)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,n=Math.imul(I,Q),i=(i=Math.imul(I,Y))+Math.imul(j,Q)|0,o=Math.imul(j,Y),n=n+Math.imul(w,G)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,W)|0,n=n+Math.imul(y,H)|0,i=(i=i+Math.imul(y,V)|0)+Math.imul(m,H)|0,o=o+Math.imul(m,V)|0,n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,J)|0)+Math.imul(g,K)|0,o=o+Math.imul(g,J)|0;var we=(c+(n=n+Math.imul(f,$)|0)|0)+((8191&(i=(i=i+Math.imul(f,ee)|0)+Math.imul(d,$)|0))<<13)|0;c=((o=o+Math.imul(d,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(x,Q),i=(i=Math.imul(x,Y))+Math.imul(k,Q)|0,o=Math.imul(k,Y),n=n+Math.imul(I,G)|0,i=(i=i+Math.imul(I,W)|0)+Math.imul(j,G)|0,o=o+Math.imul(j,W)|0,n=n+Math.imul(w,H)|0,i=(i=i+Math.imul(w,V)|0)+Math.imul(M,H)|0,o=o+Math.imul(M,V)|0,n=n+Math.imul(y,K)|0,i=(i=i+Math.imul(y,J)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,J)|0,n=n+Math.imul(p,$)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(g,$)|0,o=o+Math.imul(g,ee)|0;var Me=(c+(n=n+Math.imul(f,re)|0)|0)+((8191&(i=(i=i+Math.imul(f,ne)|0)+Math.imul(d,re)|0))<<13)|0;c=((o=o+Math.imul(d,ne)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(D,Q),i=(i=Math.imul(D,Y))+Math.imul(T,Q)|0,o=Math.imul(T,Y),n=n+Math.imul(x,G)|0,i=(i=i+Math.imul(x,W)|0)+Math.imul(k,G)|0,o=o+Math.imul(k,W)|0,n=n+Math.imul(I,H)|0,i=(i=i+Math.imul(I,V)|0)+Math.imul(j,H)|0,o=o+Math.imul(j,V)|0,n=n+Math.imul(w,K)|0,i=(i=i+Math.imul(w,J)|0)+Math.imul(M,K)|0,o=o+Math.imul(M,J)|0,n=n+Math.imul(y,$)|0,i=(i=i+Math.imul(y,ee)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,ee)|0,n=n+Math.imul(p,re)|0,i=(i=i+Math.imul(p,ne)|0)+Math.imul(g,re)|0,o=o+Math.imul(g,ne)|0;var Ae=(c+(n=n+Math.imul(f,oe)|0)|0)+((8191&(i=(i=i+Math.imul(f,ae)|0)+Math.imul(d,oe)|0))<<13)|0;c=((o=o+Math.imul(d,ae)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(O,Q),i=(i=Math.imul(O,Y))+Math.imul(_,Q)|0,o=Math.imul(_,Y),n=n+Math.imul(D,G)|0,i=(i=i+Math.imul(D,W)|0)+Math.imul(T,G)|0,o=o+Math.imul(T,W)|0,n=n+Math.imul(x,H)|0,i=(i=i+Math.imul(x,V)|0)+Math.imul(k,H)|0,o=o+Math.imul(k,V)|0,n=n+Math.imul(I,K)|0,i=(i=i+Math.imul(I,J)|0)+Math.imul(j,K)|0,o=o+Math.imul(j,J)|0,n=n+Math.imul(w,$)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,ee)|0,n=n+Math.imul(y,re)|0,i=(i=i+Math.imul(y,ne)|0)+Math.imul(m,re)|0,o=o+Math.imul(m,ne)|0,n=n+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,ae)|0)+Math.imul(g,oe)|0,o=o+Math.imul(g,ae)|0;var Ie=(c+(n=n+Math.imul(f,se)|0)|0)+((8191&(i=(i=i+Math.imul(f,ce)|0)+Math.imul(d,se)|0))<<13)|0;c=((o=o+Math.imul(d,ce)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,n=Math.imul(L,Q),i=(i=Math.imul(L,Y))+Math.imul(z,Q)|0,o=Math.imul(z,Y),n=n+Math.imul(O,G)|0,i=(i=i+Math.imul(O,W)|0)+Math.imul(_,G)|0,o=o+Math.imul(_,W)|0,n=n+Math.imul(D,H)|0,i=(i=i+Math.imul(D,V)|0)+Math.imul(T,H)|0,o=o+Math.imul(T,V)|0,n=n+Math.imul(x,K)|0,i=(i=i+Math.imul(x,J)|0)+Math.imul(k,K)|0,o=o+Math.imul(k,J)|0,n=n+Math.imul(I,$)|0,i=(i=i+Math.imul(I,ee)|0)+Math.imul(j,$)|0,o=o+Math.imul(j,ee)|0,n=n+Math.imul(w,re)|0,i=(i=i+Math.imul(w,ne)|0)+Math.imul(M,re)|0,o=o+Math.imul(M,ne)|0,n=n+Math.imul(y,oe)|0,i=(i=i+Math.imul(y,ae)|0)+Math.imul(m,oe)|0,o=o+Math.imul(m,ae)|0,n=n+Math.imul(p,se)|0,i=(i=i+Math.imul(p,ce)|0)+Math.imul(g,se)|0,o=o+Math.imul(g,ce)|0;var je=(c+(n=n+Math.imul(f,fe)|0)|0)+((8191&(i=(i=i+Math.imul(f,de)|0)+Math.imul(d,fe)|0))<<13)|0;c=((o=o+Math.imul(d,de)|0)+(i>>>13)|0)+(je>>>26)|0,je&=67108863,n=Math.imul(R,Q),i=(i=Math.imul(R,Y))+Math.imul(B,Q)|0,o=Math.imul(B,Y),n=n+Math.imul(L,G)|0,i=(i=i+Math.imul(L,W)|0)+Math.imul(z,G)|0,o=o+Math.imul(z,W)|0,n=n+Math.imul(O,H)|0,i=(i=i+Math.imul(O,V)|0)+Math.imul(_,H)|0,o=o+Math.imul(_,V)|0,n=n+Math.imul(D,K)|0,i=(i=i+Math.imul(D,J)|0)+Math.imul(T,K)|0,o=o+Math.imul(T,J)|0,n=n+Math.imul(x,$)|0,i=(i=i+Math.imul(x,ee)|0)+Math.imul(k,$)|0,o=o+Math.imul(k,ee)|0,n=n+Math.imul(I,re)|0,i=(i=i+Math.imul(I,ne)|0)+Math.imul(j,re)|0,o=o+Math.imul(j,ne)|0,n=n+Math.imul(w,oe)|0,i=(i=i+Math.imul(w,ae)|0)+Math.imul(M,oe)|0,o=o+Math.imul(M,ae)|0,n=n+Math.imul(y,se)|0,i=(i=i+Math.imul(y,ce)|0)+Math.imul(m,se)|0,o=o+Math.imul(m,ce)|0,n=n+Math.imul(p,fe)|0,i=(i=i+Math.imul(p,de)|0)+Math.imul(g,fe)|0,o=o+Math.imul(g,de)|0;var Ne=(c+(n=n+Math.imul(f,pe)|0)|0)+((8191&(i=(i=i+Math.imul(f,ge)|0)+Math.imul(d,pe)|0))<<13)|0;c=((o=o+Math.imul(d,ge)|0)+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,n=Math.imul(R,G),i=(i=Math.imul(R,W))+Math.imul(B,G)|0,o=Math.imul(B,W),n=n+Math.imul(L,H)|0,i=(i=i+Math.imul(L,V)|0)+Math.imul(z,H)|0,o=o+Math.imul(z,V)|0,n=n+Math.imul(O,K)|0,i=(i=i+Math.imul(O,J)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,J)|0,n=n+Math.imul(D,$)|0,i=(i=i+Math.imul(D,ee)|0)+Math.imul(T,$)|0,o=o+Math.imul(T,ee)|0,n=n+Math.imul(x,re)|0,i=(i=i+Math.imul(x,ne)|0)+Math.imul(k,re)|0,o=o+Math.imul(k,ne)|0,n=n+Math.imul(I,oe)|0,i=(i=i+Math.imul(I,ae)|0)+Math.imul(j,oe)|0,o=o+Math.imul(j,ae)|0,n=n+Math.imul(w,se)|0,i=(i=i+Math.imul(w,ce)|0)+Math.imul(M,se)|0,o=o+Math.imul(M,ce)|0,n=n+Math.imul(y,fe)|0,i=(i=i+Math.imul(y,de)|0)+Math.imul(m,fe)|0,o=o+Math.imul(m,de)|0;var xe=(c+(n=n+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,ge)|0)+Math.imul(g,pe)|0))<<13)|0;c=((o=o+Math.imul(g,ge)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(R,H),i=(i=Math.imul(R,V))+Math.imul(B,H)|0,o=Math.imul(B,V),n=n+Math.imul(L,K)|0,i=(i=i+Math.imul(L,J)|0)+Math.imul(z,K)|0,o=o+Math.imul(z,J)|0,n=n+Math.imul(O,$)|0,i=(i=i+Math.imul(O,ee)|0)+Math.imul(_,$)|0,o=o+Math.imul(_,ee)|0,n=n+Math.imul(D,re)|0,i=(i=i+Math.imul(D,ne)|0)+Math.imul(T,re)|0,o=o+Math.imul(T,ne)|0,n=n+Math.imul(x,oe)|0,i=(i=i+Math.imul(x,ae)|0)+Math.imul(k,oe)|0,o=o+Math.imul(k,ae)|0,n=n+Math.imul(I,se)|0,i=(i=i+Math.imul(I,ce)|0)+Math.imul(j,se)|0,o=o+Math.imul(j,ce)|0,n=n+Math.imul(w,fe)|0,i=(i=i+Math.imul(w,de)|0)+Math.imul(M,fe)|0,o=o+Math.imul(M,de)|0;var ke=(c+(n=n+Math.imul(y,pe)|0)|0)+((8191&(i=(i=i+Math.imul(y,ge)|0)+Math.imul(m,pe)|0))<<13)|0;c=((o=o+Math.imul(m,ge)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(R,K),i=(i=Math.imul(R,J))+Math.imul(B,K)|0,o=Math.imul(B,J),n=n+Math.imul(L,$)|0,i=(i=i+Math.imul(L,ee)|0)+Math.imul(z,$)|0,o=o+Math.imul(z,ee)|0,n=n+Math.imul(O,re)|0,i=(i=i+Math.imul(O,ne)|0)+Math.imul(_,re)|0,o=o+Math.imul(_,ne)|0,n=n+Math.imul(D,oe)|0,i=(i=i+Math.imul(D,ae)|0)+Math.imul(T,oe)|0,o=o+Math.imul(T,ae)|0,n=n+Math.imul(x,se)|0,i=(i=i+Math.imul(x,ce)|0)+Math.imul(k,se)|0,o=o+Math.imul(k,ce)|0,n=n+Math.imul(I,fe)|0,i=(i=i+Math.imul(I,de)|0)+Math.imul(j,fe)|0,o=o+Math.imul(j,de)|0;var Ee=(c+(n=n+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,ge)|0)+Math.imul(M,pe)|0))<<13)|0;c=((o=o+Math.imul(M,ge)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(R,$),i=(i=Math.imul(R,ee))+Math.imul(B,$)|0,o=Math.imul(B,ee),n=n+Math.imul(L,re)|0,i=(i=i+Math.imul(L,ne)|0)+Math.imul(z,re)|0,o=o+Math.imul(z,ne)|0,n=n+Math.imul(O,oe)|0,i=(i=i+Math.imul(O,ae)|0)+Math.imul(_,oe)|0,o=o+Math.imul(_,ae)|0,n=n+Math.imul(D,se)|0,i=(i=i+Math.imul(D,ce)|0)+Math.imul(T,se)|0,o=o+Math.imul(T,ce)|0,n=n+Math.imul(x,fe)|0,i=(i=i+Math.imul(x,de)|0)+Math.imul(k,fe)|0,o=o+Math.imul(k,de)|0;var De=(c+(n=n+Math.imul(I,pe)|0)|0)+((8191&(i=(i=i+Math.imul(I,ge)|0)+Math.imul(j,pe)|0))<<13)|0;c=((o=o+Math.imul(j,ge)|0)+(i>>>13)|0)+(De>>>26)|0,De&=67108863,n=Math.imul(R,re),i=(i=Math.imul(R,ne))+Math.imul(B,re)|0,o=Math.imul(B,ne),n=n+Math.imul(L,oe)|0,i=(i=i+Math.imul(L,ae)|0)+Math.imul(z,oe)|0,o=o+Math.imul(z,ae)|0,n=n+Math.imul(O,se)|0,i=(i=i+Math.imul(O,ce)|0)+Math.imul(_,se)|0,o=o+Math.imul(_,ce)|0,n=n+Math.imul(D,fe)|0,i=(i=i+Math.imul(D,de)|0)+Math.imul(T,fe)|0,o=o+Math.imul(T,de)|0;var Te=(c+(n=n+Math.imul(x,pe)|0)|0)+((8191&(i=(i=i+Math.imul(x,ge)|0)+Math.imul(k,pe)|0))<<13)|0;c=((o=o+Math.imul(k,ge)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(R,oe),i=(i=Math.imul(R,ae))+Math.imul(B,oe)|0,o=Math.imul(B,ae),n=n+Math.imul(L,se)|0,i=(i=i+Math.imul(L,ce)|0)+Math.imul(z,se)|0,o=o+Math.imul(z,ce)|0,n=n+Math.imul(O,fe)|0,i=(i=i+Math.imul(O,de)|0)+Math.imul(_,fe)|0,o=o+Math.imul(_,de)|0;var Se=(c+(n=n+Math.imul(D,pe)|0)|0)+((8191&(i=(i=i+Math.imul(D,ge)|0)+Math.imul(T,pe)|0))<<13)|0;c=((o=o+Math.imul(T,ge)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(R,se),i=(i=Math.imul(R,ce))+Math.imul(B,se)|0,o=Math.imul(B,ce),n=n+Math.imul(L,fe)|0,i=(i=i+Math.imul(L,de)|0)+Math.imul(z,fe)|0,o=o+Math.imul(z,de)|0;var Oe=(c+(n=n+Math.imul(O,pe)|0)|0)+((8191&(i=(i=i+Math.imul(O,ge)|0)+Math.imul(_,pe)|0))<<13)|0;c=((o=o+Math.imul(_,ge)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,n=Math.imul(R,fe),i=(i=Math.imul(R,de))+Math.imul(B,fe)|0,o=Math.imul(B,de);var _e=(c+(n=n+Math.imul(L,pe)|0)|0)+((8191&(i=(i=i+Math.imul(L,ge)|0)+Math.imul(z,pe)|0))<<13)|0;c=((o=o+Math.imul(z,ge)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863;var Ce=(c+(n=Math.imul(R,pe))|0)+((8191&(i=(i=Math.imul(R,ge))+Math.imul(B,pe)|0))<<13)|0;return c=((o=Math.imul(B,ge))+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,s[0]=ve,s[1]=ye,s[2]=me,s[3]=be,s[4]=we,s[5]=Me,s[6]=Ae,s[7]=Ie,s[8]=je,s[9]=Ne,s[10]=xe,s[11]=ke,s[12]=Ee,s[13]=De,s[14]=Te,s[15]=Se,s[16]=Oe,s[17]=_e,s[18]=Ce,0!==c&&(s[19]=c,r.length++),r};function p(e,t,r){return(new g).mulp(e,t,r)}function g(e,t){this.x=e,this.y=t}Math.imul||(h=d),o.prototype.mulTo=function(e,t){var r,n=this.length+e.length;return r=10===this.length&&10===e.length?h(this,e,t):n<63?d(this,e,t):n<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,a&=67108863}r.words[o]=u,n=a,a=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,e,t):p(this,e,t),r},g.prototype.makeRBT=function(e){for(var t=new Array(e),r=o.prototype._countBits(e)-1,n=0;n>=1;return n},g.prototype.permute=function(e,t,r,n,i,o){for(var a=0;a>>=1)i++;return 1<>>=13,r[2*a+1]=8191&o,o>>>=13;for(a=2*t;a>=26,t+=i/67108864|0,t+=o>>>26,this.words[r]=67108863&o}return 0!==t&&(this.words[r]=t,this.length++),this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r>>i}return t}(e);if(0===t.length)return new o(1);for(var r=this,n=0;n=0);var t,r=e%26,i=(e-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(t=0;t>>26-r}a&&(this.words[t]=a,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t=0),i=t?(t-t%26)/26:0;var o=e%26,a=Math.min((e-o)/26,this.length),u=67108863^67108863>>>o<a)for(this.length-=a,c=0;c=0&&(0!==l||c>=i);c--){var f=0|this.words[c];this.words[c]=l<<26-o|f>>>o,l=f&u}return s&&0!==l&&(s.words[s.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){n("number"===typeof e&&e>=0);var t=e%26,r=(e-t)/26,i=1<=0);var t=e%26,r=(e-t)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var i=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(n("number"===typeof e),n(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(s/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===u)return this.strip();for(n(-1===u),u=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),i=e,a=0|i.words[i.length-1];0!==(r=26-this._countBits(a))&&(i=i.ushln(r),n.iushln(r),a=0|i.words[i.length-1]);var u,s=n.length-i.length;if("mod"!==t){(u=new o(null)).length=s+1,u.words=new Array(u.length);for(var c=0;c=0;f--){var d=67108864*(0|n.words[i.length+f])+(0|n.words[i.length+f-1]);for(d=Math.min(d/a|0,67108863),n._ishlnsubmul(i,d,f);0!==n.negative;)d--,n.negative=0,n._ishlnsubmul(i,1,f),n.isZero()||(n.negative^=1);u&&(u.words[f]=d)}return u&&u.strip(),n.strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:u||null,mod:n}},o.prototype.divmod=function(e,t,r){return n(!e.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(u=this.neg().divmod(e,t),"mod"!==t&&(i=u.div.neg()),"div"!==t&&(a=u.mod.neg(),r&&0!==a.negative&&a.iadd(e)),{div:i,mod:a}):0===this.negative&&0!==e.negative?(u=this.divmod(e.neg(),t),"mod"!==t&&(i=u.div.neg()),{div:i,mod:u.mod}):0!==(this.negative&e.negative)?(u=this.neg().divmod(e.neg(),t),"div"!==t&&(a=u.mod.neg(),r&&0!==a.negative&&a.isub(e)),{div:u.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modn(e.words[0]))}:this._wordDiv(e,t);var i,a,u},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),i=e.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modn=function(e){n(e<=67108863);for(var t=(1<<26)%e,r=0,i=this.length-1;i>=0;i--)r=(t*r+(0|this.words[i]))%e;return r},o.prototype.idivn=function(e){n(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*t;this.words[r]=i/e|0,t=i%e}return this.strip()},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new o(1),a=new o(0),u=new o(0),s=new o(1),c=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++c;for(var l=r.clone(),f=t.clone();!t.isZero();){for(var d=0,h=1;0===(t.words[0]&h)&&d<26;++d,h<<=1);if(d>0)for(t.iushrn(d);d-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(l),a.isub(f)),i.iushrn(1),a.iushrn(1);for(var p=0,g=1;0===(r.words[0]&g)&&p<26;++p,g<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(u.isOdd()||s.isOdd())&&(u.iadd(l),s.isub(f)),u.iushrn(1),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),i.isub(u),a.isub(s)):(r.isub(t),u.isub(i),s.isub(a))}return{a:u,b:s,gcd:r.iushln(c)}},o.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i,a=new o(1),u=new o(0),s=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,l=1;0===(t.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(t.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(s),a.iushrn(1);for(var f=0,d=1;0===(r.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(r.iushrn(f);f-- >0;)u.isOdd()&&u.iadd(s),u.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(u)):(r.isub(t),u.isub(a))}return(i=0===t.cmpn(1)?a:u).cmpn(0)<0&&i.iadd(e),i},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var n=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=t.cmp(r);if(i<0){var o=t;t=r,r=o}else if(0===i||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return 0===(1&this.words[0])},o.prototype.isOdd=function(){return 1===(1&this.words[0])},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){n("number"===typeof e);var t=e%26,r=(e-t)/26,i=1<>>26,u&=67108863,this.words[a]=u}return 0!==o&&(this.words[a]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),n(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:ie.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|e.words[r];if(n!==i){ni&&(t=1);break}}return t},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return-1===this.cmpn(e)},o.prototype.lt=function(e){return-1===this.cmp(e)},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new A(e)},o.prototype.toRed=function(e){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},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(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var v={k256:null,p224:null,p192:null,p25519:null};function y(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function m(){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 w(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function M(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(e){if("string"===typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function I(e){A.call(this,e),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 e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},y.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var n=t0?r.isub(this.p):r.strip(),r},y.prototype.split=function(e,t){e.iushrn(this.n,0,t)},y.prototype.imulK=function(e){return e.imul(this.k)},i(m,y),m.prototype.split=function(e,t){for(var r=4194303,n=Math.min(e.length,9),i=0;i>>22,o=a}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},m.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=i,t=n}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(v[e])return v[e];var t;if("k256"===e)t=new m;else if("p224"===e)t=new b;else if("p192"===e)t=new w;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new M}return v[e]=t,t},A.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},A.prototype._verify2=function(e,t){n(0===(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},A.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},A.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},A.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},A.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},A.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},A.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},A.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},A.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},A.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},A.prototype.isqr=function(e){return this.imul(e,e.clone())},A.prototype.sqr=function(e){return this.mul(e,e)},A.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2===1),3===t){var r=this.m.add(new o(1)).iushrn(2);return this.pow(e,r)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);n(!i.isZero());var u=new o(1).toRed(this),s=u.redNeg(),c=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,c).cmp(s);)l.redIAdd(s);for(var f=this.pow(l,i),d=this.pow(e,i.addn(1).iushrn(1)),h=this.pow(e,i),p=a;0!==h.cmp(u);){for(var g=h,v=0;0!==g.cmp(u);v++)g=g.redSqr();n(v=0;n--){for(var c=t.words[n],l=s-1;l>=0;l--){var f=c>>l&1;i!==r[0]&&(i=this.sqr(i)),0!==f||0!==a?(a<<=1,a|=f,(4===++u||0===n&&0===l)&&(i=this.mul(i,r[a]),u=0,a=0)):u=0}s=26}return i},A.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},A.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new I(e)},i(I,A),I.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},I.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},I.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},I.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},I.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,this)}).call(this,r(72)(e))},function(e,t,r){"use strict";function n(e){var t=void 0;return"undefined"!==typeof window&&"undefined"!==typeof window[e]&&(t=window[e]),t}function i(e){var t=n(e);if(!t)throw new Error("".concat(e," is not defined in Window"));return t}Object.defineProperty(t,"__esModule",{value:!0}),t.getLocalStorage=t.getLocalStorageOrThrow=t.getCrypto=t.getCryptoOrThrow=t.getLocation=t.getLocationOrThrow=t.getNavigator=t.getNavigatorOrThrow=t.getDocument=t.getDocumentOrThrow=t.getFromWindowOrThrow=t.getFromWindow=void 0,t.getFromWindow=n,t.getFromWindowOrThrow=i,t.getDocumentOrThrow=function(){return i("document")},t.getDocument=function(){return n("document")},t.getNavigatorOrThrow=function(){return i("navigator")},t.getNavigator=function(){return n("navigator")},t.getLocationOrThrow=function(){return i("location")},t.getLocation=function(){return n("location")},t.getCryptoOrThrow=function(){return i("crypto")},t.getCrypto=function(){return n("crypto")},t.getLocalStorageOrThrow=function(){return i("localStorage")},t.getLocalStorage=function(){return n("localStorage")}},,function(e,t,r){"use strict";function n(e,t){for(var r in t)Object.defineProperty(e,r,{value:t[r],enumerable:!0,configurable:!0});return e}e.exports=function(e,t,r){if(!e||"string"===typeof e)throw new TypeError("Please pass an Error to err-code");r||(r={}),"object"===typeof t&&(r=t,t=""),t&&(r.code=t);try{return n(e,r)}catch(o){r.message=e.message,r.stack=e.stack;var i=function(){};return i.prototype=Object.create(Object.getPrototypeOf(e)),n(new i,r)}}},function(e,t,r){"use strict";var n=r(245),i=Object.prototype.toString;function o(e){return"[object Array]"===i.call(e)}function a(e){return"undefined"===typeof e}function u(e){return null!==e&&"object"===typeof e}function s(e){return"[object Function]"===i.call(e)}function c(e,t){if(null!==e&&"undefined"!==typeof e)if("object"!==typeof e&&(e=[e]),o(e))for(var r=0,n=e.length;r(i>>1)-1?(i>>1)-s:s,o.isubn(u)):u=0,n[a]=u,o.iushrn(1)}return n},n.getJSF=function(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var n,i=0,o=0;e.cmpn(-i)>0||t.cmpn(-o)>0;){var a,u,s=e.andln(3)+i&3,c=t.andln(3)+o&3;3===s&&(s=-1),3===c&&(c=-1),a=0===(1&s)?0:3!==(n=e.andln(7)+i&7)&&5!==n||2!==c?s:-s,r[0].push(a),u=0===(1&c)?0:3!==(n=t.andln(7)+o&7)&&5!==n||2!==s?c:-c,r[1].push(u),2*i===a+1&&(i=1-i),2*o===u+1&&(o=1-o),e.iushrn(1),t.iushrn(1)}return r},n.cachedProperty=function(e,t,r){var n="_"+t;e.prototype[t]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},n.parseBytes=function(e){return"string"===typeof e?n.toArray(e,"hex"):e},n.intFromLE=function(e){return new i(e,"hex","le")}},function(e,t,r){var n=r(21),i=n.Buffer;function o(e,t){for(var r in e)t[r]=e[r]}function a(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(o(n,t),t.Buffer=a),a.prototype=Object.create(i.prototype),o(i,a),a.from=function(e,t,r){if("number"===typeof e)throw new TypeError("Argument must not be a number");return i(e,t,r)},a.alloc=function(e,t,r){if("number"!==typeof e)throw new TypeError("Argument must be a number");var n=i(e);return void 0!==t?"string"===typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},a.allocUnsafe=function(e){if("number"!==typeof e)throw new TypeError("Argument must be a number");return i(e)},a.allocUnsafeSlow=function(e){if("number"!==typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}},function(e,t,r){var n=r(75).default,i=r(37);e.exports=function(e,t){if(t&&("object"===n(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return i(e)},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,r){"use strict";!function(t){function r(e){return parseInt(e)===e}function n(e){if(!r(e.length))return!1;for(var t=0;t255)return!1;return!0}function i(e,t){if(e.buffer&&ArrayBuffer.isView(e)&&"Uint8Array"===e.name)return t&&(e=e.slice?e.slice():Array.prototype.slice.call(e)),e;if(Array.isArray(e)){if(!n(e))throw new Error("Array contains invalid value: "+e);return new Uint8Array(e)}if(r(e.length)&&n(e))return new Uint8Array(e);throw new Error("unsupported array-like object")}function o(e){return new Uint8Array(e)}function a(e,t,r,n,i){null==n&&null==i||(e=e.slice?e.slice(n,i):Array.prototype.slice.call(e,n,i)),t.set(e,r)}var u={toBytes:function(e){var t=[],r=0;for(e=encodeURI(e);r191&&n<224?(t.push(String.fromCharCode((31&n)<<6|63&e[r+1])),r+=2):(t.push(String.fromCharCode((15&n)<<12|(63&e[r+1])<<6|63&e[r+2])),r+=3)}return t.join("")}},s=function(){var e="0123456789abcdef";return{toBytes:function(e){for(var t=[],r=0;r>4]+e[15&i])}return r.join("")}}}(),c={16:10,24:12,32:14},l=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],f=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],d=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],h=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],p=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],g=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],v=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],y=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],m=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],b=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],w=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],M=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],A=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],I=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],j=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function N(e){for(var t=[],r=0;r>2,this._Ke[r][t%4]=o[t],this._Kd[e-r][t%4]=o[t];for(var a,u=0,s=i;s>16&255]<<24^f[a>>8&255]<<16^f[255&a]<<8^f[a>>24&255]^l[u]<<24,u+=1,8!=i)for(t=1;t>8&255]<<8^f[a>>16&255]<<16^f[a>>24&255]<<24;for(t=i/2+1;t>2,h=s%4,this._Ke[d][h]=o[t],this._Kd[e-d][h]=o[t++],s++}for(var d=1;d>24&255]^A[a>>16&255]^I[a>>8&255]^j[255&a]},x.prototype.encrypt=function(e){if(16!=e.length)throw new Error("invalid plaintext size (must be 16 bytes)");for(var t=this._Ke.length-1,r=[0,0,0,0],n=N(e),i=0;i<4;i++)n[i]^=this._Ke[0][i];for(var a=1;a>24&255]^p[n[(i+1)%4]>>16&255]^g[n[(i+2)%4]>>8&255]^v[255&n[(i+3)%4]]^this._Ke[a][i];n=r.slice()}var u,s=o(16);for(i=0;i<4;i++)u=this._Ke[t][i],s[4*i]=255&(f[n[i]>>24&255]^u>>24),s[4*i+1]=255&(f[n[(i+1)%4]>>16&255]^u>>16),s[4*i+2]=255&(f[n[(i+2)%4]>>8&255]^u>>8),s[4*i+3]=255&(f[255&n[(i+3)%4]]^u);return s},x.prototype.decrypt=function(e){if(16!=e.length)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var t=this._Kd.length-1,r=[0,0,0,0],n=N(e),i=0;i<4;i++)n[i]^=this._Kd[0][i];for(var a=1;a>24&255]^m[n[(i+3)%4]>>16&255]^b[n[(i+2)%4]>>8&255]^w[255&n[(i+1)%4]]^this._Kd[a][i];n=r.slice()}var u,s=o(16);for(i=0;i<4;i++)u=this._Kd[t][i],s[4*i]=255&(d[n[i]>>24&255]^u>>24),s[4*i+1]=255&(d[n[(i+3)%4]>>16&255]^u>>16),s[4*i+2]=255&(d[n[(i+2)%4]>>8&255]^u>>8),s[4*i+3]=255&(d[255&n[(i+1)%4]]^u);return s};var k=function e(t){if(!(this instanceof e))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new x(t)};k.prototype.encrypt=function(e){if((e=i(e)).length%16!==0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=o(e.length),r=o(16),n=0;n=0;--t)this._counter[t]=e%256,e>>=8},S.prototype.setBytes=function(e){if(16!=(e=i(e,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=e},S.prototype.increment=function(){for(var e=15;e>=0;e--){if(255!==this._counter[e]){this._counter[e]++;break}this._counter[e]=0}};var O=function e(t,r){if(!(this instanceof e))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",r instanceof S||(r=new S(r)),this._counter=r,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new x(t)};O.prototype.encrypt=function(e){for(var t=i(e,!0),r=0;r16)throw new Error("PKCS#7 padding byte out of range");for(var r=e.length-t,n=0;n0&&(10===arguments[0]?k||(k=!0,j.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?j.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",M.b.errors.UNEXPECTED_ARGUMENT,{}):j.throwError("BigNumber.toString does not accept parameters",M.b.errors.UNEXPECTED_ARGUMENT,{})),S(this).toString(10)}},{key:"toHexString",value:function(){return this._hex}},{key:"toJSON",value:function(e){return{type:"BigNumber",hex:this.toHexString()}}}],[{key:"from",value:function(t){if(t instanceof e)return t;if("string"===typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new e(N,D(t)):t.match(/^-?[0-9]+$/)?new e(N,D(new I(t))):j.throwArgumentError("invalid BigNumber string","value",t);if("number"===typeof t)return t%1&&O("underflow","BigNumber.from",t),(t>=x||t<=-x)&&O("overflow","BigNumber.from",t),e.from(String(t));var r=t;if("bigint"===typeof r)return e.from(r.toString());if(Object(m.j)(r))return e.from(Object(m.i)(r));if(r)if(r.toHexString){var n=r.toHexString();if("string"===typeof n)return e.from(n)}else{var i=r._hex;if(null==i&&"BigNumber"===r.type&&(i=r.hex),"string"===typeof i&&(Object(m.l)(i)||"-"===i[0]&&Object(m.l)(i.substring(1))))return e.from(i)}return j.throwArgumentError("invalid BigNumber value","value",t)}},{key:"isBigNumber",value:function(e){return!(!e||!e._isBigNumber)}}]),e}();function D(e){if("string"!==typeof e)return D(e.toString(16));if("-"===e[0])return"-"===(e=e.substring(1))[0]&&j.throwArgumentError("invalid hex","value",e),"0x00"===(e=D(e))?e:"-"+e;if("0x"!==e.substring(0,2)&&(e="0x"+e),"0x"===e)return"0x00";for(e.length%2&&(e="0x0"+e.substring(2));e.length>4&&"0x00"===e.substring(0,4);)e="0x"+e.substring(4);return e}function T(e){return E.from(D(e))}function S(e){var t=E.from(e).toHexString();return"-"===t[0]?new I("-"+t.substring(3),16):new I(t.substring(2),16)}function O(e,t,r){var n={fault:e,operation:t};return null!=r&&(n.value=r),j.throwError(e,M.b.errors.NUMERIC_FAULT,n)}var _=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{s(n.next(e))}catch(t){o(t)}}function u(e){try{s(n.throw(e))}catch(t){o(t)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,u)}s((n=n.apply(e,t||[])).next())}))},C=new M.b("properties/5.7.0");function L(e,t,r){Object.defineProperty(e,t,{enumerable:!0,value:r,writable:!1})}function z(e,t){for(var r=0;r<32;r++){if(e[t])return e[t];if(!e.prototype||"object"!==typeof e.prototype)break;e=Object.getPrototypeOf(e.prototype).constructor}return null}function P(e){return _(this,void 0,void 0,Object(y.a)().mark((function t(){var r,n;return Object(y.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=Object.keys(e).map((function(t){var r=e[t];return Promise.resolve(r).then((function(e){return{key:t,value:e}}))})),t.next=3,Promise.all(r);case 3:return n=t.sent,t.abrupt("return",n.reduce((function(e,t){return e[t.key]=t.value,e}),{}));case 5:case"end":return t.stop()}}),t)})))}function R(e,t){e&&"object"===typeof e||C.throwArgumentError("invalid object","object",e),Object.keys(e).forEach((function(r){t[r]||C.throwArgumentError("invalid object key - "+r,"transaction:"+r,e)}))}function B(e){var t={};for(var r in e)t[r]=e[r];return t}var U={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function Q(e){if(void 0===e||null===e||U[typeof e])return!0;if(Array.isArray(e)||"object"===typeof e){if(!Object.isFrozen(e))return!1;for(var t=Object.keys(e),r=0;rthis.wordSize&&Z.throwError("value out-of-bounds",M.b.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:t.length}),t.length%this.wordSize&&(t=Object(m.b)([this._padding.slice(t.length%this.wordSize),t])),t}},{key:"writeValue",value:function(e){return this._writeData(this._getValue(e))}},{key:"writeUpdatableValue",value:function(){var e=this,t=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,function(r){e._data[t]=e._getValue(r)}}}]),e}(),K=function(){function e(t,r,n,i){Object(g.a)(this,e),L(this,"_data",Object(m.a)(t)),L(this,"wordSize",r||32),L(this,"_coerceFunc",n),L(this,"allowLoose",i),this._offset=0}return Object(v.a)(e,[{key:"data",get:function(){return Object(m.i)(this._data)}},{key:"consumed",get:function(){return this._offset}},{key:"coerce",value:function(t,r){return this._coerceFunc?this._coerceFunc(t,r):e.coerce(t,r)}},{key:"_peekBytes",value:function(e,t,r){var n=Math.ceil(t/this.wordSize)*this.wordSize;return this._offset+n>this._data.length&&(this.allowLoose&&r&&this._offset+t<=this._data.length?n=t:Z.throwError("data out-of-bounds",M.b.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+n})),this._data.slice(this._offset,this._offset+n)}},{key:"subReader",value:function(t){return new e(this._data.slice(this._offset+t),this.wordSize,this._coerceFunc,this.allowLoose)}},{key:"readBytes",value:function(e,t){var r=this._peekBytes(0,e,!!t);return this._offset+=r.length,r.slice(0,e)}},{key:"readValue",value:function(){return E.from(this.readBytes(this.wordSize))}}],[{key:"coerce",value:function(e,t){var r=e.match("^u?int([0-9]+)$");return r&&parseInt(r[1])<=48&&(t=t.toNumber()),t}}]),e}(),J=r(144),X=r.n(J);function $(e){return"0x"+X.a.keccak_256(Object(m.a)(e))}var ee=new M.b("rlp/5.7.0");function te(e){for(var t=[];e;)t.unshift(255&e),e>>=8;return t}function re(e,t,r){for(var n=0,i=0;it+1+n&&ee.throwError("child data too short",M.b.errors.BUFFER_OVERRUN,{})}return{consumed:1+n,result:i}}function ae(e,t){if(0===e.length&&ee.throwError("data too short",M.b.errors.BUFFER_OVERRUN,{}),e[t]>=248){var r=e[t]-247;t+1+r>e.length&&ee.throwError("data short segment too short",M.b.errors.BUFFER_OVERRUN,{});var n=re(e,t+1,r);return t+1+r+n>e.length&&ee.throwError("data long segment too short",M.b.errors.BUFFER_OVERRUN,{}),oe(e,t,t+1+r,r+n)}if(e[t]>=192){var i=e[t]-192;return t+1+i>e.length&&ee.throwError("data array too short",M.b.errors.BUFFER_OVERRUN,{}),oe(e,t,t+1,i)}if(e[t]>=184){var o=e[t]-183;t+1+o>e.length&&ee.throwError("data array too short",M.b.errors.BUFFER_OVERRUN,{});var a=re(e,t+1,o);return t+1+o+a>e.length&&ee.throwError("data array too short",M.b.errors.BUFFER_OVERRUN,{}),{consumed:1+o+a,result:Object(m.i)(e.slice(t+1+o,t+1+o+a))}}if(e[t]>=128){var u=e[t]-128;return t+1+u>e.length&&ee.throwError("data too short",M.b.errors.BUFFER_OVERRUN,{}),{consumed:1+u,result:Object(m.i)(e.slice(t+1,t+1+u))}}return{consumed:1,result:Object(m.i)(e[t])}}function ue(e){var t=Object(m.a)(e),r=ae(t,0);return r.consumed!==t.length&&ee.throwArgumentError("invalid rlp data","data",e),r.result}var se=new M.b("address/5.7.0");function ce(e){Object(m.l)(e,20)||se.throwArgumentError("invalid address","address",e);for(var t=(e=e.toLowerCase()).substring(2).split(""),r=new Uint8Array(40),n=0;n<40;n++)r[n]=t[n].charCodeAt(0);for(var i=Object(m.a)($(r)),o=0;o<40;o+=2)i[o>>1]>>4>=8&&(t[o]=t[o].toUpperCase()),(15&i[o>>1])>=8&&(t[o+1]=t[o+1].toUpperCase());return"0x"+t.join("")}for(var le={},fe=0;fe<10;fe++)le[String(fe)]=String(fe);for(var de=0;de<26;de++)le[String.fromCharCode(65+de)]=String(10+de);var he,pe=Math.floor((he=9007199254740991,Math.log10?Math.log10(he):Math.log(he)/Math.LN10));function ge(e){for(var t=(e=(e=e.toUpperCase()).substring(4)+e.substring(0,2)+"00").split("").map((function(e){return le[e]})).join("");t.length>=pe;){var r=t.substring(0,pe);t=parseInt(r,10)%97+t.substring(r.length)}for(var n=String(98-parseInt(t,10)%97);n.length<2;)n="0"+n;return n}function ve(e){var t,r=null;if("string"!==typeof e&&se.throwArgumentError("invalid address","address",e),e.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==e.substring(0,2)&&(e="0x"+e),r=ce(e),e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&r!==e&&se.throwArgumentError("bad address checksum","address",e);else if(e.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(e.substring(2,4)!==ge(e)&&se.throwArgumentError("bad icap checksum","address",e),t=e.substring(4),r=new I(t,36).toString(16);r.length<40;)r="0"+r;r=ce("0x"+r)}else se.throwArgumentError("invalid address","address",e);return r}function ye(e){try{return ve(e),!0}catch(t){}return!1}function me(e){for(var t,r=(t=ve(e).substring(2),new I(t,16).toString(36)).toUpperCase();r.length<30;)r="0"+r;return"XE"+ge("XE00"+r)+r}function be(e){var t=null;try{t=ve(e.from)}catch(n){se.throwArgumentError("missing from address","transaction",e)}var r=Object(m.o)(Object(m.a)(E.from(e.nonce).toHexString()));return ve(Object(m.e)($(ie([t,r])),12))}function we(e,t,r){return 32!==Object(m.d)(t)&&se.throwArgumentError("salt must be 32 bytes","salt",t),32!==Object(m.d)(r)&&se.throwArgumentError("initCodeHash must be 32 bytes","initCodeHash",r),ve(Object(m.e)($(Object(m.b)(["0xff",ve(e),t,r])),12))}var Me,Ae,Ie=new M.b("strings/5.7.0");function je(e,t,r,n,i){if(e===Ae.BAD_PREFIX||e===Ae.UNEXPECTED_CONTINUE){for(var o=0,a=t+1;a>6===2;a++)o++;return o}return e===Ae.OVERRUN?r.length-t-1:0}!function(e){e.current="",e.NFC="NFC",e.NFD="NFD",e.NFKC="NFKC",e.NFKD="NFKD"}(Me||(Me={})),function(e){e.UNEXPECTED_CONTINUE="unexpected continuation byte",e.BAD_PREFIX="bad codepoint prefix",e.OVERRUN="string overrun",e.MISSING_CONTINUE="missing continuation byte",e.OUT_OF_RANGE="out of UTF-8 range",e.UTF16_SURROGATE="UTF-16 surrogate",e.OVERLONG="overlong representation"}(Ae||(Ae={}));var Ne=Object.freeze({error:function(e,t,r,n,i){return Ie.throwArgumentError("invalid codepoint at offset ".concat(t,"; ").concat(e),"bytes",r)},ignore:je,replace:function(e,t,r,n,i){return e===Ae.OVERLONG?(n.push(i),0):(n.push(65533),je(e,t,r))}});function xe(e,t){null==t&&(t=Ne.error),e=Object(m.a)(e);for(var r=[],n=0;n>7!==0){var o=null,a=null;if(192===(224&i))o=1,a=127;else if(224===(240&i))o=2,a=2047;else{if(240!==(248&i)){n+=t(128===(192&i)?Ae.UNEXPECTED_CONTINUE:Ae.BAD_PREFIX,n-1,e,r);continue}o=3,a=65535}if(n-1+o>=e.length)n+=t(Ae.OVERRUN,n-1,e,r);else{for(var u=i&(1<<8-o-1)-1,s=0;s1114111?n+=t(Ae.OUT_OF_RANGE,n-1-o,e,r,u):u>=55296&&u<=57343?n+=t(Ae.UTF16_SURROGATE,n-1-o,e,r,u):u<=a?n+=t(Ae.OVERLONG,n-1-o,e,r,u):r.push(u))}}else r.push(i)}return r}function ke(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Me.current;t!=Me.current&&(Ie.checkNormalize(),e=e.normalize(t));for(var r=[],n=0;n>6|192),r.push(63&i|128);else if(55296==(64512&i)){n++;var o=e.charCodeAt(n);if(n>=e.length||56320!==(64512&o))throw new Error("invalid utf-8 string");var a=65536+((1023&i)<<10)+(1023&o);r.push(a>>18|240),r.push(a>>12&63|128),r.push(a>>6&63|128),r.push(63&a|128)}else r.push(i>>12|224),r.push(i>>6&63|128),r.push(63&i|128)}return Object(m.a)(r)}function Ee(e){var t="0000"+e.toString(16);return"\\u"+t.substring(t.length-4)}function De(e,t){return'"'+xe(e,t).map((function(e){if(e<256){switch(e){case 8:return"\\b";case 9:return"\\t";case 10:return"\\n";case 13:return"\\r";case 34:return'\\"';case 92:return"\\\\"}if(e>=32&&e<127)return String.fromCharCode(e)}return e<=65535?Ee(e):Ee(55296+((e-=65536)>>10&1023))+Ee(56320+(1023&e))})).join("")+'"'}function Te(e){return e.map((function(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10&1023),56320+(1023&e)))})).join("")}function Se(e,t){return Te(xe(e,t))}function Oe(e){return xe(ke(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:Me.current))}function _e(e){return $(ke(e))}var Ce=function(e){Object(h.a)(r,e);var t=Object(p.a)(r);function r(e){return Object(g.a)(this,r),t.call(this,"address","address",e,!1)}return Object(v.a)(r,[{key:"defaultValue",value:function(){return"0x0000000000000000000000000000000000000000"}},{key:"encode",value:function(e,t){try{t=ve(t)}catch(r){this._throwError(r.message,t)}return e.writeValue(t)}},{key:"decode",value:function(e){return ve(Object(m.h)(e.readValue().toHexString(),20))}}]),r}(V),Le=function(e){Object(h.a)(r,e);var t=Object(p.a)(r);function r(e){var n;return Object(g.a)(this,r),(n=t.call(this,e.name,e.type,void 0,e.dynamic)).coder=e,n}return Object(v.a)(r,[{key:"defaultValue",value:function(){return this.coder.defaultValue()}},{key:"encode",value:function(e,t){return this.coder.encode(e,t)}},{key:"decode",value:function(e){return this.coder.decode(e)}}]),r}(V),ze=new M.b(W);function Pe(e,t,r){var n=null;if(Array.isArray(r))n=r;else if(r&&"object"===typeof r){var i={};n=t.map((function(e){var t=e.localName;return t||ze.throwError("cannot encode object for signature with missing names",M.b.errors.INVALID_ARGUMENT,{argument:"values",coder:e,value:r}),i[t]&&ze.throwError("cannot encode object for signature with duplicate names",M.b.errors.INVALID_ARGUMENT,{argument:"values",coder:e,value:r}),i[t]=!0,r[t]}))}else ze.throwArgumentError("invalid tuple value","tuple",r);t.length!==n.length&&ze.throwArgumentError("types/value length mismatch","tuple",r);var o=new q(e.wordSize),a=new q(e.wordSize),u=[];t.forEach((function(e,t){var r=n[t];if(e.dynamic){var i=a.length;e.encode(a,r);var s=o.writeUpdatableValue();u.push((function(e){s(e+i)}))}else e.encode(o,r)})),u.forEach((function(e){e(o.length)}));var s=e.appendWriter(o);return s+=e.appendWriter(a)}function Re(e,t){var r=[],n=e.subReader(0);t.forEach((function(t){var i=null;if(t.dynamic){var o=e.readValue(),a=n.subReader(o.toNumber());try{i=t.decode(a)}catch(u){if(u.code===M.b.errors.BUFFER_OVERRUN)throw u;(i=u).baseType=t.name,i.name=t.localName,i.type=t.type}}else try{i=t.decode(e)}catch(u){if(u.code===M.b.errors.BUFFER_OVERRUN)throw u;(i=u).baseType=t.name,i.name=t.localName,i.type=t.type}void 0!=i&&r.push(i)}));var i=t.reduce((function(e,t){var r=t.localName;return r&&(e[r]||(e[r]=0),e[r]++),e}),{});t.forEach((function(e,t){var n=e.localName;if(n&&1===i[n]&&("length"===n&&(n="_length"),null==r[n])){var o=r[t];o instanceof Error?Object.defineProperty(r,n,{enumerable:!0,get:function(){throw o}}):r[n]=o}}));for(var o=function(){var e=r[a];e instanceof Error&&Object.defineProperty(r,a,{enumerable:!0,get:function(){throw e}})},a=0;a=0?n:"")+"]",u=-1===n||e.dynamic;return(o=t.call(this,"array",a,i,u)).coder=e,o.length=n,o}return Object(v.a)(r,[{key:"defaultValue",value:function(){for(var e=this.coder.defaultValue(),t=[],r=0;re._data.length&&ze.throwError("insufficient data length",M.b.errors.BUFFER_OVERRUN,{length:e._data.length,count:t});for(var r=[],n=0;n=0||"tuple"===e)&&ot[t])return!0;return(it[t]||"payable"===t)&&rt.throwArgumentError("invalid modifier","name",t),!1}function ut(e,t){for(var r in t)L(e,r,t[r])}var st=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),ct=new RegExp(/^(.*)\[([0-9]*)\]$/),lt=function(){function e(t,r){Object(g.a)(this,e),t!==nt&&rt.throwError("use fromString",M.b.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),ut(this,r);var n=this.type.match(ct);ut(this,n?{arrayLength:parseInt(n[2]||"-1"),arrayChildren:e.fromObject({type:n[1],components:this.components}),baseType:"array"}:{arrayLength:null,arrayChildren:null,baseType:null!=this.components?"tuple":this.type}),this._isParamType=!0,Object.freeze(this)}return Object(v.a)(e,[{key:"format",value:function(e){if(e||(e=st.sighash),st[e]||rt.throwArgumentError("invalid format type","format",e),e===st.json){var t={type:"tuple"===this.baseType?"tuple":this.type,name:this.name||void 0};return"boolean"===typeof this.indexed&&(t.indexed=this.indexed),this.components&&(t.components=this.components.map((function(t){return JSON.parse(t.format(e))}))),JSON.stringify(t)}var r="";return"array"===this.baseType?(r+=this.arrayChildren.format(e),r+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):"tuple"===this.baseType?(e!==st.sighash&&(r+=this.type),r+="("+this.components.map((function(t){return t.format(e)})).join(e===st.full?", ":",")+")"):r+=this.type,e!==st.sighash&&(!0===this.indexed&&(r+=" indexed"),e===st.full&&this.name&&(r+=" "+this.name)),r}}],[{key:"from",value:function(t,r){return"string"===typeof t?e.fromString(t,r):e.fromObject(t)}},{key:"fromObject",value:function(t){return e.isParamType(t)?t:new e(nt,{name:t.name||null,type:Mt(t.type),indexed:null==t.indexed?null:!!t.indexed,components:t.components?t.components.map(e.fromObject):null})}},{key:"fromString",value:function(t,r){return n=function(e,t){var r=e;function n(t){rt.throwArgumentError("unexpected character at position ".concat(t),"param",e)}function i(e){var r={type:"",name:"",parent:e,state:{allowType:!0}};return t&&(r.indexed=!1),r}e=e.replace(/\s/g," ");for(var o={type:"",name:"",state:{allowType:!0}},a=o,u=0;u2&&rt.throwArgumentError("invalid human-readable ABI signature","value",e),r[1].match(/^[0-9]+$/)||rt.throwArgumentError("invalid human-readable ABI signature gas","value",e),t.gas=E.from(r[1]),r[0]):e}function gt(e,t){t.constant=!1,t.payable=!1,t.stateMutability="nonpayable",e.split(" ").forEach((function(e){switch(e.trim()){case"constant":t.constant=!0;break;case"payable":t.payable=!0,t.stateMutability="payable";break;case"nonpayable":t.payable=!1,t.stateMutability="nonpayable";break;case"pure":t.constant=!0,t.stateMutability="pure";break;case"view":t.constant=!0,t.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+e)}}))}function vt(e){var t={constant:!1,payable:!0,stateMutability:"payable"};return null!=e.stateMutability?(t.stateMutability=e.stateMutability,t.constant="view"===t.stateMutability||"pure"===t.stateMutability,null!=e.constant&&!!e.constant!==t.constant&&rt.throwArgumentError("cannot have constant function with mutability "+t.stateMutability,"value",e),t.payable="payable"===t.stateMutability,null!=e.payable&&!!e.payable!==t.payable&&rt.throwArgumentError("cannot have payable function with mutability "+t.stateMutability,"value",e)):null!=e.payable?(t.payable=!!e.payable,null!=e.constant||t.payable||"constructor"===e.type||rt.throwArgumentError("unable to determine stateMutability","value",e),t.constant=!!e.constant,t.constant?t.stateMutability="view":t.stateMutability=t.payable?"payable":"nonpayable",t.payable&&t.constant&&rt.throwArgumentError("cannot have constant payable function","value",e)):null!=e.constant?(t.constant=!!e.constant,t.payable=!t.constant,t.stateMutability=t.constant?"view":"payable"):"constructor"!==e.type&&rt.throwArgumentError("unable to determine stateMutability","value",e),t}var yt=function(e){Object(h.a)(r,e);var t=Object(p.a)(r);function r(){return Object(g.a)(this,r),t.apply(this,arguments)}return Object(v.a)(r,[{key:"format",value:function(e){if(e||(e=st.sighash),st[e]||rt.throwArgumentError("invalid format type","format",e),e===st.json)return JSON.stringify({type:"constructor",stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((function(t){return JSON.parse(t.format(e))}))});e===st.sighash&&rt.throwError("cannot format a constructor for sighash",M.b.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});var t="constructor("+this.inputs.map((function(t){return t.format(e)})).join(e===st.full?", ":",")+") ";return this.stateMutability&&"nonpayable"!==this.stateMutability&&(t+=this.stateMutability+" "),t.trim()}}],[{key:"from",value:function(e){return"string"===typeof e?r.fromString(e):r.fromObject(e)}},{key:"fromObject",value:function(e){if(r.isConstructorFragment(e))return e;"constructor"!==e.type&&rt.throwArgumentError("invalid constructor object","value",e);var t=vt(e);t.constant&&rt.throwArgumentError("constructor cannot be constant","value",e);var n={name:null,type:e.type,inputs:e.inputs?e.inputs.map(lt.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?E.from(e.gas):null};return new r(nt,n)}},{key:"fromString",value:function(e){var t={type:"constructor"},n=(e=pt(e,t)).match(jt);return n&&"constructor"===n[1].trim()||rt.throwArgumentError("invalid constructor string","value",e),t.inputs=ft(n[2].trim(),!1),gt(n[3].trim(),t),r.fromObject(t)}},{key:"isConstructorFragment",value:function(e){return e&&e._isFragment&&"constructor"===e.type}}]),r}(dt),mt=function(e){Object(h.a)(r,e);var t=Object(p.a)(r);function r(){return Object(g.a)(this,r),t.apply(this,arguments)}return Object(v.a)(r,[{key:"format",value:function(e){if(e||(e=st.sighash),st[e]||rt.throwArgumentError("invalid format type","format",e),e===st.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((function(t){return JSON.parse(t.format(e))})),outputs:this.outputs.map((function(t){return JSON.parse(t.format(e))}))});var t="";return e!==st.sighash&&(t+="function "),t+=this.name+"("+this.inputs.map((function(t){return t.format(e)})).join(e===st.full?", ":",")+") ",e!==st.sighash&&(this.stateMutability?"nonpayable"!==this.stateMutability&&(t+=this.stateMutability+" "):this.constant&&(t+="view "),this.outputs&&this.outputs.length&&(t+="returns ("+this.outputs.map((function(t){return t.format(e)})).join(", ")+") "),null!=this.gas&&(t+="@"+this.gas.toString()+" ")),t.trim()}}],[{key:"from",value:function(e){return"string"===typeof e?r.fromString(e):r.fromObject(e)}},{key:"fromObject",value:function(e){if(r.isFunctionFragment(e))return e;"function"!==e.type&&rt.throwArgumentError("invalid function object","value",e);var t=vt(e),n={type:e.type,name:It(e.name),constant:t.constant,inputs:e.inputs?e.inputs.map(lt.fromObject):[],outputs:e.outputs?e.outputs.map(lt.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?E.from(e.gas):null};return new r(nt,n)}},{key:"fromString",value:function(e){var t={type:"function"},n=(e=pt(e,t)).split(" returns ");n.length>2&&rt.throwArgumentError("invalid function string","value",e);var i=n[0].match(jt);if(i||rt.throwArgumentError("invalid function signature","value",e),t.name=i[1].trim(),t.name&&It(t.name),t.inputs=ft(i[2],!1),gt(i[3].trim(),t),n.length>1){var o=n[1].match(jt);""==o[1].trim()&&""==o[3].trim()||rt.throwArgumentError("unexpected tokens","value",e),t.outputs=ft(o[2],!1)}else t.outputs=[];return r.fromObject(t)}},{key:"isFunctionFragment",value:function(e){return e&&e._isFragment&&"function"===e.type}}]),r}(yt);function bt(e){var t=e.format();return"Error(string)"!==t&&"Panic(uint256)"!==t||rt.throwArgumentError("cannot specify user defined ".concat(t," error"),"fragment",e),e}var wt=function(e){Object(h.a)(r,e);var t=Object(p.a)(r);function r(){return Object(g.a)(this,r),t.apply(this,arguments)}return Object(v.a)(r,[{key:"format",value:function(e){if(e||(e=st.sighash),st[e]||rt.throwArgumentError("invalid format type","format",e),e===st.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map((function(t){return JSON.parse(t.format(e))}))});var t="";return e!==st.sighash&&(t+="error "),(t+=this.name+"("+this.inputs.map((function(t){return t.format(e)})).join(e===st.full?", ":",")+") ").trim()}}],[{key:"from",value:function(e){return"string"===typeof e?r.fromString(e):r.fromObject(e)}},{key:"fromObject",value:function(e){if(r.isErrorFragment(e))return e;"error"!==e.type&&rt.throwArgumentError("invalid error object","value",e);var t={type:e.type,name:It(e.name),inputs:e.inputs?e.inputs.map(lt.fromObject):[]};return bt(new r(nt,t))}},{key:"fromString",value:function(e){var t={type:"error"},n=e.match(jt);return n||rt.throwArgumentError("invalid error signature","value",e),t.name=n[1].trim(),t.name&&It(t.name),t.inputs=ft(n[2],!1),bt(r.fromObject(t))}},{key:"isErrorFragment",value:function(e){return e&&e._isFragment&&"error"===e.type}}]),r}(dt);function Mt(e){return e.match(/^uint($|[^1-9])/)?e="uint256"+e.substring(4):e.match(/^int($|[^1-9])/)&&(e="int256"+e.substring(3)),e}var At=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function It(e){return e&&e.match(At)||rt.throwArgumentError('invalid identifier "'.concat(e,'"'),"value",e),e}var jt=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");var Nt=new M.b(W),xt=new RegExp(/^bytes([0-9]*)$/),kt=new RegExp(/^(u?int)([0-9]*)$/),Et=function(){function e(t){Object(g.a)(this,e),L(this,"coerceFunc",t||null)}return Object(v.a)(e,[{key:"_getCoder",value:function(e){var t=this;switch(e.baseType){case"address":return new Ce(e.name);case"bool":return new Ue(e.name);case"string":return new et(e.name);case"bytes":return new Ye(e.name);case"array":return new Be(this._getCoder(e.arrayChildren),e.arrayLength,e.name);case"tuple":return new tt((e.components||[]).map((function(e){return t._getCoder(e)})),e.name);case"":return new Ge(e.name)}var r=e.type.match(kt);if(r){var n=parseInt(r[2]||"256");return(0===n||n>256||n%8!==0)&&Nt.throwArgumentError("invalid "+r[1]+" bit length","param",e),new $e(n/8,"int"===r[1],e.name)}if(r=e.type.match(xt)){var i=parseInt(r[1]);return(0===i||i>32)&&Nt.throwArgumentError("invalid bytes length","param",e),new Fe(i,e.name)}return Nt.throwArgumentError("invalid type","type",e.type)}},{key:"_getWordSize",value:function(){return 32}},{key:"_getReader",value:function(e,t){return new K(e,this._getWordSize(),this.coerceFunc,t)}},{key:"_getWriter",value:function(){return new q(this._getWordSize())}},{key:"getDefaultValue",value:function(e){var t=this,r=e.map((function(e){return t._getCoder(lt.from(e))}));return new tt(r,"_").defaultValue()}},{key:"encode",value:function(e,t){var r=this;e.length!==t.length&&Nt.throwError("types/values length mismatch",M.b.errors.INVALID_ARGUMENT,{count:{types:e.length,values:t.length},value:{types:e,values:t}});var n=e.map((function(e){return r._getCoder(lt.from(e))})),i=new tt(n,"_"),o=this._getWriter();return i.encode(o,t),o.data}},{key:"decode",value:function(e,t,r){var n=this,i=e.map((function(e){return n._getCoder(lt.from(e))}));return new tt(i,"_").decode(this._getReader(Object(m.a)(t),r))}}]),e}(),Dt=new Et,Tt=new M.b(W),St=function(e){Object(h.a)(r,e);var t=Object(p.a)(r);function r(){return Object(g.a)(this,r),t.apply(this,arguments)}return Object(v.a)(r)}(G),Ot=function(e){Object(h.a)(r,e);var t=Object(p.a)(r);function r(){return Object(g.a)(this,r),t.apply(this,arguments)}return Object(v.a)(r)}(G),_t=function(e){Object(h.a)(r,e);var t=Object(p.a)(r);function r(){return Object(g.a)(this,r),t.apply(this,arguments)}return Object(v.a)(r)}(G),Ct=function(e){Object(h.a)(r,e);var t=Object(p.a)(r);function r(){return Object(g.a)(this,r),t.apply(this,arguments)}return Object(v.a)(r,null,[{key:"isIndexed",value:function(e){return!(!e||!e._isIndexed)}}]),r}(G),Lt={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function zt(e,t){var r=new Error("deferred error during ABI decoding triggered accessing ".concat(e));return r.error=t,r}var Pt=function(){function e(t){var r=this;Object(g.a)(this,e);L(this,"fragments",("string"===typeof t?JSON.parse(t):t).map((function(e){return dt.from(e)})).filter((function(e){return null!=e}))),L(this,"_abiCoder",z(this instanceof e?this.constructor:void 0,"getAbiCoder")()),L(this,"functions",{}),L(this,"errors",{}),L(this,"events",{}),L(this,"structs",{}),this.fragments.forEach((function(e){var t=null;switch(e.type){case"constructor":return r.deploy?void Tt.warn("duplicate definition - constructor"):void L(r,"deploy",e);case"function":t=r.functions;break;case"event":t=r.events;break;case"error":t=r.errors;break;default:return}var n=e.format();t[n]?Tt.warn("duplicate definition - "+n):t[n]=e})),this.deploy||L(this,"deploy",yt.from({payable:!1,type:"constructor"})),L(this,"_isInterface",!0)}return Object(v.a)(e,[{key:"format",value:function(e){e||(e=st.full),e===st.sighash&&Tt.throwArgumentError("interface does not support formatting sighash","format",e);var t=this.fragments.map((function(t){return t.format(e)}));return e===st.json?JSON.stringify(t.map((function(e){return JSON.parse(e)}))):t}},{key:"getFunction",value:function(e){if(Object(m.l)(e)){for(var t in this.functions)if(e===this.getSighash(t))return this.functions[t];Tt.throwArgumentError("no matching function","sighash",e)}if(-1===e.indexOf("(")){var r=e.trim(),n=Object.keys(this.functions).filter((function(e){return e.split("(")[0]===r}));return 0===n.length?Tt.throwArgumentError("no matching function","name",r):n.length>1&&Tt.throwArgumentError("multiple matching functions","name",r),this.functions[n[0]]}var i=this.functions[mt.fromString(e).format()];return i||Tt.throwArgumentError("no matching function","signature",e),i}},{key:"getEvent",value:function(e){if(Object(m.l)(e)){var t=e.toLowerCase();for(var r in this.events)if(t===this.getEventTopic(r))return this.events[r];Tt.throwArgumentError("no matching event","topichash",t)}if(-1===e.indexOf("(")){var n=e.trim(),i=Object.keys(this.events).filter((function(e){return e.split("(")[0]===n}));return 0===i.length?Tt.throwArgumentError("no matching event","name",n):i.length>1&&Tt.throwArgumentError("multiple matching events","name",n),this.events[i[0]]}var o=this.events[ht.fromString(e).format()];return o||Tt.throwArgumentError("no matching event","signature",e),o}},{key:"getError",value:function(e){if(Object(m.l)(e)){var t=z(this.constructor,"getSighash");for(var r in this.errors){if(e===t(this.errors[r]))return this.errors[r]}Tt.throwArgumentError("no matching error","sighash",e)}if(-1===e.indexOf("(")){var n=e.trim(),i=Object.keys(this.errors).filter((function(e){return e.split("(")[0]===n}));return 0===i.length?Tt.throwArgumentError("no matching error","name",n):i.length>1&&Tt.throwArgumentError("multiple matching errors","name",n),this.errors[i[0]]}var o=this.errors[mt.fromString(e).format()];return o||Tt.throwArgumentError("no matching error","signature",e),o}},{key:"getSighash",value:function(e){if("string"===typeof e)try{e=this.getFunction(e)}catch(t){try{e=this.getError(e)}catch(r){throw t}}return z(this.constructor,"getSighash")(e)}},{key:"getEventTopic",value:function(e){return"string"===typeof e&&(e=this.getEvent(e)),z(this.constructor,"getEventTopic")(e)}},{key:"_decodeParams",value:function(e,t){return this._abiCoder.decode(e,t)}},{key:"_encodeParams",value:function(e,t){return this._abiCoder.encode(e,t)}},{key:"encodeDeploy",value:function(e){return this._encodeParams(this.deploy.inputs,e||[])}},{key:"decodeErrorResult",value:function(e,t){"string"===typeof e&&(e=this.getError(e));var r=Object(m.a)(t);return Object(m.i)(r.slice(0,4))!==this.getSighash(e)&&Tt.throwArgumentError("data signature does not match error ".concat(e.name,"."),"data",Object(m.i)(r)),this._decodeParams(e.inputs,r.slice(4))}},{key:"encodeErrorResult",value:function(e,t){return"string"===typeof e&&(e=this.getError(e)),Object(m.i)(Object(m.b)([this.getSighash(e),this._encodeParams(e.inputs,t||[])]))}},{key:"decodeFunctionData",value:function(e,t){"string"===typeof e&&(e=this.getFunction(e));var r=Object(m.a)(t);return Object(m.i)(r.slice(0,4))!==this.getSighash(e)&&Tt.throwArgumentError("data signature does not match function ".concat(e.name,"."),"data",Object(m.i)(r)),this._decodeParams(e.inputs,r.slice(4))}},{key:"encodeFunctionData",value:function(e,t){return"string"===typeof e&&(e=this.getFunction(e)),Object(m.i)(Object(m.b)([this.getSighash(e),this._encodeParams(e.inputs,t||[])]))}},{key:"decodeFunctionResult",value:function(e,t){"string"===typeof e&&(e=this.getFunction(e));var r=Object(m.a)(t),n=null,i="",o=null,a=null,u=null;switch(r.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(e.outputs,r)}catch(l){}break;case 4:var s=Object(m.i)(r.slice(0,4)),c=Lt[s];if(c)o=this._abiCoder.decode(c.inputs,r.slice(4)),a=c.name,u=c.signature,c.reason&&(n=o[0]),"Error"===a?i="; VM Exception while processing transaction: reverted with reason string ".concat(JSON.stringify(o[0])):"Panic"===a&&(i="; VM Exception while processing transaction: reverted with panic code ".concat(o[0]));else try{var l=this.getError(s);o=this._abiCoder.decode(l.inputs,r.slice(4)),a=l.name,u=l.format()}catch(l){}}return Tt.throwError("call revert exception"+i,M.b.errors.CALL_EXCEPTION,{method:e.format(),data:Object(m.i)(t),errorArgs:o,errorName:a,errorSignature:u,reason:n})}},{key:"encodeFunctionResult",value:function(e,t){return"string"===typeof e&&(e=this.getFunction(e)),Object(m.i)(this._abiCoder.encode(e.outputs,t||[]))}},{key:"encodeFilterTopics",value:function(e,t){var r=this;"string"===typeof e&&(e=this.getEvent(e)),t.length>e.inputs.length&&Tt.throwError("too many arguments for "+e.format(),M.b.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:t});var n=[];e.anonymous||n.push(this.getEventTopic(e));var i=function(e,t){return"string"===e.type?_e(t):"bytes"===e.type?$(Object(m.i)(t)):("bool"===e.type&&"boolean"===typeof t&&(t=t?"0x01":"0x00"),e.type.match(/^u?int/)&&(t=E.from(t).toHexString()),"address"===e.type&&r._abiCoder.encode(["address"],[t]),Object(m.h)(Object(m.i)(t),32))};for(t.forEach((function(t,r){var o=e.inputs[r];o.indexed?null==t?n.push(null):"array"===o.baseType||"tuple"===o.baseType?Tt.throwArgumentError("filtering with tuples or arrays not supported","contract."+o.name,t):Array.isArray(t)?n.push(t.map((function(e){return i(o,e)}))):n.push(i(o,t)):null!=t&&Tt.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+o.name,t)}));n.length&&null===n[n.length-1];)n.pop();return n}},{key:"encodeEventLog",value:function(e,t){var r=this;"string"===typeof e&&(e=this.getEvent(e));var n=[],i=[],o=[];return e.anonymous||n.push(this.getEventTopic(e)),t.length!==e.inputs.length&&Tt.throwArgumentError("event arguments/values mismatch","values",t),e.inputs.forEach((function(e,a){var u=t[a];if(e.indexed)if("string"===e.type)n.push(_e(u));else if("bytes"===e.type)n.push($(u));else{if("tuple"===e.baseType||"array"===e.baseType)throw new Error("not implemented");n.push(r._abiCoder.encode([e.type],[u]))}else i.push(e),o.push(u)})),{data:this._abiCoder.encode(i,o),topics:n}}},{key:"decodeEventLog",value:function(e,t,r){if("string"===typeof e&&(e=this.getEvent(e)),null!=r&&!e.anonymous){var n=this.getEventTopic(e);Object(m.l)(r[0],32)&&r[0].toLowerCase()===n||Tt.throwError("fragment/topic mismatch",M.b.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:n,value:r[0]}),r=r.slice(1)}var i=[],o=[],a=[];e.inputs.forEach((function(e,t){e.indexed?"string"===e.type||"bytes"===e.type||"tuple"===e.baseType||"array"===e.baseType?(i.push(lt.fromObject({type:"bytes32",name:e.name})),a.push(!0)):(i.push(e),a.push(!1)):(o.push(e),a.push(!1))}));var u=null!=r?this._abiCoder.decode(i,Object(m.b)(r)):null,s=this._abiCoder.decode(o,t,!0),c=[],l=0,f=0;e.inputs.forEach((function(e,t){if(e.indexed)if(null==u)c[t]=new Ct({_isIndexed:!0,hash:null});else if(a[t])c[t]=new Ct({_isIndexed:!0,hash:u[f++]});else try{c[t]=u[f++]}catch(n){c[t]=n}else try{c[t]=s[l++]}catch(n){c[t]=n}if(e.name&&null==c[e.name]){var r=c[t];r instanceof Error?Object.defineProperty(c,e.name,{enumerable:!0,get:function(){throw zt("property ".concat(JSON.stringify(e.name)),r)}}):c[e.name]=r}}));for(var d=function(e){var t=c[e];t instanceof Error&&Object.defineProperty(c,e,{enumerable:!0,get:function(){throw zt("index ".concat(e),t)}})},h=0;h=0)throw e;return Ft.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",M.b.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,tx:r})}))),null==r.chainId?r.chainId=this.getChainId():r.chainId=Promise.all([Promise.resolve(r.chainId),this.getChainId()]).then((function(t){return 0!==t[1]&&t[0]!==t[1]&&Ft.throwArgumentError("chainId address mismatch","transaction",e),t[0]})),t.next=23,P(r);case 23:return t.abrupt("return",t.sent);case 24:case"end":return t.stop()}}),t,this)})))}},{key:"_checkProvider",value:function(e){this.provider||Ft.throwError("missing provider",M.b.errors.UNSUPPORTED_OPERATION,{operation:e||"_checkProvider"})}}],[{key:"isSigner",value:function(e){return!(!e||!e._isSigner)}}]),e}(),Ht=function(e){Object(h.a)(r,e);var t=Object(p.a)(r);function r(e,n){var i;return Object(g.a)(this,r),i=t.call(this),L(Object(l.a)(i),"address",e),L(Object(l.a)(i),"provider",n||null),i}return Object(v.a)(r,[{key:"getAddress",value:function(){return Promise.resolve(this.address)}},{key:"_fail",value:function(e,t){return Promise.resolve().then((function(){Ft.throwError(e,M.b.errors.UNSUPPORTED_OPERATION,{operation:t})}))}},{key:"signMessage",value:function(e){return this._fail("VoidSigner cannot sign messages","signMessage")}},{key:"signTransaction",value:function(e){return this._fail("VoidSigner cannot sign transactions","signTransaction")}},{key:"_signTypedData",value:function(e,t,r){return this._fail("VoidSigner cannot sign typed data","signTypedData")}},{key:"connect",value:function(e){return new r(this.address,e)}}]),r}(Zt),Vt=r(352),qt=new M.b("signing-key/5.7.0"),Kt=null;function Jt(){return Kt||(Kt=new Vt.a("secp256k1")),Kt}var Xt=function(){function e(t){Object(g.a)(this,e),L(this,"curve","secp256k1"),L(this,"privateKey",Object(m.i)(t)),32!==Object(m.d)(this.privateKey)&&qt.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");var r=Jt().keyFromPrivate(Object(m.a)(this.privateKey));L(this,"publicKey","0x"+r.getPublic(!1,"hex")),L(this,"compressedPublicKey","0x"+r.getPublic(!0,"hex")),L(this,"_isSigningKey",!0)}return Object(v.a)(e,[{key:"_addPoint",value:function(e){var t=Jt().keyFromPublic(Object(m.a)(this.publicKey)),r=Jt().keyFromPublic(Object(m.a)(e));return"0x"+t.pub.add(r.pub).encodeCompressed("hex")}},{key:"signDigest",value:function(e){var t=Jt().keyFromPrivate(Object(m.a)(this.privateKey)),r=Object(m.a)(e);32!==r.length&&qt.throwArgumentError("bad digest length","digest",e);var n=t.sign(r,{canonical:!0});return Object(m.n)({recoveryParam:n.recoveryParam,r:Object(m.h)("0x"+n.r.toString(16),32),s:Object(m.h)("0x"+n.s.toString(16),32)})}},{key:"computeSharedSecret",value:function(e){var t=Jt().keyFromPrivate(Object(m.a)(this.privateKey)),r=Jt().keyFromPublic(Object(m.a)(er(e)));return Object(m.h)("0x"+t.derive(r.getPublic()).toString(16),32)}}],[{key:"isSigningKey",value:function(e){return!(!e||!e._isSigningKey)}}]),e}();function $t(e,t){var r=Object(m.n)(t),n={r:Object(m.a)(r.r),s:Object(m.a)(r.s)};return"0x"+Jt().recoverPubKey(Object(m.a)(e),n,r.recoveryParam).encode("hex",!1)}function er(e,t){var r=Object(m.a)(e);if(32===r.length){var n=new Xt(r);return t?"0x"+Jt().keyFromPrivate(r).getPublic(!0,"hex"):n.publicKey}return 33===r.length?t?Object(m.i)(r):"0x"+Jt().keyFromPublic(r).getPublic(!1,"hex"):65===r.length?t?"0x"+Jt().keyFromPublic(r).getPublic(!0,"hex"):Object(m.i)(r):qt.throwArgumentError("invalid public or private key","key","[REDACTED]")}var tr,rr=new M.b("transactions/5.7.0");function nr(e){return"0x"===e?null:ve(e)}function ir(e){return"0x"===e?Ze:E.from(e)}!function(e){e[e.legacy=0]="legacy",e[e.eip2930=1]="eip2930",e[e.eip1559=2]="eip1559"}(tr||(tr={}));var or=[{name:"nonce",maxLength:32,numeric:!0},{name:"gasPrice",maxLength:32,numeric:!0},{name:"gasLimit",maxLength:32,numeric:!0},{name:"to",length:20},{name:"value",maxLength:32,numeric:!0},{name:"data"}],ar={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,type:!0,value:!0};function ur(e){var t=er(e);return ve(Object(m.e)($(Object(m.e)(t,1)),12))}function sr(e,t){return ur($t(Object(m.a)(e),t))}function cr(e,t){var r=Object(m.o)(E.from(e).toHexString());return r.length>32&&rr.throwArgumentError("invalid length for "+t,"transaction:"+t,e),r}function lr(e,t){return{address:ve(e),storageKeys:(t||[]).map((function(t,r){return 32!==Object(m.d)(t)&&rr.throwArgumentError("invalid access list storageKey","accessList[".concat(e,":").concat(r,"]"),t),t.toLowerCase()}))}}function fr(e){if(Array.isArray(e))return e.map((function(e,t){return Array.isArray(e)?(e.length>2&&rr.throwArgumentError("access list expected to be [ address, storageKeys[] ]","value[".concat(t,"]"),e),lr(e[0],e[1])):lr(e.address,e.storageKeys)}));var t=Object.keys(e).map((function(t){var r=e[t].reduce((function(e,t){return e[t]=!0,e}),{});return lr(t,Object.keys(r).sort())}));return t.sort((function(e,t){return e.address.localeCompare(t.address)})),t}function dr(e){return fr(e).map((function(e){return[e.address,e.storageKeys]}))}function hr(e,t){if(null!=e.gasPrice){var r=E.from(e.gasPrice),n=E.from(e.maxFeePerGas||0);r.eq(n)||rr.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:r,maxFeePerGas:n})}var i=[cr(e.chainId||0,"chainId"),cr(e.nonce||0,"nonce"),cr(e.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),cr(e.maxFeePerGas||0,"maxFeePerGas"),cr(e.gasLimit||0,"gasLimit"),null!=e.to?ve(e.to):"0x",cr(e.value||0,"value"),e.data||"0x",dr(e.accessList||[])];if(t){var o=Object(m.n)(t);i.push(cr(o.recoveryParam,"recoveryParam")),i.push(Object(m.o)(o.r)),i.push(Object(m.o)(o.s))}return Object(m.c)(["0x02",ie(i)])}function pr(e,t){var r=[cr(e.chainId||0,"chainId"),cr(e.nonce||0,"nonce"),cr(e.gasPrice||0,"gasPrice"),cr(e.gasLimit||0,"gasLimit"),null!=e.to?ve(e.to):"0x",cr(e.value||0,"value"),e.data||"0x",dr(e.accessList||[])];if(t){var n=Object(m.n)(t);r.push(cr(n.recoveryParam,"recoveryParam")),r.push(Object(m.o)(n.r)),r.push(Object(m.o)(n.s))}return Object(m.c)(["0x01",ie(r)])}function gr(e,t){if(null==e.type||0===e.type)return null!=e.accessList&&rr.throwArgumentError("untyped transactions do not support accessList; include type: 1","transaction",e),function(e,t){R(e,ar);var r=[];or.forEach((function(t){var n=e[t.name]||[],i={};t.numeric&&(i.hexPad="left"),n=Object(m.a)(Object(m.i)(n,i)),t.length&&n.length!==t.length&&n.length>0&&rr.throwArgumentError("invalid length for "+t.name,"transaction:"+t.name,n),t.maxLength&&(n=Object(m.o)(n)).length>t.maxLength&&rr.throwArgumentError("invalid length for "+t.name,"transaction:"+t.name,n),r.push(Object(m.i)(n))}));var n=0;if(null!=e.chainId?"number"!==typeof(n=e.chainId)&&rr.throwArgumentError("invalid transaction.chainId","transaction",e):t&&!Object(m.k)(t)&&t.v>28&&(n=Math.floor((t.v-35)/2)),0!==n&&(r.push(Object(m.i)(n)),r.push("0x"),r.push("0x")),!t)return ie(r);var i=Object(m.n)(t),o=27+i.recoveryParam;return 0!==n?(r.pop(),r.pop(),r.pop(),o+=2*n+8,i.v>28&&i.v!==o&&rr.throwArgumentError("transaction.chainId/signature.v mismatch","signature",t)):i.v!==o&&rr.throwArgumentError("transaction.chainId/signature.v mismatch","signature",t),r.push(Object(m.i)(o)),r.push(Object(m.o)(Object(m.a)(i.r))),r.push(Object(m.o)(Object(m.a)(i.s))),ie(r)}(e,t);switch(e.type){case 1:return pr(e,t);case 2:return hr(e,t)}return rr.throwError("unsupported transaction type: ".concat(e.type),M.b.errors.UNSUPPORTED_OPERATION,{operation:"serializeTransaction",transactionType:e.type})}function vr(e,t,r){try{var n=ir(t[0]).toNumber();if(0!==n&&1!==n)throw new Error("bad recid");e.v=n}catch(o){rr.throwArgumentError("invalid v for transaction type: 1","v",t[0])}e.r=Object(m.h)(t[1],32),e.s=Object(m.h)(t[2],32);try{var i=$(r(e));e.from=sr(i,{r:e.r,s:e.s,recoveryParam:e.v})}catch(o){}}function yr(e){var t=Object(m.a)(e);if(t[0]>127)return function(e){var t=ue(e);9!==t.length&&6!==t.length&&rr.throwArgumentError("invalid raw transaction","rawTransaction",e);var r={nonce:ir(t[0]).toNumber(),gasPrice:ir(t[1]),gasLimit:ir(t[2]),to:nr(t[3]),value:ir(t[4]),data:t[5],chainId:0};if(6===t.length)return r;try{r.v=E.from(t[6]).toNumber()}catch(a){return r}if(r.r=Object(m.h)(t[7],32),r.s=Object(m.h)(t[8],32),E.from(r.r).isZero()&&E.from(r.s).isZero())r.chainId=r.v,r.v=0;else{r.chainId=Math.floor((r.v-35)/2),r.chainId<0&&(r.chainId=0);var n=r.v-27,i=t.slice(0,6);0!==r.chainId&&(i.push(Object(m.i)(r.chainId)),i.push("0x"),i.push("0x"),n-=2*r.chainId+8);var o=$(ie(i));try{r.from=sr(o,{r:Object(m.i)(r.r),s:Object(m.i)(r.s),recoveryParam:n})}catch(a){}r.hash=$(e)}return r.type=null,r}(t);switch(t[0]){case 1:return function(e){var t=ue(e.slice(1));8!==t.length&&11!==t.length&&rr.throwArgumentError("invalid component count for transaction type: 1","payload",Object(m.i)(e));var r={type:1,chainId:ir(t[0]).toNumber(),nonce:ir(t[1]).toNumber(),gasPrice:ir(t[2]),gasLimit:ir(t[3]),to:nr(t[4]),value:ir(t[5]),data:t[6],accessList:fr(t[7])};return 8===t.length||(r.hash=$(e),vr(r,t.slice(8),pr)),r}(t);case 2:return function(e){var t=ue(e.slice(1));9!==t.length&&12!==t.length&&rr.throwArgumentError("invalid component count for transaction type: 2","payload",Object(m.i)(e));var r=ir(t[2]),n=ir(t[3]),i={type:2,chainId:ir(t[0]).toNumber(),nonce:ir(t[1]).toNumber(),maxPriorityFeePerGas:r,maxFeePerGas:n,gasPrice:null,gasLimit:ir(t[4]),to:nr(t[5]),value:ir(t[6]),data:t[7],accessList:fr(t[8])};return 9===t.length||(i.hash=$(e),vr(i,t.slice(9),hr)),i}(t)}return rr.throwError("unsupported transaction type: ".concat(t[0]),M.b.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:t[0]})}var mr=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{s(n.next(e))}catch(t){o(t)}}function u(e){try{s(n.throw(e))}catch(t){o(t)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,u)}s((n=n.apply(e,t||[])).next())}))},br=new M.b("contracts/5.7.0"),wr={chainId:!0,data:!0,from:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0,customData:!0,ccipReadEnabled:!0};function Mr(e,t){return mr(this,void 0,void 0,Object(y.a)().mark((function r(){var n,i;return Object(y.a)().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,t;case 2:return"string"!==typeof(n=r.sent)&&br.throwArgumentError("invalid address or ENS name","name",n),r.prev=4,r.abrupt("return",ve(n));case 8:r.prev=8,r.t0=r.catch(4);case 10:return e||br.throwError("a provider or signer is needed to resolve ENS names",M.b.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"}),r.next=13,e.resolveName(n);case 13:return null==(i=r.sent)&&br.throwArgumentError("resolver or addr is not configured for ENS name","name",n),r.abrupt("return",i);case 16:case"end":return r.stop()}}),r,null,[[4,8]])})))}function Ar(e,t,r){return mr(this,void 0,void 0,Object(y.a)().mark((function n(){return Object(y.a)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!Array.isArray(r)){n.next=4;break}return n.next=3,Promise.all(r.map((function(r,n){return Ar(e,Array.isArray(t)?t[n]:t[r.name],r)})));case 3:case 7:case 11:case 17:return n.abrupt("return",n.sent);case 4:if("address"!==r.type){n.next=8;break}return n.next=7,Mr(e,t);case 8:if("tuple"!==r.type){n.next=12;break}return n.next=11,Ar(e,t,r.components);case 12:if("array"!==r.baseType){n.next=18;break}if(Array.isArray(t)){n.next=15;break}return n.abrupt("return",Promise.reject(br.makeError("invalid value for array",M.b.errors.INVALID_ARGUMENT,{argument:"value",value:t})));case 15:return n.next=17,Promise.all(t.map((function(t){return Ar(e,t,r.arrayChildren)})));case 18:return n.abrupt("return",t);case 19:case"end":return n.stop()}}),n)})))}function Ir(e,t,r){return mr(this,void 0,void 0,Object(y.a)().mark((function n(){var i,o,a,u,s,c,l,f,d,h,p=this;return Object(y.a)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return i={},r.length===t.inputs.length+1&&"object"===typeof r[r.length-1]&&(i=B(r.pop())),br.checkArgumentCount(r.length,t.inputs.length,"passed to contract"),e.signer?i.from?i.from=P({override:Mr(e.signer,i.from),signer:e.signer.getAddress()}).then((function(e){return mr(p,void 0,void 0,Object(y.a)().mark((function t(){return Object(y.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return ve(e.signer)!==e.override&&br.throwError("Contract with a Signer cannot override from",M.b.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),t.abrupt("return",e.override);case 2:case"end":return t.stop()}}),t)})))})):i.from=e.signer.getAddress():i.from&&(i.from=Mr(e.provider,i.from)),n.next=6,P({args:Ar(e.signer||e.provider,r,t.inputs),address:e.resolvedAddress,overrides:P(i)||{}});case 6:if(o=n.sent,a=e.interface.encodeFunctionData(t,o.args),u={data:a,to:o.address},null!=(s=o.overrides).nonce&&(u.nonce=E.from(s.nonce).toNumber()),null!=s.gasLimit&&(u.gasLimit=E.from(s.gasLimit)),null!=s.gasPrice&&(u.gasPrice=E.from(s.gasPrice)),null!=s.maxFeePerGas&&(u.maxFeePerGas=E.from(s.maxFeePerGas)),null!=s.maxPriorityFeePerGas&&(u.maxPriorityFeePerGas=E.from(s.maxPriorityFeePerGas)),null!=s.from&&(u.from=s.from),null!=s.type&&(u.type=s.type),null!=s.accessList&&(u.accessList=fr(s.accessList)),null==u.gasLimit&&null!=t.gas){for(c=21e3,l=Object(m.a)(a),f=0;f1)){e=e.substring(1);var r=t[0];try{null==i[e]&&L(i,e,i[r])}catch(n){}null==i.functions[e]&&L(i.functions,e,i.functions[r]),null==i.callStatic[e]&&L(i.callStatic,e,i.callStatic[r]),null==i.populateTransaction[e]&&L(i.populateTransaction,e,i.populateTransaction[r]),null==i.estimateGas[e]&&L(i.estimateGas,e,i.estimateGas[r])}}))}return Object(v.a)(e,[{key:"deployed",value:function(){return this._deployed()}},{key:"_deployed",value:function(e){var t=this;return this._deployedPromise||(this.deployTransaction?this._deployedPromise=this.deployTransaction.wait().then((function(){return t})):this._deployedPromise=this.provider.getCode(this.address,e).then((function(e){return"0x"===e&&br.throwError("contract not deployed",M.b.errors.UNSUPPORTED_OPERATION,{contractAddress:t.address,operation:"getDeployed"}),t}))),this._deployedPromise}},{key:"fallback",value:function(e){var t=this;this.signer||br.throwError("sending a transactions require a signer",M.b.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});var r=B(e||{});return["from","to"].forEach((function(e){null!=r[e]&&br.throwError("cannot override "+e,M.b.errors.UNSUPPORTED_OPERATION,{operation:e})})),r.to=this.resolvedAddress,this.deployed().then((function(){return t.signer.sendTransaction(r)}))}},{key:"connect",value:function(e){"string"===typeof e&&(e=new Ht(e,this.provider));var t=new this.constructor(this.address,this.interface,e);return this.deployTransaction&&L(t,"deployTransaction",this.deployTransaction),t}},{key:"attach",value:function(e){return new this.constructor(e,this.interface,this.signer||this.provider)}},{key:"_normalizeRunningEvent",value:function(e){return this._runningEvents[e.tag]?this._runningEvents[e.tag]:e}},{key:"_getRunningEvent",value:function(e){if("string"===typeof e){if("error"===e)return this._normalizeRunningEvent(new Dr);if("event"===e)return this._normalizeRunningEvent(new Er("event",null));if("*"===e)return this._normalizeRunningEvent(new Sr(this.address,this.interface));var t=this.interface.getEvent(e);return this._normalizeRunningEvent(new Tr(this.address,this.interface,t))}if(e.topics&&e.topics.length>0){try{var r=e.topics[0];if("string"!==typeof r)throw new Error("invalid topic");var n=this.interface.getEvent(r);return this._normalizeRunningEvent(new Tr(this.address,this.interface,n,e.topics))}catch(o){}var i={address:this.address,topics:e.topics};return this._normalizeRunningEvent(new Er(kr(i),i))}return this._normalizeRunningEvent(new Sr(this.address,this.interface))}},{key:"_checkRunningEvents",value:function(e){if(0===e.listenerCount()){delete this._runningEvents[e.tag];var t=this._wrappedEmits[e.tag];t&&e.filter&&(this.provider.off(e.filter,t),delete this._wrappedEmits[e.tag])}}},{key:"_wrapEvent",value:function(e,t,r){var n=this,i=F(t);return i.removeListener=function(){r&&(e.removeListener(r),n._checkRunningEvents(e))},i.getBlock=function(){return n.provider.getBlock(t.blockHash)},i.getTransaction=function(){return n.provider.getTransaction(t.transactionHash)},i.getTransactionReceipt=function(){return n.provider.getTransactionReceipt(t.transactionHash)},e.prepareEvent(i),i}},{key:"_addEventListener",value:function(e,t,r){var n=this;if(this.provider||br.throwError("events require a provider or a signer with a provider",M.b.errors.UNSUPPORTED_OPERATION,{operation:"once"}),e.addListener(t,r),this._runningEvents[e.tag]=e,!this._wrappedEmits[e.tag]){var i=function(r){var i=n._wrapEvent(e,r,t);if(null==i.decodeError)try{var o=e.getEmit(i);n.emit.apply(n,[e.filter].concat(Object(c.a)(o)))}catch(a){i.decodeError=a.error}null!=e.filter&&n.emit("event",i),null!=i.decodeError&&n.emit("error",i.decodeError,i)};this._wrappedEmits[e.tag]=i,null!=e.filter&&this.provider.on(e.filter,i)}}},{key:"queryFilter",value:function(e,t,r){var n=this,i=this._getRunningEvent(e),o=B(i.filter);return"string"===typeof t&&Object(m.l)(t,32)?(null!=r&&br.throwArgumentError("cannot specify toBlock with blockhash","toBlock",r),o.blockHash=t):(o.fromBlock=null!=t?t:0,o.toBlock=null!=r?r:"latest"),this.provider.getLogs(o).then((function(e){return e.map((function(e){return n._wrapEvent(i,e,null)}))}))}},{key:"on",value:function(e,t){return this._addEventListener(this._getRunningEvent(e),t,!1),this}},{key:"once",value:function(e,t){return this._addEventListener(this._getRunningEvent(e),t,!0),this}},{key:"emit",value:function(e){if(!this.provider)return!1;for(var t=this._getRunningEvent(e),r=arguments.length,n=new Array(r>1?r-1:0),i=1;i0;return this._checkRunningEvents(t),o}},{key:"listenerCount",value:function(e){var t=this;return this.provider?null==e?Object.keys(this._runningEvents).reduce((function(e,r){return e+t._runningEvents[r].listenerCount()}),0):this._getRunningEvent(e).listenerCount():0}},{key:"listeners",value:function(e){if(!this.provider)return[];if(null==e){var t=[];for(var r in this._runningEvents)this._runningEvents[r].listeners().forEach((function(e){t.push(e)}));return t}return this._getRunningEvent(e).listeners()}},{key:"removeAllListeners",value:function(e){if(!this.provider)return this;if(null==e){for(var t in this._runningEvents){var r=this._runningEvents[t];r.removeAllListeners(),this._checkRunningEvents(r)}return this}var n=this._getRunningEvent(e);return n.removeAllListeners(),this._checkRunningEvents(n),this}},{key:"off",value:function(e,t){if(!this.provider)return this;var r=this._getRunningEvent(e);return r.removeListener(t),this._checkRunningEvents(r),this}},{key:"removeListener",value:function(e,t){return this.off(e,t)}}],[{key:"getContractAddress",value:function(e){return be(e)}},{key:"getInterface",value:function(e){return Pt.isInterface(e)?e:new Pt(e)}},{key:"isIndexed",value:function(e){return Ct.isIndexed(e)}}]),e}(),_r=function(e){Object(h.a)(r,e);var t=Object(p.a)(r);function r(){return Object(g.a)(this,r),t.apply(this,arguments)}return Object(v.a)(r)}(Or),Cr=function(){function e(t,r,n){Object(g.a)(this,e);var i=null;"0x"!==(i="string"===typeof r?r:Object(m.j)(r)?Object(m.i)(r):r&&"string"===typeof r.object?r.object:"!").substring(0,2)&&(i="0x"+i),(!Object(m.l)(i)||i.length%2)&&br.throwArgumentError("invalid bytecode","bytecode",r),n&&!Zt.isSigner(n)&&br.throwArgumentError("invalid signer","signer",n),L(this,"bytecode",i),L(this,"interface",z(this instanceof e?this.constructor:void 0,"getInterface")(t)),L(this,"signer",n||null)}return Object(v.a)(e,[{key:"getDeployTransaction",value:function(){for(var e={},t=arguments.length,r=new Array(t),n=0;n=0&&e<=256&&!(e%1)?"1"+Ur.substring(0,e):Lr.throwArgumentError("invalid decimal size","decimals",e)}function Yr(e,t){null==t&&(t=0);var r=Qr(t),n=(e=E.from(e)).lt(Pr);n&&(e=e.mul(Rr));for(var i=e.mod(r).toString();i.length2&&Lr.throwArgumentError("too many decimal points","value",e);var o=i[0],a=i[1];for(o||(o="0"),a||(a="0");"0"===a[a.length-1];)a=a.substring(0,a.length-1);for(a.length>r.length-1&&Br("fractional component exceeds decimals","underflow","parseFixed"),""===a&&(a="0");a.length80&&Lr.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",i),new e(zr,r,n,i)}}]),e}(),Wr=function(){function e(t,r,n,i){Object(g.a)(this,e),t!==zr&&Lr.throwError("cannot use FixedNumber constructor; use FixedNumber.from",M.b.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=i,this._hex=r,this._value=n,this._isFixedNumber=!0,Object.freeze(this)}return Object(v.a)(e,[{key:"_checkFormat",value:function(e){this.format.name!==e.format.name&&Lr.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}},{key:"addUnsafe",value:function(t){this._checkFormat(t);var r=Fr(this._value,this.format.decimals),n=Fr(t._value,t.format.decimals);return e.fromValue(r.add(n),this.format.decimals,this.format)}},{key:"subUnsafe",value:function(t){this._checkFormat(t);var r=Fr(this._value,this.format.decimals),n=Fr(t._value,t.format.decimals);return e.fromValue(r.sub(n),this.format.decimals,this.format)}},{key:"mulUnsafe",value:function(t){this._checkFormat(t);var r=Fr(this._value,this.format.decimals),n=Fr(t._value,t.format.decimals);return e.fromValue(r.mul(n).div(this.format._multiplier),this.format.decimals,this.format)}},{key:"divUnsafe",value:function(t){this._checkFormat(t);var r=Fr(this._value,this.format.decimals),n=Fr(t._value,t.format.decimals);return e.fromValue(r.mul(this.format._multiplier).div(n),this.format.decimals,this.format)}},{key:"floor",value:function(){var t=this.toString().split(".");1===t.length&&t.push("0");var r=e.from(t[0],this.format),n=!t[1].match(/^(0*)$/);return this.isNegative()&&n&&(r=r.subUnsafe(Zr.toFormat(r.format))),r}},{key:"ceiling",value:function(){var t=this.toString().split(".");1===t.length&&t.push("0");var r=e.from(t[0],this.format),n=!t[1].match(/^(0*)$/);return!this.isNegative()&&n&&(r=r.addUnsafe(Zr.toFormat(r.format))),r}},{key:"round",value:function(t){null==t&&(t=0);var r=this.toString().split(".");if(1===r.length&&r.push("0"),(t<0||t>80||t%1)&&Lr.throwArgumentError("invalid decimal count","decimals",t),r[1].length<=t)return this;var n=e.from("1"+Ur.substring(0,t),this.format),i=Hr.toFormat(this.format);return this.mulUnsafe(n).addUnsafe(i).floor().divUnsafe(n)}},{key:"isZero",value:function(){return"0.0"===this._value||"0"===this._value}},{key:"isNegative",value:function(){return"-"===this._value[0]}},{key:"toString",value:function(){return this._value}},{key:"toHexString",value:function(e){if(null==e)return this._hex;e%8&&Lr.throwArgumentError("invalid byte width","width",e);var t=E.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString();return Object(m.h)(t,e/8)}},{key:"toUnsafeFloat",value:function(){return parseFloat(this.toString())}},{key:"toFormat",value:function(t){return e.fromString(this._value,t)}}],[{key:"fromValue",value:function(t,r,n){return null!=n||null==r||function(e){return null!=e&&(E.isBigNumber(e)||"number"===typeof e&&e%1===0||"string"===typeof e&&!!e.match(/^-?[0-9]+$/)||Object(m.l)(e)||"bigint"===typeof e||Object(m.j)(e))}(r)||(n=r,r=null),null==r&&(r=0),null==n&&(n="fixed"),e.fromString(Yr(t,r),Gr.from(n))}},{key:"fromString",value:function(t,r){null==r&&(r="fixed");var n=Gr.from(r),i=Fr(t,n.decimals);!n.signed&&i.lt(Pr)&&Br("unsigned value cannot be negative","overflow","value",t);var o=null;n.signed?o=i.toTwos(n.width).toHexString():(o=i.toHexString(),o=Object(m.h)(o,n.width/8));var a=Yr(i,n.decimals);return new e(zr,o,a,n)}},{key:"fromBytes",value:function(t,r){null==r&&(r="fixed");var n=Gr.from(r);if(Object(m.a)(t).length>n.width/8)throw new Error("overflow");var i=E.from(t);n.signed&&(i=i.fromTwos(n.width));var o=i.toTwos((n.signed?0:1)+n.width).toHexString(),a=Yr(i,n.decimals);return new e(zr,o,a,n)}},{key:"from",value:function(t,r){if("string"===typeof t)return e.fromString(t,r);if(Object(m.j)(t))return e.fromBytes(t,r);try{return e.fromValue(t,0,r)}catch(n){if(n.code!==M.b.errors.INVALID_ARGUMENT)throw n}return Lr.throwArgumentError("invalid FixedNumber value","value",t)}},{key:"isFixedNumber",value:function(e){return!(!e||!e._isFixedNumber)}}]),e}(),Zr=Wr.from(1),Hr=Wr.from("0.5"),Vr="\x19Ethereum Signed Message:\n";function qr(e){return"string"===typeof e&&(e=ke(e)),$(Object(m.b)([ke(Vr),ke(String(e.length)),e]))}var Kr="hash/5.7.0",Jr=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{s(n.next(e))}catch(t){o(t)}}function u(e){try{s(n.throw(e))}catch(t){o(t)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,u)}s((n=n.apply(e,t||[])).next())}))},Xr=new M.b(Kr),$r=new Uint8Array(32);$r.fill(0);var en=E.from(-1),tn=E.from(0),rn=E.from(1),nn=E.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");var on=Object(m.h)(rn.toHexString(),32),an=Object(m.h)(tn.toHexString(),32),un={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},sn=["name","version","chainId","verifyingContract","salt"];function cn(e){return function(t){return"string"!==typeof t&&Xr.throwArgumentError("invalid domain value for ".concat(JSON.stringify(e)),"domain.".concat(e),t),t}}var ln={name:cn("name"),version:cn("version"),chainId:function(e){try{return E.from(e).toString()}catch(t){}return Xr.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",e)},verifyingContract:function(e){try{return ve(e).toLowerCase()}catch(t){}return Xr.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",e)},salt:function(e){try{var t=Object(m.a)(e);if(32!==t.length)throw new Error("bad length");return Object(m.i)(t)}catch(r){}return Xr.throwArgumentError('invalid domain value "salt"',"domain.salt",e)}};function fn(e){var t=e.match(/^(u?)int(\d*)$/);if(t){var r=""===t[1],n=parseInt(t[2]||"256");(n%8!==0||n>256||t[2]&&t[2]!==String(n))&&Xr.throwArgumentError("invalid numeric width","type",e);var i=nn.mask(r?n-1:n),o=r?i.add(rn).mul(en):tn;return function(t){var r=E.from(t);return(r.lt(o)||r.gt(i))&&Xr.throwArgumentError("value out-of-bounds for ".concat(e),"value",t),Object(m.h)(r.toTwos(256).toHexString(),32)}}var a=e.match(/^bytes(\d+)$/);if(a){var u=parseInt(a[1]);return(0===u||u>32||a[1]!==String(u))&&Xr.throwArgumentError("invalid bytes width","type",e),function(t){return Object(m.a)(t).length!==u&&Xr.throwArgumentError("invalid length for ".concat(e),"value",t),function(e){var t=Object(m.a)(e),r=t.length%32;return r?Object(m.c)([t,$r.slice(r)]):Object(m.i)(t)}(t)}}switch(e){case"address":return function(e){return Object(m.h)(ve(e),32)};case"bool":return function(e){return e?on:an};case"bytes":return function(e){return $(e)};case"string":return function(e){return _e(e)}}return null}function dn(e,t){return"".concat(e,"(").concat(t.map((function(e){var t=e.name;return e.type+" "+t})).join(","),")")}var hn,pn=function(){function e(t){Object(g.a)(this,e),L(this,"types",Object.freeze(F(t))),L(this,"_encoderCache",{}),L(this,"_types",{});var r={},n={},i={};Object.keys(t).forEach((function(e){r[e]={},n[e]=[],i[e]={}}));var o=function(e){var i={};t[e].forEach((function(o){i[o.name]&&Xr.throwArgumentError("duplicate variable name ".concat(JSON.stringify(o.name)," in ").concat(JSON.stringify(e)),"types",t),i[o.name]=!0;var a=o.type.match(/^([^\x5b]*)(\x5b|$)/)[1];a===e&&Xr.throwArgumentError("circular type reference to ".concat(JSON.stringify(a)),"types",t),fn(a)||(n[a]||Xr.throwArgumentError("unknown type ".concat(JSON.stringify(a)),"types",t),n[a].push(e),r[e][a]=!0)}))};for(var a in t)o(a);var u=Object.keys(n).filter((function(e){return 0===n[e].length}));for(var s in 0===u.length?Xr.throwArgumentError("missing primary type","types",t):u.length>1&&Xr.throwArgumentError("ambiguous primary types or unused types: ".concat(u.map((function(e){return JSON.stringify(e)})).join(", ")),"types",t),L(this,"primaryType",u[0]),function e(o,a){a[o]&&Xr.throwArgumentError("circular type reference to ".concat(JSON.stringify(o)),"types",t),a[o]=!0,Object.keys(r[o]).forEach((function(t){n[t]&&(e(t,a),Object.keys(a).forEach((function(e){i[e][t]=!0})))})),delete a[o]}(this.primaryType,{}),i){var c=Object.keys(i[s]);c.sort(),this._types[s]=dn(s,t[s])+c.map((function(e){return dn(e,t[e])})).join("")}}return Object(v.a)(e,[{key:"getEncoder",value:function(e){var t=this._encoderCache[e];return t||(t=this._encoderCache[e]=this._getEncoder(e)),t}},{key:"_getEncoder",value:function(e){var t=this,r=fn(e);if(r)return r;var n=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(n){var i=n[1],o=this.getEncoder(i),a=parseInt(n[3]);return function(e){a>=0&&e.length!==a&&Xr.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e);var r=e.map(o);return t._types[i]&&(r=r.map($)),$(Object(m.c)(r))}}var u=this.types[e];if(u){var s=_e(this._types[e]);return function(e){var r=u.map((function(r){var n=r.name,i=r.type,o=t.getEncoder(i)(e[n]);return t._types[i]?$(o):o}));return r.unshift(s),Object(m.c)(r)}}return Xr.throwArgumentError("unknown type: ".concat(e),"type",e)}},{key:"encodeType",value:function(e){var t=this._types[e];return t||Xr.throwArgumentError("unknown type: ".concat(JSON.stringify(e)),"name",e),t}},{key:"encodeData",value:function(e,t){return this.getEncoder(e)(t)}},{key:"hashStruct",value:function(e,t){return $(this.encodeData(e,t))}},{key:"encode",value:function(e){return this.encodeData(this.primaryType,e)}},{key:"hash",value:function(e){return this.hashStruct(this.primaryType,e)}},{key:"_visit",value:function(e,t,r){var n=this;if(fn(e))return r(e,t);var i=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(i){var o=i[1],a=parseInt(i[3]);return a>=0&&t.length!==a&&Xr.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",t),t.map((function(e){return n._visit(o,e,r)}))}var u=this.types[e];return u?u.reduce((function(e,i){var o=i.name,a=i.type;return e[o]=n._visit(a,t[o],r),e}),{}):Xr.throwArgumentError("unknown type: ".concat(e),"type",e)}},{key:"visit",value:function(e,t){return this._visit(this.primaryType,e,t)}}],[{key:"from",value:function(t){return new e(t)}},{key:"getPrimaryType",value:function(t){return e.from(t).primaryType}},{key:"hashStruct",value:function(t,r,n){return e.from(r).hashStruct(t,n)}},{key:"hashDomain",value:function(t){var r=[];for(var n in t){var i=un[n];i||Xr.throwArgumentError("invalid typed-data domain key: ".concat(JSON.stringify(n)),"domain",t),r.push({name:n,type:i})}return r.sort((function(e,t){return sn.indexOf(e.name)-sn.indexOf(t.name)})),e.hashStruct("EIP712Domain",{EIP712Domain:r},t)}},{key:"encode",value:function(t,r,n){return Object(m.c)(["0x1901",e.hashDomain(t),e.from(r).hash(n)])}},{key:"hash",value:function(t,r,n){return $(e.encode(t,r,n))}},{key:"resolveNames",value:function(t,r,n,i){return Jr(this,void 0,void 0,Object(y.a)().mark((function o(){var a,u,s;return Object(y.a)().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:t=B(t),a={},t.verifyingContract&&!Object(m.l)(t.verifyingContract,20)&&(a[t.verifyingContract]="0x"),(u=e.from(r)).visit(n,(function(e,t){return"address"!==e||Object(m.l)(t,20)||(a[t]="0x"),t})),o.t0=Object(y.a)().keys(a);case 6:if((o.t1=o.t0()).done){o.next=13;break}return s=o.t1.value,o.next=10,i(s);case 10:a[s]=o.sent,o.next=6;break;case 13:return t.verifyingContract&&a[t.verifyingContract]&&(t.verifyingContract=a[t.verifyingContract]),n=u.visit(n,(function(e,t){return"address"===e&&a[t]?a[t]:t})),o.abrupt("return",{domain:t,value:n});case 16:case"end":return o.stop()}}),o)})))}},{key:"getPayload",value:function(t,r,n){e.hashDomain(t);var i={},o=[];sn.forEach((function(e){var r=t[e];null!=r&&(i[e]=ln[e](r),o.push({name:e,type:un[e]}))}));var a=e.from(r),u=B(r);return u.EIP712Domain?Xr.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",r):u.EIP712Domain=o,a.encode(n),{types:u,domain:i,primaryType:a.primaryType,message:a.visit(n,(function(e,t){if(e.match(/^bytes(\d*)/))return Object(m.i)(Object(m.a)(t));if(e.match(/^u?int/))return E.from(t).toString();switch(e){case"address":return t.toLowerCase();case"bool":return!!t;case"string":return"string"!==typeof t&&Xr.throwArgumentError("invalid string","value",t),t}return Xr.throwArgumentError("unsupported type","type",e)}))}}}]),e}(),gn=function(){function e(t){Object(g.a)(this,e),L(this,"alphabet",t),L(this,"base",t.length),L(this,"_alphabetMap",{}),L(this,"_leader",t.charAt(0));for(var r=0;r0;)r.push(i%this.base),i=i/this.base|0}for(var a="",u=0;0===t[u]&&u=0;--s)a+=this.alphabet[r[s]];return a}},{key:"decode",value:function(e){if("string"!==typeof e)throw new TypeError("Expected String");var t=[];if(0===e.length)return new Uint8Array(t);t.push(0);for(var r=0;r>=8;for(;i>0;)t.push(255&i),i>>=8}for(var a=0;e[a]===this._leader&&a>24&255,l[t.length+1]=f>>16&255,l[t.length+2]=f>>8&255,l[t.length+3]=255&f;var d=Object(m.a)(In(i,e,l));o||(o=d.length,u=new Uint8Array(o),a=n-((s=Math.ceil(n/o))-1)*o),u.set(d);for(var h=1;h=256)throw new Error("Depth too large!");return Rn(Object(m.b)([null!=this.privateKey?"0x0488ADE4":"0x0488B21E",Object(m.i)(this.depth),this.parentFingerprint,Object(m.h)(Object(m.i)(this.index),4),this.chainCode,null!=this.privateKey?Object(m.b)(["0x00",this.privateKey]):this.publicKey]))}},{key:"neuter",value:function(){return new e(Un,null,this.publicKey,this.parentFingerprint,this.chainCode,this.index,this.depth,this.path)}},{key:"_derive",value:function(t){if(t>4294967295)throw new Error("invalid index - "+String(t));var r=this.path;r&&(r+="/"+(t&~Ln));var n=new Uint8Array(37);if(t&Ln){if(!this.privateKey)throw new Error("cannot derive child of neutered node");n.set(Object(m.a)(this.privateKey),1),r&&(r+="'")}else n.set(Object(m.a)(this.publicKey));for(var i=24;i>=0;i-=8)n[33+(i>>3)]=t>>24-i&255;var o=Object(m.a)(In(hn.sha512,this.chainCode,n)),a=o.slice(0,32),u=o.slice(32),s=null,c=null;this.privateKey?s=Pn(E.from(a).add(this.privateKey).mod(_n)):c=new Xt(Object(m.i)(a))._addPoint(this.publicKey);var l=r,f=this.mnemonic;return f&&(l=Object.freeze({phrase:f.phrase,path:r,locale:f.locale||"en"})),new e(Un,s,c,this.fingerprint,Pn(u),t,this.depth+1,l)}},{key:"derivePath",value:function(e){var t=e.split("/");if(0===t.length||"m"===t[0]&&0!==this.depth)throw new Error("invalid path - "+e);"m"===t[0]&&t.shift();for(var r=this,n=0;n=Ln)throw new Error("invalid path index - "+i);r=r._derive(Ln+o)}else{if(!i.match(/^[0-9]+$/))throw new Error("invalid path component - "+i);var a=parseInt(i);if(a>=Ln)throw new Error("invalid path index - "+i);r=r._derive(a)}}return r}}],[{key:"_fromSeed",value:function(t,r){var n=Object(m.a)(t);if(n.length<16||n.length>64)throw new Error("invalid seed");var i=Object(m.a)(In(hn.sha512,Cn,n));return new e(Un,Pn(i.slice(0,32)),null,"0x00000000",Pn(i.slice(32)),0,0,r)}},{key:"fromMnemonic",value:function(t,r,n){return t=Wn(Gn(t,n=Bn(n)),n),e._fromSeed(Fn(t,r),{phrase:t,path:"m",locale:n.locale})}},{key:"fromSeed",value:function(t){return e._fromSeed(t,null)}},{key:"fromExtendedKey",value:function(t){var r=vn.decode(t);82===r.length&&Rn(r.slice(0,78))===t||On.throwArgumentError("invalid extended key","extendedKey","[REDACTED]");var n=r[4],i=Object(m.i)(r.slice(5,9)),o=parseInt(Object(m.i)(r.slice(9,13)).substring(2),16),a=Object(m.i)(r.slice(13,45)),u=r.slice(45,78);switch(Object(m.i)(r.slice(0,4))){case"0x0488b21e":case"0x043587cf":return new e(Un,null,Object(m.i)(u),i,a,o,n,null);case"0x0488ade4":case"0x04358394 ":if(0!==u[0])break;return new e(Un,Object(m.i)(u.slice(1)),null,i,a,o,n,null)}return On.throwArgumentError("invalid extended key","extendedKey","[REDACTED]")}}]),e}();function Fn(e,t){t||(t="");var r=ke("mnemonic"+t,Me.NFKD);return jn(ke(e,Me.NFKD),r,2048,64,"sha512")}function Gn(e,t){t=Bn(t),On.checkNormalize();var r=t.split(e);if(r.length%3!==0)throw new Error("invalid mnemonic");for(var n=Object(m.a)(new Uint8Array(Math.ceil(11*r.length/8))),i=0,o=0;o>3]|=1<<7-i%8),i++}var s=32*r.length/3,c=zn(r.length/3);if((Object(m.a)(Mn(n.slice(0,s/8)))[0]&c)!==(n[n.length-1]&c))throw new Error("invalid checksum");return Object(m.i)(n.slice(0,s/8))}function Wn(e,t){if(t=Bn(t),(e=Object(m.a)(e)).length%4!==0||e.length<16||e.length>32)throw new Error("invalid entropy");for(var r=[0],n=11,i=0;i8?(r[r.length-1]<<=8,r[r.length-1]|=e[i],n-=8):(r[r.length-1]<<=n,r[r.length-1]|=e[i]>>8-n,r.push(e[i]&(1<<8-n)-1),n+=3);var o=e.length/4,a=Object(m.a)(Mn(e))[0]&zn(o);return r[r.length-1]<<=o,r[r.length-1]|=a>>8-o,t.join(r.map((function(e){return t.getWord(e)})))}function Zn(e,t){try{return Gn(e,t),!0}catch(r){}return!1}function Hn(e){return("number"!==typeof e||e<0||e>=Ln||e%1)&&On.throwArgumentError("invalid account index","index",e),"m/44'/60'/".concat(e,"'/0/0")}var Vn=r(828),qn=r(62),Kn=r.n(qn),Jn=r(150),Xn=r.n(Jn);function $n(e){return"string"===typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),Object(m.a)(e)}function ei(e,t){for(e=String(e);e.length0&&Array.isArray(t)?e(t,i-1):r.push(t)}))}(e,t),r}function Qi(e){return function(e){var t=0;return function(){return e[t++]}}(function(e){var t=0;function r(){return e[t++]<<8|e[t++]}for(var n=r(),i=1,o=[0,1],a=1;a>--c&1}for(var d=Math.pow(2,31),h=d>>>1,p=h>>1,g=d-1,v=0,y=0;y<31;y++)v=v<<1|f();for(var m=[],b=0,w=d;;){for(var M=Math.floor(((v-b+1)*i-1)/w),A=0,I=n;I-A>1;){var j=A+I>>>1;M>>1|f(),N=N<<1^h,x=(x^h)<<1|h|1;b=N,w=1+x-N}var k=n-4;return m.map((function(t){switch(t-k){case 3:return k+65792+(e[s++]<<16|e[s++]<<8|e[s++]);case 2:return k+256+(e[s++]<<8|e[s++]);case 1:return k+e[s++];default:return t-1}}))}(e))}function Yi(e){return 1&e?~e>>1:e>>1}function Fi(e,t){for(var r=Array(e),n=0,i=-1;n>=1),check:2==o}}()}(qi),eo=45,to=95;function ro(e){return Oe(e)}function no(e){return e.filter((function(e){return 65039!=e}))}function io(e){var t,r=Object(Bi.a)(e.split("."));try{for(r.s();!(t=r.n()).done;){var n=t.value,i=ro(n);try{for(var o=i.lastIndexOf(to)-1;o>=0;o--)if(i[o]!==to)throw new Error("underscore only allowed at start");if(i.length>=4&&i.every((function(e){return e<128}))&&i[2]===eo&&i[3]===eo)throw new Error("invalid label extension")}catch(a){throw new Error('Invalid label "'.concat(n,'": ').concat(a.message))}}}catch(a){r.e(a)}finally{r.f()}return e}function oo(e){return io(function(e,t){var r=ro(e).reverse(),n=[];for(;r.length;){var i=ao(r);if(i)n.push.apply(n,Object(c.a)(t(i)));else{var o=r.pop();if(Ki.has(o))n.push(o);else if(!Ji.has(o)){var a=Xi[o];if(!a)throw new Error("Disallowed codepoint: 0x".concat(o.toString(16).toUpperCase()));n.push.apply(n,Object(c.a)(a))}}}return io((u=String.fromCodePoint.apply(String,n),u.normalize("NFC")));var u}(e,no))}function ao(e,t){var r,n,i,o=$i,a=[],u=e.length;t&&(t.length=0);for(var s=function(){var s=e[--u];if(o=null===(r=o.branches.find((function(e){return e.set.has(s)})))||void 0===r?void 0:r.node,!o)return"break";if(o.save)i=s;else if(o.check&&s===i)return"break";a.push(s),o.fe0f&&(a.push(65039),u>0&&65039==e[u-1]&&u--),o.valid&&(n=a.slice(),2==o.valid&&n.splice(1,1),t&&t.push.apply(t,Object(c.a)(e.slice(u).reverse())),e.length=u)};u;){if("break"===s())break}return n}var uo=new M.b(Kr),so=new Uint8Array(32);function co(e){if(0===e.length)throw new Error("invalid ENS name; empty component");return e}function lo(e){var t=ke(oo(e)),r=[];if(0===e.length)return r;for(var n=0,i=0;i=t.length)throw new Error("invalid ENS name; empty component");return r.push(co(t.slice(n))),r}function fo(e){try{return 0!==lo(e).length}catch(t){}return!1}function ho(e){"string"!==typeof e&&uo.throwArgumentError("invalid ENS name; not a string","name",e);for(var t=so,r=lo(e);r.length;)t=$(Object(m.b)([t,$(r.pop())]));return Object(m.i)(t)}function po(e){return Object(m.i)(Object(m.b)(lo(e).map((function(e){if(e.length>63)throw new Error("invalid DNS encoded entry; length exceeds 63 bytes");var t=new Uint8Array(e.length+1);return t.set(e,1),t[0]=t.length-1,t}))))+"00"}so.fill(0);var go=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{s(n.next(e))}catch(t){o(t)}}function u(e){try{s(n.throw(e))}catch(t){o(t)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,u)}s((n=n.apply(e,t||[])).next())}))};function vo(e,t){return go(this,void 0,void 0,Object(y.a)().mark((function r(){var n,i,o,a,u;return Object(y.a)().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return null==t&&(t={}),n={method:t.method||"GET",headers:t.headers||{},body:t.body||void 0},!0!==t.skipFetchSetup&&(n.mode="cors",n.cache="no-cache",n.credentials="same-origin",n.redirect="follow",n.referrer="client"),null!=t.fetchOptions&&((i=t.fetchOptions).mode&&(n.mode=i.mode),i.cache&&(n.cache=i.cache),i.credentials&&(n.credentials=i.credentials),i.redirect&&(n.redirect=i.redirect),i.referrer&&(n.referrer=i.referrer)),r.next=7,fetch(e,n);case 7:return o=r.sent,r.next=10,o.arrayBuffer();case 10:return a=r.sent,u={},o.headers.forEach?o.headers.forEach((function(e,t){u[t.toLowerCase()]=e})):o.headers.keys().forEach((function(e){u[e.toLowerCase()]=o.headers.get(e)})),r.abrupt("return",{headers:u,statusCode:o.status,statusMessage:o.statusText,body:Object(m.a)(new Uint8Array(a))});case 14:case"end":return r.stop()}}),r)})))}var yo=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{s(n.next(e))}catch(t){o(t)}}function u(e){try{s(n.throw(e))}catch(t){o(t)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,u)}s((n=n.apply(e,t||[])).next())}))},mo=new M.b("web/5.7.1");function bo(e){return new Promise((function(t){setTimeout(t,e)}))}function wo(e,t){if(null==e)return null;if("string"===typeof e)return e;if(Object(m.k)(e)){if(t&&("text"===t.split("/")[0]||"application/json"===t.split(";")[0].trim()))try{return Se(e)}catch(r){}return Object(m.i)(e)}return e}function Mo(e,t,r){var n="object"===typeof e&&null!=e.throttleLimit?e.throttleLimit:12;mo.assertArgument(n>0&&n%1===0,"invalid connection throttle limit","connection.throttleLimit",n);var i="object"===typeof e?e.throttleCallback:null,o="object"===typeof e&&"number"===typeof e.throttleSlotInterval?e.throttleSlotInterval:100;mo.assertArgument(o>0&&o%1===0,"invalid connection throttle slot interval","connection.throttleSlotInterval",o);var a="object"===typeof e&&!!e.errorPassThrough,u={},s=null,c={method:"GET"},l=!1,f=12e4;if("string"===typeof e)s=e;else if("object"===typeof e){if(null!=e&&null!=e.url||mo.throwArgumentError("missing URL","connection.url",e),s=e.url,"number"===typeof e.timeout&&e.timeout>0&&(f=e.timeout),e.headers)for(var d in e.headers)u[d.toLowerCase()]={key:d,value:String(e.headers[d])},["if-none-match","if-modified-since"].indexOf(d.toLowerCase())>=0&&(l=!0);if(c.allowGzip=!!e.allowGzip,null!=e.user&&null!=e.password){"https:"!==s.substring(0,6)&&!0!==e.allowInsecureAuthentication&&mo.throwError("basic authentication requires a secure https url",M.b.errors.INVALID_ARGUMENT,{argument:"url",url:s,user:e.user,password:"[REDACTED]"});var h=e.user+":"+e.password;u.authorization={key:"Authorization",value:"Basic "+Ri(ke(h))}}null!=e.skipFetchSetup&&(c.skipFetchSetup=!!e.skipFetchSetup),null!=e.fetchOptions&&(c.fetchOptions=B(e.fetchOptions))}var p,g=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),v=s?s.match(g):null;if(v)try{var m={statusCode:200,statusMessage:"OK",headers:{"content-type":v[1]||"text/plain"},body:v[2]?Pi(v[3]):(p=v[3],ke(p.replace(/%([0-9a-f][0-9a-f])/gi,(function(e,t){return String.fromCharCode(parseInt(t,16))}))))},b=m.body;return r&&(b=r(m.body,m)),Promise.resolve(b)}catch(j){mo.throwError("processing response error",M.b.errors.SERVER_ERROR,{body:wo(v[1],v[2]),error:j,requestBody:null,requestMethod:"GET",url:s})}t&&(c.method="POST",c.body=t,null==u["content-type"]&&(u["content-type"]={key:"Content-Type",value:"application/octet-stream"}),null==u["content-length"]&&(u["content-length"]={key:"Content-Length",value:String(t.length)}));var w={};Object.keys(u).forEach((function(e){var t=u[e];w[t.key]=t.value})),c.headers=w;var A=function(){var e=null;return{promise:new Promise((function(t,r){f&&(e=setTimeout((function(){null!=e&&(e=null,r(mo.makeError("timeout",M.b.errors.TIMEOUT,{requestBody:wo(c.body,w["content-type"]),requestMethod:c.method,timeout:f,url:s})))}),f))})),cancel:function(){null!=e&&(clearTimeout(e),e=null)}}}(),I=function(){return yo(this,void 0,void 0,Object(y.a)().mark((function e(){var t,u,f,d,h,p,g,v,m,b;return Object(y.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=0;case 1:if(!(t=300)&&(A.cancel(),mo.throwError("bad response",M.b.errors.SERVER_ERROR,{status:u.statusCode,headers:u.headers,body:wo(g,u.headers?u.headers["content-type"]:null),requestBody:wo(c.body,w["content-type"]),requestMethod:c.method,url:s})),!r){e.next=60;break}return e.prev=37,e.next=40,r(g,u);case 40:return v=e.sent,A.cancel(),e.abrupt("return",v);case 45:if(e.prev=45,e.t1=e.catch(37),!(e.t1.throttleRetry&&tu)return void(a()&&n(new Error("retry limit reached")));var c=t.interval*parseInt(String(Math.random()*Math.pow(2,s)));ct.ceiling&&(c=t.ceiling),setTimeout(i,c)}return null}),(function(e){a()&&n(e)}))}()}))}var jo=r(199),No=r.n(jo),xo="providers/5.7.1",ko=new M.b(xo),Eo=function(){function e(){Object(g.a)(this,e),this.formats=this.getDefaultFormats()}return Object(v.a)(e,[{key:"getDefaultFormats",value:function(){var t=this,r={},n=this.address.bind(this),i=this.bigNumber.bind(this),o=this.blockTag.bind(this),a=this.data.bind(this),u=this.hash.bind(this),s=this.hex.bind(this),c=this.number.bind(this),l=this.type.bind(this);return r.transaction={hash:u,type:l,accessList:e.allowNull(this.accessList.bind(this),null),blockHash:e.allowNull(u,null),blockNumber:e.allowNull(c,null),transactionIndex:e.allowNull(c,null),confirmations:e.allowNull(c,null),from:n,gasPrice:e.allowNull(i),maxPriorityFeePerGas:e.allowNull(i),maxFeePerGas:e.allowNull(i),gasLimit:i,to:e.allowNull(n,null),value:i,nonce:c,data:a,r:e.allowNull(this.uint256),s:e.allowNull(this.uint256),v:e.allowNull(c),creates:e.allowNull(n,null),raw:e.allowNull(a)},r.transactionRequest={from:e.allowNull(n),nonce:e.allowNull(c),gasLimit:e.allowNull(i),gasPrice:e.allowNull(i),maxPriorityFeePerGas:e.allowNull(i),maxFeePerGas:e.allowNull(i),to:e.allowNull(n),value:e.allowNull(i),data:e.allowNull((function(e){return t.data(e,!0)})),type:e.allowNull(c),accessList:e.allowNull(this.accessList.bind(this),null)},r.receiptLog={transactionIndex:c,blockNumber:c,transactionHash:u,address:n,topics:e.arrayOf(u),data:a,logIndex:c,blockHash:u},r.receipt={to:e.allowNull(this.address,null),from:e.allowNull(this.address,null),contractAddress:e.allowNull(n,null),transactionIndex:c,root:e.allowNull(s),gasUsed:i,logsBloom:e.allowNull(a),blockHash:u,transactionHash:u,logs:e.arrayOf(this.receiptLog.bind(this)),blockNumber:c,confirmations:e.allowNull(c,null),cumulativeGasUsed:i,effectiveGasPrice:e.allowNull(i),status:e.allowNull(c),type:l},r.block={hash:e.allowNull(u),parentHash:u,number:c,timestamp:c,nonce:e.allowNull(s),difficulty:this.difficulty.bind(this),gasLimit:i,gasUsed:i,miner:e.allowNull(n),extraData:a,transactions:e.allowNull(e.arrayOf(u)),baseFeePerGas:e.allowNull(i)},r.blockWithTransactions=B(r.block),r.blockWithTransactions.transactions=e.allowNull(e.arrayOf(this.transactionResponse.bind(this))),r.filter={fromBlock:e.allowNull(o,void 0),toBlock:e.allowNull(o,void 0),blockHash:e.allowNull(u,void 0),address:e.allowNull(n,void 0),topics:e.allowNull(this.topics.bind(this),void 0)},r.filterLog={blockNumber:e.allowNull(c),blockHash:e.allowNull(u),transactionIndex:c,removed:e.allowNull(this.boolean.bind(this)),address:n,data:e.allowFalsish(a,"0x"),topics:e.arrayOf(u),transactionHash:u,logIndex:c},r}},{key:"accessList",value:function(e){return fr(e||[])}},{key:"number",value:function(e){return"0x"===e?0:E.from(e).toNumber()}},{key:"type",value:function(e){return"0x"===e||null==e?0:E.from(e).toNumber()}},{key:"bigNumber",value:function(e){return E.from(e)}},{key:"boolean",value:function(e){if("boolean"===typeof e)return e;if("string"===typeof e){if("true"===(e=e.toLowerCase()))return!0;if("false"===e)return!1}throw new Error("invalid boolean - "+e)}},{key:"hex",value:function(e,t){return"string"===typeof e&&(t||"0x"===e.substring(0,2)||(e="0x"+e),Object(m.l)(e))?e.toLowerCase():ko.throwArgumentError("invalid hash","value",e)}},{key:"data",value:function(e,t){var r=this.hex(e,t);if(r.length%2!==0)throw new Error("invalid data; odd-length - "+e);return r}},{key:"address",value:function(e){return ve(e)}},{key:"callAddress",value:function(e){if(!Object(m.l)(e,32))return null;var t=ve(Object(m.e)(e,12));return t===xi?null:t}},{key:"contractAddress",value:function(e){return be(e)}},{key:"blockTag",value:function(e){if(null==e)return"latest";if("earliest"===e)return"0x0";switch(e){case"earliest":return"0x0";case"latest":case"pending":case"safe":case"finalized":return e}if("number"===typeof e||Object(m.l)(e))return Object(m.g)(e);throw new Error("invalid blockTag")}},{key:"hash",value:function(e,t){var r=this.hex(e,t);return 32!==Object(m.d)(r)?ko.throwArgumentError("invalid hash","value",e):r}},{key:"difficulty",value:function(e){if(null==e)return null;var t=E.from(e);try{return t.toNumber()}catch(r){}return null}},{key:"uint256",value:function(e){if(!Object(m.l)(e))throw new Error("invalid uint256");return Object(m.h)(e,32)}},{key:"_block",value:function(t,r){null!=t.author&&null==t.miner&&(t.miner=t.author);var n=null!=t._difficulty?t._difficulty:t.difficulty,i=e.check(r,t);return i._difficulty=null==n?null:E.from(n),i}},{key:"block",value:function(e){return this._block(e,this.formats.block)}},{key:"blockWithTransactions",value:function(e){return this._block(e,this.formats.blockWithTransactions)}},{key:"transactionRequest",value:function(t){return e.check(this.formats.transactionRequest,t)}},{key:"transactionResponse",value:function(t){null!=t.gas&&null==t.gasLimit&&(t.gasLimit=t.gas),t.to&&E.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=[]);var r=e.check(this.formats.transaction,t);if(null!=t.chainId){var n=t.chainId;Object(m.l)(n)&&(n=E.from(n).toNumber()),r.chainId=n}else{var i=t.networkId;null==i&&null==r.v&&(i=t.chainId),Object(m.l)(i)&&(i=E.from(i).toNumber()),"number"!==typeof i&&null!=r.v&&((i=(r.v-35)/2)<0&&(i=0),i=parseInt(i)),"number"!==typeof i&&(i=0),r.chainId=i}return r.blockHash&&"x"===r.blockHash.replace(/0/g,"")&&(r.blockHash=null),r}},{key:"transaction",value:function(e){return yr(e)}},{key:"receiptLog",value:function(t){return e.check(this.formats.receiptLog,t)}},{key:"receipt",value:function(t){var r=e.check(this.formats.receipt,t);if(null!=r.root)if(r.root.length<=4){var n=E.from(r.root).toNumber();0===n||1===n?(null!=r.status&&r.status!==n&&ko.throwArgumentError("alt-root-status/status mismatch","value",{root:r.root,status:r.status}),r.status=n,delete r.root):ko.throwArgumentError("invalid alt-root-status","value.root",r.root)}else 66!==r.root.length&&ko.throwArgumentError("invalid root hash","value.root",r.root);return null!=r.status&&(r.byzantium=!0),r}},{key:"topics",value:function(e){var t=this;return Array.isArray(e)?e.map((function(e){return t.topics(e)})):null!=e?this.hash(e,!0):null}},{key:"filter",value:function(t){return e.check(this.formats.filter,t)}},{key:"filterLog",value:function(t){return e.check(this.formats.filterLog,t)}}],[{key:"check",value:function(e,t){var r={};for(var n in e)try{var i=e[n](t[n]);void 0!==i&&(r[n]=i)}catch(o){throw o.checkKey=n,o.checkValue=t[n],o}return r}},{key:"allowNull",value:function(e,t){return function(r){return null==r?t:e(r)}}},{key:"allowFalsish",value:function(e,t){return function(r){return r?e(r):t}}},{key:"arrayOf",value:function(e){return function(t){if(!Array.isArray(t))throw new Error("not an array");var r=[];return t.forEach((function(t){r.push(e(t))})),r}}}]),e}();function Do(e){return e&&"function"===typeof e.isCommunityResource}function To(e){return Do(e)&&e.isCommunityResource()}var So=!1;function Oo(){So||(So=!0,console.log("========= NOTICE ========="),console.log("Request-Rate Exceeded (this message will not be repeated)"),console.log(""),console.log("The default API keys for each service are provided as a highly-throttled,"),console.log("community resource for low-traffic projects and early prototyping."),console.log(""),console.log("While your application will continue to function, we highly recommended"),console.log("signing up for your own API keys to improve performance, increase your"),console.log("request rate/limit and enable other perks, such as metrics and advanced APIs."),console.log(""),console.log("For more details: https://docs.ethers.io/api-keys/"),console.log("=========================="))}var _o=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{s(n.next(e))}catch(t){o(t)}}function u(e){try{s(n.throw(e))}catch(t){o(t)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,u)}s((n=n.apply(e,t||[])).next())}))},Co=new M.b(xo);function Lo(e){return null==e?"null":(32!==Object(m.d)(e)&&Co.throwArgumentError("invalid topic","topic",e),e.toLowerCase())}function zo(e){for(e=e.slice();e.length>0&&null==e[e.length-1];)e.pop();return e.map((function(e){if(Array.isArray(e)){var t={};e.forEach((function(e){t[Lo(e)]=!0}));var r=Object.keys(t);return r.sort(),r.join("|")}return Lo(e)})).join("&")}function Po(e){if("string"===typeof e){if(e=e.toLowerCase(),32===Object(m.d)(e))return"tx:"+e;if(-1===e.indexOf(":"))return e}else{if(Array.isArray(e))return"filter:*:"+zo(e);if(Ut.isForkEvent(e))throw Co.warn("not implemented"),new Error("not implemented");if(e&&"object"===typeof e)return"filter:"+(e.address||"*")+":"+zo(e.topics||[])}throw new Error("invalid event - "+e)}function Ro(){return(new Date).getTime()}function Bo(e){return new Promise((function(t){setTimeout(t,e)}))}var Uo=["block","network","pending","poll"],Qo=function(){function e(t,r,n){Object(g.a)(this,e),L(this,"tag",t),L(this,"listener",r),L(this,"once",n),this._lastBlockNumber=-2,this._inflight=!1}return Object(v.a)(e,[{key:"event",get:function(){switch(this.type){case"tx":return this.hash;case"filter":return this.filter}return this.tag}},{key:"type",get:function(){return this.tag.split(":")[0]}},{key:"hash",get:function(){var e=this.tag.split(":");return"tx"!==e[0]?null:e[1]}},{key:"filter",get:function(){var e=this.tag.split(":");if("filter"!==e[0])return null;var t,r=e[1],n=""===(t=e[2])?[]:t.split(/&/g).map((function(e){if(""===e)return[];var t=e.split("|").map((function(e){return"null"===e?null:e}));return 1===t.length?t[0]:t})),i={};return n.length>0&&(i.topics=n),r&&"*"!==r&&(i.address=r),i}},{key:"pollable",value:function(){return this.tag.indexOf(":")>=0||Uo.indexOf(this.tag)>=0}}]),e}(),Yo={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 Fo(e){return Object(m.h)(E.from(e).toHexString(),32)}function Go(e){return vn.encode(Object(m.b)([e,Object(m.e)(Mn(Mn(e)),0,4)]))}var Wo=new RegExp("^(ipfs)://(.*)$","i"),Zo=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),Wo,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function Ho(e,t){try{return Se(Vo(e,t))}catch(r){}return null}function Vo(e,t){if("0x"===e)return null;var r=E.from(Object(m.e)(e,t,t+32)).toNumber(),n=E.from(Object(m.e)(e,r,r+32)).toNumber();return Object(m.e)(e,r+32,r+32+n)}function qo(e){return e.match(/^ipfs:\/\/ipfs\//i)?e=e.substring(12):e.match(/^ipfs:\/\//i)?e=e.substring(7):Co.throwArgumentError("unsupported IPFS format","link",e),"https://gateway.ipfs.io/ipfs/".concat(e)}function Ko(e){var t=Object(m.a)(e);if(t.length>32)throw new Error("internal; should not happen");var r=new Uint8Array(32);return r.set(t,32-t.length),r}function Jo(e){if(e.length%32===0)return e;var t=new Uint8Array(32*Math.ceil(e.length/32));return t.set(e),t}function Xo(e){for(var t=[],r=0,n=0;n=1&&o<=75)return Go(Object(m.b)([[r.p2pkh],"0x"+i[2]]))}}if(null!=r.p2sh){var a=t.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);if(a){var u=parseInt(a[1],16);if(a[2].length===2*u&&u>=1&&u<=75)return Go(Object(m.b)([[r.p2sh],"0x"+a[2]]))}}if(null!=r.prefix){var s=n[1],c=n[0];if(0===c?20!==s&&32!==s&&(c=-1):c=-1,c>=0&&n.length===2+s&&s>=1&&s<=75){var l=No.a.toWords(n.slice(2));return l.unshift(c),No.a.encode(r.prefix,l)}}return null}},{key:"getAddress",value:function(e){return _o(this,void 0,void 0,Object(y.a)().mark((function t(){var r,n,i;return Object(y.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null==e&&(e=60),60!==e){t.next=16;break}return t.prev=2,t.next=5,this._fetch("0x3b3b57de");case 5:if("0x"!==(r=t.sent)&&r!==ki){t.next=8;break}return t.abrupt("return",null);case 8:return t.abrupt("return",this.provider.formatter.callAddress(r));case 11:if(t.prev=11,t.t0=t.catch(2),t.t0.code!==M.b.errors.CALL_EXCEPTION){t.next=15;break}return t.abrupt("return",null);case 15:throw t.t0;case 16:return t.next=18,this._fetchBytes("0xf1cb7e06",Fo(e));case 18:if(null!=(n=t.sent)&&"0x"!==n){t.next=21;break}return t.abrupt("return",null);case 21:return null==(i=this._getAddress(e,n))&&Co.throwError("invalid or unsupported coin data",M.b.errors.UNSUPPORTED_OPERATION,{operation:"getAddress(".concat(e,")"),coinType:e,data:n}),t.abrupt("return",i);case 24:case"end":return t.stop()}}),t,this,[[2,11]])})))}},{key:"getAvatar",value:function(){return _o(this,void 0,void 0,Object(y.a)().mark((function e(){var t,r,n,i,o,a,u,s,c,l,f,d,h,p,g,v;return Object(y.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=[{type:"name",content:this.name}],e.prev=1,e.next=4,this.getText("avatar");case 4:if(null!=(r=e.sent)){e.next=7;break}return e.abrupt("return",null);case 7:n=0;case 8:if(!(n=0?null:JSON.stringify({data:o,sender:i}),n.next=12,Ao({url:c,errorPassThrough:!0},l,(function(e,t){return e.status=t.statusCode,e}));case 12:if(!(f=n.sent).data){n.next=15;break}return n.abrupt("return",f.data);case 15:if(d=f.message||"unknown error",!(f.status>=400&&f.status<500)){n.next=18;break}return n.abrupt("return",Co.throwError("response not found during CCIP fetch: ".concat(d),M.b.errors.SERVER_ERROR,{url:s,errorMessage:d}));case 18:a.push(d);case 19:u++,n.next=6;break;case 22:return n.abrupt("return",Co.throwError("error encountered during CCIP fetch: ".concat(a.map((function(e){return JSON.stringify(e)})).join(", ")),M.b.errors.SERVER_ERROR,{urls:r,errorMessages:a}));case 23:case"end":return n.stop()}}),n,this)})))}},{key:"_getInternalBlockNumber",value:function(e){return _o(this,void 0,void 0,Object(y.a)().mark((function t(){var r,n,i,o,a=this;return Object(y.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._ready();case 2:if(!(e>0)){t.next=20;break}case 3:if(!this._internalBlockNumber){t.next=20;break}return r=this._internalBlockNumber,t.prev=5,t.next=8,r;case 8:if(n=t.sent,!(Ro()-n.respTime<=e)){t.next=11;break}return t.abrupt("return",n.blockNumber);case 11:return t.abrupt("break",20);case 14:if(t.prev=14,t.t0=t.catch(5),this._internalBlockNumber!==r){t.next=18;break}return t.abrupt("break",20);case 18:t.next=3;break;case 20:return i=Ro(),o=P({blockNumber:this.perform("getBlockNumber",{}),networkError:this.getNetwork().then((function(e){return null}),(function(e){return e}))}).then((function(e){var t=e.blockNumber,r=e.networkError;if(r)throw a._internalBlockNumber===o&&(a._internalBlockNumber=null),r;var n=Ro();return(t=E.from(t).toNumber())1e3)Co.warn("network block skew detected; skipping block events (emitted=".concat(this._emitted.block," blockNumber").concat(n,")")),this.emit("error",Co.makeError("network block skew detected",M.b.errors.NETWORK_ERROR,{blockNumber:n,event:"blockSkew",previousBlockNumber:this._emitted.block})),this.emit("block",n);else for(i=this._emitted.block+1;i<=n;i++)this.emit("block",i);return this._emitted.block!==n&&(this._emitted.block=n,Object.keys(this._emitted).forEach((function(e){if("block"!==e){var t=o._emitted[e];"pending"!==t&&n-t>12&&delete o._emitted[e]}}))),-2===this._lastBlockNumber&&(this._lastBlockNumber=n-1),this._events.forEach((function(e){switch(e.type){case"tx":var t=e.hash,i=o.getTransactionReceipt(t).then((function(e){return e&&null!=e.blockNumber?(o._emitted["t:"+t]=e.blockNumber,o.emit(t,e),null):null})).catch((function(e){o.emit("error",e)}));r.push(i);break;case"filter":if(!e._inflight){e._inflight=!0,-2===e._lastBlockNumber&&(e._lastBlockNumber=n-1);var a=e.filter;a.fromBlock=e._lastBlockNumber+1,a.toBlock=n;var u=a.toBlock-o._maxFilterBlockRange;u>a.fromBlock&&(a.fromBlock=u),a.fromBlock<0&&(a.fromBlock=0);var s=o.getLogs(a).then((function(t){e._inflight=!1,0!==t.length&&t.forEach((function(t){t.blockNumber>e._lastBlockNumber&&(e._lastBlockNumber=t.blockNumber),o._emitted["b:"+t.blockHash]=t.blockNumber,o._emitted["t:"+t.transactionHash]=t.blockNumber,o.emit(a,t)}))})).catch((function(t){o.emit("error",t),e._inflight=!1}));r.push(s)}}})),this._lastBlockNumber=n,Promise.all(r).then((function(){o.emit("didPoll",t)})).catch((function(e){o.emit("error",e)})),e.abrupt("return");case 26:case"end":return e.stop()}}),e,this,[[3,9]])})))}},{key:"resetEventsBlock",value:function(e){this._lastBlockNumber=e-1,this.polling&&this.poll()}},{key:"network",get:function(){return this._network}},{key:"detectNetwork",value:function(){return _o(this,void 0,void 0,Object(y.a)().mark((function e(){return Object(y.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Co.throwError("provider does not support network detection",M.b.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"}));case 1:case"end":return e.stop()}}),e)})))}},{key:"getNetwork",value:function(){return _o(this,void 0,void 0,Object(y.a)().mark((function e(){var t,r,n;return Object(y.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._ready();case 2:return t=e.sent,e.next=5,this.detectNetwork();case 5:if(r=e.sent,t.chainId===r.chainId){e.next=23;break}if(!this.anyNetwork){e.next=20;break}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),e.next=19,Bo(0);case 19:return e.abrupt("return",this._network);case 20:throw n=Co.makeError("underlying network changed",M.b.errors.NETWORK_ERROR,{event:"changed",network:t,detectedNetwork:r}),this.emit("error",n),n;case 23:return e.abrupt("return",t);case 24:case"end":return e.stop()}}),e,this)})))}},{key:"blockNumber",get:function(){var e=this;return this._getInternalBlockNumber(100+this.pollingInterval/2).then((function(t){e._setFastBlockNumber(t)}),(function(e){})),null!=this._fastBlockNumber?this._fastBlockNumber:-1}},{key:"polling",get:function(){return null!=this._poller},set:function(e){var t=this;e&&!this._poller?(this._poller=setInterval((function(){t.poll()}),this.pollingInterval),this._bootstrapPoll||(this._bootstrapPoll=setTimeout((function(){t.poll(),t._bootstrapPoll=setTimeout((function(){t._poller||t.poll(),t._bootstrapPoll=null}),t.pollingInterval)}),0))):!e&&this._poller&&(clearInterval(this._poller),this._poller=null)}},{key:"pollingInterval",get:function(){return this._pollingInterval},set:function(e){var t=this;if("number"!==typeof e||e<=0||parseInt(String(e))!=e)throw new Error("invalid polling interval");this._pollingInterval=e,this._poller&&(clearInterval(this._poller),this._poller=setInterval((function(){t.poll()}),this._pollingInterval))}},{key:"_getFastBlockNumber",value:function(){var e=this,t=Ro();return t-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=t,this._fastBlockNumberPromise=this.getBlockNumber().then((function(t){return(null==e._fastBlockNumber||t>e._fastBlockNumber)&&(e._fastBlockNumber=t),e._fastBlockNumber}))),this._fastBlockNumberPromise}},{key:"_setFastBlockNumber",value:function(e){null!=this._fastBlockNumber&ðis._fastBlockNumber)&&(this._fastBlockNumber=e,this._fastBlockNumberPromise=Promise.resolve(e)))}},{key:"waitForTransaction",value:function(e,t,r){return _o(this,void 0,void 0,Object(y.a)().mark((function n(){return Object(y.a)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.abrupt("return",this._waitForTransaction(e,null==t?1:t,r||0,null));case 1:case"end":return n.stop()}}),n,this)})))}},{key:"_waitForTransaction",value:function(e,t,r,n){return _o(this,void 0,void 0,Object(y.a)().mark((function i(){var o,a=this;return Object(y.a)().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,this.getTransactionReceipt(e);case 2:if(!(((o=i.sent)?o.confirmations:0)>=t)){i.next=5;break}return i.abrupt("return",o);case 5:return i.abrupt("return",new Promise((function(i,o){var u=[],s=!1,c=function(){return!!s||(s=!0,u.forEach((function(e){e()})),!1)},l=function(e){e.confirmations0){var p=setTimeout((function(){c()||o(Co.makeError("timeout exceeded",M.b.errors.TIMEOUT,{timeout:r}))}),r);p.unref&&p.unref(),u.push((function(){clearTimeout(p)}))}})));case 6:case"end":return i.stop()}}),i,this)})))}},{key:"getBlockNumber",value:function(){return _o(this,void 0,void 0,Object(y.a)().mark((function e(){return Object(y.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._getInternalBlockNumber(0));case 1:case"end":return e.stop()}}),e,this)})))}},{key:"getGasPrice",value:function(){return _o(this,void 0,void 0,Object(y.a)().mark((function e(){var t;return Object(y.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getNetwork();case 2:return e.next=4,this.perform("getGasPrice",{});case 4:return t=e.sent,e.prev=5,e.abrupt("return",E.from(t));case 9:return e.prev=9,e.t0=e.catch(5),e.abrupt("return",Co.throwError("bad result from backend",M.b.errors.SERVER_ERROR,{method:"getGasPrice",result:t,error:e.t0}));case 12:case"end":return e.stop()}}),e,this,[[5,9]])})))}},{key:"getBalance",value:function(e,t){return _o(this,void 0,void 0,Object(y.a)().mark((function r(){var n,i;return Object(y.a)().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,this.getNetwork();case 2:return r.next=4,P({address:this._getAddress(e),blockTag:this._getBlockTag(t)});case 4:return n=r.sent,r.next=7,this.perform("getBalance",n);case 7:return i=r.sent,r.prev=8,r.abrupt("return",E.from(i));case 12:return r.prev=12,r.t0=r.catch(8),r.abrupt("return",Co.throwError("bad result from backend",M.b.errors.SERVER_ERROR,{method:"getBalance",params:n,result:i,error:r.t0}));case 15:case"end":return r.stop()}}),r,this,[[8,12]])})))}},{key:"getTransactionCount",value:function(e,t){return _o(this,void 0,void 0,Object(y.a)().mark((function r(){var n,i;return Object(y.a)().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,this.getNetwork();case 2:return r.next=4,P({address:this._getAddress(e),blockTag:this._getBlockTag(t)});case 4:return n=r.sent,r.next=7,this.perform("getTransactionCount",n);case 7:return i=r.sent,r.prev=8,r.abrupt("return",E.from(i).toNumber());case 12:return r.prev=12,r.t0=r.catch(8),r.abrupt("return",Co.throwError("bad result from backend",M.b.errors.SERVER_ERROR,{method:"getTransactionCount",params:n,result:i,error:r.t0}));case 15:case"end":return r.stop()}}),r,this,[[8,12]])})))}},{key:"getCode",value:function(e,t){return _o(this,void 0,void 0,Object(y.a)().mark((function r(){var n,i;return Object(y.a)().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,this.getNetwork();case 2:return r.next=4,P({address:this._getAddress(e),blockTag:this._getBlockTag(t)});case 4:return n=r.sent,r.next=7,this.perform("getCode",n);case 7:return i=r.sent,r.prev=8,r.abrupt("return",Object(m.i)(i));case 12:return r.prev=12,r.t0=r.catch(8),r.abrupt("return",Co.throwError("bad result from backend",M.b.errors.SERVER_ERROR,{method:"getCode",params:n,result:i,error:r.t0}));case 15:case"end":return r.stop()}}),r,this,[[8,12]])})))}},{key:"getStorageAt",value:function(e,t,r){return _o(this,void 0,void 0,Object(y.a)().mark((function n(){var i,o;return Object(y.a)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.getNetwork();case 2:return n.next=4,P({address:this._getAddress(e),blockTag:this._getBlockTag(r),position:Promise.resolve(t).then((function(e){return Object(m.g)(e)}))});case 4:return i=n.sent,n.next=7,this.perform("getStorageAt",i);case 7:return o=n.sent,n.prev=8,n.abrupt("return",Object(m.i)(o));case 12:return n.prev=12,n.t0=n.catch(8),n.abrupt("return",Co.throwError("bad result from backend",M.b.errors.SERVER_ERROR,{method:"getStorageAt",params:i,result:o,error:n.t0}));case 15:case"end":return n.stop()}}),n,this,[[8,12]])})))}},{key:"_wrapTransaction",value:function(e,t,r){var n=this;if(null!=t&&32!==Object(m.d)(t))throw new Error("invalid response - sendTransaction");var i=e;return null!=t&&e.hash!==t&&Co.throwError("Transaction hash mismatch from Provider.sendTransaction.",M.b.errors.UNKNOWN_ERROR,{expectedHash:e.hash,returnedHash:t}),i.wait=function(t,i){return _o(n,void 0,void 0,Object(y.a)().mark((function n(){var o,a;return Object(y.a)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return null==t&&(t=1),null==i&&(i=0),o=void 0,0!==t&&null!=r&&(o={data:e.data,from:e.from,nonce:e.nonce,to:e.to,value:e.value,startBlock:r}),n.next=6,this._waitForTransaction(e.hash,t,i,o);case 6:if(null!=(a=n.sent)||0!==t){n.next=9;break}return n.abrupt("return",null);case 9:return this._emitted["t:"+e.hash]=a.blockNumber,0===a.status&&Co.throwError("transaction failed",M.b.errors.CALL_EXCEPTION,{transactionHash:e.hash,transaction:e,receipt:a}),n.abrupt("return",a);case 12:case"end":return n.stop()}}),n,this)})))},i}},{key:"sendTransaction",value:function(e){return _o(this,void 0,void 0,Object(y.a)().mark((function t(){var r,n,i,o;return Object(y.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getNetwork();case 2:return t.next=4,Promise.resolve(e).then((function(e){return Object(m.i)(e)}));case 4:return r=t.sent,null==(n=this.formatter.transaction(e)).confirmations&&(n.confirmations=0),t.next=9,this._getInternalBlockNumber(100+2*this.pollingInterval);case 9:return i=t.sent,t.prev=10,t.next=13,this.perform("sendTransaction",{signedTransaction:r});case 13:return o=t.sent,t.abrupt("return",this._wrapTransaction(n,o,i));case 17:throw t.prev=17,t.t0=t.catch(10),t.t0.transaction=n,t.t0.transactionHash=n.hash,t.t0;case 22:case"end":return t.stop()}}),t,this,[[10,17]])})))}},{key:"_getTransactionRequest",value:function(e){return _o(this,void 0,void 0,Object(y.a)().mark((function t(){var r,n,i=this;return Object(y.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e;case 2:return r=t.sent,n={},["from","to"].forEach((function(e){null!=r[e]&&(n[e]=Promise.resolve(r[e]).then((function(e){return e?i._getAddress(e):null})))})),["gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","value"].forEach((function(e){null!=r[e]&&(n[e]=Promise.resolve(r[e]).then((function(e){return e?E.from(e):null})))})),["type"].forEach((function(e){null!=r[e]&&(n[e]=Promise.resolve(r[e]).then((function(e){return null!=e?e:null})))})),r.accessList&&(n.accessList=this.formatter.accessList(r.accessList)),["data"].forEach((function(e){null!=r[e]&&(n[e]=Promise.resolve(r[e]).then((function(e){return e?Object(m.i)(e):null})))})),t.t0=this.formatter,t.next=12,P(n);case 12:return t.t1=t.sent,t.abrupt("return",t.t0.transactionRequest.call(t.t0,t.t1));case 14:case"end":return t.stop()}}),t,this)})))}},{key:"_getFilter",value:function(e){return _o(this,void 0,void 0,Object(y.a)().mark((function t(){var r,n=this;return Object(y.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e;case 2:return e=t.sent,r={},null!=e.address&&(r.address=this._getAddress(e.address)),["blockHash","topics"].forEach((function(t){null!=e[t]&&(r[t]=e[t])})),["fromBlock","toBlock"].forEach((function(t){null!=e[t]&&(r[t]=n._getBlockTag(e[t]))})),t.t0=this.formatter,t.next=10,P(r);case 10:return t.t1=t.sent,t.abrupt("return",t.t0.filter.call(t.t0,t.t1));case 12:case"end":return t.stop()}}),t,this)})))}},{key:"_call",value:function(e,t,r){return _o(this,void 0,void 0,Object(y.a)().mark((function n(){var i,o,a,u,s,c,l,f,d,h,p,g,v,b,w;return Object(y.a)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r>=10&&Co.throwError("CCIP read exceeded maximum redirections",M.b.errors.SERVER_ERROR,{redirects:r,transaction:e}),i=e.to,n.next=4,this.perform("call",{transaction:e,blockTag:t});case 4:if(o=n.sent,!(r>=0&&"latest"===t&&null!=i&&"0x556f1830"===o.substring(0,10)&&Object(m.d)(o)%32===4)){n.next=31;break}for(n.prev=6,a=Object(m.e)(o,4),u=Object(m.e)(a,0,32),E.from(u).eq(i)||Co.throwError("CCIP Read sender did not match",M.b.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:o}),s=[],c=E.from(Object(m.e)(a,32,64)).toNumber(),l=E.from(Object(m.e)(a,c,c+32)).toNumber(),f=Object(m.e)(a,c+32),d=0;dthis._emitted.block)){e.next=10;break}return e.abrupt("return",null);case 10:return e.abrupt("return",void 0);case 11:if(!t){e.next=34;break}o=null,a=0;case 14:if(!(a0}},{key:"_stopEvent",value:function(e){this.polling=this._events.filter((function(e){return e.pollable()})).length>0}},{key:"_addEventListener",value:function(e,t,r){var n=new Qo(Po(e),t,r);return this._events.push(n),this._startEvent(n),this}},{key:"on",value:function(e,t){return this._addEventListener(e,t,!1)}},{key:"once",value:function(e,t){return this._addEventListener(e,t,!0)}},{key:"emit",value:function(e){for(var t=this,r=arguments.length,n=new Array(r>1?r-1:0),i=1;i=0&&a.match(/gas required exceeds allowance|always failing transaction|execution reverted/)&&oa.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",M.b.errors.UNPREDICTABLE_GAS_LIMIT,{error:t,method:e,transaction:n}),t}function ca(e){return new Promise((function(t){setTimeout(t,e)}))}function la(e){if(e.error){var t=new Error(e.error.message);throw t.code=e.error.code,t.data=e.error.data,t}return e.result}function fa(e){return e?e.toLowerCase():e}var da={},ha=function(e){Object(h.a)(r,e);var t=Object(p.a)(r);function r(e,n,i){var o;if(Object(g.a)(this,r),o=t.call(this),e!==da)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");return L(Object(l.a)(o),"provider",n),null==i&&(i=0),"string"===typeof i?(L(Object(l.a)(o),"_address",o.provider.formatter.address(i)),L(Object(l.a)(o),"_index",null)):"number"===typeof i?(L(Object(l.a)(o),"_index",i),L(Object(l.a)(o),"_address",null)):oa.throwArgumentError("invalid address or index","addressOrIndex",i),o}return Object(v.a)(r,[{key:"connect",value:function(e){return oa.throwError("cannot alter JSON-RPC Signer connection",M.b.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}},{key:"connectUnchecked",value:function(){return new pa(da,this.provider,this._address||this._index)}},{key:"getAddress",value:function(){var e=this;return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then((function(t){return t.length<=e._index&&oa.throwError("unknown account #"+e._index,M.b.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),e.provider.formatter.address(t[e._index])}))}},{key:"sendUncheckedTransaction",value:function(e){var t=this;e=B(e);var r=this.getAddress().then((function(e){return e&&(e=e.toLowerCase()),e}));if(null==e.gasLimit){var n=B(e);n.from=r,e.gasLimit=this.provider.estimateGas(n)}return null!=e.to&&(e.to=Promise.resolve(e.to).then((function(e){return ia(t,void 0,void 0,Object(y.a)().mark((function t(){var r;return Object(y.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null!=e){t.next=2;break}return t.abrupt("return",null);case 2:return t.next=4,this.provider.resolveName(e);case 4:return null==(r=t.sent)&&oa.throwArgumentError("provided ENS name resolves to null","tx.to",e),t.abrupt("return",r);case 7:case"end":return t.stop()}}),t,this)})))}))),P({tx:P(e),sender:r}).then((function(r){var n=r.tx,i=r.sender;null!=n.from?n.from.toLowerCase()!==i&&oa.throwArgumentError("from address mismatch","transaction",e):n.from=i;var o=t.provider.constructor.hexlifyTransaction(n,{from:!0});return t.provider.send("eth_sendTransaction",[o]).then((function(e){return e}),(function(e){return"string"===typeof e.message&&e.message.match(/user denied/i)&&oa.throwError("user rejected transaction",M.b.errors.ACTION_REJECTED,{action:"sendTransaction",transaction:n}),sa("sendTransaction",e,o)}))}))}},{key:"signTransaction",value:function(e){return oa.throwError("signing transactions is unsupported",M.b.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}},{key:"sendTransaction",value:function(e){return ia(this,void 0,void 0,Object(y.a)().mark((function t(){var r,n,i=this;return Object(y.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.provider._getInternalBlockNumber(100+2*this.provider.pollingInterval);case 2:return r=t.sent,t.next=5,this.sendUncheckedTransaction(e);case 5:return n=t.sent,t.prev=6,t.next=9,Io((function(){return ia(i,void 0,void 0,Object(y.a)().mark((function e(){var t;return Object(y.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.provider.getTransaction(n);case 2:if(null!==(t=e.sent)){e.next=5;break}return e.abrupt("return",void 0);case 5:return e.abrupt("return",this.provider._wrapTransaction(t,n,r));case 6:case"end":return e.stop()}}),e,this)})))}),{oncePoll:this.provider});case 9:return t.abrupt("return",t.sent);case 12:throw t.prev=12,t.t0=t.catch(6),t.t0.transactionHash=n,t.t0;case 16:case"end":return t.stop()}}),t,this,[[6,12]])})))}},{key:"signMessage",value:function(e){return ia(this,void 0,void 0,Object(y.a)().mark((function t(){var r,n;return Object(y.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="string"===typeof e?ke(e):e,t.next=3,this.getAddress();case 3:return n=t.sent,t.prev=4,t.next=7,this.provider.send("personal_sign",[Object(m.i)(r),n.toLowerCase()]);case 7:return t.abrupt("return",t.sent);case 10:throw t.prev=10,t.t0=t.catch(4),"string"===typeof t.t0.message&&t.t0.message.match(/user denied/i)&&oa.throwError("user rejected signing",M.b.errors.ACTION_REJECTED,{action:"signMessage",from:n,messageData:e}),t.t0;case 14:case"end":return t.stop()}}),t,this,[[4,10]])})))}},{key:"_legacySignMessage",value:function(e){return ia(this,void 0,void 0,Object(y.a)().mark((function t(){var r,n;return Object(y.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="string"===typeof e?ke(e):e,t.next=3,this.getAddress();case 3:return n=t.sent,t.prev=4,t.next=7,this.provider.send("eth_sign",[n.toLowerCase(),Object(m.i)(r)]);case 7:return t.abrupt("return",t.sent);case 10:throw t.prev=10,t.t0=t.catch(4),"string"===typeof t.t0.message&&t.t0.message.match(/user denied/i)&&oa.throwError("user rejected signing",M.b.errors.ACTION_REJECTED,{action:"_legacySignMessage",from:n,messageData:e}),t.t0;case 14:case"end":return t.stop()}}),t,this,[[4,10]])})))}},{key:"_signTypedData",value:function(e,t,r){return ia(this,void 0,void 0,Object(y.a)().mark((function n(){var i,o,a=this;return Object(y.a)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,pn.resolveNames(e,t,r,(function(e){return a.provider.resolveName(e)}));case 2:return i=n.sent,n.next=5,this.getAddress();case 5:return o=n.sent,n.prev=6,n.next=9,this.provider.send("eth_signTypedData_v4",[o.toLowerCase(),JSON.stringify(pn.getPayload(i.domain,t,i.value))]);case 9:return n.abrupt("return",n.sent);case 12:throw n.prev=12,n.t0=n.catch(6),"string"===typeof n.t0.message&&n.t0.message.match(/user denied/i)&&oa.throwError("user rejected signing",M.b.errors.ACTION_REJECTED,{action:"_signTypedData",from:o,messageData:{domain:i.domain,types:t,value:i.value}}),n.t0;case 16:case"end":return n.stop()}}),n,this,[[6,12]])})))}},{key:"unlock",value:function(e){return ia(this,void 0,void 0,Object(y.a)().mark((function t(){var r,n;return Object(y.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=this.provider,t.next=3,this.getAddress();case 3:return n=t.sent,t.abrupt("return",r.send("personal_unlockAccount",[n.toLowerCase(),e,null]));case 5:case"end":return t.stop()}}),t,this)})))}}]),r}(Zt),pa=function(e){Object(h.a)(r,e);var t=Object(p.a)(r);function r(){return Object(g.a)(this,r),t.apply(this,arguments)}return Object(v.a)(r,[{key:"sendTransaction",value:function(e){var t=this;return this.sendUncheckedTransaction(e).then((function(e){return{hash:e,nonce:null,gasLimit:null,gasPrice:null,data:null,value:null,chainId:null,confirmations:0,from:null,wait:function(r){return t.provider.waitForTransaction(e,r)}}}))}}]),r}(ha),ga={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0},va=function(e){Object(h.a)(r,e);var t=Object(p.a)(r);function r(e,n){var i;Object(g.a)(this,r);var o=n;return null==o&&(o=new Promise((function(e,t){setTimeout((function(){i.detectNetwork().then((function(t){e(t)}),(function(e){t(e)}))}),0)}))),i=t.call(this,o),e||(e=z(i.constructor,"defaultUrl")()),L(Object(l.a)(i),"connection","string"===typeof e?Object.freeze({url:e}):Object.freeze(B(e))),i._nextId=42,i}return Object(v.a)(r,[{key:"_cache",get:function(){return null==this._eventLoopCache&&(this._eventLoopCache={}),this._eventLoopCache}},{key:"detectNetwork",value:function(){var e=this;return this._cache.detectNetwork||(this._cache.detectNetwork=this._uncachedDetectNetwork(),setTimeout((function(){e._cache.detectNetwork=null}),0)),this._cache.detectNetwork}},{key:"_uncachedDetectNetwork",value:function(){return ia(this,void 0,void 0,Object(y.a)().mark((function e(){var t,r;return Object(y.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ca(0);case 2:return t=null,e.prev=3,e.next=6,this.send("eth_chainId",[]);case 6:t=e.sent,e.next=19;break;case 9:return e.prev=9,e.t0=e.catch(3),e.prev=11,e.next=14,this.send("net_version",[]);case 14:t=e.sent,e.next=19;break;case 17:e.prev=17,e.t1=e.catch(11);case 19:if(null==t){e.next=28;break}return r=z(this.constructor,"getNetwork"),e.prev=21,e.abrupt("return",r(E.from(t).toNumber()));case 25:return e.prev=25,e.t2=e.catch(21),e.abrupt("return",oa.throwError("could not detect network",M.b.errors.NETWORK_ERROR,{chainId:t,event:"invalidNetwork",serverError:e.t2}));case 28:return e.abrupt("return",oa.throwError("could not detect network",M.b.errors.NETWORK_ERROR,{event:"noNetwork"}));case 29:case"end":return e.stop()}}),e,this,[[3,9],[11,17],[21,25]])})))}},{key:"getSigner",value:function(e){return new ha(da,this,e)}},{key:"getUncheckedSigner",value:function(e){return this.getSigner(e).connectUnchecked()}},{key:"listAccounts",value:function(){var e=this;return this.send("eth_accounts",[]).then((function(t){return t.map((function(t){return e.formatter.address(t)}))}))}},{key:"send",value:function(e,t){var r=this,n={method:e,params:t,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:F(n),provider:this});var i=["eth_chainId","eth_blockNumber"].indexOf(e)>=0;if(i&&this._cache[e])return this._cache[e];var o=Ao(this.connection,JSON.stringify(n),la).then((function(e){return r.emit("debug",{action:"response",request:n,response:e,provider:r}),e}),(function(e){throw r.emit("debug",{action:"response",error:e,request:n,provider:r}),e}));return i&&(this._cache[e]=o,setTimeout((function(){r._cache[e]=null}),0)),o}},{key:"prepareRequest",value:function(e,t){switch(e){case"getBlockNumber":return["eth_blockNumber",[]];case"getGasPrice":return["eth_gasPrice",[]];case"getBalance":return["eth_getBalance",[fa(t.address),t.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[fa(t.address),t.blockTag]];case"getCode":return["eth_getCode",[fa(t.address),t.blockTag]];case"getStorageAt":return["eth_getStorageAt",[fa(t.address),Object(m.h)(t.position,32),t.blockTag]];case"sendTransaction":return["eth_sendRawTransaction",[t.signedTransaction]];case"getBlock":return t.blockTag?["eth_getBlockByNumber",[t.blockTag,!!t.includeTransactions]]:t.blockHash?["eth_getBlockByHash",[t.blockHash,!!t.includeTransactions]]:null;case"getTransaction":return["eth_getTransactionByHash",[t.transactionHash]];case"getTransactionReceipt":return["eth_getTransactionReceipt",[t.transactionHash]];case"call":return["eth_call",[z(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0}),t.blockTag]];case"estimateGas":return["eth_estimateGas",[z(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0})]];case"getLogs":return t.filter&&null!=t.filter.address&&(t.filter.address=fa(t.filter.address)),["eth_getLogs",[t.filter]]}return null}},{key:"perform",value:function(e,t){return ia(this,void 0,void 0,Object(y.a)().mark((function r(){var n,i,o;return Object(y.a)().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if("call"!==e&&"estimateGas"!==e){r.next=8;break}if(!(n=t.transaction)||null==n.type||!E.from(n.type).isZero()){r.next=8;break}if(null!=n.maxFeePerGas||null!=n.maxPriorityFeePerGas){r.next=8;break}return r.next=6,this.getFeeData();case 6:null==(i=r.sent).maxFeePerGas&&null==i.maxPriorityFeePerGas&&((t=B(t)).transaction=B(n),delete t.transaction.type);case 8:return null==(o=this.prepareRequest(e,t))&&oa.throwError(e+" not implemented",M.b.errors.NOT_IMPLEMENTED,{operation:e}),r.prev=10,r.next=13,this.send(o[0],o[1]);case 13:return r.abrupt("return",r.sent);case 16:return r.prev=16,r.t0=r.catch(10),r.abrupt("return",sa(e,r.t0,t));case 19:case"end":return r.stop()}}),r,this,[[10,16]])})))}},{key:"_startEvent",value:function(e){"pending"===e.tag&&this._startPending(),Object(f.a)(Object(d.a)(r.prototype),"_startEvent",this).call(this,e)}},{key:"_startPending",value:function(){if(null==this._pendingFilter){var e=this,t=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=t,t.then((function(r){return function n(){e.send("eth_getFilterChanges",[r]).then((function(r){if(e._pendingFilter!=t)return null;var n=Promise.resolve();return r.forEach((function(t){e._emitted["t:"+t.toLowerCase()]="pending",n=n.then((function(){return e.getTransaction(t).then((function(t){return e.emit("pending",t),null}))}))})),n.then((function(){return ca(1e3)}))})).then((function(){if(e._pendingFilter==t)return setTimeout((function(){n()}),0),null;e.send("eth_uninstallFilter",[r])})).catch((function(e){}))}(),r})).catch((function(e){}))}}},{key:"_stopEvent",value:function(e){"pending"===e.tag&&0===this.listenerCount("pending")&&(this._pendingFilter=null),Object(f.a)(Object(d.a)(r.prototype),"_stopEvent",this).call(this,e)}}],[{key:"defaultUrl",value:function(){return"http://localhost:8545"}},{key:"hexlifyTransaction",value:function(e,t){var r=B(ga);if(t)for(var n in t)t[n]&&(r[n]=!0);R(e,r);var i={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach((function(t){if(null!=e[t]){var r=Object(m.g)(E.from(e[t]));"gasLimit"===t&&(t="gas"),i[t]=r}})),["from","to","data"].forEach((function(t){null!=e[t]&&(i[t]=Object(m.i)(e[t]))})),e.accessList&&(i.accessList=fr(e.accessList)),i}}]),r}(ra),ya=null;try{if(null==(ya=WebSocket))throw new Error("inject please")}catch(ns){var ma=new M.b(xo);ya=function(){ma.throwError("WebSockets not supported in this environment",M.b.errors.UNSUPPORTED_OPERATION,{operation:"new WebSocket()"})}}var ba=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{s(n.next(e))}catch(t){o(t)}}function u(e){try{s(n.throw(e))}catch(t){o(t)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,u)}s((n=n.apply(e,t||[])).next())}))},wa=new M.b(xo),Ma=1,Aa=function(e){Object(h.a)(r,e);var t=Object(p.a)(r);function r(e,n){var i,o;Object(g.a)(this,r),"any"===n&&wa.throwError("WebSocketProvider does not support 'any' network yet",M.b.errors.UNSUPPORTED_OPERATION,{operation:"network:any"}),(o="string"===typeof e?t.call(this,e,n):t.call(this,"_websocket",n))._pollingInterval=-1,o._wsReady=!1,L(Object(l.a)(o),"_websocket","string"===typeof e?new ya(o.connection.url):e),L(Object(l.a)(o),"_requests",{}),L(Object(l.a)(o),"_subs",{}),L(Object(l.a)(o),"_subIds",{}),L(Object(l.a)(o),"_detectNetwork",Object(f.a)((i=Object(l.a)(o),Object(d.a)(r.prototype)),"detectNetwork",i).call(i)),o.websocket.onopen=function(){o._wsReady=!0,Object.keys(o._requests).forEach((function(e){o.websocket.send(o._requests[e].payload)}))},o.websocket.onmessage=function(e){var t=e.data,r=JSON.parse(t);if(null!=r.id){var n=String(r.id),i=o._requests[n];if(delete o._requests[n],void 0!==r.result)i.callback(null,r.result),o.emit("debug",{action:"response",request:JSON.parse(i.payload),response:r.result,provider:Object(l.a)(o)});else{var a=null;r.error?(L(a=new Error(r.error.message||"unknown error"),"code",r.error.code||null),L(a,"response",t)):a=new Error("unknown error"),i.callback(a,void 0),o.emit("debug",{action:"response",error:a,request:JSON.parse(i.payload),provider:Object(l.a)(o)})}}else if("eth_subscription"===r.method){var u=o._subs[r.params.subscription];u&&u.processFunc(r.params.result)}else console.warn("this should not happen")};var a=setInterval((function(){o.emit("poll")}),1e3);return a.unref&&a.unref(),Object(na.a)(o)}return Object(v.a)(r,[{key:"websocket",get:function(){return this._websocket}},{key:"detectNetwork",value:function(){return this._detectNetwork}},{key:"pollingInterval",get:function(){return 0},set:function(e){wa.throwError("cannot set polling interval on WebSocketProvider",M.b.errors.UNSUPPORTED_OPERATION,{operation:"setPollingInterval"})}},{key:"resetEventsBlock",value:function(e){wa.throwError("cannot reset events block on WebSocketProvider",M.b.errors.UNSUPPORTED_OPERATION,{operation:"resetEventBlock"})}},{key:"poll",value:function(){return ba(this,void 0,void 0,Object(y.a)().mark((function e(){return Object(y.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",null);case 1:case"end":return e.stop()}}),e)})))}},{key:"polling",set:function(e){e&&wa.throwError("cannot set polling on WebSocketProvider",M.b.errors.UNSUPPORTED_OPERATION,{operation:"setPolling"})}},{key:"send",value:function(e,t){var r=this,n=Ma++;return new Promise((function(i,o){var a=JSON.stringify({method:e,params:t,id:n,jsonrpc:"2.0"});r.emit("debug",{action:"request",request:JSON.parse(a),provider:r}),r._requests[String(n)]={callback:function(e,t){return e?o(e):i(t)},payload:a},r._wsReady&&r.websocket.send(a)}))}},{key:"_subscribe",value:function(e,t,r){return ba(this,void 0,void 0,Object(y.a)().mark((function n(){var i,o,a=this;return Object(y.a)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return null==(i=this._subIds[e])&&(i=Promise.all(t).then((function(e){return a.send("eth_subscribe",e)})),this._subIds[e]=i),n.next=4,i;case 4:o=n.sent,this._subs[o]={tag:e,processFunc:r};case 6:case"end":return n.stop()}}),n,this)})))}},{key:"_startEvent",value:function(e){var t=this;switch(e.type){case"block":this._subscribe("block",["newHeads"],(function(e){var r=E.from(e.number).toNumber();t._emitted.block=r,t.emit("block",r)}));break;case"pending":this._subscribe("pending",["newPendingTransactions"],(function(e){t.emit("pending",e)}));break;case"filter":this._subscribe(e.tag,["logs",this._getFilter(e.filter)],(function(r){null==r.removed&&(r.removed=!1),t.emit(e.filter,t.formatter.filterLog(r))}));break;case"tx":var r=function(e){var r=e.hash;t.getTransactionReceipt(r).then((function(e){e&&t.emit(r,e)}))};r(e),this._subscribe("tx",["newHeads"],(function(e){t._events.filter((function(e){return"tx"===e.type})).forEach(r)}));break;case"debug":case"poll":case"willPoll":case"didPoll":case"error":break;default:console.log("unhandled:",e)}}},{key:"_stopEvent",value:function(e){var t=this,r=e.tag;if("tx"===e.type){if(this._events.filter((function(e){return"tx"===e.type})).length)return;r="tx"}else if(this.listenerCount(e.event))return;var n=this._subIds[r];n&&(delete this._subIds[r],n.then((function(e){t._subs[e]&&(delete t._subs[e],t.send("eth_unsubscribe",[e]))})))}},{key:"destroy",value:function(){return ba(this,void 0,void 0,Object(y.a)().mark((function e(){var t=this;return Object(y.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.websocket.readyState!==ya.CONNECTING){e.next=3;break}return e.next=3,new Promise((function(e){t.websocket.onopen=function(){e(!0)},t.websocket.onerror=function(){e(!1)}}));case 3:this.websocket.close(1e3);case 4:case"end":return e.stop()}}),e,this)})))}}],[{key:"defaultUrl",value:function(){return"ws://localhost:8546"}}]),r}(va),Ia=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{s(n.next(e))}catch(t){o(t)}}function u(e){try{s(n.throw(e))}catch(t){o(t)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,u)}s((n=n.apply(e,t||[])).next())}))},ja=new M.b(xo),Na=function(e){Object(h.a)(r,e);var t=Object(p.a)(r);function r(){return Object(g.a)(this,r),t.apply(this,arguments)}return Object(v.a)(r,[{key:"detectNetwork",value:function(){var e=this,t=Object.create(null,{detectNetwork:{get:function(){return Object(f.a)(Object(d.a)(r.prototype),"detectNetwork",e)}}});return Ia(this,void 0,void 0,Object(y.a)().mark((function e(){var r;return Object(y.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=(r=this.network)){e.next=7;break}return e.next=4,t.detectNetwork.call(this);case 4:(r=e.sent)||ja.throwError("no network detected",M.b.errors.UNKNOWN_ERROR,{}),null==this._network&&(L(this,"_network",r),this.emit("network",r,null));case 7:return e.abrupt("return",r);case 8:case"end":return e.stop()}}),e,this)})))}}]),r}(va),xa=function(e){Object(h.a)(r,e);var t=Object(p.a)(r);function r(e,n){var i;Object(g.a)(this,r),ja.checkAbstract(this instanceof r?this.constructor:void 0,r),e=z(this instanceof r?this.constructor:void 0,"getNetwork")(e),n=z(this instanceof r?this.constructor:void 0,"getApiKey")(n);var o=z(this instanceof r?this.constructor:void 0,"getUrl")(e,n);return i=t.call(this,o,e),"string"===typeof n?L(Object(l.a)(i),"apiKey",n):null!=n&&Object.keys(n).forEach((function(e){L(Object(l.a)(i),e,n[e])})),i}return Object(v.a)(r,[{key:"_startPending",value:function(){ja.warn("WARNING: API provider does not support pending filters")}},{key:"isCommunityResource",value:function(){return!1}},{key:"getSigner",value:function(e){return ja.throwError("API provider does not support signing",M.b.errors.UNSUPPORTED_OPERATION,{operation:"getSigner"})}},{key:"listAccounts",value:function(){return Promise.resolve([])}}],[{key:"getApiKey",value:function(e){return e}},{key:"getUrl",value:function(e,t){return ja.throwError("not implemented; sub-classes must override getUrl",M.b.errors.NOT_IMPLEMENTED,{operation:"getUrl"})}}]),r}(Na),ka=new M.b(xo),Ea="_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC",Da=function(e){Object(h.a)(r,e);var t=Object(p.a)(r);function r(e,n){var i;Object(g.a)(this,r);var o=new Ta(e,n),a=o.connection.url.replace(/^http/i,"ws").replace(".alchemyapi.",".ws.alchemyapi.");return i=t.call(this,a,o.network),L(Object(l.a)(i),"apiKey",o.apiKey),i}return Object(v.a)(r,[{key:"isCommunityResource",value:function(){return this.apiKey===Ea}}]),r}(Aa),Ta=function(e){Object(h.a)(r,e);var t=Object(p.a)(r);function r(){return Object(g.a)(this,r),t.apply(this,arguments)}return Object(v.a)(r,[{key:"isCommunityResource",value:function(){return this.apiKey===Ea}}],[{key:"getWebSocketProvider",value:function(e,t){return new Da(e,t)}},{key:"getApiKey",value:function(e){return null==e?Ea:(e&&"string"!==typeof e&&ka.throwArgumentError("invalid apiKey","apiKey",e),e)}},{key:"getUrl",value:function(e,t){var r=null;switch(e.name){case"homestead":r="eth-mainnet.alchemyapi.io/v2/";break;case"ropsten":r="eth-ropsten.alchemyapi.io/v2/";break;case"rinkeby":r="eth-rinkeby.alchemyapi.io/v2/";break;case"goerli":r="eth-goerli.alchemyapi.io/v2/";break;case"kovan":r="eth-kovan.alchemyapi.io/v2/";break;case"matic":r="polygon-mainnet.g.alchemy.com/v2/";break;case"maticmum":r="polygon-mumbai.g.alchemy.com/v2/";break;case"arbitrum":r="arb-mainnet.g.alchemy.com/v2/";break;case"arbitrum-rinkeby":r="arb-rinkeby.g.alchemy.com/v2/";break;case"arbitrum-goerli":r="arb-goerli.g.alchemy.com/v2/";break;case"optimism":r="opt-mainnet.g.alchemy.com/v2/";break;case"optimism-kovan":r="opt-kovan.g.alchemy.com/v2/";break;case"optimism-goerli":r="opt-goerli.g.alchemy.com/v2/";break;default:ka.throwArgumentError("unsupported network","network",arguments[0])}return{allowGzip:!0,url:"https://"+r+t,throttleCallback:function(e,r){return t===Ea&&Oo(),Promise.resolve(!0)}}}}]),r}(xa),Sa=new M.b(xo),Oa="9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972";function _a(e){switch(e){case"homestead":return"rpc.ankr.com/eth/";case"ropsten":return"rpc.ankr.com/eth_ropsten/";case"rinkeby":return"rpc.ankr.com/eth_rinkeby/";case"goerli":return"rpc.ankr.com/eth_goerli/";case"matic":return"rpc.ankr.com/polygon/";case"arbitrum":return"rpc.ankr.com/arbitrum/"}return Sa.throwArgumentError("unsupported network","name",e)}var Ca=function(e){Object(h.a)(r,e);var t=Object(p.a)(r);function r(){return Object(g.a)(this,r),t.apply(this,arguments)}return Object(v.a)(r,[{key:"isCommunityResource",value:function(){return this.apiKey===Oa}}],[{key:"getApiKey",value:function(e){return null==e?Oa:e}},{key:"getUrl",value:function(e,t){null==t&&(t=Oa);var r={allowGzip:!0,url:"https://"+_a(e.name)+t,throttleCallback:function(e,r){return t.apiKey===Oa&&Oo(),Promise.resolve(!0)}};return null!=t.projectSecret&&(r.user="",r.password=t.projectSecret),r}}]),r}(xa),La=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{s(n.next(e))}catch(t){o(t)}}function u(e){try{s(n.throw(e))}catch(t){o(t)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,u)}s((n=n.apply(e,t||[])).next())}))},za=new M.b(xo),Pa=function(e){Object(h.a)(r,e);var t=Object(p.a)(r);function r(){return Object(g.a)(this,r),t.apply(this,arguments)}return Object(v.a)(r,[{key:"perform",value:function(e,t){var n=this,i=Object.create(null,{perform:{get:function(){return Object(f.a)(Object(d.a)(r.prototype),"perform",n)}}});return La(this,void 0,void 0,Object(y.a)().mark((function r(){var n;return Object(y.a)().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if("getBlockNumber"!==e){r.next=5;break}return r.next=3,i.perform.call(this,"getBlock",{blockTag:"latest"});case 3:return n=r.sent,r.abrupt("return",n.number);case 5:return r.abrupt("return",i.perform.call(this,e,t));case 6:case"end":return r.stop()}}),r,this)})))}}],[{key:"getApiKey",value:function(e){return null!=e&&za.throwArgumentError("apiKey not supported for cloudflare","apiKey",e),null}},{key:"getUrl",value:function(e,t){var r=null;if("homestead"===e.name)r="https://cloudflare-eth.com/";else za.throwArgumentError("unsupported network","network",arguments[0]);return r}}]),r}(xa),Ra=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{s(n.next(e))}catch(t){o(t)}}function u(e){try{s(n.throw(e))}catch(t){o(t)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,u)}s((n=n.apply(e,t||[])).next())}))},Ba=new M.b(xo);function Ua(e){var t={};for(var r in e)if(null!=e[r]){var n=e[r];"type"===r&&0===n||(n={type:!0,gasLimit:!0,gasPrice:!0,maxFeePerGs:!0,maxPriorityFeePerGas:!0,nonce:!0,value:!0}[r]?Object(m.g)(Object(m.i)(n)):"accessList"===r?"["+fr(n).map((function(e){return'{address:"'.concat(e.address,'",storageKeys:["').concat(e.storageKeys.join('","'),'"]}')})).join(",")+"]":Object(m.i)(n),t[r]=n)}return t}function Qa(e){if(0==e.status&&("No records found"===e.message||"No transactions found"===e.message))return e.result;if(1!=e.status||"string"!==typeof e.message||!e.message.match(/^OK/)){var t=new Error("invalid response");throw t.result=JSON.stringify(e),(e.result||"").toLowerCase().indexOf("rate limit")>=0&&(t.throttleRetry=!0),t}return e.result}function Ya(e){if(e&&0==e.status&&"NOTOK"==e.message&&(e.result||"").toLowerCase().indexOf("rate limit")>=0){var t=new Error("throttled response");throw t.result=JSON.stringify(e),t.throttleRetry=!0,t}if("2.0"!=e.jsonrpc){var r=new Error("invalid response");throw r.result=JSON.stringify(e),r}if(e.error){var n=new Error(e.error.message||"unknown error");throw e.error.code&&(n.code=e.error.code),e.error.data&&(n.data=e.error.data),n}return e.result}function Fa(e){if("pending"===e)throw new Error("pending not supported");return"latest"===e?e:parseInt(e.substring(2),16)}function Ga(e,t,r){if("call"===e&&t.code===M.b.errors.SERVER_ERROR){var n=t.error;if(n&&(n.message.match(/reverted/i)||n.message.match(/VM execution error/i))){var i=n.data;if(i&&(i="0x"+i.replace(/^.*0x/i,"")),Object(m.l)(i))return i;Ba.throwError("missing revert data in call exception",M.b.errors.CALL_EXCEPTION,{error:t,data:"0x"})}}var o=t.message;throw t.code===M.b.errors.SERVER_ERROR&&(t.error&&"string"===typeof t.error.message?o=t.error.message:"string"===typeof t.body?o=t.body:"string"===typeof t.responseText&&(o=t.responseText)),(o=(o||"").toLowerCase()).match(/insufficient funds/)&&Ba.throwError("insufficient funds for intrinsic transaction cost",M.b.errors.INSUFFICIENT_FUNDS,{error:t,method:e,transaction:r}),o.match(/same hash was already imported|transaction nonce is too low|nonce too low/)&&Ba.throwError("nonce has already been used",M.b.errors.NONCE_EXPIRED,{error:t,method:e,transaction:r}),o.match(/another transaction with same nonce/)&&Ba.throwError("replacement fee too low",M.b.errors.REPLACEMENT_UNDERPRICED,{error:t,method:e,transaction:r}),o.match(/execution failed due to an exception|execution reverted/)&&Ba.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",M.b.errors.UNPREDICTABLE_GAS_LIMIT,{error:t,method:e,transaction:r}),t}var Wa=function(e){Object(h.a)(r,e);var t=Object(p.a)(r);function r(e,n){var i;return Object(g.a)(this,r),i=t.call(this,e),L(Object(l.a)(i),"baseUrl",i.getBaseUrl()),L(Object(l.a)(i),"apiKey",n||null),i}return Object(v.a)(r,[{key:"getBaseUrl",value:function(){switch(this.network?this.network.name:"invalid"){case"homestead":return"https://api.etherscan.io";case"ropsten":return"https://api-ropsten.etherscan.io";case"rinkeby":return"https://api-rinkeby.etherscan.io";case"kovan":return"https://api-kovan.etherscan.io";case"goerli":return"https://api-goerli.etherscan.io";case"sepolia":return"https://api-sepolia.etherscan.io";case"optimism":return"https://api-optimistic.etherscan.io";case"optimism-kovan":return"https://api-kovan-optimistic.etherscan.io"}return Ba.throwArgumentError("unsupported network","network",this.network.name)}},{key:"getUrl",value:function(e,t){var r=Object.keys(t).reduce((function(e,r){var n=t[r];return null!=n&&(e+="&".concat(r,"=").concat(n)),e}),""),n=this.apiKey?"&apikey=".concat(this.apiKey):"";return"".concat(this.baseUrl,"/api?module=").concat(e).concat(r).concat(n)}},{key:"getPostUrl",value:function(){return"".concat(this.baseUrl,"/api")}},{key:"getPostData",value:function(e,t){return t.module=e,t.apikey=this.apiKey,t}},{key:"fetch",value:function(e,t,r){return Ra(this,void 0,void 0,Object(y.a)().mark((function n(){var i,o,a,u,s,c,l=this;return Object(y.a)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return i=r?this.getPostUrl():this.getUrl(e,t),o=r?this.getPostData(e,t):null,a="proxy"===e?Ya:Qa,this.emit("debug",{action:"request",request:i,provider:this}),u={url:i,throttleSlotInterval:1e3,throttleCallback:function(e,t){return l.isCommunityResource()&&Oo(),Promise.resolve(!0)}},s=null,o&&(u.headers={"content-type":"application/x-www-form-urlencoded; charset=UTF-8"},s=Object.keys(o).map((function(e){return"".concat(e,"=").concat(o[e])})).join("&")),n.next=9,Ao(u,s,a||Ya);case 9:return c=n.sent,this.emit("debug",{action:"response",request:i,response:F(c),provider:this}),n.abrupt("return",c);case 12:case"end":return n.stop()}}),n,this)})))}},{key:"detectNetwork",value:function(){return Ra(this,void 0,void 0,Object(y.a)().mark((function e(){return Object(y.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.network);case 1:case"end":return e.stop()}}),e,this)})))}},{key:"perform",value:function(e,t){var n=this,i=Object.create(null,{perform:{get:function(){return Object(f.a)(Object(d.a)(r.prototype),"perform",n)}}});return Ra(this,void 0,void 0,Object(y.a)().mark((function r(){var n,o,a,u,s,c,l,f,d;return Object(y.a)().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:r.t0=e,r.next="getBlockNumber"===r.t0?3:"getGasPrice"===r.t0?4:"getBalance"===r.t0?5:"getTransactionCount"===r.t0?6:"getCode"===r.t0?7:"getStorageAt"===r.t0?8:"sendTransaction"===r.t0?9:"getBlock"===r.t0?10:"getTransaction"===r.t0?13:"getTransactionReceipt"===r.t0?14:"call"===r.t0?15:"estimateGas"===r.t0?29:"getLogs"===r.t0?41:"getEtherPrice"===r.t0?65:72;break;case 3:return r.abrupt("return",this.fetch("proxy",{action:"eth_blockNumber"}));case 4:return r.abrupt("return",this.fetch("proxy",{action:"eth_gasPrice"}));case 5:return r.abrupt("return",this.fetch("account",{action:"balance",address:t.address,tag:t.blockTag}));case 6:return r.abrupt("return",this.fetch("proxy",{action:"eth_getTransactionCount",address:t.address,tag:t.blockTag}));case 7:return r.abrupt("return",this.fetch("proxy",{action:"eth_getCode",address:t.address,tag:t.blockTag}));case 8:return r.abrupt("return",this.fetch("proxy",{action:"eth_getStorageAt",address:t.address,position:t.position,tag:t.blockTag}));case 9:return r.abrupt("return",this.fetch("proxy",{action:"eth_sendRawTransaction",hex:t.signedTransaction},!0).catch((function(e){return Ga("sendTransaction",e,t.signedTransaction)})));case 10:if(!t.blockTag){r.next=12;break}return r.abrupt("return",this.fetch("proxy",{action:"eth_getBlockByNumber",tag:t.blockTag,boolean:t.includeTransactions?"true":"false"}));case 12:throw new Error("getBlock by blockHash not implemented");case 13:return r.abrupt("return",this.fetch("proxy",{action:"eth_getTransactionByHash",txhash:t.transactionHash}));case 14:return r.abrupt("return",this.fetch("proxy",{action:"eth_getTransactionReceipt",txhash:t.transactionHash}));case 15:if("latest"===t.blockTag){r.next=17;break}throw new Error("EtherscanProvider does not support blockTag for call");case 17:return(n=Ua(t.transaction)).module="proxy",n.action="eth_call",r.prev=20,r.next=23,this.fetch("proxy",n,!0);case 23:return r.abrupt("return",r.sent);case 26:return r.prev=26,r.t1=r.catch(20),r.abrupt("return",Ga("call",r.t1,t.transaction));case 29:return(o=Ua(t.transaction)).module="proxy",o.action="eth_estimateGas",r.prev=32,r.next=35,this.fetch("proxy",o,!0);case 35:return r.abrupt("return",r.sent);case 38:return r.prev=38,r.t2=r.catch(32),r.abrupt("return",Ga("estimateGas",r.t2,t.transaction));case 41:return a={action:"getLogs"},t.filter.fromBlock&&(a.fromBlock=Fa(t.filter.fromBlock)),t.filter.toBlock&&(a.toBlock=Fa(t.filter.toBlock)),t.filter.address&&(a.address=t.filter.address),t.filter.topics&&t.filter.topics.length>0&&(t.filter.topics.length>1&&Ba.throwError("unsupported topic count",M.b.errors.UNSUPPORTED_OPERATION,{topics:t.filter.topics}),1===t.filter.topics.length&&("string"===typeof(u=t.filter.topics[0])&&66===u.length||Ba.throwError("unsupported topic format",M.b.errors.UNSUPPORTED_OPERATION,{topic0:u}),a.topic0=u)),r.next=48,this.fetch("logs",a);case 48:s=r.sent,c={},l=0;case 51:if(!(l0;t--){var r=Math.floor(Math.random()*(t+1)),n=e[t];e[t]=e[r],e[r]=n}return e}var Ha=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{s(n.next(e))}catch(t){o(t)}}function u(e){try{s(n.throw(e))}catch(t){o(t)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,u)}s((n=n.apply(e,t||[])).next())}))},Va=new M.b(xo);function qa(){return(new Date).getTime()}function Ka(e){for(var t=null,r=0;rt?null:(n+i)/2}function Xa(e){if(null===e)return"null";if("number"===typeof e||"boolean"===typeof e)return JSON.stringify(e);if("string"===typeof e)return e;if(E.isBigNumber(e))return e.toString();if(Array.isArray(e))return JSON.stringify(e.map((function(e){return Xa(e)})));if("object"===typeof e){var t=Object.keys(e);return t.sort(),"{"+t.map((function(t){var r=e[t];return r="function"===typeof r?"[function]":Xa(r),JSON.stringify(t)+":"+r})).join(",")+"}"}throw new Error("unknown value type: "+typeof e)}var $a=1;function eu(e){var t=null,r=null,n=new Promise((function(n){t=function(){r&&(clearTimeout(r),r=null),n()},r=setTimeout(t,e)}));return{cancel:t,getPromise:function(){return n},wait:function(e){return n=n.then(e)}}}var tu=[M.b.errors.CALL_EXCEPTION,M.b.errors.INSUFFICIENT_FUNDS,M.b.errors.NONCE_EXPIRED,M.b.errors.REPLACEMENT_UNDERPRICED,M.b.errors.UNPREDICTABLE_GAS_LIMIT],ru=["address","args","errorArgs","errorSignature","method","transaction"];function nu(e,t){var r={weight:e.weight};return Object.defineProperty(r,"provider",{get:function(){return e.provider}}),e.start&&(r.start=e.start),t&&(r.duration=t-e.start),e.done&&(e.error?r.error=e.error:r.result=e.result||null),r}function iu(e,t,r){var n=Xa;switch(t){case"getBlockNumber":return function(t){var r=t.map((function(e){return e.result})),n=Ja(t.map((function(e){return e.result})),2);if(null!=n)return n=Math.ceil(n),r.indexOf(n+1)>=0&&n++,n>=e._highestBlockNumber&&(e._highestBlockNumber=n),e._highestBlockNumber};case"getGasPrice":return function(e){var t=e.map((function(e){return e.result}));return t.sort(),t[Math.floor(t.length/2)]};case"getEtherPrice":return function(e){return Ja(e.map((function(e){return e.result})))};case"getBalance":case"getTransactionCount":case"getCode":case"getStorageAt":case"call":case"estimateGas":case"getLogs":break;case"getTransaction":case"getTransactionReceipt":n=function(e){return null==e?null:((e=B(e)).confirmations=-1,Xa(e))};break;case"getBlock":n=r.includeTransactions?function(e){return null==e?null:((e=B(e)).transactions=e.transactions.map((function(e){return(e=B(e)).confirmations=-1,e})),Xa(e))}:function(e){return null==e?null:Xa(e)};break;default:throw new Error("unknown method: "+t)}return function(e,t){return function(r){var n={};r.forEach((function(t){var r=e(t.result);n[r]||(n[r]={count:0,result:t.result}),n[r].count++}));for(var i=Object.keys(n),o=0;o=t)return a.result}}}(n,e.quorum)}function ou(e,t){return Ha(this,void 0,void 0,Object(y.a)().mark((function r(){var n;return Object(y.a)().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!(null!=(n=e.provider).blockNumber&&n.blockNumber>=t||-1===t)){r.next=3;break}return r.abrupt("return",n);case 3:return r.abrupt("return",Io((function(){return new Promise((function(r,i){setTimeout((function(){return n.blockNumber>=t?r(n):e.cancelled?r(null):r(void 0)}),0)}))}),{oncePoll:n}));case 4:case"end":return r.stop()}}),r)})))}function au(e,t,r,n){return Ha(this,void 0,void 0,Object(y.a)().mark((function i(){var o,a;return Object(y.a)().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:o=e.provider,i.t0=r,i.next="getBlockNumber"===i.t0||"getGasPrice"===i.t0?4:"getEtherPrice"===i.t0?5:"getBalance"===i.t0||"getTransactionCount"===i.t0||"getCode"===i.t0?8:"getStorageAt"===i.t0?13:"getBlock"===i.t0?18:"call"===i.t0||"estimateGas"===i.t0?23:"getTransaction"===i.t0||"getTransactionReceipt"===i.t0?30:"getLogs"===i.t0?31:37;break;case 4:return i.abrupt("return",o[r]());case 5:if(!o.getEtherPrice){i.next=7;break}return i.abrupt("return",o.getEtherPrice());case 7:return i.abrupt("break",37);case 8:if(!n.blockTag||!Object(m.l)(n.blockTag)){i.next=12;break}return i.next=11,ou(e,t);case 11:o=i.sent;case 12:return i.abrupt("return",o[r](n.address,n.blockTag||"latest"));case 13:if(!n.blockTag||!Object(m.l)(n.blockTag)){i.next=17;break}return i.next=16,ou(e,t);case 16:o=i.sent;case 17:return i.abrupt("return",o.getStorageAt(n.address,n.position,n.blockTag||"latest"));case 18:if(!n.blockTag||!Object(m.l)(n.blockTag)){i.next=22;break}return i.next=21,ou(e,t);case 21:o=i.sent;case 22:return i.abrupt("return",o[n.includeTransactions?"getBlockWithTransactions":"getBlock"](n.blockTag||n.blockHash));case 23:if(!n.blockTag||!Object(m.l)(n.blockTag)){i.next=27;break}return i.next=26,ou(e,t);case 26:o=i.sent;case 27:if("call"!==r||!n.blockTag){i.next=29;break}return i.abrupt("return",o[r](n.transaction,n.blockTag));case 29:return i.abrupt("return",o[r](n.transaction));case 30:return i.abrupt("return",o[r](n.transactionHash));case 31:if(!((a=n.filter).fromBlock&&Object(m.l)(a.fromBlock)||a.toBlock&&Object(m.l)(a.toBlock))){i.next=36;break}return i.next=35,ou(e,t);case 35:o=i.sent;case 36:return i.abrupt("return",o.getLogs(a));case 37:return i.abrupt("return",Va.throwError("unknown method error",M.b.errors.UNKNOWN_ERROR,{method:r,params:n}));case 38:case"end":return i.stop()}}),i)})))}var uu=function(e){Object(h.a)(r,e);var t=Object(p.a)(r);function r(e,n){var i;Object(g.a)(this,r),0===e.length&&Va.throwArgumentError("missing providers","providers",e);var o=e.map((function(e,t){if(Qt.isProvider(e)){var r=To(e)?2e3:750;return Object.freeze({provider:e,weight:1,stallTimeout:r,priority:1})}var n=B(e);null==n.priority&&(n.priority=1),null==n.stallTimeout&&(n.stallTimeout=To(e)?2e3:750),null==n.weight&&(n.weight=1);var i=n.weight;return(i%1||i>512||i<1)&&Va.throwArgumentError("invalid weight; must be integer in [1, 512]","providers[".concat(t,"].weight"),i),Object.freeze(n)})),a=o.reduce((function(e,t){return e+t.weight}),0);null==n?n=a/2:n>a&&Va.throwArgumentError("quorum will always fail; larger than total weight","quorum",n);var u=Ka(o.map((function(e){return e.provider.network})));return null==u&&(u=new Promise((function(e,t){setTimeout((function(){i.detectNetwork().then(e,t)}),0)}))),i=t.call(this,u),L(Object(l.a)(i),"providerConfigs",Object.freeze(o)),L(Object(l.a)(i),"quorum",n),i._highestBlockNumber=-1,i}return Object(v.a)(r,[{key:"detectNetwork",value:function(){return Ha(this,void 0,void 0,Object(y.a)().mark((function e(){var t;return Object(y.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all(this.providerConfigs.map((function(e){return e.provider.getNetwork()})));case 2:return t=e.sent,e.abrupt("return",Ka(t));case 4:case"end":return e.stop()}}),e,this)})))}},{key:"perform",value:function(e,t){return Ha(this,void 0,void 0,Object(y.a)().mark((function r(){var n,i,o,a,u,s,c,l,f,d,h=this;return Object(y.a)().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if("sendTransaction"!==e){r.next=13;break}return r.next=3,Promise.all(this.providerConfigs.map((function(e){return e.provider.sendTransaction(t.signedTransaction).then((function(e){return e.hash}),(function(e){return e}))})));case 3:n=r.sent,i=0;case 5:if(!(i=h.quorum)){r.next=22;break}if(void 0===(p=a(d))){r.next=18;break}return u.forEach((function(e){e.staller&&e.staller.cancel(),e.cancelled=!0})),r.abrupt("return",{v:p});case 18:if(l){r.next=21;break}return r.next=21,eu(100).getPromise();case 21:l=!1;case 22:if(g=u.reduce((function(e,t){if(!t.done||null==t.error)return e;var r=t.error.code;return tu.indexOf(r)>=0&&(e[r]||(e[r]={error:t.error,weight:0}),e[r].weight+=t.weight),e}),{}),Object.keys(g).forEach((function(e){var t=g[e];if(!(t.weight256)&&Du.throwArgumentError("invalid number type","type",e),r&&(i=256),t=E.from(t).toTwos(i),Object(m.p)(t,i/8)}if(n=e.match(Nu)){var o=parseInt(n[1]);return(String(o)!==n[1]||0===o||o>32)&&Du.throwArgumentError("invalid bytes type","type",e),Object(m.a)(t).byteLength!==o&&Du.throwArgumentError("invalid value for ".concat(e),"value",t),r?Object(m.a)((t+Eu).substring(0,66)):t}if((n=e.match(ku))&&Array.isArray(t)){var a=n[1];parseInt(n[2]||String(t.length))!=t.length&&Du.throwArgumentError("invalid array length for ".concat(e),"value",t);var u=[];return t.forEach((function(e){u.push(Tu(a,e,!0))})),Object(m.b)(u)}return Du.throwArgumentError("invalid type","type",e)}function Su(e,t){e.length!=t.length&&Du.throwArgumentError("wrong number of values; expected ${ types.length }","values",t);var r=[];return e.forEach((function(e,n){r.push(Tu(e,t[n]))})),Object(m.i)(Object(m.b)(r))}function Ou(e,t){return $(Su(e,t))}function _u(e,t){return Mn(Su(e,t))}function Cu(e,t){t||(t=function(e){return[parseInt(e,16)]});var r=0,n={};return e.split(",").forEach((function(e){var i=e.split(":");r+=parseInt(i[0],16),n[r]=t(i[1])})),n}function Lu(e){var t=0;return e.split(",").map((function(e){var r=e.split("-");return 1===r.length?r[1]="0":""===r[1]&&(r[1]="1"),{l:t+parseInt(r[0],16),h:t=parseInt(r[1],16)}}))}function zu(e,t){for(var r=0,n=0;n=(r+=i.l)&&e<=r+i.h&&(e-r)%(i.d||1)===0){if(i.e&&-1!==i.e.indexOf(e-r))continue;return i}}return null}var Pu=Lu("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"),Ru="ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map((function(e){return parseInt(e,16)})),Bu=[{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}],Uu=Cu("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"),Qu=Cu("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"),Yu=Cu("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(e){if(e.length%4!==0)throw new Error("bad data");for(var t=[],r=0;r=0)return[];if(e>=65024&&e<=65039)return[];var t=function(e){var t=zu(e,Bu);if(t)return[e+t.s];var r=Uu[e];if(r)return r;var n=Qu[e];return n?[e+n[0]]:Yu[e]||null}(e);return t||[e]})),r=t.reduce((function(e,t){return t.forEach((function(t){e.push(t)})),e}),[]),(r=Oe(Te(r),Me.NFKC)).forEach((function(e){if(zu(e,Fu))throw new Error("STRINGPREP_CONTAINS_PROHIBITED")})),r.forEach((function(e){if(zu(e,Pu))throw new Error("STRINGPREP_CONTAINS_UNASSIGNED")}));var n=Te(r);if("-"===n.substring(0,1)||"--"===n.substring(2,4)||"-"===n.substring(n.length-1))throw new Error("invalid hyphen");return n}function Wu(e){var t=ke(e);if(t.length>31)throw new Error("bytes32 string must be less than 32 bytes");return Object(m.i)(Object(m.b)([t,ki]).slice(0,32))}function Zu(e){var t=Object(m.a)(e);if(32!==t.length)throw new Error("invalid bytes32 - not 32 bytes long");if(0!==t[31])throw new Error("invalid bytes32 string - no null terminator");for(var r=31;0===t[r-1];)r--;return Se(t.slice(0,r))}var Hu=new M.b("units/5.7.0"),Vu=["wei","kwei","mwei","gwei","szabo","finney","ether"];function qu(e){var t=String(e).split(".");(t.length>2||!t[0].match(/^-?[0-9]*$/)||t[1]&&!t[1].match(/^[0-9]*$/)||"."===e||"-."===e)&&Hu.throwArgumentError("invalid value","value",e);var r=t[0],n="";for("-"===r.substring(0,1)&&(n="-",r=r.substring(1));"0"===r.substring(0,1);)r=r.substring(1);""===r&&(r="0");var i="";for(2===t.length&&(i="."+(t[1]||"0"));i.length>2&&"0"===i[i.length-1];)i=i.substring(0,i.length-1);for(var o=[];r.length;){if(r.length<=3){o.unshift(r);break}var a=r.length-3;o.unshift(r.substring(a)),r=r.substring(0,a)}return n+o.join(",")+i}function Ku(e,t){if("string"===typeof t){var r=Vu.indexOf(t);-1!==r&&(t=3*r)}return Yr(e,null!=t?t:18)}function Ju(e,t){if("string"!==typeof e&&Hu.throwArgumentError("value must be a string","value",e),"string"===typeof t){var r=Vu.indexOf(t);-1!==r&&(t=3*r)}return Fr(e,null!=t?t:18)}function Xu(e){return Ku(e,18)}function $u(e){return Ju(e,18)}var es="ethers/5.7.1",ts=new M.b(es);try{var rs=window;null==rs._ethers&&(rs._ethers=s)}catch(ns){}},function(e,t,r){"use strict";r.d(t,"b",(function(){return f})),r.d(t,"a",(function(){return h})),r.d(t,"c",(function(){return g})),r.d(t,"d",(function(){return y})),r.d(t,"e",(function(){return b})),r.d(t,"f",(function(){return M}));var n=r(0),i=r(7),o=r(47),a=r(34);function u(e){return e===a.a?{length:a.b,name:a.a}:{hash:{name:a.f},name:a.e}}function s(e){return e===a.a?[a.d,a.c]:[a.k,a.l]}function c(e){return l.apply(this,arguments)}function l(){return l=Object(i.a)(Object(n.a)().mark((function e(t){var r,i=arguments;return Object(n.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=i.length>1&&void 0!==i[1]?i[1]:a.a,e.abrupt("return",o.getSubtleCrypto().importKey("raw",t,u(r),!0,s(r)));case 2:case"end":return e.stop()}}),e)}))),l.apply(this,arguments)}function f(e,t,r){return d.apply(this,arguments)}function d(){return(d=Object(i.a)(Object(n.a)().mark((function e(t,r,i){var u,s,l;return Object(n.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u=o.getSubtleCrypto(),e.next=3,c(r,a.a);case 3:return s=e.sent,e.next=6,u.encrypt({iv:t,name:a.a},s,i);case 6:return l=e.sent,e.abrupt("return",new Uint8Array(l));case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function h(e,t,r){return p.apply(this,arguments)}function p(){return(p=Object(i.a)(Object(n.a)().mark((function e(t,r,i){var u,s,l;return Object(n.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u=o.getSubtleCrypto(),e.next=3,c(r,a.a);case 3:return s=e.sent,e.next=6,u.decrypt({iv:t,name:a.a},s,i);case 6:return l=e.sent,e.abrupt("return",new Uint8Array(l));case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function g(e,t){return v.apply(this,arguments)}function v(){return(v=Object(i.a)(Object(n.a)().mark((function e(t,r){var i,u,s;return Object(n.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=o.getSubtleCrypto(),e.next=3,c(t,a.e);case 3:return u=e.sent,e.next=6,i.sign({length:a.g,name:a.e},u,r);case 6:return s=e.sent,e.abrupt("return",new Uint8Array(s));case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function y(e,t){return m.apply(this,arguments)}function m(){return(m=Object(i.a)(Object(n.a)().mark((function e(t,r){var i,u,s;return Object(n.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=o.getSubtleCrypto(),e.next=3,c(t,a.e);case 3:return u=e.sent,e.next=6,i.sign({length:a.h,name:a.e},u,r);case 6:return s=e.sent,e.abrupt("return",new Uint8Array(s));case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function b(e){return w.apply(this,arguments)}function w(){return(w=Object(i.a)(Object(n.a)().mark((function e(t){var r,i;return Object(n.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=o.getSubtleCrypto(),e.next=3,r.digest({name:a.i},t);case 3:return i=e.sent,e.abrupt("return",new Uint8Array(i));case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function M(e){return A.apply(this,arguments)}function A(){return(A=Object(i.a)(Object(n.a)().mark((function e(t){var r,i;return Object(n.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=o.getSubtleCrypto(),e.next=3,r.digest({name:a.j},t);case 3:return i=e.sent,e.abrupt("return",new Uint8Array(i));case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getMessageFromCode=t.serializeError=t.EthereumProviderError=t.EthereumRpcError=t.ethErrors=t.errorCodes=void 0;var n=r(183);Object.defineProperty(t,"EthereumRpcError",{enumerable:!0,get:function(){return n.EthereumRpcError}}),Object.defineProperty(t,"EthereumProviderError",{enumerable:!0,get:function(){return n.EthereumProviderError}});var i=r(326);Object.defineProperty(t,"serializeError",{enumerable:!0,get:function(){return i.serializeError}}),Object.defineProperty(t,"getMessageFromCode",{enumerable:!0,get:function(){return i.getMessageFromCode}});var o=r(773);Object.defineProperty(t,"ethErrors",{enumerable:!0,get:function(){return o.ethErrors}});var a=r(184);Object.defineProperty(t,"errorCodes",{enumerable:!0,get:function(){return a.errorCodes}})},function(e,t,r){"use strict";var n=r(14).default,i=r(13).default,o=r(17).default,a=r(18).default;Object.defineProperty(t,"__esModule",{value:!0});var u=r(380),s=r(78),c=function(){function e(t,r,n){o(this,e),this.name=t,this.prefix=r,this.baseEncode=n}return a(e,[{key:"encode",value:function(e){if(e instanceof Uint8Array)return"".concat(this.prefix).concat(this.baseEncode(e));throw Error("Unknown type, must be binary type")}}]),e}(),l=function(){function e(t,r,n){if(o(this,e),this.name=t,this.prefix=r,void 0===r.codePointAt(0))throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}return a(e,[{key:"decode",value:function(e){if("string"===typeof e){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error("Unable to decode multibase string ".concat(JSON.stringify(e),", ").concat(this.name," decoder only supports inputs prefixed with ").concat(this.prefix));return this.baseDecode(e.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}},{key:"or",value:function(e){return d(this,e)}}]),e}(),f=function(){function e(t){o(this,e),this.decoders=t}return a(e,[{key:"or",value:function(e){return d(this,e)}},{key:"decode",value:function(e){var t=e[0],r=this.decoders[t];if(r)return r.decode(e);throw RangeError("Unable to decode multibase string ".concat(JSON.stringify(e),", only inputs prefixed with ").concat(Object.keys(this.decoders)," are supported"))}}]),e}(),d=function(e,t){return new f(i(i({},e.decoders||n({},e.prefix,e)),t.decoders||n({},t.prefix,t)))},h=function(){function e(t,r,n,i){o(this,e),this.name=t,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new c(t,r,n),this.decoder=new l(t,r,i)}return a(e,[{key:"encode",value:function(e){return this.encoder.encode(e)}},{key:"decode",value:function(e){return this.decoder.decode(e)}}]),e}(),p=function(e){var t=e.name,r=e.prefix,n=e.encode,i=e.decode;return new h(t,r,n,i)};t.Codec=h,t.baseX=function(e){var t=e.prefix,r=e.name,n=e.alphabet,i=u(n,r),o=i.encode,a=i.decode;return p({prefix:t,name:r,encode:o,decode:function(e){return s.coerce(a(e))}})},t.from=p,t.or=d,t.rfc4648=function(e){var t=e.name,r=e.prefix,n=e.bitsPerChar,i=e.alphabet;return p({prefix:r,name:t,encode:function(e){return function(e,t,r){for(var n="="===t[t.length-1],i=(1<r;)o+=t[i&u>>(a-=r)];if(a&&(o+=t[i&u<=8&&(s-=8,u[l++]=255&c>>s)}if(s>=r||255&c<<8-s)throw new SyntaxError("Unexpected end of data");return u}(e,i,n,t)}})}},function(e,t,r){"use strict";var n=r(3).default,i=r(6).default,o=r(26).default;Object.defineProperty(t,"__esModule",{value:!0});var a=r(441),u=r(460);function s(){return s=i(n().mark((function e(t,r){var i,s,c,l,f,d,h,p,g,v,y,m,b,w,M,A,I,j,N,x,k,E,D=arguments;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=D.length>2&&void 0!==D[2]?D[2]:{},s=[],c=new FormData,l=0,f=0,d=!1,h=!1,e.prev=7,g=o(a.normaliseInput(t));case 9:return e.next=11,g.next();case 11:if(!(d=!(v=e.sent).done)){e.next=37;break}if(y=v.value,m=y.content,b=y.path,w=y.mode,M=y.mtime,A="",I=m?"file":"dir",l>0&&(A="-".concat(l)),j=I+A,N=[],null!==w&&void 0!==w&&N.push("mode=".concat(u.modeToString(w))),null!=M&&(x=M.secs,k=M.nsecs,N.push("mtime=".concat(x)),null!=k&&N.push("mtime-nsecs=".concat(k))),N.length&&(j="".concat(j,"?").concat(N.join("&"))),!m){e.next=28;break}c.set(j,m,null!=b?encodeURIComponent(b):void 0),E=f+m.size,s.push({name:b,start:f,end:E}),f=E,e.next=33;break;case 28:if(null==b){e.next=32;break}c.set(j,new File([""],encodeURIComponent(b),{type:"application/x-directory"})),e.next=33;break;case 32:throw new Error("path or content or both must be set");case 33:l++;case 34:d=!1,e.next=9;break;case 37:e.next=43;break;case 39:e.prev=39,e.t0=e.catch(7),h=!0,p=e.t0;case 43:if(e.prev=43,e.prev=44,!d||null==g.return){e.next=48;break}return e.next=48,g.return();case 48:if(e.prev=48,!h){e.next=51;break}throw p;case 51:return e.finish(48);case 52:return e.finish(43);case 53:return e.abrupt("return",{total:f,parts:s,headers:i,body:c});case 54:case"end":return e.stop()}}),e,null,[[7,39,43,53],[44,,48,52]])}))),s.apply(this,arguments)}t.multipartRequest=function(e,t){return s.apply(this,arguments)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(226);t.abortSignal=function(){for(var e=arguments.length,t=new Array(e),r=0;r=e.length)&&56320===(64512&e.charCodeAt(t+1)))}function a(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function u(e){return 1===e.length?"0"+e:e}function s(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}t.inherits=i,t.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"===typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!==0&&(e="0"+e),i=0;i>6|192,r[n++]=63&a|128):o(e,i)?(a=65536+((1023&a)<<10)+(1023&e.charCodeAt(++i)),r[n++]=a>>18|240,r[n++]=a>>12&63|128,r[n++]=a>>6&63|128,r[n++]=63&a|128):(r[n++]=a>>12|224,r[n++]=a>>6&63|128,r[n++]=63&a|128)}else for(i=0;i>>0}return a},t.split32=function(e,t){for(var r=new Array(4*e.length),n=0,i=0;n>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=255&o):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=255&o)}return r},t.rotr32=function(e,t){return e>>>t|e<<32-t},t.rotl32=function(e,t){return e<>>32-t},t.sum32=function(e,t){return e+t>>>0},t.sum32_3=function(e,t,r){return e+t+r>>>0},t.sum32_4=function(e,t,r,n){return e+t+r+n>>>0},t.sum32_5=function(e,t,r,n,i){return e+t+r+n+i>>>0},t.sum64=function(e,t,r,n){var i=e[t],o=n+e[t+1]>>>0,a=(o>>0,e[t+1]=o},t.sum64_hi=function(e,t,r,n){return(t+n>>>0>>0},t.sum64_lo=function(e,t,r,n){return t+n>>>0},t.sum64_4_hi=function(e,t,r,n,i,o,a,u){var s=0,c=t;return s+=(c=c+n>>>0)>>0)>>0)>>0},t.sum64_4_lo=function(e,t,r,n,i,o,a,u){return t+n+o+u>>>0},t.sum64_5_hi=function(e,t,r,n,i,o,a,u,s,c){var l=0,f=t;return l+=(f=f+n>>>0)>>0)>>0)>>0)>>0},t.sum64_5_lo=function(e,t,r,n,i,o,a,u,s,c){return t+n+o+u+c>>>0},t.rotr64_hi=function(e,t,r){return(t<<32-r|e>>>r)>>>0},t.rotr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0},t.shr64_hi=function(e,t,r){return e>>>r},t.shr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0}},function(e,t,r){"use strict";r.d(t,"a",(function(){return Y})),r.d(t,"b",(function(){return te})),r.d(t,"c",(function(){return se})),r.d(t,"d",(function(){return W})),r.d(t,"e",(function(){return q})),r.d(t,"f",(function(){return V})),r.d(t,"g",(function(){return ce}));var n=r(75),i=r.n(n),o=r(17),a=r.n(o),u=r(18),s=r.n(u),c=r(37),l=r.n(c),f=r(29),d=r.n(f),h=r(61),p=r.n(h),g=r(33),v=r.n(g),y=r(14),m=r.n(y),b=r(77),w=r(6),M=r.n(w),A=r(40),I=r.n(A),j=r(348),N=r(46),x=r(91),k=r.n(x),E=r(195),D=r.n(E),T=r(44),S=r.n(T),O=r(65),_=r(146),C=r.n(_),L=r(141),z=r.n(L),P=r(108),R=r.n(P);function B(e){var t=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=v()(e);if(t){var i=v()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return p()(this,r)}}function U(){}var Q="ACK",Y=function(e){d()(r,e);var t=B(r);function r(e){var n,i=e.name,o=e.target,u=e.targetWindow,s=void 0===u?window:u,c=e.targetOrigin,f=void 0===c?"*":c;if(a()(this,r),n=t.call(this,{objectMode:!0}),m()(l()(n),"_init",void 0),m()(l()(n),"_haveSyn",void 0),m()(l()(n),"_name",void 0),m()(l()(n),"_target",void 0),m()(l()(n),"_targetWindow",void 0),m()(l()(n),"_targetOrigin",void 0),m()(l()(n),"_onMessage",void 0),m()(l()(n),"_synIntervalId",void 0),!i||!o)throw new Error("Invalid input.");return n._init=!1,n._haveSyn=!1,n._name=i,n._target=o,n._targetWindow=s,n._targetOrigin=f,n._onMessage=n.onMessage.bind(l()(n)),n._synIntervalId=null,window.addEventListener("message",n._onMessage,!1),n._handShake(),n}return s()(r,[{key:"_break",value:function(){this.cork(),this._write("BRK",null,U),this._haveSyn=!1,this._init=!1}},{key:"_handShake",value:function(){this._write("SYN",null,U),this.cork()}},{key:"_onData",value:function(e){if(this._init)if("BRK"===e)this._break();else try{this.push(e)}catch(t){this.emit("error",t)}else"SYN"===e?(this._haveSyn=!0,this._write(Q,null,U)):e===Q&&(this._init=!0,this._haveSyn||this._write(Q,null,U),this.uncork())}},{key:"_postMessage",value:function(e){var t=this._targetOrigin;this._targetWindow.postMessage({target:this._target,data:e},t)}},{key:"onMessage",value:function(e){var t=e.data;"*"!==this._targetOrigin&&e.origin!==this._targetOrigin||e.source!==this._targetWindow||"object"!==i()(t)||t.target!==this._name||!t.data||this._onData(t.data)}},{key:"_read",value:function(){}},{key:"_write",value:function(e,t,r){this._postMessage(e),r()}},{key:"_destroy",value:function(){window.removeEventListener("message",this._onMessage,!1)}}]),r}(b.Duplex);function F(e){var t=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=v()(e);if(t){var i=v()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return p()(this,r)}}function G(e,t,r){try{Reflect.apply(e,t,r)}catch(n){setTimeout((function(){throw n}))}}var W=function(e){d()(r,e);var t=F(r);function r(){return a()(this,r),t.apply(this,arguments)}return s()(r,[{key:"emit",value:function(e){var t="error"===e,r=this._events;if(void 0!==r)t=t&&void 0===r.error;else if(!t)return!1;for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o0&&(a=i[0]),a instanceof Error)throw a;var u=new Error("Unhandled error.".concat(a?" (".concat(a.message,")"):""));throw u.context=a,u}var s=r[e];if(void 0===s)return!1;if("function"===typeof s)G(s,this,i);else for(var c=s.length,l=function(e){for(var t=e.length,r=new Array(t),n=0;n=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw o}}}}function J(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r0&&void 0!==arguments[0]?arguments[0]:{};return a()(this,r),e=t.call(this,oe(oe({},n),{},{objectMode:!0})),m()(l()(e),"_substreams",void 0),m()(l()(e),"getStream",void 0),e._substreams={},e}return s()(r,[{key:"createStream",value:function(e){if(!e)throw new Error("ObjectMultiplex - name must not be empty");if(this._substreams[e])throw new Error('ObjectMultiplex - Substream for name "'.concat(e,'" already exists'));var t=new ne({parent:this,name:e});return this._substreams[e]=t,function(e,t){var r=z()(t);C()(e,{readable:!1},r),C()(e,{writable:!1},r)}(this,(function(e){return t.destroy(e||void 0)})),t}},{key:"ignoreStream",value:function(e){if(!e)throw new Error("ObjectMultiplex - name must not be empty");if(this._substreams[e])throw new Error('ObjectMultiplex - Substream for name "'.concat(e,'" already exists'));this._substreams[e]=ue}},{key:"_read",value:function(){}},{key:"_write",value:function(e,t,r){var n=e.name,i=e.data;if(!n)return window.console.warn('ObjectMultiplex - malformed chunk without name "'.concat(e,'"')),r();var o=this._substreams[n];return o?(o!==ue&&o.push(i),r()):(window.console.warn('ObjectMultiplex - orphaned data for stream "'.concat(n,'"')),r())}}]),r}(b.Duplex);function ce(e){var t=new se;return t.getStream=function(e){return this._substreams[e]?this._substreams[e]:this.createStream(e)},R()(e,t,e,(function(e){e&&window.console.error(e)})),t}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(50),i=r(57),o=[24,256,65536,4294967296,BigInt("18446744073709551616")];function a(e,t,r){i.assertEnoughData(e,t,1);var n=e[t];if(!0===r.strict&&n>>8,255&u])}else if(r>>24&255,s>>>16&255,s>>>8&255,255&s])}else{var c=BigInt(r);if(!(c