/**
 * Skipped minification because the original files appears to be already minified.
 * Original file: /npm/@trustwallet/walletconnect@0.1.37/lib/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
!function(t,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define("WalletConnect",[],r):"object"==typeof exports?exports.WalletConnect=r():t.WalletConnect=r()}(this,function(){return function(t){var r={};function e(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,e),i.l=!0,i.exports}return e.m=t,e.c=r,e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:n})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,r){if(1&r&&(t=e(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(e.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var i in t)e.d(n,i,function(r){return t[r]}.bind(null,i));return n},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},e.p="",e(e.s=2)}([function(t,r,e){"use strict";e.r(r),e.d(r,"__extends",function(){return i}),e.d(r,"__assign",function(){return o}),e.d(r,"__rest",function(){return s}),e.d(r,"__decorate",function(){return u}),e.d(r,"__param",function(){return a}),e.d(r,"__metadata",function(){return f}),e.d(r,"__awaiter",function(){return h}),e.d(r,"__generator",function(){return l}),e.d(r,"__exportStar",function(){return c}),e.d(r,"__values",function(){return d}),e.d(r,"__read",function(){return p}),e.d(r,"__spread",function(){return m}),e.d(r,"__spreadArrays",function(){return g}),e.d(r,"__await",function(){return v}),e.d(r,"__asyncGenerator",function(){return y}),e.d(r,"__asyncDelegator",function(){return w}),e.d(r,"__asyncValues",function(){return b}),e.d(r,"__makeTemplateObject",function(){return _}),e.d(r,"__importStar",function(){return M}),e.d(r,"__importDefault",function(){return E});
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0

THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.

See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
var n=function(t,r){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var e in r)r.hasOwnProperty(e)&&(t[e]=r[e])})(t,r)};function i(t,r){function e(){this.constructor=t}n(t,r),t.prototype=null===r?Object.create(r):(e.prototype=r.prototype,new e)}var o=function(){return(o=Object.assign||function(t){for(var r,e=1,n=arguments.length;e<n;e++)for(var i in r=arguments[e])Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i]);return t}).apply(this,arguments)};function s(t,r){var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&r.indexOf(n)<0&&(e[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(t);i<n.length;i++)r.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(e[n[i]]=t[n[i]])}return e}function u(t,r,e,n){var i,o=arguments.length,s=o<3?r:null===n?n=Object.getOwnPropertyDescriptor(r,e):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,r,e,n);else for(var u=t.length-1;u>=0;u--)(i=t[u])&&(s=(o<3?i(s):o>3?i(r,e,s):i(r,e))||s);return o>3&&s&&Object.defineProperty(r,e,s),s}function a(t,r){return function(e,n){r(e,n,t)}}function f(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)}function h(t,r,e,n){return new(e||(e=Promise))(function(i,o){function s(t){try{a(n.next(t))}catch(t){o(t)}}function u(t){try{a(n.throw(t))}catch(t){o(t)}}function a(t){t.done?i(t.value):new e(function(r){r(t.value)}).then(s,u)}a((n=n.apply(t,r||[])).next())})}function l(t,r){var e,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(o){return function(u){return function(o){if(e)throw new TypeError("Generator is already executing.");for(;s;)try{if(e=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=r.call(t,s)}catch(t){o=[6,t],n=0}finally{e=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}}function c(t,r){for(var e in t)r.hasOwnProperty(e)||(r[e]=t[e])}function d(t){var r="function"==typeof Symbol&&t[Symbol.iterator],e=0;return r?r.call(t):{next:function(){return t&&e>=t.length&&(t=void 0),{value:t&&t[e++],done:!t}}}}function p(t,r){var e="function"==typeof Symbol&&t[Symbol.iterator];if(!e)return t;var n,i,o=e.call(t),s=[];try{for(;(void 0===r||r-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(e=o.return)&&e.call(o)}finally{if(i)throw i.error}}return s}function m(){for(var t=[],r=0;r<arguments.length;r++)t=t.concat(p(arguments[r]));return t}function g(){for(var t=0,r=0,e=arguments.length;r<e;r++)t+=arguments[r].length;var n=Array(t),i=0;for(r=0;r<e;r++)for(var o=arguments[r],s=0,u=o.length;s<u;s++,i++)n[i]=o[s];return n}function v(t){return this instanceof v?(this.v=t,this):new v(t)}function y(t,r,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,i=e.apply(t,r||[]),o=[];return n={},s("next"),s("throw"),s("return"),n[Symbol.asyncIterator]=function(){return this},n;function s(t){i[t]&&(n[t]=function(r){return new Promise(function(e,n){o.push([t,r,e,n])>1||u(t,r)})})}function u(t,r){try{(e=i[t](r)).value instanceof v?Promise.resolve(e.value.v).then(a,f):h(o[0][2],e)}catch(t){h(o[0][3],t)}var e}function a(t){u("next",t)}function f(t){u("throw",t)}function h(t,r){t(r),o.shift(),o.length&&u(o[0][0],o[0][1])}}function w(t){var r,e;return r={},n("next"),n("throw",function(t){throw t}),n("return"),r[Symbol.iterator]=function(){return this},r;function n(n,i){r[n]=t[n]?function(r){return(e=!e)?{value:v(t[n](r)),done:"return"===n}:i?i(r):r}:i}}function b(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,e=t[Symbol.asyncIterator];return e?e.call(t):(t=d(t),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(e){r[e]=t[e]&&function(r){return new Promise(function(n,i){(function(t,r,e,n){Promise.resolve(n).then(function(r){t({value:r,done:e})},r)})(n,i,(r=t[e](r)).done,r.value)})}}}function _(t,r){return Object.defineProperty?Object.defineProperty(t,"raw",{value:r}):t.raw=r,t}function M(t){if(t&&t.__esModule)return t;var r={};if(null!=t)for(var e in t)Object.hasOwnProperty.call(t,e)&&(r[e]=t[e]);return r.default=t,r}function E(t){return t&&t.__esModule?t:{default:t}}},function(t,r,e){t.exports=function(t){var r={};function e(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,e),i.l=!0,i.exports}return e.m=t,e.c=r,e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:n})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,r){if(1&r&&(t=e(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(e.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var i in t)e.d(n,i,function(r){return t[r]}.bind(null,i));return n},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},e.p="",e(e.s=7)}([function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e(1),i=e(15),o=new n.Logger(i.version);function s(t){return!!t.toHexString}function u(t){return t.slice?t:(t.slice=function(){var r=Array.prototype.slice.call(arguments);return u(new Uint8Array(Array.prototype.slice.apply(t,r)))},t)}function a(t){return c(t)&&!(t.length%2)||f(t)}function f(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(null==t.length)return!1;for(var r=0;r<t.length;r++){var e=t[r];if(e<0||e>=256||e%1)return!1}return!0}function h(t,r){if(r||(r={}),"number"==typeof t){o.checkSafeUint53(t,"invalid arrayify value");for(var e=[];t;)e.unshift(255&t),t/=256;return 0===e.length&&e.push(0),u(new Uint8Array(e))}if(r.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),s(t)&&(t=t.toHexString()),c(t)){var n=t.substring(2);!r.allowOddLength&&n.length%2&&o.throwArgumentError("hex data is odd-length","value",t),e=[];for(var i=0;i<n.length;i+=2)e.push(parseInt(n.substring(i,i+2),16));return u(new Uint8Array(e))}return f(t)?u(new Uint8Array(t)):o.throwArgumentError("invalid arrayify value","value",t)}function l(t){var r=t.map(function(t){return h(t)}),e=r.reduce(function(t,r){return t+r.length},0),n=new Uint8Array(e);return r.reduce(function(t,r){return n.set(r,t),t+r.length},0),u(n)}function c(t,r){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/)||r&&t.length!==2+2*r)}r.isBytesLike=a,r.isBytes=f,r.arrayify=h,r.concat=l,r.stripZeros=function(t){var r=h(t);if(0===r.length)return r;for(var e=0;e<r.length&&0===r[e];)e++;return e&&(r=r.slice(e)),r},r.zeroPad=function(t,r){(t=h(t)).length>r&&o.throwArgumentError("value out of range","value",arguments[0]);var e=new Uint8Array(r);return e.set(t,r-t.length),u(e)},r.isHexString=c;var d="0123456789abcdef";function p(t,r){if(r||(r={}),"number"==typeof t){o.checkSafeUint53(t,"invalid hexlify value");for(var e="";t;)e=d[15&t]+e,t=Math.floor(t/16);return e.length?(e.length%2&&(e="0"+e),"0x"+e):"0x00"}if(r.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),s(t))return t.toHexString();if(c(t))return!r.allowOddLength&&t.length%2&&o.throwArgumentError("hex data is odd-length","value",t),t.toLowerCase();if(f(t)){for(var n="0x",i=0;i<t.length;i++){var u=t[i];n+=d[(240&u)>>4]+d[15&u]}return n}return o.throwArgumentError("invalid hexlify value","value",t)}function m(t){"string"!=typeof t&&(t=p(t)),c(t)||o.throwArgumentError("invalid hex string","value",t),t=t.substring(2);for(var r=0;r<t.length&&"0"===t[r];)r++;return"0x"+t.substring(r)}function g(t,r){for("string"!=typeof t?t=p(t):c(t)||o.throwArgumentError("invalid hex string","value",t),t.length>2*r+2&&o.throwArgumentError("value out of range","value",arguments[1]);t.length<2*r+2;)t="0x0"+t.substring(2);return t}function v(t){var r={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0};if(a(t)){var e=h(t);65!==e.length&&o.throwArgumentError("invalid signature string; must be 65 bytes","signature",t),r.r=p(e.slice(0,32)),r.s=p(e.slice(32,64)),r.v=e[64],27!==r.v&&28!==r.v&&(r.v=27+r.v%2),r.recoveryParam=r.v-27,r.recoveryParam&&(e[32]|=128),r._vs=p(e.slice(32,64))}else{if(r.r=t.r,r.s=t.s,r.v=t.v,r.recoveryParam=t.recoveryParam,r._vs=t._vs,null!=r.v&&27!=r.v&&28!=r.v&&(r.v=27+r.v%2),null==r.recoveryParam&&null!=r.v?r.recoveryParam=1-r.v%2:null!=r.recoveryParam&&null==r.v?r.v=27+r.recoveryParam:null!=r.recoveryParam&&null!=r.v&&r.v!==27+r.recoveryParam&&o.throwArgumentError("signature v mismatch recoveryParam","signature",t),null!=r.r&&(r.r=g(r.r,32)),null!=r.s&&(r.s=g(r.s,32)),null!=r._vs){r._vs=g(r._vs,32),r._vs.length>66&&o.throwArgumentError("signature _vs overflow","signature",t);var n=(u=h(r._vs))[0]>=128?1:0,i=27+r.recoveryParam;u[0]&=127;var s=p(u);null==r.s?r.s=s:r.s!==s&&o.throwArgumentError("signature v mismatch _vs","signature",t),null==r.v?r.v=i:r.v!==i&&o.throwArgumentError("signature v mismatch _vs","signature",t),null==n?r.recoveryParam=n:r.recoveryParam!==n&&o.throwArgumentError("signature recoveryParam mismatch _vs","signature",t)}var u;null==r.v&&null==r.recoveryParam&&o.throwArgumentError("signature requires at least one of recoveryParam, v or _vs","signature",t),27!==r.v&&28!==r.v&&o.throwArgumentError("signature v not canonical","signature",t),(r.r.length>66||r.s.length>66)&&o.throwArgumentError("signature overflow r or s","signature",t),null==r._vs&&((u=h(r.s))[0]>=128&&o.throwArgumentError("signature s out of range","signature",t),r.recoveryParam&&(u[0]|=128),r._vs=p(u))}return r}r.hexlify=p,r.hexDataLength=function(t){if("string"!=typeof t)t=p(t);else if(!c(t)||t.length%2)return null;return(t.length-2)/2},r.hexDataSlice=function(t,r,e){return"string"!=typeof t?t=p(t):(!c(t)||t.length%2)&&o.throwArgumentError("invalid hexData","value",t),r=2+2*r,null!=e?"0x"+t.substring(r,2+2*e):"0x"+t.substring(r)},r.hexConcat=function(t){var r="0x";return t.forEach(function(t){r+=p(t).substring(2)}),r},r.hexValue=function(t){var r=m(p(t,{allowOddLength:!0}));return"0x"===r?"0x0":r},r.hexStripZeros=m,r.hexZeroPad=g,r.splitSignature=v,r.joinSignature=function(t){return p(l([(t=v(t)).r,t.s,t.recoveryParam?"0x1c":"0x1b"]))}},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=!1,i=!1,o={debug:1,default:2,info:2,warn:3,error:4,off:5},s=o.default,u=e(14),a=null,f=function(){try{var t=[];if(["NFD","NFC","NFKD","NFKC"].forEach(function(r){try{if("test"!=="test".normalize(r))throw new Error("bad normalize")}catch(e){t.push(r)}}),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}(),h=function(){function t(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}return t.prototype.setLogLevel=function(t){var r=o[t];null!=r?s=r:this.warn("invliad log level - "+t)},t.prototype._log=function(t,r){s>o[t]||console.log.apply(console,r)},t.prototype.debug=function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];this._log(t.levels.DEBUG,r)},t.prototype.info=function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];this._log(t.levels.INFO,r)},t.prototype.warn=function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];this._log(t.levels.WARNING,r)},t.prototype.makeError=function(r,e,n){if(i)return new Error("unknown error");e||(e=t.errors.UNKNOWN_ERROR),n||(n={});var o=[];Object.keys(n).forEach(function(t){try{o.push(t+"="+JSON.stringify(n[t]))}catch(r){o.push(t+"="+JSON.stringify(n[t].toString()))}}),o.push("version="+this.version);var s=r;o.length&&(r+=" ("+o.join(", ")+")");var u=new Error(r);return u.reason=s,u.code=e,Object.keys(n).forEach(function(t){u[t]=n[t]}),u},t.prototype.throwError=function(t,r,e){throw this.makeError(t,r,e)},t.prototype.throwArgumentError=function(r,e,n){return this.throwError(r,t.errors.INVALID_ARGUMENT,{argument:e,value:n})},t.prototype.checkNormalize=function(r){null==r&&(r="platform missing String.prototype.normalize"),f&&this.throwError("platform missing String.prototype.normalize",t.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:f})},t.prototype.checkSafeUint53=function(r,e){"number"==typeof r&&(null==e&&(e="value not safe"),(r<0||r>=9007199254740991)&&this.throwError(e,t.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:r}),r%1&&this.throwError(e,t.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:r}))},t.prototype.checkArgumentCount=function(r,e,n){n=n?": "+n:"",r<e&&this.throwError("missing argument"+n,t.errors.MISSING_ARGUMENT,{count:r,expectedCount:e}),r>e&&this.throwError("too many arguments"+n,t.errors.UNEXPECTED_ARGUMENT,{count:r,expectedCount:e})},t.prototype.checkNew=function(r,e){r!==Object&&null!=r||this.throwError("missing new",t.errors.MISSING_NEW,{name:e.name})},t.prototype.checkAbstract=function(r,e){r===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",t.errors.UNSUPPORTED_OPERATION,{name:r.name,operation:"new"}):r!==Object&&null!=r||this.throwError("missing new",t.errors.MISSING_NEW,{name:e.name})},t.globalLogger=function(){return a||(a=new t(u.version)),a},t.setCensorship=function(r,e){if(n){if(!r)return;this.globalLogger().throwError("error censorship permanent",t.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}i=!!r,n=!!e},t.errors={UNKNOWN_ERROR:"UNKNOWN_ERROR",NOT_IMPLEMENTED:"NOT_IMPLEMENTED",UNSUPPORTED_OPERATION:"UNSUPPORTED_OPERATION",NETWORK_ERROR:"NETWORK_ERROR",SERVER_ERROR:"SERVER_ERROR",TIMEOUT:"TIMEOUT",BUFFER_OVERRUN:"BUFFER_OVERRUN",NUMERIC_FAULT:"NUMERIC_FAULT",MISSING_NEW:"MISSING_NEW",INVALID_ARGUMENT:"INVALID_ARGUMENT",MISSING_ARGUMENT:"MISSING_ARGUMENT",UNEXPECTED_ARGUMENT:"UNEXPECTED_ARGUMENT",CALL_EXCEPTION:"CALL_EXCEPTION",INSUFFICIENT_FUNDS:"INSUFFICIENT_FUNDS",NONCE_EXPIRED:"NONCE_EXPIRED",REPLACEMENT_UNDERPRICED:"REPLACEMENT_UNDERPRICED",UNPREDICTABLE_GAS_LIMIT:"UNPREDICTABLE_GAS_LIMIT"},t.levels={DEBUG:"DEBUG",INFO:"INFO",WARNING:"WARNING",ERROR:"ERROR",OFF:"OFF"},t}();r.Logger=h},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n,i=e(0),o=e(1),s=e(29),u=new o.Logger(s.version);function a(t,r){t=i.arrayify(t);for(var e=[],n=0;n<t.length;){var o=t[n++];if(o>>7!=0){var s=null,u=null;if(192==(224&o))s=1,u=127;else if(224==(240&o))s=2,u=2047;else{if(240!=(248&o)){if(!r){if(128==(192&o))throw new Error("invalid utf8 byte sequence; unexpected continuation byte");throw new Error("invalid utf8 byte sequence; invalid prefix")}continue}s=3,u=65535}if(n+s>t.length){if(!r)throw new Error("invalid utf8 byte sequence; too short");for(;n<t.length&&t[n]>>6==2;n++);}else{for(var a=o&(1<<8-s-1)-1,f=0;f<s;f++){var h=t[n];if(128!=(192&h)){a=null;break}a=a<<6|63&h,n++}if(null!==a)if(a<=u){if(!r)throw new Error("invalid utf8 byte sequence; overlong")}else if(a>1114111){if(!r)throw new Error("invalid utf8 byte sequence; out-of-range")}else if(a>=55296&&a<=57343){if(!r)throw new Error("invalid utf8 byte sequence; utf-16 surrogate")}else e.push(a);else if(!r)throw new Error("invalid utf8 byte sequence; invalid continuation byte")}}else e.push(o)}return e}function f(t,r){void 0===r&&(r=n.current),r!=n.current&&(u.checkNormalize(),t=t.normalize(r));for(var e=[],o=0;o<t.length;o++){var s=t.charCodeAt(o);if(s<128)e.push(s);else if(s<2048)e.push(s>>6|192),e.push(63&s|128);else if(55296==(64512&s)){o++;var a=t.charCodeAt(o);if(o>=t.length||56320!=(64512&a))throw new Error("invalid utf-8 string");s=65536+((1023&s)<<10)+(1023&a),e.push(s>>18|240),e.push(s>>12&63|128),e.push(s>>6&63|128),e.push(63&s|128)}else e.push(s>>12|224),e.push(s>>6&63|128),e.push(63&s|128)}return i.arrayify(e)}function h(t){var r="0000"+t.toString(16);return"\\u"+r.substring(r.length-4)}function l(t){return t.map(function(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10&1023),56320+(1023&t)))}).join("")}!function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"}(n=r.UnicodeNormalizationForm||(r.UnicodeNormalizationForm={})),r.toUtf8Bytes=f,r._toEscapedUtf8String=function(t,r){return'"'+a(t,r).map(function(t){if(t<256){switch(t){case 8:return"\\b";case 9:return"\\t";case 10:return"\\n";case 13:return"\\r";case 34:return'\\"';case 92:return"\\\\"}if(t>=32&&t<127)return String.fromCharCode(t)}return t<=65535?h(t):h(55296+((t-=65536)>>10&1023))+h(56320+(1023&t))}).join("")+'"'},r._toUtf8String=l,r.toUtf8String=function(t,r){return l(a(t,r))},r.toUtf8CodePoints=function(t,r){return void 0===r&&(r=n.current),a(f(t,r))}},function(t,r){var e;e=function(){return this}();try{e=e||new Function("return this")()}catch(t){"object"==typeof window&&(e=window)}t.exports=e},function(t,r,e){(function(t){!function(t,r){"use strict";function n(t,r){if(!t)throw new Error(r||"Assertion failed")}function i(t,r){t.super_=r;var e=function(){};e.prototype=r.prototype,t.prototype=new e,t.prototype.constructor=t}function o(t,r,e){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==r&&"be"!==r||(e=r,r=10),this._init(t||0,r||10,e||"be"))}var s;"object"==typeof t?t.exports=o:r.BN=o,o.BN=o,o.wordSize=26;try{s=e(18).Buffer}catch(t){}function u(t,r,e){for(var n=0,i=Math.min(t.length,e),o=r;o<i;o++){var s=t.charCodeAt(o)-48;n<<=4,n|=s>=49&&s<=54?s-49+10:s>=17&&s<=22?s-17+10:15&s}return n}function a(t,r,e,n){for(var i=0,o=Math.min(t.length,e),s=r;s<o;s++){var u=t.charCodeAt(s)-48;i*=n,i+=u>=49?u-49+10:u>=17?u-17+10:u}return i}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,r){return t.cmp(r)>0?t:r},o.min=function(t,r){return t.cmp(r)<0?t:r},o.prototype._init=function(t,r,e){if("number"==typeof t)return this._initNumber(t,r,e);if("object"==typeof t)return this._initArray(t,r,e);"hex"===r&&(r=16),n(r===(0|r)&&r>=2&&r<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&i++,16===r?this._parseHex(t,i):this._parseBase(t,r,i),"-"===t[0]&&(this.negative=1),this.strip(),"le"===e&&this._initArray(this.toArray(),r,e)},o.prototype._initNumber=function(t,r,e){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===e&&this._initArray(this.toArray(),r,e)},o.prototype._initArray=function(t,r,e){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,s,u=0;if("be"===e)for(i=t.length-1,o=0;i>=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<<u&67108863,this.words[o+1]=s>>>26-u&67108863,(u+=24)>=26&&(u-=26,o++);else if("le"===e)for(i=0,o=0;i<t.length;i+=3)s=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=s<<u&67108863,this.words[o+1]=s>>>26-u&67108863,(u+=24)>=26&&(u-=26,o++);return this.strip()},o.prototype._parseHex=function(t,r){this.length=Math.ceil((t.length-r)/6),this.words=new Array(this.length);for(var e=0;e<this.length;e++)this.words[e]=0;var n,i,o=0;for(e=t.length-6,n=0;e>=r;e-=6)i=u(t,e,e+6),this.words[n]|=i<<o&67108863,this.words[n+1]|=i>>>26-o&4194303,(o+=24)>=26&&(o-=26,n++);e+6!==r&&(i=u(t,r,e+6),this.words[n]|=i<<o&67108863,this.words[n+1]|=i>>>26-o&4194303),this.strip()},o.prototype._parseBase=function(t,r,e){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=r)n++;n--,i=i/r|0;for(var o=t.length-e,s=o%n,u=Math.min(o,o-s)+e,f=0,h=e;h<u;h+=n)f=a(t,h,h+n,r),this.imuln(i),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f);if(0!==s){var l=1;for(f=a(t,h,t.length,r),h=0;h<s;h++)l*=r;this.imuln(l),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f)}},o.prototype.copy=function(t){t.words=new Array(this.length);for(var r=0;r<this.length;r++)t.words[r]=this.words[r];t.length=this.length,t.negative=this.negative,t.red=this.red},o.prototype.clone=function(){var t=new o(null);return this.copy(t),t},o.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var f=["","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"],h=[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],l=[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 c(t,r,e){e.negative=r.negative^t.negative;var n=t.length+r.length|0;e.length=n,n=n-1|0;var i=0|t.words[0],o=0|r.words[0],s=i*o,u=67108863&s,a=s/67108864|0;e.words[0]=u;for(var f=1;f<n;f++){for(var h=a>>>26,l=67108863&a,c=Math.min(f,r.length-1),d=Math.max(0,f-t.length+1);d<=c;d++){var p=f-d|0;h+=(s=(i=0|t.words[p])*(o=0|r.words[d])+l)/67108864|0,l=67108863&s}e.words[f]=0|l,a=0|h}return 0!==a?e.words[f]=0|a:e.length--,e.strip()}o.prototype.toString=function(t,r){var e;if(r=0|r||1,16===(t=t||10)||"hex"===t){e="";for(var i=0,o=0,s=0;s<this.length;s++){var u=this.words[s],a=(16777215&(u<<i|o)).toString(16);e=0!=(o=u>>>24-i&16777215)||s!==this.length-1?f[6-a.length]+a+e:a+e,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(e=o.toString(16)+e);e.length%r!=0;)e="0"+e;return 0!==this.negative&&(e="-"+e),e}if(t===(0|t)&&t>=2&&t<=36){var c=h[t],d=l[t];e="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);e=(p=p.idivn(d)).isZero()?m+e:f[c-m.length]+m+e}for(this.isZero()&&(e="0"+e);e.length%r!=0;)e="0"+e;return 0!==this.negative&&(e="-"+e),e}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,r){return n(void 0!==s),this.toArrayLike(s,t,r)},o.prototype.toArray=function(t,r){return this.toArrayLike(Array,t,r)},o.prototype.toArrayLike=function(t,r,e){var i=this.byteLength(),o=e||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0"),this.strip();var s,u,a="le"===r,f=new t(o),h=this.clone();if(a){for(u=0;!h.isZero();u++)s=h.andln(255),h.iushrn(8),f[u]=s;for(;u<o;u++)f[u]=0}else{for(u=0;u<o-i;u++)f[u]=0;for(u=0;!h.isZero();u++)s=h.andln(255),h.iushrn(8),f[o-u-1]=s}return f},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var r=t,e=0;return r>=4096&&(e+=13,r>>>=13),r>=64&&(e+=7,r>>>=7),r>=8&&(e+=4,r>>>=4),r>=2&&(e+=2,r>>>=2),e+r},o.prototype._zeroBits=function(t){if(0===t)return 26;var r=t,e=0;return 0==(8191&r)&&(e+=13,r>>>=13),0==(127&r)&&(e+=7,r>>>=7),0==(15&r)&&(e+=4,r>>>=4),0==(3&r)&&(e+=2,r>>>=2),0==(1&r)&&e++,e},o.prototype.bitLength=function(){var t=this.words[this.length-1],r=this._countBits(t);return 26*(this.length-1)+r},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,r=0;r<this.length;r++){var e=this._zeroBits(this.words[r]);if(t+=e,26!==e)break}return t},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},o.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var r=0;r<t.length;r++)this.words[r]=this.words[r]|t.words[r];return this.strip()},o.prototype.ior=function(t){return n(0==(this.negative|t.negative)),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var r;r=this.length>t.length?t:this;for(var e=0;e<r.length;e++)this.words[e]=this.words[e]&t.words[e];return this.length=r.length,this.strip()},o.prototype.iand=function(t){return n(0==(this.negative|t.negative)),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var r,e;this.length>t.length?(r=this,e=t):(r=t,e=this);for(var n=0;n<e.length;n++)this.words[n]=r.words[n]^e.words[n];if(this!==r)for(;n<r.length;n++)this.words[n]=r.words[n];return this.length=r.length,this.strip()},o.prototype.ixor=function(t){return n(0==(this.negative|t.negative)),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var r=0|Math.ceil(t/26),e=t%26;this._expand(r),e>0&&r--;for(var i=0;i<r;i++)this.words[i]=67108863&~this.words[i];return e>0&&(this.words[i]=~this.words[i]&67108863>>26-e),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,r){n("number"==typeof t&&t>=0);var e=t/26|0,i=t%26;return this._expand(e+1),this.words[e]=r?this.words[e]|1<<i:this.words[e]&~(1<<i),this.strip()},o.prototype.iadd=function(t){var r,e,n;if(0!==this.negative&&0===t.negative)return this.negative=0,r=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,r=this.isub(t),t.negative=1,r._normSign();this.length>t.length?(e=this,n=t):(e=t,n=this);for(var i=0,o=0;o<n.length;o++)r=(0|e.words[o])+(0|n.words[o])+i,this.words[o]=67108863&r,i=r>>>26;for(;0!==i&&o<e.length;o++)r=(0|e.words[o])+i,this.words[o]=67108863&r,i=r>>>26;if(this.length=e.length,0!==i)this.words[this.length]=i,this.length++;else if(e!==this)for(;o<e.length;o++)this.words[o]=e.words[o];return this},o.prototype.add=function(t){var r;return 0!==t.negative&&0===this.negative?(t.negative=0,r=this.sub(t),t.negative^=1,r):0===t.negative&&0!==this.negative?(this.negative=0,r=t.sub(this),this.negative=1,r):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var r=this.iadd(t);return t.negative=1,r._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var e,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(e=this,n=t):(e=t,n=this);for(var o=0,s=0;s<n.length;s++)o=(r=(0|e.words[s])-(0|n.words[s])+o)>>26,this.words[s]=67108863&r;for(;0!==o&&s<e.length;s++)o=(r=(0|e.words[s])+o)>>26,this.words[s]=67108863&r;if(0===o&&s<e.length&&e!==this)for(;s<e.length;s++)this.words[s]=e.words[s];return this.length=Math.max(this.length,s),e!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(t){return this.clone().isub(t)};var d=function(t,r,e){var n,i,o,s=t.words,u=r.words,a=e.words,f=0,h=0|s[0],l=8191&h,c=h>>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],v=8191&g,y=g>>>13,w=0|s[3],b=8191&w,_=w>>>13,M=0|s[4],E=8191&M,S=M>>>13,A=0|s[5],R=8191&A,O=A>>>13,N=0|s[6],B=8191&N,x=N>>>13,I=0|s[7],P=8191&I,T=I>>>13,U=0|s[8],C=8191&U,k=U>>>13,D=0|s[9],F=8191&D,j=D>>>13,L=0|u[0],q=8191&L,H=L>>>13,G=0|u[1],z=8191&G,Y=G>>>13,Z=0|u[2],V=8191&Z,J=Z>>>13,W=0|u[3],K=8191&W,$=W>>>13,X=0|u[4],Q=8191&X,tt=X>>>13,rt=0|u[5],et=8191&rt,nt=rt>>>13,it=0|u[6],ot=8191&it,st=it>>>13,ut=0|u[7],at=8191&ut,ft=ut>>>13,ht=0|u[8],lt=8191&ht,ct=ht>>>13,dt=0|u[9],pt=8191&dt,mt=dt>>>13;e.negative=t.negative^r.negative,e.length=19;var gt=(f+(n=Math.imul(l,q))|0)+((8191&(i=(i=Math.imul(l,H))+Math.imul(c,q)|0))<<13)|0;f=((o=Math.imul(c,H))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(p,q),i=(i=Math.imul(p,H))+Math.imul(m,q)|0,o=Math.imul(m,H);var vt=(f+(n=n+Math.imul(l,z)|0)|0)+((8191&(i=(i=i+Math.imul(l,Y)|0)+Math.imul(c,z)|0))<<13)|0;f=((o=o+Math.imul(c,Y)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(v,q),i=(i=Math.imul(v,H))+Math.imul(y,q)|0,o=Math.imul(y,H),n=n+Math.imul(p,z)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(m,z)|0,o=o+Math.imul(m,Y)|0;var yt=(f+(n=n+Math.imul(l,V)|0)|0)+((8191&(i=(i=i+Math.imul(l,J)|0)+Math.imul(c,V)|0))<<13)|0;f=((o=o+Math.imul(c,J)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(b,q),i=(i=Math.imul(b,H))+Math.imul(_,q)|0,o=Math.imul(_,H),n=n+Math.imul(v,z)|0,i=(i=i+Math.imul(v,Y)|0)+Math.imul(y,z)|0,o=o+Math.imul(y,Y)|0,n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,J)|0)+Math.imul(m,V)|0,o=o+Math.imul(m,J)|0;var wt=(f+(n=n+Math.imul(l,K)|0)|0)+((8191&(i=(i=i+Math.imul(l,$)|0)+Math.imul(c,K)|0))<<13)|0;f=((o=o+Math.imul(c,$)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(E,q),i=(i=Math.imul(E,H))+Math.imul(S,q)|0,o=Math.imul(S,H),n=n+Math.imul(b,z)|0,i=(i=i+Math.imul(b,Y)|0)+Math.imul(_,z)|0,o=o+Math.imul(_,Y)|0,n=n+Math.imul(v,V)|0,i=(i=i+Math.imul(v,J)|0)+Math.imul(y,V)|0,o=o+Math.imul(y,J)|0,n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,$)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,$)|0;var bt=(f+(n=n+Math.imul(l,Q)|0)|0)+((8191&(i=(i=i+Math.imul(l,tt)|0)+Math.imul(c,Q)|0))<<13)|0;f=((o=o+Math.imul(c,tt)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(R,q),i=(i=Math.imul(R,H))+Math.imul(O,q)|0,o=Math.imul(O,H),n=n+Math.imul(E,z)|0,i=(i=i+Math.imul(E,Y)|0)+Math.imul(S,z)|0,o=o+Math.imul(S,Y)|0,n=n+Math.imul(b,V)|0,i=(i=i+Math.imul(b,J)|0)+Math.imul(_,V)|0,o=o+Math.imul(_,J)|0,n=n+Math.imul(v,K)|0,i=(i=i+Math.imul(v,$)|0)+Math.imul(y,K)|0,o=o+Math.imul(y,$)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var _t=(f+(n=n+Math.imul(l,et)|0)|0)+((8191&(i=(i=i+Math.imul(l,nt)|0)+Math.imul(c,et)|0))<<13)|0;f=((o=o+Math.imul(c,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(B,q),i=(i=Math.imul(B,H))+Math.imul(x,q)|0,o=Math.imul(x,H),n=n+Math.imul(R,z)|0,i=(i=i+Math.imul(R,Y)|0)+Math.imul(O,z)|0,o=o+Math.imul(O,Y)|0,n=n+Math.imul(E,V)|0,i=(i=i+Math.imul(E,J)|0)+Math.imul(S,V)|0,o=o+Math.imul(S,J)|0,n=n+Math.imul(b,K)|0,i=(i=i+Math.imul(b,$)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,$)|0,n=n+Math.imul(v,Q)|0,i=(i=i+Math.imul(v,tt)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,tt)|0,n=n+Math.imul(p,et)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(m,et)|0,o=o+Math.imul(m,nt)|0;var Mt=(f+(n=n+Math.imul(l,ot)|0)|0)+((8191&(i=(i=i+Math.imul(l,st)|0)+Math.imul(c,ot)|0))<<13)|0;f=((o=o+Math.imul(c,st)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(P,q),i=(i=Math.imul(P,H))+Math.imul(T,q)|0,o=Math.imul(T,H),n=n+Math.imul(B,z)|0,i=(i=i+Math.imul(B,Y)|0)+Math.imul(x,z)|0,o=o+Math.imul(x,Y)|0,n=n+Math.imul(R,V)|0,i=(i=i+Math.imul(R,J)|0)+Math.imul(O,V)|0,o=o+Math.imul(O,J)|0,n=n+Math.imul(E,K)|0,i=(i=i+Math.imul(E,$)|0)+Math.imul(S,K)|0,o=o+Math.imul(S,$)|0,n=n+Math.imul(b,Q)|0,i=(i=i+Math.imul(b,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(v,et)|0,i=(i=i+Math.imul(v,nt)|0)+Math.imul(y,et)|0,o=o+Math.imul(y,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var Et=(f+(n=n+Math.imul(l,at)|0)|0)+((8191&(i=(i=i+Math.imul(l,ft)|0)+Math.imul(c,at)|0))<<13)|0;f=((o=o+Math.imul(c,ft)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(C,q),i=(i=Math.imul(C,H))+Math.imul(k,q)|0,o=Math.imul(k,H),n=n+Math.imul(P,z)|0,i=(i=i+Math.imul(P,Y)|0)+Math.imul(T,z)|0,o=o+Math.imul(T,Y)|0,n=n+Math.imul(B,V)|0,i=(i=i+Math.imul(B,J)|0)+Math.imul(x,V)|0,o=o+Math.imul(x,J)|0,n=n+Math.imul(R,K)|0,i=(i=i+Math.imul(R,$)|0)+Math.imul(O,K)|0,o=o+Math.imul(O,$)|0,n=n+Math.imul(E,Q)|0,i=(i=i+Math.imul(E,tt)|0)+Math.imul(S,Q)|0,o=o+Math.imul(S,tt)|0,n=n+Math.imul(b,et)|0,i=(i=i+Math.imul(b,nt)|0)+Math.imul(_,et)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(v,ot)|0,i=(i=i+Math.imul(v,st)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,st)|0,n=n+Math.imul(p,at)|0,i=(i=i+Math.imul(p,ft)|0)+Math.imul(m,at)|0,o=o+Math.imul(m,ft)|0;var St=(f+(n=n+Math.imul(l,lt)|0)|0)+((8191&(i=(i=i+Math.imul(l,ct)|0)+Math.imul(c,lt)|0))<<13)|0;f=((o=o+Math.imul(c,ct)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(F,q),i=(i=Math.imul(F,H))+Math.imul(j,q)|0,o=Math.imul(j,H),n=n+Math.imul(C,z)|0,i=(i=i+Math.imul(C,Y)|0)+Math.imul(k,z)|0,o=o+Math.imul(k,Y)|0,n=n+Math.imul(P,V)|0,i=(i=i+Math.imul(P,J)|0)+Math.imul(T,V)|0,o=o+Math.imul(T,J)|0,n=n+Math.imul(B,K)|0,i=(i=i+Math.imul(B,$)|0)+Math.imul(x,K)|0,o=o+Math.imul(x,$)|0,n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,tt)|0)+Math.imul(O,Q)|0,o=o+Math.imul(O,tt)|0,n=n+Math.imul(E,et)|0,i=(i=i+Math.imul(E,nt)|0)+Math.imul(S,et)|0,o=o+Math.imul(S,nt)|0,n=n+Math.imul(b,ot)|0,i=(i=i+Math.imul(b,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,n=n+Math.imul(v,at)|0,i=(i=i+Math.imul(v,ft)|0)+Math.imul(y,at)|0,o=o+Math.imul(y,ft)|0,n=n+Math.imul(p,lt)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(m,lt)|0,o=o+Math.imul(m,ct)|0;var At=(f+(n=n+Math.imul(l,pt)|0)|0)+((8191&(i=(i=i+Math.imul(l,mt)|0)+Math.imul(c,pt)|0))<<13)|0;f=((o=o+Math.imul(c,mt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(F,z),i=(i=Math.imul(F,Y))+Math.imul(j,z)|0,o=Math.imul(j,Y),n=n+Math.imul(C,V)|0,i=(i=i+Math.imul(C,J)|0)+Math.imul(k,V)|0,o=o+Math.imul(k,J)|0,n=n+Math.imul(P,K)|0,i=(i=i+Math.imul(P,$)|0)+Math.imul(T,K)|0,o=o+Math.imul(T,$)|0,n=n+Math.imul(B,Q)|0,i=(i=i+Math.imul(B,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,n=n+Math.imul(R,et)|0,i=(i=i+Math.imul(R,nt)|0)+Math.imul(O,et)|0,o=o+Math.imul(O,nt)|0,n=n+Math.imul(E,ot)|0,i=(i=i+Math.imul(E,st)|0)+Math.imul(S,ot)|0,o=o+Math.imul(S,st)|0,n=n+Math.imul(b,at)|0,i=(i=i+Math.imul(b,ft)|0)+Math.imul(_,at)|0,o=o+Math.imul(_,ft)|0,n=n+Math.imul(v,lt)|0,i=(i=i+Math.imul(v,ct)|0)+Math.imul(y,lt)|0,o=o+Math.imul(y,ct)|0;var Rt=(f+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;f=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(F,V),i=(i=Math.imul(F,J))+Math.imul(j,V)|0,o=Math.imul(j,J),n=n+Math.imul(C,K)|0,i=(i=i+Math.imul(C,$)|0)+Math.imul(k,K)|0,o=o+Math.imul(k,$)|0,n=n+Math.imul(P,Q)|0,i=(i=i+Math.imul(P,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,n=n+Math.imul(B,et)|0,i=(i=i+Math.imul(B,nt)|0)+Math.imul(x,et)|0,o=o+Math.imul(x,nt)|0,n=n+Math.imul(R,ot)|0,i=(i=i+Math.imul(R,st)|0)+Math.imul(O,ot)|0,o=o+Math.imul(O,st)|0,n=n+Math.imul(E,at)|0,i=(i=i+Math.imul(E,ft)|0)+Math.imul(S,at)|0,o=o+Math.imul(S,ft)|0,n=n+Math.imul(b,lt)|0,i=(i=i+Math.imul(b,ct)|0)+Math.imul(_,lt)|0,o=o+Math.imul(_,ct)|0;var Ot=(f+(n=n+Math.imul(v,pt)|0)|0)+((8191&(i=(i=i+Math.imul(v,mt)|0)+Math.imul(y,pt)|0))<<13)|0;f=((o=o+Math.imul(y,mt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(F,K),i=(i=Math.imul(F,$))+Math.imul(j,K)|0,o=Math.imul(j,$),n=n+Math.imul(C,Q)|0,i=(i=i+Math.imul(C,tt)|0)+Math.imul(k,Q)|0,o=o+Math.imul(k,tt)|0,n=n+Math.imul(P,et)|0,i=(i=i+Math.imul(P,nt)|0)+Math.imul(T,et)|0,o=o+Math.imul(T,nt)|0,n=n+Math.imul(B,ot)|0,i=(i=i+Math.imul(B,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,n=n+Math.imul(R,at)|0,i=(i=i+Math.imul(R,ft)|0)+Math.imul(O,at)|0,o=o+Math.imul(O,ft)|0,n=n+Math.imul(E,lt)|0,i=(i=i+Math.imul(E,ct)|0)+Math.imul(S,lt)|0,o=o+Math.imul(S,ct)|0;var Nt=(f+(n=n+Math.imul(b,pt)|0)|0)+((8191&(i=(i=i+Math.imul(b,mt)|0)+Math.imul(_,pt)|0))<<13)|0;f=((o=o+Math.imul(_,mt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(F,Q),i=(i=Math.imul(F,tt))+Math.imul(j,Q)|0,o=Math.imul(j,tt),n=n+Math.imul(C,et)|0,i=(i=i+Math.imul(C,nt)|0)+Math.imul(k,et)|0,o=o+Math.imul(k,nt)|0,n=n+Math.imul(P,ot)|0,i=(i=i+Math.imul(P,st)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,st)|0,n=n+Math.imul(B,at)|0,i=(i=i+Math.imul(B,ft)|0)+Math.imul(x,at)|0,o=o+Math.imul(x,ft)|0,n=n+Math.imul(R,lt)|0,i=(i=i+Math.imul(R,ct)|0)+Math.imul(O,lt)|0,o=o+Math.imul(O,ct)|0;var Bt=(f+(n=n+Math.imul(E,pt)|0)|0)+((8191&(i=(i=i+Math.imul(E,mt)|0)+Math.imul(S,pt)|0))<<13)|0;f=((o=o+Math.imul(S,mt)|0)+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,n=Math.imul(F,et),i=(i=Math.imul(F,nt))+Math.imul(j,et)|0,o=Math.imul(j,nt),n=n+Math.imul(C,ot)|0,i=(i=i+Math.imul(C,st)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,st)|0,n=n+Math.imul(P,at)|0,i=(i=i+Math.imul(P,ft)|0)+Math.imul(T,at)|0,o=o+Math.imul(T,ft)|0,n=n+Math.imul(B,lt)|0,i=(i=i+Math.imul(B,ct)|0)+Math.imul(x,lt)|0,o=o+Math.imul(x,ct)|0;var xt=(f+(n=n+Math.imul(R,pt)|0)|0)+((8191&(i=(i=i+Math.imul(R,mt)|0)+Math.imul(O,pt)|0))<<13)|0;f=((o=o+Math.imul(O,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(F,ot),i=(i=Math.imul(F,st))+Math.imul(j,ot)|0,o=Math.imul(j,st),n=n+Math.imul(C,at)|0,i=(i=i+Math.imul(C,ft)|0)+Math.imul(k,at)|0,o=o+Math.imul(k,ft)|0,n=n+Math.imul(P,lt)|0,i=(i=i+Math.imul(P,ct)|0)+Math.imul(T,lt)|0,o=o+Math.imul(T,ct)|0;var It=(f+(n=n+Math.imul(B,pt)|0)|0)+((8191&(i=(i=i+Math.imul(B,mt)|0)+Math.imul(x,pt)|0))<<13)|0;f=((o=o+Math.imul(x,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(F,at),i=(i=Math.imul(F,ft))+Math.imul(j,at)|0,o=Math.imul(j,ft),n=n+Math.imul(C,lt)|0,i=(i=i+Math.imul(C,ct)|0)+Math.imul(k,lt)|0,o=o+Math.imul(k,ct)|0;var Pt=(f+(n=n+Math.imul(P,pt)|0)|0)+((8191&(i=(i=i+Math.imul(P,mt)|0)+Math.imul(T,pt)|0))<<13)|0;f=((o=o+Math.imul(T,mt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(F,lt),i=(i=Math.imul(F,ct))+Math.imul(j,lt)|0,o=Math.imul(j,ct);var Tt=(f+(n=n+Math.imul(C,pt)|0)|0)+((8191&(i=(i=i+Math.imul(C,mt)|0)+Math.imul(k,pt)|0))<<13)|0;f=((o=o+Math.imul(k,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863;var Ut=(f+(n=Math.imul(F,pt))|0)+((8191&(i=(i=Math.imul(F,mt))+Math.imul(j,pt)|0))<<13)|0;return f=((o=Math.imul(j,mt))+(i>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,a[0]=gt,a[1]=vt,a[2]=yt,a[3]=wt,a[4]=bt,a[5]=_t,a[6]=Mt,a[7]=Et,a[8]=St,a[9]=At,a[10]=Rt,a[11]=Ot,a[12]=Nt,a[13]=Bt,a[14]=xt,a[15]=It,a[16]=Pt,a[17]=Tt,a[18]=Ut,0!==f&&(a[19]=f,e.length++),e};function p(t,r,e){return(new m).mulp(t,r,e)}function m(t,r){this.x=t,this.y=r}Math.imul||(d=c),o.prototype.mulTo=function(t,r){var e=this.length+t.length;return 10===this.length&&10===t.length?d(this,t,r):e<63?c(this,t,r):e<1024?function(t,r,e){e.negative=r.negative^t.negative,e.length=t.length+r.length;for(var n=0,i=0,o=0;o<e.length-1;o++){var s=i;i=0;for(var u=67108863&n,a=Math.min(o,r.length-1),f=Math.max(0,o-t.length+1);f<=a;f++){var h=o-f,l=(0|t.words[h])*(0|r.words[f]),c=67108863&l;u=67108863&(c=c+u|0),i+=(s=(s=s+(l/67108864|0)|0)+(c>>>26)|0)>>>26,s&=67108863}e.words[o]=u,n=s,s=i}return 0!==n?e.words[o]=n:e.length--,e.strip()}(this,t,r):p(this,t,r)},m.prototype.makeRBT=function(t){for(var r=new Array(t),e=o.prototype._countBits(t)-1,n=0;n<t;n++)r[n]=this.revBin(n,e,t);return r},m.prototype.revBin=function(t,r,e){if(0===t||t===e-1)return t;for(var n=0,i=0;i<r;i++)n|=(1&t)<<r-i-1,t>>=1;return n},m.prototype.permute=function(t,r,e,n,i,o){for(var s=0;s<o;s++)n[s]=r[t[s]],i[s]=e[t[s]]},m.prototype.transform=function(t,r,e,n,i,o){this.permute(o,t,r,e,n,i);for(var s=1;s<i;s<<=1)for(var u=s<<1,a=Math.cos(2*Math.PI/u),f=Math.sin(2*Math.PI/u),h=0;h<i;h+=u)for(var l=a,c=f,d=0;d<s;d++){var p=e[h+d],m=n[h+d],g=e[h+d+s],v=n[h+d+s],y=l*g-c*v;v=l*v+c*g,g=y,e[h+d]=p+g,n[h+d]=m+v,e[h+d+s]=p-g,n[h+d+s]=m-v,d!==u&&(y=a*l-f*c,c=a*c+f*l,l=y)}},m.prototype.guessLen13b=function(t,r){var e=1|Math.max(r,t),n=1&e,i=0;for(e=e/2|0;e;e>>>=1)i++;return 1<<i+1+n},m.prototype.conjugate=function(t,r,e){if(!(e<=1))for(var n=0;n<e/2;n++){var i=t[n];t[n]=t[e-n-1],t[e-n-1]=i,i=r[n],r[n]=-r[e-n-1],r[e-n-1]=-i}},m.prototype.normalize13b=function(t,r){for(var e=0,n=0;n<r/2;n++){var i=8192*Math.round(t[2*n+1]/r)+Math.round(t[2*n]/r)+e;t[n]=67108863&i,e=i<67108864?0:i/67108864|0}return t},m.prototype.convert13b=function(t,r,e,i){for(var o=0,s=0;s<r;s++)o+=0|t[s],e[2*s]=8191&o,o>>>=13,e[2*s+1]=8191&o,o>>>=13;for(s=2*r;s<i;++s)e[s]=0;n(0===o),n(0==(-8192&o))},m.prototype.stub=function(t){for(var r=new Array(t),e=0;e<t;e++)r[e]=0;return r},m.prototype.mulp=function(t,r,e){var n=2*this.guessLen13b(t.length,r.length),i=this.makeRBT(n),o=this.stub(n),s=new Array(n),u=new Array(n),a=new Array(n),f=new Array(n),h=new Array(n),l=new Array(n),c=e.words;c.length=n,this.convert13b(t.words,t.length,s,n),this.convert13b(r.words,r.length,f,n),this.transform(s,o,u,a,n,i),this.transform(f,o,h,l,n,i);for(var d=0;d<n;d++){var p=u[d]*h[d]-a[d]*l[d];a[d]=u[d]*l[d]+a[d]*h[d],u[d]=p}return this.conjugate(u,a,n),this.transform(u,a,c,o,n,i),this.conjugate(c,o,n),this.normalize13b(c,n),e.negative=t.negative^r.negative,e.length=t.length+r.length,e.strip()},o.prototype.mul=function(t){var r=new o(null);return r.words=new Array(this.length+t.length),this.mulTo(t,r)},o.prototype.mulf=function(t){var r=new o(null);return r.words=new Array(this.length+t.length),p(this,t,r)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.prototype.imuln=function(t){n("number"==typeof t),n(t<67108864);for(var r=0,e=0;e<this.length;e++){var i=(0|this.words[e])*t,o=(67108863&i)+(67108863&r);r>>=26,r+=i/67108864|0,r+=o>>>26,this.words[e]=67108863&o}return 0!==r&&(this.words[e]=r,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var r=function(t){for(var r=new Array(t.bitLength()),e=0;e<r.length;e++){var n=e/26|0,i=e%26;r[e]=(t.words[n]&1<<i)>>>i}return r}(t);if(0===r.length)return new o(1);for(var e=this,n=0;n<r.length&&0===r[n];n++,e=e.sqr());if(++n<r.length)for(var i=e.sqr();n<r.length;n++,i=i.sqr())0!==r[n]&&(e=e.mul(i));return e},o.prototype.iushln=function(t){n("number"==typeof t&&t>=0);var r,e=t%26,i=(t-e)/26,o=67108863>>>26-e<<26-e;if(0!==e){var s=0;for(r=0;r<this.length;r++){var u=this.words[r]&o,a=(0|this.words[r])-u<<e;this.words[r]=a|s,s=u>>>26-e}s&&(this.words[r]=s,this.length++)}if(0!==i){for(r=this.length-1;r>=0;r--)this.words[r+i]=this.words[r];for(r=0;r<i;r++)this.words[r]=0;this.length+=i}return this.strip()},o.prototype.ishln=function(t){return n(0===this.negative),this.iushln(t)},o.prototype.iushrn=function(t,r,e){var i;n("number"==typeof t&&t>=0),i=r?(r-r%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),u=67108863^67108863>>>o<<o,a=e;if(i-=s,i=Math.max(0,i),a){for(var f=0;f<s;f++)a.words[f]=this.words[f];a.length=s}if(0===s);else if(this.length>s)for(this.length-=s,f=0;f<this.length;f++)this.words[f]=this.words[f+s];else this.words[0]=0,this.length=1;var h=0;for(f=this.length-1;f>=0&&(0!==h||f>=i);f--){var l=0|this.words[f];this.words[f]=h<<26-o|l>>>o,h=l&u}return a&&0!==h&&(a.words[a.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,r,e){return n(0===this.negative),this.iushrn(t,r,e)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"==typeof t&&t>=0);var r=t%26,e=(t-r)/26,i=1<<r;return!(this.length<=e||!(this.words[e]&i))},o.prototype.imaskn=function(t){n("number"==typeof t&&t>=0);var r=t%26,e=(t-r)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=e)return this;if(0!==r&&e++,this.length=Math.min(e,this.length),0!==r){var i=67108863^67108863>>>r<<r;this.words[this.length-1]&=i}return this.strip()},o.prototype.maskn=function(t){return this.clone().imaskn(t)},o.prototype.iaddn=function(t){return n("number"==typeof t),n(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},o.prototype._iaddn=function(t){this.words[0]+=t;for(var r=0;r<this.length&&this.words[r]>=67108864;r++)this.words[r]-=67108864,r===this.length-1?this.words[r+1]=1:this.words[r+1]++;return this.length=Math.max(this.length,r+1),this},o.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var r=0;r<this.length&&this.words[r]<0;r++)this.words[r]+=67108864,this.words[r+1]-=1;return this.strip()},o.prototype.addn=function(t){return this.clone().iaddn(t)},o.prototype.subn=function(t){return this.clone().isubn(t)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(t,r,e){var i,o,s=t.length+e;this._expand(s);var u=0;for(i=0;i<t.length;i++){o=(0|this.words[i+e])+u;var a=(0|t.words[i])*r;u=((o-=67108863&a)>>26)-(a/67108864|0),this.words[i+e]=67108863&o}for(;i<this.length-e;i++)u=(o=(0|this.words[i+e])+u)>>26,this.words[i+e]=67108863&o;if(0===u)return this.strip();for(n(-1===u),u=0,i=0;i<this.length;i++)u=(o=-(0|this.words[i])+u)>>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,r){var e=(this.length,t.length),n=this.clone(),i=t,s=0|i.words[i.length-1];0!=(e=26-this._countBits(s))&&(i=i.ushln(e),n.iushln(e),s=0|i.words[i.length-1]);var u,a=n.length-i.length;if("mod"!==r){(u=new o(null)).length=a+1,u.words=new Array(u.length);for(var f=0;f<u.length;f++)u.words[f]=0}var h=n.clone()._ishlnsubmul(i,1,a);0===h.negative&&(n=h,u&&(u.words[a]=1));for(var l=a-1;l>=0;l--){var c=67108864*(0|n.words[i.length+l])+(0|n.words[i.length+l-1]);for(c=Math.min(c/s|0,67108863),n._ishlnsubmul(i,c,l);0!==n.negative;)c--,n.negative=0,n._ishlnsubmul(i,1,l),n.isZero()||(n.negative^=1);u&&(u.words[l]=c)}return u&&u.strip(),n.strip(),"div"!==r&&0!==e&&n.iushrn(e),{div:u||null,mod:n}},o.prototype.divmod=function(t,r,e){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(u=this.neg().divmod(t,r),"mod"!==r&&(i=u.div.neg()),"div"!==r&&(s=u.mod.neg(),e&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(u=this.divmod(t.neg(),r),"mod"!==r&&(i=u.div.neg()),{div:i,mod:u.mod}):0!=(this.negative&t.negative)?(u=this.neg().divmod(t.neg(),r),"div"!==r&&(s=u.mod.neg(),e&&0!==s.negative&&s.isub(t)),{div:u.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===r?{div:this.divn(t.words[0]),mod:null}:"mod"===r?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,r);var i,s,u},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var r=this.divmod(t);if(r.mod.isZero())return r.div;var e=0!==r.div.negative?r.mod.isub(t):r.mod,n=t.ushrn(1),i=t.andln(1),o=e.cmp(n);return o<0||1===i&&0===o?r.div:0!==r.div.negative?r.div.isubn(1):r.div.iaddn(1)},o.prototype.modn=function(t){n(t<=67108863);for(var r=(1<<26)%t,e=0,i=this.length-1;i>=0;i--)e=(r*e+(0|this.words[i]))%t;return e},o.prototype.idivn=function(t){n(t<=67108863);for(var r=0,e=this.length-1;e>=0;e--){var i=(0|this.words[e])+67108864*r;this.words[e]=i/t|0,r=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var r=this,e=t.clone();r=0!==r.negative?r.umod(t):r.clone();for(var i=new o(1),s=new o(0),u=new o(0),a=new o(1),f=0;r.isEven()&&e.isEven();)r.iushrn(1),e.iushrn(1),++f;for(var h=e.clone(),l=r.clone();!r.isZero();){for(var c=0,d=1;0==(r.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(r.iushrn(c);c-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(h),s.isub(l)),i.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(e.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(e.iushrn(p);p-- >0;)(u.isOdd()||a.isOdd())&&(u.iadd(h),a.isub(l)),u.iushrn(1),a.iushrn(1);r.cmp(e)>=0?(r.isub(e),i.isub(u),s.isub(a)):(e.isub(r),u.isub(i),a.isub(s))}return{a:u,b:a,gcd:e.iushln(f)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var r=this,e=t.clone();r=0!==r.negative?r.umod(t):r.clone();for(var i,s=new o(1),u=new o(0),a=e.clone();r.cmpn(1)>0&&e.cmpn(1)>0;){for(var f=0,h=1;0==(r.words[0]&h)&&f<26;++f,h<<=1);if(f>0)for(r.iushrn(f);f-- >0;)s.isOdd()&&s.iadd(a),s.iushrn(1);for(var l=0,c=1;0==(e.words[0]&c)&&l<26;++l,c<<=1);if(l>0)for(e.iushrn(l);l-- >0;)u.isOdd()&&u.iadd(a),u.iushrn(1);r.cmp(e)>=0?(r.isub(e),s.isub(u)):(e.isub(r),u.isub(s))}return(i=0===r.cmpn(1)?s:u).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var r=this.clone(),e=t.clone();r.negative=0,e.negative=0;for(var n=0;r.isEven()&&e.isEven();n++)r.iushrn(1),e.iushrn(1);for(;;){for(;r.isEven();)r.iushrn(1);for(;e.isEven();)e.iushrn(1);var i=r.cmp(e);if(i<0){var o=r;r=e,e=o}else if(0===i||0===e.cmpn(1))break;r.isub(e)}return e.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"==typeof t);var r=t%26,e=(t-r)/26,i=1<<r;if(this.length<=e)return this._expand(e+1),this.words[e]|=i,this;for(var o=i,s=e;0!==o&&s<this.length;s++){var u=0|this.words[s];o=(u+=o)>>>26,u&=67108863,this.words[s]=u}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var r,e=t<0;if(0!==this.negative&&!e)return-1;if(0===this.negative&&e)return 1;if(this.strip(),this.length>1)r=1;else{e&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];r=i===t?0:i<t?-1:1}return 0!==this.negative?0|-r:r},o.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var r=this.ucmp(t);return 0!==this.negative?0|-r:r},o.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var r=0,e=this.length-1;e>=0;e--){var n=0|this.words[e],i=0|t.words[e];if(n!==i){n<i?r=-1:n>i&&(r=1);break}}return r},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new M(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var g={k256:null,p224:null,p192:null,p25519:null};function v(t,r){this.name=t,this.p=new o(r,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function b(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function M(t){if("string"==typeof t){var r=o._prime(t);this.m=r.p,this.prime=r}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function E(t){M.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var r,e=t;do{this.split(e,this.tmp),r=(e=(e=this.imulK(e)).iadd(this.tmp)).bitLength()}while(r>this.n);var n=r<this.n?-1:e.ucmp(this.p);return 0===n?(e.words[0]=0,e.length=1):n>0?e.isub(this.p):e.strip(),e},v.prototype.split=function(t,r){t.iushrn(this.n,0,r)},v.prototype.imulK=function(t){return t.imul(this.k)},i(y,v),y.prototype.split=function(t,r){for(var e=Math.min(t.length,9),n=0;n<e;n++)r.words[n]=t.words[n];if(r.length=e,t.length<=9)return t.words[0]=0,void(t.length=1);var i=t.words[9];for(r.words[r.length++]=4194303&i,n=10;n<t.length;n++){var o=0|t.words[n];t.words[n-10]=(4194303&o)<<4|i>>>22,i=o}i>>>=22,t.words[n-10]=i,0===i&&t.length>10?t.length-=10:t.length-=9},y.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var r=0,e=0;e<t.length;e++){var n=0|t.words[e];r+=977*n,t.words[e]=67108863&r,r=64*n+(r/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(w,v),i(b,v),i(_,v),_.prototype.imulK=function(t){for(var r=0,e=0;e<t.length;e++){var n=19*(0|t.words[e])+r,i=67108863&n;n>>>=26,t.words[e]=i,r=n}return 0!==r&&(t.words[t.length++]=r),t},o._prime=function(t){if(g[t])return g[t];var r;if("k256"===t)r=new y;else if("p224"===t)r=new w;else if("p192"===t)r=new b;else{if("p25519"!==t)throw new Error("Unknown prime "+t);r=new _}return g[t]=r,r},M.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},M.prototype._verify2=function(t,r){n(0==(t.negative|r.negative),"red works only with positives"),n(t.red&&t.red===r.red,"red works only with red numbers")},M.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},M.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},M.prototype.add=function(t,r){this._verify2(t,r);var e=t.add(r);return e.cmp(this.m)>=0&&e.isub(this.m),e._forceRed(this)},M.prototype.iadd=function(t,r){this._verify2(t,r);var e=t.iadd(r);return e.cmp(this.m)>=0&&e.isub(this.m),e},M.prototype.sub=function(t,r){this._verify2(t,r);var e=t.sub(r);return e.cmpn(0)<0&&e.iadd(this.m),e._forceRed(this)},M.prototype.isub=function(t,r){this._verify2(t,r);var e=t.isub(r);return e.cmpn(0)<0&&e.iadd(this.m),e},M.prototype.shl=function(t,r){return this._verify1(t),this.imod(t.ushln(r))},M.prototype.imul=function(t,r){return this._verify2(t,r),this.imod(t.imul(r))},M.prototype.mul=function(t,r){return this._verify2(t,r),this.imod(t.mul(r))},M.prototype.isqr=function(t){return this.imul(t,t.clone())},M.prototype.sqr=function(t){return this.mul(t,t)},M.prototype.sqrt=function(t){if(t.isZero())return t.clone();var r=this.m.andln(3);if(n(r%2==1),3===r){var e=this.m.add(new o(1)).iushrn(2);return this.pow(t,e)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var u=new o(1).toRed(this),a=u.redNeg(),f=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new o(2*h*h).toRed(this);0!==this.pow(h,f).cmp(a);)h.redIAdd(a);for(var l=this.pow(h,i),c=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=s;0!==d.cmp(u);){for(var m=d,g=0;0!==m.cmp(u);g++)m=m.redSqr();n(g<p);var v=this.pow(l,new o(1).iushln(p-g-1));c=c.redMul(v),l=v.redSqr(),d=d.redMul(l),p=g}return c},M.prototype.invm=function(t){var r=t._invmp(this.m);return 0!==r.negative?(r.negative=0,this.imod(r).redNeg()):this.imod(r)},M.prototype.pow=function(t,r){if(r.isZero())return new o(1).toRed(this);if(0===r.cmpn(1))return t.clone();var e=new Array(16);e[0]=new o(1).toRed(this),e[1]=t;for(var n=2;n<e.length;n++)e[n]=this.mul(e[n-1],t);var i=e[0],s=0,u=0,a=r.bitLength()%26;for(0===a&&(a=26),n=r.length-1;n>=0;n--){for(var f=r.words[n],h=a-1;h>=0;h--){var l=f>>h&1;i!==e[0]&&(i=this.sqr(i)),0!==l||0!==s?(s<<=1,s|=l,(4==++u||0===n&&0===h)&&(i=this.mul(i,e[s]),u=0,s=0)):u=0}a=26}return i},M.prototype.convertTo=function(t){var r=t.umod(this.m);return r===t?r.clone():r},M.prototype.convertFrom=function(t){var r=t.clone();return r.red=null,r},o.mont=function(t){return new E(t)},i(E,M),E.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},E.prototype.convertFrom=function(t){var r=this.imod(t.mul(this.rinv));return r.red=null,r},E.prototype.imul=function(t,r){if(t.isZero()||r.isZero())return t.words[0]=0,t.length=1,t;var e=t.imul(r),n=e.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=e.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},E.prototype.mul=function(t,r){if(t.isZero()||r.isZero())return new o(0)._forceRed(this);var e=t.mul(r),n=e.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=e.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},E.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,e(17)(t))},function(t,r,e){"use strict";var n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var r={};if(null!=t)for(var e in t)Object.hasOwnProperty.call(t,e)&&(r[e]=t[e]);return r.default=t,r};Object.defineProperty(r,"__esModule",{value:!0});var i=n(e(4)),o=e(0),s=e(1),u=e(6),a=new s.Logger(u.version),f={};r.isBigNumberish=function(t){return null!=t&&(h.isBigNumber(t)||"number"==typeof t&&t%1==0||"string"==typeof t&&!!t.match(/^-?[0-9]+$/)||o.isHexString(t)||"bigint"==typeof t||o.isBytes(t))};var h=function(){function t(r,e){var n=this.constructor;a.checkNew(n,t),r!==f&&a.throwError("cannot call consturtor directly; use BigNumber.from",s.Logger.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}return t.prototype.fromTwos=function(t){return c(d(this).fromTwos(t))},t.prototype.toTwos=function(t){return c(d(this).toTwos(t))},t.prototype.abs=function(){return"-"===this._hex[0]?t.from(this._hex.substring(1)):this},t.prototype.add=function(t){return c(d(this).add(d(t)))},t.prototype.sub=function(t){return c(d(this).sub(d(t)))},t.prototype.div=function(r){return t.from(r).isZero()&&p("division by zero","div"),c(d(this).div(d(r)))},t.prototype.mul=function(t){return c(d(this).mul(d(t)))},t.prototype.mod=function(t){return c(d(this).mod(d(t)))},t.prototype.pow=function(t){return c(d(this).pow(d(t)))},t.prototype.maskn=function(t){return c(d(this).maskn(t))},t.prototype.eq=function(t){return d(this).eq(d(t))},t.prototype.lt=function(t){return d(this).lt(d(t))},t.prototype.lte=function(t){return d(this).lte(d(t))},t.prototype.gt=function(t){return d(this).gt(d(t))},t.prototype.gte=function(t){return d(this).gte(d(t))},t.prototype.isZero=function(){return d(this).isZero()},t.prototype.toNumber=function(){try{return d(this).toNumber()}catch(t){p("overflow","toNumber",this.toString())}return null},t.prototype.toString=function(){return 0!==arguments.length&&a.throwError("bigNumber.toString does not accept parameters",s.Logger.errors.UNEXPECTED_ARGUMENT,{}),d(this).toString(10)},t.prototype.toHexString=function(){return this._hex},t.from=function(r){return r instanceof t?r:"string"==typeof r?r.match(/-?0x[0-9a-f]+/i)?new t(f,l(r)):r.match(/^-?[0-9]+$/)?new t(f,l(new i.BN(r))):a.throwArgumentError("invalid BigNumber string","value",r):"number"==typeof r?(r%1&&p("underflow","BigNumber.from",r),(r>=9007199254740991||r<=-9007199254740991)&&p("overflow","BigNumber.from",r),t.from(String(r))):"bigint"==typeof r?t.from(r.toString()):o.isBytes(r)?t.from(o.hexlify(r)):r._hex&&o.isHexString(r._hex)?t.from(r._hex):r.toHexString&&"string"==typeof(r=r.toHexString())?t.from(r):a.throwArgumentError("invalid BigNumber value","value",r)},t.isBigNumber=function(t){return!(!t||!t._isBigNumber)},t}();function l(t){if("string"!=typeof t)return l(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&a.throwArgumentError("invalid hex","value",t),"0x00"===(t=l(t))?t:"-"+t;if("0x"!==t.substring(0,2)&&(t="0x"+t),"0x"===t)return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&"0x00"===t.substring(0,4);)t="0x"+t.substring(4);return t}function c(t){return h.from(l(t))}function d(t){var r=h.from(t).toHexString();return"-"===r[0]?new i.BN("-"+r.substring(3),16):new i.BN(r.substring(2),16)}function p(t,r,e){var n={fault:t,operation:r};return null!=e&&(n.value=e),a.throwError(t,s.Logger.errors.NUMERIC_FAULT,n)}r.BigNumber=h},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.version="bignumber/5.0.0-beta.129"},function(t,r,e){"use strict";(function(t){Object.defineProperty(r,"__esModule",{value:!0});var n=e(12),i=n.__importDefault(e(13)),o=e(0),s=e(16),u=e(24);function a(t){return u.toUtf8String(new Uint8Array(t))}function f(t,r){var e=o.hexlify(new Uint8Array(t));return r&&(e=w(e)),e}function h(t,r){var e=t.toString("hex");return r||(e=y(e)),e}function l(t){return u.toUtf8Bytes(t).buffer}function c(t,r){return f(l(t),r)}function d(t,r){var e=new i.default(t).toString(16);return e=v(e),r&&(e=w(e)),e}function p(r){return r=w(r),t.from(r,"hex")}function m(t){return t=y(t),o.arrayify(t).buffer}function g(t){return new i.default(t).toNumber()}function v(t){return(t=(t=w(t)).length%2!=0?"0"+t:t)&&(t=y(t)),t}function y(t){return"0x"===t.toLowerCase().substring(0,2)?t:"0x"+t}function w(t){return"0x"===t.toLowerCase().substring(0,2)?t.substring(2):t}function b(t){return o.isHexString(t)}function _(t){return""===t||"string"==typeof t&&""===t.trim()}function M(t){for(var r={},e=("?"===t[0]?t.substr(1):t).split("&"),n=0;n<e.length;n++){var i=e[n].match(/\w+(?==)/i)||[],o=e[n].match(/=.+/i)||[];i[0]&&(r[decodeURIComponent(i[0])]=decodeURIComponent(o[0].substr(1)))}return r}function E(t){return!(t&&t.length)}r.convertArrayBufferToBuffer=function(t){return p(f(t))},r.convertArrayBufferToUtf8=a,r.convertArrayBufferToHex=f,r.convertArrayBufferToNumber=function(t){return g(f(t))},r.concatArrayBuffers=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return m(t.map(function(t){return f(t,!0)}).join(""))},r.convertBufferToArrayBuffer=function(t){return m(h(t))},r.convertBufferToUtf8=function(t){return t.toString("utf8")},r.convertBufferToHex=h,r.convertBufferToNumber=function(t){return g(h(t))},r.concatBuffers=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return p(t.map(function(t){return h(t,!0)}).join(""))},r.convertUtf8ToArrayBuffer=l,r.convertUtf8ToBuffer=function(r){return t.from(r,"utf8")},r.convertUtf8ToHex=c,r.convertUtf8ToNumber=function(t){return new i.default(t).toNumber()},r.convertNumberToBuffer=function(t){return p(d(t))},r.convertNumberToArrayBuffer=function(t){return m(d(t))},r.convertNumberToUtf8=function(t){return new i.default(t).toString()},r.convertNumberToHex=d,r.convertHexToBuffer=p,r.convertHexToArrayBuffer=m,r.convertHexToUtf8=function(t){return a(m(t))},r.convertHexToNumber=g,r.sanitizeHex=v,r.addHexPrefix=y,r.removeHexPrefix=w,r.isHexString=b,r.isEmptyString=_,r.payloadId=function(){return(new Date).getTime()*Math.pow(10,3)+Math.floor(Math.random()*Math.pow(10,3))},r.uuid=function(){return function(t,r){for(r=t="";t++<36;r+=51*t&52?(15^t?8^Math.random()*(20^t?16:4):4).toString(16):"-");return r}()},r.toChecksumAddress=function(t){return s.getAddress(t)},r.isValidAddress=function(t){return!(!t||"0x"!==t.toLowerCase().substring(0,2)||!/^(0x)?[0-9a-f]{40}$/i.test(t)||!/^(0x)?[0-9a-f]{40}$/.test(t)&&!/^(0x)?[0-9A-F]{40}$/.test(t)&&t!==r.toChecksumAddress(t))},r.getMeta=function(){if("undefined"==typeof window||"undefined"==typeof document||void 0===window.location)return null;function t(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];for(var e=document.getElementsByTagName("meta"),n=function(r){var n=e[r],i=["itemprop","property","name"].map(function(t){return n.getAttribute(t)}).filter(function(r){r&&t.includes(r)});if(i.length&&i){var o=n.getAttribute("content");if(o)return{value:o}}},i=0;i<e.length;i++){var o=n(i);if("object"==typeof o)return o.value}return""}var r=function(){var r=t("name","og:site_name","og:title","twitter:title");return r||(r=document.title),r}();return{description:t("description","og:description","twitter:description","keywords"),url:window.location.origin,icons:function(){for(var t=document.getElementsByTagName("link"),r=[],e=0;e<t.length;e++){var n=t[e],i=n.getAttribute("rel");if(i&&i.toLowerCase().indexOf("icon")>-1){var o=n.getAttribute("href");if(o)if(-1===o.toLowerCase().indexOf("https:")&&-1===o.toLowerCase().indexOf("http:")&&0!==o.indexOf("//")){var s=window.location.protocol+"//"+window.location.host;if(0===o.indexOf("/"))s+=o;else{var u=window.location.pathname.split("/");u.pop(),s+=u.join("/")+"/"+o}r.push(s)}else if(0===o.indexOf("//")){var a=window.location.protocol+o;r.push(a)}else r.push(o)}}return r}(),name:r}},r.parseQueryString=M,r.parseWalletConnectUri=function(t){var r=t.indexOf(":"),e=-1!==t.indexOf("?")?t.indexOf("?"):void 0,i=t.substring(0,r),o=function(t){var r=t.split("@");return{handshakeTopic:r[0],version:parseInt(r[1],10)}}(t.substring(r+1,e)),s=function(t){var r=M(t);return{key:r.key||"",bridge:r.bridge||""}}(void 0!==e?t.substr(e):"");return n.__assign({protocol:i},o,s)},r.promisify=function(t,r){var e=this;return function(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];return n.__awaiter(e,void 0,void 0,function(){return n.__generator(this,function(e){return[2,new Promise(function(e,o){t.apply(r,n.__spread(i,[function(t,r){null==t&&o(t),e(r)}]))})]})})}},r.isEmptyArray=E,r.parsePersonalSign=function(t){return E(t)||b(t[0])||(t[0]=c(t[0])),t},r.parseTransactionData=function(t){if(void 0===t.from||!r.isValidAddress(t.from))throw new Error("Transaction object must include a valid 'from' value.");function e(t){var r=t;return("number"==typeof t||"string"==typeof t&&!_(t))&&(b(t)?"string"==typeof t&&(r=v(t)):r=d(t)),r}var n={from:v(t.from),to:void 0===t.to?"":v(t.to),gasPrice:void 0===t.gasPrice?"":e(t.gasPrice),gasLimit:void 0===t.gasLimit?void 0===t.gas?"":e(t.gas):e(t.gasLimit),value:void 0===t.value?"":e(t.value),nonce:void 0===t.nonce?"":e(t.nonce),data:void 0===t.data?"":v(t.data)||"0x"},i=["gasPrice","gasLimit","value","nonce"];return Object.keys(n).forEach(function(t){!n[t].trim().length&&i.includes(t)&&delete n[t]}),n},r.formatRpcError=function(t){var r=t.message||"Failed or Rejected Request",e=-32e3;if(t&&!t.code)switch(r){case"Parse error":e=-32700;break;case"Invalid request":e=-32600;break;case"Method not found":e=-32601;break;case"Invalid params":e=-32602;break;case"Internal error":e=-32603;break;default:e=-32e3}return{code:e,message:r}},r.isJsonRpcSubscription=function(t){return"object"==typeof t.params},r.isJsonRpcRequest=function(t){return void 0!==t.method},r.isJsonRpcResponseSuccess=function(t){return void 0!==t.result},r.isJsonRpcResponseError=function(t){return void 0!==t.error},r.isInternalEvent=function(t){return void 0!==t.event},r.isWalletConnectSession=function(t){return void 0!==t.bridge},r.isReservedEvent=function(t){return["session_request","session_update","exchange_key","connect","disconnect"].includes(t)||t.startsWith("wc_")},r.signingMethods=["eth_sendTransaction","eth_signTransaction","eth_sign","eth_signTypedData","eth_signTypedData_v1","eth_signTypedData_v3","personal_sign"],r.stateMethods=["eth_accounts","eth_chainId","net_version"],r.isSilentPayload=function(t){return!!t.method.startsWith("wc_")||!r.signingMethods.includes(t.method)}}).call(this,e(8).Buffer)},function(t,r,e){"use strict";(function(t){
/*!
 * The buffer module from node.js, for the browser.
 *
 * @author   Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
 * @license  MIT
 */
var n=e(9),i=e(10),o=e(11);function s(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function u(t,r){if(s()<r)throw new RangeError("Invalid typed array length");return a.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(r)).__proto__=a.prototype:(null===t&&(t=new a(r)),t.length=r),t}function a(t,r,e){if(!(a.TYPED_ARRAY_SUPPORT||this instanceof a))return new a(t,r,e);if("number"==typeof t){if("string"==typeof r)throw new Error("If encoding is specified then the first argument must be a string");return l(this,t)}return f(this,t,r,e)}function f(t,r,e,n){if("number"==typeof r)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&r instanceof ArrayBuffer?function(t,r,e,n){if(r.byteLength,e<0||r.byteLength<e)throw new RangeError("'offset' is out of bounds");if(r.byteLength<e+(n||0))throw new RangeError("'length' is out of bounds");return r=void 0===e&&void 0===n?new Uint8Array(r):void 0===n?new Uint8Array(r,e):new Uint8Array(r,e,n),a.TYPED_ARRAY_SUPPORT?(t=r).__proto__=a.prototype:t=c(t,r),t}(t,r,e,n):"string"==typeof r?function(t,r,e){if("string"==typeof e&&""!==e||(e="utf8"),!a.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var n=0|p(r,e),i=(t=u(t,n)).write(r,e);return i!==n&&(t=t.slice(0,i)),t}(t,r,e):function(t,r){if(a.isBuffer(r)){var e=0|d(r.length);return 0===(t=u(t,e)).length?t:(r.copy(t,0,0,e),t)}if(r){if("undefined"!=typeof ArrayBuffer&&r.buffer instanceof ArrayBuffer||"length"in r)return"number"!=typeof r.length||(n=r.length)!=n?u(t,0):c(t,r);if("Buffer"===r.type&&o(r.data))return c(t,r.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,r)}function h(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function l(t,r){if(h(r),t=u(t,r<0?0:0|d(r)),!a.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}function c(t,r){var e=r.length<0?0:0|d(r.length);t=u(t,e);for(var n=0;n<e;n+=1)t[n]=255&r[n];return t}function d(t){if(t>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|t}function p(t,r){if(a.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var e=t.length;if(0===e)return 0;for(var n=!1;;)switch(r){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return q(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*e;case"hex":return e>>>1;case"base64":return H(t).length;default:if(n)return q(t).length;r=(""+r).toLowerCase(),n=!0}}function m(t,r,e){var n=!1;if((void 0===r||r<0)&&(r=0),r>this.length)return"";if((void 0===e||e>this.length)&&(e=this.length),e<=0)return"";if((e>>>=0)<=(r>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return x(this,r,e);case"utf8":case"utf-8":return R(this,r,e);case"ascii":return N(this,r,e);case"latin1":case"binary":return B(this,r,e);case"base64":return A(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function g(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}function v(t,r,e,n,i){if(0===t.length)return-1;if("string"==typeof e?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=i?0:t.length-1),e<0&&(e=t.length+e),e>=t.length){if(i)return-1;e=t.length-1}else if(e<0){if(!i)return-1;e=0}if("string"==typeof r&&(r=a.from(r,n)),a.isBuffer(r))return 0===r.length?-1:y(t,r,e,n,i);if("number"==typeof r)return r&=255,a.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):y(t,[r],e,n,i);throw new TypeError("val must be string, number or Buffer")}function y(t,r,e,n,i){var o,s=1,u=t.length,a=r.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||r.length<2)return-1;s=2,u/=2,a/=2,e/=2}function f(t,r){return 1===s?t[r]:t.readUInt16BE(r*s)}if(i){var h=-1;for(o=e;o<u;o++)if(f(t,o)===f(r,-1===h?0:o-h)){if(-1===h&&(h=o),o-h+1===a)return h*s}else-1!==h&&(o-=o-h),h=-1}else for(e+a>u&&(e=u-a),o=e;o>=0;o--){for(var l=!0,c=0;c<a;c++)if(f(t,o+c)!==f(r,c)){l=!1;break}if(l)return o}return-1}function w(t,r,e,n){e=Number(e)||0;var i=t.length-e;n?(n=Number(n))>i&&(n=i):n=i;var o=r.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var s=0;s<n;++s){var u=parseInt(r.substr(2*s,2),16);if(isNaN(u))return s;t[e+s]=u}return s}function b(t,r,e,n){return G(q(r,t.length-e),t,e,n)}function _(t,r,e,n){return G(function(t){for(var r=[],e=0;e<t.length;++e)r.push(255&t.charCodeAt(e));return r}(r),t,e,n)}function M(t,r,e,n){return _(t,r,e,n)}function E(t,r,e,n){return G(H(r),t,e,n)}function S(t,r,e,n){return G(function(t,r){for(var e,n,i,o=[],s=0;s<t.length&&!((r-=2)<0);++s)n=(e=t.charCodeAt(s))>>8,i=e%256,o.push(i),o.push(n);return o}(r,t.length-e),t,e,n)}function A(t,r,e){return 0===r&&e===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(r,e))}function R(t,r,e){e=Math.min(t.length,e);for(var n=[],i=r;i<e;){var o,s,u,a,f=t[i],h=null,l=f>239?4:f>223?3:f>191?2:1;if(i+l<=e)switch(l){case 1:f<128&&(h=f);break;case 2:128==(192&(o=t[i+1]))&&(a=(31&f)<<6|63&o)>127&&(h=a);break;case 3:o=t[i+1],s=t[i+2],128==(192&o)&&128==(192&s)&&(a=(15&f)<<12|(63&o)<<6|63&s)>2047&&(a<55296||a>57343)&&(h=a);break;case 4:o=t[i+1],s=t[i+2],u=t[i+3],128==(192&o)&&128==(192&s)&&128==(192&u)&&(a=(15&f)<<18|(63&o)<<12|(63&s)<<6|63&u)>65535&&a<1114112&&(h=a)}null===h?(h=65533,l=1):h>65535&&(h-=65536,n.push(h>>>10&1023|55296),h=56320|1023&h),n.push(h),i+=l}return function(t){var r=t.length;if(r<=O)return String.fromCharCode.apply(String,t);for(var e="",n=0;n<r;)e+=String.fromCharCode.apply(String,t.slice(n,n+=O));return e}(n)}r.Buffer=a,r.SlowBuffer=function(t){return+t!=t&&(t=0),a.alloc(+t)},r.INSPECT_MAX_BYTES=50,a.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),r.kMaxLength=s(),a.poolSize=8192,a._augment=function(t){return t.__proto__=a.prototype,t},a.from=function(t,r,e){return f(null,t,r,e)},a.TYPED_ARRAY_SUPPORT&&(a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&a[Symbol.species]===a&&Object.defineProperty(a,Symbol.species,{value:null,configurable:!0})),a.alloc=function(t,r,e){return function(t,r,e,n){return h(r),r<=0?u(t,r):void 0!==e?"string"==typeof n?u(t,r).fill(e,n):u(t,r).fill(e):u(t,r)}(null,t,r,e)},a.allocUnsafe=function(t){return l(null,t)},a.allocUnsafeSlow=function(t){return l(null,t)},a.isBuffer=function(t){return!(null==t||!t._isBuffer)},a.compare=function(t,r){if(!a.isBuffer(t)||!a.isBuffer(r))throw new TypeError("Arguments must be Buffers");if(t===r)return 0;for(var e=t.length,n=r.length,i=0,o=Math.min(e,n);i<o;++i)if(t[i]!==r[i]){e=t[i],n=r[i];break}return e<n?-1:n<e?1:0},a.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(t,r){if(!o(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return a.alloc(0);var e;if(void 0===r)for(r=0,e=0;e<t.length;++e)r+=t[e].length;var n=a.allocUnsafe(r),i=0;for(e=0;e<t.length;++e){var s=t[e];if(!a.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(n,i),i+=s.length}return n},a.byteLength=p,a.prototype._isBuffer=!0,a.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<t;r+=2)g(this,r,r+1);return this},a.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<t;r+=4)g(this,r,r+3),g(this,r+1,r+2);return this},a.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<t;r+=8)g(this,r,r+7),g(this,r+1,r+6),g(this,r+2,r+5),g(this,r+3,r+4);return this},a.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?R(this,0,t):m.apply(this,arguments)},a.prototype.equals=function(t){if(!a.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===a.compare(this,t)},a.prototype.inspect=function(){var t="",e=r.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),"<Buffer "+t+">"},a.prototype.compare=function(t,r,e,n,i){if(!a.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===r&&(r=0),void 0===e&&(e=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),r<0||e>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&r>=e)return 0;if(n>=i)return-1;if(r>=e)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(e>>>=0)-(r>>>=0),u=Math.min(o,s),f=this.slice(n,i),h=t.slice(r,e),l=0;l<u;++l)if(f[l]!==h[l]){o=f[l],s=h[l];break}return o<s?-1:s<o?1:0},a.prototype.includes=function(t,r,e){return-1!==this.indexOf(t,r,e)},a.prototype.indexOf=function(t,r,e){return v(this,t,r,e,!0)},a.prototype.lastIndexOf=function(t,r,e){return v(this,t,r,e,!1)},a.prototype.write=function(t,r,e,n){if(void 0===r)n="utf8",e=this.length,r=0;else if(void 0===e&&"string"==typeof r)n=r,e=this.length,r=0;else{if(!isFinite(r))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");r|=0,isFinite(e)?(e|=0,void 0===n&&(n="utf8")):(n=e,e=void 0)}var i=this.length-r;if((void 0===e||e>i)&&(e=i),t.length>0&&(e<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return w(this,t,r,e);case"utf8":case"utf-8":return b(this,t,r,e);case"ascii":return _(this,t,r,e);case"latin1":case"binary":return M(this,t,r,e);case"base64":return E(this,t,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,t,r,e);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var O=4096;function N(t,r,e){var n="";e=Math.min(t.length,e);for(var i=r;i<e;++i)n+=String.fromCharCode(127&t[i]);return n}function B(t,r,e){var n="";e=Math.min(t.length,e);for(var i=r;i<e;++i)n+=String.fromCharCode(t[i]);return n}function x(t,r,e){var n=t.length;(!r||r<0)&&(r=0),(!e||e<0||e>n)&&(e=n);for(var i="",o=r;o<e;++o)i+=L(t[o]);return i}function I(t,r,e){for(var n=t.slice(r,e),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function P(t,r,e){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+r>e)throw new RangeError("Trying to access beyond buffer length")}function T(t,r,e,n,i,o){if(!a.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>i||r<o)throw new RangeError('"value" argument is out of bounds');if(e+n>t.length)throw new RangeError("Index out of range")}function U(t,r,e,n){r<0&&(r=65535+r+1);for(var i=0,o=Math.min(t.length-e,2);i<o;++i)t[e+i]=(r&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function C(t,r,e,n){r<0&&(r=4294967295+r+1);for(var i=0,o=Math.min(t.length-e,4);i<o;++i)t[e+i]=r>>>8*(n?i:3-i)&255}function k(t,r,e,n,i,o){if(e+n>t.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function D(t,r,e,n,o){return o||k(t,0,e,4),i.write(t,r,e,n,23,4),e+4}function F(t,r,e,n,o){return o||k(t,0,e,8),i.write(t,r,e,n,52,8),e+8}a.prototype.slice=function(t,r){var e,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(r=void 0===r?n:~~r)<0?(r+=n)<0&&(r=0):r>n&&(r=n),r<t&&(r=t),a.TYPED_ARRAY_SUPPORT)(e=this.subarray(t,r)).__proto__=a.prototype;else{var i=r-t;e=new a(i,void 0);for(var o=0;o<i;++o)e[o]=this[o+t]}return e},a.prototype.readUIntLE=function(t,r,e){t|=0,r|=0,e||P(t,r,this.length);for(var n=this[t],i=1,o=0;++o<r&&(i*=256);)n+=this[t+o]*i;return n},a.prototype.readUIntBE=function(t,r,e){t|=0,r|=0,e||P(t,r,this.length);for(var n=this[t+--r],i=1;r>0&&(i*=256);)n+=this[t+--r]*i;return n},a.prototype.readUInt8=function(t,r){return r||P(t,1,this.length),this[t]},a.prototype.readUInt16LE=function(t,r){return r||P(t,2,this.length),this[t]|this[t+1]<<8},a.prototype.readUInt16BE=function(t,r){return r||P(t,2,this.length),this[t]<<8|this[t+1]},a.prototype.readUInt32LE=function(t,r){return r||P(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},a.prototype.readUInt32BE=function(t,r){return r||P(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},a.prototype.readIntLE=function(t,r,e){t|=0,r|=0,e||P(t,r,this.length);for(var n=this[t],i=1,o=0;++o<r&&(i*=256);)n+=this[t+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*r)),n},a.prototype.readIntBE=function(t,r,e){t|=0,r|=0,e||P(t,r,this.length);for(var n=r,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*r)),o},a.prototype.readInt8=function(t,r){return r||P(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},a.prototype.readInt16LE=function(t,r){r||P(t,2,this.length);var e=this[t]|this[t+1]<<8;return 32768&e?4294901760|e:e},a.prototype.readInt16BE=function(t,r){r||P(t,2,this.length);var e=this[t+1]|this[t]<<8;return 32768&e?4294901760|e:e},a.prototype.readInt32LE=function(t,r){return r||P(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},a.prototype.readInt32BE=function(t,r){return r||P(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},a.prototype.readFloatLE=function(t,r){return r||P(t,4,this.length),i.read(this,t,!0,23,4)},a.prototype.readFloatBE=function(t,r){return r||P(t,4,this.length),i.read(this,t,!1,23,4)},a.prototype.readDoubleLE=function(t,r){return r||P(t,8,this.length),i.read(this,t,!0,52,8)},a.prototype.readDoubleBE=function(t,r){return r||P(t,8,this.length),i.read(this,t,!1,52,8)},a.prototype.writeUIntLE=function(t,r,e,n){t=+t,r|=0,e|=0,n||T(this,t,r,e,Math.pow(2,8*e)-1,0);var i=1,o=0;for(this[r]=255&t;++o<e&&(i*=256);)this[r+o]=t/i&255;return r+e},a.prototype.writeUIntBE=function(t,r,e,n){t=+t,r|=0,e|=0,n||T(this,t,r,e,Math.pow(2,8*e)-1,0);var i=e-1,o=1;for(this[r+i]=255&t;--i>=0&&(o*=256);)this[r+i]=t/o&255;return r+e},a.prototype.writeUInt8=function(t,r,e){return t=+t,r|=0,e||T(this,t,r,1,255,0),a.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[r]=255&t,r+1},a.prototype.writeUInt16LE=function(t,r,e){return t=+t,r|=0,e||T(this,t,r,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):U(this,t,r,!0),r+2},a.prototype.writeUInt16BE=function(t,r,e){return t=+t,r|=0,e||T(this,t,r,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):U(this,t,r,!1),r+2},a.prototype.writeUInt32LE=function(t,r,e){return t=+t,r|=0,e||T(this,t,r,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=255&t):C(this,t,r,!0),r+4},a.prototype.writeUInt32BE=function(t,r,e){return t=+t,r|=0,e||T(this,t,r,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):C(this,t,r,!1),r+4},a.prototype.writeIntLE=function(t,r,e,n){if(t=+t,r|=0,!n){var i=Math.pow(2,8*e-1);T(this,t,r,e,i-1,-i)}var o=0,s=1,u=0;for(this[r]=255&t;++o<e&&(s*=256);)t<0&&0===u&&0!==this[r+o-1]&&(u=1),this[r+o]=(t/s>>0)-u&255;return r+e},a.prototype.writeIntBE=function(t,r,e,n){if(t=+t,r|=0,!n){var i=Math.pow(2,8*e-1);T(this,t,r,e,i-1,-i)}var o=e-1,s=1,u=0;for(this[r+o]=255&t;--o>=0&&(s*=256);)t<0&&0===u&&0!==this[r+o+1]&&(u=1),this[r+o]=(t/s>>0)-u&255;return r+e},a.prototype.writeInt8=function(t,r,e){return t=+t,r|=0,e||T(this,t,r,1,127,-128),a.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[r]=255&t,r+1},a.prototype.writeInt16LE=function(t,r,e){return t=+t,r|=0,e||T(this,t,r,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):U(this,t,r,!0),r+2},a.prototype.writeInt16BE=function(t,r,e){return t=+t,r|=0,e||T(this,t,r,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):U(this,t,r,!1),r+2},a.prototype.writeInt32LE=function(t,r,e){return t=+t,r|=0,e||T(this,t,r,4,2147483647,-2147483648),a.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24):C(this,t,r,!0),r+4},a.prototype.writeInt32BE=function(t,r,e){return t=+t,r|=0,e||T(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),a.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):C(this,t,r,!1),r+4},a.prototype.writeFloatLE=function(t,r,e){return D(this,t,r,!0,e)},a.prototype.writeFloatBE=function(t,r,e){return D(this,t,r,!1,e)},a.prototype.writeDoubleLE=function(t,r,e){return F(this,t,r,!0,e)},a.prototype.writeDoubleBE=function(t,r,e){return F(this,t,r,!1,e)},a.prototype.copy=function(t,r,e,n){if(e||(e=0),n||0===n||(n=this.length),r>=t.length&&(r=t.length),r||(r=0),n>0&&n<e&&(n=e),n===e)return 0;if(0===t.length||0===this.length)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(e<0||e>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-r<n-e&&(n=t.length-r+e);var i,o=n-e;if(this===t&&e<r&&r<n)for(i=o-1;i>=0;--i)t[i+r]=this[i+e];else if(o<1e3||!a.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+r]=this[i+e];else Uint8Array.prototype.set.call(t,this.subarray(e,e+o),r);return o},a.prototype.fill=function(t,r,e,n){if("string"==typeof t){if("string"==typeof r?(n=r,r=0,e=this.length):"string"==typeof e&&(n=e,e=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!a.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(r<0||this.length<r||this.length<e)throw new RangeError("Out of range index");if(e<=r)return this;var o;if(r>>>=0,e=void 0===e?this.length:e>>>0,t||(t=0),"number"==typeof t)for(o=r;o<e;++o)this[o]=t;else{var s=a.isBuffer(t)?t:q(new a(t,n).toString()),u=s.length;for(o=0;o<e-r;++o)this[o+r]=s[o%u]}return this};var j=/[^+\/0-9A-Za-z-_]/g;function L(t){return t<16?"0"+t.toString(16):t.toString(16)}function q(t,r){var e;r=r||1/0;for(var n=t.length,i=null,o=[],s=0;s<n;++s){if((e=t.charCodeAt(s))>55295&&e<57344){if(!i){if(e>56319){(r-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(r-=3)>-1&&o.push(239,191,189);continue}i=e;continue}if(e<56320){(r-=3)>-1&&o.push(239,191,189),i=e;continue}e=65536+(i-55296<<10|e-56320)}else i&&(r-=3)>-1&&o.push(239,191,189);if(i=null,e<128){if((r-=1)<0)break;o.push(e)}else if(e<2048){if((r-=2)<0)break;o.push(e>>6|192,63&e|128)}else if(e<65536){if((r-=3)<0)break;o.push(e>>12|224,e>>6&63|128,63&e|128)}else{if(!(e<1114112))throw new Error("Invalid code point");if((r-=4)<0)break;o.push(e>>18|240,e>>12&63|128,e>>6&63|128,63&e|128)}}return o}function H(t){return n.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(j,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function G(t,r,e,n){for(var i=0;i<n&&!(i+e>=r.length||i>=t.length);++i)r[i+e]=t[i];return i}}).call(this,e(3))},function(t,r,e){"use strict";r.byteLength=function(t){var r=f(t),e=r[0],n=r[1];return 3*(e+n)/4-n},r.toByteArray=function(t){var r,e,n=f(t),s=n[0],u=n[1],a=new o(3*(s+u)/4-u),h=0,l=u>0?s-4:s;for(e=0;e<l;e+=4)r=i[t.charCodeAt(e)]<<18|i[t.charCodeAt(e+1)]<<12|i[t.charCodeAt(e+2)]<<6|i[t.charCodeAt(e+3)],a[h++]=r>>16&255,a[h++]=r>>8&255,a[h++]=255&r;return 2===u&&(r=i[t.charCodeAt(e)]<<2|i[t.charCodeAt(e+1)]>>4,a[h++]=255&r),1===u&&(r=i[t.charCodeAt(e)]<<10|i[t.charCodeAt(e+1)]<<4|i[t.charCodeAt(e+2)]>>2,a[h++]=r>>8&255,a[h++]=255&r),a},r.fromByteArray=function(t){for(var r,e=t.length,i=e%3,o=[],s=0,u=e-i;s<u;s+=16383)o.push(h(t,s,s+16383>u?u:s+16383));return 1===i?(r=t[e-1],o.push(n[r>>2]+n[r<<4&63]+"==")):2===i&&(r=(t[e-2]<<8)+t[e-1],o.push(n[r>>10]+n[r>>4&63]+n[r<<2&63]+"=")),o.join("")};for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=0,a=s.length;u<a;++u)n[u]=s[u],i[s.charCodeAt(u)]=u;function f(t){var r=t.length;if(r%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var e=t.indexOf("=");return-1===e&&(e=r),[e,e===r?0:4-e%4]}function h(t,r,e){for(var i,o,s=[],u=r;u<e;u+=3)i=(t[u]<<16&16711680)+(t[u+1]<<8&65280)+(255&t[u+2]),s.push(n[(o=i)>>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return s.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(t,r){r.read=function(t,r,e,n,i){var o,s,u=8*i-n-1,a=(1<<u)-1,f=a>>1,h=-7,l=e?i-1:0,c=e?-1:1,d=t[r+l];for(l+=c,o=d&(1<<-h)-1,d>>=-h,h+=u;h>0;o=256*o+t[r+l],l+=c,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=n;h>0;s=256*s+t[r+l],l+=c,h-=8);if(0===o)o=1-f;else{if(o===a)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,n),o-=f}return(d?-1:1)*s*Math.pow(2,o-n)},r.write=function(t,r,e,n,i,o){var s,u,a,f=8*o-i-1,h=(1<<f)-1,l=h>>1,c=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,m=r<0||0===r&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(u=isNaN(r)?1:0,s=h):(s=Math.floor(Math.log(r)/Math.LN2),r*(a=Math.pow(2,-s))<1&&(s--,a*=2),(r+=s+l>=1?c/a:c*Math.pow(2,1-l))*a>=2&&(s++,a/=2),s+l>=h?(u=0,s=h):s+l>=1?(u=(r*a-1)*Math.pow(2,i),s+=l):(u=r*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;t[e+d]=255&u,d+=p,u/=256,i-=8);for(s=s<<i|u,f+=i;f>0;t[e+d]=255&s,d+=p,s/=256,f-=8);t[e+d-p]|=128*m}},function(t,r){var e={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==e.call(t)}},function(t,r,e){"use strict";e.r(r),e.d(r,"__extends",function(){return i}),e.d(r,"__assign",function(){return o}),e.d(r,"__rest",function(){return s}),e.d(r,"__decorate",function(){return u}),e.d(r,"__param",function(){return a}),e.d(r,"__metadata",function(){return f}),e.d(r,"__awaiter",function(){return h}),e.d(r,"__generator",function(){return l}),e.d(r,"__exportStar",function(){return c}),e.d(r,"__values",function(){return d}),e.d(r,"__read",function(){return p}),e.d(r,"__spread",function(){return m}),e.d(r,"__spreadArrays",function(){return g}),e.d(r,"__await",function(){return v}),e.d(r,"__asyncGenerator",function(){return y}),e.d(r,"__asyncDelegator",function(){return w}),e.d(r,"__asyncValues",function(){return b}),e.d(r,"__makeTemplateObject",function(){return _}),e.d(r,"__importStar",function(){return M}),e.d(r,"__importDefault",function(){return E});
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0

THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.

See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
var n=function(t,r){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var e in r)r.hasOwnProperty(e)&&(t[e]=r[e])})(t,r)};function i(t,r){function e(){this.constructor=t}n(t,r),t.prototype=null===r?Object.create(r):(e.prototype=r.prototype,new e)}var o=function(){return(o=Object.assign||function(t){for(var r,e=1,n=arguments.length;e<n;e++)for(var i in r=arguments[e])Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i]);return t}).apply(this,arguments)};function s(t,r){var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&r.indexOf(n)<0&&(e[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(t);i<n.length;i++)r.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(e[n[i]]=t[n[i]])}return e}function u(t,r,e,n){var i,o=arguments.length,s=o<3?r:null===n?n=Object.getOwnPropertyDescriptor(r,e):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,r,e,n);else for(var u=t.length-1;u>=0;u--)(i=t[u])&&(s=(o<3?i(s):o>3?i(r,e,s):i(r,e))||s);return o>3&&s&&Object.defineProperty(r,e,s),s}function a(t,r){return function(e,n){r(e,n,t)}}function f(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)}function h(t,r,e,n){return new(e||(e=Promise))(function(i,o){function s(t){try{a(n.next(t))}catch(t){o(t)}}function u(t){try{a(n.throw(t))}catch(t){o(t)}}function a(t){t.done?i(t.value):new e(function(r){r(t.value)}).then(s,u)}a((n=n.apply(t,r||[])).next())})}function l(t,r){var e,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(o){return function(u){return function(o){if(e)throw new TypeError("Generator is already executing.");for(;s;)try{if(e=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=r.call(t,s)}catch(t){o=[6,t],n=0}finally{e=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}}function c(t,r){for(var e in t)r.hasOwnProperty(e)||(r[e]=t[e])}function d(t){var r="function"==typeof Symbol&&t[Symbol.iterator],e=0;return r?r.call(t):{next:function(){return t&&e>=t.length&&(t=void 0),{value:t&&t[e++],done:!t}}}}function p(t,r){var e="function"==typeof Symbol&&t[Symbol.iterator];if(!e)return t;var n,i,o=e.call(t),s=[];try{for(;(void 0===r||r-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(e=o.return)&&e.call(o)}finally{if(i)throw i.error}}return s}function m(){for(var t=[],r=0;r<arguments.length;r++)t=t.concat(p(arguments[r]));return t}function g(){for(var t=0,r=0,e=arguments.length;r<e;r++)t+=arguments[r].length;var n=Array(t),i=0;for(r=0;r<e;r++)for(var o=arguments[r],s=0,u=o.length;s<u;s++,i++)n[i]=o[s];return n}function v(t){return this instanceof v?(this.v=t,this):new v(t)}function y(t,r,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,i=e.apply(t,r||[]),o=[];return n={},s("next"),s("throw"),s("return"),n[Symbol.asyncIterator]=function(){return this},n;function s(t){i[t]&&(n[t]=function(r){return new Promise(function(e,n){o.push([t,r,e,n])>1||u(t,r)})})}function u(t,r){try{(e=i[t](r)).value instanceof v?Promise.resolve(e.value.v).then(a,f):h(o[0][2],e)}catch(t){h(o[0][3],t)}var e}function a(t){u("next",t)}function f(t){u("throw",t)}function h(t,r){t(r),o.shift(),o.length&&u(o[0][0],o[0][1])}}function w(t){var r,e;return r={},n("next"),n("throw",function(t){throw t}),n("return"),r[Symbol.iterator]=function(){return this},r;function n(n,i){r[n]=t[n]?function(r){return(e=!e)?{value:v(t[n](r)),done:"return"===n}:i?i(r):r}:i}}function b(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,e=t[Symbol.asyncIterator];return e?e.call(t):(t=d(t),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(e){r[e]=t[e]&&function(r){return new Promise(function(n,i){!function(t,r,e,n){Promise.resolve(n).then(function(r){t({value:r,done:e})},r)}(n,i,(r=t[e](r)).done,r.value)})}}}function _(t,r){return Object.defineProperty?Object.defineProperty(t,"raw",{value:r}):t.raw=r,t}function M(t){if(t&&t.__esModule)return t;var r={};if(null!=t)for(var e in t)Object.hasOwnProperty.call(t,e)&&(r[e]=t[e]);return r.default=t,r}function E(t){return t&&t.__esModule?t:{default:t}}},function(t,r,e){var n;!function(i){"use strict";var o,s=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator,a=Math.ceil,f=Math.floor,h="[BigNumber Error] ",l=h+"Number primitive has more than 15 significant digits: ",c=1e14,d=14,p=9007199254740991,m=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],g=1e7,v=1e9;function y(t){var r=0|t;return t>0||t===r?r:r-1}function w(t){for(var r,e,n=1,i=t.length,o=t[0]+"";n<i;){for(r=t[n++]+"",e=d-r.length;e--;r="0"+r);o+=r}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function b(t,r){var e,n,i=t.c,o=r.c,s=t.s,u=r.s,a=t.e,f=r.e;if(!s||!u)return null;if(e=i&&!i[0],n=o&&!o[0],e||n)return e?n?0:-u:s;if(s!=u)return s;if(e=s<0,n=a==f,!i||!o)return n?0:!i^e?1:-1;if(!n)return a>f^e?1:-1;for(u=(a=i.length)<(f=o.length)?a:f,s=0;s<u;s++)if(i[s]!=o[s])return i[s]>o[s]^e?1:-1;return a==f?0:a>f^e?1:-1}function _(t,r,e,n){if(t<r||t>e||t!==f(t))throw Error(h+(n||"Argument")+("number"==typeof t?t<r||t>e?" out of range: ":" not an integer: ":" not a primitive number: ")+String(t))}function M(t){var r=t.c.length-1;return y(t.e/d)==r&&t.c[r]%2!=0}function E(t,r){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(r<0?"e":"e+")+r}function S(t,r,e){var n,i;if(r<0){for(i=e+".";++r;i+=e);t=i+t}else if(++r>(n=t.length)){for(i=e,r-=n;--r;i+=e);t+=i}else r<n&&(t=t.slice(0,r)+"."+t.slice(r));return t}(o=function t(r){var e,n,i,o,A,R,O,N,B,x=G.prototype={constructor:G,toString:null,valueOf:null},I=new G(1),P=20,T=4,U=-7,C=21,k=-1e7,D=1e7,F=!1,j=1,L=0,q={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},H="0123456789abcdefghijklmnopqrstuvwxyz";function G(t,r){var e,o,u,a,h,c,m,g,v=this;if(!(v instanceof G))return new G(t,r);if(null==r){if(t&&!0===t._isBigNumber)return v.s=t.s,void(!t.c||t.e>D?v.c=v.e=null:t.e<k?v.c=[v.e=0]:(v.e=t.e,v.c=t.c.slice()));if((c="number"==typeof t)&&0*t==0){if(v.s=1/t<0?(t=-t,-1):1,t===~~t){for(a=0,h=t;h>=10;h/=10,a++);return void(a>D?v.c=v.e=null:(v.e=a,v.c=[t]))}g=String(t)}else{if(!s.test(g=String(t)))return i(v,g,c);v.s=45==g.charCodeAt(0)?(g=g.slice(1),-1):1}(a=g.indexOf("."))>-1&&(g=g.replace(".","")),(h=g.search(/e/i))>0?(a<0&&(a=h),a+=+g.slice(h+1),g=g.substring(0,h)):a<0&&(a=g.length)}else{if(_(r,2,H.length,"Base"),10==r)return V(v=new G(t),P+v.e+1,T);if(g=String(t),c="number"==typeof t){if(0*t!=0)return i(v,g,c,r);if(v.s=1/t<0?(g=g.slice(1),-1):1,G.DEBUG&&g.replace(/^0\.0*|\./,"").length>15)throw Error(l+t)}else v.s=45===g.charCodeAt(0)?(g=g.slice(1),-1):1;for(e=H.slice(0,r),a=h=0,m=g.length;h<m;h++)if(e.indexOf(o=g.charAt(h))<0){if("."==o){if(h>a){a=m;continue}}else if(!u&&(g==g.toUpperCase()&&(g=g.toLowerCase())||g==g.toLowerCase()&&(g=g.toUpperCase()))){u=!0,h=-1,a=0;continue}return i(v,String(t),c,r)}c=!1,(a=(g=n(g,r,10,v.s)).indexOf("."))>-1?g=g.replace(".",""):a=g.length}for(h=0;48===g.charCodeAt(h);h++);for(m=g.length;48===g.charCodeAt(--m););if(g=g.slice(h,++m)){if(m-=h,c&&G.DEBUG&&m>15&&(t>p||t!==f(t)))throw Error(l+v.s*t);if((a=a-h-1)>D)v.c=v.e=null;else if(a<k)v.c=[v.e=0];else{if(v.e=a,v.c=[],h=(a+1)%d,a<0&&(h+=d),h<m){for(h&&v.c.push(+g.slice(0,h)),m-=d;h<m;)v.c.push(+g.slice(h,h+=d));h=d-(g=g.slice(h)).length}else h-=m;for(;h--;g+="0");v.c.push(+g)}}else v.c=[v.e=0]}function z(t,r,e,n){var i,o,s,u,a;if(null==e?e=T:_(e,0,8),!t.c)return t.toString();if(i=t.c[0],s=t.e,null==r)a=w(t.c),a=1==n||2==n&&(s<=U||s>=C)?E(a,s):S(a,s,"0");else if(o=(t=V(new G(t),r,e)).e,u=(a=w(t.c)).length,1==n||2==n&&(r<=o||o<=U)){for(;u<r;a+="0",u++);a=E(a,o)}else if(r-=s,a=S(a,o,"0"),o+1>u){if(--r>0)for(a+=".";r--;a+="0");}else if((r+=o-u)>0)for(o+1==u&&(a+=".");r--;a+="0");return t.s<0&&i?"-"+a:a}function Y(t,r){for(var e,n=1,i=new G(t[0]);n<t.length;n++){if(!(e=new G(t[n])).s){i=e;break}r.call(i,e)&&(i=e)}return i}function Z(t,r,e){for(var n=1,i=r.length;!r[--i];r.pop());for(i=r[0];i>=10;i/=10,n++);return(e=n+e*d-1)>D?t.c=t.e=null:e<k?t.c=[t.e=0]:(t.e=e,t.c=r),t}function V(t,r,e,n){var i,o,s,u,h,l,p,g=t.c,v=m;if(g){t:{for(i=1,u=g[0];u>=10;u/=10,i++);if((o=r-i)<0)o+=d,s=r,p=(h=g[l=0])/v[i-s-1]%10|0;else if((l=a((o+1)/d))>=g.length){if(!n)break t;for(;g.length<=l;g.push(0));h=p=0,i=1,s=(o%=d)-d+1}else{for(h=u=g[l],i=1;u>=10;u/=10,i++);p=(s=(o%=d)-d+i)<0?0:h/v[i-s-1]%10|0}if(n=n||r<0||null!=g[l+1]||(s<0?h:h%v[i-s-1]),n=e<4?(p||n)&&(0==e||e==(t.s<0?3:2)):p>5||5==p&&(4==e||n||6==e&&(o>0?s>0?h/v[i-s]:0:g[l-1])%10&1||e==(t.s<0?8:7)),r<1||!g[0])return g.length=0,n?(r-=t.e+1,g[0]=v[(d-r%d)%d],t.e=-r||0):g[0]=t.e=0,t;if(0==o?(g.length=l,u=1,l--):(g.length=l+1,u=v[d-o],g[l]=s>0?f(h/v[i-s]%v[s])*u:0),n)for(;;){if(0==l){for(o=1,s=g[0];s>=10;s/=10,o++);for(s=g[0]+=u,u=1;s>=10;s/=10,u++);o!=u&&(t.e++,g[0]==c&&(g[0]=1));break}if(g[l]+=u,g[l]!=c)break;g[l--]=0,u=1}for(o=g.length;0===g[--o];g.pop());}t.e>D?t.c=t.e=null:t.e<k&&(t.c=[t.e=0])}return t}function J(t){var r,e=t.e;return null===e?t.toString():(r=w(t.c),r=e<=U||e>=C?E(r,e):S(r,e,"0"),t.s<0?"-"+r:r)}return G.clone=t,G.ROUND_UP=0,G.ROUND_DOWN=1,G.ROUND_CEIL=2,G.ROUND_FLOOR=3,G.ROUND_HALF_UP=4,G.ROUND_HALF_DOWN=5,G.ROUND_HALF_EVEN=6,G.ROUND_HALF_CEIL=7,G.ROUND_HALF_FLOOR=8,G.EUCLID=9,G.config=G.set=function(t){var r,e;if(null!=t){if("object"!=typeof t)throw Error(h+"Object expected: "+t);if(t.hasOwnProperty(r="DECIMAL_PLACES")&&(_(e=t[r],0,v,r),P=e),t.hasOwnProperty(r="ROUNDING_MODE")&&(_(e=t[r],0,8,r),T=e),t.hasOwnProperty(r="EXPONENTIAL_AT")&&((e=t[r])&&e.pop?(_(e[0],-v,0,r),_(e[1],0,v,r),U=e[0],C=e[1]):(_(e,-v,v,r),U=-(C=e<0?-e:e))),t.hasOwnProperty(r="RANGE"))if((e=t[r])&&e.pop)_(e[0],-v,-1,r),_(e[1],1,v,r),k=e[0],D=e[1];else{if(_(e,-v,v,r),!e)throw Error(h+r+" cannot be zero: "+e);k=-(D=e<0?-e:e)}if(t.hasOwnProperty(r="CRYPTO")){if((e=t[r])!==!!e)throw Error(h+r+" not true or false: "+e);if(e){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw F=!e,Error(h+"crypto unavailable");F=e}else F=e}if(t.hasOwnProperty(r="MODULO_MODE")&&(_(e=t[r],0,9,r),j=e),t.hasOwnProperty(r="POW_PRECISION")&&(_(e=t[r],0,v,r),L=e),t.hasOwnProperty(r="FORMAT")){if("object"!=typeof(e=t[r]))throw Error(h+r+" not an object: "+e);q=e}if(t.hasOwnProperty(r="ALPHABET")){if("string"!=typeof(e=t[r])||/^.$|[+-.\s]|(.).*\1/.test(e))throw Error(h+r+" invalid: "+e);H=e}}return{DECIMAL_PLACES:P,ROUNDING_MODE:T,EXPONENTIAL_AT:[U,C],RANGE:[k,D],CRYPTO:F,MODULO_MODE:j,POW_PRECISION:L,FORMAT:q,ALPHABET:H}},G.isBigNumber=function(t){if(!t||!0!==t._isBigNumber)return!1;if(!G.DEBUG)return!0;var r,e,n=t.c,i=t.e,o=t.s;t:if("[object Array]"=={}.toString.call(n)){if((1===o||-1===o)&&i>=-v&&i<=v&&i===f(i)){if(0===n[0]){if(0===i&&1===n.length)return!0;break t}if((r=(i+1)%d)<1&&(r+=d),String(n[0]).length==r){for(r=0;r<n.length;r++)if((e=n[r])<0||e>=c||e!==f(e))break t;if(0!==e)return!0}}}else if(null===n&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(h+"Invalid BigNumber: "+t)},G.maximum=G.max=function(){return Y(arguments,x.lt)},G.minimum=G.min=function(){return Y(arguments,x.gt)},G.random=(o=9007199254740992*Math.random()&2097151?function(){return f(9007199254740992*Math.random())}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(t){var r,e,n,i,s,u=0,l=[],c=new G(I);if(null==t?t=P:_(t,0,v),i=a(t/d),F)if(crypto.getRandomValues){for(r=crypto.getRandomValues(new Uint32Array(i*=2));u<i;)(s=131072*r[u]+(r[u+1]>>>11))>=9e15?(e=crypto.getRandomValues(new Uint32Array(2)),r[u]=e[0],r[u+1]=e[1]):(l.push(s%1e14),u+=2);u=i/2}else{if(!crypto.randomBytes)throw F=!1,Error(h+"crypto unavailable");for(r=crypto.randomBytes(i*=7);u<i;)(s=281474976710656*(31&r[u])+1099511627776*r[u+1]+4294967296*r[u+2]+16777216*r[u+3]+(r[u+4]<<16)+(r[u+5]<<8)+r[u+6])>=9e15?crypto.randomBytes(7).copy(r,u):(l.push(s%1e14),u+=7);u=i/7}if(!F)for(;u<i;)(s=o())<9e15&&(l[u++]=s%1e14);for(i=l[--u],t%=d,i&&t&&(s=m[d-t],l[u]=f(i/s)*s);0===l[u];l.pop(),u--);if(u<0)l=[n=0];else{for(n=-1;0===l[0];l.splice(0,1),n-=d);for(u=1,s=l[0];s>=10;s/=10,u++);u<d&&(n-=d-u)}return c.e=n,c.c=l,c}),G.sum=function(){for(var t=1,r=arguments,e=new G(r[0]);t<r.length;)e=e.plus(r[t++]);return e},n=function(){function t(t,r,e,n){for(var i,o,s=[0],u=0,a=t.length;u<a;){for(o=s.length;o--;s[o]*=r);for(s[0]+=n.indexOf(t.charAt(u++)),i=0;i<s.length;i++)s[i]>e-1&&(null==s[i+1]&&(s[i+1]=0),s[i+1]+=s[i]/e|0,s[i]%=e)}return s.reverse()}return function(r,n,i,o,s){var u,a,f,h,l,c,d,p,m=r.indexOf("."),g=P,v=T;for(m>=0&&(h=L,L=0,r=r.replace(".",""),c=(p=new G(n)).pow(r.length-m),L=h,p.c=t(S(w(c.c),c.e,"0"),10,i,"0123456789"),p.e=p.c.length),f=h=(d=t(r,n,i,s?(u=H,"0123456789"):(u="0123456789",H))).length;0==d[--h];d.pop());if(!d[0])return u.charAt(0);if(m<0?--f:(c.c=d,c.e=f,c.s=o,d=(c=e(c,p,g,v,i)).c,l=c.r,f=c.e),m=d[a=f+g+1],h=i/2,l=l||a<0||null!=d[a+1],l=v<4?(null!=m||l)&&(0==v||v==(c.s<0?3:2)):m>h||m==h&&(4==v||l||6==v&&1&d[a-1]||v==(c.s<0?8:7)),a<1||!d[0])r=l?S(u.charAt(1),-g,u.charAt(0)):u.charAt(0);else{if(d.length=a,l)for(--i;++d[--a]>i;)d[a]=0,a||(++f,d=[1].concat(d));for(h=d.length;!d[--h];);for(m=0,r="";m<=h;r+=u.charAt(d[m++]));r=S(r,f,u.charAt(0))}return r}}(),e=function(){function t(t,r,e){var n,i,o,s,u=0,a=t.length,f=r%g,h=r/g|0;for(t=t.slice();a--;)u=((i=f*(o=t[a]%g)+(n=h*o+(s=t[a]/g|0)*f)%g*g+u)/e|0)+(n/g|0)+h*s,t[a]=i%e;return u&&(t=[u].concat(t)),t}function r(t,r,e,n){var i,o;if(e!=n)o=e>n?1:-1;else for(i=o=0;i<e;i++)if(t[i]!=r[i]){o=t[i]>r[i]?1:-1;break}return o}function e(t,r,e,n){for(var i=0;e--;)t[e]-=i,i=t[e]<r[e]?1:0,t[e]=i*n+t[e]-r[e];for(;!t[0]&&t.length>1;t.splice(0,1));}return function(n,i,o,s,u){var a,h,l,p,m,g,v,w,b,_,M,E,S,A,R,O,N,B=n.s==i.s?1:-1,x=n.c,I=i.c;if(!(x&&x[0]&&I&&I[0]))return new G(n.s&&i.s&&(x?!I||x[0]!=I[0]:I)?x&&0==x[0]||!I?0*B:B/0:NaN);for(b=(w=new G(B)).c=[],B=o+(h=n.e-i.e)+1,u||(u=c,h=y(n.e/d)-y(i.e/d),B=B/d|0),l=0;I[l]==(x[l]||0);l++);if(I[l]>(x[l]||0)&&h--,B<0)b.push(1),p=!0;else{for(A=x.length,O=I.length,l=0,B+=2,(m=f(u/(I[0]+1)))>1&&(I=t(I,m,u),x=t(x,m,u),O=I.length,A=x.length),S=O,M=(_=x.slice(0,O)).length;M<O;_[M++]=0);N=I.slice(),N=[0].concat(N),R=I[0],I[1]>=u/2&&R++;do{if(m=0,(a=r(I,_,O,M))<0){if(E=_[0],O!=M&&(E=E*u+(_[1]||0)),(m=f(E/R))>1)for(m>=u&&(m=u-1),v=(g=t(I,m,u)).length,M=_.length;1==r(g,_,v,M);)m--,e(g,O<v?N:I,v,u),v=g.length,a=1;else 0==m&&(a=m=1),v=(g=I.slice()).length;if(v<M&&(g=[0].concat(g)),e(_,g,M,u),M=_.length,-1==a)for(;r(I,_,O,M)<1;)m++,e(_,O<M?N:I,M,u),M=_.length}else 0===a&&(m++,_=[0]);b[l++]=m,_[0]?_[M++]=x[S]||0:(_=[x[S]],M=1)}while((S++<A||null!=_[0])&&B--);p=null!=_[0],b[0]||b.splice(0,1)}if(u==c){for(l=1,B=b[0];B>=10;B/=10,l++);V(w,o+(w.e=l+h*d-1)+1,s,p)}else w.e=h,w.r=+p;return w}}(),A=/^(-?)0([xbo])(?=\w[\w.]*$)/i,R=/^([^.]+)\.$/,O=/^\.([^.]+)$/,N=/^-?(Infinity|NaN)$/,B=/^\s*\+(?=[\w.])|^\s+|\s+$/g,i=function(t,r,e,n){var i,o=e?r:r.replace(B,"");if(N.test(o))t.s=isNaN(o)?null:o<0?-1:1;else{if(!e&&(o=o.replace(A,function(t,r,e){return i="x"==(e=e.toLowerCase())?16:"b"==e?2:8,n&&n!=i?t:r}),n&&(i=n,o=o.replace(R,"$1").replace(O,"0.$1")),r!=o))return new G(o,i);if(G.DEBUG)throw Error(h+"Not a"+(n?" base "+n:"")+" number: "+r);t.s=null}t.c=t.e=null},x.absoluteValue=x.abs=function(){var t=new G(this);return t.s<0&&(t.s=1),t},x.comparedTo=function(t,r){return b(this,new G(t,r))},x.decimalPlaces=x.dp=function(t,r){var e,n,i,o=this;if(null!=t)return _(t,0,v),null==r?r=T:_(r,0,8),V(new G(o),t+o.e+1,r);if(!(e=o.c))return null;if(n=((i=e.length-1)-y(this.e/d))*d,i=e[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},x.dividedBy=x.div=function(t,r){return e(this,new G(t,r),P,T)},x.dividedToIntegerBy=x.idiv=function(t,r){return e(this,new G(t,r),0,1)},x.exponentiatedBy=x.pow=function(t,r){var e,n,i,o,s,u,l,c,p=this;if((t=new G(t)).c&&!t.isInteger())throw Error(h+"Exponent not an integer: "+J(t));if(null!=r&&(r=new G(r)),s=t.e>14,!p.c||!p.c[0]||1==p.c[0]&&!p.e&&1==p.c.length||!t.c||!t.c[0])return c=new G(Math.pow(+J(p),s?2-M(t):+J(t))),r?c.mod(r):c;if(u=t.s<0,r){if(r.c?!r.c[0]:!r.s)return new G(NaN);(n=!u&&p.isInteger()&&r.isInteger())&&(p=p.mod(r))}else{if(t.e>9&&(p.e>0||p.e<-1||(0==p.e?p.c[0]>1||s&&p.c[1]>=24e7:p.c[0]<8e13||s&&p.c[0]<=9999975e7)))return o=p.s<0&&M(t)?-0:0,p.e>-1&&(o=1/o),new G(u?1/o:o);L&&(o=a(L/d+2))}for(s?(e=new G(.5),u&&(t.s=1),l=M(t)):l=(i=Math.abs(+J(t)))%2,c=new G(I);;){if(l){if(!(c=c.times(p)).c)break;o?c.c.length>o&&(c.c.length=o):n&&(c=c.mod(r))}if(i){if(0===(i=f(i/2)))break;l=i%2}else if(V(t=t.times(e),t.e+1,1),t.e>14)l=M(t);else{if(0==(i=+J(t)))break;l=i%2}p=p.times(p),o?p.c&&p.c.length>o&&(p.c.length=o):n&&(p=p.mod(r))}return n?c:(u&&(c=I.div(c)),r?c.mod(r):o?V(c,L,T,void 0):c)},x.integerValue=function(t){var r=new G(this);return null==t?t=T:_(t,0,8),V(r,r.e+1,t)},x.isEqualTo=x.eq=function(t,r){return 0===b(this,new G(t,r))},x.isFinite=function(){return!!this.c},x.isGreaterThan=x.gt=function(t,r){return b(this,new G(t,r))>0},x.isGreaterThanOrEqualTo=x.gte=function(t,r){return 1===(r=b(this,new G(t,r)))||0===r},x.isInteger=function(){return!!this.c&&y(this.e/d)>this.c.length-2},x.isLessThan=x.lt=function(t,r){return b(this,new G(t,r))<0},x.isLessThanOrEqualTo=x.lte=function(t,r){return-1===(r=b(this,new G(t,r)))||0===r},x.isNaN=function(){return!this.s},x.isNegative=function(){return this.s<0},x.isPositive=function(){return this.s>0},x.isZero=function(){return!!this.c&&0==this.c[0]},x.minus=function(t,r){var e,n,i,o,s=this,u=s.s;if(r=(t=new G(t,r)).s,!u||!r)return new G(NaN);if(u!=r)return t.s=-r,s.plus(t);var a=s.e/d,f=t.e/d,h=s.c,l=t.c;if(!a||!f){if(!h||!l)return h?(t.s=-r,t):new G(l?s:NaN);if(!h[0]||!l[0])return l[0]?(t.s=-r,t):new G(h[0]?s:3==T?-0:0)}if(a=y(a),f=y(f),h=h.slice(),u=a-f){for((o=u<0)?(u=-u,i=h):(f=a,i=l),i.reverse(),r=u;r--;i.push(0));i.reverse()}else for(n=(o=(u=h.length)<(r=l.length))?u:r,u=r=0;r<n;r++)if(h[r]!=l[r]){o=h[r]<l[r];break}if(o&&(i=h,h=l,l=i,t.s=-t.s),(r=(n=l.length)-(e=h.length))>0)for(;r--;h[e++]=0);for(r=c-1;n>u;){if(h[--n]<l[n]){for(e=n;e&&!h[--e];h[e]=r);--h[e],h[n]+=c}h[n]-=l[n]}for(;0==h[0];h.splice(0,1),--f);return h[0]?Z(t,h,f):(t.s=3==T?-1:1,t.c=[t.e=0],t)},x.modulo=x.mod=function(t,r){var n,i,o=this;return t=new G(t,r),!o.c||!t.s||t.c&&!t.c[0]?new G(NaN):!t.c||o.c&&!o.c[0]?new G(o):(9==j?(i=t.s,t.s=1,n=e(o,t,0,3),t.s=i,n.s*=i):n=e(o,t,0,j),(t=o.minus(n.times(t))).c[0]||1!=j||(t.s=o.s),t)},x.multipliedBy=x.times=function(t,r){var e,n,i,o,s,u,a,f,h,l,p,m,v,w,b,_=this,M=_.c,E=(t=new G(t,r)).c;if(!(M&&E&&M[0]&&E[0]))return!_.s||!t.s||M&&!M[0]&&!E||E&&!E[0]&&!M?t.c=t.e=t.s=null:(t.s*=_.s,M&&E?(t.c=[0],t.e=0):t.c=t.e=null),t;for(n=y(_.e/d)+y(t.e/d),t.s*=_.s,(a=M.length)<(l=E.length)&&(v=M,M=E,E=v,i=a,a=l,l=i),i=a+l,v=[];i--;v.push(0));for(w=c,b=g,i=l;--i>=0;){for(e=0,p=E[i]%b,m=E[i]/b|0,o=i+(s=a);o>i;)e=((f=p*(f=M[--s]%b)+(u=m*f+(h=M[s]/b|0)*p)%b*b+v[o]+e)/w|0)+(u/b|0)+m*h,v[o--]=f%w;v[o]=e}return e?++n:v.splice(0,1),Z(t,v,n)},x.negated=function(){var t=new G(this);return t.s=-t.s||null,t},x.plus=function(t,r){var e,n=this,i=n.s;if(r=(t=new G(t,r)).s,!i||!r)return new G(NaN);if(i!=r)return t.s=-r,n.minus(t);var o=n.e/d,s=t.e/d,u=n.c,a=t.c;if(!o||!s){if(!u||!a)return new G(i/0);if(!u[0]||!a[0])return a[0]?t:new G(u[0]?n:0*i)}if(o=y(o),s=y(s),u=u.slice(),i=o-s){for(i>0?(s=o,e=a):(i=-i,e=u),e.reverse();i--;e.push(0));e.reverse()}for((i=u.length)-(r=a.length)<0&&(e=a,a=u,u=e,r=i),i=0;r;)i=(u[--r]=u[r]+a[r]+i)/c|0,u[r]=c===u[r]?0:u[r]%c;return i&&(u=[i].concat(u),++s),Z(t,u,s)},x.precision=x.sd=function(t,r){var e,n,i,o=this;if(null!=t&&t!==!!t)return _(t,1,v),null==r?r=T:_(r,0,8),V(new G(o),t,r);if(!(e=o.c))return null;if(n=(i=e.length-1)*d+1,i=e[i]){for(;i%10==0;i/=10,n--);for(i=e[0];i>=10;i/=10,n++);}return t&&o.e+1>n&&(n=o.e+1),n},x.shiftedBy=function(t){return _(t,-p,p),this.times("1e"+t)},x.squareRoot=x.sqrt=function(){var t,r,n,i,o,s=this,u=s.c,a=s.s,f=s.e,h=P+4,l=new G("0.5");if(1!==a||!u||!u[0])return new G(!a||a<0&&(!u||u[0])?NaN:u?s:1/0);if(0==(a=Math.sqrt(+J(s)))||a==1/0?(((r=w(u)).length+f)%2==0&&(r+="0"),a=Math.sqrt(+r),f=y((f+1)/2)-(f<0||f%2),n=new G(r=a==1/0?"1e"+f:(r=a.toExponential()).slice(0,r.indexOf("e")+1)+f)):n=new G(a+""),n.c[0])for((a=(f=n.e)+h)<3&&(a=0);;)if(o=n,n=l.times(o.plus(e(s,o,h,1))),w(o.c).slice(0,a)===(r=w(n.c)).slice(0,a)){if(n.e<f&&--a,"9999"!=(r=r.slice(a-3,a+1))&&(i||"4999"!=r)){+r&&(+r.slice(1)||"5"!=r.charAt(0))||(V(n,n.e+P+2,1),t=!n.times(n).eq(s));break}if(!i&&(V(o,o.e+P+2,0),o.times(o).eq(s))){n=o;break}h+=4,a+=4,i=1}return V(n,n.e+P+1,T,t)},x.toExponential=function(t,r){return null!=t&&(_(t,0,v),t++),z(this,t,r,1)},x.toFixed=function(t,r){return null!=t&&(_(t,0,v),t=t+this.e+1),z(this,t,r)},x.toFormat=function(t,r,e){var n,i=this;if(null==e)null!=t&&r&&"object"==typeof r?(e=r,r=null):t&&"object"==typeof t?(e=t,t=r=null):e=q;else if("object"!=typeof e)throw Error(h+"Argument not an object: "+e);if(n=i.toFixed(t,r),i.c){var o,s=n.split("."),u=+e.groupSize,a=+e.secondaryGroupSize,f=e.groupSeparator||"",l=s[0],c=s[1],d=i.s<0,p=d?l.slice(1):l,m=p.length;if(a&&(o=u,u=a,a=o,m-=o),u>0&&m>0){for(o=m%u||u,l=p.substr(0,o);o<m;o+=u)l+=f+p.substr(o,u);a>0&&(l+=f+p.slice(o)),d&&(l="-"+l)}n=c?l+(e.decimalSeparator||"")+((a=+e.fractionGroupSize)?c.replace(new RegExp("\\d{"+a+"}\\B","g"),"$&"+(e.fractionGroupSeparator||"")):c):l}return(e.prefix||"")+n+(e.suffix||"")},x.toFraction=function(t){var r,n,i,o,s,u,a,f,l,c,p,g,v=this,y=v.c;if(null!=t&&(!(a=new G(t)).isInteger()&&(a.c||1!==a.s)||a.lt(I)))throw Error(h+"Argument "+(a.isInteger()?"out of range: ":"not an integer: ")+J(a));if(!y)return new G(v);for(r=new G(I),l=n=new G(I),i=f=new G(I),g=w(y),s=r.e=g.length-v.e-1,r.c[0]=m[(u=s%d)<0?d+u:u],t=!t||a.comparedTo(r)>0?s>0?r:l:a,u=D,D=1/0,a=new G(g),f.c[0]=0;c=e(a,r,0,1),1!=(o=n.plus(c.times(i))).comparedTo(t);)n=i,i=o,l=f.plus(c.times(o=l)),f=o,r=a.minus(c.times(o=r)),a=o;return o=e(t.minus(n),i,0,1),f=f.plus(o.times(l)),n=n.plus(o.times(i)),f.s=l.s=v.s,p=e(l,i,s*=2,T).minus(v).abs().comparedTo(e(f,n,s,T).minus(v).abs())<1?[l,i]:[f,n],D=u,p},x.toNumber=function(){return+J(this)},x.toPrecision=function(t,r){return null!=t&&_(t,1,v),z(this,t,r,2)},x.toString=function(t){var r,e=this,i=e.s,o=e.e;return null===o?i?(r="Infinity",i<0&&(r="-"+r)):r="NaN":(null==t?r=o<=U||o>=C?E(w(e.c),o):S(w(e.c),o,"0"):10===t?r=S(w((e=V(new G(e),P+o+1,T)).c),e.e,"0"):(_(t,2,H.length,"Base"),r=n(S(w(e.c),o,"0"),10,t,i,!0)),i<0&&e.c[0]&&(r="-"+r)),r},x.valueOf=x.toJSON=function(){return J(this)},x._isBigNumber=!0,u&&(x[Symbol.toStringTag]="BigNumber",x[Symbol.for("nodejs.util.inspect.custom")]=x.valueOf),null!=r&&G.set(r),G}()).default=o.BigNumber=o,void 0===(n=function(){return o}.call(r,e,r,t))||(t.exports=n)}()},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.version="logger/5.0.0-beta.128"},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.version="bytes/5.0.0-beta.128"},function(t,r,e){"use strict";var n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var r={};if(null!=t)for(var e in t)Object.hasOwnProperty.call(t,e)&&(r[e]=t[e]);return r.default=t,r};Object.defineProperty(r,"__esModule",{value:!0});var i=n(e(4)),o=e(0),s=e(19),u=e(22),a=e(1),f=e(23),h=new a.Logger(f.version);function l(t){o.isHexString(t,20)||h.throwArgumentError("invalid address","address",t);for(var r=(t=t.toLowerCase()).substring(2).split(""),e=new Uint8Array(40),n=0;n<40;n++)e[n]=r[n].charCodeAt(0);for(e=o.arrayify(s.keccak256(e)),n=0;n<40;n+=2)e[n>>1]>>4>=8&&(r[n]=r[n].toUpperCase()),(15&e[n>>1])>=8&&(r[n+1]=r[n+1].toUpperCase());return"0x"+r.join("")}for(var c={},d=0;d<10;d++)c[String(d)]=String(d);for(d=0;d<26;d++)c[String.fromCharCode(65+d)]=String(10+d);var p,m=Math.floor((p=9007199254740991,Math.log10?Math.log10(p):Math.log(p)/Math.LN10));function g(t){t=(t=t.toUpperCase()).substring(4)+t.substring(0,2)+"00";var r="";for(t.split("").forEach(function(t){r+=c[t]});r.length>=m;){var e=r.substring(0,m);r=parseInt(e,10)%97+r.substring(e.length)}for(var n=String(98-parseInt(r,10)%97);n.length<2;)n="0"+n;return n}function v(t){var r=null;if("string"!=typeof t&&h.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==t.substring(0,2)&&(t="0x"+t),r=l(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&r!==t&&h.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==g(t)&&h.throwArgumentError("bad icap checksum","address",t),r=new i.BN(t.substring(4),36).toString(16);r.length<40;)r="0"+r;r=l("0x"+r)}else h.throwArgumentError("invalid address","address",t);return r}r.getAddress=v,r.isAddress=function(t){try{return v(t),!0}catch(t){}return!1},r.getIcapAddress=function(t){for(var r=new i.BN(v(t).substring(2),16).toString(36).toUpperCase();r.length<30;)r="0"+r;return"XE"+g("XE00"+r)+r},r.getContractAddress=function(t){var r=null;try{r=v(t.from)}catch(r){h.throwArgumentError("missing from address","transaction",t)}var e=o.stripZeros(o.arrayify(t.nonce));return v(o.hexDataSlice(s.keccak256(u.encode([r,e])),12))}},function(t,r){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,r){},function(t,r,e){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(r,"__esModule",{value:!0});var i=n(e(20)),o=e(0);r.keccak256=function(t){return"0x"+i.default.keccak_256(o.arrayify(t))}},function(t,r,e){(function(r,e){
/**
 * [js-sha3]{@link https://github.com/emn178/js-sha3}
 *
 * @version 0.5.7
 * @author Chen, Yi-Cyuan [emn178@gmail.com]
 * @copyright Chen, Yi-Cyuan 2015-2016
 * @license MIT
 */
!function(){"use strict";var n="object"==typeof window?window:{};!n.JS_SHA3_NO_NODE_JS&&"object"==typeof r&&r.versions&&r.versions.node&&(n=e);for(var i=!n.JS_SHA3_NO_COMMON_JS&&"object"==typeof t&&t.exports,o="0123456789abcdef".split(""),s=[0,8,16,24],u=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],a=[224,256,384,512],f=["hex","buffer","arrayBuffer","array"],h=function(t,r,e){return function(n){return new _(t,r,t).update(n)[e]()}},l=function(t,r,e){return function(n,i){return new _(t,r,i).update(n)[e]()}},c=function(t,r){var e=h(t,r,"hex");e.create=function(){return new _(t,r,t)},e.update=function(t){return e.create().update(t)};for(var n=0;n<f.length;++n){var i=f[n];e[i]=h(t,r,i)}return e},d=[{name:"keccak",padding:[1,256,65536,16777216],bits:a,createMethod:c},{name:"sha3",padding:[6,1536,393216,100663296],bits:a,createMethod:c},{name:"shake",padding:[31,7936,2031616,520093696],bits:[128,256],createMethod:function(t,r){var e=l(t,r,"hex");e.create=function(e){return new _(t,r,e)},e.update=function(t,r){return e.create(r).update(t)};for(var n=0;n<f.length;++n){var i=f[n];e[i]=l(t,r,i)}return e}}],p={},m=[],g=0;g<d.length;++g)for(var v=d[g],y=v.bits,w=0;w<y.length;++w){var b=v.name+"_"+y[w];m.push(b),p[b]=v.createMethod(y[w],v.padding)}function _(t,r,e){this.blocks=[],this.s=[],this.padding=r,this.outputBits=e,this.reset=!0,this.block=0,this.start=0,this.blockCount=1600-(t<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=e>>5,this.extraBytes=(31&e)>>3;for(var n=0;n<50;++n)this.s[n]=0}_.prototype.update=function(t){var r="string"!=typeof t;r&&t.constructor===ArrayBuffer&&(t=new Uint8Array(t));for(var e,n,i=t.length,o=this.blocks,u=this.byteCount,a=this.blockCount,f=0,h=this.s;f<i;){if(this.reset)for(this.reset=!1,o[0]=this.block,e=1;e<a+1;++e)o[e]=0;if(r)for(e=this.start;f<i&&e<u;++f)o[e>>2]|=t[f]<<s[3&e++];else for(e=this.start;f<i&&e<u;++f)(n=t.charCodeAt(f))<128?o[e>>2]|=n<<s[3&e++]:n<2048?(o[e>>2]|=(192|n>>6)<<s[3&e++],o[e>>2]|=(128|63&n)<<s[3&e++]):n<55296||n>=57344?(o[e>>2]|=(224|n>>12)<<s[3&e++],o[e>>2]|=(128|n>>6&63)<<s[3&e++],o[e>>2]|=(128|63&n)<<s[3&e++]):(n=65536+((1023&n)<<10|1023&t.charCodeAt(++f)),o[e>>2]|=(240|n>>18)<<s[3&e++],o[e>>2]|=(128|n>>12&63)<<s[3&e++],o[e>>2]|=(128|n>>6&63)<<s[3&e++],o[e>>2]|=(128|63&n)<<s[3&e++]);if(this.lastByteIndex=e,e>=u){for(this.start=e-u,this.block=o[a],e=0;e<a;++e)h[e]^=o[e];M(h),this.reset=!0}else this.start=e}return this},_.prototype.finalize=function(){var t=this.blocks,r=this.lastByteIndex,e=this.blockCount,n=this.s;if(t[r>>2]|=this.padding[3&r],this.lastByteIndex===this.byteCount)for(t[0]=t[e],r=1;r<e+1;++r)t[r]=0;for(t[e-1]|=2147483648,r=0;r<e;++r)n[r]^=t[r];M(n)},_.prototype.toString=_.prototype.hex=function(){this.finalize();for(var t,r=this.blockCount,e=this.s,n=this.outputBlocks,i=this.extraBytes,s=0,u=0,a="";u<n;){for(s=0;s<r&&u<n;++s,++u)t=e[s],a+=o[t>>4&15]+o[15&t]+o[t>>12&15]+o[t>>8&15]+o[t>>20&15]+o[t>>16&15]+o[t>>28&15]+o[t>>24&15];u%r==0&&(M(e),s=0)}return i&&(t=e[s],i>0&&(a+=o[t>>4&15]+o[15&t]),i>1&&(a+=o[t>>12&15]+o[t>>8&15]),i>2&&(a+=o[t>>20&15]+o[t>>16&15])),a},_.prototype.arrayBuffer=function(){this.finalize();var t,r=this.blockCount,e=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,s=0,u=this.outputBits>>3;t=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(u);for(var a=new Uint32Array(t);s<n;){for(o=0;o<r&&s<n;++o,++s)a[s]=e[o];s%r==0&&M(e)}return i&&(a[o]=e[o],t=t.slice(0,u)),t},_.prototype.buffer=_.prototype.arrayBuffer,_.prototype.digest=_.prototype.array=function(){this.finalize();for(var t,r,e=this.blockCount,n=this.s,i=this.outputBlocks,o=this.extraBytes,s=0,u=0,a=[];u<i;){for(s=0;s<e&&u<i;++s,++u)t=u<<2,r=n[s],a[t]=255&r,a[t+1]=r>>8&255,a[t+2]=r>>16&255,a[t+3]=r>>24&255;u%e==0&&M(n)}return o&&(t=u<<2,r=n[s],o>0&&(a[t]=255&r),o>1&&(a[t+1]=r>>8&255),o>2&&(a[t+2]=r>>16&255)),a};var M=function(t){var r,e,n,i,o,s,a,f,h,l,c,d,p,m,g,v,y,w,b,_,M,E,S,A,R,O,N,B,x,I,P,T,U,C,k,D,F,j,L,q,H,G,z,Y,Z,V,J,W,K,$,X,Q,tt,rt,et,nt,it,ot,st,ut,at,ft,ht;for(n=0;n<48;n+=2)i=t[0]^t[10]^t[20]^t[30]^t[40],o=t[1]^t[11]^t[21]^t[31]^t[41],s=t[2]^t[12]^t[22]^t[32]^t[42],a=t[3]^t[13]^t[23]^t[33]^t[43],f=t[4]^t[14]^t[24]^t[34]^t[44],h=t[5]^t[15]^t[25]^t[35]^t[45],l=t[6]^t[16]^t[26]^t[36]^t[46],c=t[7]^t[17]^t[27]^t[37]^t[47],r=(d=t[8]^t[18]^t[28]^t[38]^t[48])^(s<<1|a>>>31),e=(p=t[9]^t[19]^t[29]^t[39]^t[49])^(a<<1|s>>>31),t[0]^=r,t[1]^=e,t[10]^=r,t[11]^=e,t[20]^=r,t[21]^=e,t[30]^=r,t[31]^=e,t[40]^=r,t[41]^=e,r=i^(f<<1|h>>>31),e=o^(h<<1|f>>>31),t[2]^=r,t[3]^=e,t[12]^=r,t[13]^=e,t[22]^=r,t[23]^=e,t[32]^=r,t[33]^=e,t[42]^=r,t[43]^=e,r=s^(l<<1|c>>>31),e=a^(c<<1|l>>>31),t[4]^=r,t[5]^=e,t[14]^=r,t[15]^=e,t[24]^=r,t[25]^=e,t[34]^=r,t[35]^=e,t[44]^=r,t[45]^=e,r=f^(d<<1|p>>>31),e=h^(p<<1|d>>>31),t[6]^=r,t[7]^=e,t[16]^=r,t[17]^=e,t[26]^=r,t[27]^=e,t[36]^=r,t[37]^=e,t[46]^=r,t[47]^=e,r=l^(i<<1|o>>>31),e=c^(o<<1|i>>>31),t[8]^=r,t[9]^=e,t[18]^=r,t[19]^=e,t[28]^=r,t[29]^=e,t[38]^=r,t[39]^=e,t[48]^=r,t[49]^=e,m=t[0],g=t[1],V=t[11]<<4|t[10]>>>28,J=t[10]<<4|t[11]>>>28,B=t[20]<<3|t[21]>>>29,x=t[21]<<3|t[20]>>>29,ut=t[31]<<9|t[30]>>>23,at=t[30]<<9|t[31]>>>23,G=t[40]<<18|t[41]>>>14,z=t[41]<<18|t[40]>>>14,C=t[2]<<1|t[3]>>>31,k=t[3]<<1|t[2]>>>31,v=t[13]<<12|t[12]>>>20,y=t[12]<<12|t[13]>>>20,W=t[22]<<10|t[23]>>>22,K=t[23]<<10|t[22]>>>22,I=t[33]<<13|t[32]>>>19,P=t[32]<<13|t[33]>>>19,ft=t[42]<<2|t[43]>>>30,ht=t[43]<<2|t[42]>>>30,rt=t[5]<<30|t[4]>>>2,et=t[4]<<30|t[5]>>>2,D=t[14]<<6|t[15]>>>26,F=t[15]<<6|t[14]>>>26,w=t[25]<<11|t[24]>>>21,b=t[24]<<11|t[25]>>>21,$=t[34]<<15|t[35]>>>17,X=t[35]<<15|t[34]>>>17,T=t[45]<<29|t[44]>>>3,U=t[44]<<29|t[45]>>>3,A=t[6]<<28|t[7]>>>4,R=t[7]<<28|t[6]>>>4,nt=t[17]<<23|t[16]>>>9,it=t[16]<<23|t[17]>>>9,j=t[26]<<25|t[27]>>>7,L=t[27]<<25|t[26]>>>7,_=t[36]<<21|t[37]>>>11,M=t[37]<<21|t[36]>>>11,Q=t[47]<<24|t[46]>>>8,tt=t[46]<<24|t[47]>>>8,Y=t[8]<<27|t[9]>>>5,Z=t[9]<<27|t[8]>>>5,O=t[18]<<20|t[19]>>>12,N=t[19]<<20|t[18]>>>12,ot=t[29]<<7|t[28]>>>25,st=t[28]<<7|t[29]>>>25,q=t[38]<<8|t[39]>>>24,H=t[39]<<8|t[38]>>>24,E=t[48]<<14|t[49]>>>18,S=t[49]<<14|t[48]>>>18,t[0]=m^~v&w,t[1]=g^~y&b,t[10]=A^~O&B,t[11]=R^~N&x,t[20]=C^~D&j,t[21]=k^~F&L,t[30]=Y^~V&W,t[31]=Z^~J&K,t[40]=rt^~nt&ot,t[41]=et^~it&st,t[2]=v^~w&_,t[3]=y^~b&M,t[12]=O^~B&I,t[13]=N^~x&P,t[22]=D^~j&q,t[23]=F^~L&H,t[32]=V^~W&$,t[33]=J^~K&X,t[42]=nt^~ot&ut,t[43]=it^~st&at,t[4]=w^~_&E,t[5]=b^~M&S,t[14]=B^~I&T,t[15]=x^~P&U,t[24]=j^~q&G,t[25]=L^~H&z,t[34]=W^~$&Q,t[35]=K^~X&tt,t[44]=ot^~ut&ft,t[45]=st^~at&ht,t[6]=_^~E&m,t[7]=M^~S&g,t[16]=I^~T&A,t[17]=P^~U&R,t[26]=q^~G&C,t[27]=H^~z&k,t[36]=$^~Q&Y,t[37]=X^~tt&Z,t[46]=ut^~ft&rt,t[47]=at^~ht&et,t[8]=E^~m&v,t[9]=S^~g&y,t[18]=T^~A&O,t[19]=U^~R&N,t[28]=G^~C&D,t[29]=z^~k&F,t[38]=Q^~Y&V,t[39]=tt^~Z&J,t[48]=ft^~rt&nt,t[49]=ht^~et&it,t[0]^=u[n],t[1]^=u[n+1]};if(i)t.exports=p;else for(g=0;g<m.length;++g)n[m[g]]=p[m[g]]}()}).call(this,e(21),e(3))},function(t,r){var e,n,i=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function u(t){if(e===setTimeout)return setTimeout(t,0);if((e===o||!e)&&setTimeout)return e=setTimeout,setTimeout(t,0);try{return e(t,0)}catch(r){try{return e.call(null,t,0)}catch(r){return e.call(this,t,0)}}}!function(){try{e="function"==typeof setTimeout?setTimeout:o}catch(t){e=o}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(t){n=s}}();var a,f=[],h=!1,l=-1;function c(){h&&a&&(h=!1,a.length?f=a.concat(f):l=-1,f.length&&d())}function d(){if(!h){var t=u(c);h=!0;for(var r=f.length;r;){for(a=f,f=[];++l<r;)a&&a[l].run();l=-1,r=f.length}a=null,h=!1,function(t){if(n===clearTimeout)return clearTimeout(t);if((n===s||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(t);try{n(t)}catch(r){try{return n.call(null,t)}catch(r){return n.call(this,t)}}}(t)}}function p(t,r){this.fun=t,this.array=r}function m(){}i.nextTick=function(t){var r=new Array(arguments.length-1);if(arguments.length>1)for(var e=1;e<arguments.length;e++)r[e-1]=arguments[e];f.push(new p(t,r)),1!==f.length||h||u(d)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=m,i.addListener=m,i.once=m,i.off=m,i.removeListener=m,i.removeAllListeners=m,i.emit=m,i.prependListener=m,i.prependOnceListener=m,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e(0);function i(t){for(var r=[];t;)r.unshift(255&t),t>>=8;return r}function o(t,r,e){for(var n=0,i=0;i<e;i++)n=256*n+t[r+i];return n}function s(t,r,e,n){for(var i=[];e<r+1+n;){var o=u(t,e);if(i.push(o.result),(e+=o.consumed)>r+1+n)throw new Error("invalid rlp")}return{consumed:1+n,result:i}}function u(t,r){if(0===t.length)throw new Error("invalid rlp data");if(t[r]>=248){if(r+1+(u=t[r]-247)>t.length)throw new Error("too short");var e=o(t,r+1,u);if(r+1+u+e>t.length)throw new Error("to short");return s(t,r,r+1+u,u+e)}if(t[r]>=192){var i=t[r]-192;if(r+1+i>t.length)throw new Error("invalid rlp data");return s(t,r,r+1,i)}if(t[r]>=184){var u;if(r+1+(u=t[r]-183)>t.length)throw new Error("invalid rlp data");var a=o(t,r+1,u);if(r+1+u+a>t.length)throw new Error("invalid rlp data");return{consumed:1+u+a,result:n.hexlify(t.slice(r+1+u,r+1+u+a))}}if(t[r]>=128){var f=t[r]-128;if(r+1+f>t.length)throw new Error("invlaid rlp data");return{consumed:1+f,result:n.hexlify(t.slice(r+1,r+1+f))}}return{consumed:1,result:n.hexlify(t[r])}}r.encode=function(t){return n.hexlify(function t(r){if(Array.isArray(r)){var e=[];if(r.forEach(function(r){e=e.concat(t(r))}),e.length<=55)return e.unshift(192+e.length),e;var o=i(e.length);return o.unshift(247+o.length),o.concat(e)}var s=Array.prototype.slice.call(n.arrayify(r));if(1===s.length&&s[0]<=127)return s;if(s.length<=55)return s.unshift(128+s.length),s;var u=i(s.length);return u.unshift(183+u.length),u.concat(s)}(t))},r.decode=function(t){var r=n.arrayify(t),e=u(r,0);if(e.consumed!==r.length)throw new Error("invalid rlp data");return e.result}},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.version="address/5.0.0-beta.127"},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e(25);r.formatBytes32String=n.formatBytes32String,r.parseBytes32String=n.parseBytes32String;var i=e(30);r.nameprep=i.nameprep;var o=e(2);r._toEscapedUtf8String=o._toEscapedUtf8String,r.toUtf8Bytes=o.toUtf8Bytes,r.toUtf8CodePoints=o.toUtf8CodePoints,r.toUtf8String=o.toUtf8String,r.UnicodeNormalizationForm=o.UnicodeNormalizationForm},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e(26),i=e(0),o=e(2);r.formatBytes32String=function(t){var r=o.toUtf8Bytes(t);if(r.length>31)throw new Error("bytes32 string must be less than 32 bytes");return i.hexlify(i.concat([r,n.HashZero]).slice(0,32))},r.parseBytes32String=function(t){var r=i.arrayify(t);if(32!==r.length)throw new Error("invalid bytes32 - not 32 bytes long");if(0!==r[31])throw new Error("invalid bytes32 string - no null terminator");for(var e=31;0===r[e-1];)e--;return o.toUtf8String(r.slice(0,e))}},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e(27);r.AddressZero="0x0000000000000000000000000000000000000000",r.HashZero="0x0000000000000000000000000000000000000000000000000000000000000000",r.EtherSymbol="Ξ";var i=n.BigNumber.from(-1);r.NegativeOne=i;var o=n.BigNumber.from(0);r.Zero=o;var s=n.BigNumber.from(1);r.One=s;var u=n.BigNumber.from(2);r.Two=u;var a=n.BigNumber.from("1000000000000000000");r.WeiPerEther=a;var f=n.BigNumber.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");r.MaxUint256=f},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e(5);r.BigNumber=n.BigNumber;var i=e(28);r.FixedNumber=i.FixedNumber},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e(0),i=e(1),o=e(6),s=new i.Logger(o.version),u=e(5),a={},f=u.BigNumber.from(0),h=u.BigNumber.from(-1);function l(t,r,e,n){var o={fault:r,operation:e};return void 0!==n&&(o.value=n),s.throwError(t,i.Logger.errors.NUMERIC_FAULT,o)}for(var c="0";c.length<256;)c+=c;function d(t){if("number"!=typeof t)try{t=u.BigNumber.from(t).toNumber()}catch(t){}return"number"==typeof t&&t>=0&&t<=256&&!(t%1)?"1"+c.substring(0,t):s.throwArgumentError("invalid decimal size","decimals",t)}function p(t,r){null==r&&(r=0);var e=d(r),n=(t=u.BigNumber.from(t)).lt(f);n&&(t=t.mul(h));for(var i=t.mod(e).toString();i.length<e.length-1;)i="0"+i;i=i.match(/^([0-9]*[1-9]|0)(0*)/)[1];var o=t.div(e).toString();return t=o+"."+i,n&&(t="-"+t),t}function m(t,r){null==r&&(r=0);var e=d(r);if("string"==typeof t&&t.match(/^-?[0-9.,]+$/)||s.throwArgumentError("invalid decimal value","value",t),e.length-1==0)return u.BigNumber.from(t);var n="-"===t.substring(0,1);n&&(t=t.substring(1)),"."===t&&s.throwArgumentError("missing value","value",t);var i=t.split(".");i.length>2&&s.throwArgumentError("too many decimal points","value",t);var o=i[0],a=i[1];for(o||(o="0"),a||(a="0"),a.length>e.length-1&&l("fractional component exceeds decimals","underflow","parseFixed");a.length<e.length-1;)a+="0";var f=u.BigNumber.from(o),c=u.BigNumber.from(a),p=f.mul(e).add(c);return n&&(p=p.mul(h)),p}r.formatFixed=p,r.parseFixed=m;var g=function(){function t(t,r,e,n){this.signed=r,this.width=e,this.decimals=n,this.name=(r?"":"u")+"fixed"+String(e)+"x"+String(n),this._multiplier=d(n),Object.freeze(this)}return t.from=function(r){if(r instanceof t)return r;var e=!0,n=128,i=18;if("string"==typeof r){if("fixed"===r);else if("ufixed"===r)e=!1;else if(null!=r){var o=r.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);o||s.throwArgumentError("invalid fixed format","format",r),e="u"!==o[1],n=parseInt(o[2]),i=parseInt(o[3])}}else if(r){var u=function(t,e,n){return null==r[t]?n:(typeof r[t]!==e&&s.throwArgumentError("invalid fixed format ("+t+" not "+e+")","format."+t,r[t]),r[t])};e=u("signed","boolean",e),n=u("width","number",n),i=u("decimals","number",i)}return n%8&&s.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",n),i>80&&s.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",i),new t(a,e,n,i)},t}();r.FixedFormat=g;var v=function(){function t(r,e,n,i){var o=this.constructor;s.checkNew(o,t),this.format=i,this._hex=e,this._value=n,this._isFixedNumber=!0,Object.freeze(this)}return t.prototype._checkFormat=function(t){this.format.name!==t.format.name&&s.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",t)},t.prototype.addUnsafe=function(r){this._checkFormat(r);var e=m(this._value,this.format.decimals),n=m(r._value,r.format.decimals);return t.fromValue(e.add(n),this.format.decimals,this.format)},t.prototype.subUnsafe=function(r){this._checkFormat(r);var e=m(this._value,this.format.decimals),n=m(r._value,r.format.decimals);return t.fromValue(e.sub(n),this.format.decimals,this.format)},t.prototype.mulUnsafe=function(r){this._checkFormat(r);var e=m(this._value,this.format.decimals),n=m(r._value,r.format.decimals);return t.fromValue(e.mul(n).div(this.format._multiplier),this.format.decimals,this.format)},t.prototype.divUnsafe=function(r){this._checkFormat(r);var e=m(this._value,this.format.decimals),n=m(r._value,r.format.decimals);return t.fromValue(e.mul(this.format._multiplier).div(n),this.format.decimals,this.format)},t.prototype.round=function(r){null==r&&(r=0),(r<0||r>80||r%1)&&s.throwArgumentError("invalid decimal cound","decimals",r);var e=this.toString().split(".");if(e[1].length<=r)return this;var n="0."+c.substring(0,r)+"5";return e=this.addUnsafe(t.fromString(n,this.format))._value.split("."),t.fromString(e[0]+"."+e[1].substring(0,r))},t.prototype.toString=function(){return this._value},t.prototype.toHexString=function(t){if(null==t)return this._hex;t%8&&s.throwArgumentError("invalid byte width","width",t);var r=u.BigNumber.from(this._hex).fromTwos(this.format.width).toTwos(t).toHexString();return n.hexZeroPad(r,t/8)},t.prototype.toUnsafeFloat=function(){return parseFloat(this.toString())},t.prototype.toFormat=function(r){return t.fromString(this._value,r)},t.fromValue=function(r,e,n){return null!=n||null==e||u.isBigNumberish(e)||(n=e,e=null),null==e&&(e=0),null==n&&(n="fixed"),t.fromString(p(r,e),g.from(n))},t.fromString=function(r,e){null==e&&(e="fixed");var i=g.from(e),o=m(r,i.decimals);!i.signed&&o.lt(f)&&l("unsigned value cannot be negative","overflow","value",r);var s=null;i.signed?s=o.toTwos(i.width).toHexString():(s=o.toHexString(),s=n.hexZeroPad(s,i.width/8));var u=p(o,i.decimals);return new t(a,s,u,i)},t.fromBytes=function(r,e){null==e&&(e="fixed");var i=g.from(e);if(n.arrayify(r).length>i.width/8)throw new Error("overflow");var o=u.BigNumber.from(r);i.signed&&(o=o.fromTwos(i.width));var s=o.toTwos((i.signed?0:1)+i.width).toHexString(),f=p(o,i.decimals);return new t(a,s,f,i)},t.from=function(r,e){if("string"==typeof r)return t.fromString(r,e);if(n.isBytes(r))return t.fromBytes(r,e);try{return t.fromValue(r,0,e)}catch(t){if(t.code!==i.Logger.errors.INVALID_ARGUMENT)throw t}return s.throwArgumentError("invalid FixedNumber value","value",r)},t.isFixedNumber=function(t){return!(!t||!t._isFixedNumber)},t}();r.FixedNumber=v},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.version="strings/5.0.0-beta.129"},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e(2);function i(t,r){r||(r=function(t){return[parseInt(t,16)]});var e=0,n={};return t.split(",").forEach(function(t){var i=t.split(":");e+=parseInt(i[0],16),n[e]=r(i[1])}),n}function o(t){var r=0;return t.split(",").map(function(t){var e=t.split("-");return 1===e.length?e[1]="0":""===e[1]&&(e[1]="1"),{l:r+parseInt(e[0],16),h:r=parseInt(e[1],16)}})}function s(t,r){for(var e=0,n=0;n<r.length;n++){var i=r[n];if(t>=(e+=i.l)&&t<=e+i.h&&(t-e)%(i.d||1)==0){if(i.e&&-1!==i.e.indexOf(t-e))continue;return i}}return null}var u=o("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"),a="ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map(function(t){return parseInt(t,16)}),f=[{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}],h=i("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"),l=i("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"),c=i("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",function(t){if(t.length%4!=0)throw new Error("bad data");for(var r=[],e=0;e<t.length;e+=4)r.push(parseInt(t.substring(e,e+4),16));return r}),d=o("80-20,2a0-,39c,32,f71,18e,7f2-f,19-7,30-4,7-5,f81-b,5,a800-20ff,4d1-1f,110,fa-6,d174-7,2e84-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,2,1f-5f,ff7f-20001");function p(t){return!!s(t,u)}function m(t){var r=s(t,f);if(r)return[t+r.s];var e=h[t];if(e)return e;var n=l[t];return n?[t+n[0]]:c[t]||null}function g(t){return!!s(t,d)}r._nameprepTableA1=p,r._nameprepTableB2=m,r._nameprepTableC=g,r.nameprep=function(t){if(t.match(/^[a-z0-9-]*$/i)&&t.length<=59)return t.toLowerCase();var r,e=n.toUtf8CodePoints(t);r=e.map(function(t){return a.indexOf(t)>=0?[]:t>=65024&&t<=65039?[]:m(t)||[t]}),e=r.reduce(function(t,r){return r.forEach(function(r){t.push(r)}),t},[]),(e=n.toUtf8CodePoints(n._toUtf8String(e),n.UnicodeNormalizationForm.NFKC)).forEach(function(t){if(g(t))throw new Error("STRINGPREP_CONTAINS_PROHIBITED")}),e.forEach(function(t){if(p(t))throw new Error("STRINGPREP_CONTAINS_UNASSIGNED")});var i=n._toUtf8String(e);if("-"===i.substring(0,1)||"--"===i.substring(2,4)||"-"===i.substring(i.length-1))throw new Error("invalid hyphen");if(i.length>63)throw new Error("too long");return i}}])},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const n=e(0),i=n.__importDefault(e(3)),o=n.__importStar(e(4)),s=n.__importDefault(e(5));r.default=class extends i.default{constructor(t){super(o,t,null,s.default)}getAccounts(){return n.__awaiter(this,void 0,void 0,function*(){if(!this.connected)throw new Error("Session currently disconnected");const t=this._formatRequest({method:"get_accounts"});try{return yield this._sendCallRequest(t)}catch(t){throw t}})}trustSignTransaction(t,r){return n.__awaiter(this,void 0,void 0,function*(){if(!this.connected)throw new Error("Session currently disconnected");const e=this._formatRequest({method:"trust_signTransaction",params:[{network:t,transaction:JSON.stringify(r)}]});try{return yield this._sendCallRequest(e)}catch(t){throw t}})}}},function(t,r,e){t.exports=function(t){var r={};function e(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,e),i.l=!0,i.exports}return e.m=t,e.c=r,e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:n})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,r){if(1&r&&(t=e(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(e.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var i in t)e.d(n,i,function(r){return t[r]}.bind(null,i));return n},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},e.p="",e(e.s=2)}([function(t,r,e){"use strict";e.r(r),e.d(r,"__extends",function(){return i}),e.d(r,"__assign",function(){return o}),e.d(r,"__rest",function(){return s}),e.d(r,"__decorate",function(){return u}),e.d(r,"__param",function(){return a}),e.d(r,"__metadata",function(){return f}),e.d(r,"__awaiter",function(){return h}),e.d(r,"__generator",function(){return l}),e.d(r,"__exportStar",function(){return c}),e.d(r,"__values",function(){return d}),e.d(r,"__read",function(){return p}),e.d(r,"__spread",function(){return m}),e.d(r,"__spreadArrays",function(){return g}),e.d(r,"__await",function(){return v}),e.d(r,"__asyncGenerator",function(){return y}),e.d(r,"__asyncDelegator",function(){return w}),e.d(r,"__asyncValues",function(){return b}),e.d(r,"__makeTemplateObject",function(){return _}),e.d(r,"__importStar",function(){return M}),e.d(r,"__importDefault",function(){return E});
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0

THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.

See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
var n=function(t,r){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var e in r)r.hasOwnProperty(e)&&(t[e]=r[e])})(t,r)};function i(t,r){function e(){this.constructor=t}n(t,r),t.prototype=null===r?Object.create(r):(e.prototype=r.prototype,new e)}var o=function(){return(o=Object.assign||function(t){for(var r,e=1,n=arguments.length;e<n;e++)for(var i in r=arguments[e])Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i]);return t}).apply(this,arguments)};function s(t,r){var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&r.indexOf(n)<0&&(e[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(t);i<n.length;i++)r.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(e[n[i]]=t[n[i]])}return e}function u(t,r,e,n){var i,o=arguments.length,s=o<3?r:null===n?n=Object.getOwnPropertyDescriptor(r,e):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,r,e,n);else for(var u=t.length-1;u>=0;u--)(i=t[u])&&(s=(o<3?i(s):o>3?i(r,e,s):i(r,e))||s);return o>3&&s&&Object.defineProperty(r,e,s),s}function a(t,r){return function(e,n){r(e,n,t)}}function f(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)}function h(t,r,e,n){return new(e||(e=Promise))(function(i,o){function s(t){try{a(n.next(t))}catch(t){o(t)}}function u(t){try{a(n.throw(t))}catch(t){o(t)}}function a(t){t.done?i(t.value):new e(function(r){r(t.value)}).then(s,u)}a((n=n.apply(t,r||[])).next())})}function l(t,r){var e,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(o){return function(u){return function(o){if(e)throw new TypeError("Generator is already executing.");for(;s;)try{if(e=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=r.call(t,s)}catch(t){o=[6,t],n=0}finally{e=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}}function c(t,r){for(var e in t)r.hasOwnProperty(e)||(r[e]=t[e])}function d(t){var r="function"==typeof Symbol&&t[Symbol.iterator],e=0;return r?r.call(t):{next:function(){return t&&e>=t.length&&(t=void 0),{value:t&&t[e++],done:!t}}}}function p(t,r){var e="function"==typeof Symbol&&t[Symbol.iterator];if(!e)return t;var n,i,o=e.call(t),s=[];try{for(;(void 0===r||r-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(e=o.return)&&e.call(o)}finally{if(i)throw i.error}}return s}function m(){for(var t=[],r=0;r<arguments.length;r++)t=t.concat(p(arguments[r]));return t}function g(){for(var t=0,r=0,e=arguments.length;r<e;r++)t+=arguments[r].length;var n=Array(t),i=0;for(r=0;r<e;r++)for(var o=arguments[r],s=0,u=o.length;s<u;s++,i++)n[i]=o[s];return n}function v(t){return this instanceof v?(this.v=t,this):new v(t)}function y(t,r,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,i=e.apply(t,r||[]),o=[];return n={},s("next"),s("throw"),s("return"),n[Symbol.asyncIterator]=function(){return this},n;function s(t){i[t]&&(n[t]=function(r){return new Promise(function(e,n){o.push([t,r,e,n])>1||u(t,r)})})}function u(t,r){try{(e=i[t](r)).value instanceof v?Promise.resolve(e.value.v).then(a,f):h(o[0][2],e)}catch(t){h(o[0][3],t)}var e}function a(t){u("next",t)}function f(t){u("throw",t)}function h(t,r){t(r),o.shift(),o.length&&u(o[0][0],o[0][1])}}function w(t){var r,e;return r={},n("next"),n("throw",function(t){throw t}),n("return"),r[Symbol.iterator]=function(){return this},r;function n(n,i){r[n]=t[n]?function(r){return(e=!e)?{value:v(t[n](r)),done:"return"===n}:i?i(r):r}:i}}function b(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,e=t[Symbol.asyncIterator];return e?e.call(t):(t=d(t),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(e){r[e]=t[e]&&function(r){return new Promise(function(n,i){!function(t,r,e,n){Promise.resolve(n).then(function(r){t({value:r,done:e})},r)}(n,i,(r=t[e](r)).done,r.value)})}}}function _(t,r){return Object.defineProperty?Object.defineProperty(t,"raw",{value:r}):t.raw=r,t}function M(t){if(t&&t.__esModule)return t;var r={};if(null!=t)for(var e in t)Object.hasOwnProperty.call(t,e)&&(r[e]=t[e]);return r.default=t,r}function E(t){return t&&t.__esModule?t:{default:t}}},function(t,r,e){t.exports=function(t){var r={};function e(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,e),i.l=!0,i.exports}return e.m=t,e.c=r,e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:n})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,r){if(1&r&&(t=e(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(e.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var i in t)e.d(n,i,function(r){return t[r]}.bind(null,i));return n},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},e.p="",e(e.s=7)}([function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e(1),i=e(15),o=new n.Logger(i.version);function s(t){return!!t.toHexString}function u(t){return t.slice?t:(t.slice=function(){var r=Array.prototype.slice.call(arguments);return u(new Uint8Array(Array.prototype.slice.apply(t,r)))},t)}function a(t){return c(t)&&!(t.length%2)||f(t)}function f(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(null==t.length)return!1;for(var r=0;r<t.length;r++){var e=t[r];if(e<0||e>=256||e%1)return!1}return!0}function h(t,r){if(r||(r={}),"number"==typeof t){o.checkSafeUint53(t,"invalid arrayify value");for(var e=[];t;)e.unshift(255&t),t/=256;return 0===e.length&&e.push(0),u(new Uint8Array(e))}if(r.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),s(t)&&(t=t.toHexString()),c(t)){var n=t.substring(2);!r.allowOddLength&&n.length%2&&o.throwArgumentError("hex data is odd-length","value",t),e=[];for(var i=0;i<n.length;i+=2)e.push(parseInt(n.substring(i,i+2),16));return u(new Uint8Array(e))}return f(t)?u(new Uint8Array(t)):o.throwArgumentError("invalid arrayify value","value",t)}function l(t){var r=t.map(function(t){return h(t)}),e=r.reduce(function(t,r){return t+r.length},0),n=new Uint8Array(e);return r.reduce(function(t,r){return n.set(r,t),t+r.length},0),u(n)}function c(t,r){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/)||r&&t.length!==2+2*r)}r.isBytesLike=a,r.isBytes=f,r.arrayify=h,r.concat=l,r.stripZeros=function(t){var r=h(t);if(0===r.length)return r;for(var e=0;e<r.length&&0===r[e];)e++;return e&&(r=r.slice(e)),r},r.zeroPad=function(t,r){(t=h(t)).length>r&&o.throwArgumentError("value out of range","value",arguments[0]);var e=new Uint8Array(r);return e.set(t,r-t.length),u(e)},r.isHexString=c;var d="0123456789abcdef";function p(t,r){if(r||(r={}),"number"==typeof t){o.checkSafeUint53(t,"invalid hexlify value");for(var e="";t;)e=d[15&t]+e,t=Math.floor(t/16);return e.length?(e.length%2&&(e="0"+e),"0x"+e):"0x00"}if(r.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),s(t))return t.toHexString();if(c(t))return!r.allowOddLength&&t.length%2&&o.throwArgumentError("hex data is odd-length","value",t),t.toLowerCase();if(f(t)){for(var n="0x",i=0;i<t.length;i++){var u=t[i];n+=d[(240&u)>>4]+d[15&u]}return n}return o.throwArgumentError("invalid hexlify value","value",t)}function m(t){"string"!=typeof t&&(t=p(t)),c(t)||o.throwArgumentError("invalid hex string","value",t),t=t.substring(2);for(var r=0;r<t.length&&"0"===t[r];)r++;return"0x"+t.substring(r)}function g(t,r){for("string"!=typeof t?t=p(t):c(t)||o.throwArgumentError("invalid hex string","value",t),t.length>2*r+2&&o.throwArgumentError("value out of range","value",arguments[1]);t.length<2*r+2;)t="0x0"+t.substring(2);return t}function v(t){var r={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0};if(a(t)){var e=h(t);65!==e.length&&o.throwArgumentError("invalid signature string; must be 65 bytes","signature",t),r.r=p(e.slice(0,32)),r.s=p(e.slice(32,64)),r.v=e[64],27!==r.v&&28!==r.v&&(r.v=27+r.v%2),r.recoveryParam=r.v-27,r.recoveryParam&&(e[32]|=128),r._vs=p(e.slice(32,64))}else{if(r.r=t.r,r.s=t.s,r.v=t.v,r.recoveryParam=t.recoveryParam,r._vs=t._vs,null!=r.v&&27!=r.v&&28!=r.v&&(r.v=27+r.v%2),null==r.recoveryParam&&null!=r.v?r.recoveryParam=1-r.v%2:null!=r.recoveryParam&&null==r.v?r.v=27+r.recoveryParam:null!=r.recoveryParam&&null!=r.v&&r.v!==27+r.recoveryParam&&o.throwArgumentError("signature v mismatch recoveryParam","signature",t),null!=r.r&&(r.r=g(r.r,32)),null!=r.s&&(r.s=g(r.s,32)),null!=r._vs){r._vs=g(r._vs,32),r._vs.length>66&&o.throwArgumentError("signature _vs overflow","signature",t);var n=(u=h(r._vs))[0]>=128?1:0,i=27+r.recoveryParam;u[0]&=127;var s=p(u);null==r.s?r.s=s:r.s!==s&&o.throwArgumentError("signature v mismatch _vs","signature",t),null==r.v?r.v=i:r.v!==i&&o.throwArgumentError("signature v mismatch _vs","signature",t),null==n?r.recoveryParam=n:r.recoveryParam!==n&&o.throwArgumentError("signature recoveryParam mismatch _vs","signature",t)}var u;null==r.v&&null==r.recoveryParam&&o.throwArgumentError("signature requires at least one of recoveryParam, v or _vs","signature",t),27!==r.v&&28!==r.v&&o.throwArgumentError("signature v not canonical","signature",t),(r.r.length>66||r.s.length>66)&&o.throwArgumentError("signature overflow r or s","signature",t),null==r._vs&&((u=h(r.s))[0]>=128&&o.throwArgumentError("signature s out of range","signature",t),r.recoveryParam&&(u[0]|=128),r._vs=p(u))}return r}r.hexlify=p,r.hexDataLength=function(t){if("string"!=typeof t)t=p(t);else if(!c(t)||t.length%2)return null;return(t.length-2)/2},r.hexDataSlice=function(t,r,e){return"string"!=typeof t?t=p(t):(!c(t)||t.length%2)&&o.throwArgumentError("invalid hexData","value",t),r=2+2*r,null!=e?"0x"+t.substring(r,2+2*e):"0x"+t.substring(r)},r.hexConcat=function(t){var r="0x";return t.forEach(function(t){r+=p(t).substring(2)}),r},r.hexValue=function(t){var r=m(p(t,{allowOddLength:!0}));return"0x"===r?"0x0":r},r.hexStripZeros=m,r.hexZeroPad=g,r.splitSignature=v,r.joinSignature=function(t){return p(l([(t=v(t)).r,t.s,t.recoveryParam?"0x1c":"0x1b"]))}},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=!1,i=!1,o={debug:1,default:2,info:2,warn:3,error:4,off:5},s=o.default,u=e(14),a=null,f=function(){try{var t=[];if(["NFD","NFC","NFKD","NFKC"].forEach(function(r){try{if("test"!=="test".normalize(r))throw new Error("bad normalize")}catch(e){t.push(r)}}),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}(),h=function(){function t(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}return t.prototype.setLogLevel=function(t){var r=o[t];null!=r?s=r:this.warn("invliad log level - "+t)},t.prototype._log=function(t,r){s>o[t]||console.log.apply(console,r)},t.prototype.debug=function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];this._log(t.levels.DEBUG,r)},t.prototype.info=function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];this._log(t.levels.INFO,r)},t.prototype.warn=function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];this._log(t.levels.WARNING,r)},t.prototype.makeError=function(r,e,n){if(i)return new Error("unknown error");e||(e=t.errors.UNKNOWN_ERROR),n||(n={});var o=[];Object.keys(n).forEach(function(t){try{o.push(t+"="+JSON.stringify(n[t]))}catch(r){o.push(t+"="+JSON.stringify(n[t].toString()))}}),o.push("version="+this.version);var s=r;o.length&&(r+=" ("+o.join(", ")+")");var u=new Error(r);return u.reason=s,u.code=e,Object.keys(n).forEach(function(t){u[t]=n[t]}),u},t.prototype.throwError=function(t,r,e){throw this.makeError(t,r,e)},t.prototype.throwArgumentError=function(r,e,n){return this.throwError(r,t.errors.INVALID_ARGUMENT,{argument:e,value:n})},t.prototype.checkNormalize=function(r){null==r&&(r="platform missing String.prototype.normalize"),f&&this.throwError("platform missing String.prototype.normalize",t.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:f})},t.prototype.checkSafeUint53=function(r,e){"number"==typeof r&&(null==e&&(e="value not safe"),(r<0||r>=9007199254740991)&&this.throwError(e,t.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:r}),r%1&&this.throwError(e,t.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:r}))},t.prototype.checkArgumentCount=function(r,e,n){n=n?": "+n:"",r<e&&this.throwError("missing argument"+n,t.errors.MISSING_ARGUMENT,{count:r,expectedCount:e}),r>e&&this.throwError("too many arguments"+n,t.errors.UNEXPECTED_ARGUMENT,{count:r,expectedCount:e})},t.prototype.checkNew=function(r,e){r!==Object&&null!=r||this.throwError("missing new",t.errors.MISSING_NEW,{name:e.name})},t.prototype.checkAbstract=function(r,e){r===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",t.errors.UNSUPPORTED_OPERATION,{name:r.name,operation:"new"}):r!==Object&&null!=r||this.throwError("missing new",t.errors.MISSING_NEW,{name:e.name})},t.globalLogger=function(){return a||(a=new t(u.version)),a},t.setCensorship=function(r,e){if(n){if(!r)return;this.globalLogger().throwError("error censorship permanent",t.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}i=!!r,n=!!e},t.errors={UNKNOWN_ERROR:"UNKNOWN_ERROR",NOT_IMPLEMENTED:"NOT_IMPLEMENTED",UNSUPPORTED_OPERATION:"UNSUPPORTED_OPERATION",NETWORK_ERROR:"NETWORK_ERROR",SERVER_ERROR:"SERVER_ERROR",TIMEOUT:"TIMEOUT",BUFFER_OVERRUN:"BUFFER_OVERRUN",NUMERIC_FAULT:"NUMERIC_FAULT",MISSING_NEW:"MISSING_NEW",INVALID_ARGUMENT:"INVALID_ARGUMENT",MISSING_ARGUMENT:"MISSING_ARGUMENT",UNEXPECTED_ARGUMENT:"UNEXPECTED_ARGUMENT",CALL_EXCEPTION:"CALL_EXCEPTION",INSUFFICIENT_FUNDS:"INSUFFICIENT_FUNDS",NONCE_EXPIRED:"NONCE_EXPIRED",REPLACEMENT_UNDERPRICED:"REPLACEMENT_UNDERPRICED",UNPREDICTABLE_GAS_LIMIT:"UNPREDICTABLE_GAS_LIMIT"},t.levels={DEBUG:"DEBUG",INFO:"INFO",WARNING:"WARNING",ERROR:"ERROR",OFF:"OFF"},t}();r.Logger=h},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n,i=e(0),o=e(1),s=e(29),u=new o.Logger(s.version);function a(t,r){t=i.arrayify(t);for(var e=[],n=0;n<t.length;){var o=t[n++];if(o>>7!=0){var s=null,u=null;if(192==(224&o))s=1,u=127;else if(224==(240&o))s=2,u=2047;else{if(240!=(248&o)){if(!r){if(128==(192&o))throw new Error("invalid utf8 byte sequence; unexpected continuation byte");throw new Error("invalid utf8 byte sequence; invalid prefix")}continue}s=3,u=65535}if(n+s>t.length){if(!r)throw new Error("invalid utf8 byte sequence; too short");for(;n<t.length&&t[n]>>6==2;n++);}else{for(var a=o&(1<<8-s-1)-1,f=0;f<s;f++){var h=t[n];if(128!=(192&h)){a=null;break}a=a<<6|63&h,n++}if(null!==a)if(a<=u){if(!r)throw new Error("invalid utf8 byte sequence; overlong")}else if(a>1114111){if(!r)throw new Error("invalid utf8 byte sequence; out-of-range")}else if(a>=55296&&a<=57343){if(!r)throw new Error("invalid utf8 byte sequence; utf-16 surrogate")}else e.push(a);else if(!r)throw new Error("invalid utf8 byte sequence; invalid continuation byte")}}else e.push(o)}return e}function f(t,r){void 0===r&&(r=n.current),r!=n.current&&(u.checkNormalize(),t=t.normalize(r));for(var e=[],o=0;o<t.length;o++){var s=t.charCodeAt(o);if(s<128)e.push(s);else if(s<2048)e.push(s>>6|192),e.push(63&s|128);else if(55296==(64512&s)){o++;var a=t.charCodeAt(o);if(o>=t.length||56320!=(64512&a))throw new Error("invalid utf-8 string");s=65536+((1023&s)<<10)+(1023&a),e.push(s>>18|240),e.push(s>>12&63|128),e.push(s>>6&63|128),e.push(63&s|128)}else e.push(s>>12|224),e.push(s>>6&63|128),e.push(63&s|128)}return i.arrayify(e)}function h(t){var r="0000"+t.toString(16);return"\\u"+r.substring(r.length-4)}function l(t){return t.map(function(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10&1023),56320+(1023&t)))}).join("")}!function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"}(n=r.UnicodeNormalizationForm||(r.UnicodeNormalizationForm={})),r.toUtf8Bytes=f,r._toEscapedUtf8String=function(t,r){return'"'+a(t,r).map(function(t){if(t<256){switch(t){case 8:return"\\b";case 9:return"\\t";case 10:return"\\n";case 13:return"\\r";case 34:return'\\"';case 92:return"\\\\"}if(t>=32&&t<127)return String.fromCharCode(t)}return t<=65535?h(t):h(55296+((t-=65536)>>10&1023))+h(56320+(1023&t))}).join("")+'"'},r._toUtf8String=l,r.toUtf8String=function(t,r){return l(a(t,r))},r.toUtf8CodePoints=function(t,r){return void 0===r&&(r=n.current),a(f(t,r))}},function(t,r){var e;e=function(){return this}();try{e=e||new Function("return this")()}catch(t){"object"==typeof window&&(e=window)}t.exports=e},function(t,r,e){(function(t){!function(t,r){"use strict";function n(t,r){if(!t)throw new Error(r||"Assertion failed")}function i(t,r){t.super_=r;var e=function(){};e.prototype=r.prototype,t.prototype=new e,t.prototype.constructor=t}function o(t,r,e){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==r&&"be"!==r||(e=r,r=10),this._init(t||0,r||10,e||"be"))}var s;"object"==typeof t?t.exports=o:r.BN=o,o.BN=o,o.wordSize=26;try{s=e(18).Buffer}catch(t){}function u(t,r,e){for(var n=0,i=Math.min(t.length,e),o=r;o<i;o++){var s=t.charCodeAt(o)-48;n<<=4,n|=s>=49&&s<=54?s-49+10:s>=17&&s<=22?s-17+10:15&s}return n}function a(t,r,e,n){for(var i=0,o=Math.min(t.length,e),s=r;s<o;s++){var u=t.charCodeAt(s)-48;i*=n,i+=u>=49?u-49+10:u>=17?u-17+10:u}return i}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,r){return t.cmp(r)>0?t:r},o.min=function(t,r){return t.cmp(r)<0?t:r},o.prototype._init=function(t,r,e){if("number"==typeof t)return this._initNumber(t,r,e);if("object"==typeof t)return this._initArray(t,r,e);"hex"===r&&(r=16),n(r===(0|r)&&r>=2&&r<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&i++,16===r?this._parseHex(t,i):this._parseBase(t,r,i),"-"===t[0]&&(this.negative=1),this.strip(),"le"===e&&this._initArray(this.toArray(),r,e)},o.prototype._initNumber=function(t,r,e){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===e&&this._initArray(this.toArray(),r,e)},o.prototype._initArray=function(t,r,e){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,s,u=0;if("be"===e)for(i=t.length-1,o=0;i>=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<<u&67108863,this.words[o+1]=s>>>26-u&67108863,(u+=24)>=26&&(u-=26,o++);else if("le"===e)for(i=0,o=0;i<t.length;i+=3)s=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=s<<u&67108863,this.words[o+1]=s>>>26-u&67108863,(u+=24)>=26&&(u-=26,o++);return this.strip()},o.prototype._parseHex=function(t,r){this.length=Math.ceil((t.length-r)/6),this.words=new Array(this.length);for(var e=0;e<this.length;e++)this.words[e]=0;var n,i,o=0;for(e=t.length-6,n=0;e>=r;e-=6)i=u(t,e,e+6),this.words[n]|=i<<o&67108863,this.words[n+1]|=i>>>26-o&4194303,(o+=24)>=26&&(o-=26,n++);e+6!==r&&(i=u(t,r,e+6),this.words[n]|=i<<o&67108863,this.words[n+1]|=i>>>26-o&4194303),this.strip()},o.prototype._parseBase=function(t,r,e){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=r)n++;n--,i=i/r|0;for(var o=t.length-e,s=o%n,u=Math.min(o,o-s)+e,f=0,h=e;h<u;h+=n)f=a(t,h,h+n,r),this.imuln(i),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f);if(0!==s){var l=1;for(f=a(t,h,t.length,r),h=0;h<s;h++)l*=r;this.imuln(l),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f)}},o.prototype.copy=function(t){t.words=new Array(this.length);for(var r=0;r<this.length;r++)t.words[r]=this.words[r];t.length=this.length,t.negative=this.negative,t.red=this.red},o.prototype.clone=function(){var t=new o(null);return this.copy(t),t},o.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var f=["","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"],h=[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],l=[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 c(t,r,e){e.negative=r.negative^t.negative;var n=t.length+r.length|0;e.length=n,n=n-1|0;var i=0|t.words[0],o=0|r.words[0],s=i*o,u=67108863&s,a=s/67108864|0;e.words[0]=u;for(var f=1;f<n;f++){for(var h=a>>>26,l=67108863&a,c=Math.min(f,r.length-1),d=Math.max(0,f-t.length+1);d<=c;d++){var p=f-d|0;h+=(s=(i=0|t.words[p])*(o=0|r.words[d])+l)/67108864|0,l=67108863&s}e.words[f]=0|l,a=0|h}return 0!==a?e.words[f]=0|a:e.length--,e.strip()}o.prototype.toString=function(t,r){var e;if(r=0|r||1,16===(t=t||10)||"hex"===t){e="";for(var i=0,o=0,s=0;s<this.length;s++){var u=this.words[s],a=(16777215&(u<<i|o)).toString(16);e=0!=(o=u>>>24-i&16777215)||s!==this.length-1?f[6-a.length]+a+e:a+e,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(e=o.toString(16)+e);e.length%r!=0;)e="0"+e;return 0!==this.negative&&(e="-"+e),e}if(t===(0|t)&&t>=2&&t<=36){var c=h[t],d=l[t];e="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);e=(p=p.idivn(d)).isZero()?m+e:f[c-m.length]+m+e}for(this.isZero()&&(e="0"+e);e.length%r!=0;)e="0"+e;return 0!==this.negative&&(e="-"+e),e}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,r){return n(void 0!==s),this.toArrayLike(s,t,r)},o.prototype.toArray=function(t,r){return this.toArrayLike(Array,t,r)},o.prototype.toArrayLike=function(t,r,e){var i=this.byteLength(),o=e||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0"),this.strip();var s,u,a="le"===r,f=new t(o),h=this.clone();if(a){for(u=0;!h.isZero();u++)s=h.andln(255),h.iushrn(8),f[u]=s;for(;u<o;u++)f[u]=0}else{for(u=0;u<o-i;u++)f[u]=0;for(u=0;!h.isZero();u++)s=h.andln(255),h.iushrn(8),f[o-u-1]=s}return f},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var r=t,e=0;return r>=4096&&(e+=13,r>>>=13),r>=64&&(e+=7,r>>>=7),r>=8&&(e+=4,r>>>=4),r>=2&&(e+=2,r>>>=2),e+r},o.prototype._zeroBits=function(t){if(0===t)return 26;var r=t,e=0;return 0==(8191&r)&&(e+=13,r>>>=13),0==(127&r)&&(e+=7,r>>>=7),0==(15&r)&&(e+=4,r>>>=4),0==(3&r)&&(e+=2,r>>>=2),0==(1&r)&&e++,e},o.prototype.bitLength=function(){var t=this.words[this.length-1],r=this._countBits(t);return 26*(this.length-1)+r},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,r=0;r<this.length;r++){var e=this._zeroBits(this.words[r]);if(t+=e,26!==e)break}return t},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},o.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var r=0;r<t.length;r++)this.words[r]=this.words[r]|t.words[r];return this.strip()},o.prototype.ior=function(t){return n(0==(this.negative|t.negative)),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var r;r=this.length>t.length?t:this;for(var e=0;e<r.length;e++)this.words[e]=this.words[e]&t.words[e];return this.length=r.length,this.strip()},o.prototype.iand=function(t){return n(0==(this.negative|t.negative)),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var r,e;this.length>t.length?(r=this,e=t):(r=t,e=this);for(var n=0;n<e.length;n++)this.words[n]=r.words[n]^e.words[n];if(this!==r)for(;n<r.length;n++)this.words[n]=r.words[n];return this.length=r.length,this.strip()},o.prototype.ixor=function(t){return n(0==(this.negative|t.negative)),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var r=0|Math.ceil(t/26),e=t%26;this._expand(r),e>0&&r--;for(var i=0;i<r;i++)this.words[i]=67108863&~this.words[i];return e>0&&(this.words[i]=~this.words[i]&67108863>>26-e),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,r){n("number"==typeof t&&t>=0);var e=t/26|0,i=t%26;return this._expand(e+1),this.words[e]=r?this.words[e]|1<<i:this.words[e]&~(1<<i),this.strip()},o.prototype.iadd=function(t){var r,e,n;if(0!==this.negative&&0===t.negative)return this.negative=0,r=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,r=this.isub(t),t.negative=1,r._normSign();this.length>t.length?(e=this,n=t):(e=t,n=this);for(var i=0,o=0;o<n.length;o++)r=(0|e.words[o])+(0|n.words[o])+i,this.words[o]=67108863&r,i=r>>>26;for(;0!==i&&o<e.length;o++)r=(0|e.words[o])+i,this.words[o]=67108863&r,i=r>>>26;if(this.length=e.length,0!==i)this.words[this.length]=i,this.length++;else if(e!==this)for(;o<e.length;o++)this.words[o]=e.words[o];return this},o.prototype.add=function(t){var r;return 0!==t.negative&&0===this.negative?(t.negative=0,r=this.sub(t),t.negative^=1,r):0===t.negative&&0!==this.negative?(this.negative=0,r=t.sub(this),this.negative=1,r):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var r=this.iadd(t);return t.negative=1,r._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var e,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(e=this,n=t):(e=t,n=this);for(var o=0,s=0;s<n.length;s++)o=(r=(0|e.words[s])-(0|n.words[s])+o)>>26,this.words[s]=67108863&r;for(;0!==o&&s<e.length;s++)o=(r=(0|e.words[s])+o)>>26,this.words[s]=67108863&r;if(0===o&&s<e.length&&e!==this)for(;s<e.length;s++)this.words[s]=e.words[s];return this.length=Math.max(this.length,s),e!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(t){return this.clone().isub(t)};var d=function(t,r,e){var n,i,o,s=t.words,u=r.words,a=e.words,f=0,h=0|s[0],l=8191&h,c=h>>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],v=8191&g,y=g>>>13,w=0|s[3],b=8191&w,_=w>>>13,M=0|s[4],E=8191&M,S=M>>>13,A=0|s[5],R=8191&A,O=A>>>13,N=0|s[6],B=8191&N,x=N>>>13,I=0|s[7],P=8191&I,T=I>>>13,U=0|s[8],C=8191&U,k=U>>>13,D=0|s[9],F=8191&D,j=D>>>13,L=0|u[0],q=8191&L,H=L>>>13,G=0|u[1],z=8191&G,Y=G>>>13,Z=0|u[2],V=8191&Z,J=Z>>>13,W=0|u[3],K=8191&W,$=W>>>13,X=0|u[4],Q=8191&X,tt=X>>>13,rt=0|u[5],et=8191&rt,nt=rt>>>13,it=0|u[6],ot=8191&it,st=it>>>13,ut=0|u[7],at=8191&ut,ft=ut>>>13,ht=0|u[8],lt=8191&ht,ct=ht>>>13,dt=0|u[9],pt=8191&dt,mt=dt>>>13;e.negative=t.negative^r.negative,e.length=19;var gt=(f+(n=Math.imul(l,q))|0)+((8191&(i=(i=Math.imul(l,H))+Math.imul(c,q)|0))<<13)|0;f=((o=Math.imul(c,H))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(p,q),i=(i=Math.imul(p,H))+Math.imul(m,q)|0,o=Math.imul(m,H);var vt=(f+(n=n+Math.imul(l,z)|0)|0)+((8191&(i=(i=i+Math.imul(l,Y)|0)+Math.imul(c,z)|0))<<13)|0;f=((o=o+Math.imul(c,Y)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(v,q),i=(i=Math.imul(v,H))+Math.imul(y,q)|0,o=Math.imul(y,H),n=n+Math.imul(p,z)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(m,z)|0,o=o+Math.imul(m,Y)|0;var yt=(f+(n=n+Math.imul(l,V)|0)|0)+((8191&(i=(i=i+Math.imul(l,J)|0)+Math.imul(c,V)|0))<<13)|0;f=((o=o+Math.imul(c,J)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(b,q),i=(i=Math.imul(b,H))+Math.imul(_,q)|0,o=Math.imul(_,H),n=n+Math.imul(v,z)|0,i=(i=i+Math.imul(v,Y)|0)+Math.imul(y,z)|0,o=o+Math.imul(y,Y)|0,n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,J)|0)+Math.imul(m,V)|0,o=o+Math.imul(m,J)|0;var wt=(f+(n=n+Math.imul(l,K)|0)|0)+((8191&(i=(i=i+Math.imul(l,$)|0)+Math.imul(c,K)|0))<<13)|0;f=((o=o+Math.imul(c,$)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(E,q),i=(i=Math.imul(E,H))+Math.imul(S,q)|0,o=Math.imul(S,H),n=n+Math.imul(b,z)|0,i=(i=i+Math.imul(b,Y)|0)+Math.imul(_,z)|0,o=o+Math.imul(_,Y)|0,n=n+Math.imul(v,V)|0,i=(i=i+Math.imul(v,J)|0)+Math.imul(y,V)|0,o=o+Math.imul(y,J)|0,n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,$)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,$)|0;var bt=(f+(n=n+Math.imul(l,Q)|0)|0)+((8191&(i=(i=i+Math.imul(l,tt)|0)+Math.imul(c,Q)|0))<<13)|0;f=((o=o+Math.imul(c,tt)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(R,q),i=(i=Math.imul(R,H))+Math.imul(O,q)|0,o=Math.imul(O,H),n=n+Math.imul(E,z)|0,i=(i=i+Math.imul(E,Y)|0)+Math.imul(S,z)|0,o=o+Math.imul(S,Y)|0,n=n+Math.imul(b,V)|0,i=(i=i+Math.imul(b,J)|0)+Math.imul(_,V)|0,o=o+Math.imul(_,J)|0,n=n+Math.imul(v,K)|0,i=(i=i+Math.imul(v,$)|0)+Math.imul(y,K)|0,o=o+Math.imul(y,$)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var _t=(f+(n=n+Math.imul(l,et)|0)|0)+((8191&(i=(i=i+Math.imul(l,nt)|0)+Math.imul(c,et)|0))<<13)|0;f=((o=o+Math.imul(c,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(B,q),i=(i=Math.imul(B,H))+Math.imul(x,q)|0,o=Math.imul(x,H),n=n+Math.imul(R,z)|0,i=(i=i+Math.imul(R,Y)|0)+Math.imul(O,z)|0,o=o+Math.imul(O,Y)|0,n=n+Math.imul(E,V)|0,i=(i=i+Math.imul(E,J)|0)+Math.imul(S,V)|0,o=o+Math.imul(S,J)|0,n=n+Math.imul(b,K)|0,i=(i=i+Math.imul(b,$)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,$)|0,n=n+Math.imul(v,Q)|0,i=(i=i+Math.imul(v,tt)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,tt)|0,n=n+Math.imul(p,et)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(m,et)|0,o=o+Math.imul(m,nt)|0;var Mt=(f+(n=n+Math.imul(l,ot)|0)|0)+((8191&(i=(i=i+Math.imul(l,st)|0)+Math.imul(c,ot)|0))<<13)|0;f=((o=o+Math.imul(c,st)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(P,q),i=(i=Math.imul(P,H))+Math.imul(T,q)|0,o=Math.imul(T,H),n=n+Math.imul(B,z)|0,i=(i=i+Math.imul(B,Y)|0)+Math.imul(x,z)|0,o=o+Math.imul(x,Y)|0,n=n+Math.imul(R,V)|0,i=(i=i+Math.imul(R,J)|0)+Math.imul(O,V)|0,o=o+Math.imul(O,J)|0,n=n+Math.imul(E,K)|0,i=(i=i+Math.imul(E,$)|0)+Math.imul(S,K)|0,o=o+Math.imul(S,$)|0,n=n+Math.imul(b,Q)|0,i=(i=i+Math.imul(b,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(v,et)|0,i=(i=i+Math.imul(v,nt)|0)+Math.imul(y,et)|0,o=o+Math.imul(y,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var Et=(f+(n=n+Math.imul(l,at)|0)|0)+((8191&(i=(i=i+Math.imul(l,ft)|0)+Math.imul(c,at)|0))<<13)|0;f=((o=o+Math.imul(c,ft)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(C,q),i=(i=Math.imul(C,H))+Math.imul(k,q)|0,o=Math.imul(k,H),n=n+Math.imul(P,z)|0,i=(i=i+Math.imul(P,Y)|0)+Math.imul(T,z)|0,o=o+Math.imul(T,Y)|0,n=n+Math.imul(B,V)|0,i=(i=i+Math.imul(B,J)|0)+Math.imul(x,V)|0,o=o+Math.imul(x,J)|0,n=n+Math.imul(R,K)|0,i=(i=i+Math.imul(R,$)|0)+Math.imul(O,K)|0,o=o+Math.imul(O,$)|0,n=n+Math.imul(E,Q)|0,i=(i=i+Math.imul(E,tt)|0)+Math.imul(S,Q)|0,o=o+Math.imul(S,tt)|0,n=n+Math.imul(b,et)|0,i=(i=i+Math.imul(b,nt)|0)+Math.imul(_,et)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(v,ot)|0,i=(i=i+Math.imul(v,st)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,st)|0,n=n+Math.imul(p,at)|0,i=(i=i+Math.imul(p,ft)|0)+Math.imul(m,at)|0,o=o+Math.imul(m,ft)|0;var St=(f+(n=n+Math.imul(l,lt)|0)|0)+((8191&(i=(i=i+Math.imul(l,ct)|0)+Math.imul(c,lt)|0))<<13)|0;f=((o=o+Math.imul(c,ct)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(F,q),i=(i=Math.imul(F,H))+Math.imul(j,q)|0,o=Math.imul(j,H),n=n+Math.imul(C,z)|0,i=(i=i+Math.imul(C,Y)|0)+Math.imul(k,z)|0,o=o+Math.imul(k,Y)|0,n=n+Math.imul(P,V)|0,i=(i=i+Math.imul(P,J)|0)+Math.imul(T,V)|0,o=o+Math.imul(T,J)|0,n=n+Math.imul(B,K)|0,i=(i=i+Math.imul(B,$)|0)+Math.imul(x,K)|0,o=o+Math.imul(x,$)|0,n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,tt)|0)+Math.imul(O,Q)|0,o=o+Math.imul(O,tt)|0,n=n+Math.imul(E,et)|0,i=(i=i+Math.imul(E,nt)|0)+Math.imul(S,et)|0,o=o+Math.imul(S,nt)|0,n=n+Math.imul(b,ot)|0,i=(i=i+Math.imul(b,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,n=n+Math.imul(v,at)|0,i=(i=i+Math.imul(v,ft)|0)+Math.imul(y,at)|0,o=o+Math.imul(y,ft)|0,n=n+Math.imul(p,lt)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(m,lt)|0,o=o+Math.imul(m,ct)|0;var At=(f+(n=n+Math.imul(l,pt)|0)|0)+((8191&(i=(i=i+Math.imul(l,mt)|0)+Math.imul(c,pt)|0))<<13)|0;f=((o=o+Math.imul(c,mt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(F,z),i=(i=Math.imul(F,Y))+Math.imul(j,z)|0,o=Math.imul(j,Y),n=n+Math.imul(C,V)|0,i=(i=i+Math.imul(C,J)|0)+Math.imul(k,V)|0,o=o+Math.imul(k,J)|0,n=n+Math.imul(P,K)|0,i=(i=i+Math.imul(P,$)|0)+Math.imul(T,K)|0,o=o+Math.imul(T,$)|0,n=n+Math.imul(B,Q)|0,i=(i=i+Math.imul(B,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,n=n+Math.imul(R,et)|0,i=(i=i+Math.imul(R,nt)|0)+Math.imul(O,et)|0,o=o+Math.imul(O,nt)|0,n=n+Math.imul(E,ot)|0,i=(i=i+Math.imul(E,st)|0)+Math.imul(S,ot)|0,o=o+Math.imul(S,st)|0,n=n+Math.imul(b,at)|0,i=(i=i+Math.imul(b,ft)|0)+Math.imul(_,at)|0,o=o+Math.imul(_,ft)|0,n=n+Math.imul(v,lt)|0,i=(i=i+Math.imul(v,ct)|0)+Math.imul(y,lt)|0,o=o+Math.imul(y,ct)|0;var Rt=(f+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;f=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(F,V),i=(i=Math.imul(F,J))+Math.imul(j,V)|0,o=Math.imul(j,J),n=n+Math.imul(C,K)|0,i=(i=i+Math.imul(C,$)|0)+Math.imul(k,K)|0,o=o+Math.imul(k,$)|0,n=n+Math.imul(P,Q)|0,i=(i=i+Math.imul(P,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,n=n+Math.imul(B,et)|0,i=(i=i+Math.imul(B,nt)|0)+Math.imul(x,et)|0,o=o+Math.imul(x,nt)|0,n=n+Math.imul(R,ot)|0,i=(i=i+Math.imul(R,st)|0)+Math.imul(O,ot)|0,o=o+Math.imul(O,st)|0,n=n+Math.imul(E,at)|0,i=(i=i+Math.imul(E,ft)|0)+Math.imul(S,at)|0,o=o+Math.imul(S,ft)|0,n=n+Math.imul(b,lt)|0,i=(i=i+Math.imul(b,ct)|0)+Math.imul(_,lt)|0,o=o+Math.imul(_,ct)|0;var Ot=(f+(n=n+Math.imul(v,pt)|0)|0)+((8191&(i=(i=i+Math.imul(v,mt)|0)+Math.imul(y,pt)|0))<<13)|0;f=((o=o+Math.imul(y,mt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(F,K),i=(i=Math.imul(F,$))+Math.imul(j,K)|0,o=Math.imul(j,$),n=n+Math.imul(C,Q)|0,i=(i=i+Math.imul(C,tt)|0)+Math.imul(k,Q)|0,o=o+Math.imul(k,tt)|0,n=n+Math.imul(P,et)|0,i=(i=i+Math.imul(P,nt)|0)+Math.imul(T,et)|0,o=o+Math.imul(T,nt)|0,n=n+Math.imul(B,ot)|0,i=(i=i+Math.imul(B,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,n=n+Math.imul(R,at)|0,i=(i=i+Math.imul(R,ft)|0)+Math.imul(O,at)|0,o=o+Math.imul(O,ft)|0,n=n+Math.imul(E,lt)|0,i=(i=i+Math.imul(E,ct)|0)+Math.imul(S,lt)|0,o=o+Math.imul(S,ct)|0;var Nt=(f+(n=n+Math.imul(b,pt)|0)|0)+((8191&(i=(i=i+Math.imul(b,mt)|0)+Math.imul(_,pt)|0))<<13)|0;f=((o=o+Math.imul(_,mt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(F,Q),i=(i=Math.imul(F,tt))+Math.imul(j,Q)|0,o=Math.imul(j,tt),n=n+Math.imul(C,et)|0,i=(i=i+Math.imul(C,nt)|0)+Math.imul(k,et)|0,o=o+Math.imul(k,nt)|0,n=n+Math.imul(P,ot)|0,i=(i=i+Math.imul(P,st)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,st)|0,n=n+Math.imul(B,at)|0,i=(i=i+Math.imul(B,ft)|0)+Math.imul(x,at)|0,o=o+Math.imul(x,ft)|0,n=n+Math.imul(R,lt)|0,i=(i=i+Math.imul(R,ct)|0)+Math.imul(O,lt)|0,o=o+Math.imul(O,ct)|0;var Bt=(f+(n=n+Math.imul(E,pt)|0)|0)+((8191&(i=(i=i+Math.imul(E,mt)|0)+Math.imul(S,pt)|0))<<13)|0;f=((o=o+Math.imul(S,mt)|0)+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,n=Math.imul(F,et),i=(i=Math.imul(F,nt))+Math.imul(j,et)|0,o=Math.imul(j,nt),n=n+Math.imul(C,ot)|0,i=(i=i+Math.imul(C,st)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,st)|0,n=n+Math.imul(P,at)|0,i=(i=i+Math.imul(P,ft)|0)+Math.imul(T,at)|0,o=o+Math.imul(T,ft)|0,n=n+Math.imul(B,lt)|0,i=(i=i+Math.imul(B,ct)|0)+Math.imul(x,lt)|0,o=o+Math.imul(x,ct)|0;var xt=(f+(n=n+Math.imul(R,pt)|0)|0)+((8191&(i=(i=i+Math.imul(R,mt)|0)+Math.imul(O,pt)|0))<<13)|0;f=((o=o+Math.imul(O,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(F,ot),i=(i=Math.imul(F,st))+Math.imul(j,ot)|0,o=Math.imul(j,st),n=n+Math.imul(C,at)|0,i=(i=i+Math.imul(C,ft)|0)+Math.imul(k,at)|0,o=o+Math.imul(k,ft)|0,n=n+Math.imul(P,lt)|0,i=(i=i+Math.imul(P,ct)|0)+Math.imul(T,lt)|0,o=o+Math.imul(T,ct)|0;var It=(f+(n=n+Math.imul(B,pt)|0)|0)+((8191&(i=(i=i+Math.imul(B,mt)|0)+Math.imul(x,pt)|0))<<13)|0;f=((o=o+Math.imul(x,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(F,at),i=(i=Math.imul(F,ft))+Math.imul(j,at)|0,o=Math.imul(j,ft),n=n+Math.imul(C,lt)|0,i=(i=i+Math.imul(C,ct)|0)+Math.imul(k,lt)|0,o=o+Math.imul(k,ct)|0;var Pt=(f+(n=n+Math.imul(P,pt)|0)|0)+((8191&(i=(i=i+Math.imul(P,mt)|0)+Math.imul(T,pt)|0))<<13)|0;f=((o=o+Math.imul(T,mt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(F,lt),i=(i=Math.imul(F,ct))+Math.imul(j,lt)|0,o=Math.imul(j,ct);var Tt=(f+(n=n+Math.imul(C,pt)|0)|0)+((8191&(i=(i=i+Math.imul(C,mt)|0)+Math.imul(k,pt)|0))<<13)|0;f=((o=o+Math.imul(k,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863;var Ut=(f+(n=Math.imul(F,pt))|0)+((8191&(i=(i=Math.imul(F,mt))+Math.imul(j,pt)|0))<<13)|0;return f=((o=Math.imul(j,mt))+(i>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,a[0]=gt,a[1]=vt,a[2]=yt,a[3]=wt,a[4]=bt,a[5]=_t,a[6]=Mt,a[7]=Et,a[8]=St,a[9]=At,a[10]=Rt,a[11]=Ot,a[12]=Nt,a[13]=Bt,a[14]=xt,a[15]=It,a[16]=Pt,a[17]=Tt,a[18]=Ut,0!==f&&(a[19]=f,e.length++),e};function p(t,r,e){return(new m).mulp(t,r,e)}function m(t,r){this.x=t,this.y=r}Math.imul||(d=c),o.prototype.mulTo=function(t,r){var e=this.length+t.length;return 10===this.length&&10===t.length?d(this,t,r):e<63?c(this,t,r):e<1024?function(t,r,e){e.negative=r.negative^t.negative,e.length=t.length+r.length;for(var n=0,i=0,o=0;o<e.length-1;o++){var s=i;i=0;for(var u=67108863&n,a=Math.min(o,r.length-1),f=Math.max(0,o-t.length+1);f<=a;f++){var h=o-f,l=(0|t.words[h])*(0|r.words[f]),c=67108863&l;u=67108863&(c=c+u|0),i+=(s=(s=s+(l/67108864|0)|0)+(c>>>26)|0)>>>26,s&=67108863}e.words[o]=u,n=s,s=i}return 0!==n?e.words[o]=n:e.length--,e.strip()}(this,t,r):p(this,t,r)},m.prototype.makeRBT=function(t){for(var r=new Array(t),e=o.prototype._countBits(t)-1,n=0;n<t;n++)r[n]=this.revBin(n,e,t);return r},m.prototype.revBin=function(t,r,e){if(0===t||t===e-1)return t;for(var n=0,i=0;i<r;i++)n|=(1&t)<<r-i-1,t>>=1;return n},m.prototype.permute=function(t,r,e,n,i,o){for(var s=0;s<o;s++)n[s]=r[t[s]],i[s]=e[t[s]]},m.prototype.transform=function(t,r,e,n,i,o){this.permute(o,t,r,e,n,i);for(var s=1;s<i;s<<=1)for(var u=s<<1,a=Math.cos(2*Math.PI/u),f=Math.sin(2*Math.PI/u),h=0;h<i;h+=u)for(var l=a,c=f,d=0;d<s;d++){var p=e[h+d],m=n[h+d],g=e[h+d+s],v=n[h+d+s],y=l*g-c*v;v=l*v+c*g,g=y,e[h+d]=p+g,n[h+d]=m+v,e[h+d+s]=p-g,n[h+d+s]=m-v,d!==u&&(y=a*l-f*c,c=a*c+f*l,l=y)}},m.prototype.guessLen13b=function(t,r){var e=1|Math.max(r,t),n=1&e,i=0;for(e=e/2|0;e;e>>>=1)i++;return 1<<i+1+n},m.prototype.conjugate=function(t,r,e){if(!(e<=1))for(var n=0;n<e/2;n++){var i=t[n];t[n]=t[e-n-1],t[e-n-1]=i,i=r[n],r[n]=-r[e-n-1],r[e-n-1]=-i}},m.prototype.normalize13b=function(t,r){for(var e=0,n=0;n<r/2;n++){var i=8192*Math.round(t[2*n+1]/r)+Math.round(t[2*n]/r)+e;t[n]=67108863&i,e=i<67108864?0:i/67108864|0}return t},m.prototype.convert13b=function(t,r,e,i){for(var o=0,s=0;s<r;s++)o+=0|t[s],e[2*s]=8191&o,o>>>=13,e[2*s+1]=8191&o,o>>>=13;for(s=2*r;s<i;++s)e[s]=0;n(0===o),n(0==(-8192&o))},m.prototype.stub=function(t){for(var r=new Array(t),e=0;e<t;e++)r[e]=0;return r},m.prototype.mulp=function(t,r,e){var n=2*this.guessLen13b(t.length,r.length),i=this.makeRBT(n),o=this.stub(n),s=new Array(n),u=new Array(n),a=new Array(n),f=new Array(n),h=new Array(n),l=new Array(n),c=e.words;c.length=n,this.convert13b(t.words,t.length,s,n),this.convert13b(r.words,r.length,f,n),this.transform(s,o,u,a,n,i),this.transform(f,o,h,l,n,i);for(var d=0;d<n;d++){var p=u[d]*h[d]-a[d]*l[d];a[d]=u[d]*l[d]+a[d]*h[d],u[d]=p}return this.conjugate(u,a,n),this.transform(u,a,c,o,n,i),this.conjugate(c,o,n),this.normalize13b(c,n),e.negative=t.negative^r.negative,e.length=t.length+r.length,e.strip()},o.prototype.mul=function(t){var r=new o(null);return r.words=new Array(this.length+t.length),this.mulTo(t,r)},o.prototype.mulf=function(t){var r=new o(null);return r.words=new Array(this.length+t.length),p(this,t,r)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.prototype.imuln=function(t){n("number"==typeof t),n(t<67108864);for(var r=0,e=0;e<this.length;e++){var i=(0|this.words[e])*t,o=(67108863&i)+(67108863&r);r>>=26,r+=i/67108864|0,r+=o>>>26,this.words[e]=67108863&o}return 0!==r&&(this.words[e]=r,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var r=function(t){for(var r=new Array(t.bitLength()),e=0;e<r.length;e++){var n=e/26|0,i=e%26;r[e]=(t.words[n]&1<<i)>>>i}return r}(t);if(0===r.length)return new o(1);for(var e=this,n=0;n<r.length&&0===r[n];n++,e=e.sqr());if(++n<r.length)for(var i=e.sqr();n<r.length;n++,i=i.sqr())0!==r[n]&&(e=e.mul(i));return e},o.prototype.iushln=function(t){n("number"==typeof t&&t>=0);var r,e=t%26,i=(t-e)/26,o=67108863>>>26-e<<26-e;if(0!==e){var s=0;for(r=0;r<this.length;r++){var u=this.words[r]&o,a=(0|this.words[r])-u<<e;this.words[r]=a|s,s=u>>>26-e}s&&(this.words[r]=s,this.length++)}if(0!==i){for(r=this.length-1;r>=0;r--)this.words[r+i]=this.words[r];for(r=0;r<i;r++)this.words[r]=0;this.length+=i}return this.strip()},o.prototype.ishln=function(t){return n(0===this.negative),this.iushln(t)},o.prototype.iushrn=function(t,r,e){var i;n("number"==typeof t&&t>=0),i=r?(r-r%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),u=67108863^67108863>>>o<<o,a=e;if(i-=s,i=Math.max(0,i),a){for(var f=0;f<s;f++)a.words[f]=this.words[f];a.length=s}if(0===s);else if(this.length>s)for(this.length-=s,f=0;f<this.length;f++)this.words[f]=this.words[f+s];else this.words[0]=0,this.length=1;var h=0;for(f=this.length-1;f>=0&&(0!==h||f>=i);f--){var l=0|this.words[f];this.words[f]=h<<26-o|l>>>o,h=l&u}return a&&0!==h&&(a.words[a.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,r,e){return n(0===this.negative),this.iushrn(t,r,e)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"==typeof t&&t>=0);var r=t%26,e=(t-r)/26,i=1<<r;return!(this.length<=e||!(this.words[e]&i))},o.prototype.imaskn=function(t){n("number"==typeof t&&t>=0);var r=t%26,e=(t-r)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=e)return this;if(0!==r&&e++,this.length=Math.min(e,this.length),0!==r){var i=67108863^67108863>>>r<<r;this.words[this.length-1]&=i}return this.strip()},o.prototype.maskn=function(t){return this.clone().imaskn(t)},o.prototype.iaddn=function(t){return n("number"==typeof t),n(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},o.prototype._iaddn=function(t){this.words[0]+=t;for(var r=0;r<this.length&&this.words[r]>=67108864;r++)this.words[r]-=67108864,r===this.length-1?this.words[r+1]=1:this.words[r+1]++;return this.length=Math.max(this.length,r+1),this},o.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var r=0;r<this.length&&this.words[r]<0;r++)this.words[r]+=67108864,this.words[r+1]-=1;return this.strip()},o.prototype.addn=function(t){return this.clone().iaddn(t)},o.prototype.subn=function(t){return this.clone().isubn(t)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(t,r,e){var i,o,s=t.length+e;this._expand(s);var u=0;for(i=0;i<t.length;i++){o=(0|this.words[i+e])+u;var a=(0|t.words[i])*r;u=((o-=67108863&a)>>26)-(a/67108864|0),this.words[i+e]=67108863&o}for(;i<this.length-e;i++)u=(o=(0|this.words[i+e])+u)>>26,this.words[i+e]=67108863&o;if(0===u)return this.strip();for(n(-1===u),u=0,i=0;i<this.length;i++)u=(o=-(0|this.words[i])+u)>>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,r){var e=(this.length,t.length),n=this.clone(),i=t,s=0|i.words[i.length-1];0!=(e=26-this._countBits(s))&&(i=i.ushln(e),n.iushln(e),s=0|i.words[i.length-1]);var u,a=n.length-i.length;if("mod"!==r){(u=new o(null)).length=a+1,u.words=new Array(u.length);for(var f=0;f<u.length;f++)u.words[f]=0}var h=n.clone()._ishlnsubmul(i,1,a);0===h.negative&&(n=h,u&&(u.words[a]=1));for(var l=a-1;l>=0;l--){var c=67108864*(0|n.words[i.length+l])+(0|n.words[i.length+l-1]);for(c=Math.min(c/s|0,67108863),n._ishlnsubmul(i,c,l);0!==n.negative;)c--,n.negative=0,n._ishlnsubmul(i,1,l),n.isZero()||(n.negative^=1);u&&(u.words[l]=c)}return u&&u.strip(),n.strip(),"div"!==r&&0!==e&&n.iushrn(e),{div:u||null,mod:n}},o.prototype.divmod=function(t,r,e){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(u=this.neg().divmod(t,r),"mod"!==r&&(i=u.div.neg()),"div"!==r&&(s=u.mod.neg(),e&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(u=this.divmod(t.neg(),r),"mod"!==r&&(i=u.div.neg()),{div:i,mod:u.mod}):0!=(this.negative&t.negative)?(u=this.neg().divmod(t.neg(),r),"div"!==r&&(s=u.mod.neg(),e&&0!==s.negative&&s.isub(t)),{div:u.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===r?{div:this.divn(t.words[0]),mod:null}:"mod"===r?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,r);var i,s,u},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var r=this.divmod(t);if(r.mod.isZero())return r.div;var e=0!==r.div.negative?r.mod.isub(t):r.mod,n=t.ushrn(1),i=t.andln(1),o=e.cmp(n);return o<0||1===i&&0===o?r.div:0!==r.div.negative?r.div.isubn(1):r.div.iaddn(1)},o.prototype.modn=function(t){n(t<=67108863);for(var r=(1<<26)%t,e=0,i=this.length-1;i>=0;i--)e=(r*e+(0|this.words[i]))%t;return e},o.prototype.idivn=function(t){n(t<=67108863);for(var r=0,e=this.length-1;e>=0;e--){var i=(0|this.words[e])+67108864*r;this.words[e]=i/t|0,r=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var r=this,e=t.clone();r=0!==r.negative?r.umod(t):r.clone();for(var i=new o(1),s=new o(0),u=new o(0),a=new o(1),f=0;r.isEven()&&e.isEven();)r.iushrn(1),e.iushrn(1),++f;for(var h=e.clone(),l=r.clone();!r.isZero();){for(var c=0,d=1;0==(r.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(r.iushrn(c);c-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(h),s.isub(l)),i.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(e.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(e.iushrn(p);p-- >0;)(u.isOdd()||a.isOdd())&&(u.iadd(h),a.isub(l)),u.iushrn(1),a.iushrn(1);r.cmp(e)>=0?(r.isub(e),i.isub(u),s.isub(a)):(e.isub(r),u.isub(i),a.isub(s))}return{a:u,b:a,gcd:e.iushln(f)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var r=this,e=t.clone();r=0!==r.negative?r.umod(t):r.clone();for(var i,s=new o(1),u=new o(0),a=e.clone();r.cmpn(1)>0&&e.cmpn(1)>0;){for(var f=0,h=1;0==(r.words[0]&h)&&f<26;++f,h<<=1);if(f>0)for(r.iushrn(f);f-- >0;)s.isOdd()&&s.iadd(a),s.iushrn(1);for(var l=0,c=1;0==(e.words[0]&c)&&l<26;++l,c<<=1);if(l>0)for(e.iushrn(l);l-- >0;)u.isOdd()&&u.iadd(a),u.iushrn(1);r.cmp(e)>=0?(r.isub(e),s.isub(u)):(e.isub(r),u.isub(s))}return(i=0===r.cmpn(1)?s:u).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var r=this.clone(),e=t.clone();r.negative=0,e.negative=0;for(var n=0;r.isEven()&&e.isEven();n++)r.iushrn(1),e.iushrn(1);for(;;){for(;r.isEven();)r.iushrn(1);for(;e.isEven();)e.iushrn(1);var i=r.cmp(e);if(i<0){var o=r;r=e,e=o}else if(0===i||0===e.cmpn(1))break;r.isub(e)}return e.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"==typeof t);var r=t%26,e=(t-r)/26,i=1<<r;if(this.length<=e)return this._expand(e+1),this.words[e]|=i,this;for(var o=i,s=e;0!==o&&s<this.length;s++){var u=0|this.words[s];o=(u+=o)>>>26,u&=67108863,this.words[s]=u}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var r,e=t<0;if(0!==this.negative&&!e)return-1;if(0===this.negative&&e)return 1;if(this.strip(),this.length>1)r=1;else{e&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];r=i===t?0:i<t?-1:1}return 0!==this.negative?0|-r:r},o.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var r=this.ucmp(t);return 0!==this.negative?0|-r:r},o.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var r=0,e=this.length-1;e>=0;e--){var n=0|this.words[e],i=0|t.words[e];if(n!==i){n<i?r=-1:n>i&&(r=1);break}}return r},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new M(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var g={k256:null,p224:null,p192:null,p25519:null};function v(t,r){this.name=t,this.p=new o(r,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function b(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function M(t){if("string"==typeof t){var r=o._prime(t);this.m=r.p,this.prime=r}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function E(t){M.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var r,e=t;do{this.split(e,this.tmp),r=(e=(e=this.imulK(e)).iadd(this.tmp)).bitLength()}while(r>this.n);var n=r<this.n?-1:e.ucmp(this.p);return 0===n?(e.words[0]=0,e.length=1):n>0?e.isub(this.p):e.strip(),e},v.prototype.split=function(t,r){t.iushrn(this.n,0,r)},v.prototype.imulK=function(t){return t.imul(this.k)},i(y,v),y.prototype.split=function(t,r){for(var e=Math.min(t.length,9),n=0;n<e;n++)r.words[n]=t.words[n];if(r.length=e,t.length<=9)return t.words[0]=0,void(t.length=1);var i=t.words[9];for(r.words[r.length++]=4194303&i,n=10;n<t.length;n++){var o=0|t.words[n];t.words[n-10]=(4194303&o)<<4|i>>>22,i=o}i>>>=22,t.words[n-10]=i,0===i&&t.length>10?t.length-=10:t.length-=9},y.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var r=0,e=0;e<t.length;e++){var n=0|t.words[e];r+=977*n,t.words[e]=67108863&r,r=64*n+(r/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(w,v),i(b,v),i(_,v),_.prototype.imulK=function(t){for(var r=0,e=0;e<t.length;e++){var n=19*(0|t.words[e])+r,i=67108863&n;n>>>=26,t.words[e]=i,r=n}return 0!==r&&(t.words[t.length++]=r),t},o._prime=function(t){if(g[t])return g[t];var r;if("k256"===t)r=new y;else if("p224"===t)r=new w;else if("p192"===t)r=new b;else{if("p25519"!==t)throw new Error("Unknown prime "+t);r=new _}return g[t]=r,r},M.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},M.prototype._verify2=function(t,r){n(0==(t.negative|r.negative),"red works only with positives"),n(t.red&&t.red===r.red,"red works only with red numbers")},M.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},M.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},M.prototype.add=function(t,r){this._verify2(t,r);var e=t.add(r);return e.cmp(this.m)>=0&&e.isub(this.m),e._forceRed(this)},M.prototype.iadd=function(t,r){this._verify2(t,r);var e=t.iadd(r);return e.cmp(this.m)>=0&&e.isub(this.m),e},M.prototype.sub=function(t,r){this._verify2(t,r);var e=t.sub(r);return e.cmpn(0)<0&&e.iadd(this.m),e._forceRed(this)},M.prototype.isub=function(t,r){this._verify2(t,r);var e=t.isub(r);return e.cmpn(0)<0&&e.iadd(this.m),e},M.prototype.shl=function(t,r){return this._verify1(t),this.imod(t.ushln(r))},M.prototype.imul=function(t,r){return this._verify2(t,r),this.imod(t.imul(r))},M.prototype.mul=function(t,r){return this._verify2(t,r),this.imod(t.mul(r))},M.prototype.isqr=function(t){return this.imul(t,t.clone())},M.prototype.sqr=function(t){return this.mul(t,t)},M.prototype.sqrt=function(t){if(t.isZero())return t.clone();var r=this.m.andln(3);if(n(r%2==1),3===r){var e=this.m.add(new o(1)).iushrn(2);return this.pow(t,e)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var u=new o(1).toRed(this),a=u.redNeg(),f=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new o(2*h*h).toRed(this);0!==this.pow(h,f).cmp(a);)h.redIAdd(a);for(var l=this.pow(h,i),c=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=s;0!==d.cmp(u);){for(var m=d,g=0;0!==m.cmp(u);g++)m=m.redSqr();n(g<p);var v=this.pow(l,new o(1).iushln(p-g-1));c=c.redMul(v),l=v.redSqr(),d=d.redMul(l),p=g}return c},M.prototype.invm=function(t){var r=t._invmp(this.m);return 0!==r.negative?(r.negative=0,this.imod(r).redNeg()):this.imod(r)},M.prototype.pow=function(t,r){if(r.isZero())return new o(1).toRed(this);if(0===r.cmpn(1))return t.clone();var e=new Array(16);e[0]=new o(1).toRed(this),e[1]=t;for(var n=2;n<e.length;n++)e[n]=this.mul(e[n-1],t);var i=e[0],s=0,u=0,a=r.bitLength()%26;for(0===a&&(a=26),n=r.length-1;n>=0;n--){for(var f=r.words[n],h=a-1;h>=0;h--){var l=f>>h&1;i!==e[0]&&(i=this.sqr(i)),0!==l||0!==s?(s<<=1,s|=l,(4==++u||0===n&&0===h)&&(i=this.mul(i,e[s]),u=0,s=0)):u=0}a=26}return i},M.prototype.convertTo=function(t){var r=t.umod(this.m);return r===t?r.clone():r},M.prototype.convertFrom=function(t){var r=t.clone();return r.red=null,r},o.mont=function(t){return new E(t)},i(E,M),E.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},E.prototype.convertFrom=function(t){var r=this.imod(t.mul(this.rinv));return r.red=null,r},E.prototype.imul=function(t,r){if(t.isZero()||r.isZero())return t.words[0]=0,t.length=1,t;var e=t.imul(r),n=e.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=e.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},E.prototype.mul=function(t,r){if(t.isZero()||r.isZero())return new o(0)._forceRed(this);var e=t.mul(r),n=e.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=e.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},E.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,e(17)(t))},function(t,r,e){"use strict";var n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var r={};if(null!=t)for(var e in t)Object.hasOwnProperty.call(t,e)&&(r[e]=t[e]);return r.default=t,r};Object.defineProperty(r,"__esModule",{value:!0});var i=n(e(4)),o=e(0),s=e(1),u=e(6),a=new s.Logger(u.version),f={};r.isBigNumberish=function(t){return null!=t&&(h.isBigNumber(t)||"number"==typeof t&&t%1==0||"string"==typeof t&&!!t.match(/^-?[0-9]+$/)||o.isHexString(t)||"bigint"==typeof t||o.isBytes(t))};var h=function(){function t(r,e){var n=this.constructor;a.checkNew(n,t),r!==f&&a.throwError("cannot call consturtor directly; use BigNumber.from",s.Logger.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}return t.prototype.fromTwos=function(t){return c(d(this).fromTwos(t))},t.prototype.toTwos=function(t){return c(d(this).toTwos(t))},t.prototype.abs=function(){return"-"===this._hex[0]?t.from(this._hex.substring(1)):this},t.prototype.add=function(t){return c(d(this).add(d(t)))},t.prototype.sub=function(t){return c(d(this).sub(d(t)))},t.prototype.div=function(r){return t.from(r).isZero()&&p("division by zero","div"),c(d(this).div(d(r)))},t.prototype.mul=function(t){return c(d(this).mul(d(t)))},t.prototype.mod=function(t){return c(d(this).mod(d(t)))},t.prototype.pow=function(t){return c(d(this).pow(d(t)))},t.prototype.maskn=function(t){return c(d(this).maskn(t))},t.prototype.eq=function(t){return d(this).eq(d(t))},t.prototype.lt=function(t){return d(this).lt(d(t))},t.prototype.lte=function(t){return d(this).lte(d(t))},t.prototype.gt=function(t){return d(this).gt(d(t))},t.prototype.gte=function(t){return d(this).gte(d(t))},t.prototype.isZero=function(){return d(this).isZero()},t.prototype.toNumber=function(){try{return d(this).toNumber()}catch(t){p("overflow","toNumber",this.toString())}return null},t.prototype.toString=function(){return 0!==arguments.length&&a.throwError("bigNumber.toString does not accept parameters",s.Logger.errors.UNEXPECTED_ARGUMENT,{}),d(this).toString(10)},t.prototype.toHexString=function(){return this._hex},t.from=function(r){return r instanceof t?r:"string"==typeof r?r.match(/-?0x[0-9a-f]+/i)?new t(f,l(r)):r.match(/^-?[0-9]+$/)?new t(f,l(new i.BN(r))):a.throwArgumentError("invalid BigNumber string","value",r):"number"==typeof r?(r%1&&p("underflow","BigNumber.from",r),(r>=9007199254740991||r<=-9007199254740991)&&p("overflow","BigNumber.from",r),t.from(String(r))):"bigint"==typeof r?t.from(r.toString()):o.isBytes(r)?t.from(o.hexlify(r)):r._hex&&o.isHexString(r._hex)?t.from(r._hex):r.toHexString&&"string"==typeof(r=r.toHexString())?t.from(r):a.throwArgumentError("invalid BigNumber value","value",r)},t.isBigNumber=function(t){return!(!t||!t._isBigNumber)},t}();function l(t){if("string"!=typeof t)return l(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&a.throwArgumentError("invalid hex","value",t),"0x00"===(t=l(t))?t:"-"+t;if("0x"!==t.substring(0,2)&&(t="0x"+t),"0x"===t)return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&"0x00"===t.substring(0,4);)t="0x"+t.substring(4);return t}function c(t){return h.from(l(t))}function d(t){var r=h.from(t).toHexString();return"-"===r[0]?new i.BN("-"+r.substring(3),16):new i.BN(r.substring(2),16)}function p(t,r,e){var n={fault:t,operation:r};return null!=e&&(n.value=e),a.throwError(t,s.Logger.errors.NUMERIC_FAULT,n)}r.BigNumber=h},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.version="bignumber/5.0.0-beta.129"},function(t,r,e){"use strict";(function(t){Object.defineProperty(r,"__esModule",{value:!0});var n=e(12),i=n.__importDefault(e(13)),o=e(0),s=e(16),u=e(24);function a(t){return u.toUtf8String(new Uint8Array(t))}function f(t,r){var e=o.hexlify(new Uint8Array(t));return r&&(e=w(e)),e}function h(t,r){var e=t.toString("hex");return r||(e=y(e)),e}function l(t){return u.toUtf8Bytes(t).buffer}function c(t,r){return f(l(t),r)}function d(t,r){var e=new i.default(t).toString(16);return e=v(e),r&&(e=w(e)),e}function p(r){return r=w(r),t.from(r,"hex")}function m(t){return t=y(t),o.arrayify(t).buffer}function g(t){return new i.default(t).toNumber()}function v(t){return(t=(t=w(t)).length%2!=0?"0"+t:t)&&(t=y(t)),t}function y(t){return"0x"===t.toLowerCase().substring(0,2)?t:"0x"+t}function w(t){return"0x"===t.toLowerCase().substring(0,2)?t.substring(2):t}function b(t){return o.isHexString(t)}function _(t){return""===t||"string"==typeof t&&""===t.trim()}function M(t){for(var r={},e=("?"===t[0]?t.substr(1):t).split("&"),n=0;n<e.length;n++){var i=e[n].match(/\w+(?==)/i)||[],o=e[n].match(/=.+/i)||[];i[0]&&(r[decodeURIComponent(i[0])]=decodeURIComponent(o[0].substr(1)))}return r}function E(t){return!(t&&t.length)}r.convertArrayBufferToBuffer=function(t){return p(f(t))},r.convertArrayBufferToUtf8=a,r.convertArrayBufferToHex=f,r.convertArrayBufferToNumber=function(t){return g(f(t))},r.concatArrayBuffers=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return m(t.map(function(t){return f(t,!0)}).join(""))},r.convertBufferToArrayBuffer=function(t){return m(h(t))},r.convertBufferToUtf8=function(t){return t.toString("utf8")},r.convertBufferToHex=h,r.convertBufferToNumber=function(t){return g(h(t))},r.concatBuffers=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return p(t.map(function(t){return h(t,!0)}).join(""))},r.convertUtf8ToArrayBuffer=l,r.convertUtf8ToBuffer=function(r){return t.from(r,"utf8")},r.convertUtf8ToHex=c,r.convertUtf8ToNumber=function(t){return new i.default(t).toNumber()},r.convertNumberToBuffer=function(t){return p(d(t))},r.convertNumberToArrayBuffer=function(t){return m(d(t))},r.convertNumberToUtf8=function(t){return new i.default(t).toString()},r.convertNumberToHex=d,r.convertHexToBuffer=p,r.convertHexToArrayBuffer=m,r.convertHexToUtf8=function(t){return a(m(t))},r.convertHexToNumber=g,r.sanitizeHex=v,r.addHexPrefix=y,r.removeHexPrefix=w,r.isHexString=b,r.isEmptyString=_,r.payloadId=function(){return(new Date).getTime()*Math.pow(10,3)+Math.floor(Math.random()*Math.pow(10,3))},r.uuid=function(){return function(t,r){for(r=t="";t++<36;r+=51*t&52?(15^t?8^Math.random()*(20^t?16:4):4).toString(16):"-");return r}()},r.toChecksumAddress=function(t){return s.getAddress(t)},r.isValidAddress=function(t){return!(!t||"0x"!==t.toLowerCase().substring(0,2)||!/^(0x)?[0-9a-f]{40}$/i.test(t)||!/^(0x)?[0-9a-f]{40}$/.test(t)&&!/^(0x)?[0-9A-F]{40}$/.test(t)&&t!==r.toChecksumAddress(t))},r.getMeta=function(){if("undefined"==typeof window||"undefined"==typeof document||void 0===window.location)return null;function t(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];for(var e=document.getElementsByTagName("meta"),n=function(r){var n=e[r],i=["itemprop","property","name"].map(function(t){return n.getAttribute(t)}).filter(function(r){r&&t.includes(r)});if(i.length&&i){var o=n.getAttribute("content");if(o)return{value:o}}},i=0;i<e.length;i++){var o=n(i);if("object"==typeof o)return o.value}return""}var r=function(){var r=t("name","og:site_name","og:title","twitter:title");return r||(r=document.title),r}();return{description:t("description","og:description","twitter:description","keywords"),url:window.location.origin,icons:function(){for(var t=document.getElementsByTagName("link"),r=[],e=0;e<t.length;e++){var n=t[e],i=n.getAttribute("rel");if(i&&i.toLowerCase().indexOf("icon")>-1){var o=n.getAttribute("href");if(o)if(-1===o.toLowerCase().indexOf("https:")&&-1===o.toLowerCase().indexOf("http:")&&0!==o.indexOf("//")){var s=window.location.protocol+"//"+window.location.host;if(0===o.indexOf("/"))s+=o;else{var u=window.location.pathname.split("/");u.pop(),s+=u.join("/")+"/"+o}r.push(s)}else if(0===o.indexOf("//")){var a=window.location.protocol+o;r.push(a)}else r.push(o)}}return r}(),name:r}},r.parseQueryString=M,r.parseWalletConnectUri=function(t){var r=t.indexOf(":"),e=-1!==t.indexOf("?")?t.indexOf("?"):void 0,i=t.substring(0,r),o=function(t){var r=t.split("@");return{handshakeTopic:r[0],version:parseInt(r[1],10)}}(t.substring(r+1,e)),s=function(t){var r=M(t);return{key:r.key||"",bridge:r.bridge||""}}(void 0!==e?t.substr(e):"");return n.__assign({protocol:i},o,s)},r.promisify=function(t,r){var e=this;return function(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];return n.__awaiter(e,void 0,void 0,function(){return n.__generator(this,function(e){return[2,new Promise(function(e,o){t.apply(r,n.__spread(i,[function(t,r){null==t&&o(t),e(r)}]))})]})})}},r.isEmptyArray=E,r.parsePersonalSign=function(t){return E(t)||b(t[0])||(t[0]=c(t[0])),t},r.parseTransactionData=function(t){if(void 0===t.from||!r.isValidAddress(t.from))throw new Error("Transaction object must include a valid 'from' value.");function e(t){var r=t;return("number"==typeof t||"string"==typeof t&&!_(t))&&(b(t)?"string"==typeof t&&(r=v(t)):r=d(t)),r}var n={from:v(t.from),to:void 0===t.to?"":v(t.to),gasPrice:void 0===t.gasPrice?"":e(t.gasPrice),gasLimit:void 0===t.gasLimit?void 0===t.gas?"":e(t.gas):e(t.gasLimit),value:void 0===t.value?"":e(t.value),nonce:void 0===t.nonce?"":e(t.nonce),data:void 0===t.data?"":v(t.data)||"0x"},i=["gasPrice","gasLimit","value","nonce"];return Object.keys(n).forEach(function(t){!n[t].trim().length&&i.includes(t)&&delete n[t]}),n},r.formatRpcError=function(t){var r=t.message||"Failed or Rejected Request",e=-32e3;if(t&&!t.code)switch(r){case"Parse error":e=-32700;break;case"Invalid request":e=-32600;break;case"Method not found":e=-32601;break;case"Invalid params":e=-32602;break;case"Internal error":e=-32603;break;default:e=-32e3}return{code:e,message:r}},r.isJsonRpcSubscription=function(t){return"object"==typeof t.params},r.isJsonRpcRequest=function(t){return void 0!==t.method},r.isJsonRpcResponseSuccess=function(t){return void 0!==t.result},r.isJsonRpcResponseError=function(t){return void 0!==t.error},r.isInternalEvent=function(t){return void 0!==t.event},r.isWalletConnectSession=function(t){return void 0!==t.bridge},r.isReservedEvent=function(t){return["session_request","session_update","exchange_key","connect","disconnect"].includes(t)||t.startsWith("wc_")},r.signingMethods=["eth_sendTransaction","eth_signTransaction","eth_sign","eth_signTypedData","eth_signTypedData_v1","eth_signTypedData_v3","personal_sign"],r.stateMethods=["eth_accounts","eth_chainId","net_version"],r.isSilentPayload=function(t){return!!t.method.startsWith("wc_")||!r.signingMethods.includes(t.method)}}).call(this,e(8).Buffer)},function(t,r,e){"use strict";(function(t){
/*!
 * The buffer module from node.js, for the browser.
 *
 * @author   Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
 * @license  MIT
 */
var n=e(9),i=e(10),o=e(11);function s(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function u(t,r){if(s()<r)throw new RangeError("Invalid typed array length");return a.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(r)).__proto__=a.prototype:(null===t&&(t=new a(r)),t.length=r),t}function a(t,r,e){if(!(a.TYPED_ARRAY_SUPPORT||this instanceof a))return new a(t,r,e);if("number"==typeof t){if("string"==typeof r)throw new Error("If encoding is specified then the first argument must be a string");return l(this,t)}return f(this,t,r,e)}function f(t,r,e,n){if("number"==typeof r)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&r instanceof ArrayBuffer?function(t,r,e,n){if(r.byteLength,e<0||r.byteLength<e)throw new RangeError("'offset' is out of bounds");if(r.byteLength<e+(n||0))throw new RangeError("'length' is out of bounds");return r=void 0===e&&void 0===n?new Uint8Array(r):void 0===n?new Uint8Array(r,e):new Uint8Array(r,e,n),a.TYPED_ARRAY_SUPPORT?(t=r).__proto__=a.prototype:t=c(t,r),t}(t,r,e,n):"string"==typeof r?function(t,r,e){if("string"==typeof e&&""!==e||(e="utf8"),!a.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var n=0|p(r,e),i=(t=u(t,n)).write(r,e);return i!==n&&(t=t.slice(0,i)),t}(t,r,e):function(t,r){if(a.isBuffer(r)){var e=0|d(r.length);return 0===(t=u(t,e)).length?t:(r.copy(t,0,0,e),t)}if(r){if("undefined"!=typeof ArrayBuffer&&r.buffer instanceof ArrayBuffer||"length"in r)return"number"!=typeof r.length||(n=r.length)!=n?u(t,0):c(t,r);if("Buffer"===r.type&&o(r.data))return c(t,r.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,r)}function h(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function l(t,r){if(h(r),t=u(t,r<0?0:0|d(r)),!a.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}function c(t,r){var e=r.length<0?0:0|d(r.length);t=u(t,e);for(var n=0;n<e;n+=1)t[n]=255&r[n];return t}function d(t){if(t>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|t}function p(t,r){if(a.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var e=t.length;if(0===e)return 0;for(var n=!1;;)switch(r){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return q(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*e;case"hex":return e>>>1;case"base64":return H(t).length;default:if(n)return q(t).length;r=(""+r).toLowerCase(),n=!0}}function m(t,r,e){var n=!1;if((void 0===r||r<0)&&(r=0),r>this.length)return"";if((void 0===e||e>this.length)&&(e=this.length),e<=0)return"";if((e>>>=0)<=(r>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return x(this,r,e);case"utf8":case"utf-8":return R(this,r,e);case"ascii":return N(this,r,e);case"latin1":case"binary":return B(this,r,e);case"base64":return A(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function g(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}function v(t,r,e,n,i){if(0===t.length)return-1;if("string"==typeof e?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=i?0:t.length-1),e<0&&(e=t.length+e),e>=t.length){if(i)return-1;e=t.length-1}else if(e<0){if(!i)return-1;e=0}if("string"==typeof r&&(r=a.from(r,n)),a.isBuffer(r))return 0===r.length?-1:y(t,r,e,n,i);if("number"==typeof r)return r&=255,a.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):y(t,[r],e,n,i);throw new TypeError("val must be string, number or Buffer")}function y(t,r,e,n,i){var o,s=1,u=t.length,a=r.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||r.length<2)return-1;s=2,u/=2,a/=2,e/=2}function f(t,r){return 1===s?t[r]:t.readUInt16BE(r*s)}if(i){var h=-1;for(o=e;o<u;o++)if(f(t,o)===f(r,-1===h?0:o-h)){if(-1===h&&(h=o),o-h+1===a)return h*s}else-1!==h&&(o-=o-h),h=-1}else for(e+a>u&&(e=u-a),o=e;o>=0;o--){for(var l=!0,c=0;c<a;c++)if(f(t,o+c)!==f(r,c)){l=!1;break}if(l)return o}return-1}function w(t,r,e,n){e=Number(e)||0;var i=t.length-e;n?(n=Number(n))>i&&(n=i):n=i;var o=r.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var s=0;s<n;++s){var u=parseInt(r.substr(2*s,2),16);if(isNaN(u))return s;t[e+s]=u}return s}function b(t,r,e,n){return G(q(r,t.length-e),t,e,n)}function _(t,r,e,n){return G(function(t){for(var r=[],e=0;e<t.length;++e)r.push(255&t.charCodeAt(e));return r}(r),t,e,n)}function M(t,r,e,n){return _(t,r,e,n)}function E(t,r,e,n){return G(H(r),t,e,n)}function S(t,r,e,n){return G(function(t,r){for(var e,n,i,o=[],s=0;s<t.length&&!((r-=2)<0);++s)n=(e=t.charCodeAt(s))>>8,i=e%256,o.push(i),o.push(n);return o}(r,t.length-e),t,e,n)}function A(t,r,e){return 0===r&&e===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(r,e))}function R(t,r,e){e=Math.min(t.length,e);for(var n=[],i=r;i<e;){var o,s,u,a,f=t[i],h=null,l=f>239?4:f>223?3:f>191?2:1;if(i+l<=e)switch(l){case 1:f<128&&(h=f);break;case 2:128==(192&(o=t[i+1]))&&(a=(31&f)<<6|63&o)>127&&(h=a);break;case 3:o=t[i+1],s=t[i+2],128==(192&o)&&128==(192&s)&&(a=(15&f)<<12|(63&o)<<6|63&s)>2047&&(a<55296||a>57343)&&(h=a);break;case 4:o=t[i+1],s=t[i+2],u=t[i+3],128==(192&o)&&128==(192&s)&&128==(192&u)&&(a=(15&f)<<18|(63&o)<<12|(63&s)<<6|63&u)>65535&&a<1114112&&(h=a)}null===h?(h=65533,l=1):h>65535&&(h-=65536,n.push(h>>>10&1023|55296),h=56320|1023&h),n.push(h),i+=l}return function(t){var r=t.length;if(r<=O)return String.fromCharCode.apply(String,t);for(var e="",n=0;n<r;)e+=String.fromCharCode.apply(String,t.slice(n,n+=O));return e}(n)}r.Buffer=a,r.SlowBuffer=function(t){return+t!=t&&(t=0),a.alloc(+t)},r.INSPECT_MAX_BYTES=50,a.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),r.kMaxLength=s(),a.poolSize=8192,a._augment=function(t){return t.__proto__=a.prototype,t},a.from=function(t,r,e){return f(null,t,r,e)},a.TYPED_ARRAY_SUPPORT&&(a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&a[Symbol.species]===a&&Object.defineProperty(a,Symbol.species,{value:null,configurable:!0})),a.alloc=function(t,r,e){return function(t,r,e,n){return h(r),r<=0?u(t,r):void 0!==e?"string"==typeof n?u(t,r).fill(e,n):u(t,r).fill(e):u(t,r)}(null,t,r,e)},a.allocUnsafe=function(t){return l(null,t)},a.allocUnsafeSlow=function(t){return l(null,t)},a.isBuffer=function(t){return!(null==t||!t._isBuffer)},a.compare=function(t,r){if(!a.isBuffer(t)||!a.isBuffer(r))throw new TypeError("Arguments must be Buffers");if(t===r)return 0;for(var e=t.length,n=r.length,i=0,o=Math.min(e,n);i<o;++i)if(t[i]!==r[i]){e=t[i],n=r[i];break}return e<n?-1:n<e?1:0},a.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(t,r){if(!o(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return a.alloc(0);var e;if(void 0===r)for(r=0,e=0;e<t.length;++e)r+=t[e].length;var n=a.allocUnsafe(r),i=0;for(e=0;e<t.length;++e){var s=t[e];if(!a.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(n,i),i+=s.length}return n},a.byteLength=p,a.prototype._isBuffer=!0,a.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<t;r+=2)g(this,r,r+1);return this},a.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<t;r+=4)g(this,r,r+3),g(this,r+1,r+2);return this},a.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<t;r+=8)g(this,r,r+7),g(this,r+1,r+6),g(this,r+2,r+5),g(this,r+3,r+4);return this},a.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?R(this,0,t):m.apply(this,arguments)},a.prototype.equals=function(t){if(!a.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===a.compare(this,t)},a.prototype.inspect=function(){var t="",e=r.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),"<Buffer "+t+">"},a.prototype.compare=function(t,r,e,n,i){if(!a.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===r&&(r=0),void 0===e&&(e=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),r<0||e>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&r>=e)return 0;if(n>=i)return-1;if(r>=e)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(e>>>=0)-(r>>>=0),u=Math.min(o,s),f=this.slice(n,i),h=t.slice(r,e),l=0;l<u;++l)if(f[l]!==h[l]){o=f[l],s=h[l];break}return o<s?-1:s<o?1:0},a.prototype.includes=function(t,r,e){return-1!==this.indexOf(t,r,e)},a.prototype.indexOf=function(t,r,e){return v(this,t,r,e,!0)},a.prototype.lastIndexOf=function(t,r,e){return v(this,t,r,e,!1)},a.prototype.write=function(t,r,e,n){if(void 0===r)n="utf8",e=this.length,r=0;else if(void 0===e&&"string"==typeof r)n=r,e=this.length,r=0;else{if(!isFinite(r))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");r|=0,isFinite(e)?(e|=0,void 0===n&&(n="utf8")):(n=e,e=void 0)}var i=this.length-r;if((void 0===e||e>i)&&(e=i),t.length>0&&(e<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return w(this,t,r,e);case"utf8":case"utf-8":return b(this,t,r,e);case"ascii":return _(this,t,r,e);case"latin1":case"binary":return M(this,t,r,e);case"base64":return E(this,t,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,t,r,e);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var O=4096;function N(t,r,e){var n="";e=Math.min(t.length,e);for(var i=r;i<e;++i)n+=String.fromCharCode(127&t[i]);return n}function B(t,r,e){var n="";e=Math.min(t.length,e);for(var i=r;i<e;++i)n+=String.fromCharCode(t[i]);return n}function x(t,r,e){var n=t.length;(!r||r<0)&&(r=0),(!e||e<0||e>n)&&(e=n);for(var i="",o=r;o<e;++o)i+=L(t[o]);return i}function I(t,r,e){for(var n=t.slice(r,e),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function P(t,r,e){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+r>e)throw new RangeError("Trying to access beyond buffer length")}function T(t,r,e,n,i,o){if(!a.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>i||r<o)throw new RangeError('"value" argument is out of bounds');if(e+n>t.length)throw new RangeError("Index out of range")}function U(t,r,e,n){r<0&&(r=65535+r+1);for(var i=0,o=Math.min(t.length-e,2);i<o;++i)t[e+i]=(r&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function C(t,r,e,n){r<0&&(r=4294967295+r+1);for(var i=0,o=Math.min(t.length-e,4);i<o;++i)t[e+i]=r>>>8*(n?i:3-i)&255}function k(t,r,e,n,i,o){if(e+n>t.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function D(t,r,e,n,o){return o||k(t,0,e,4),i.write(t,r,e,n,23,4),e+4}function F(t,r,e,n,o){return o||k(t,0,e,8),i.write(t,r,e,n,52,8),e+8}a.prototype.slice=function(t,r){var e,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(r=void 0===r?n:~~r)<0?(r+=n)<0&&(r=0):r>n&&(r=n),r<t&&(r=t),a.TYPED_ARRAY_SUPPORT)(e=this.subarray(t,r)).__proto__=a.prototype;else{var i=r-t;e=new a(i,void 0);for(var o=0;o<i;++o)e[o]=this[o+t]}return e},a.prototype.readUIntLE=function(t,r,e){t|=0,r|=0,e||P(t,r,this.length);for(var n=this[t],i=1,o=0;++o<r&&(i*=256);)n+=this[t+o]*i;return n},a.prototype.readUIntBE=function(t,r,e){t|=0,r|=0,e||P(t,r,this.length);for(var n=this[t+--r],i=1;r>0&&(i*=256);)n+=this[t+--r]*i;return n},a.prototype.readUInt8=function(t,r){return r||P(t,1,this.length),this[t]},a.prototype.readUInt16LE=function(t,r){return r||P(t,2,this.length),this[t]|this[t+1]<<8},a.prototype.readUInt16BE=function(t,r){return r||P(t,2,this.length),this[t]<<8|this[t+1]},a.prototype.readUInt32LE=function(t,r){return r||P(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},a.prototype.readUInt32BE=function(t,r){return r||P(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},a.prototype.readIntLE=function(t,r,e){t|=0,r|=0,e||P(t,r,this.length);for(var n=this[t],i=1,o=0;++o<r&&(i*=256);)n+=this[t+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*r)),n},a.prototype.readIntBE=function(t,r,e){t|=0,r|=0,e||P(t,r,this.length);for(var n=r,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*r)),o},a.prototype.readInt8=function(t,r){return r||P(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},a.prototype.readInt16LE=function(t,r){r||P(t,2,this.length);var e=this[t]|this[t+1]<<8;return 32768&e?4294901760|e:e},a.prototype.readInt16BE=function(t,r){r||P(t,2,this.length);var e=this[t+1]|this[t]<<8;return 32768&e?4294901760|e:e},a.prototype.readInt32LE=function(t,r){return r||P(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},a.prototype.readInt32BE=function(t,r){return r||P(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},a.prototype.readFloatLE=function(t,r){return r||P(t,4,this.length),i.read(this,t,!0,23,4)},a.prototype.readFloatBE=function(t,r){return r||P(t,4,this.length),i.read(this,t,!1,23,4)},a.prototype.readDoubleLE=function(t,r){return r||P(t,8,this.length),i.read(this,t,!0,52,8)},a.prototype.readDoubleBE=function(t,r){return r||P(t,8,this.length),i.read(this,t,!1,52,8)},a.prototype.writeUIntLE=function(t,r,e,n){t=+t,r|=0,e|=0,n||T(this,t,r,e,Math.pow(2,8*e)-1,0);var i=1,o=0;for(this[r]=255&t;++o<e&&(i*=256);)this[r+o]=t/i&255;return r+e},a.prototype.writeUIntBE=function(t,r,e,n){t=+t,r|=0,e|=0,n||T(this,t,r,e,Math.pow(2,8*e)-1,0);var i=e-1,o=1;for(this[r+i]=255&t;--i>=0&&(o*=256);)this[r+i]=t/o&255;return r+e},a.prototype.writeUInt8=function(t,r,e){return t=+t,r|=0,e||T(this,t,r,1,255,0),a.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[r]=255&t,r+1},a.prototype.writeUInt16LE=function(t,r,e){return t=+t,r|=0,e||T(this,t,r,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):U(this,t,r,!0),r+2},a.prototype.writeUInt16BE=function(t,r,e){return t=+t,r|=0,e||T(this,t,r,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):U(this,t,r,!1),r+2},a.prototype.writeUInt32LE=function(t,r,e){return t=+t,r|=0,e||T(this,t,r,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=255&t):C(this,t,r,!0),r+4},a.prototype.writeUInt32BE=function(t,r,e){return t=+t,r|=0,e||T(this,t,r,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):C(this,t,r,!1),r+4},a.prototype.writeIntLE=function(t,r,e,n){if(t=+t,r|=0,!n){var i=Math.pow(2,8*e-1);T(this,t,r,e,i-1,-i)}var o=0,s=1,u=0;for(this[r]=255&t;++o<e&&(s*=256);)t<0&&0===u&&0!==this[r+o-1]&&(u=1),this[r+o]=(t/s>>0)-u&255;return r+e},a.prototype.writeIntBE=function(t,r,e,n){if(t=+t,r|=0,!n){var i=Math.pow(2,8*e-1);T(this,t,r,e,i-1,-i)}var o=e-1,s=1,u=0;for(this[r+o]=255&t;--o>=0&&(s*=256);)t<0&&0===u&&0!==this[r+o+1]&&(u=1),this[r+o]=(t/s>>0)-u&255;return r+e},a.prototype.writeInt8=function(t,r,e){return t=+t,r|=0,e||T(this,t,r,1,127,-128),a.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[r]=255&t,r+1},a.prototype.writeInt16LE=function(t,r,e){return t=+t,r|=0,e||T(this,t,r,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):U(this,t,r,!0),r+2},a.prototype.writeInt16BE=function(t,r,e){return t=+t,r|=0,e||T(this,t,r,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):U(this,t,r,!1),r+2},a.prototype.writeInt32LE=function(t,r,e){return t=+t,r|=0,e||T(this,t,r,4,2147483647,-2147483648),a.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24):C(this,t,r,!0),r+4},a.prototype.writeInt32BE=function(t,r,e){return t=+t,r|=0,e||T(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),a.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):C(this,t,r,!1),r+4},a.prototype.writeFloatLE=function(t,r,e){return D(this,t,r,!0,e)},a.prototype.writeFloatBE=function(t,r,e){return D(this,t,r,!1,e)},a.prototype.writeDoubleLE=function(t,r,e){return F(this,t,r,!0,e)},a.prototype.writeDoubleBE=function(t,r,e){return F(this,t,r,!1,e)},a.prototype.copy=function(t,r,e,n){if(e||(e=0),n||0===n||(n=this.length),r>=t.length&&(r=t.length),r||(r=0),n>0&&n<e&&(n=e),n===e)return 0;if(0===t.length||0===this.length)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(e<0||e>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-r<n-e&&(n=t.length-r+e);var i,o=n-e;if(this===t&&e<r&&r<n)for(i=o-1;i>=0;--i)t[i+r]=this[i+e];else if(o<1e3||!a.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+r]=this[i+e];else Uint8Array.prototype.set.call(t,this.subarray(e,e+o),r);return o},a.prototype.fill=function(t,r,e,n){if("string"==typeof t){if("string"==typeof r?(n=r,r=0,e=this.length):"string"==typeof e&&(n=e,e=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!a.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(r<0||this.length<r||this.length<e)throw new RangeError("Out of range index");if(e<=r)return this;var o;if(r>>>=0,e=void 0===e?this.length:e>>>0,t||(t=0),"number"==typeof t)for(o=r;o<e;++o)this[o]=t;else{var s=a.isBuffer(t)?t:q(new a(t,n).toString()),u=s.length;for(o=0;o<e-r;++o)this[o+r]=s[o%u]}return this};var j=/[^+\/0-9A-Za-z-_]/g;function L(t){return t<16?"0"+t.toString(16):t.toString(16)}function q(t,r){var e;r=r||1/0;for(var n=t.length,i=null,o=[],s=0;s<n;++s){if((e=t.charCodeAt(s))>55295&&e<57344){if(!i){if(e>56319){(r-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(r-=3)>-1&&o.push(239,191,189);continue}i=e;continue}if(e<56320){(r-=3)>-1&&o.push(239,191,189),i=e;continue}e=65536+(i-55296<<10|e-56320)}else i&&(r-=3)>-1&&o.push(239,191,189);if(i=null,e<128){if((r-=1)<0)break;o.push(e)}else if(e<2048){if((r-=2)<0)break;o.push(e>>6|192,63&e|128)}else if(e<65536){if((r-=3)<0)break;o.push(e>>12|224,e>>6&63|128,63&e|128)}else{if(!(e<1114112))throw new Error("Invalid code point");if((r-=4)<0)break;o.push(e>>18|240,e>>12&63|128,e>>6&63|128,63&e|128)}}return o}function H(t){return n.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(j,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function G(t,r,e,n){for(var i=0;i<n&&!(i+e>=r.length||i>=t.length);++i)r[i+e]=t[i];return i}}).call(this,e(3))},function(t,r,e){"use strict";r.byteLength=function(t){var r=f(t),e=r[0],n=r[1];return 3*(e+n)/4-n},r.toByteArray=function(t){var r,e,n=f(t),s=n[0],u=n[1],a=new o(3*(s+u)/4-u),h=0,l=u>0?s-4:s;for(e=0;e<l;e+=4)r=i[t.charCodeAt(e)]<<18|i[t.charCodeAt(e+1)]<<12|i[t.charCodeAt(e+2)]<<6|i[t.charCodeAt(e+3)],a[h++]=r>>16&255,a[h++]=r>>8&255,a[h++]=255&r;return 2===u&&(r=i[t.charCodeAt(e)]<<2|i[t.charCodeAt(e+1)]>>4,a[h++]=255&r),1===u&&(r=i[t.charCodeAt(e)]<<10|i[t.charCodeAt(e+1)]<<4|i[t.charCodeAt(e+2)]>>2,a[h++]=r>>8&255,a[h++]=255&r),a},r.fromByteArray=function(t){for(var r,e=t.length,i=e%3,o=[],s=0,u=e-i;s<u;s+=16383)o.push(h(t,s,s+16383>u?u:s+16383));return 1===i?(r=t[e-1],o.push(n[r>>2]+n[r<<4&63]+"==")):2===i&&(r=(t[e-2]<<8)+t[e-1],o.push(n[r>>10]+n[r>>4&63]+n[r<<2&63]+"=")),o.join("")};for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=0,a=s.length;u<a;++u)n[u]=s[u],i[s.charCodeAt(u)]=u;function f(t){var r=t.length;if(r%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var e=t.indexOf("=");return-1===e&&(e=r),[e,e===r?0:4-e%4]}function h(t,r,e){for(var i,o,s=[],u=r;u<e;u+=3)i=(t[u]<<16&16711680)+(t[u+1]<<8&65280)+(255&t[u+2]),s.push(n[(o=i)>>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return s.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(t,r){r.read=function(t,r,e,n,i){var o,s,u=8*i-n-1,a=(1<<u)-1,f=a>>1,h=-7,l=e?i-1:0,c=e?-1:1,d=t[r+l];for(l+=c,o=d&(1<<-h)-1,d>>=-h,h+=u;h>0;o=256*o+t[r+l],l+=c,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=n;h>0;s=256*s+t[r+l],l+=c,h-=8);if(0===o)o=1-f;else{if(o===a)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,n),o-=f}return(d?-1:1)*s*Math.pow(2,o-n)},r.write=function(t,r,e,n,i,o){var s,u,a,f=8*o-i-1,h=(1<<f)-1,l=h>>1,c=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,m=r<0||0===r&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(u=isNaN(r)?1:0,s=h):(s=Math.floor(Math.log(r)/Math.LN2),r*(a=Math.pow(2,-s))<1&&(s--,a*=2),(r+=s+l>=1?c/a:c*Math.pow(2,1-l))*a>=2&&(s++,a/=2),s+l>=h?(u=0,s=h):s+l>=1?(u=(r*a-1)*Math.pow(2,i),s+=l):(u=r*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;t[e+d]=255&u,d+=p,u/=256,i-=8);for(s=s<<i|u,f+=i;f>0;t[e+d]=255&s,d+=p,s/=256,f-=8);t[e+d-p]|=128*m}},function(t,r){var e={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==e.call(t)}},function(t,r,e){"use strict";e.r(r),e.d(r,"__extends",function(){return i}),e.d(r,"__assign",function(){return o}),e.d(r,"__rest",function(){return s}),e.d(r,"__decorate",function(){return u}),e.d(r,"__param",function(){return a}),e.d(r,"__metadata",function(){return f}),e.d(r,"__awaiter",function(){return h}),e.d(r,"__generator",function(){return l}),e.d(r,"__exportStar",function(){return c}),e.d(r,"__values",function(){return d}),e.d(r,"__read",function(){return p}),e.d(r,"__spread",function(){return m}),e.d(r,"__spreadArrays",function(){return g}),e.d(r,"__await",function(){return v}),e.d(r,"__asyncGenerator",function(){return y}),e.d(r,"__asyncDelegator",function(){return w}),e.d(r,"__asyncValues",function(){return b}),e.d(r,"__makeTemplateObject",function(){return _}),e.d(r,"__importStar",function(){return M}),e.d(r,"__importDefault",function(){return E});
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0

THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.

See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
var n=function(t,r){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var e in r)r.hasOwnProperty(e)&&(t[e]=r[e])})(t,r)};function i(t,r){function e(){this.constructor=t}n(t,r),t.prototype=null===r?Object.create(r):(e.prototype=r.prototype,new e)}var o=function(){return(o=Object.assign||function(t){for(var r,e=1,n=arguments.length;e<n;e++)for(var i in r=arguments[e])Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i]);return t}).apply(this,arguments)};function s(t,r){var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&r.indexOf(n)<0&&(e[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(t);i<n.length;i++)r.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(e[n[i]]=t[n[i]])}return e}function u(t,r,e,n){var i,o=arguments.length,s=o<3?r:null===n?n=Object.getOwnPropertyDescriptor(r,e):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,r,e,n);else for(var u=t.length-1;u>=0;u--)(i=t[u])&&(s=(o<3?i(s):o>3?i(r,e,s):i(r,e))||s);return o>3&&s&&Object.defineProperty(r,e,s),s}function a(t,r){return function(e,n){r(e,n,t)}}function f(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)}function h(t,r,e,n){return new(e||(e=Promise))(function(i,o){function s(t){try{a(n.next(t))}catch(t){o(t)}}function u(t){try{a(n.throw(t))}catch(t){o(t)}}function a(t){t.done?i(t.value):new e(function(r){r(t.value)}).then(s,u)}a((n=n.apply(t,r||[])).next())})}function l(t,r){var e,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(o){return function(u){return function(o){if(e)throw new TypeError("Generator is already executing.");for(;s;)try{if(e=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=r.call(t,s)}catch(t){o=[6,t],n=0}finally{e=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}}function c(t,r){for(var e in t)r.hasOwnProperty(e)||(r[e]=t[e])}function d(t){var r="function"==typeof Symbol&&t[Symbol.iterator],e=0;return r?r.call(t):{next:function(){return t&&e>=t.length&&(t=void 0),{value:t&&t[e++],done:!t}}}}function p(t,r){var e="function"==typeof Symbol&&t[Symbol.iterator];if(!e)return t;var n,i,o=e.call(t),s=[];try{for(;(void 0===r||r-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(e=o.return)&&e.call(o)}finally{if(i)throw i.error}}return s}function m(){for(var t=[],r=0;r<arguments.length;r++)t=t.concat(p(arguments[r]));return t}function g(){for(var t=0,r=0,e=arguments.length;r<e;r++)t+=arguments[r].length;var n=Array(t),i=0;for(r=0;r<e;r++)for(var o=arguments[r],s=0,u=o.length;s<u;s++,i++)n[i]=o[s];return n}function v(t){return this instanceof v?(this.v=t,this):new v(t)}function y(t,r,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,i=e.apply(t,r||[]),o=[];return n={},s("next"),s("throw"),s("return"),n[Symbol.asyncIterator]=function(){return this},n;function s(t){i[t]&&(n[t]=function(r){return new Promise(function(e,n){o.push([t,r,e,n])>1||u(t,r)})})}function u(t,r){try{(e=i[t](r)).value instanceof v?Promise.resolve(e.value.v).then(a,f):h(o[0][2],e)}catch(t){h(o[0][3],t)}var e}function a(t){u("next",t)}function f(t){u("throw",t)}function h(t,r){t(r),o.shift(),o.length&&u(o[0][0],o[0][1])}}function w(t){var r,e;return r={},n("next"),n("throw",function(t){throw t}),n("return"),r[Symbol.iterator]=function(){return this},r;function n(n,i){r[n]=t[n]?function(r){return(e=!e)?{value:v(t[n](r)),done:"return"===n}:i?i(r):r}:i}}function b(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,e=t[Symbol.asyncIterator];return e?e.call(t):(t=d(t),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(e){r[e]=t[e]&&function(r){return new Promise(function(n,i){!function(t,r,e,n){Promise.resolve(n).then(function(r){t({value:r,done:e})},r)}(n,i,(r=t[e](r)).done,r.value)})}}}function _(t,r){return Object.defineProperty?Object.defineProperty(t,"raw",{value:r}):t.raw=r,t}function M(t){if(t&&t.__esModule)return t;var r={};if(null!=t)for(var e in t)Object.hasOwnProperty.call(t,e)&&(r[e]=t[e]);return r.default=t,r}function E(t){return t&&t.__esModule?t:{default:t}}},function(t,r,e){var n;!function(i){"use strict";var o,s=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator,a=Math.ceil,f=Math.floor,h="[BigNumber Error] ",l=h+"Number primitive has more than 15 significant digits: ",c=1e14,d=14,p=9007199254740991,m=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],g=1e7,v=1e9;function y(t){var r=0|t;return t>0||t===r?r:r-1}function w(t){for(var r,e,n=1,i=t.length,o=t[0]+"";n<i;){for(r=t[n++]+"",e=d-r.length;e--;r="0"+r);o+=r}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function b(t,r){var e,n,i=t.c,o=r.c,s=t.s,u=r.s,a=t.e,f=r.e;if(!s||!u)return null;if(e=i&&!i[0],n=o&&!o[0],e||n)return e?n?0:-u:s;if(s!=u)return s;if(e=s<0,n=a==f,!i||!o)return n?0:!i^e?1:-1;if(!n)return a>f^e?1:-1;for(u=(a=i.length)<(f=o.length)?a:f,s=0;s<u;s++)if(i[s]!=o[s])return i[s]>o[s]^e?1:-1;return a==f?0:a>f^e?1:-1}function _(t,r,e,n){if(t<r||t>e||t!==f(t))throw Error(h+(n||"Argument")+("number"==typeof t?t<r||t>e?" out of range: ":" not an integer: ":" not a primitive number: ")+String(t))}function M(t){var r=t.c.length-1;return y(t.e/d)==r&&t.c[r]%2!=0}function E(t,r){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(r<0?"e":"e+")+r}function S(t,r,e){var n,i;if(r<0){for(i=e+".";++r;i+=e);t=i+t}else if(++r>(n=t.length)){for(i=e,r-=n;--r;i+=e);t+=i}else r<n&&(t=t.slice(0,r)+"."+t.slice(r));return t}(o=function t(r){var e,n,i,o,A,R,O,N,B,x=G.prototype={constructor:G,toString:null,valueOf:null},I=new G(1),P=20,T=4,U=-7,C=21,k=-1e7,D=1e7,F=!1,j=1,L=0,q={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},H="0123456789abcdefghijklmnopqrstuvwxyz";function G(t,r){var e,o,u,a,h,c,m,g,v=this;if(!(v instanceof G))return new G(t,r);if(null==r){if(t&&!0===t._isBigNumber)return v.s=t.s,void(!t.c||t.e>D?v.c=v.e=null:t.e<k?v.c=[v.e=0]:(v.e=t.e,v.c=t.c.slice()));if((c="number"==typeof t)&&0*t==0){if(v.s=1/t<0?(t=-t,-1):1,t===~~t){for(a=0,h=t;h>=10;h/=10,a++);return void(a>D?v.c=v.e=null:(v.e=a,v.c=[t]))}g=String(t)}else{if(!s.test(g=String(t)))return i(v,g,c);v.s=45==g.charCodeAt(0)?(g=g.slice(1),-1):1}(a=g.indexOf("."))>-1&&(g=g.replace(".","")),(h=g.search(/e/i))>0?(a<0&&(a=h),a+=+g.slice(h+1),g=g.substring(0,h)):a<0&&(a=g.length)}else{if(_(r,2,H.length,"Base"),10==r)return V(v=new G(t),P+v.e+1,T);if(g=String(t),c="number"==typeof t){if(0*t!=0)return i(v,g,c,r);if(v.s=1/t<0?(g=g.slice(1),-1):1,G.DEBUG&&g.replace(/^0\.0*|\./,"").length>15)throw Error(l+t)}else v.s=45===g.charCodeAt(0)?(g=g.slice(1),-1):1;for(e=H.slice(0,r),a=h=0,m=g.length;h<m;h++)if(e.indexOf(o=g.charAt(h))<0){if("."==o){if(h>a){a=m;continue}}else if(!u&&(g==g.toUpperCase()&&(g=g.toLowerCase())||g==g.toLowerCase()&&(g=g.toUpperCase()))){u=!0,h=-1,a=0;continue}return i(v,String(t),c,r)}c=!1,(a=(g=n(g,r,10,v.s)).indexOf("."))>-1?g=g.replace(".",""):a=g.length}for(h=0;48===g.charCodeAt(h);h++);for(m=g.length;48===g.charCodeAt(--m););if(g=g.slice(h,++m)){if(m-=h,c&&G.DEBUG&&m>15&&(t>p||t!==f(t)))throw Error(l+v.s*t);if((a=a-h-1)>D)v.c=v.e=null;else if(a<k)v.c=[v.e=0];else{if(v.e=a,v.c=[],h=(a+1)%d,a<0&&(h+=d),h<m){for(h&&v.c.push(+g.slice(0,h)),m-=d;h<m;)v.c.push(+g.slice(h,h+=d));h=d-(g=g.slice(h)).length}else h-=m;for(;h--;g+="0");v.c.push(+g)}}else v.c=[v.e=0]}function z(t,r,e,n){var i,o,s,u,a;if(null==e?e=T:_(e,0,8),!t.c)return t.toString();if(i=t.c[0],s=t.e,null==r)a=w(t.c),a=1==n||2==n&&(s<=U||s>=C)?E(a,s):S(a,s,"0");else if(o=(t=V(new G(t),r,e)).e,u=(a=w(t.c)).length,1==n||2==n&&(r<=o||o<=U)){for(;u<r;a+="0",u++);a=E(a,o)}else if(r-=s,a=S(a,o,"0"),o+1>u){if(--r>0)for(a+=".";r--;a+="0");}else if((r+=o-u)>0)for(o+1==u&&(a+=".");r--;a+="0");return t.s<0&&i?"-"+a:a}function Y(t,r){for(var e,n=1,i=new G(t[0]);n<t.length;n++){if(!(e=new G(t[n])).s){i=e;break}r.call(i,e)&&(i=e)}return i}function Z(t,r,e){for(var n=1,i=r.length;!r[--i];r.pop());for(i=r[0];i>=10;i/=10,n++);return(e=n+e*d-1)>D?t.c=t.e=null:e<k?t.c=[t.e=0]:(t.e=e,t.c=r),t}function V(t,r,e,n){var i,o,s,u,h,l,p,g=t.c,v=m;if(g){t:{for(i=1,u=g[0];u>=10;u/=10,i++);if((o=r-i)<0)o+=d,s=r,p=(h=g[l=0])/v[i-s-1]%10|0;else if((l=a((o+1)/d))>=g.length){if(!n)break t;for(;g.length<=l;g.push(0));h=p=0,i=1,s=(o%=d)-d+1}else{for(h=u=g[l],i=1;u>=10;u/=10,i++);p=(s=(o%=d)-d+i)<0?0:h/v[i-s-1]%10|0}if(n=n||r<0||null!=g[l+1]||(s<0?h:h%v[i-s-1]),n=e<4?(p||n)&&(0==e||e==(t.s<0?3:2)):p>5||5==p&&(4==e||n||6==e&&(o>0?s>0?h/v[i-s]:0:g[l-1])%10&1||e==(t.s<0?8:7)),r<1||!g[0])return g.length=0,n?(r-=t.e+1,g[0]=v[(d-r%d)%d],t.e=-r||0):g[0]=t.e=0,t;if(0==o?(g.length=l,u=1,l--):(g.length=l+1,u=v[d-o],g[l]=s>0?f(h/v[i-s]%v[s])*u:0),n)for(;;){if(0==l){for(o=1,s=g[0];s>=10;s/=10,o++);for(s=g[0]+=u,u=1;s>=10;s/=10,u++);o!=u&&(t.e++,g[0]==c&&(g[0]=1));break}if(g[l]+=u,g[l]!=c)break;g[l--]=0,u=1}for(o=g.length;0===g[--o];g.pop());}t.e>D?t.c=t.e=null:t.e<k&&(t.c=[t.e=0])}return t}function J(t){var r,e=t.e;return null===e?t.toString():(r=w(t.c),r=e<=U||e>=C?E(r,e):S(r,e,"0"),t.s<0?"-"+r:r)}return G.clone=t,G.ROUND_UP=0,G.ROUND_DOWN=1,G.ROUND_CEIL=2,G.ROUND_FLOOR=3,G.ROUND_HALF_UP=4,G.ROUND_HALF_DOWN=5,G.ROUND_HALF_EVEN=6,G.ROUND_HALF_CEIL=7,G.ROUND_HALF_FLOOR=8,G.EUCLID=9,G.config=G.set=function(t){var r,e;if(null!=t){if("object"!=typeof t)throw Error(h+"Object expected: "+t);if(t.hasOwnProperty(r="DECIMAL_PLACES")&&(_(e=t[r],0,v,r),P=e),t.hasOwnProperty(r="ROUNDING_MODE")&&(_(e=t[r],0,8,r),T=e),t.hasOwnProperty(r="EXPONENTIAL_AT")&&((e=t[r])&&e.pop?(_(e[0],-v,0,r),_(e[1],0,v,r),U=e[0],C=e[1]):(_(e,-v,v,r),U=-(C=e<0?-e:e))),t.hasOwnProperty(r="RANGE"))if((e=t[r])&&e.pop)_(e[0],-v,-1,r),_(e[1],1,v,r),k=e[0],D=e[1];else{if(_(e,-v,v,r),!e)throw Error(h+r+" cannot be zero: "+e);k=-(D=e<0?-e:e)}if(t.hasOwnProperty(r="CRYPTO")){if((e=t[r])!==!!e)throw Error(h+r+" not true or false: "+e);if(e){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw F=!e,Error(h+"crypto unavailable");F=e}else F=e}if(t.hasOwnProperty(r="MODULO_MODE")&&(_(e=t[r],0,9,r),j=e),t.hasOwnProperty(r="POW_PRECISION")&&(_(e=t[r],0,v,r),L=e),t.hasOwnProperty(r="FORMAT")){if("object"!=typeof(e=t[r]))throw Error(h+r+" not an object: "+e);q=e}if(t.hasOwnProperty(r="ALPHABET")){if("string"!=typeof(e=t[r])||/^.$|[+-.\s]|(.).*\1/.test(e))throw Error(h+r+" invalid: "+e);H=e}}return{DECIMAL_PLACES:P,ROUNDING_MODE:T,EXPONENTIAL_AT:[U,C],RANGE:[k,D],CRYPTO:F,MODULO_MODE:j,POW_PRECISION:L,FORMAT:q,ALPHABET:H}},G.isBigNumber=function(t){if(!t||!0!==t._isBigNumber)return!1;if(!G.DEBUG)return!0;var r,e,n=t.c,i=t.e,o=t.s;t:if("[object Array]"=={}.toString.call(n)){if((1===o||-1===o)&&i>=-v&&i<=v&&i===f(i)){if(0===n[0]){if(0===i&&1===n.length)return!0;break t}if((r=(i+1)%d)<1&&(r+=d),String(n[0]).length==r){for(r=0;r<n.length;r++)if((e=n[r])<0||e>=c||e!==f(e))break t;if(0!==e)return!0}}}else if(null===n&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(h+"Invalid BigNumber: "+t)},G.maximum=G.max=function(){return Y(arguments,x.lt)},G.minimum=G.min=function(){return Y(arguments,x.gt)},G.random=(o=9007199254740992*Math.random()&2097151?function(){return f(9007199254740992*Math.random())}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(t){var r,e,n,i,s,u=0,l=[],c=new G(I);if(null==t?t=P:_(t,0,v),i=a(t/d),F)if(crypto.getRandomValues){for(r=crypto.getRandomValues(new Uint32Array(i*=2));u<i;)(s=131072*r[u]+(r[u+1]>>>11))>=9e15?(e=crypto.getRandomValues(new Uint32Array(2)),r[u]=e[0],r[u+1]=e[1]):(l.push(s%1e14),u+=2);u=i/2}else{if(!crypto.randomBytes)throw F=!1,Error(h+"crypto unavailable");for(r=crypto.randomBytes(i*=7);u<i;)(s=281474976710656*(31&r[u])+1099511627776*r[u+1]+4294967296*r[u+2]+16777216*r[u+3]+(r[u+4]<<16)+(r[u+5]<<8)+r[u+6])>=9e15?crypto.randomBytes(7).copy(r,u):(l.push(s%1e14),u+=7);u=i/7}if(!F)for(;u<i;)(s=o())<9e15&&(l[u++]=s%1e14);for(i=l[--u],t%=d,i&&t&&(s=m[d-t],l[u]=f(i/s)*s);0===l[u];l.pop(),u--);if(u<0)l=[n=0];else{for(n=-1;0===l[0];l.splice(0,1),n-=d);for(u=1,s=l[0];s>=10;s/=10,u++);u<d&&(n-=d-u)}return c.e=n,c.c=l,c}),G.sum=function(){for(var t=1,r=arguments,e=new G(r[0]);t<r.length;)e=e.plus(r[t++]);return e},n=function(){function t(t,r,e,n){for(var i,o,s=[0],u=0,a=t.length;u<a;){for(o=s.length;o--;s[o]*=r);for(s[0]+=n.indexOf(t.charAt(u++)),i=0;i<s.length;i++)s[i]>e-1&&(null==s[i+1]&&(s[i+1]=0),s[i+1]+=s[i]/e|0,s[i]%=e)}return s.reverse()}return function(r,n,i,o,s){var u,a,f,h,l,c,d,p,m=r.indexOf("."),g=P,v=T;for(m>=0&&(h=L,L=0,r=r.replace(".",""),c=(p=new G(n)).pow(r.length-m),L=h,p.c=t(S(w(c.c),c.e,"0"),10,i,"0123456789"),p.e=p.c.length),f=h=(d=t(r,n,i,s?(u=H,"0123456789"):(u="0123456789",H))).length;0==d[--h];d.pop());if(!d[0])return u.charAt(0);if(m<0?--f:(c.c=d,c.e=f,c.s=o,d=(c=e(c,p,g,v,i)).c,l=c.r,f=c.e),m=d[a=f+g+1],h=i/2,l=l||a<0||null!=d[a+1],l=v<4?(null!=m||l)&&(0==v||v==(c.s<0?3:2)):m>h||m==h&&(4==v||l||6==v&&1&d[a-1]||v==(c.s<0?8:7)),a<1||!d[0])r=l?S(u.charAt(1),-g,u.charAt(0)):u.charAt(0);else{if(d.length=a,l)for(--i;++d[--a]>i;)d[a]=0,a||(++f,d=[1].concat(d));for(h=d.length;!d[--h];);for(m=0,r="";m<=h;r+=u.charAt(d[m++]));r=S(r,f,u.charAt(0))}return r}}(),e=function(){function t(t,r,e){var n,i,o,s,u=0,a=t.length,f=r%g,h=r/g|0;for(t=t.slice();a--;)u=((i=f*(o=t[a]%g)+(n=h*o+(s=t[a]/g|0)*f)%g*g+u)/e|0)+(n/g|0)+h*s,t[a]=i%e;return u&&(t=[u].concat(t)),t}function r(t,r,e,n){var i,o;if(e!=n)o=e>n?1:-1;else for(i=o=0;i<e;i++)if(t[i]!=r[i]){o=t[i]>r[i]?1:-1;break}return o}function e(t,r,e,n){for(var i=0;e--;)t[e]-=i,i=t[e]<r[e]?1:0,t[e]=i*n+t[e]-r[e];for(;!t[0]&&t.length>1;t.splice(0,1));}return function(n,i,o,s,u){var a,h,l,p,m,g,v,w,b,_,M,E,S,A,R,O,N,B=n.s==i.s?1:-1,x=n.c,I=i.c;if(!(x&&x[0]&&I&&I[0]))return new G(n.s&&i.s&&(x?!I||x[0]!=I[0]:I)?x&&0==x[0]||!I?0*B:B/0:NaN);for(b=(w=new G(B)).c=[],B=o+(h=n.e-i.e)+1,u||(u=c,h=y(n.e/d)-y(i.e/d),B=B/d|0),l=0;I[l]==(x[l]||0);l++);if(I[l]>(x[l]||0)&&h--,B<0)b.push(1),p=!0;else{for(A=x.length,O=I.length,l=0,B+=2,(m=f(u/(I[0]+1)))>1&&(I=t(I,m,u),x=t(x,m,u),O=I.length,A=x.length),S=O,M=(_=x.slice(0,O)).length;M<O;_[M++]=0);N=I.slice(),N=[0].concat(N),R=I[0],I[1]>=u/2&&R++;do{if(m=0,(a=r(I,_,O,M))<0){if(E=_[0],O!=M&&(E=E*u+(_[1]||0)),(m=f(E/R))>1)for(m>=u&&(m=u-1),v=(g=t(I,m,u)).length,M=_.length;1==r(g,_,v,M);)m--,e(g,O<v?N:I,v,u),v=g.length,a=1;else 0==m&&(a=m=1),v=(g=I.slice()).length;if(v<M&&(g=[0].concat(g)),e(_,g,M,u),M=_.length,-1==a)for(;r(I,_,O,M)<1;)m++,e(_,O<M?N:I,M,u),M=_.length}else 0===a&&(m++,_=[0]);b[l++]=m,_[0]?_[M++]=x[S]||0:(_=[x[S]],M=1)}while((S++<A||null!=_[0])&&B--);p=null!=_[0],b[0]||b.splice(0,1)}if(u==c){for(l=1,B=b[0];B>=10;B/=10,l++);V(w,o+(w.e=l+h*d-1)+1,s,p)}else w.e=h,w.r=+p;return w}}(),A=/^(-?)0([xbo])(?=\w[\w.]*$)/i,R=/^([^.]+)\.$/,O=/^\.([^.]+)$/,N=/^-?(Infinity|NaN)$/,B=/^\s*\+(?=[\w.])|^\s+|\s+$/g,i=function(t,r,e,n){var i,o=e?r:r.replace(B,"");if(N.test(o))t.s=isNaN(o)?null:o<0?-1:1;else{if(!e&&(o=o.replace(A,function(t,r,e){return i="x"==(e=e.toLowerCase())?16:"b"==e?2:8,n&&n!=i?t:r}),n&&(i=n,o=o.replace(R,"$1").replace(O,"0.$1")),r!=o))return new G(o,i);if(G.DEBUG)throw Error(h+"Not a"+(n?" base "+n:"")+" number: "+r);t.s=null}t.c=t.e=null},x.absoluteValue=x.abs=function(){var t=new G(this);return t.s<0&&(t.s=1),t},x.comparedTo=function(t,r){return b(this,new G(t,r))},x.decimalPlaces=x.dp=function(t,r){var e,n,i,o=this;if(null!=t)return _(t,0,v),null==r?r=T:_(r,0,8),V(new G(o),t+o.e+1,r);if(!(e=o.c))return null;if(n=((i=e.length-1)-y(this.e/d))*d,i=e[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},x.dividedBy=x.div=function(t,r){return e(this,new G(t,r),P,T)},x.dividedToIntegerBy=x.idiv=function(t,r){return e(this,new G(t,r),0,1)},x.exponentiatedBy=x.pow=function(t,r){var e,n,i,o,s,u,l,c,p=this;if((t=new G(t)).c&&!t.isInteger())throw Error(h+"Exponent not an integer: "+J(t));if(null!=r&&(r=new G(r)),s=t.e>14,!p.c||!p.c[0]||1==p.c[0]&&!p.e&&1==p.c.length||!t.c||!t.c[0])return c=new G(Math.pow(+J(p),s?2-M(t):+J(t))),r?c.mod(r):c;if(u=t.s<0,r){if(r.c?!r.c[0]:!r.s)return new G(NaN);(n=!u&&p.isInteger()&&r.isInteger())&&(p=p.mod(r))}else{if(t.e>9&&(p.e>0||p.e<-1||(0==p.e?p.c[0]>1||s&&p.c[1]>=24e7:p.c[0]<8e13||s&&p.c[0]<=9999975e7)))return o=p.s<0&&M(t)?-0:0,p.e>-1&&(o=1/o),new G(u?1/o:o);L&&(o=a(L/d+2))}for(s?(e=new G(.5),u&&(t.s=1),l=M(t)):l=(i=Math.abs(+J(t)))%2,c=new G(I);;){if(l){if(!(c=c.times(p)).c)break;o?c.c.length>o&&(c.c.length=o):n&&(c=c.mod(r))}if(i){if(0===(i=f(i/2)))break;l=i%2}else if(V(t=t.times(e),t.e+1,1),t.e>14)l=M(t);else{if(0==(i=+J(t)))break;l=i%2}p=p.times(p),o?p.c&&p.c.length>o&&(p.c.length=o):n&&(p=p.mod(r))}return n?c:(u&&(c=I.div(c)),r?c.mod(r):o?V(c,L,T,void 0):c)},x.integerValue=function(t){var r=new G(this);return null==t?t=T:_(t,0,8),V(r,r.e+1,t)},x.isEqualTo=x.eq=function(t,r){return 0===b(this,new G(t,r))},x.isFinite=function(){return!!this.c},x.isGreaterThan=x.gt=function(t,r){return b(this,new G(t,r))>0},x.isGreaterThanOrEqualTo=x.gte=function(t,r){return 1===(r=b(this,new G(t,r)))||0===r},x.isInteger=function(){return!!this.c&&y(this.e/d)>this.c.length-2},x.isLessThan=x.lt=function(t,r){return b(this,new G(t,r))<0},x.isLessThanOrEqualTo=x.lte=function(t,r){return-1===(r=b(this,new G(t,r)))||0===r},x.isNaN=function(){return!this.s},x.isNegative=function(){return this.s<0},x.isPositive=function(){return this.s>0},x.isZero=function(){return!!this.c&&0==this.c[0]},x.minus=function(t,r){var e,n,i,o,s=this,u=s.s;if(r=(t=new G(t,r)).s,!u||!r)return new G(NaN);if(u!=r)return t.s=-r,s.plus(t);var a=s.e/d,f=t.e/d,h=s.c,l=t.c;if(!a||!f){if(!h||!l)return h?(t.s=-r,t):new G(l?s:NaN);if(!h[0]||!l[0])return l[0]?(t.s=-r,t):new G(h[0]?s:3==T?-0:0)}if(a=y(a),f=y(f),h=h.slice(),u=a-f){for((o=u<0)?(u=-u,i=h):(f=a,i=l),i.reverse(),r=u;r--;i.push(0));i.reverse()}else for(n=(o=(u=h.length)<(r=l.length))?u:r,u=r=0;r<n;r++)if(h[r]!=l[r]){o=h[r]<l[r];break}if(o&&(i=h,h=l,l=i,t.s=-t.s),(r=(n=l.length)-(e=h.length))>0)for(;r--;h[e++]=0);for(r=c-1;n>u;){if(h[--n]<l[n]){for(e=n;e&&!h[--e];h[e]=r);--h[e],h[n]+=c}h[n]-=l[n]}for(;0==h[0];h.splice(0,1),--f);return h[0]?Z(t,h,f):(t.s=3==T?-1:1,t.c=[t.e=0],t)},x.modulo=x.mod=function(t,r){var n,i,o=this;return t=new G(t,r),!o.c||!t.s||t.c&&!t.c[0]?new G(NaN):!t.c||o.c&&!o.c[0]?new G(o):(9==j?(i=t.s,t.s=1,n=e(o,t,0,3),t.s=i,n.s*=i):n=e(o,t,0,j),(t=o.minus(n.times(t))).c[0]||1!=j||(t.s=o.s),t)},x.multipliedBy=x.times=function(t,r){var e,n,i,o,s,u,a,f,h,l,p,m,v,w,b,_=this,M=_.c,E=(t=new G(t,r)).c;if(!(M&&E&&M[0]&&E[0]))return!_.s||!t.s||M&&!M[0]&&!E||E&&!E[0]&&!M?t.c=t.e=t.s=null:(t.s*=_.s,M&&E?(t.c=[0],t.e=0):t.c=t.e=null),t;for(n=y(_.e/d)+y(t.e/d),t.s*=_.s,(a=M.length)<(l=E.length)&&(v=M,M=E,E=v,i=a,a=l,l=i),i=a+l,v=[];i--;v.push(0));for(w=c,b=g,i=l;--i>=0;){for(e=0,p=E[i]%b,m=E[i]/b|0,o=i+(s=a);o>i;)e=((f=p*(f=M[--s]%b)+(u=m*f+(h=M[s]/b|0)*p)%b*b+v[o]+e)/w|0)+(u/b|0)+m*h,v[o--]=f%w;v[o]=e}return e?++n:v.splice(0,1),Z(t,v,n)},x.negated=function(){var t=new G(this);return t.s=-t.s||null,t},x.plus=function(t,r){var e,n=this,i=n.s;if(r=(t=new G(t,r)).s,!i||!r)return new G(NaN);if(i!=r)return t.s=-r,n.minus(t);var o=n.e/d,s=t.e/d,u=n.c,a=t.c;if(!o||!s){if(!u||!a)return new G(i/0);if(!u[0]||!a[0])return a[0]?t:new G(u[0]?n:0*i)}if(o=y(o),s=y(s),u=u.slice(),i=o-s){for(i>0?(s=o,e=a):(i=-i,e=u),e.reverse();i--;e.push(0));e.reverse()}for((i=u.length)-(r=a.length)<0&&(e=a,a=u,u=e,r=i),i=0;r;)i=(u[--r]=u[r]+a[r]+i)/c|0,u[r]=c===u[r]?0:u[r]%c;return i&&(u=[i].concat(u),++s),Z(t,u,s)},x.precision=x.sd=function(t,r){var e,n,i,o=this;if(null!=t&&t!==!!t)return _(t,1,v),null==r?r=T:_(r,0,8),V(new G(o),t,r);if(!(e=o.c))return null;if(n=(i=e.length-1)*d+1,i=e[i]){for(;i%10==0;i/=10,n--);for(i=e[0];i>=10;i/=10,n++);}return t&&o.e+1>n&&(n=o.e+1),n},x.shiftedBy=function(t){return _(t,-p,p),this.times("1e"+t)},x.squareRoot=x.sqrt=function(){var t,r,n,i,o,s=this,u=s.c,a=s.s,f=s.e,h=P+4,l=new G("0.5");if(1!==a||!u||!u[0])return new G(!a||a<0&&(!u||u[0])?NaN:u?s:1/0);if(0==(a=Math.sqrt(+J(s)))||a==1/0?(((r=w(u)).length+f)%2==0&&(r+="0"),a=Math.sqrt(+r),f=y((f+1)/2)-(f<0||f%2),n=new G(r=a==1/0?"1e"+f:(r=a.toExponential()).slice(0,r.indexOf("e")+1)+f)):n=new G(a+""),n.c[0])for((a=(f=n.e)+h)<3&&(a=0);;)if(o=n,n=l.times(o.plus(e(s,o,h,1))),w(o.c).slice(0,a)===(r=w(n.c)).slice(0,a)){if(n.e<f&&--a,"9999"!=(r=r.slice(a-3,a+1))&&(i||"4999"!=r)){+r&&(+r.slice(1)||"5"!=r.charAt(0))||(V(n,n.e+P+2,1),t=!n.times(n).eq(s));break}if(!i&&(V(o,o.e+P+2,0),o.times(o).eq(s))){n=o;break}h+=4,a+=4,i=1}return V(n,n.e+P+1,T,t)},x.toExponential=function(t,r){return null!=t&&(_(t,0,v),t++),z(this,t,r,1)},x.toFixed=function(t,r){return null!=t&&(_(t,0,v),t=t+this.e+1),z(this,t,r)},x.toFormat=function(t,r,e){var n,i=this;if(null==e)null!=t&&r&&"object"==typeof r?(e=r,r=null):t&&"object"==typeof t?(e=t,t=r=null):e=q;else if("object"!=typeof e)throw Error(h+"Argument not an object: "+e);if(n=i.toFixed(t,r),i.c){var o,s=n.split("."),u=+e.groupSize,a=+e.secondaryGroupSize,f=e.groupSeparator||"",l=s[0],c=s[1],d=i.s<0,p=d?l.slice(1):l,m=p.length;if(a&&(o=u,u=a,a=o,m-=o),u>0&&m>0){for(o=m%u||u,l=p.substr(0,o);o<m;o+=u)l+=f+p.substr(o,u);a>0&&(l+=f+p.slice(o)),d&&(l="-"+l)}n=c?l+(e.decimalSeparator||"")+((a=+e.fractionGroupSize)?c.replace(new RegExp("\\d{"+a+"}\\B","g"),"$&"+(e.fractionGroupSeparator||"")):c):l}return(e.prefix||"")+n+(e.suffix||"")},x.toFraction=function(t){var r,n,i,o,s,u,a,f,l,c,p,g,v=this,y=v.c;if(null!=t&&(!(a=new G(t)).isInteger()&&(a.c||1!==a.s)||a.lt(I)))throw Error(h+"Argument "+(a.isInteger()?"out of range: ":"not an integer: ")+J(a));if(!y)return new G(v);for(r=new G(I),l=n=new G(I),i=f=new G(I),g=w(y),s=r.e=g.length-v.e-1,r.c[0]=m[(u=s%d)<0?d+u:u],t=!t||a.comparedTo(r)>0?s>0?r:l:a,u=D,D=1/0,a=new G(g),f.c[0]=0;c=e(a,r,0,1),1!=(o=n.plus(c.times(i))).comparedTo(t);)n=i,i=o,l=f.plus(c.times(o=l)),f=o,r=a.minus(c.times(o=r)),a=o;return o=e(t.minus(n),i,0,1),f=f.plus(o.times(l)),n=n.plus(o.times(i)),f.s=l.s=v.s,p=e(l,i,s*=2,T).minus(v).abs().comparedTo(e(f,n,s,T).minus(v).abs())<1?[l,i]:[f,n],D=u,p},x.toNumber=function(){return+J(this)},x.toPrecision=function(t,r){return null!=t&&_(t,1,v),z(this,t,r,2)},x.toString=function(t){var r,e=this,i=e.s,o=e.e;return null===o?i?(r="Infinity",i<0&&(r="-"+r)):r="NaN":(null==t?r=o<=U||o>=C?E(w(e.c),o):S(w(e.c),o,"0"):10===t?r=S(w((e=V(new G(e),P+o+1,T)).c),e.e,"0"):(_(t,2,H.length,"Base"),r=n(S(w(e.c),o,"0"),10,t,i,!0)),i<0&&e.c[0]&&(r="-"+r)),r},x.valueOf=x.toJSON=function(){return J(this)},x._isBigNumber=!0,u&&(x[Symbol.toStringTag]="BigNumber",x[Symbol.for("nodejs.util.inspect.custom")]=x.valueOf),null!=r&&G.set(r),G}()).default=o.BigNumber=o,void 0===(n=function(){return o}.call(r,e,r,t))||(t.exports=n)}()},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.version="logger/5.0.0-beta.128"},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.version="bytes/5.0.0-beta.128"},function(t,r,e){"use strict";var n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var r={};if(null!=t)for(var e in t)Object.hasOwnProperty.call(t,e)&&(r[e]=t[e]);return r.default=t,r};Object.defineProperty(r,"__esModule",{value:!0});var i=n(e(4)),o=e(0),s=e(19),u=e(22),a=e(1),f=e(23),h=new a.Logger(f.version);function l(t){o.isHexString(t,20)||h.throwArgumentError("invalid address","address",t);for(var r=(t=t.toLowerCase()).substring(2).split(""),e=new Uint8Array(40),n=0;n<40;n++)e[n]=r[n].charCodeAt(0);for(e=o.arrayify(s.keccak256(e)),n=0;n<40;n+=2)e[n>>1]>>4>=8&&(r[n]=r[n].toUpperCase()),(15&e[n>>1])>=8&&(r[n+1]=r[n+1].toUpperCase());return"0x"+r.join("")}for(var c={},d=0;d<10;d++)c[String(d)]=String(d);for(d=0;d<26;d++)c[String.fromCharCode(65+d)]=String(10+d);var p,m=Math.floor((p=9007199254740991,Math.log10?Math.log10(p):Math.log(p)/Math.LN10));function g(t){t=(t=t.toUpperCase()).substring(4)+t.substring(0,2)+"00";var r="";for(t.split("").forEach(function(t){r+=c[t]});r.length>=m;){var e=r.substring(0,m);r=parseInt(e,10)%97+r.substring(e.length)}for(var n=String(98-parseInt(r,10)%97);n.length<2;)n="0"+n;return n}function v(t){var r=null;if("string"!=typeof t&&h.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==t.substring(0,2)&&(t="0x"+t),r=l(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&r!==t&&h.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==g(t)&&h.throwArgumentError("bad icap checksum","address",t),r=new i.BN(t.substring(4),36).toString(16);r.length<40;)r="0"+r;r=l("0x"+r)}else h.throwArgumentError("invalid address","address",t);return r}r.getAddress=v,r.isAddress=function(t){try{return v(t),!0}catch(t){}return!1},r.getIcapAddress=function(t){for(var r=new i.BN(v(t).substring(2),16).toString(36).toUpperCase();r.length<30;)r="0"+r;return"XE"+g("XE00"+r)+r},r.getContractAddress=function(t){var r=null;try{r=v(t.from)}catch(r){h.throwArgumentError("missing from address","transaction",t)}var e=o.stripZeros(o.arrayify(t.nonce));return v(o.hexDataSlice(s.keccak256(u.encode([r,e])),12))}},function(t,r){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,r){},function(t,r,e){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(r,"__esModule",{value:!0});var i=n(e(20)),o=e(0);r.keccak256=function(t){return"0x"+i.default.keccak_256(o.arrayify(t))}},function(t,r,e){(function(r,e){
/**
 * [js-sha3]{@link https://github.com/emn178/js-sha3}
 *
 * @version 0.5.7
 * @author Chen, Yi-Cyuan [emn178@gmail.com]
 * @copyright Chen, Yi-Cyuan 2015-2016
 * @license MIT
 */
!function(){"use strict";var n="object"==typeof window?window:{};!n.JS_SHA3_NO_NODE_JS&&"object"==typeof r&&r.versions&&r.versions.node&&(n=e);for(var i=!n.JS_SHA3_NO_COMMON_JS&&"object"==typeof t&&t.exports,o="0123456789abcdef".split(""),s=[0,8,16,24],u=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],a=[224,256,384,512],f=["hex","buffer","arrayBuffer","array"],h=function(t,r,e){return function(n){return new _(t,r,t).update(n)[e]()}},l=function(t,r,e){return function(n,i){return new _(t,r,i).update(n)[e]()}},c=function(t,r){var e=h(t,r,"hex");e.create=function(){return new _(t,r,t)},e.update=function(t){return e.create().update(t)};for(var n=0;n<f.length;++n){var i=f[n];e[i]=h(t,r,i)}return e},d=[{name:"keccak",padding:[1,256,65536,16777216],bits:a,createMethod:c},{name:"sha3",padding:[6,1536,393216,100663296],bits:a,createMethod:c},{name:"shake",padding:[31,7936,2031616,520093696],bits:[128,256],createMethod:function(t,r){var e=l(t,r,"hex");e.create=function(e){return new _(t,r,e)},e.update=function(t,r){return e.create(r).update(t)};for(var n=0;n<f.length;++n){var i=f[n];e[i]=l(t,r,i)}return e}}],p={},m=[],g=0;g<d.length;++g)for(var v=d[g],y=v.bits,w=0;w<y.length;++w){var b=v.name+"_"+y[w];m.push(b),p[b]=v.createMethod(y[w],v.padding)}function _(t,r,e){this.blocks=[],this.s=[],this.padding=r,this.outputBits=e,this.reset=!0,this.block=0,this.start=0,this.blockCount=1600-(t<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=e>>5,this.extraBytes=(31&e)>>3;for(var n=0;n<50;++n)this.s[n]=0}_.prototype.update=function(t){var r="string"!=typeof t;r&&t.constructor===ArrayBuffer&&(t=new Uint8Array(t));for(var e,n,i=t.length,o=this.blocks,u=this.byteCount,a=this.blockCount,f=0,h=this.s;f<i;){if(this.reset)for(this.reset=!1,o[0]=this.block,e=1;e<a+1;++e)o[e]=0;if(r)for(e=this.start;f<i&&e<u;++f)o[e>>2]|=t[f]<<s[3&e++];else for(e=this.start;f<i&&e<u;++f)(n=t.charCodeAt(f))<128?o[e>>2]|=n<<s[3&e++]:n<2048?(o[e>>2]|=(192|n>>6)<<s[3&e++],o[e>>2]|=(128|63&n)<<s[3&e++]):n<55296||n>=57344?(o[e>>2]|=(224|n>>12)<<s[3&e++],o[e>>2]|=(128|n>>6&63)<<s[3&e++],o[e>>2]|=(128|63&n)<<s[3&e++]):(n=65536+((1023&n)<<10|1023&t.charCodeAt(++f)),o[e>>2]|=(240|n>>18)<<s[3&e++],o[e>>2]|=(128|n>>12&63)<<s[3&e++],o[e>>2]|=(128|n>>6&63)<<s[3&e++],o[e>>2]|=(128|63&n)<<s[3&e++]);if(this.lastByteIndex=e,e>=u){for(this.start=e-u,this.block=o[a],e=0;e<a;++e)h[e]^=o[e];M(h),this.reset=!0}else this.start=e}return this},_.prototype.finalize=function(){var t=this.blocks,r=this.lastByteIndex,e=this.blockCount,n=this.s;if(t[r>>2]|=this.padding[3&r],this.lastByteIndex===this.byteCount)for(t[0]=t[e],r=1;r<e+1;++r)t[r]=0;for(t[e-1]|=2147483648,r=0;r<e;++r)n[r]^=t[r];M(n)},_.prototype.toString=_.prototype.hex=function(){this.finalize();for(var t,r=this.blockCount,e=this.s,n=this.outputBlocks,i=this.extraBytes,s=0,u=0,a="";u<n;){for(s=0;s<r&&u<n;++s,++u)t=e[s],a+=o[t>>4&15]+o[15&t]+o[t>>12&15]+o[t>>8&15]+o[t>>20&15]+o[t>>16&15]+o[t>>28&15]+o[t>>24&15];u%r==0&&(M(e),s=0)}return i&&(t=e[s],i>0&&(a+=o[t>>4&15]+o[15&t]),i>1&&(a+=o[t>>12&15]+o[t>>8&15]),i>2&&(a+=o[t>>20&15]+o[t>>16&15])),a},_.prototype.arrayBuffer=function(){this.finalize();var t,r=this.blockCount,e=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,s=0,u=this.outputBits>>3;t=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(u);for(var a=new Uint32Array(t);s<n;){for(o=0;o<r&&s<n;++o,++s)a[s]=e[o];s%r==0&&M(e)}return i&&(a[o]=e[o],t=t.slice(0,u)),t},_.prototype.buffer=_.prototype.arrayBuffer,_.prototype.digest=_.prototype.array=function(){this.finalize();for(var t,r,e=this.blockCount,n=this.s,i=this.outputBlocks,o=this.extraBytes,s=0,u=0,a=[];u<i;){for(s=0;s<e&&u<i;++s,++u)t=u<<2,r=n[s],a[t]=255&r,a[t+1]=r>>8&255,a[t+2]=r>>16&255,a[t+3]=r>>24&255;u%e==0&&M(n)}return o&&(t=u<<2,r=n[s],o>0&&(a[t]=255&r),o>1&&(a[t+1]=r>>8&255),o>2&&(a[t+2]=r>>16&255)),a};var M=function(t){var r,e,n,i,o,s,a,f,h,l,c,d,p,m,g,v,y,w,b,_,M,E,S,A,R,O,N,B,x,I,P,T,U,C,k,D,F,j,L,q,H,G,z,Y,Z,V,J,W,K,$,X,Q,tt,rt,et,nt,it,ot,st,ut,at,ft,ht;for(n=0;n<48;n+=2)i=t[0]^t[10]^t[20]^t[30]^t[40],o=t[1]^t[11]^t[21]^t[31]^t[41],s=t[2]^t[12]^t[22]^t[32]^t[42],a=t[3]^t[13]^t[23]^t[33]^t[43],f=t[4]^t[14]^t[24]^t[34]^t[44],h=t[5]^t[15]^t[25]^t[35]^t[45],l=t[6]^t[16]^t[26]^t[36]^t[46],c=t[7]^t[17]^t[27]^t[37]^t[47],r=(d=t[8]^t[18]^t[28]^t[38]^t[48])^(s<<1|a>>>31),e=(p=t[9]^t[19]^t[29]^t[39]^t[49])^(a<<1|s>>>31),t[0]^=r,t[1]^=e,t[10]^=r,t[11]^=e,t[20]^=r,t[21]^=e,t[30]^=r,t[31]^=e,t[40]^=r,t[41]^=e,r=i^(f<<1|h>>>31),e=o^(h<<1|f>>>31),t[2]^=r,t[3]^=e,t[12]^=r,t[13]^=e,t[22]^=r,t[23]^=e,t[32]^=r,t[33]^=e,t[42]^=r,t[43]^=e,r=s^(l<<1|c>>>31),e=a^(c<<1|l>>>31),t[4]^=r,t[5]^=e,t[14]^=r,t[15]^=e,t[24]^=r,t[25]^=e,t[34]^=r,t[35]^=e,t[44]^=r,t[45]^=e,r=f^(d<<1|p>>>31),e=h^(p<<1|d>>>31),t[6]^=r,t[7]^=e,t[16]^=r,t[17]^=e,t[26]^=r,t[27]^=e,t[36]^=r,t[37]^=e,t[46]^=r,t[47]^=e,r=l^(i<<1|o>>>31),e=c^(o<<1|i>>>31),t[8]^=r,t[9]^=e,t[18]^=r,t[19]^=e,t[28]^=r,t[29]^=e,t[38]^=r,t[39]^=e,t[48]^=r,t[49]^=e,m=t[0],g=t[1],V=t[11]<<4|t[10]>>>28,J=t[10]<<4|t[11]>>>28,B=t[20]<<3|t[21]>>>29,x=t[21]<<3|t[20]>>>29,ut=t[31]<<9|t[30]>>>23,at=t[30]<<9|t[31]>>>23,G=t[40]<<18|t[41]>>>14,z=t[41]<<18|t[40]>>>14,C=t[2]<<1|t[3]>>>31,k=t[3]<<1|t[2]>>>31,v=t[13]<<12|t[12]>>>20,y=t[12]<<12|t[13]>>>20,W=t[22]<<10|t[23]>>>22,K=t[23]<<10|t[22]>>>22,I=t[33]<<13|t[32]>>>19,P=t[32]<<13|t[33]>>>19,ft=t[42]<<2|t[43]>>>30,ht=t[43]<<2|t[42]>>>30,rt=t[5]<<30|t[4]>>>2,et=t[4]<<30|t[5]>>>2,D=t[14]<<6|t[15]>>>26,F=t[15]<<6|t[14]>>>26,w=t[25]<<11|t[24]>>>21,b=t[24]<<11|t[25]>>>21,$=t[34]<<15|t[35]>>>17,X=t[35]<<15|t[34]>>>17,T=t[45]<<29|t[44]>>>3,U=t[44]<<29|t[45]>>>3,A=t[6]<<28|t[7]>>>4,R=t[7]<<28|t[6]>>>4,nt=t[17]<<23|t[16]>>>9,it=t[16]<<23|t[17]>>>9,j=t[26]<<25|t[27]>>>7,L=t[27]<<25|t[26]>>>7,_=t[36]<<21|t[37]>>>11,M=t[37]<<21|t[36]>>>11,Q=t[47]<<24|t[46]>>>8,tt=t[46]<<24|t[47]>>>8,Y=t[8]<<27|t[9]>>>5,Z=t[9]<<27|t[8]>>>5,O=t[18]<<20|t[19]>>>12,N=t[19]<<20|t[18]>>>12,ot=t[29]<<7|t[28]>>>25,st=t[28]<<7|t[29]>>>25,q=t[38]<<8|t[39]>>>24,H=t[39]<<8|t[38]>>>24,E=t[48]<<14|t[49]>>>18,S=t[49]<<14|t[48]>>>18,t[0]=m^~v&w,t[1]=g^~y&b,t[10]=A^~O&B,t[11]=R^~N&x,t[20]=C^~D&j,t[21]=k^~F&L,t[30]=Y^~V&W,t[31]=Z^~J&K,t[40]=rt^~nt&ot,t[41]=et^~it&st,t[2]=v^~w&_,t[3]=y^~b&M,t[12]=O^~B&I,t[13]=N^~x&P,t[22]=D^~j&q,t[23]=F^~L&H,t[32]=V^~W&$,t[33]=J^~K&X,t[42]=nt^~ot&ut,t[43]=it^~st&at,t[4]=w^~_&E,t[5]=b^~M&S,t[14]=B^~I&T,t[15]=x^~P&U,t[24]=j^~q&G,t[25]=L^~H&z,t[34]=W^~$&Q,t[35]=K^~X&tt,t[44]=ot^~ut&ft,t[45]=st^~at&ht,t[6]=_^~E&m,t[7]=M^~S&g,t[16]=I^~T&A,t[17]=P^~U&R,t[26]=q^~G&C,t[27]=H^~z&k,t[36]=$^~Q&Y,t[37]=X^~tt&Z,t[46]=ut^~ft&rt,t[47]=at^~ht&et,t[8]=E^~m&v,t[9]=S^~g&y,t[18]=T^~A&O,t[19]=U^~R&N,t[28]=G^~C&D,t[29]=z^~k&F,t[38]=Q^~Y&V,t[39]=tt^~Z&J,t[48]=ft^~rt&nt,t[49]=ht^~et&it,t[0]^=u[n],t[1]^=u[n+1]};if(i)t.exports=p;else for(g=0;g<m.length;++g)n[m[g]]=p[m[g]]}()}).call(this,e(21),e(3))},function(t,r){var e,n,i=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function u(t){if(e===setTimeout)return setTimeout(t,0);if((e===o||!e)&&setTimeout)return e=setTimeout,setTimeout(t,0);try{return e(t,0)}catch(r){try{return e.call(null,t,0)}catch(r){return e.call(this,t,0)}}}!function(){try{e="function"==typeof setTimeout?setTimeout:o}catch(t){e=o}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(t){n=s}}();var a,f=[],h=!1,l=-1;function c(){h&&a&&(h=!1,a.length?f=a.concat(f):l=-1,f.length&&d())}function d(){if(!h){var t=u(c);h=!0;for(var r=f.length;r;){for(a=f,f=[];++l<r;)a&&a[l].run();l=-1,r=f.length}a=null,h=!1,function(t){if(n===clearTimeout)return clearTimeout(t);if((n===s||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(t);try{n(t)}catch(r){try{return n.call(null,t)}catch(r){return n.call(this,t)}}}(t)}}function p(t,r){this.fun=t,this.array=r}function m(){}i.nextTick=function(t){var r=new Array(arguments.length-1);if(arguments.length>1)for(var e=1;e<arguments.length;e++)r[e-1]=arguments[e];f.push(new p(t,r)),1!==f.length||h||u(d)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=m,i.addListener=m,i.once=m,i.off=m,i.removeListener=m,i.removeAllListeners=m,i.emit=m,i.prependListener=m,i.prependOnceListener=m,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e(0);function i(t){for(var r=[];t;)r.unshift(255&t),t>>=8;return r}function o(t,r,e){for(var n=0,i=0;i<e;i++)n=256*n+t[r+i];return n}function s(t,r,e,n){for(var i=[];e<r+1+n;){var o=u(t,e);if(i.push(o.result),(e+=o.consumed)>r+1+n)throw new Error("invalid rlp")}return{consumed:1+n,result:i}}function u(t,r){if(0===t.length)throw new Error("invalid rlp data");if(t[r]>=248){if(r+1+(u=t[r]-247)>t.length)throw new Error("too short");var e=o(t,r+1,u);if(r+1+u+e>t.length)throw new Error("to short");return s(t,r,r+1+u,u+e)}if(t[r]>=192){var i=t[r]-192;if(r+1+i>t.length)throw new Error("invalid rlp data");return s(t,r,r+1,i)}if(t[r]>=184){var u;if(r+1+(u=t[r]-183)>t.length)throw new Error("invalid rlp data");var a=o(t,r+1,u);if(r+1+u+a>t.length)throw new Error("invalid rlp data");return{consumed:1+u+a,result:n.hexlify(t.slice(r+1+u,r+1+u+a))}}if(t[r]>=128){var f=t[r]-128;if(r+1+f>t.length)throw new Error("invlaid rlp data");return{consumed:1+f,result:n.hexlify(t.slice(r+1,r+1+f))}}return{consumed:1,result:n.hexlify(t[r])}}r.encode=function(t){return n.hexlify(function t(r){if(Array.isArray(r)){var e=[];if(r.forEach(function(r){e=e.concat(t(r))}),e.length<=55)return e.unshift(192+e.length),e;var o=i(e.length);return o.unshift(247+o.length),o.concat(e)}var s=Array.prototype.slice.call(n.arrayify(r));if(1===s.length&&s[0]<=127)return s;if(s.length<=55)return s.unshift(128+s.length),s;var u=i(s.length);return u.unshift(183+u.length),u.concat(s)}(t))},r.decode=function(t){var r=n.arrayify(t),e=u(r,0);if(e.consumed!==r.length)throw new Error("invalid rlp data");return e.result}},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.version="address/5.0.0-beta.127"},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e(25);r.formatBytes32String=n.formatBytes32String,r.parseBytes32String=n.parseBytes32String;var i=e(30);r.nameprep=i.nameprep;var o=e(2);r._toEscapedUtf8String=o._toEscapedUtf8String,r.toUtf8Bytes=o.toUtf8Bytes,r.toUtf8CodePoints=o.toUtf8CodePoints,r.toUtf8String=o.toUtf8String,r.UnicodeNormalizationForm=o.UnicodeNormalizationForm},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e(26),i=e(0),o=e(2);r.formatBytes32String=function(t){var r=o.toUtf8Bytes(t);if(r.length>31)throw new Error("bytes32 string must be less than 32 bytes");return i.hexlify(i.concat([r,n.HashZero]).slice(0,32))},r.parseBytes32String=function(t){var r=i.arrayify(t);if(32!==r.length)throw new Error("invalid bytes32 - not 32 bytes long");if(0!==r[31])throw new Error("invalid bytes32 string - no null terminator");for(var e=31;0===r[e-1];)e--;return o.toUtf8String(r.slice(0,e))}},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e(27);r.AddressZero="0x0000000000000000000000000000000000000000",r.HashZero="0x0000000000000000000000000000000000000000000000000000000000000000",r.EtherSymbol="Ξ";var i=n.BigNumber.from(-1);r.NegativeOne=i;var o=n.BigNumber.from(0);r.Zero=o;var s=n.BigNumber.from(1);r.One=s;var u=n.BigNumber.from(2);r.Two=u;var a=n.BigNumber.from("1000000000000000000");r.WeiPerEther=a;var f=n.BigNumber.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");r.MaxUint256=f},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e(5);r.BigNumber=n.BigNumber;var i=e(28);r.FixedNumber=i.FixedNumber},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e(0),i=e(1),o=e(6),s=new i.Logger(o.version),u=e(5),a={},f=u.BigNumber.from(0),h=u.BigNumber.from(-1);function l(t,r,e,n){var o={fault:r,operation:e};return void 0!==n&&(o.value=n),s.throwError(t,i.Logger.errors.NUMERIC_FAULT,o)}for(var c="0";c.length<256;)c+=c;function d(t){if("number"!=typeof t)try{t=u.BigNumber.from(t).toNumber()}catch(t){}return"number"==typeof t&&t>=0&&t<=256&&!(t%1)?"1"+c.substring(0,t):s.throwArgumentError("invalid decimal size","decimals",t)}function p(t,r){null==r&&(r=0);var e=d(r),n=(t=u.BigNumber.from(t)).lt(f);n&&(t=t.mul(h));for(var i=t.mod(e).toString();i.length<e.length-1;)i="0"+i;i=i.match(/^([0-9]*[1-9]|0)(0*)/)[1];var o=t.div(e).toString();return t=o+"."+i,n&&(t="-"+t),t}function m(t,r){null==r&&(r=0);var e=d(r);if("string"==typeof t&&t.match(/^-?[0-9.,]+$/)||s.throwArgumentError("invalid decimal value","value",t),e.length-1==0)return u.BigNumber.from(t);var n="-"===t.substring(0,1);n&&(t=t.substring(1)),"."===t&&s.throwArgumentError("missing value","value",t);var i=t.split(".");i.length>2&&s.throwArgumentError("too many decimal points","value",t);var o=i[0],a=i[1];for(o||(o="0"),a||(a="0"),a.length>e.length-1&&l("fractional component exceeds decimals","underflow","parseFixed");a.length<e.length-1;)a+="0";var f=u.BigNumber.from(o),c=u.BigNumber.from(a),p=f.mul(e).add(c);return n&&(p=p.mul(h)),p}r.formatFixed=p,r.parseFixed=m;var g=function(){function t(t,r,e,n){this.signed=r,this.width=e,this.decimals=n,this.name=(r?"":"u")+"fixed"+String(e)+"x"+String(n),this._multiplier=d(n),Object.freeze(this)}return t.from=function(r){if(r instanceof t)return r;var e=!0,n=128,i=18;if("string"==typeof r){if("fixed"===r);else if("ufixed"===r)e=!1;else if(null!=r){var o=r.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);o||s.throwArgumentError("invalid fixed format","format",r),e="u"!==o[1],n=parseInt(o[2]),i=parseInt(o[3])}}else if(r){var u=function(t,e,n){return null==r[t]?n:(typeof r[t]!==e&&s.throwArgumentError("invalid fixed format ("+t+" not "+e+")","format."+t,r[t]),r[t])};e=u("signed","boolean",e),n=u("width","number",n),i=u("decimals","number",i)}return n%8&&s.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",n),i>80&&s.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",i),new t(a,e,n,i)},t}();r.FixedFormat=g;var v=function(){function t(r,e,n,i){var o=this.constructor;s.checkNew(o,t),this.format=i,this._hex=e,this._value=n,this._isFixedNumber=!0,Object.freeze(this)}return t.prototype._checkFormat=function(t){this.format.name!==t.format.name&&s.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",t)},t.prototype.addUnsafe=function(r){this._checkFormat(r);var e=m(this._value,this.format.decimals),n=m(r._value,r.format.decimals);return t.fromValue(e.add(n),this.format.decimals,this.format)},t.prototype.subUnsafe=function(r){this._checkFormat(r);var e=m(this._value,this.format.decimals),n=m(r._value,r.format.decimals);return t.fromValue(e.sub(n),this.format.decimals,this.format)},t.prototype.mulUnsafe=function(r){this._checkFormat(r);var e=m(this._value,this.format.decimals),n=m(r._value,r.format.decimals);return t.fromValue(e.mul(n).div(this.format._multiplier),this.format.decimals,this.format)},t.prototype.divUnsafe=function(r){this._checkFormat(r);var e=m(this._value,this.format.decimals),n=m(r._value,r.format.decimals);return t.fromValue(e.mul(this.format._multiplier).div(n),this.format.decimals,this.format)},t.prototype.round=function(r){null==r&&(r=0),(r<0||r>80||r%1)&&s.throwArgumentError("invalid decimal cound","decimals",r);var e=this.toString().split(".");if(e[1].length<=r)return this;var n="0."+c.substring(0,r)+"5";return e=this.addUnsafe(t.fromString(n,this.format))._value.split("."),t.fromString(e[0]+"."+e[1].substring(0,r))},t.prototype.toString=function(){return this._value},t.prototype.toHexString=function(t){if(null==t)return this._hex;t%8&&s.throwArgumentError("invalid byte width","width",t);var r=u.BigNumber.from(this._hex).fromTwos(this.format.width).toTwos(t).toHexString();return n.hexZeroPad(r,t/8)},t.prototype.toUnsafeFloat=function(){return parseFloat(this.toString())},t.prototype.toFormat=function(r){return t.fromString(this._value,r)},t.fromValue=function(r,e,n){return null!=n||null==e||u.isBigNumberish(e)||(n=e,e=null),null==e&&(e=0),null==n&&(n="fixed"),t.fromString(p(r,e),g.from(n))},t.fromString=function(r,e){null==e&&(e="fixed");var i=g.from(e),o=m(r,i.decimals);!i.signed&&o.lt(f)&&l("unsigned value cannot be negative","overflow","value",r);var s=null;i.signed?s=o.toTwos(i.width).toHexString():(s=o.toHexString(),s=n.hexZeroPad(s,i.width/8));var u=p(o,i.decimals);return new t(a,s,u,i)},t.fromBytes=function(r,e){null==e&&(e="fixed");var i=g.from(e);if(n.arrayify(r).length>i.width/8)throw new Error("overflow");var o=u.BigNumber.from(r);i.signed&&(o=o.fromTwos(i.width));var s=o.toTwos((i.signed?0:1)+i.width).toHexString(),f=p(o,i.decimals);return new t(a,s,f,i)},t.from=function(r,e){if("string"==typeof r)return t.fromString(r,e);if(n.isBytes(r))return t.fromBytes(r,e);try{return t.fromValue(r,0,e)}catch(t){if(t.code!==i.Logger.errors.INVALID_ARGUMENT)throw t}return s.throwArgumentError("invalid FixedNumber value","value",r)},t.isFixedNumber=function(t){return!(!t||!t._isFixedNumber)},t}();r.FixedNumber=v},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.version="strings/5.0.0-beta.129"},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e(2);function i(t,r){r||(r=function(t){return[parseInt(t,16)]});var e=0,n={};return t.split(",").forEach(function(t){var i=t.split(":");e+=parseInt(i[0],16),n[e]=r(i[1])}),n}function o(t){var r=0;return t.split(",").map(function(t){var e=t.split("-");return 1===e.length?e[1]="0":""===e[1]&&(e[1]="1"),{l:r+parseInt(e[0],16),h:r=parseInt(e[1],16)}})}function s(t,r){for(var e=0,n=0;n<r.length;n++){var i=r[n];if(t>=(e+=i.l)&&t<=e+i.h&&(t-e)%(i.d||1)==0){if(i.e&&-1!==i.e.indexOf(t-e))continue;return i}}return null}var u=o("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"),a="ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map(function(t){return parseInt(t,16)}),f=[{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}],h=i("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"),l=i("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"),c=i("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",function(t){if(t.length%4!=0)throw new Error("bad data");for(var r=[],e=0;e<t.length;e+=4)r.push(parseInt(t.substring(e,e+4),16));return r}),d=o("80-20,2a0-,39c,32,f71,18e,7f2-f,19-7,30-4,7-5,f81-b,5,a800-20ff,4d1-1f,110,fa-6,d174-7,2e84-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,2,1f-5f,ff7f-20001");function p(t){return!!s(t,u)}function m(t){var r=s(t,f);if(r)return[t+r.s];var e=h[t];if(e)return e;var n=l[t];return n?[t+n[0]]:c[t]||null}function g(t){return!!s(t,d)}r._nameprepTableA1=p,r._nameprepTableB2=m,r._nameprepTableC=g,r.nameprep=function(t){if(t.match(/^[a-z0-9-]*$/i)&&t.length<=59)return t.toLowerCase();var r,e=n.toUtf8CodePoints(t);r=e.map(function(t){return a.indexOf(t)>=0?[]:t>=65024&&t<=65039?[]:m(t)||[t]}),e=r.reduce(function(t,r){return r.forEach(function(r){t.push(r)}),t},[]),(e=n.toUtf8CodePoints(n._toUtf8String(e),n.UnicodeNormalizationForm.NFKC)).forEach(function(t){if(g(t))throw new Error("STRINGPREP_CONTAINS_PROHIBITED")}),e.forEach(function(t){if(p(t))throw new Error("STRINGPREP_CONTAINS_UNASSIGNED")});var i=n._toUtf8String(e);if("-"===i.substring(0,1)||"--"===i.substring(2,4)||"-"===i.substring(i.length-1))throw new Error("invalid hyphen");if(i.length>63)throw new Error("too long");return i}}])},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e(0),i=e(1),o=e(3),s=n.__importDefault(e(4)),u=n.__importDefault(e(5)),a=function(){function t(t,r,e,n,i){var a=this;if(this.cryptoLib=t,this.protocol="wc",this.version=1,this._bridge="",this._key=null,this._nextKey=null,this._clientId="",this._clientMeta=null,this._peerId="",this._peerMeta=null,this._handshakeId=0,this._handshakeTopic="",this._accounts=[],this._chainId=0,this._networkId=0,this._rpcUrl="",this._eventManager=new u.default,this._connected=!1,this._storage=n||null,i&&(this.clientMeta=i),!r.bridge&&!r.uri&&!r.session)throw new Error(o.ERROR_MISSING_REQUIRED);r.bridge&&(this.bridge=r.bridge),r.uri&&(this.uri=r.uri);var f=r.session||null;f||(f=this._getStorageSession()),f&&(this.session=f),this.handshakeId&&this._subscribeToSessionResponse(this.handshakeId,"Session request rejected"),this._transport=e||new s.default({bridge:this.bridge,clientId:this.clientId}),this._transport.on("message",function(t){return a._handleIncomingMessages(t)}),r.uri&&this._subscribeToSessionRequest(),this._subscribeToInternalEvents(),this._transport.open()}return Object.defineProperty(t.prototype,"bridge",{get:function(){return this._bridge},set:function(t){t&&(this._bridge=t)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"key",{get:function(){return this._key?i.convertArrayBufferToHex(this._key,!0):""},set:function(t){if(t){var r=i.convertHexToArrayBuffer(t);this._key=r}},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nextKey",{get:function(){return this._nextKey?i.convertArrayBufferToHex(this._nextKey):""},set:function(t){if(t){var r=i.convertHexToArrayBuffer(t);this._nextKey=r}},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"clientId",{get:function(){var t=this._clientId;return t||(t=this._clientId=i.uuid()),this._clientId},set:function(t){t&&(this._clientId=t)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"peerId",{get:function(){return this._peerId},set:function(t){t&&(this._peerId=t)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"clientMeta",{get:function(){var t=this._clientMeta;return t||(t=this._clientMeta=i.getMeta()),t},set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"peerMeta",{get:function(){return this._peerMeta},set:function(t){this._peerMeta=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"handshakeTopic",{get:function(){return this._handshakeTopic},set:function(t){t&&(this._handshakeTopic=t)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"handshakeId",{get:function(){return this._handshakeId},set:function(t){t&&(this._handshakeId=t)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"uri",{get:function(){return this._formatUri()},set:function(t){if(t){var r=this._parseUri(t),e=r.handshakeTopic,n=r.bridge,i=r.key;this.handshakeTopic=e,this.bridge=n,this.key=i}},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"chainId",{get:function(){return this._chainId},set:function(t){this._chainId=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"networkId",{get:function(){return this._networkId},set:function(t){this._networkId=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"accounts",{get:function(){return this._accounts},set:function(t){this._accounts=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"rpcUrl",{get:function(){return this._rpcUrl},set:function(t){this._rpcUrl=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"connected",{get:function(){return this._connected},set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"pending",{get:function(){return!!this._handshakeTopic},set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"session",{get:function(){return{connected:this.connected,accounts:this.accounts,chainId:this.chainId,bridge:this.bridge,key:this.key,clientId:this.clientId,clientMeta:this.clientMeta,peerId:this.peerId,peerMeta:this.peerMeta,handshakeId:this.handshakeId,handshakeTopic:this.handshakeTopic}},set:function(t){t&&(this._connected=t.connected,this.accounts=t.accounts,this.chainId=t.chainId,this.bridge=t.bridge,this.key=t.key,this.clientId=t.clientId,this.clientMeta=t.clientMeta,this.peerId=t.peerId,this.peerMeta=t.peerMeta,this.handshakeId=t.handshakeId,this.handshakeTopic=t.handshakeTopic)},enumerable:!0,configurable:!0}),t.prototype.on=function(t,r){var e={event:t,callback:r};this._eventManager.subscribe(e)},t.prototype.createSession=function(t){return n.__awaiter(this,void 0,void 0,function(){var r,e;return n.__generator(this,function(n){switch(n.label){case 0:if(this._connected)throw new Error(o.ERROR_SESSION_CONNECTED);return this.pending?[2]:(r=this,[4,this._generateKey()]);case 1:return r._key=n.sent(),e=this._formatRequest({method:"wc_sessionRequest",params:[{peerId:this.clientId,peerMeta:this.clientMeta,chainId:t&&t.chainId?t.chainId:null}]}),this.handshakeId=e.id,this.handshakeTopic=i.uuid(),this._sendSessionRequest(e,"Session update rejected",this.handshakeTopic),[2]}})})},t.prototype.approveSession=function(t){if(this._connected)throw new Error(o.ERROR_SESSION_CONNECTED);this.chainId=t.chainId,this.accounts=t.accounts,this.networkId=t.networkId||0,this.rpcUrl=t.rpcUrl||"";var r={approved:!0,chainId:this.chainId,networkId:this.networkId,accounts:this.accounts,rpcUrl:this.rpcUrl,peerId:this.clientId,peerMeta:this.clientMeta},e={id:this.handshakeId,jsonrpc:"2.0",result:r};this._sendResponse(e),this._connected=!0,this._eventManager.trigger({event:"connect",params:[{peerId:this.peerId,peerMeta:this.peerMeta,chainId:this.chainId,accounts:this.accounts}]}),this._connected&&this._setStorageSession()},t.prototype.rejectSession=function(t){if(this._connected)throw new Error(o.ERROR_SESSION_CONNECTED);var r=t&&t.message?t.message:o.ERROR_SESSION_REJECTED,e=this._formatResponse({id:this.handshakeId,error:{message:r}});this._sendResponse(e),this._connected=!1,this._eventManager.trigger({event:"disconnect",params:[{message:r}]}),this._removeStorageSession()},t.prototype.updateSession=function(t){if(!this._connected)throw new Error(o.ERROR_SESSION_DISCONNECTED);this.chainId=t.chainId,this.accounts=t.accounts,this.networkId=t.networkId||0,this.rpcUrl=t.rpcUrl||"";var r={approved:!0,chainId:this.chainId,networkId:this.networkId,accounts:this.accounts,rpcUrl:this.rpcUrl},e=this._formatRequest({method:"wc_sessionUpdate",params:[r]});this._sendSessionRequest(e,"Session update rejected"),this._eventManager.trigger({event:"session_update",params:[{chainId:this.chainId,accounts:this.accounts}]}),this._manageStorageSession()},t.prototype.killSession=function(t){return n.__awaiter(this,void 0,void 0,function(){var r,e,i;return n.__generator(this,function(n){switch(n.label){case 0:return r=t?t.message:"Session Disconnected",e={approved:!1,chainId:null,networkId:null,accounts:null},i=this._formatRequest({method:"wc_sessionUpdate",params:[e]}),[4,this._sendRequest(i)];case 1:return n.sent(),this._handleSessionDisconnect(r),[2]}})})},t.prototype.sendTransaction=function(t){return n.__awaiter(this,void 0,void 0,function(){var r,e;return n.__generator(this,function(n){switch(n.label){case 0:if(!this._connected)throw new Error(o.ERROR_SESSION_DISCONNECTED);r=i.parseTransactionData(t),e=this._formatRequest({method:"eth_sendTransaction",params:[r]}),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this._sendCallRequest(e)];case 2:return[2,n.sent()];case 3:throw n.sent();case 4:return[2]}})})},t.prototype.signTransaction=function(t){return n.__awaiter(this,void 0,void 0,function(){var r,e;return n.__generator(this,function(n){switch(n.label){case 0:if(!this._connected)throw new Error(o.ERROR_SESSION_DISCONNECTED);r=i.parseTransactionData(t),e=this._formatRequest({method:"eth_signTransaction",params:[r]}),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this._sendCallRequest(e)];case 2:return[2,n.sent()];case 3:throw n.sent();case 4:return[2]}})})},t.prototype.signMessage=function(t){return n.__awaiter(this,void 0,void 0,function(){var r;return n.__generator(this,function(e){switch(e.label){case 0:if(!this._connected)throw new Error(o.ERROR_SESSION_DISCONNECTED);r=this._formatRequest({method:"eth_sign",params:t}),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this._sendCallRequest(r)];case 2:return[2,e.sent()];case 3:throw e.sent();case 4:return[2]}})})},t.prototype.signPersonalMessage=function(t){return n.__awaiter(this,void 0,void 0,function(){var r;return n.__generator(this,function(e){switch(e.label){case 0:if(!this._connected)throw new Error(o.ERROR_SESSION_DISCONNECTED);t=i.parsePersonalSign(t),r=this._formatRequest({method:"personal_sign",params:t}),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this._sendCallRequest(r)];case 2:return[2,e.sent()];case 3:throw e.sent();case 4:return[2]}})})},t.prototype.signTypedData=function(t){return n.__awaiter(this,void 0,void 0,function(){var r;return n.__generator(this,function(e){switch(e.label){case 0:if(!this._connected)throw new Error(o.ERROR_SESSION_DISCONNECTED);r=this._formatRequest({method:"eth_signTypedData",params:t}),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this._sendCallRequest(r)];case 2:return[2,e.sent()];case 3:throw e.sent();case 4:return[2]}})})},t.prototype.updateChain=function(t){return n.__awaiter(this,void 0,void 0,function(){var r;return n.__generator(this,function(e){switch(e.label){case 0:if(!this._connected)throw new Error("Session currently disconnected");r=this._formatRequest({method:"wallet_updateChain",params:[t]}),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this._sendCallRequest(r)];case 2:return[2,e.sent()];case 3:throw e.sent();case 4:return[2]}})})},t.prototype.unsafeSend=function(t){var r=this;return this._sendRequest(t),new Promise(function(e,n){r._subscribeToResponse(t.id,function(t,r){if(t)n(t);else{if(!r)throw new Error(o.ERROR_MISSING_JSON_RPC);e(r)}})})},t.prototype.sendCustomRequest=function(t){return n.__awaiter(this,void 0,void 0,function(){var r;return n.__generator(this,function(e){switch(e.label){case 0:if(!this._connected)throw new Error(o.ERROR_SESSION_DISCONNECTED);switch(t.method){case"eth_accounts":return[2,this.accounts];case"eth_chainId":return[2,i.convertNumberToHex(this.chainId)];case"eth_sendTransaction":case"eth_signTransaction":t.params&&(t.params[0]=i.parseTransactionData(t.params[0]));break;case"personal_sign":t.params&&(t.params=i.parsePersonalSign(t.params))}r=this._formatRequest(t),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this._sendCallRequest(r)];case 2:return[2,e.sent()];case 3:throw e.sent();case 4:return[2]}})})},t.prototype.approveRequest=function(t){if(!i.isJsonRpcResponseSuccess(t))throw new Error(o.ERROR_MISSING_RESULT);var r=this._formatResponse(t);this._sendResponse(r)},t.prototype.rejectRequest=function(t){if(!i.isJsonRpcResponseError(t))throw new Error(o.ERROR_MISSING_ERROR);var r=this._formatResponse(t);this._sendResponse(r)},t.prototype._sendRequest=function(t,r){return n.__awaiter(this,void 0,void 0,function(){var e,o,s,u,a,f;return n.__generator(this,function(n){switch(n.label){case 0:return e=this._formatRequest(t),[4,this._encrypt(e)];case 1:return o=n.sent(),s=r||this.peerId,u=JSON.stringify(o),a=i.isSilentPayload(e),f={topic:s,type:"pub",payload:u,silent:a},this._transport.send(f),[2]}})})},t.prototype._sendResponse=function(t){return n.__awaiter(this,void 0,void 0,function(){var r,e,i,o;return n.__generator(this,function(n){switch(n.label){case 0:return[4,this._encrypt(t)];case 1:return r=n.sent(),e=this.peerId,i=JSON.stringify(r),o={topic:e,type:"pub",payload:i,silent:!0},this._transport.send(o),[2]}})})},t.prototype._sendSessionRequest=function(t,r,e){return n.__awaiter(this,void 0,void 0,function(){return n.__generator(this,function(n){return this._sendRequest(t,e),this._subscribeToSessionResponse(t.id,r),[2]})})},t.prototype._sendCallRequest=function(t){return this._sendRequest(t),this._subscribeToCallResponse(t.id)},t.prototype._formatRequest=function(t){if(void 0===t.method)throw new Error(o.ERROR_MISSING_METHOD);return{id:void 0===t.id?i.payloadId():t.id,jsonrpc:"2.0",method:t.method,params:void 0===t.params?[]:t.params}},t.prototype._formatResponse=function(t){if(void 0===t.id)throw new Error(o.ERROR_MISSING_ID);if(i.isJsonRpcResponseError(t)){var r=i.formatRpcError(t.error);return n.__assign({id:t.id,jsonrpc:"2.0"},t,{error:r})}if(i.isJsonRpcResponseSuccess(t))return n.__assign({id:t.id,jsonrpc:"2.0"},t);throw new Error(o.ERROR_INVALID_RESPONSE)},t.prototype._handleSessionDisconnect=function(t){var r=t||"Session Disconnected";this._connected&&(this._connected=!1),this._eventManager.trigger({event:"disconnect",params:[{message:r}]}),this._removeStorageSession(),this._transport.close()},t.prototype._handleSessionResponse=function(t,r){r&&r.approved?(this._connected?(r.chainId&&(this.chainId=r.chainId),r.accounts&&(this.accounts=r.accounts),this._eventManager.trigger({event:"session_update",params:[{chainId:this.chainId,accounts:this.accounts}]})):(this._connected=!0,r.chainId&&(this.chainId=r.chainId),r.accounts&&(this.accounts=r.accounts),r.peerId&&!this.peerId&&(this.peerId=r.peerId),r.peerMeta&&!this.peerMeta&&(this.peerMeta=r.peerMeta),this._eventManager.trigger({event:"connect",params:[{peerId:this.peerId,peerMeta:this.peerMeta,chainId:this.chainId,accounts:this.accounts}]})),this._manageStorageSession()):this._handleSessionDisconnect(t)},t.prototype._handleIncomingMessages=function(t){return n.__awaiter(this,void 0,void 0,function(){var r,e;return n.__generator(this,function(n){switch(n.label){case 0:if(![this.clientId,this.handshakeTopic].includes(t.topic))return[2];try{r=JSON.parse(t.payload)}catch(t){return[2]}return[4,this._decrypt(r)];case 1:return(e=n.sent())&&this._eventManager.trigger(e),[2]}})})},t.prototype._subscribeToSessionRequest=function(){this._transport.send({topic:""+this.handshakeTopic,type:"sub",payload:"",silent:!0})},t.prototype._subscribeToResponse=function(t,r){this.on("response:"+t,r)},t.prototype._subscribeToSessionResponse=function(t,r){var e=this;this._subscribeToResponse(t,function(t,n){t?e._handleSessionResponse(t.message):n.result?e._handleSessionResponse(r,n.result):n.error&&n.error.message?e._handleSessionResponse(n.error.message):e._handleSessionResponse(r)})},t.prototype._subscribeToCallResponse=function(t){var r=this;return new Promise(function(e,n){r._subscribeToResponse(t,function(t,r){t?n(t):r.result?e(r.result):r.error&&r.error.message?n(new Error(r.error.message)):n(new Error(o.ERROR_INVALID_RESPONSE))})})},t.prototype._subscribeToInternalEvents=function(){var t=this;this.on("wc_sessionRequest",function(r,e){r&&t._eventManager.trigger({event:"error",params:[{code:"SESSION_REQUEST_ERROR",message:r.toString()}]}),t.handshakeId=e.id,t.peerId=e.params[0].peerId,t.peerMeta=e.params[0].peerMeta;var i=n.__assign({},e,{method:"session_request"});t._eventManager.trigger(i)}),this.on("wc_sessionUpdate",function(r,e){r&&t._handleSessionResponse(r.message),t._handleSessionResponse("Session disconnected",e.params[0])})},t.prototype._formatUri=function(){return this.protocol+":"+this.handshakeTopic+"@"+this.version+"?bridge="+encodeURIComponent(this.bridge)+"&key="+this.key},t.prototype._parseUri=function(t){var r=i.parseWalletConnectUri(t);if(r.protocol===this.protocol){if(!r.handshakeTopic)throw Error("Invalid or missing handshakeTopic parameter value");var e=r.handshakeTopic;if(!r.bridge)throw Error("Invalid or missing bridge url parameter value");var n=decodeURIComponent(r.bridge);if(!r.key)throw Error("Invalid or missing kkey parameter value");return{handshakeTopic:e,bridge:n,key:r.key}}throw new Error(o.ERROR_INVALID_URI)},t.prototype._generateKey=function(){return n.__awaiter(this,void 0,void 0,function(){return n.__generator(this,function(t){switch(t.label){case 0:return this.cryptoLib?[4,this.cryptoLib.generateKey()]:[3,2];case 1:return[2,t.sent()];case 2:return[2,null]}})})},t.prototype._encrypt=function(t){return n.__awaiter(this,void 0,void 0,function(){var r;return n.__generator(this,function(e){switch(e.label){case 0:return r=this._key,this.cryptoLib&&r?[4,this.cryptoLib.encrypt(t,r)]:[3,2];case 1:return[2,e.sent()];case 2:return[2,null]}})})},t.prototype._decrypt=function(t){return n.__awaiter(this,void 0,void 0,function(){var r;return n.__generator(this,function(e){switch(e.label){case 0:return r=this._key,this.cryptoLib&&r?[4,this.cryptoLib.decrypt(t,r)]:[3,2];case 1:return[2,e.sent()];case 2:return[2,null]}})})},t.prototype._getStorageSession=function(){var t=null;return this._storage&&(t=this._storage.getSession()),t},t.prototype._setStorageSession=function(){this._storage&&this._storage.setSession(this.session)},t.prototype._removeStorageSession=function(){this._storage&&this._storage.removeSession()},t.prototype._manageStorageSession=function(){this._connected?this._setStorageSession():this._removeStorageSession()},t}();r.default=a},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.ERROR_SESSION_CONNECTED="Session currently connected",r.ERROR_SESSION_DISCONNECTED="Session currently disconnected",r.ERROR_SESSION_REJECTED="Session Rejected",r.ERROR_MISSING_JSON_RPC="Missing JSON RPC response",r.ERROR_MISSING_RESULT='JSON-RPC success response must include "result" field',r.ERROR_MISSING_ERROR='JSON-RPC error response must include "error" field',r.ERROR_MISSING_METHOD='JSON RPC request must have valid "method" value',r.ERROR_MISSING_ID='JSON RPC request must have valid "id" value',r.ERROR_MISSING_REQUIRED="Missing one of the required parameters: bridge / uri / session",r.ERROR_INVALID_RESPONSE="JSON RPC response format is invalid",r.ERROR_INVALID_URI="URI format is invalid"},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e(0),i=function(){function t(t){if(this._events=[],this._initiating=!1,this._bridge="",this._socket=null,this._queue=[],!t.bridge||"string"!=typeof t.bridge)throw new Error("Missing or invalid bridge field");if(this._bridge=t.bridge,!t.clientId||"string"!=typeof t.clientId)throw new Error("Missing or invalid clientId field");this._clientId=t.clientId}return Object.defineProperty(t.prototype,"readyState",{get:function(){return this._socket?this._socket.readyState:-1},set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"connecting",{get:function(){return 0===this.readyState},set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"connected",{get:function(){return 1===this.readyState},set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"closing",{get:function(){return 2===this.readyState},set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"closed",{get:function(){return 3===this.readyState},set:function(t){},enumerable:!0,configurable:!0}),t.prototype.open=function(){this._socketOpen()},t.prototype.send=function(t){this._socketSend(t)},t.prototype.close=function(){this._socketClose()},t.prototype.on=function(t,r){this._events.push({event:t,callback:r})},t.prototype._socketOpen=function(t){var r=this;if((void 0===t||t)&&!this._initiating){this._initiating=!0;var e=this._bridge;this._setToQueue({topic:""+this._clientId,type:"sub",payload:"",silent:!0});var n=e.startsWith("https")?e.replace("https","wss"):e.startsWith("http")?e.replace("http","ws"):e,i=new WebSocket(n);i.onmessage=function(t){return r._socketReceive(t)},i.onopen=function(){r._socketClose(),r._initiating=!1,r._socket=i,r._pushQueue()},i.onclose=function(){r._socketOpen(!0)}}},t.prototype._socketClose=function(){this._socket&&(this._socket.onclose=function(){},this._socket.close())},t.prototype._socketSend=function(t){var r=JSON.stringify(t);this._socket&&this.connected?this._socket.send(r):(this._setToQueue(t),this._socketOpen())},t.prototype._socketReceive=function(t){return n.__awaiter(this,void 0,void 0,function(){var r,e;return n.__generator(this,function(n){try{r=JSON.parse(t.data)}catch(t){return[2]}return this.connected&&(e=this._events.filter(function(t){return"message"===t.event}))&&e.length&&e.forEach(function(t){return t.callback(r)}),[2]})})},t.prototype._setToQueue=function(t){this._queue.push(t)},t.prototype._pushQueue=function(){var t=this;this._queue.forEach(function(r){return t._socketSend(r)}),this._queue=[]},t}();r.default=i},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e(1),i=function(){function t(){this._eventEmitters=[]}return t.prototype.subscribe=function(t){this._eventEmitters.push(t)},t.prototype.trigger=function(t){var r,e=[];(r=n.isJsonRpcRequest(t)?t.method:n.isJsonRpcResponseSuccess(t)||n.isJsonRpcResponseError(t)?"response:"+t.id:n.isInternalEvent(t)?t.event:"")&&(e=this._eventEmitters.filter(function(t){return t.event===r})),e&&e.length||n.isReservedEvent(r)||(e=this._eventEmitters.filter(function(t){return"call_request"===t.event})),e.forEach(function(r){if(n.isJsonRpcResponseError(t)){var e=new Error(t.error.message);r.callback(e,null)}else r.callback(null,t)})},t}();r.default=i}])},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const n=e(0),i=e(1),o="AES-CBC",s=256,u="SHA-256";function a(t){return n.__awaiter(this,void 0,void 0,function*(){return yield window.crypto.subtle.exportKey("raw",t)})}function f(t,r=o){return n.__awaiter(this,void 0,void 0,function*(){const e=r===o?{length:s,name:o}:{hash:{name:u},name:"HMAC"},n=r===o?["encrypt","decrypt"]:["sign","verify"];return yield window.crypto.subtle.importKey("raw",t,e,!0,n)})}function h(t){return n.__awaiter(this,void 0,void 0,function*(){const r=t||256,e=yield window.crypto.subtle.generateKey({length:r,name:o},!0,["encrypt","decrypt"]);return yield a(e)})}function l(t,r){return n.__awaiter(this,void 0,void 0,function*(){const e=yield f(r,"HMAC");return yield window.crypto.subtle.sign({length:256,name:"HMAC"},e,t)})}function c(t,r){return n.__awaiter(this,void 0,void 0,function*(){const e=i.convertHexToArrayBuffer(t.data),n=i.convertHexToArrayBuffer(t.iv),o=i.convertHexToArrayBuffer(t.hmac),s=i.convertArrayBufferToHex(o,!0),u=i.concatArrayBuffers(e,n),a=yield l(u,r),f=i.convertArrayBufferToHex(a,!0);return i.removeHexPrefix(s)===i.removeHexPrefix(f)})}function d(t,r,e){return n.__awaiter(this,void 0,void 0,function*(){const n=yield f(r,o);return yield window.crypto.subtle.encrypt({iv:e,name:o},n,t)})}function p(t,r,e){return n.__awaiter(this,void 0,void 0,function*(){const n=yield f(r,o);return yield window.crypto.subtle.decrypt({iv:e,name:o},n,t)})}r.exportKey=a,r.importKey=f,r.generateKey=h,r.createHmac=l,r.verifyHmac=c,r.aesCbcEncrypt=d,r.aesCbcDecrypt=p,r.encrypt=function(t,r){return n.__awaiter(this,void 0,void 0,function*(){if(!r)throw new Error("Missing key: required for encryption");const e=yield h(128),n=i.convertArrayBufferToHex(e,!0),o=JSON.stringify(t),s=i.convertUtf8ToArrayBuffer(o),u=yield d(s,r,e),a=i.convertArrayBufferToHex(u,!0),f=i.concatArrayBuffers(u,e),c=yield l(f,r);return{data:a,hmac:i.convertArrayBufferToHex(c,!0),iv:n}})},r.decrypt=function(t,r){return n.__awaiter(this,void 0,void 0,function*(){if(!r)throw new Error("Missing key: required for decryption");if(!(yield c(t,r)))return null;const e=i.convertHexToArrayBuffer(t.data),n=i.convertHexToArrayBuffer(t.iv),o=yield p(e,r,n),s=i.convertArrayBufferToUtf8(o);let u;try{u=JSON.parse(s)}catch(t){return null}return u})}},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const n=e(1),i="walletconnect";let o=null;"undefined"!=typeof window&&void 0!==window.localStorage&&(o=window.localStorage),r.default={getSession:function(){let t=null,r=null;if(o&&(r=o.getItem(i)),r&&"string"==typeof r)try{const e=JSON.parse(r);n.isWalletConnectSession(e)&&(t=e)}catch(t){return null}return t},setSession:function(t){const r=JSON.stringify(t);return o&&o.setItem(i,r),t},removeSession:function(){o&&o.removeItem(i)}}}])});
//# sourceMappingURL=index.js.map