text: /*! For license information please see eth-reveal-8b7e2fe562ca137eff18.js.LICENSE.txt */
  !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("reveal",[],e):"object"==typeof exports?exports.reveal=e():t.reveal=e()}(window,(function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=20)}([function(t,e,r){"use strict";var n=r(8),i=Object.prototype.toString;function o(t){return"[object Array]"===i.call(t)}function s(t){return void 0===t}function a(t){return null!==t&&"object"==typeof t}function u(t){if("[object Object]"!==i.call(t))return!1;var e=Object.getPrototypeOf(t);return null===e||e===Object.prototype}function h(t){return"[object Function]"===i.call(t)}function l(t,e){if(null!=t)if("object"!=typeof t&&(t=[t]),o(t))for(var r=0,n=t.length;r<n;r++)e.call(null,t[r],r,t);else for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.call(null,t[i],i,t)}t.exports={isArray:o,isArrayBuffer:function(t){return"[object ArrayBuffer]"===i.call(t)},isBuffer:function(t){return null!==t&&!s(t)&&null!==t.constructor&&!s(t.constructor)&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)},isFormData:function(t){return"undefined"!=typeof FormData&&t instanceof FormData},isArrayBufferView:function(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&t.buffer instanceof ArrayBuffer},isString:function(t){return"string"==typeof t},isNumber:function(t){return"number"==typeof t},isObject:a,isPlainObject:u,isUndefined:s,isDate:function(t){return"[object Date]"===i.call(t)},isFile:function(t){return"[object File]"===i.call(t)},isBlob:function(t){return"[object Blob]"===i.call(t)},isFunction:h,isStream:function(t){return a(t)&&h(t.pipe)},isURLSearchParams:function(t){return"undefined"!=typeof URLSearchParams&&t instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:l,merge:function t(){var e={};function r(r,n){u(e[n])&&u(r)?e[n]=t(e[n],r):u(r)?e[n]=t({},r):o(r)?e[n]=r.slice():e[n]=r}for(var n=0,i=arguments.length;n<i;n++)l(arguments[n],r);return e},extend:function(t,e,r){return l(e,(function(e,i){t[i]=r&&"function"==typeof e?n(e,r):e})),t},trim:function(t){return t.replace(/^\s*/,"").replace(/\s*$/,"")},stripBOM:function(t){return 65279===t.charCodeAt(0)&&(t=t.slice(1)),t}}},,function(t,e,r){"use strict";(function(t){var n=r(44),i=r(45),o=r(46);function s(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(t,e){if(s()<e)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=u.prototype:(null===t&&(t=new u(e)),t.length=e),t}function u(t,e,r){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(t,e,r);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return f(this,t)}return h(this,t,e,r)}function h(t,e,r,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,r,n){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");e=void 0===r&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,r):new Uint8Array(e,r,n);u.TYPED_ARRAY_SUPPORT?(t=e).__proto__=u.prototype:t=c(t,e);return t}(t,e,r,n):"string"==typeof e?function(t,e,r){"string"==typeof r&&""!==r||(r="utf8");if(!u.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|p(e,r),i=(t=a(t,n)).write(e,r);i!==n&&(t=t.slice(0,i));return t}(t,e,r):function(t,e){if(u.isBuffer(e)){var r=0|d(e.length);return 0===(t=a(t,r)).length||e.copy(t,0,0,r),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(n=e.length)!=n?a(t,0):c(t,e);if("Buffer"===e.type&&o(e.data))return c(t,e.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function l(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 f(t,e){if(l(e),t=a(t,e<0?0:0|d(e)),!u.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function c(t,e){var r=e.length<0?0:0|d(e.length);t=a(t,r);for(var n=0;n<r;n+=1)t[n]=255&e[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,e){if(u.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 r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return z(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return H(t).length;default:if(n)return z(t).length;e=(""+e).toLowerCase(),n=!0}}function m(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return P(this,e,r);case"utf8":case"utf-8":return S(this,e,r);case"ascii":return k(this,e,r);case"latin1":case"binary":return T(this,e,r);case"base64":return x(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function g(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function y(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:v(t,e,r,n,i);if("number"==typeof e)return e&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):v(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function v(t,e,r,n,i){var o,s=1,a=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,r/=2}function h(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){var l=-1;for(o=r;o<a;o++)if(h(t,o)===h(e,-1===l?0:o-l)){if(-1===l&&(l=o),o-l+1===u)return l*s}else-1!==l&&(o-=o-l),l=-1}else for(r+u>a&&(r=a-u),o=r;o>=0;o--){for(var f=!0,c=0;c<u;c++)if(h(t,o+c)!==h(e,c)){f=!1;break}if(f)return o}return-1}function w(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=e.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 a=parseInt(e.substr(2*s,2),16);if(isNaN(a))return s;t[r+s]=a}return s}function b(t,e,r,n){return G(z(e,t.length-r),t,r,n)}function M(t,e,r,n){return G(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function _(t,e,r,n){return M(t,e,r,n)}function A(t,e,r,n){return G(H(e),t,r,n)}function E(t,e,r,n){return G(function(t,e){for(var r,n,i,o=[],s=0;s<t.length&&!((e-=2)<0);++s)n=(r=t.charCodeAt(s))>>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function x(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function S(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o,s,a,u,h=t[i],l=null,f=h>239?4:h>223?3:h>191?2:1;if(i+f<=r)switch(f){case 1:h<128&&(l=h);break;case 2:128==(192&(o=t[i+1]))&&(u=(31&h)<<6|63&o)>127&&(l=u);break;case 3:o=t[i+1],s=t[i+2],128==(192&o)&&128==(192&s)&&(u=(15&h)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:o=t[i+1],s=t[i+2],a=t[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(u=(15&h)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(l=u)}null===l?(l=65533,f=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),i+=f}return function(t){var e=t.length;if(e<=N)return String.fromCharCode.apply(String,t);var r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=N));return r}(n)}e.Buffer=u,e.SlowBuffer=function(t){+t!=t&&(t=0);return u.alloc(+t)},e.INSPECT_MAX_BYTES=50,u.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}}(),e.kMaxLength=s(),u.poolSize=8192,u._augment=function(t){return t.__proto__=u.prototype,t},u.from=function(t,e,r){return h(null,t,e,r)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(t,e,r){return function(t,e,r,n){return l(e),e<=0?a(t,e):void 0!==r?"string"==typeof n?a(t,e).fill(r,n):a(t,e).fill(r):a(t,e)}(null,t,e,r)},u.allocUnsafe=function(t){return f(null,t)},u.allocUnsafeSlow=function(t){return f(null,t)},u.isBuffer=function(t){return!(null==t||!t._isBuffer)},u.compare=function(t,e){if(!u.isBuffer(t)||!u.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},u.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}},u.concat=function(t,e){if(!o(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return u.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=u.allocUnsafe(e),i=0;for(r=0;r<t.length;++r){var s=t[r];if(!u.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(n,i),i+=s.length}return n},u.byteLength=p,u.prototype._isBuffer=!0,u.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 e=0;e<t;e+=2)g(this,e,e+1);return this},u.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 e=0;e<t;e+=4)g(this,e,e+3),g(this,e+1,e+2);return this},u.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 e=0;e<t;e+=8)g(this,e,e+7),g(this,e+1,e+6),g(this,e+2,e+5),g(this,e+3,e+4);return this},u.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?S(this,0,t):m.apply(this,arguments)},u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),"<Buffer "+t+">"},u.prototype.compare=function(t,e,r,n,i){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(e>>>=0),a=Math.min(o,s),h=this.slice(n,i),l=t.slice(e,r),f=0;f<a;++f)if(h[f]!==l[f]){o=h[f],s=l[f];break}return o<s?-1:s<o?1:0},u.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},u.prototype.indexOf=function(t,e,r){return y(this,t,e,r,!0)},u.prototype.lastIndexOf=function(t,e,r){return y(this,t,e,r,!1)},u.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>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,e,r);case"utf8":case"utf-8":return b(this,t,e,r);case"ascii":return M(this,t,e,r);case"latin1":case"binary":return _(this,t,e,r);case"base64":return A(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var N=4096;function k(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function T(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function P(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=e;o<r;++o)i+=F(t[o]);return i}function I(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function R(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function O(t,e,r,n,i,o){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function C(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i<o;++i)t[r+i]=(e&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function B(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i<o;++i)t[r+i]=e>>>8*(n?i:3-i)&255}function U(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function L(t,e,r,n,o){return o||U(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function D(t,e,r,n,o){return o||U(t,0,r,8),i.write(t,e,r,n,52,8),r+8}u.prototype.slice=function(t,e){var r,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t),u.TYPED_ARRAY_SUPPORT)(r=this.subarray(t,e)).__proto__=u.prototype;else{var i=e-t;r=new u(i,void 0);for(var o=0;o<i;++o)r[o]=this[o+t]}return r},u.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||R(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n},u.prototype.readUIntBE=function(t,e,r){t|=0,e|=0,r||R(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},u.prototype.readUInt8=function(t,e){return e||R(t,1,this.length),this[t]},u.prototype.readUInt16LE=function(t,e){return e||R(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUInt16BE=function(t,e){return e||R(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUInt32LE=function(t,e){return e||R(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUInt32BE=function(t,e){return e||R(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||R(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*e)),n},u.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||R(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},u.prototype.readInt8=function(t,e){return e||R(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){e||R(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){e||R(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(t,e){return e||R(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return e||R(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,e){return e||R(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return e||R(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return e||R(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return e||R(t,8,this.length),i.read(this,t,!1,52,8)},u.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||O(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},u.prototype.writeUIntBE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||O(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},u.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||O(this,t,e,1,255,0),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||O(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):C(this,t,e,!0),e+2},u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||O(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):C(this,t,e,!1),e+2},u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||O(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):B(this,t,e,!0),e+4},u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||O(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):B(this,t,e,!1),e+4},u.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);O(this,t,e,r,i-1,-i)}var o=0,s=1,a=0;for(this[e]=255&t;++o<r&&(s*=256);)t<0&&0===a&&0!==this[e+o-1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},u.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);O(this,t,e,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||O(this,t,e,1,127,-128),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||O(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):C(this,t,e,!0),e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||O(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):C(this,t,e,!1),e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||O(this,t,e,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):B(this,t,e,!0),e+4},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||O(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):B(this,t,e,!1),e+4},u.prototype.writeFloatLE=function(t,e,r){return L(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return L(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return D(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return D(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=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-e<n-r&&(n=t.length-e+r);var i,o=n-r;if(this===t&&r<e&&e<n)for(i=o-1;i>=0;--i)t[i+e]=this[i+r];else if(o<1e3||!u.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+e]=this[i+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+o),e);return o},u.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=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&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var o;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{var s=u.isBuffer(t)?t:z(new u(t,n).toString()),a=s.length;for(o=0;o<r-e;++o)this[o+e]=s[o%a]}return this};var j=/[^+\/0-9A-Za-z-_]/g;function F(t){return t<16?"0"+t.toString(16):t.toString(16)}function z(t,e){var r;e=e||1/0;for(var n=t.length,i=null,o=[],s=0;s<n;++s){if((r=t.charCodeAt(s))>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|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,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}}).call(this,r(4))},function(t,e,r){(function(t){!function(t,e){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var s;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(50).Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function u(t,e,r){var n=a(t,r);return r-1>=e&&(n|=a(t,r-1)<<4),n}function h(t,e,r,n){for(var i=0,o=Math.min(t.length,r),s=e;s<o;s++){var a=t.charCodeAt(s)-48;i*=n,i+=a>=49?a-49+10:a>=17?a-17+10:a}return i}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<t.length&&(16===e?this._parseHex(t,i,r):(this._parseBase(t,e,i),"le"===r&&this._initArray(this.toArray(),e,r)))},o.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},o.prototype._initArray=function(t,e,r){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,s,a=0;if("be"===r)for(i=t.length-1,o=0;i>=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i<t.length;i+=3)s=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var i,o=0,s=0;if("be"===r)for(n=t.length-1;n>=e;n-=2)i=u(t,e,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n<t.length;n+=2)i=u(t,e,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this.strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,u=0,l=r;l<a;l+=n)u=h(t,l,l+n,e),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var f=1;for(u=h(t,l,t.length,e),l=0;l<s;l++)f*=e;this.imuln(f),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},o.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},o.prototype.clone=function(){var t=new o(null);return this.copy(t),t},o.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var l=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],c=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var h=1;h<n;h++){for(var l=u>>>26,f=67108863&u,c=Math.min(h,e.length-1),d=Math.max(0,h-t.length+1);d<=c;d++){var p=h-d|0;l+=(s=(i=0|t.words[p])*(o=0|e.words[d])+f)/67108864|0,f=67108863&s}r.words[h]=0|f,u=0|l}return 0!==u?r.words[h]=0|u:r.length--,r.strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,s=0;s<this.length;s++){var a=this.words[s],u=(16777215&(a<<i|o)).toString(16);r=0!==(o=a>>>24-i&16777215)||s!==this.length-1?l[6-u.length]+u+r:u+r,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var h=f[t],d=c[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?m+r:l[h-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return n(void 0!==s),this.toArrayLike(s,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0"),this.strip();var s,a,u="le"===e,h=new t(o),l=this.clone();if(u){for(a=0;!l.isZero();a++)s=l.andln(255),l.iushrn(8),h[a]=s;for(;a<o;a++)h[a]=0}else{for(a=0;a<o-i;a++)h[a]=0;for(a=0;!l.isZero();a++)s=l.andln(255),l.iushrn(8),h[o-a-1]=s}return h},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},o.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},o.prototype.ior=function(t){return n(0==(this.negative|t.negative)),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this.strip()},o.prototype.iand=function(t){return n(0==(this.negative|t.negative)),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;n<r.length;n++)this.words[n]=e.words[n]^r.words[n];if(this!==e)for(;n<e.length;n++)this.words[n]=e.words[n];return this.length=e.length,this.strip()},o.prototype.ixor=function(t){return n(0==(this.negative|t.negative)),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i<e;i++)this.words[i]=67108863&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<<i:this.words[r]&~(1<<i),this.strip()},o.prototype.iadd=function(t){var e,r,n;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o<n.length;o++)e=(0|r.words[o])+(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<r.length;o++)e=(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},o.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,s=0;s<n.length;s++)o=(e=(0|r.words[s])-(0|n.words[s])+o)>>26,this.words[s]=67108863&e;for(;0!==o&&s<r.length;s++)o=(e=(0|r.words[s])+o)>>26,this.words[s]=67108863&e;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(t){return this.clone().isub(t)};var p=function(t,e,r){var n,i,o,s=t.words,a=e.words,u=r.words,h=0,l=0|s[0],f=8191&l,c=l>>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],y=8191&g,v=g>>>13,w=0|s[3],b=8191&w,M=w>>>13,_=0|s[4],A=8191&_,E=_>>>13,x=0|s[5],S=8191&x,N=x>>>13,k=0|s[6],T=8191&k,P=k>>>13,I=0|s[7],R=8191&I,O=I>>>13,C=0|s[8],B=8191&C,U=C>>>13,L=0|s[9],D=8191&L,j=L>>>13,F=0|a[0],z=8191&F,H=F>>>13,G=0|a[1],q=8191&G,V=G>>>13,K=0|a[2],Z=8191&K,W=K>>>13,J=0|a[3],$=8191&J,X=J>>>13,Y=0|a[4],Q=8191&Y,tt=Y>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,ht=at>>>13,lt=0|a[8],ft=8191&lt,ct=lt>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(h+(n=Math.imul(f,z))|0)+((8191&(i=(i=Math.imul(f,H))+Math.imul(c,z)|0))<<13)|0;h=((o=Math.imul(c,H))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(p,z),i=(i=Math.imul(p,H))+Math.imul(m,z)|0,o=Math.imul(m,H);var yt=(h+(n=n+Math.imul(f,q)|0)|0)+((8191&(i=(i=i+Math.imul(f,V)|0)+Math.imul(c,q)|0))<<13)|0;h=((o=o+Math.imul(c,V)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(y,z),i=(i=Math.imul(y,H))+Math.imul(v,z)|0,o=Math.imul(v,H),n=n+Math.imul(p,q)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(m,q)|0,o=o+Math.imul(m,V)|0;var vt=(h+(n=n+Math.imul(f,Z)|0)|0)+((8191&(i=(i=i+Math.imul(f,W)|0)+Math.imul(c,Z)|0))<<13)|0;h=((o=o+Math.imul(c,W)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(b,z),i=(i=Math.imul(b,H))+Math.imul(M,z)|0,o=Math.imul(M,H),n=n+Math.imul(y,q)|0,i=(i=i+Math.imul(y,V)|0)+Math.imul(v,q)|0,o=o+Math.imul(v,V)|0,n=n+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,W)|0;var wt=(h+(n=n+Math.imul(f,$)|0)|0)+((8191&(i=(i=i+Math.imul(f,X)|0)+Math.imul(c,$)|0))<<13)|0;h=((o=o+Math.imul(c,X)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(A,z),i=(i=Math.imul(A,H))+Math.imul(E,z)|0,o=Math.imul(E,H),n=n+Math.imul(b,q)|0,i=(i=i+Math.imul(b,V)|0)+Math.imul(M,q)|0,o=o+Math.imul(M,V)|0,n=n+Math.imul(y,Z)|0,i=(i=i+Math.imul(y,W)|0)+Math.imul(v,Z)|0,o=o+Math.imul(v,W)|0,n=n+Math.imul(p,$)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,X)|0;var bt=(h+(n=n+Math.imul(f,Q)|0)|0)+((8191&(i=(i=i+Math.imul(f,tt)|0)+Math.imul(c,Q)|0))<<13)|0;h=((o=o+Math.imul(c,tt)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(S,z),i=(i=Math.imul(S,H))+Math.imul(N,z)|0,o=Math.imul(N,H),n=n+Math.imul(A,q)|0,i=(i=i+Math.imul(A,V)|0)+Math.imul(E,q)|0,o=o+Math.imul(E,V)|0,n=n+Math.imul(b,Z)|0,i=(i=i+Math.imul(b,W)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,W)|0,n=n+Math.imul(y,$)|0,i=(i=i+Math.imul(y,X)|0)+Math.imul(v,$)|0,o=o+Math.imul(v,X)|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 Mt=(h+(n=n+Math.imul(f,rt)|0)|0)+((8191&(i=(i=i+Math.imul(f,nt)|0)+Math.imul(c,rt)|0))<<13)|0;h=((o=o+Math.imul(c,nt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(T,z),i=(i=Math.imul(T,H))+Math.imul(P,z)|0,o=Math.imul(P,H),n=n+Math.imul(S,q)|0,i=(i=i+Math.imul(S,V)|0)+Math.imul(N,q)|0,o=o+Math.imul(N,V)|0,n=n+Math.imul(A,Z)|0,i=(i=i+Math.imul(A,W)|0)+Math.imul(E,Z)|0,o=o+Math.imul(E,W)|0,n=n+Math.imul(b,$)|0,i=(i=i+Math.imul(b,X)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,X)|0,n=n+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,nt)|0;var _t=(h+(n=n+Math.imul(f,ot)|0)|0)+((8191&(i=(i=i+Math.imul(f,st)|0)+Math.imul(c,ot)|0))<<13)|0;h=((o=o+Math.imul(c,st)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(R,z),i=(i=Math.imul(R,H))+Math.imul(O,z)|0,o=Math.imul(O,H),n=n+Math.imul(T,q)|0,i=(i=i+Math.imul(T,V)|0)+Math.imul(P,q)|0,o=o+Math.imul(P,V)|0,n=n+Math.imul(S,Z)|0,i=(i=i+Math.imul(S,W)|0)+Math.imul(N,Z)|0,o=o+Math.imul(N,W)|0,n=n+Math.imul(A,$)|0,i=(i=i+Math.imul(A,X)|0)+Math.imul(E,$)|0,o=o+Math.imul(E,X)|0,n=n+Math.imul(b,Q)|0,i=(i=i+Math.imul(b,tt)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,tt)|0,n=n+Math.imul(y,rt)|0,i=(i=i+Math.imul(y,nt)|0)+Math.imul(v,rt)|0,o=o+Math.imul(v,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 At=(h+(n=n+Math.imul(f,ut)|0)|0)+((8191&(i=(i=i+Math.imul(f,ht)|0)+Math.imul(c,ut)|0))<<13)|0;h=((o=o+Math.imul(c,ht)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(B,z),i=(i=Math.imul(B,H))+Math.imul(U,z)|0,o=Math.imul(U,H),n=n+Math.imul(R,q)|0,i=(i=i+Math.imul(R,V)|0)+Math.imul(O,q)|0,o=o+Math.imul(O,V)|0,n=n+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,W)|0)+Math.imul(P,Z)|0,o=o+Math.imul(P,W)|0,n=n+Math.imul(S,$)|0,i=(i=i+Math.imul(S,X)|0)+Math.imul(N,$)|0,o=o+Math.imul(N,X)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,tt)|0,n=n+Math.imul(b,rt)|0,i=(i=i+Math.imul(b,nt)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,nt)|0,n=n+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,st)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,st)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ht)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ht)|0;var Et=(h+(n=n+Math.imul(f,ft)|0)|0)+((8191&(i=(i=i+Math.imul(f,ct)|0)+Math.imul(c,ft)|0))<<13)|0;h=((o=o+Math.imul(c,ct)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(D,z),i=(i=Math.imul(D,H))+Math.imul(j,z)|0,o=Math.imul(j,H),n=n+Math.imul(B,q)|0,i=(i=i+Math.imul(B,V)|0)+Math.imul(U,q)|0,o=o+Math.imul(U,V)|0,n=n+Math.imul(R,Z)|0,i=(i=i+Math.imul(R,W)|0)+Math.imul(O,Z)|0,o=o+Math.imul(O,W)|0,n=n+Math.imul(T,$)|0,i=(i=i+Math.imul(T,X)|0)+Math.imul(P,$)|0,o=o+Math.imul(P,X)|0,n=n+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,nt)|0,n=n+Math.imul(b,ot)|0,i=(i=i+Math.imul(b,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|0,n=n+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ht)|0)+Math.imul(v,ut)|0,o=o+Math.imul(v,ht)|0,n=n+Math.imul(p,ft)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(m,ft)|0,o=o+Math.imul(m,ct)|0;var xt=(h+(n=n+Math.imul(f,pt)|0)|0)+((8191&(i=(i=i+Math.imul(f,mt)|0)+Math.imul(c,pt)|0))<<13)|0;h=((o=o+Math.imul(c,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(D,q),i=(i=Math.imul(D,V))+Math.imul(j,q)|0,o=Math.imul(j,V),n=n+Math.imul(B,Z)|0,i=(i=i+Math.imul(B,W)|0)+Math.imul(U,Z)|0,o=o+Math.imul(U,W)|0,n=n+Math.imul(R,$)|0,i=(i=i+Math.imul(R,X)|0)+Math.imul(O,$)|0,o=o+Math.imul(O,X)|0,n=n+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,tt)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,tt)|0,n=n+Math.imul(S,rt)|0,i=(i=i+Math.imul(S,nt)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,nt)|0,n=n+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,st)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,st)|0,n=n+Math.imul(b,ut)|0,i=(i=i+Math.imul(b,ht)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ht)|0,n=n+Math.imul(y,ft)|0,i=(i=i+Math.imul(y,ct)|0)+Math.imul(v,ft)|0,o=o+Math.imul(v,ct)|0;var St=(h+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;h=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(D,Z),i=(i=Math.imul(D,W))+Math.imul(j,Z)|0,o=Math.imul(j,W),n=n+Math.imul(B,$)|0,i=(i=i+Math.imul(B,X)|0)+Math.imul(U,$)|0,o=o+Math.imul(U,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(T,rt)|0,i=(i=i+Math.imul(T,nt)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,nt)|0,n=n+Math.imul(S,ot)|0,i=(i=i+Math.imul(S,st)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,st)|0,n=n+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,ht)|0)+Math.imul(E,ut)|0,o=o+Math.imul(E,ht)|0,n=n+Math.imul(b,ft)|0,i=(i=i+Math.imul(b,ct)|0)+Math.imul(M,ft)|0,o=o+Math.imul(M,ct)|0;var Nt=(h+(n=n+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,mt)|0)+Math.imul(v,pt)|0))<<13)|0;h=((o=o+Math.imul(v,mt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(D,$),i=(i=Math.imul(D,X))+Math.imul(j,$)|0,o=Math.imul(j,X),n=n+Math.imul(B,Q)|0,i=(i=i+Math.imul(B,tt)|0)+Math.imul(U,Q)|0,o=o+Math.imul(U,tt)|0,n=n+Math.imul(R,rt)|0,i=(i=i+Math.imul(R,nt)|0)+Math.imul(O,rt)|0,o=o+Math.imul(O,nt)|0,n=n+Math.imul(T,ot)|0,i=(i=i+Math.imul(T,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,n=n+Math.imul(S,ut)|0,i=(i=i+Math.imul(S,ht)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ht)|0,n=n+Math.imul(A,ft)|0,i=(i=i+Math.imul(A,ct)|0)+Math.imul(E,ft)|0,o=o+Math.imul(E,ct)|0;var kt=(h+(n=n+Math.imul(b,pt)|0)|0)+((8191&(i=(i=i+Math.imul(b,mt)|0)+Math.imul(M,pt)|0))<<13)|0;h=((o=o+Math.imul(M,mt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(D,Q),i=(i=Math.imul(D,tt))+Math.imul(j,Q)|0,o=Math.imul(j,tt),n=n+Math.imul(B,rt)|0,i=(i=i+Math.imul(B,nt)|0)+Math.imul(U,rt)|0,o=o+Math.imul(U,nt)|0,n=n+Math.imul(R,ot)|0,i=(i=i+Math.imul(R,st)|0)+Math.imul(O,ot)|0,o=o+Math.imul(O,st)|0,n=n+Math.imul(T,ut)|0,i=(i=i+Math.imul(T,ht)|0)+Math.imul(P,ut)|0,o=o+Math.imul(P,ht)|0,n=n+Math.imul(S,ft)|0,i=(i=i+Math.imul(S,ct)|0)+Math.imul(N,ft)|0,o=o+Math.imul(N,ct)|0;var Tt=(h+(n=n+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,mt)|0)+Math.imul(E,pt)|0))<<13)|0;h=((o=o+Math.imul(E,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(D,rt),i=(i=Math.imul(D,nt))+Math.imul(j,rt)|0,o=Math.imul(j,nt),n=n+Math.imul(B,ot)|0,i=(i=i+Math.imul(B,st)|0)+Math.imul(U,ot)|0,o=o+Math.imul(U,st)|0,n=n+Math.imul(R,ut)|0,i=(i=i+Math.imul(R,ht)|0)+Math.imul(O,ut)|0,o=o+Math.imul(O,ht)|0,n=n+Math.imul(T,ft)|0,i=(i=i+Math.imul(T,ct)|0)+Math.imul(P,ft)|0,o=o+Math.imul(P,ct)|0;var Pt=(h+(n=n+Math.imul(S,pt)|0)|0)+((8191&(i=(i=i+Math.imul(S,mt)|0)+Math.imul(N,pt)|0))<<13)|0;h=((o=o+Math.imul(N,mt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(D,ot),i=(i=Math.imul(D,st))+Math.imul(j,ot)|0,o=Math.imul(j,st),n=n+Math.imul(B,ut)|0,i=(i=i+Math.imul(B,ht)|0)+Math.imul(U,ut)|0,o=o+Math.imul(U,ht)|0,n=n+Math.imul(R,ft)|0,i=(i=i+Math.imul(R,ct)|0)+Math.imul(O,ft)|0,o=o+Math.imul(O,ct)|0;var It=(h+(n=n+Math.imul(T,pt)|0)|0)+((8191&(i=(i=i+Math.imul(T,mt)|0)+Math.imul(P,pt)|0))<<13)|0;h=((o=o+Math.imul(P,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(D,ut),i=(i=Math.imul(D,ht))+Math.imul(j,ut)|0,o=Math.imul(j,ht),n=n+Math.imul(B,ft)|0,i=(i=i+Math.imul(B,ct)|0)+Math.imul(U,ft)|0,o=o+Math.imul(U,ct)|0;var Rt=(h+(n=n+Math.imul(R,pt)|0)|0)+((8191&(i=(i=i+Math.imul(R,mt)|0)+Math.imul(O,pt)|0))<<13)|0;h=((o=o+Math.imul(O,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(D,ft),i=(i=Math.imul(D,ct))+Math.imul(j,ft)|0,o=Math.imul(j,ct);var Ot=(h+(n=n+Math.imul(B,pt)|0)|0)+((8191&(i=(i=i+Math.imul(B,mt)|0)+Math.imul(U,pt)|0))<<13)|0;h=((o=o+Math.imul(U,mt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863;var Ct=(h+(n=Math.imul(D,pt))|0)+((8191&(i=(i=Math.imul(D,mt))+Math.imul(j,pt)|0))<<13)|0;return h=((o=Math.imul(j,mt))+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,u[0]=gt,u[1]=yt,u[2]=vt,u[3]=wt,u[4]=bt,u[5]=Mt,u[6]=_t,u[7]=At,u[8]=Et,u[9]=xt,u[10]=St,u[11]=Nt,u[12]=kt,u[13]=Tt,u[14]=Pt,u[15]=It,u[16]=Rt,u[17]=Ot,u[18]=Ct,0!==h&&(u[19]=h,r.length++),r};function m(t,e,r){return(new g).mulp(t,e,r)}function g(t,e){this.x=t,this.y=e}Math.imul||(p=d),o.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?p(this,t,e):r<63?d(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o<r.length-1;o++){var s=i;i=0;for(var a=67108863&n,u=Math.min(o,e.length-1),h=Math.max(0,o-t.length+1);h<=u;h++){var l=o-h,f=(0|t.words[l])*(0|e.words[h]),c=67108863&f;a=67108863&(c=c+a|0),i+=(s=(s=s+(f/67108864|0)|0)+(c>>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,t,e):m(this,t,e)},g.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n<t;n++)e[n]=this.revBin(n,r,t);return e},g.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var n=0,i=0;i<e;i++)n|=(1&t)<<e-i-1,t>>=1;return n},g.prototype.permute=function(t,e,r,n,i,o){for(var s=0;s<o;s++)n[s]=e[t[s]],i[s]=r[t[s]]},g.prototype.transform=function(t,e,r,n,i,o){this.permute(o,t,e,r,n,i);for(var s=1;s<i;s<<=1)for(var a=s<<1,u=Math.cos(2*Math.PI/a),h=Math.sin(2*Math.PI/a),l=0;l<i;l+=a)for(var f=u,c=h,d=0;d<s;d++){var p=r[l+d],m=n[l+d],g=r[l+d+s],y=n[l+d+s],v=f*g-c*y;y=f*y+c*g,g=v,r[l+d]=p+g,n[l+d]=m+y,r[l+d+s]=p-g,n[l+d+s]=m-y,d!==a&&(v=u*f-h*c,c=u*c+h*f,f=v)}},g.prototype.guessLen13b=function(t,e){var r=1|Math.max(e,t),n=1&r,i=0;for(r=r/2|0;r;r>>>=1)i++;return 1<<i+1+n},g.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var n=0;n<r/2;n++){var i=t[n];t[n]=t[r-n-1],t[r-n-1]=i,i=e[n],e[n]=-e[r-n-1],e[r-n-1]=-i}},g.prototype.normalize13b=function(t,e){for(var r=0,n=0;n<e/2;n++){var i=8192*Math.round(t[2*n+1]/e)+Math.round(t[2*n]/e)+r;t[n]=67108863&i,r=i<67108864?0:i/67108864|0}return t},g.prototype.convert13b=function(t,e,r,i){for(var o=0,s=0;s<e;s++)o+=0|t[s],r[2*s]=8191&o,o>>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s<i;++s)r[s]=0;n(0===o),n(0==(-8192&o))},g.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},g.prototype.mulp=function(t,e,r){var n=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(n),o=this.stub(n),s=new Array(n),a=new Array(n),u=new Array(n),h=new Array(n),l=new Array(n),f=new Array(n),c=r.words;c.length=n,this.convert13b(t.words,t.length,s,n),this.convert13b(e.words,e.length,h,n),this.transform(s,o,a,u,n,i),this.transform(h,o,l,f,n,i);for(var d=0;d<n;d++){var p=a[d]*l[d]-u[d]*f[d];u[d]=a[d]*f[d]+u[d]*l[d],a[d]=p}return this.conjugate(a,u,n),this.transform(a,u,c,o,n,i),this.conjugate(c,o,n),this.normalize13b(c,n),r.negative=t.negative^e.negative,r.length=t.length+e.length,r.strip()},o.prototype.mul=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},o.prototype.mulf=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),m(this,t,e)},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 e=0,r=0;r<this.length;r++){var i=(0|this.words[r])*t,o=(67108863&i)+(67108863&e);e>>=26,e+=i/67108864|0,e+=o>>>26,this.words[r]=67108863&o}return 0!==e&&(this.words[r]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var n=r/26|0,i=r%26;e[r]=(t.words[n]&1<<i)>>>i}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n<e.length&&0===e[n];n++,r=r.sqr());if(++n<e.length)for(var i=r.sqr();n<e.length;n++,i=i.sqr())0!==e[n]&&(r=r.mul(i));return r},o.prototype.iushln=function(t){n("number"==typeof t&&t>=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,u=(0|this.words[e])-a<<r;this.words[e]=u|s,s=a>>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this.strip()},o.prototype.ishln=function(t){return n(0===this.negative),this.iushln(t)},o.prototype.iushrn=function(t,e,r){var i;n("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,u=r;if(i-=s,i=Math.max(0,i),u){for(var h=0;h<s;h++)u.words[h]=this.words[h];u.length=s}if(0===s);else if(this.length>s)for(this.length-=s,h=0;h<this.length;h++)this.words[h]=this.words[h+s];else this.words[0]=0,this.length=1;var l=0;for(h=this.length-1;h>=0&&(0!==l||h>=i);h--){var f=0|this.words[h];this.words[h]=l<<26-o|f>>>o,l=f&a}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<<e;return!(this.length<=r)&&!!(this.words[r]&i)},o.prototype.imaskn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<<e;this.words[this.length-1]&=i}return this.strip()},o.prototype.maskn=function(t){return this.clone().imaskn(t)},o.prototype.iaddn=function(t){return n("number"==typeof t),n(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},o.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this.strip()},o.prototype.addn=function(t){return this.clone().iaddn(t)},o.prototype.subn=function(t){return this.clone().isubn(t)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(t,e,r){var i,o,s=t.length+r;this._expand(s);var a=0;for(i=0;i<t.length;i++){o=(0|this.words[i+r])+a;var u=(0|t.words[i])*e;a=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i<this.length-r;i++)a=(o=(0|this.words[i+r])+a)>>26,this.words[i+r]=67108863&o;if(0===a)return this.strip();for(n(-1===a),a=0,i=0;i<this.length;i++)a=(o=-(0|this.words[i])+a)>>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,s=0|i.words[i.length-1];0!==(r=26-this._countBits(s))&&(i=i.ushln(r),n.iushln(r),s=0|i.words[i.length-1]);var a,u=n.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var h=0;h<a.length;h++)a.words[h]=0}var l=n.clone()._ishlnsubmul(i,1,u);0===l.negative&&(n=l,a&&(a.words[u]=1));for(var f=u-1;f>=0;f--){var c=67108864*(0|n.words[i.length+f])+(0|n.words[i.length+f-1]);for(c=Math.min(c/s|0,67108863),n._ishlnsubmul(i,c,f);0!==n.negative;)c--,n.negative=0,n._ishlnsubmul(i,1,f),n.isZero()||(n.negative^=1);a&&(a.words[f]=c)}return a&&a.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){n(t<=67108863);for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},o.prototype.idivn=function(t){n(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),s=new o(0),a=new o(0),u=new o(1),h=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++h;for(var l=r.clone(),f=e.clone();!e.isZero();){for(var c=0,d=1;0==(e.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(l),s.isub(f)),i.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(l),u.isub(f)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),s.isub(u)):(r.isub(e),a.isub(i),u.isub(s))}return{a:a,b:u,gcd:r.iushln(h)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,s=new o(1),a=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var h=0,l=1;0==(e.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(e.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var f=0,c=1;0==(r.words[0]&c)&&f<26;++f,c<<=1);if(f>0)for(r.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<<e;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var o=i,s=r;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:i<t?-1:1}return 0!==this.negative?0|-e:e},o.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},o.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){n<i?e=-1:n>i&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new A(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 y={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function b(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function M(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function E(t){A.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},i(w,v),w.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i<n;i++)e.words[i]=t.words[i];if(e.length=n,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,i=10;i<t.length;i++){var s=0|t.words[i];t.words[i-10]=(s&r)<<4|o>>>22,o=s}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},w.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var n=0|t.words[r];e+=977*n,t.words[r]=67108863&e,e=64*n+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(b,v),i(M,v),i(_,v),_.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var n=19*(0|t.words[r])+e,i=67108863&n;n>>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(y[t])return y[t];var e;if("k256"===t)e=new w;else if("p224"===t)e=new b;else if("p192"===t)e=new M;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new _}return y[t]=e,e},A.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},A.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},A.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},A.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},A.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},A.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},A.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},A.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},A.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},A.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},A.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},A.prototype.isqr=function(t){return this.imul(t,t.clone())},A.prototype.sqr=function(t){return this.mul(t,t)},A.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),h=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,h).cmp(u);)l.redIAdd(u);for(var f=this.pow(l,i),c=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();n(g<p);var y=this.pow(f,new o(1).iushln(p-g-1));c=c.redMul(y),f=y.redSqr(),d=d.redMul(f),p=g}return c},A.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},A.prototype.pow=function(t,e){if(e.isZero())return new o(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new o(1).toRed(this),r[1]=t;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],t);var i=r[0],s=0,a=0,u=e.bitLength()%26;for(0===u&&(u=26),n=e.length-1;n>=0;n--){for(var h=e.words[n],l=u-1;l>=0;l--){var f=h>>l&1;i!==r[0]&&(i=this.sqr(i)),0!==f||0!==s?(s<<=1,s|=f,(4===++a||0===n&&0===l)&&(i=this.mul(i,r[s]),a=0,s=0)):a=0}u=26}return i},A.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},A.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new E(t)},i(E,A),E.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},E.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},E.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},E.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},E.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,r(6)(t))},function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e){var r,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 a(t){if(r===setTimeout)return setTimeout(t,0);if((r===o||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:o}catch(t){r=o}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(t){n=s}}();var u,h=[],l=!1,f=-1;function c(){l&&u&&(l=!1,u.length?h=u.concat(h):f=-1,h.length&&d())}function d(){if(!l){var t=a(c);l=!0;for(var e=h.length;e;){for(u=h,h=[];++f<e;)u&&u[f].run();f=-1,e=h.length}u=null,l=!1,function(t){if(n===clearTimeout)return clearTimeout(t);if((n===s||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(t);try{n(t)}catch(e){try{return n.call(null,t)}catch(e){return n.call(this,t)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function m(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];h.push(new p(t,e)),1!==h.length||l||a(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,e){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,e,r){(function(n,i){var o;!function(){"use strict";var s="input is invalid type",a="object"==typeof window,u=a?window:{};u.JS_SHA3_NO_WINDOW&&(a=!1);var h=!a&&"object"==typeof self;!u.JS_SHA3_NO_NODE_JS&&"object"==typeof n&&n.versions&&n.versions.node?u=i:h&&(u=self);var l=!u.JS_SHA3_NO_COMMON_JS&&"object"==typeof t&&t.exports,f=r(55),c=!u.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,d="0123456789abcdef".split(""),p=[4,1024,262144,67108864],m=[0,8,16,24],g=[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],y=[224,256,384,512],v=[128,256],w=["hex","buffer","arrayBuffer","array","digest"],b={128:168,256:136};!u.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),!c||!u.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(t){return"object"==typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer});for(var M=function(t,e,r){return function(n){return new U(t,e,t).update(n)[r]()}},_=function(t,e,r){return function(n,i){return new U(t,e,i).update(n)[r]()}},A=function(t,e,r){return function(e,n,i,o){return k["cshake"+t].update(e,n,i,o)[r]()}},E=function(t,e,r){return function(e,n,i,o){return k["kmac"+t].update(e,n,i,o)[r]()}},x=function(t,e,r,n){for(var i=0;i<w.length;++i){var o=w[i];t[o]=e(r,n,o)}return t},S=function(t,e){var r=M(t,e,"hex");return r.create=function(){return new U(t,e,t)},r.update=function(t){return r.create().update(t)},x(r,M,t,e)},N=[{name:"keccak",padding:[1,256,65536,16777216],bits:y,createMethod:S},{name:"sha3",padding:[6,1536,393216,100663296],bits:y,createMethod:S},{name:"shake",padding:[31,7936,2031616,520093696],bits:v,createMethod:function(t,e){var r=_(t,e,"hex");return r.create=function(r){return new U(t,e,r)},r.update=function(t,e){return r.create(e).update(t)},x(r,_,t,e)}},{name:"cshake",padding:p,bits:v,createMethod:function(t,e){var r=b[t],n=A(t,0,"hex");return n.create=function(n,i,o){return i||o?new U(t,e,n).bytepad([i,o],r):k["shake"+t].create(n)},n.update=function(t,e,r,i){return n.create(e,r,i).update(t)},x(n,A,t,e)}},{name:"kmac",padding:p,bits:v,createMethod:function(t,e){var r=b[t],n=E(t,0,"hex");return n.create=function(n,i,o){return new L(t,e,i).bytepad(["KMAC",o],r).bytepad([n],r)},n.update=function(t,e,r,i){return n.create(t,r,i).update(e)},x(n,E,t,e)}}],k={},T=[],P=0;P<N.length;++P)for(var I=N[P],R=I.bits,O=0;O<R.length;++O){var C=I.name+"_"+R[O];if(T.push(C),k[C]=I.createMethod(R[O],I.padding),"sha3"!==I.name){var B=I.name+R[O];T.push(B),k[B]=k[C]}}function U(t,e,r){this.blocks=[],this.s=[],this.padding=e,this.outputBits=r,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(t<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}function L(t,e,r){U.call(this,t,e,r)}U.prototype.update=function(t){if(this.finalized)throw new Error("finalize already called");var e,r=typeof t;if("string"!==r){if("object"!==r)throw new Error(s);if(null===t)throw new Error(s);if(c&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||c&&ArrayBuffer.isView(t)))throw new Error(s);e=!0}for(var n,i,o=this.blocks,a=this.byteCount,u=t.length,h=this.blockCount,l=0,f=this.s;l<u;){if(this.reset)for(this.reset=!1,o[0]=this.block,n=1;n<h+1;++n)o[n]=0;if(e)for(n=this.start;l<u&&n<a;++l)o[n>>2]|=t[l]<<m[3&n++];else for(n=this.start;l<u&&n<a;++l)(i=t.charCodeAt(l))<128?o[n>>2]|=i<<m[3&n++]:i<2048?(o[n>>2]|=(192|i>>6)<<m[3&n++],o[n>>2]|=(128|63&i)<<m[3&n++]):i<55296||i>=57344?(o[n>>2]|=(224|i>>12)<<m[3&n++],o[n>>2]|=(128|i>>6&63)<<m[3&n++],o[n>>2]|=(128|63&i)<<m[3&n++]):(i=65536+((1023&i)<<10|1023&t.charCodeAt(++l)),o[n>>2]|=(240|i>>18)<<m[3&n++],o[n>>2]|=(128|i>>12&63)<<m[3&n++],o[n>>2]|=(128|i>>6&63)<<m[3&n++],o[n>>2]|=(128|63&i)<<m[3&n++]);if(this.lastByteIndex=n,n>=a){for(this.start=n-a,this.block=o[h],n=0;n<h;++n)f[n]^=o[n];D(f),this.reset=!0}else this.start=n}return this},U.prototype.encode=function(t,e){var r=255&t,n=1,i=[r];for(r=255&(t>>=8);r>0;)i.unshift(r),r=255&(t>>=8),++n;return e?i.push(n):i.unshift(n),this.update(i),i.length},U.prototype.encodeString=function(t){var e,r=typeof t;if("string"!==r){if("object"!==r)throw new Error(s);if(null===t)throw new Error(s);if(c&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||c&&ArrayBuffer.isView(t)))throw new Error(s);e=!0}var n=0,i=t.length;if(e)n=i;else for(var o=0;o<t.length;++o){var a=t.charCodeAt(o);a<128?n+=1:a<2048?n+=2:a<55296||a>=57344?n+=3:(a=65536+((1023&a)<<10|1023&t.charCodeAt(++o)),n+=4)}return n+=this.encode(8*n),this.update(t),n},U.prototype.bytepad=function(t,e){for(var r=this.encode(e),n=0;n<t.length;++n)r+=this.encodeString(t[n]);var i=e-r%e,o=[];return o.length=i,this.update(o),this},U.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex,r=this.blockCount,n=this.s;if(t[e>>2]|=this.padding[3&e],this.lastByteIndex===this.byteCount)for(t[0]=t[r],e=1;e<r+1;++e)t[e]=0;for(t[r-1]|=2147483648,e=0;e<r;++e)n[e]^=t[e];D(n)}},U.prototype.toString=U.prototype.hex=function(){this.finalize();for(var t,e=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,s=0,a="";s<n;){for(o=0;o<e&&s<n;++o,++s)t=r[o],a+=d[t>>4&15]+d[15&t]+d[t>>12&15]+d[t>>8&15]+d[t>>20&15]+d[t>>16&15]+d[t>>28&15]+d[t>>24&15];s%e==0&&(D(r),o=0)}return i&&(t=r[o],a+=d[t>>4&15]+d[15&t],i>1&&(a+=d[t>>12&15]+d[t>>8&15]),i>2&&(a+=d[t>>20&15]+d[t>>16&15])),a},U.prototype.arrayBuffer=function(){this.finalize();var t,e=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,s=0,a=this.outputBits>>3;t=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(a);for(var u=new Uint32Array(t);s<n;){for(o=0;o<e&&s<n;++o,++s)u[s]=r[o];s%e==0&&D(r)}return i&&(u[o]=r[o],t=t.slice(0,a)),t},U.prototype.buffer=U.prototype.arrayBuffer,U.prototype.digest=U.prototype.array=function(){this.finalize();for(var t,e,r=this.blockCount,n=this.s,i=this.outputBlocks,o=this.extraBytes,s=0,a=0,u=[];a<i;){for(s=0;s<r&&a<i;++s,++a)t=a<<2,e=n[s],u[t]=255&e,u[t+1]=e>>8&255,u[t+2]=e>>16&255,u[t+3]=e>>24&255;a%r==0&&D(n)}return o&&(t=a<<2,e=n[s],u[t]=255&e,o>1&&(u[t+1]=e>>8&255),o>2&&(u[t+2]=e>>16&255)),u},L.prototype=new U,L.prototype.finalize=function(){return this.encode(this.outputBits,!0),U.prototype.finalize.call(this)};var D=function(t){var e,r,n,i,o,s,a,u,h,l,f,c,d,p,m,y,v,w,b,M,_,A,E,x,S,N,k,T,P,I,R,O,C,B,U,L,D,j,F,z,H,G,q,V,K,Z,W,J,$,X,Y,Q,tt,et,rt,nt,it,ot,st,at,ut,ht,lt;for(n=0;n<48;n+=2)i=t[0]^t[10]^t[20]^t[30]^t[40],o=t[1]^t[11]^t[21]^t[31]^t[41],s=t[2]^t[12]^t[22]^t[32]^t[42],a=t[3]^t[13]^t[23]^t[33]^t[43],u=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],f=t[7]^t[17]^t[27]^t[37]^t[47],e=(c=t[8]^t[18]^t[28]^t[38]^t[48])^(s<<1|a>>>31),r=(d=t[9]^t[19]^t[29]^t[39]^t[49])^(a<<1|s>>>31),t[0]^=e,t[1]^=r,t[10]^=e,t[11]^=r,t[20]^=e,t[21]^=r,t[30]^=e,t[31]^=r,t[40]^=e,t[41]^=r,e=i^(u<<1|h>>>31),r=o^(h<<1|u>>>31),t[2]^=e,t[3]^=r,t[12]^=e,t[13]^=r,t[22]^=e,t[23]^=r,t[32]^=e,t[33]^=r,t[42]^=e,t[43]^=r,e=s^(l<<1|f>>>31),r=a^(f<<1|l>>>31),t[4]^=e,t[5]^=r,t[14]^=e,t[15]^=r,t[24]^=e,t[25]^=r,t[34]^=e,t[35]^=r,t[44]^=e,t[45]^=r,e=u^(c<<1|d>>>31),r=h^(d<<1|c>>>31),t[6]^=e,t[7]^=r,t[16]^=e,t[17]^=r,t[26]^=e,t[27]^=r,t[36]^=e,t[37]^=r,t[46]^=e,t[47]^=r,e=l^(i<<1|o>>>31),r=f^(o<<1|i>>>31),t[8]^=e,t[9]^=r,t[18]^=e,t[19]^=r,t[28]^=e,t[29]^=r,t[38]^=e,t[39]^=r,t[48]^=e,t[49]^=r,p=t[0],m=t[1],Z=t[11]<<4|t[10]>>>28,W=t[10]<<4|t[11]>>>28,T=t[20]<<3|t[21]>>>29,P=t[21]<<3|t[20]>>>29,at=t[31]<<9|t[30]>>>23,ut=t[30]<<9|t[31]>>>23,G=t[40]<<18|t[41]>>>14,q=t[41]<<18|t[40]>>>14,B=t[2]<<1|t[3]>>>31,U=t[3]<<1|t[2]>>>31,y=t[13]<<12|t[12]>>>20,v=t[12]<<12|t[13]>>>20,J=t[22]<<10|t[23]>>>22,$=t[23]<<10|t[22]>>>22,I=t[33]<<13|t[32]>>>19,R=t[32]<<13|t[33]>>>19,ht=t[42]<<2|t[43]>>>30,lt=t[43]<<2|t[42]>>>30,et=t[5]<<30|t[4]>>>2,rt=t[4]<<30|t[5]>>>2,L=t[14]<<6|t[15]>>>26,D=t[15]<<6|t[14]>>>26,w=t[25]<<11|t[24]>>>21,b=t[24]<<11|t[25]>>>21,X=t[34]<<15|t[35]>>>17,Y=t[35]<<15|t[34]>>>17,O=t[45]<<29|t[44]>>>3,C=t[44]<<29|t[45]>>>3,x=t[6]<<28|t[7]>>>4,S=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,F=t[27]<<25|t[26]>>>7,M=t[36]<<21|t[37]>>>11,_=t[37]<<21|t[36]>>>11,Q=t[47]<<24|t[46]>>>8,tt=t[46]<<24|t[47]>>>8,V=t[8]<<27|t[9]>>>5,K=t[9]<<27|t[8]>>>5,N=t[18]<<20|t[19]>>>12,k=t[19]<<20|t[18]>>>12,ot=t[29]<<7|t[28]>>>25,st=t[28]<<7|t[29]>>>25,z=t[38]<<8|t[39]>>>24,H=t[39]<<8|t[38]>>>24,A=t[48]<<14|t[49]>>>18,E=t[49]<<14|t[48]>>>18,t[0]=p^~y&w,t[1]=m^~v&b,t[10]=x^~N&T,t[11]=S^~k&P,t[20]=B^~L&j,t[21]=U^~D&F,t[30]=V^~Z&J,t[31]=K^~W&$,t[40]=et^~nt&ot,t[41]=rt^~it&st,t[2]=y^~w&M,t[3]=v^~b&_,t[12]=N^~T&I,t[13]=k^~P&R,t[22]=L^~j&z,t[23]=D^~F&H,t[32]=Z^~J&X,t[33]=W^~$&Y,t[42]=nt^~ot&at,t[43]=it^~st&ut,t[4]=w^~M&A,t[5]=b^~_&E,t[14]=T^~I&O,t[15]=P^~R&C,t[24]=j^~z&G,t[25]=F^~H&q,t[34]=J^~X&Q,t[35]=$^~Y&tt,t[44]=ot^~at&ht,t[45]=st^~ut&lt,t[6]=M^~A&p,t[7]=_^~E&m,t[16]=I^~O&x,t[17]=R^~C&S,t[26]=z^~G&B,t[27]=H^~q&U,t[36]=X^~Q&V,t[37]=Y^~tt&K,t[46]=at^~ht&et,t[47]=ut^~lt&rt,t[8]=A^~p&y,t[9]=E^~m&v,t[18]=O^~x&N,t[19]=C^~S&k,t[28]=G^~B&L,t[29]=q^~U&D,t[38]=Q^~V&Z,t[39]=tt^~K&W,t[48]=ht^~et&nt,t[49]=lt^~rt&it,t[0]^=g[n],t[1]^=g[n+1]};if(l)t.exports=k;else{for(P=0;P<T.length;++P)u[T[P]]=k[T[P]];f&&(void 0===(o=function(){return k}.call(e,r,e,t))||(t.exports=o))}}()}).call(this,r(5),r(4))},function(t,e,r){"use strict";t.exports=function(t,e){return function(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];return t.apply(e,r)}}},function(t,e,r){"use strict";var n=r(0);function i(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}t.exports=function(t,e,r){if(!e)return t;var o;if(r)o=r(e);else if(n.isURLSearchParams(e))o=e.toString();else{var s=[];n.forEach(e,(function(t,e){null!=t&&(n.isArray(t)?e+="[]":t=[t],n.forEach(t,(function(t){n.isDate(t)?t=t.toISOString():n.isObject(t)&&(t=JSON.stringify(t)),s.push(i(e)+"="+i(t))})))})),o=s.join("&")}if(o){var a=t.indexOf("#");-1!==a&&(t=t.slice(0,a)),t+=(-1===t.indexOf("?")?"?":"&")+o}return t}},function(t,e,r){"use strict";t.exports=function(t){return!(!t||!t.__CANCEL__)}},function(t,e,r){"use strict";(function(e){var n=r(0),i=r(28),o={"Content-Type":"application/x-www-form-urlencoded"};function s(t,e){!n.isUndefined(t)&&n.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var a,u={adapter:(("undefined"!=typeof XMLHttpRequest||void 0!==e&&"[object process]"===Object.prototype.toString.call(e))&&(a=r(12)),a),transformRequest:[function(t,e){return i(e,"Accept"),i(e,"Content-Type"),n.isFormData(t)||n.isArrayBuffer(t)||n.isBuffer(t)||n.isStream(t)||n.isFile(t)||n.isBlob(t)?t:n.isArrayBufferView(t)?t.buffer:n.isURLSearchParams(t)?(s(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString()):n.isObject(t)?(s(e,"application/json;charset=utf-8"),JSON.stringify(t)):t}],transformResponse:[function(t){if("string"==typeof t)try{t=JSON.parse(t)}catch(t){}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(t){return t>=200&&t<300}};u.headers={common:{Accept:"application/json, text/plain, */*"}},n.forEach(["delete","get","head"],(function(t){u.headers[t]={}})),n.forEach(["post","put","patch"],(function(t){u.headers[t]=n.merge(o)})),t.exports=u}).call(this,r(5))},function(t,e,r){"use strict";var n=r(0),i=r(29),o=r(31),s=r(9),a=r(32),u=r(35),h=r(36),l=r(13);t.exports=function(t){return new Promise((function(e,r){var f=t.data,c=t.headers;n.isFormData(f)&&delete c["Content-Type"];var d=new XMLHttpRequest;if(t.auth){var p=t.auth.username||"",m=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";c.Authorization="Basic "+btoa(p+":"+m)}var g=a(t.baseURL,t.url);if(d.open(t.method.toUpperCase(),s(g,t.params,t.paramsSerializer),!0),d.timeout=t.timeout,d.onreadystatechange=function(){if(d&&4===d.readyState&&(0!==d.status||d.responseURL&&0===d.responseURL.indexOf("file:"))){var n="getAllResponseHeaders"in d?u(d.getAllResponseHeaders()):null,o={data:t.responseType&&"text"!==t.responseType?d.response:d.responseText,status:d.status,statusText:d.statusText,headers:n,config:t,request:d};i(e,r,o),d=null}},d.onabort=function(){d&&(r(l("Request aborted",t,"ECONNABORTED",d)),d=null)},d.onerror=function(){r(l("Network Error",t,null,d)),d=null},d.ontimeout=function(){var e="timeout of "+t.timeout+"ms exceeded";t.timeoutErrorMessage&&(e=t.timeoutErrorMessage),r(l(e,t,"ECONNABORTED",d)),d=null},n.isStandardBrowserEnv()){var y=(t.withCredentials||h(g))&&t.xsrfCookieName?o.read(t.xsrfCookieName):void 0;y&&(c[t.xsrfHeaderName]=y)}if("setRequestHeader"in d&&n.forEach(c,(function(t,e){void 0===f&&"content-type"===e.toLowerCase()?delete c[e]:d.setRequestHeader(e,t)})),n.isUndefined(t.withCredentials)||(d.withCredentials=!!t.withCredentials),t.responseType)try{d.responseType=t.responseType}catch(e){if("json"!==t.responseType)throw e}"function"==typeof t.onDownloadProgress&&d.addEventListener("progress",t.onDownloadProgress),"function"==typeof t.onUploadProgress&&d.upload&&d.upload.addEventListener("progress",t.onUploadProgress),t.cancelToken&&t.cancelToken.promise.then((function(t){d&&(d.abort(),r(t),d=null)})),f||(f=null),d.send(f)}))}},function(t,e,r){"use strict";var n=r(30);t.exports=function(t,e,r,i,o){var s=new Error(t);return n(s,e,r,i,o)}},function(t,e,r){"use strict";var n=r(0);t.exports=function(t,e){e=e||{};var r={},i=["url","method","data"],o=["headers","auth","proxy","params"],s=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],a=["validateStatus"];function u(t,e){return n.isPlainObject(t)&&n.isPlainObject(e)?n.merge(t,e):n.isPlainObject(e)?n.merge({},e):n.isArray(e)?e.slice():e}function h(i){n.isUndefined(e[i])?n.isUndefined(t[i])||(r[i]=u(void 0,t[i])):r[i]=u(t[i],e[i])}n.forEach(i,(function(t){n.isUndefined(e[t])||(r[t]=u(void 0,e[t]))})),n.forEach(o,h),n.forEach(s,(function(i){n.isUndefined(e[i])?n.isUndefined(t[i])||(r[i]=u(void 0,t[i])):r[i]=u(void 0,e[i])})),n.forEach(a,(function(n){n in e?r[n]=u(t[n],e[n]):n in t&&(r[n]=u(void 0,t[n]))}));var l=i.concat(o).concat(s).concat(a),f=Object.keys(t).concat(Object.keys(e)).filter((function(t){return-1===l.indexOf(t)}));return n.forEach(f,h),r}},function(t,e,r){"use strict";function n(t){this.message=t}n.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},n.prototype.__CANCEL__=!0,t.exports=n},function(t,e,r){var n=r(42),i=r(18),o=r(56),s=r(57),a=r(3),u=function(t,e){var r=[];return e.forEach((function(e){if("object"==typeof e.components){if("tuple"!==e.type.substring(0,5))throw new Error("components found but type is not tuple; report on GitHub");var n="",i=e.type.indexOf("[");i>=0&&(n=e.type.substring(i));var o=u(t,e.components);Array.isArray(o)&&t?r.push("tuple("+o.join(",")+")"+n):t?r.push("("+o+")"):r.push("("+o.join(",")+")"+n)}else r.push(e.type)})),r},h=function(t){if(!i.isHexStrict(t))throw new Error("The parameter must be a valid HEX string.");var e="",r=0,n=t.length;for("0x"===t.substring(0,2)&&(r=2);r<n;r+=2){var o=parseInt(t.substr(r,2),16);e+=String.fromCharCode(o)}return e},l=function(t){if(!t)return"0x00";for(var e="",r=0;r<t.length;r++){var n=t.charCodeAt(r).toString(16);e+=n.length<2?"0"+n:n}return"0x"+e},f=function(t){if(t=t?t.toLowerCase():"ether",!n.unitMap[t])throw new Error('This unit "'+t+"\" doesn't exist, please use the one of the following units"+JSON.stringify(n.unitMap,null,2));return t};t.exports={_fireError:function(t,e,r,n,i){return!t||"object"!=typeof t||t instanceof Error||!t.data||((t.data&&"object"==typeof t.data||Array.isArray(t.data))&&(t.data=JSON.stringify(t.data,null,2)),t=t.message+"\n"+t.data),"string"==typeof t&&(t=new Error(t)),"function"==typeof n&&n(t,i),"function"==typeof r&&((e&&"function"==typeof e.listeners&&e.listeners("error").length||"function"==typeof n)&&e.catch((function(){})),setTimeout((function(){r(t)}),1)),e&&"function"==typeof e.emit&&setTimeout((function(){e.emit("error",t,i),e.removeAllListeners()}),1),e},_jsonInterfaceMethodToString:function(t){return t&&"object"==typeof t&&t.name&&-1!==t.name.indexOf("(")?t.name:t.name+"("+u(!1,t.inputs).join(",")+")"},_flattenTypes:u,randomHex:function(t){return"0x"+s(t).toString("hex")},BN:i.BN,isBN:i.isBN,isBigNumber:i.isBigNumber,isHex:i.isHex,isHexStrict:i.isHexStrict,sha3:i.sha3,sha3Raw:i.sha3Raw,keccak256:i.sha3,soliditySha3:o.soliditySha3,soliditySha3Raw:o.soliditySha3Raw,encodePacked:o.encodePacked,isAddress:i.isAddress,checkAddressChecksum:i.checkAddressChecksum,toChecksumAddress:function(t){if(void 0===t)return"";if(!/^(0x)?[0-9a-f]{40}$/i.test(t))throw new Error('Given address "'+t+'" is not a valid Ethereum address.');t=t.toLowerCase().replace(/^0x/i,"");for(var e=i.sha3(t).replace(/^0x/i,""),r="0x",n=0;n<t.length;n++)parseInt(e[n],16)>7?r+=t[n].toUpperCase():r+=t[n];return r},toHex:i.toHex,toBN:i.toBN,bytesToHex:i.bytesToHex,hexToBytes:i.hexToBytes,hexToNumberString:i.hexToNumberString,hexToNumber:i.hexToNumber,toDecimal:i.hexToNumber,numberToHex:i.numberToHex,fromDecimal:i.numberToHex,hexToUtf8:i.hexToUtf8,hexToString:i.hexToUtf8,toUtf8:i.hexToUtf8,stripHexPrefix:i.stripHexPrefix,utf8ToHex:i.utf8ToHex,stringToHex:i.utf8ToHex,fromUtf8:i.utf8ToHex,hexToAscii:h,toAscii:h,asciiToHex:l,fromAscii:l,unitMap:n.unitMap,toWei:function(t,e){if(e=f(e),!i.isBN(t)&&"string"!=typeof t)throw new Error("Please pass numbers as strings or BN objects to avoid precision errors.");return i.isBN(t)?n.toWei(t,e):n.toWei(t,e).toString(10)},fromWei:function(t,e){if(e=f(e),!i.isBN(t)&&"string"!=typeof t)throw new Error("Please pass numbers as strings or BN objects to avoid precision errors.");return i.isBN(t)?n.fromWei(t,e):n.fromWei(t,e).toString(10)},padLeft:i.leftPad,leftPad:i.leftPad,padRight:i.rightPad,rightPad:i.rightPad,toTwosComplement:i.toTwosComplement,isBloom:i.isBloom,isUserEthereumAddressInBloom:i.isUserEthereumAddressInBloom,isContractAddressInBloom:i.isContractAddressInBloom,isTopic:i.isTopic,isTopicInBloom:i.isTopicInBloom,isInBloom:i.isInBloom,compareBlockNumbers:function(t,e){if(t==e)return 0;if("genesis"!=t&&"earliest"!=t&&0!=t||"genesis"!=e&&"earliest"!=e&&0!=e){if("genesis"==t||"earliest"==t)return-1;if("genesis"==e||"earliest"==e)return 1;if("latest"==t)return"pending"==e?-1:1;if("latest"===e)return"pending"==t?1:-1;if("pending"==t)return 1;if("pending"==e)return-1;{let r=new a(t),n=new a(e);return r.lt(n)?-1:r.eq(n)?0:1}}return 0},toNumber:i.toNumber}},function(t,e,r){var n=r(47),i=r(48);t.exports=function(t){if("string"==typeof t||"number"==typeof t){var e=new n(1),r=String(t).toLowerCase().trim(),o="0x"===r.substr(0,2)||"-0x"===r.substr(0,3),s=i(r);if("-"===s.substr(0,1)&&(s=i(s.slice(1)),e=new n(-1,10)),!(s=""===s?"0":s).match(/^-?[0-9]+$/)&&s.match(/^[0-9A-Fa-f]+$/)||s.match(/^[a-fA-F]+$/)||!0===o&&s.match(/^[0-9A-Fa-f]+$/))return new n(s,16).mul(e);if((s.match(/^-?[0-9]+$/)||""===s)&&!1===o)return new n(s,10).mul(e)}else if("object"==typeof t&&t.toString&&!t.pop&&!t.push&&t.toString(10).match(/^-?[0-9]+$/)&&(t.mul||t.dividedToIntegerBy))return new n(t.toString(10),10);throw new Error("[number-to-bn] while converting number "+JSON.stringify(t)+" to BN.js instance, error: invalid number value. Value must be an integer, hex string, BN or BigNumber instance. Note, decimals are not supported.")}},function(t,e,r){(function(e){var n=r(3),i=r(17),o=r(51),s=r(52),a=r(53),u=function(t){return n.isBN(t)},h=function(t){return t&&t.constructor&&"BigNumber"===t.constructor.name},l=function(t){try{return i.apply(null,arguments)}catch(e){throw new Error(e+' Given value: "'+t+'"')}},f=function(t){return!!/^(0x)?[0-9a-f]{40}$/i.test(t)&&(!(!/^(0x|0X)?[0-9a-f]{40}$/.test(t)&&!/^(0x|0X)?[0-9A-F]{40}$/.test(t))||c(t))},c=function(t){t=t.replace(/^0x/i,"");for(var e=M(t.toLowerCase()).replace(/^0x/i,""),r=0;r<40;r++)if(parseInt(e[r],16)>7&&t[r].toUpperCase()!==t[r]||parseInt(e[r],16)<=7&&t[r].toLowerCase()!==t[r])return!1;return!0},d=function(t){var e="";t=(t=(t=(t=(t=o.encode(t)).replace(/^(?:\u0000)*/,"")).split("").reverse().join("")).replace(/^(?:\u0000)*/,"")).split("").reverse().join("");for(var r=0;r<t.length;r++){var n=t.charCodeAt(r).toString(16);e+=n.length<2?"0"+n:n}return"0x"+e},p=function(t){if(!t)return t;if("string"==typeof t&&!v(t))throw new Error('Given value "'+t+'" is not a valid hex string.');return l(t).toNumber()},m=function(t){if(null==t)return t;if(!isFinite(t)&&!v(t))throw new Error('Given input "'+t+'" is not a number.');var e=l(t),r=e.toString(16);return e.lt(new n(0))?"-0x"+r.substr(1):"0x"+r},g=function(t){if(t=t.toString(16),!v(t))throw new Error('Given value "'+t+'" is not a valid hex string.');t=t.replace(/^0x/i,"");for(var e=[],r=0;r<t.length;r+=2)e.push(parseInt(t.substr(r,2),16));return e},y=function(t,r){if(f(t))return r?"address":"0x"+t.toLowerCase().replace(/^0x/i,"");if("boolean"==typeof t)return r?"bool":t?"0x01":"0x00";if(e.isBuffer(t))return"0x"+t.toString("hex");if("object"==typeof t&&t&&!h(t)&&!u(t))return r?"string":d(JSON.stringify(t));if("string"==typeof t){if(0===t.indexOf("-0x")||0===t.indexOf("-0X"))return r?"int256":m(t);if(0===t.indexOf("0x")||0===t.indexOf("0X"))return r?"bytes":t;if(!isFinite(t))return r?"string":d(t)}return r?t<0?"int256":"uint256":m(t)},v=function(t){return("string"==typeof t||"number"==typeof t)&&/^(-)?0x[0-9a-f]*$/i.test(t)},w=function(t){return("string"==typeof t||"number"==typeof t)&&/^(-0x|0x)?[0-9a-f]*$/i.test(t)},b="0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",M=function(t){u(t)&&(t=t.toString()),v(t)&&/^0x/i.test(t.toString())&&(t=g(t));var e=s.keccak256(t);return e===b?null:e};M._Hash=s;t.exports={BN:n,isBN:u,isBigNumber:h,toBN:l,isAddress:f,isBloom:function(t){return a.isBloom(t)},isUserEthereumAddressInBloom:function(t,e){return a.isUserEthereumAddressInBloom(t,e)},isContractAddressInBloom:function(t,e){return a.isContractAddressInBloom(t,e)},isTopic:function(t){return a.isTopic(t)},isTopicInBloom:function(t,e){return a.isTopicInBloom(t,e)},isInBloom:function(t,e){return a.isInBloom(t,e)},checkAddressChecksum:c,utf8ToHex:d,hexToUtf8:function(t){if(!v(t))throw new Error('The parameter "'+t+'" must be a valid HEX string.');for(var e="",r=0,n=(t=(t=(t=(t=(t=t.replace(/^0x/i,"")).replace(/^(?:00)*/,"")).split("").reverse().join("")).replace(/^(?:00)*/,"")).split("").reverse().join("")).length,i=0;i<n;i+=2)r=parseInt(t.substr(i,2),16),e+=String.fromCharCode(r);return o.decode(e)},hexToNumber:p,hexToNumberString:function(t){if(!t)return t;if("string"==typeof t&&!v(t))throw new Error('Given value "'+t+'" is not a valid hex string.');return l(t).toString(10)},numberToHex:m,toHex:y,hexToBytes:g,bytesToHex:function(t){for(var e=[],r=0;r<t.length;r++)e.push((t[r]>>>4).toString(16)),e.push((15&t[r]).toString(16));return"0x"+e.join("")},isHex:w,isHexStrict:v,stripHexPrefix:function(t){return 0!==t&&w(t)?t.replace(/^(-)?0x/i,"$1"):t},leftPad:function(t,e,r){var n=/^0x/i.test(t)||"number"==typeof t,i=e-(t=t.toString(16).replace(/^0x/i,"")).length+1>=0?e-t.length+1:0;return(n?"0x":"")+new Array(i).join(r||"0")+t},rightPad:function(t,e,r){var n=/^0x/i.test(t)||"number"==typeof t,i=e-(t=t.toString(16).replace(/^0x/i,"")).length+1>=0?e-t.length+1:0;return(n?"0x":"")+t+new Array(i).join(r||"0")},toTwosComplement:function(t){return"0x"+l(t).toTwos(256).toString(16,64)},sha3:M,sha3Raw:function(t){return null===(t=M(t))?b:t},toNumber:function(t){return"number"==typeof t?t:p(y(t))}}}).call(this,r(2).Buffer)},function(t,e,r){"use strict";r.r(e),r.d(e,"ConstructorFragment",(function(){return st})),r.d(e,"EventFragment",(function(){return rt})),r.d(e,"Fragment",(function(){return et})),r.d(e,"FunctionFragment",(function(){return at})),r.d(e,"ParamType",(function(){return Q})),r.d(e,"FormatTypes",(function(){return X})),r.d(e,"AbiCoder",(function(){return re})),r.d(e,"defaultAbiCoder",(function(){return ne})),r.d(e,"Interface",(function(){return le})),r.d(e,"Indexed",(function(){return ue})),r.d(e,"checkResultErrors",(function(){return dt})),r.d(e,"LogDescription",(function(){return se})),r.d(e,"TransactionDescription",(function(){return ae}));var n=r(3),i=r.n(n);let o=!1,s=!1;const a={debug:1,default:2,info:2,warning:3,error:4,off:5};let u=a.default,h=null;const l=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var f,c;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(f||(f={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED"}(c||(c={}));const d="0123456789abcdef";class p{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==a[r]&&this.throwArgumentError("invalid log level name","logLevel",t),u>a[r]||console.log.apply(console,e)}debug(...t){this._log(p.levels.DEBUG,t)}info(...t){this._log(p.levels.INFO,t)}warn(...t){this._log(p.levels.WARNING,t)}makeError(t,e,r){if(s)return this.makeError("censored error",e,{});e||(e=p.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach((t=>{const e=r[t];try{if(e instanceof Uint8Array){let r="";for(let t=0;t<e.length;t++)r+=d[e[t]>>4],r+=d[15&e[t]];n.push(t+"=Uint8Array(0x"+r+")")}else n.push(t+"="+JSON.stringify(e))}catch(e){n.push(t+"="+JSON.stringify(r[t].toString()))}})),n.push(`code=${e}`),n.push(`version=${this.version}`);const i=t;n.length&&(t+=" ("+n.join(", ")+")");const o=new Error(t);return o.reason=i,o.code=e,Object.keys(r).forEach((function(t){o[t]=r[t]})),o}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,p.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,n){t||this.throwError(e,r,n)}assertArgument(t,e,r,n){t||this.throwArgumentError(e,r,n)}checkNormalize(t){null==t&&(t="platform missing String.prototype.normalize"),l&&this.throwError("platform missing String.prototype.normalize",p.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:l})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,p.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,p.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",t<e&&this.throwError("missing argument"+r,p.errors.MISSING_ARGUMENT,{count:t,expectedCount:e}),t>e&&this.throwError("too many arguments"+r,p.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",p.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",p.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",p.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return h||(h=new p("logger/5.4.1")),h}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",p.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),o){if(!t)return;this.globalLogger().throwError("error censorship permanent",p.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}s=!!t,o=!!e}static setLogLevel(t){const e=a[t.toLowerCase()];null!=e?u=e:p.globalLogger().warn("invalid log level - "+t)}static from(t){return new p(t)}}p.errors=c,p.levels=f;const m=new p("bytes/5.4.0");function g(t){return!!t.toHexString}function y(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return y(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function v(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(let e=0;e<t.length;e++){const r=t[e];if("number"!=typeof r||r<0||r>=256||r%1)return!1}return!0}function w(t,e){if(e||(e={}),"number"==typeof t){m.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),y(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),g(t)&&(t=t.toHexString()),M(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0x0"+r.substring(2):"right"===e.hexPad?r+="0":m.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let t=0;t<r.length;t+=2)n.push(parseInt(r.substring(t,t+2),16));return y(new Uint8Array(n))}return v(t)?y(new Uint8Array(t)):m.throwArgumentError("invalid arrayify value","value",t)}function b(t){const e=t.map((t=>w(t))),r=e.reduce(((t,e)=>t+e.length),0),n=new Uint8Array(r);return e.reduce(((t,e)=>(n.set(e,t),t+e.length)),0),y(n)}function M(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/))&&(!e||t.length===2+2*e)}const _="0123456789abcdef";function A(t,e){if(e||(e={}),"number"==typeof t){m.checkSafeUint53(t,"invalid hexlify value");let e="";for(;t;)e=_[15&t]+e,t=Math.floor(t/16);return e.length?(e.length%2&&(e="0"+e),"0x"+e):"0x00"}if("bigint"==typeof t)return(t=t.toString(16)).length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),g(t))return t.toHexString();if(M(t))return t.length%2&&("left"===e.hexPad?t="0x0"+t.substring(2):"right"===e.hexPad?t+="0":m.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(v(t)){let e="0x";for(let r=0;r<t.length;r++){let n=t[r];e+=_[(240&n)>>4]+_[15&n]}return e}return m.throwArgumentError("invalid hexlify value","value",t)}function E(t,e,r){return"string"!=typeof t?t=A(t):(!M(t)||t.length%2)&&m.throwArgumentError("invalid hexData","value",t),e=2+2*e,null!=r?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}function x(t,e){for("string"!=typeof t?t=A(t):M(t)||m.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&m.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}var S=i.a.BN;const N=new p("bignumber/5.4.1"),k={},T=9007199254740991;let P=!1;class I{constructor(t,e){N.checkNew(new.target,I),t!==k&&N.throwError("cannot call constructor directly; use BigNumber.from",p.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return O(C(this).fromTwos(t))}toTwos(t){return O(C(this).toTwos(t))}abs(){return"-"===this._hex[0]?I.from(this._hex.substring(1)):this}add(t){return O(C(this).add(C(t)))}sub(t){return O(C(this).sub(C(t)))}div(t){return I.from(t).isZero()&&B("division by zero","div"),O(C(this).div(C(t)))}mul(t){return O(C(this).mul(C(t)))}mod(t){const e=C(t);return e.isNeg()&&B("cannot modulo negative values","mod"),O(C(this).umod(e))}pow(t){const e=C(t);return e.isNeg()&&B("cannot raise to negative values","pow"),O(C(this).pow(e))}and(t){const e=C(t);return(this.isNegative()||e.isNeg())&&B("cannot 'and' negative values","and"),O(C(this).and(e))}or(t){const e=C(t);return(this.isNegative()||e.isNeg())&&B("cannot 'or' negative values","or"),O(C(this).or(e))}xor(t){const e=C(t);return(this.isNegative()||e.isNeg())&&B("cannot 'xor' negative values","xor"),O(C(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&B("cannot mask negative values","mask"),O(C(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&B("cannot shift negative values","shl"),O(C(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&B("cannot shift negative values","shr"),O(C(this).shrn(t))}eq(t){return C(this).eq(C(t))}lt(t){return C(this).lt(C(t))}lte(t){return C(this).lte(C(t))}gt(t){return C(this).gt(C(t))}gte(t){return C(this).gte(C(t))}isNegative(){return"-"===this._hex[0]}isZero(){return C(this).isZero()}toNumber(){try{return C(this).toNumber()}catch(t){B("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return N.throwError("this platform does not support BigInt",p.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?P||(P=!0,N.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?N.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",p.errors.UNEXPECTED_ARGUMENT,{}):N.throwError("BigNumber.toString does not accept parameters",p.errors.UNEXPECTED_ARGUMENT,{})),C(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof I)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new I(k,R(t)):t.match(/^-?[0-9]+$/)?new I(k,R(new S(t))):N.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&B("underflow","BigNumber.from",t),(t>=T||t<=-T)&&B("overflow","BigNumber.from",t),I.from(String(t));const e=t;if("bigint"==typeof e)return I.from(e.toString());if(v(e))return I.from(A(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return I.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&(M(t)||"-"===t[0]&&M(t.substring(1))))return I.from(t)}return N.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function R(t){if("string"!=typeof t)return R(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&N.throwArgumentError("invalid hex","value",t),"0x00"===(t=R(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 O(t){return I.from(R(t))}function C(t){const e=I.from(t).toHexString();return"-"===e[0]?new S("-"+e.substring(3),16):new S(e.substring(2),16)}function B(t,e,r){const n={fault:t,operation:e};return null!=r&&(n.value=r),N.throwError(t,p.errors.NUMERIC_FAULT,n)}const U=new p("properties/5.4.1");function L(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}function D(t,e){for(let r=0;r<32;r++){if(t[e])return t[e];if(!t.prototype||"object"!=typeof t.prototype)break;t=Object.getPrototypeOf(t.prototype).constructor}return null}const j={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function F(t){if(null==t||j[typeof t])return!0;if(Array.isArray(t)||"object"==typeof t){if(!Object.isFrozen(t))return!1;const e=Object.keys(t);for(let r=0;r<e.length;r++){let n=null;try{n=t[e[r]]}catch(t){continue}if(!F(n))return!1}return!0}return U.throwArgumentError("Cannot deepCopy "+typeof t,"object",t)}function z(t){if(F(t))return t;if(Array.isArray(t))return Object.freeze(t.map((t=>H(t))));if("object"==typeof t){const e={};for(const r in t){const n=t[r];void 0!==n&&L(e,r,H(n))}return e}return U.throwArgumentError("Cannot deepCopy "+typeof t,"object",t)}function H(t){return z(t)}class G{constructor(t){for(const e in t)this[e]=H(t[e])}}const q="abi/5.0.7",V=new p(q),K={};let Z={calldata:!0,memory:!0,storage:!0},W={calldata:!0,memory:!0};function J(t,e){if("bytes"===t||"string"===t){if(Z[e])return!0}else if("address"===t){if("payable"===e)return!0}else if((t.indexOf("[")>=0||"tuple"===t)&&W[e])return!0;return(Z[e]||"payable"===e)&&V.throwArgumentError("invalid modifier","name",e),!1}function $(t,e){for(let r in e)L(t,r,e[r])}const X=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),Y=new RegExp(/^(.*)\[([0-9]*)\]$/);class Q{constructor(t,e){t!==K&&V.throwError("use fromString",p.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),$(this,e);let r=this.type.match(Y);$(this,r?{arrayLength:parseInt(r[2]||"-1"),arrayChildren:Q.fromObject({type:r[1],components:this.components}),baseType:"array"}:{arrayLength:null,arrayChildren:null,baseType:null!=this.components?"tuple":this.type}),this._isParamType=!0,Object.freeze(this)}format(t){if(t||(t=X.sighash),X[t]||V.throwArgumentError("invalid format type","format",t),t===X.json){let e={type:"tuple"===this.baseType?"tuple":this.type,name:this.name||void 0};return"boolean"==typeof this.indexed&&(e.indexed=this.indexed),this.components&&(e.components=this.components.map((e=>JSON.parse(e.format(t))))),JSON.stringify(e)}let e="";return"array"===this.baseType?(e+=this.arrayChildren.format(t),e+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):"tuple"===this.baseType?(t!==X.sighash&&(e+=this.type),e+="("+this.components.map((e=>e.format(t))).join(t===X.full?", ":",")+")"):e+=this.type,t!==X.sighash&&(!0===this.indexed&&(e+=" indexed"),t===X.full&&this.name&&(e+=" "+this.name)),e}static from(t,e){return"string"==typeof t?Q.fromString(t,e):Q.fromObject(t)}static fromObject(t){return Q.isParamType(t)?t:new Q(K,{name:t.name||null,type:ut(t.type),indexed:null==t.indexed?null:!!t.indexed,components:t.components?t.components.map(Q.fromObject):null})}static fromString(t,e){return r=function(t,e){let r=t;function n(e){V.throwArgumentError(`unexpected character at position ${e}`,"param",t)}function i(t){let r={type:"",name:"",parent:t,state:{allowType:!0}};return e&&(r.indexed=!1),r}t=t.replace(/\s/g," ");let o={type:"",name:"",state:{allowType:!0}},s=o;for(let r=0;r<t.length;r++){let o=t[r];switch(o){case"(":s.state.allowType&&""===s.type?s.type="tuple":s.state.allowParams||n(r),s.state.allowType=!1,s.type=ut(s.type),s.components=[i(s)],s=s.components[0];break;case")":delete s.state,"indexed"===s.name&&(e||n(r),s.indexed=!0,s.name=""),J(s.type,s.name)&&(s.name=""),s.type=ut(s.type);let t=s;s=s.parent,s||n(r),delete t.parent,s.state.allowParams=!1,s.state.allowName=!0,s.state.allowArray=!0;break;case",":delete s.state,"indexed"===s.name&&(e||n(r),s.indexed=!0,s.name=""),J(s.type,s.name)&&(s.name=""),s.type=ut(s.type);let a=i(s.parent);s.parent.components.push(a),delete s.parent,s=a;break;case" ":s.state.allowType&&""!==s.type&&(s.type=ut(s.type),delete s.state.allowType,s.state.allowName=!0,s.state.allowParams=!0),s.state.allowName&&""!==s.name&&("indexed"===s.name?(e||n(r),s.indexed&&n(r),s.indexed=!0,s.name=""):J(s.type,s.name)?s.name="":s.state.allowName=!1);break;case"[":s.state.allowArray||n(r),s.type+=o,s.state.allowArray=!1,s.state.allowName=!1,s.state.readArray=!0;break;case"]":s.state.readArray||n(r),s.type+=o,s.state.readArray=!1,s.state.allowArray=!0,s.state.allowName=!0;break;default:s.state.allowType?(s.type+=o,s.state.allowParams=!0,s.state.allowArray=!0):s.state.allowName?(s.name+=o,delete s.state.allowArray):s.state.readArray?s.type+=o:n(r)}}return s.parent&&V.throwArgumentError("unexpected eof","param",t),delete o.state,"indexed"===s.name?(e||n(r.length-7),s.indexed&&n(r.length-7),s.indexed=!0,s.name=""):J(s.type,s.name)&&(s.name=""),o.type=ut(o.type),o}(t,!!e),Q.fromObject({name:r.name,type:r.type,indexed:r.indexed,components:r.components});var r}static isParamType(t){return!(null==t||!t._isParamType)}}function tt(t,e){return function(t){t=t.trim();let e=[],r="",n=0;for(let i=0;i<t.length;i++){let o=t[i];","===o&&0===n?(e.push(r),r=""):(r+=o,"("===o?n++:")"===o&&(n--,-1===n&&V.throwArgumentError("unbalanced parenthesis","value",t)))}r&&e.push(r);return e}(t).map((t=>Q.fromString(t,e)))}class et{constructor(t,e){t!==K&&V.throwError("use a static from method",p.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),$(this,e),this._isFragment=!0,Object.freeze(this)}static from(t){return et.isFragment(t)?t:"string"==typeof t?et.fromString(t):et.fromObject(t)}static fromObject(t){if(et.isFragment(t))return t;switch(t.type){case"function":return at.fromObject(t);case"event":return rt.fromObject(t);case"constructor":return st.fromObject(t);case"fallback":case"receive":return null}return V.throwArgumentError("invalid fragment object","value",t)}static fromString(t){return"event"===(t=(t=(t=t.replace(/\s/g," ")).replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," ")).trim()).split(" ")[0]?rt.fromString(t.substring(5).trim()):"function"===t.split(" ")[0]?at.fromString(t.substring(8).trim()):"constructor"===t.split("(")[0].trim()?st.fromString(t.trim()):V.throwArgumentError("unsupported fragment","value",t)}static isFragment(t){return!(!t||!t._isFragment)}}class rt extends et{format(t){if(t||(t=X.sighash),X[t]||V.throwArgumentError("invalid format type","format",t),t===X.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});let e="";return t!==X.sighash&&(e+="event "),e+=this.name+"("+this.inputs.map((e=>e.format(t))).join(t===X.full?", ":",")+") ",t!==X.sighash&&this.anonymous&&(e+="anonymous "),e.trim()}static from(t){return"string"==typeof t?rt.fromString(t):rt.fromObject(t)}static fromObject(t){if(rt.isEventFragment(t))return t;"event"!==t.type&&V.throwArgumentError("invalid event object","value",t);const e={name:lt(t.name),anonymous:t.anonymous,inputs:t.inputs?t.inputs.map(Q.fromObject):[],type:"event"};return new rt(K,e)}static fromString(t){let e=t.match(ft);e||V.throwArgumentError("invalid event string","value",t);let r=!1;return e[3].split(" ").forEach((t=>{switch(t.trim()){case"anonymous":r=!0;break;case"":break;default:V.warn("unknown modifier: "+t)}})),rt.fromObject({name:e[1].trim(),anonymous:r,inputs:tt(e[2],!0),type:"event"})}static isEventFragment(t){return t&&t._isFragment&&"event"===t.type}}function nt(t,e){e.gas=null;let r=t.split("@");return 1!==r.length?(r.length>2&&V.throwArgumentError("invalid human-readable ABI signature","value",t),r[1].match(/^[0-9]+$/)||V.throwArgumentError("invalid human-readable ABI signature gas","value",t),e.gas=I.from(r[1]),r[0]):t}function it(t,e){e.constant=!1,e.payable=!1,e.stateMutability="nonpayable",t.split(" ").forEach((t=>{switch(t.trim()){case"constant":e.constant=!0;break;case"payable":e.payable=!0,e.stateMutability="payable";break;case"nonpayable":e.payable=!1,e.stateMutability="nonpayable";break;case"pure":e.constant=!0,e.stateMutability="pure";break;case"view":e.constant=!0,e.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+t)}}))}function ot(t){let e={constant:!1,payable:!0,stateMutability:"payable"};return null!=t.stateMutability?(e.stateMutability=t.stateMutability,e.constant="view"===e.stateMutability||"pure"===e.stateMutability,null!=t.constant&&!!t.constant!==e.constant&&V.throwArgumentError("cannot have constant function with mutability "+e.stateMutability,"value",t),e.payable="payable"===e.stateMutability,null!=t.payable&&!!t.payable!==e.payable&&V.throwArgumentError("cannot have payable function with mutability "+e.stateMutability,"value",t)):null!=t.payable?(e.payable=!!t.payable,null!=t.constant||e.payable||"constructor"===t.type||V.throwArgumentError("unable to determine stateMutability","value",t),e.constant=!!t.constant,e.constant?e.stateMutability="view":e.stateMutability=e.payable?"payable":"nonpayable",e.payable&&e.constant&&V.throwArgumentError("cannot have constant payable function","value",t)):null!=t.constant?(e.constant=!!t.constant,e.payable=!e.constant,e.stateMutability=e.constant?"view":"payable"):"constructor"!==t.type&&V.throwArgumentError("unable to determine stateMutability","value",t),e}class st extends et{format(t){if(t||(t=X.sighash),X[t]||V.throwArgumentError("invalid format type","format",t),t===X.json)return JSON.stringify({type:"constructor",stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payble:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});t===X.sighash&&V.throwError("cannot format a constructor for sighash",p.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let e="constructor("+this.inputs.map((e=>e.format(t))).join(t===X.full?", ":",")+") ";return this.stateMutability&&"nonpayable"!==this.stateMutability&&(e+=this.stateMutability+" "),e.trim()}static from(t){return"string"==typeof t?st.fromString(t):st.fromObject(t)}static fromObject(t){if(st.isConstructorFragment(t))return t;"constructor"!==t.type&&V.throwArgumentError("invalid constructor object","value",t);let e=ot(t);e.constant&&V.throwArgumentError("constructor cannot be constant","value",t);const r={name:null,type:t.type,inputs:t.inputs?t.inputs.map(Q.fromObject):[],payable:e.payable,stateMutability:e.stateMutability,gas:t.gas?I.from(t.gas):null};return new st(K,r)}static fromString(t){let e={type:"constructor"},r=(t=nt(t,e)).match(ft);return r&&"constructor"===r[1].trim()||V.throwArgumentError("invalid constructor string","value",t),e.inputs=tt(r[2].trim(),!1),it(r[3].trim(),e),st.fromObject(e)}static isConstructorFragment(t){return t&&t._isFragment&&"constructor"===t.type}}class at extends st{format(t){if(t||(t=X.sighash),X[t]||V.throwArgumentError("invalid format type","format",t),t===X.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payble:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((e=>JSON.parse(e.format(t)))),ouputs:this.outputs.map((e=>JSON.parse(e.format(t))))});let e="";return t!==X.sighash&&(e+="function "),e+=this.name+"("+this.inputs.map((e=>e.format(t))).join(t===X.full?", ":",")+") ",t!==X.sighash&&(this.stateMutability?"nonpayable"!==this.stateMutability&&(e+=this.stateMutability+" "):this.constant&&(e+="view "),this.outputs&&this.outputs.length&&(e+="returns ("+this.outputs.map((e=>e.format(t))).join(", ")+") "),null!=this.gas&&(e+="@"+this.gas.toString()+" ")),e.trim()}static from(t){return"string"==typeof t?at.fromString(t):at.fromObject(t)}static fromObject(t){if(at.isFunctionFragment(t))return t;"function"!==t.type&&V.throwArgumentError("invalid function object","value",t);let e=ot(t);const r={type:t.type,name:lt(t.name),constant:e.constant,inputs:t.inputs?t.inputs.map(Q.fromObject):[],outputs:t.outputs?t.outputs.map(Q.fromObject):[],payable:e.payable,stateMutability:e.stateMutability,gas:t.gas?I.from(t.gas):null};return new at(K,r)}static fromString(t){let e={type:"function"},r=(t=nt(t,e)).split(" returns ");r.length>2&&V.throwArgumentError("invalid function string","value",t);let n=r[0].match(ft);if(n||V.throwArgumentError("invalid function signature","value",t),e.name=n[1].trim(),e.name&&lt(e.name),e.inputs=tt(n[2],!1),it(n[3].trim(),e),r.length>1){let n=r[1].match(ft);""==n[1].trim()&&""==n[3].trim()||V.throwArgumentError("unexpected tokens","value",t),e.outputs=tt(n[2],!1)}else e.outputs=[];return at.fromObject(e)}static isFunctionFragment(t){return t&&t._isFragment&&"function"===t.type}}function ut(t){return t.match(/^uint($|[^1-9])/)?t="uint256"+t.substring(4):t.match(/^int($|[^1-9])/)&&(t="int256"+t.substring(3)),t}const ht=new RegExp("^[A-Za-z_][A-Za-z0-9_]*$");function lt(t){return t&&t.match(ht)||V.throwArgumentError(`invalid identifier "${t}"`,"value",t),t}const ft=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");const ct=new p(q);function dt(t){const e=[],r=function(t,n){if(Array.isArray(n))for(let i in n){const o=t.slice();o.push(i);try{r(o,n[i])}catch(t){e.push({path:o,error:t})}}};return r([],t),e}class pt{constructor(t,e,r,n){this.name=t,this.type=e,this.localName=r,this.dynamic=n}_throwError(t,e){ct.throwArgumentError(t,this.localName,e)}}class mt{constructor(t){L(this,"wordSize",t||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(t)}get data(){return function(t){let e="0x";return t.forEach((t=>{e+=A(t).substring(2)})),e}(this._data)}get length(){return this._dataLength}_writeData(t){return this._data.push(t),this._dataLength+=t.length,t.length}appendWriter(t){return this._writeData(b(t._data))}writeBytes(t){let e=w(t);const r=e.length%this.wordSize;return r&&(e=b([e,this._padding.slice(r)])),this._writeData(e)}_getValue(t){let e=w(I.from(t));return e.length>this.wordSize&&ct.throwError("value out-of-bounds",p.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:e.length}),e.length%this.wordSize&&(e=b([this._padding.slice(e.length%this.wordSize),e])),e}writeValue(t){return this._writeData(this._getValue(t))}writeUpdatableValue(){const t=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,e=>{this._data[t]=this._getValue(e)}}}class gt{constructor(t,e,r,n){L(this,"_data",w(t)),L(this,"wordSize",e||32),L(this,"_coerceFunc",r),L(this,"allowLoose",n),this._offset=0}get data(){return A(this._data)}get consumed(){return this._offset}static coerce(t,e){let r=t.match("^u?int([0-9]+)$");return r&&parseInt(r[1])<=48&&(e=e.toNumber()),e}coerce(t,e){return this._coerceFunc?this._coerceFunc(t,e):gt.coerce(t,e)}_peekBytes(t,e,r){let n=Math.ceil(e/this.wordSize)*this.wordSize;return this._offset+n>this._data.length&&(this.allowLoose&&r&&this._offset+e<=this._data.length?n=e:ct.throwError("data out-of-bounds",p.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+n})),this._data.slice(this._offset,this._offset+n)}subReader(t){return new gt(this._data.slice(this._offset+t),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(t,e){let r=this._peekBytes(0,t,!!e);return this._offset+=r.length,r.slice(0,t)}readValue(){return I.from(this.readBytes(this.wordSize))}}var yt=r(7),vt=r.n(yt);function wt(t){return"0x"+vt.a.keccak_256(w(t))}new p("rlp/5.4.0");const bt=new p("address/5.4.0");function Mt(t){M(t,20)||bt.throwArgumentError("invalid address","address",t);const e=(t=t.toLowerCase()).substring(2).split(""),r=new Uint8Array(40);for(let t=0;t<40;t++)r[t]=e[t].charCodeAt(0);const n=w(wt(r));for(let t=0;t<40;t+=2)n[t>>1]>>4>=8&&(e[t]=e[t].toUpperCase()),(15&n[t>>1])>=8&&(e[t+1]=e[t+1].toUpperCase());return"0x"+e.join("")}const _t={};for(let t=0;t<10;t++)_t[String(t)]=String(t);for(let t=0;t<26;t++)_t[String.fromCharCode(65+t)]=String(10+t);const At=Math.floor((Et=9007199254740991,Math.log10?Math.log10(Et):Math.log(Et)/Math.LN10));var Et;function xt(t){let e=(t=(t=t.toUpperCase()).substring(4)+t.substring(0,2)+"00").split("").map((t=>_t[t])).join("");for(;e.length>=At;){let t=e.substring(0,At);e=parseInt(t,10)%97+e.substring(t.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}function St(t){let e=null;if("string"!=typeof t&&bt.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==t.substring(0,2)&&(t="0x"+t),e=Mt(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&bt.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)!==xt(t)&&bt.throwArgumentError("bad icap checksum","address",t),r=t.substring(4),e=new S(r,36).toString(16);e.length<40;)e="0"+e;e=Mt("0x"+e)}else bt.throwArgumentError("invalid address","address",t);var r;return e}class Nt extends pt{constructor(t){super("address","address",t,!1)}encode(t,e){try{St(e)}catch(t){this._throwError(t.message,e)}return t.writeValue(e)}decode(t){return St(x(t.readValue().toHexString(),20))}}class kt extends pt{constructor(t){super(t.name,t.type,void 0,t.dynamic),this.coder=t}encode(t,e){return this.coder.encode(t,e)}decode(t){return this.coder.decode(t)}}const Tt=new p(q);function Pt(t,e,r){let n=null;if(Array.isArray(r))n=r;else if(r&&"object"==typeof r){let t={};n=e.map((e=>{const n=e.localName;return n||Tt.throwError("cannot encode object for signature with missing names",p.errors.INVALID_ARGUMENT,{argument:"values",coder:e,value:r}),t[n]&&Tt.throwError("cannot encode object for signature with duplicate names",p.errors.INVALID_ARGUMENT,{argument:"values",coder:e,value:r}),t[n]=!0,r[n]}))}else Tt.throwArgumentError("invalid tuple value","tuple",r);e.length!==n.length&&Tt.throwArgumentError("types/value length mismatch","tuple",r);let i=new mt(t.wordSize),o=new mt(t.wordSize),s=[];e.forEach(((t,e)=>{let r=n[e];if(t.dynamic){let e=o.length;t.encode(o,r);let n=i.writeUpdatableValue();s.push((t=>{n(t+e)}))}else t.encode(i,r)})),s.forEach((t=>{t(i.length)}));let a=t.appendWriter(i);return a+=t.appendWriter(o),a}function It(t,e){let r=[],n=t.subReader(0);e.forEach((e=>{let i=null;if(e.dynamic){let r=t.readValue(),o=n.subReader(r.toNumber());try{i=e.decode(o)}catch(t){if(t.code===p.errors.BUFFER_OVERRUN)throw t;i=t,i.baseType=e.name,i.name=e.localName,i.type=e.type}}else try{i=e.decode(t)}catch(t){if(t.code===p.errors.BUFFER_OVERRUN)throw t;i=t,i.baseType=e.name,i.name=e.localName,i.type=e.type}null!=i&&r.push(i)}));const i=e.reduce(((t,e)=>{const r=e.localName;return r&&(t[r]||(t[r]=0),t[r]++),t}),{});e.forEach(((t,e)=>{let n=t.localName;if(!n||1!==i[n])return;if("length"===n&&(n="_length"),null!=r[n])return;const o=r[e];o instanceof Error?Object.defineProperty(r,n,{get:()=>{throw o}}):r[n]=o}));for(let t=0;t<r.length;t++){const e=r[t];e instanceof Error&&Object.defineProperty(r,t,{get:()=>{throw e}})}return Object.freeze(r)}class Rt extends pt{constructor(t,e,r){super("array",t.type+"["+(e>=0?e:"")+"]",r,-1===e||t.dynamic),this.coder=t,this.length=e}encode(t,e){Array.isArray(e)||this._throwError("expected array value",e);let r=this.length;-1===r&&(r=e.length,t.writeValue(e.length)),Tt.checkArgumentCount(e.length,r,"coder array"+(this.localName?" "+this.localName:""));let n=[];for(let t=0;t<e.length;t++)n.push(this.coder);return Pt(t,n,e)}decode(t){let e=this.length;-1===e&&(e=t.readValue().toNumber());let r=[];for(let t=0;t<e;t++)r.push(new kt(this.coder));return t.coerce(this.name,It(t,r))}}class Ot extends pt{constructor(t){super("bool","bool",t,!1)}encode(t,e){return t.writeValue(e?1:0)}decode(t){return t.coerce(this.type,!t.readValue().isZero())}}class Ct extends pt{constructor(t,e){super(t,t,e,!0)}encode(t,e){e=w(e);let r=t.writeValue(e.length);return r+=t.writeBytes(e),r}decode(t){return t.readBytes(t.readValue().toNumber(),!0)}}class Bt extends Ct{constructor(t){super("bytes",t)}decode(t){return t.coerce(this.name,A(super.decode(t)))}}class Ut extends pt{constructor(t,e){let r="bytes"+String(t);super(r,r,e,!1),this.size=t}encode(t,e){let r=w(e);return r.length!==this.size&&this._throwError("incorrect data length",e),t.writeBytes(r)}decode(t){return t.coerce(this.name,A(t.readBytes(this.size)))}}class Lt extends pt{constructor(t){super("null","",t,!1)}encode(t,e){return null!=e&&this._throwError("not null",e),t.writeBytes([])}decode(t){return t.readBytes(0),t.coerce(this.name,null)}}const Dt=I.from(-1),jt=I.from(0),Ft=I.from(1),zt=I.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");class Ht extends pt{constructor(t,e,r){const n=(e?"int":"uint")+8*t;super(n,n,r,!1),this.size=t,this.signed=e}encode(t,e){let r=I.from(e),n=zt.mask(8*t.wordSize);if(this.signed){let t=n.mask(8*this.size-1);(r.gt(t)||r.lt(t.add(Ft).mul(Dt)))&&this._throwError("value out-of-bounds",e)}else(r.lt(jt)||r.gt(n.mask(8*this.size)))&&this._throwError("value out-of-bounds",e);return r=r.toTwos(8*this.size).mask(8*this.size),this.signed&&(r=r.fromTwos(8*this.size).toTwos(8*t.wordSize)),t.writeValue(r)}decode(t){let e=t.readValue().mask(8*this.size);return this.signed&&(e=e.fromTwos(8*this.size)),t.coerce(this.name,e)}}const Gt=new p("strings/5.4.0");var qt,Vt;function Kt(t,e,r,n,i){if(t===Vt.BAD_PREFIX||t===Vt.UNEXPECTED_CONTINUE){let t=0;for(let n=e+1;n<r.length&&r[n]>>6==2;n++)t++;return t}return t===Vt.OVERRUN?r.length-e-1:0}!function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"}(qt||(qt={})),function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"}(Vt||(Vt={}));const Zt=Object.freeze({error:function(t,e,r,n,i){return Gt.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",r)},ignore:Kt,replace:function(t,e,r,n,i){return t===Vt.OVERLONG?(n.push(i),0):(n.push(65533),Kt(t,e,r))}});function Wt(t,e){null==e&&(e=Zt.error),t=w(t);const r=[];let n=0;for(;n<t.length;){const i=t[n++];if(i>>7==0){r.push(i);continue}let o=null,s=null;if(192==(224&i))o=1,s=127;else if(224==(240&i))o=2,s=2047;else{if(240!=(248&i)){n+=e(128==(192&i)?Vt.UNEXPECTED_CONTINUE:Vt.BAD_PREFIX,n-1,t,r);continue}o=3,s=65535}if(n-1+o>=t.length){n+=e(Vt.OVERRUN,n-1,t,r);continue}let a=i&(1<<8-o-1)-1;for(let i=0;i<o;i++){let i=t[n];if(128!=(192&i)){n+=e(Vt.MISSING_CONTINUE,n,t,r),a=null;break}a=a<<6|63&i,n++}null!==a&&(a>1114111?n+=e(Vt.OUT_OF_RANGE,n-1-o,t,r,a):a>=55296&&a<=57343?n+=e(Vt.UTF16_SURROGATE,n-1-o,t,r,a):a<=s?n+=e(Vt.OVERLONG,n-1-o,t,r,a):r.push(a))}return r}function Jt(t,e=qt.current){e!=qt.current&&(Gt.checkNormalize(),t=t.normalize(e));let r=[];for(let e=0;e<t.length;e++){const n=t.charCodeAt(e);if(n<128)r.push(n);else if(n<2048)r.push(n>>6|192),r.push(63&n|128);else if(55296==(64512&n)){e++;const i=t.charCodeAt(e);if(e>=t.length||56320!=(64512&i))throw new Error("invalid utf-8 string");const o=65536+((1023&n)<<10)+(1023&i);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(63&o|128)}else r.push(n>>12|224),r.push(n>>6&63|128),r.push(63&n|128)}return w(r)}function $t(t,e){return Wt(t,e).map((t=>t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10&1023),56320+(1023&t))))).join("")}class Xt extends Ct{constructor(t){super("string",t)}encode(t,e){return super.encode(t,Jt(e))}decode(t){return $t(super.decode(t))}}class Yt extends pt{constructor(t,e){let r=!1;const n=[];t.forEach((t=>{t.dynamic&&(r=!0),n.push(t.type)}));super("tuple","tuple("+n.join(",")+")",e,r),this.coders=t}encode(t,e){return Pt(t,this.coders,e)}decode(t){return t.coerce(this.name,It(t,this.coders))}}const Qt=new p(q),te=new RegExp(/^bytes([0-9]*)$/),ee=new RegExp(/^(u?int)([0-9]*)$/);class re{constructor(t){Qt.checkNew(new.target,re),L(this,"coerceFunc",t||null)}_getCoder(t){switch(t.baseType){case"address":return new Nt(t.name);case"bool":return new Ot(t.name);case"string":return new Xt(t.name);case"bytes":return new Bt(t.name);case"array":return new Rt(this._getCoder(t.arrayChildren),t.arrayLength,t.name);case"tuple":return new Yt((t.components||[]).map((t=>this._getCoder(t))),t.name);case"":return new Lt(t.name)}let e=t.type.match(ee);if(e){let r=parseInt(e[2]||"256");return(0===r||r>256||r%8!=0)&&Qt.throwArgumentError("invalid "+e[1]+" bit length","param",t),new Ht(r/8,"int"===e[1],t.name)}if(e=t.type.match(te),e){let r=parseInt(e[1]);return(0===r||r>32)&&Qt.throwArgumentError("invalid bytes length","param",t),new Ut(r,t.name)}return Qt.throwArgumentError("invalid type","type",t.type)}_getWordSize(){return 32}_getReader(t,e){return new gt(t,this._getWordSize(),this.coerceFunc,e)}_getWriter(){return new mt(this._getWordSize())}encode(t,e){t.length!==e.length&&Qt.throwError("types/values length mismatch",p.errors.INVALID_ARGUMENT,{count:{types:t.length,values:e.length},value:{types:t,values:e}});const r=t.map((t=>this._getCoder(Q.from(t)))),n=new Yt(r,"_"),i=this._getWriter();return n.encode(i,e),i.data}decode(t,e,r){const n=t.map((t=>this._getCoder(Q.from(t))));return new Yt(n,"_").decode(this._getReader(w(e),r))}}const ne=new re;function ie(t){return wt(Jt(t))}const oe=new p(q);class se extends G{}class ae extends G{}class ue extends G{static isIndexed(t){return!(!t||!t._isIndexed)}}function he(t,e){const r=new Error(`deferred error during ABI decoding triggered accessing ${t}`);return r.error=e,r}class le{constructor(t){oe.checkNew(new.target,le);let e=[];e="string"==typeof t?JSON.parse(t):t,L(this,"fragments",e.map((t=>et.from(t))).filter((t=>null!=t))),L(this,"_abiCoder",D(new.target,"getAbiCoder")()),L(this,"functions",{}),L(this,"errors",{}),L(this,"events",{}),L(this,"structs",{}),this.fragments.forEach((t=>{let e=null;switch(t.type){case"constructor":return this.deploy?void oe.warn("duplicate definition - constructor"):void L(this,"deploy",t);case"function":e=this.functions;break;case"event":e=this.events;break;default:return}let r=t.format();e[r]?oe.warn("duplicate definition - "+r):e[r]=t})),this.deploy||L(this,"deploy",st.from({payable:!1,type:"constructor"})),L(this,"_isInterface",!0)}format(t){t||(t=X.full),t===X.sighash&&oe.throwArgumentError("interface does not support formatting sighash","format",t);const e=this.fragments.map((e=>e.format(t)));return t===X.json?JSON.stringify(e.map((t=>JSON.parse(t)))):e}static getAbiCoder(){return ne}static getAddress(t){return St(t)}static getSighash(t){return E(ie(t.format()),0,4)}static getEventTopic(t){return ie(t.format())}getFunction(t){if(M(t)){for(const e in this.functions)if(t===this.getSighash(e))return this.functions[e];oe.throwArgumentError("no matching function","sighash",t)}if(-1===t.indexOf("(")){const e=t.trim(),r=Object.keys(this.functions).filter((t=>t.split("(")[0]===e));return 0===r.length?oe.throwArgumentError("no matching function","name",e):r.length>1&&oe.throwArgumentError("multiple matching functions","name",e),this.functions[r[0]]}const e=this.functions[at.fromString(t).format()];return e||oe.throwArgumentError("no matching function","signature",t),e}getEvent(t){if(M(t)){const e=t.toLowerCase();for(const t in this.events)if(e===this.getEventTopic(t))return this.events[t];oe.throwArgumentError("no matching event","topichash",e)}if(-1===t.indexOf("(")){const e=t.trim(),r=Object.keys(this.events).filter((t=>t.split("(")[0]===e));return 0===r.length?oe.throwArgumentError("no matching event","name",e):r.length>1&&oe.throwArgumentError("multiple matching events","name",e),this.events[r[0]]}const e=this.events[rt.fromString(t).format()];return e||oe.throwArgumentError("no matching event","signature",t),e}getSighash(t){return"string"==typeof t&&(t=this.getFunction(t)),D(this.constructor,"getSighash")(t)}getEventTopic(t){return"string"==typeof t&&(t=this.getEvent(t)),D(this.constructor,"getEventTopic")(t)}_decodeParams(t,e){return this._abiCoder.decode(t,e)}_encodeParams(t,e){return this._abiCoder.encode(t,e)}encodeDeploy(t){return this._encodeParams(this.deploy.inputs,t||[])}decodeFunctionData(t,e){"string"==typeof t&&(t=this.getFunction(t));const r=w(e);return A(r.slice(0,4))!==this.getSighash(t)&&oe.throwArgumentError(`data signature does not match function ${t.name}.`,"data",A(r)),this._decodeParams(t.inputs,r.slice(4))}encodeFunctionData(t,e){return"string"==typeof t&&(t=this.getFunction(t)),A(b([this.getSighash(t),this._encodeParams(t.inputs,e||[])]))}decodeFunctionResult(t,e){"string"==typeof t&&(t=this.getFunction(t));let r=w(e),n=null,i=null;switch(r.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(t.outputs,r)}catch(t){}break;case 4:"0x08c379a0"===A(r.slice(0,4))&&(i="Error(string)",n=this._abiCoder.decode(["string"],r.slice(4))[0])}return oe.throwError("call revert exception",p.errors.CALL_EXCEPTION,{method:t.format(),errorSignature:i,errorArgs:[n],reason:n})}encodeFunctionResult(t,e){return"string"==typeof t&&(t=this.getFunction(t)),A(this._abiCoder.encode(t.outputs,e||[]))}encodeFilterTopics(t,e){"string"==typeof t&&(t=this.getEvent(t)),e.length>t.inputs.length&&oe.throwError("too many arguments for "+t.format(),p.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:e});let r=[];t.anonymous||r.push(this.getEventTopic(t));const n=(t,e)=>"string"===t.type?ie(e):"bytes"===t.type?wt(A(e)):("address"===t.type&&this._abiCoder.encode(["address"],[e]),x(A(e),32));for(e.forEach(((e,i)=>{let o=t.inputs[i];o.indexed?null==e?r.push(null):"array"===o.baseType||"tuple"===o.baseType?oe.throwArgumentError("filtering with tuples or arrays not supported","contract."+o.name,e):Array.isArray(e)?r.push(e.map((t=>n(o,t)))):r.push(n(o,e)):null!=e&&oe.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+o.name,e)}));r.length&&null===r[r.length-1];)r.pop();return r}encodeEventLog(t,e){"string"==typeof t&&(t=this.getEvent(t));const r=[],n=[],i=[];return t.anonymous||r.push(this.getEventTopic(t)),e.length!==t.inputs.length&&oe.throwArgumentError("event arguments/values mismatch","values",e),t.inputs.forEach(((t,o)=>{const s=e[o];if(t.indexed)if("string"===t.type)r.push(ie(s));else if("bytes"===t.type)r.push(wt(s));else{if("tuple"===t.baseType||"array"===t.baseType)throw new Error("not implemented");r.push(this._abiCoder.encode([t.type],[s]))}else n.push(t),i.push(s)})),{data:this._abiCoder.encode(n,i),topics:r}}decodeEventLog(t,e,r){if("string"==typeof t&&(t=this.getEvent(t)),null!=r&&!t.anonymous){let e=this.getEventTopic(t);M(r[0],32)&&r[0].toLowerCase()===e||oe.throwError("fragment/topic mismatch",p.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:e,value:r[0]}),r=r.slice(1)}let n=[],i=[],o=[];t.inputs.forEach(((t,e)=>{t.indexed?"string"===t.type||"bytes"===t.type||"tuple"===t.baseType||"array"===t.baseType?(n.push(Q.fromObject({type:"bytes32",name:t.name})),o.push(!0)):(n.push(t),o.push(!1)):(i.push(t),o.push(!1))}));let s=null!=r?this._abiCoder.decode(n,b(r)):null,a=this._abiCoder.decode(i,e,!0),u=[],h=0,l=0;t.inputs.forEach(((t,e)=>{if(t.indexed)if(null==s)u[e]=new ue({_isIndexed:!0,hash:null});else if(o[e])u[e]=new ue({_isIndexed:!0,hash:s[l++]});else try{u[e]=s[l++]}catch(t){u[e]=t}else try{u[e]=a[h++]}catch(t){u[e]=t}if(t.name&&null==u[t.name]){const r=u[e];r instanceof Error?Object.defineProperty(u,t.name,{get:()=>{throw he(`property ${JSON.stringify(t.name)}`,r)}}):u[t.name]=r}}));for(let t=0;t<u.length;t++){const e=u[t];e instanceof Error&&Object.defineProperty(u,t,{get:()=>{throw he(`index ${t}`,e)}})}return Object.freeze(u)}parseTransaction(t){let e=this.getFunction(t.data.substring(0,10).toLowerCase());return e?new ae({args:this._abiCoder.decode(e.inputs,"0x"+t.data.substring(10)),functionFragment:e,name:e.name,signature:e.format(),sighash:this.getSighash(e),value:I.from(t.value||"0")}):null}parseLog(t){let e=this.getEvent(t.topics[0]);return!e||e.anonymous?null:new se({eventFragment:e,name:e.name,signature:e.format(),topic:this.getEventTopic(e),args:this.decodeEventLog(e,t.data,t.topics)})}static isInterface(t){return!(!t||!t._isInterface)}}},function(t,e,r){"use strict";const n=r(22),{getDefaultProvider:i,providers:{JsonRpcProvider:o,InfuraProvider:s},utils:{formatUnits:a,toUtf8String:u,parseBytes32String:h},Contract:l}=r(40),f=r(41),c=t=>((t=Array.isArray(t)?t:[t]).forEach((t=>{if("object"==typeof t){if(/^uint256/.test(t.type)){const e=t=>{const e=t.toString();return 10===e.length&&"15"===e.substring(0,2)?new Date(1e3*t):e.length>=27?t/1e27:e.length>=18?t/1e18:t/1e9};t.formatted=Array.isArray(t.value)?t.value.map(e):e(t.value)}else if(/^bytes/.test(t.type))try{t.formatted=Array.isArray(t.value)?t.value.map(h):h(t.value)}catch(t){}Object.values(t).filter((t=>"object"==typeof t)).forEach(c)}})),t),d=({network:t})=>`https://api${"mainnet"===t?"":`-${t}`}.etherscan.io/api`,p={},m=async({contract:t,network:e,etherscanKey:r})=>{try{const{data:{result:[{ContractName:i,ABI:o}]}}=await n.get(`${d({network:e})}?module=contract&action=getsourcecode&address=${t}&apikey=${r}`);return{abi:JSON.parse(o),contractName:i}}catch(t){return{error:t}}},g=async({contract:t,network:e,provider:r,blockNumber:n,etherscanKey:i})=>{p[t]||(p[t]=m({contract:t,network:e,etherscanKey:i}));const{abi:o,contractName:s,error:a}=await p[t];if(a)return{};f.addABI(o);const u=new l(t,o,r);if(u.target){let t=await u.target();try{t=await u.target({blockTag:Number(n)})}catch(t){403===t.statusCode&&console.log("Warning: No access to archive state to get older Proxy targets - you will need a providerURI to a full archive node")}p[t]||(p[t]=m({contract:t,network:e,etherscanKey:i}));const{abi:r,contractName:o}=await p[t];if(r)return f.addABI(r),{contractName:s,targetContractName:o}}return{contractName:s}};t.exports=async({hash:t,network:e="mainnet",etherscanKey:r="6XENF1GSDZYRISER6X4KGF3VDNNFPI47H4",infuraProjectID:h,providerURI:l})=>{const p="mainnet"===e?"homestead":e;let m;m=l?new o(l):h?new s(p,h):i(p);const y=await m.getTransaction(t);if(!y)throw Error("No transaction found.");const{to:v,data:w,value:b,nonce:M,gasPrice:_,gasLimit:A,blockNumber:E}=y,{from:x,gasUsed:S,status:N,logs:k,contractAddress:T}=await m.getTransactionReceipt(t)||{},{timestamp:P}=await m.getBlock(E);let I=!1,R=!1;try{const t=await m.getCode(v);I=t&&t.length>2}catch(t){R=!0}let O,C,B=w,U=k;for(const{address:t}of k)await g({contract:t,network:e,etherscanKey:r,provider:m,blockNumber:E});if(I){const{contractName:t,targetContractName:n}=await g({contract:v,network:e,etherscanKey:r,provider:m,blockNumber:E});O=t,C=n,B=c(f.decodeMethod(w))[0]||w,U=c(f.decodeLogs(k)).map(((t,e)=>t||k[e]))}let L="",D="";if(0===N){let i="";try{i=await m.call(y,Number(E))}catch(t){403===t.statusCode&&console.log("Warning: No access to archive state - you will need to provide an providerURI to get older revert reasons"),i=await m.call(y)}D=u(`0x${i.substr(138)}`);try{const{result:{errDescription:i}}=(await n.get(`${d({network:e})}?module=transaction&action=getstatus&txhash=${t}&apikey=${r}`)).data;L=i}catch(t){}}return{hash:t,blockNumber:E,timestamp:P,to:R?"(contract creation)":v,isContract:I,contract:R?T:O,underlyingContract:C,method:"0x"===B?void 0:B,decodedLogs:U,from:x,gasUsed:S,gasPrice:_,gasLimit:A,gasFormat:{price:Number(a(_,"gwei")),limit:A.toNumber(),used:S.toNumber()},status:R?1:N,errorMessage:L,revertReason:D,value:b,nonce:M}}},,function(t,e,r){t.exports=r(23)},function(t,e,r){"use strict";var n=r(0),i=r(8),o=r(24),s=r(14);function a(t){var e=new o(t),r=i(o.prototype.request,e);return n.extend(r,o.prototype,e),n.extend(r,e),r}var u=a(r(11));u.Axios=o,u.create=function(t){return a(s(u.defaults,t))},u.Cancel=r(15),u.CancelToken=r(37),u.isCancel=r(10),u.all=function(t){return Promise.all(t)},u.spread=r(38),u.isAxiosError=r(39),t.exports=u,t.exports.default=u},function(t,e,r){"use strict";var n=r(0),i=r(9),o=r(25),s=r(26),a=r(14);function u(t){this.defaults=t,this.interceptors={request:new o,response:new o}}u.prototype.request=function(t){"string"==typeof t?(t=arguments[1]||{}).url=arguments[0]:t=t||{},(t=a(this.defaults,t)).method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var e=[s,void 0],r=Promise.resolve(t);for(this.interceptors.request.forEach((function(t){e.unshift(t.fulfilled,t.rejected)})),this.interceptors.response.forEach((function(t){e.push(t.fulfilled,t.rejected)}));e.length;)r=r.then(e.shift(),e.shift());return r},u.prototype.getUri=function(t){return t=a(this.defaults,t),i(t.url,t.params,t.paramsSerializer).replace(/^\?/,"")},n.forEach(["delete","get","head","options"],(function(t){u.prototype[t]=function(e,r){return this.request(a(r||{},{method:t,url:e,data:(r||{}).data}))}})),n.forEach(["post","put","patch"],(function(t){u.prototype[t]=function(e,r,n){return this.request(a(n||{},{method:t,url:e,data:r}))}})),t.exports=u},function(t,e,r){"use strict";var n=r(0);function i(){this.handlers=[]}i.prototype.use=function(t,e){return this.handlers.push({fulfilled:t,rejected:e}),this.handlers.length-1},i.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)},i.prototype.forEach=function(t){n.forEach(this.handlers,(function(e){null!==e&&t(e)}))},t.exports=i},function(t,e,r){"use strict";var n=r(0),i=r(27),o=r(10),s=r(11);function a(t){t.cancelToken&&t.cancelToken.throwIfRequested()}t.exports=function(t){return a(t),t.headers=t.headers||{},t.data=i(t.data,t.headers,t.transformRequest),t.headers=n.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),n.forEach(["delete","get","head","post","put","patch","common"],(function(e){delete t.headers[e]})),(t.adapter||s.adapter)(t).then((function(e){return a(t),e.data=i(e.data,e.headers,t.transformResponse),e}),(function(e){return o(e)||(a(t),e&&e.response&&(e.response.data=i(e.response.data,e.response.headers,t.transformResponse))),Promise.reject(e)}))}},function(t,e,r){"use strict";var n=r(0);t.exports=function(t,e,r){return n.forEach(r,(function(r){t=r(t,e)})),t}},function(t,e,r){"use strict";var n=r(0);t.exports=function(t,e){n.forEach(t,(function(r,n){n!==e&&n.toUpperCase()===e.toUpperCase()&&(t[e]=r,delete t[n])}))}},function(t,e,r){"use strict";var n=r(13);t.exports=function(t,e,r){var i=r.config.validateStatus;r.status&&i&&!i(r.status)?e(n("Request failed with status code "+r.status,r.config,null,r.request,r)):t(r)}},function(t,e,r){"use strict";t.exports=function(t,e,r,n,i){return t.config=e,r&&(t.code=r),t.request=n,t.response=i,t.isAxiosError=!0,t.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},t}},function(t,e,r){"use strict";var n=r(0);t.exports=n.isStandardBrowserEnv()?{write:function(t,e,r,i,o,s){var a=[];a.push(t+"="+encodeURIComponent(e)),n.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),n.isString(i)&&a.push("path="+i),n.isString(o)&&a.push("domain="+o),!0===s&&a.push("secure"),document.cookie=a.join("; ")},read:function(t){var e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},function(t,e,r){"use strict";var n=r(33),i=r(34);t.exports=function(t,e){return t&&!n(e)?i(t,e):e}},function(t,e,r){"use strict";t.exports=function(t){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(t)}},function(t,e,r){"use strict";t.exports=function(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}},function(t,e,r){"use strict";var n=r(0),i=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];t.exports=function(t){var e,r,o,s={};return t?(n.forEach(t.split("\n"),(function(t){if(o=t.indexOf(":"),e=n.trim(t.substr(0,o)).toLowerCase(),r=n.trim(t.substr(o+1)),e){if(s[e]&&i.indexOf(e)>=0)return;s[e]="set-cookie"===e?(s[e]?s[e]:[]).concat([r]):s[e]?s[e]+", "+r:r}})),s):s}},function(t,e,r){"use strict";var n=r(0);t.exports=n.isStandardBrowserEnv()?function(){var t,e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function i(t){var n=t;return e&&(r.setAttribute("href",n),n=r.href),r.setAttribute("href",n),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return t=i(window.location.href),function(e){var r=n.isString(e)?i(e):e;return r.protocol===t.protocol&&r.host===t.host}}():function(){return!0}},function(t,e,r){"use strict";var n=r(15);function i(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");var e;this.promise=new Promise((function(t){e=t}));var r=this;t((function(t){r.reason||(r.reason=new n(t),e(r.reason))}))}i.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},i.source=function(){var t;return{token:new i((function(e){t=e})),cancel:t}},t.exports=i},function(t,e,r){"use strict";t.exports=function(t){return function(e){return t.apply(null,e)}}},function(t,e,r){"use strict";t.exports=function(t){return"object"==typeof t&&!0===t.isAxiosError}},function(t,e,r){(function(e){var r;t.exports=function t(e,n,i){function o(a,u){if(!n[a]){if(!e[a]){var h=!1;if(!u&&h)return r(a,!0);if(s)return s(a,!0);throw(h=new Error("Cannot find module '"+a+"'")).code="MODULE_NOT_FOUND",h}h=n[a]={exports:{}},e[a][0].call(h.exports,(function(t){return o(e[a][1][t]||t)}),h,h.exports,t,e,n,i)}return n[a].exports}for(var s=!1,a=0;a<i.length;a++)o(i[a]);return o}({1:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.version="4.0.49"},{}],2:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./utils/properties");function i(){n.setType(this,"Signer")}i.isSigner=function(t){return n.isType(t,"Signer")},t=i,r.Signer=t},{"./utils/properties":74}],3:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./utils/bignumber");r.AddressZero="0x0000000000000000000000000000000000000000",r.HashZero="0x0000000000000000000000000000000000000000000000000000000000000000",r.EtherSymbol="Ξ",t=n.bigNumberify(-1),r.NegativeOne=t,t=n.bigNumberify(0),r.Zero=t,t=n.bigNumberify(1),r.One=t,t=n.bigNumberify(2),r.Two=t,t=n.bigNumberify("1000000000000000000"),r.WeiPerEther=t,n=n.bigNumberify("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),r.MaxUint256=n},{"./utils/bignumber":63}],4:[function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var s,a=t("./constants"),u=o(t("./errors")),h=t("./utils/abi-coder"),l=t("./utils/address"),f=t("./utils/bignumber"),c=t("./utils/bytes"),d=t("./utils/interface"),p=t("./utils/properties"),m=t("./providers/abstract-provider"),g=t("./abstract-signer"),y=(i(v,s=g.Signer),v.prototype.getAddress=function(){return Promise.resolve(this.address)},v.prototype._fail=function(t,e){return Promise.resolve().then((function(){u.throwError(t,u.UNSUPPORTED_OPERATION,{operation:e})}))},v.prototype.signMessage=function(t){return this._fail("VoidSigner cannot sign messages","signMessage")},v.prototype.sendTransaction=function(t){return this._fail("VoidSigner cannot sign transactions","sendTransaction")},v.prototype.connect=function(t){return new v(this.address,t)},v);function v(t,e){var r=s.call(this)||this;return p.defineReadOnly(r,"address",t),p.defineReadOnly(r,"provider",e),r}r.VoidSigner=y;var w={chainId:!0,data:!0,from:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0};function b(t,e,r){var n=t.interface.functions[e];return function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];var o={},s=null;if(e.length===n.inputs.length+1&&"object"==typeof e[e.length-1])for(var l in null!=(o=p.shallowCopy(e.pop())).blockTag&&(s=o.blockTag),delete o.blockTag,o)if(!w[l])throw new Error("unknown transaction override "+l);if(e.length!=n.inputs.length)throw new Error("incorrect number of arguments");return["data","to"].forEach((function(t){null!=o[t]&&u.throwError("cannot override "+t,u.UNSUPPORTED_OPERATION,{operation:t})})),o.to=t._deployed(s).then((function(){return t.addressPromise})),function t(e,r,n){if(Array.isArray(n)){var i=[];return n.forEach((function(n,o){var s=null;s=Array.isArray(r)?r[o]:r[n.name],i.push(t(e,s,n))})),Promise.all(i)}if("address"===n.type)return e.resolveName(r);if("tuple"===n.type)return t(e,r,n.components);var o=n.type.match(/(.*)(\[[0-9]*\]$)/);if(o){if(!Array.isArray(r))throw new Error("invalid value for array");var s=[],a={components:n.components,type:o[1]};return r.forEach((function(r){s.push(t(e,r,a))})),Promise.all(s)}return Promise.resolve(r)}(t.provider,e,n.inputs).then((function(e){if(o.data=n.encode(e),"call"===n.type)return r?Promise.resolve(a.Zero):(t.provider||u.throwError("call (constant functions) require a provider or a signer with a provider",u.UNSUPPORTED_OPERATION,{operation:"call"}),["gasLimit","gasPrice","value"].forEach((function(t){if(null!=o[t])throw new Error("call cannot override "+t)})),null==o.from&&t.signer&&(o.from=t.signer.getAddress()),t.provider.call(o,s).then((function(r){var i;c.hexDataLength(r)%32==4&&"0x08c379a0"===c.hexDataSlice(r,0,4)&&(i=h.defaultAbiCoder.decode(["string"],c.hexDataSlice(r,4)),u.throwError("call revert exception",u.CALL_EXCEPTION,{address:t.address,args:e,method:n.signature,errorSignature:"Error(string)",errorArgs:[i],reason:i,transaction:o}));try{var s=n.decode(r);return 1===n.outputs.length?s[0]:s}catch(i){throw"0x"===r&&0<n.outputs.length&&u.throwError("call exception",u.CALL_EXCEPTION,{address:t.address,method:n.signature,args:e}),i}})));if("transaction"===n.type)return r?(t.provider||u.throwError("estimate gas require a provider or a signer with a provider",u.UNSUPPORTED_OPERATION,{operation:"estimateGas"}),null==o.from&&t.signer&&(o.from=t.signer.getAddress()),t.provider.estimateGas(o)):(null==o.gasLimit&&null!=n.gas&&(o.gasLimit=f.bigNumberify(n.gas).add(21e3)),t.signer||u.throwError("sending a transaction requires a signer",u.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),null!=o.from&&u.throwError("cannot override from in a transaction",u.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),t.signer.sendTransaction(o).then((function(e){var r=e.wait.bind(e);return e.wait=function(e){return r(e).then((function(e){return e.events=e.logs.map((function(r){var n=p.deepCopy(r);return(r=t.interface.parseLog(r))&&(n.args=r.values,n.decode=r.decode,n.event=r.name,n.eventSignature=r.signature),n.removeListener=function(){return t.provider},n.getBlock=function(){return t.provider.getBlock(e.blockHash)},n.getTransaction=function(){return t.provider.getTransaction(e.transactionHash)},n.getTransactionReceipt=function(){return Promise.resolve(e)},n})),e}))},e})));throw new Error("invalid type - "+n.type)}))}}function M(t){return!t.address||null!=t.topics&&0!==t.topics.length?(t.address||"*")+"@"+(t.topics?t.topics.join(":"):""):"*"}var _=(A.prototype.deployed=function(){return this._deployed()},A.prototype._deployed=function(t){var e=this;return this._deployedPromise||(this.deployTransaction?this._deployedPromise=this.deployTransaction.wait().then((function(){return e})):this._deployedPromise=this.provider.getCode(this.address,t).then((function(t){return"0x"===t&&u.throwError("contract not deployed",u.UNSUPPORTED_OPERATION,{contractAddress:e.address,operation:"getDeployed"}),e}))),this._deployedPromise},A.prototype.fallback=function(t){var e=this;this.signer||u.throwError("sending a transaction requires a signer",u.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});var r=p.shallowCopy(t||{});return["from","to"].forEach((function(t){null!=r[t]&&u.throwError("cannot override "+t,u.UNSUPPORTED_OPERATION,{operation:t})})),r.to=this.addressPromise,this.deployed().then((function(){return e.signer.sendTransaction(r)}))},A.prototype.connect=function(t){return"string"==typeof t&&(t=new y(t,this.provider)),t=new A(this.address,this.interface,t),this.deployTransaction&&p.defineReadOnly(t,"deployTransaction",this.deployTransaction),t},A.prototype.attach=function(t){return new A(t,this.interface,this.signer||this.provider)},A.isIndexed=function(t){return d.Interface.isIndexed(t)},A.prototype._getEventFilter=function(t){var e=this;if("string"==typeof t){if("*"===t)return{prepareEvent:function(t){var r=e.interface.parseLog(t);return r&&(t.args=r.values,t.decode=r.decode,t.event=r.name,t.eventSignature=r.signature),[t]},eventTag:"*",filter:{address:this.address}};-1!==t.indexOf("(")&&(t=h.formatSignature(h.parseSignature("event "+t)));var r=this.interface.events[t];r||u.throwError("unknown event - "+t,u.INVALID_ARGUMENT,{argumnet:"eventName",value:t});var n={address:this.address,topics:[r.topic]};return{prepareEvent:function(t){var e=r.decode(t.data,t.topics);return t.args=e,(e=Array.prototype.slice.call(e)).push(t),e},event:r,eventTag:M(n),filter:n}}n={address:this.address};var i=null;if(t.topics&&t.topics[0])for(var o in n.topics=t.topics,this.interface.events)if(-1!==o.indexOf("(")&&(o=this.interface.events[o]).topic===t.topics[0].toLowerCase()){i=o;break}return{prepareEvent:function(t){if(!i)return[t];var e=i.decode(t.data,t.topics);return t.args=e,(e=Array.prototype.slice.call(e)).push(t),e},event:i,eventTag:M(n),filter:n}},A.prototype._addEventListener=function(t,e,r){var n=this;function i(r){var i=p.deepCopy(r),o=t.prepareEvent(i);t.event&&(i.decode=t.event.decode,i.event=t.event.name,i.eventSignature=t.event.signature),i.removeListener=function(){n.removeListener(t.filter,e)},i.getBlock=function(){return n.provider.getBlock(r.blockHash)},i.getTransaction=function(){return n.provider.getTransaction(r.transactionHash)},i.getTransactionReceipt=function(){return n.provider.getTransactionReceipt(r.transactionHash)},n.emit.apply(n,[t.filter].concat(o))}this.provider||u.throwError("events require a provider or a signer with a provider",u.UNSUPPORTED_OPERATION,{operation:"once"}),this.provider.on(t.filter,i),this._events.push({eventFilter:t,listener:e,wrappedListener:i,once:r})},A.prototype.on=function(t,e){return this._addEventListener(this._getEventFilter(t),e,!1),this},A.prototype.once=function(t,e){return this._addEventListener(this._getEventFilter(t),e,!0),this},A.prototype.addListener=function(t,e){return this.on(t,e)},A.prototype.emit=function(t){for(var e=this,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];if(!this.provider)return!1;var i=!1,o=this._getEventFilter(t);return this._events=this._events.filter((function(t){return t.eventFilter.eventTag!==o.eventTag||(setTimeout((function(){t.listener.apply(e,r)}),0),i=!0,!t.once)})),i},A.prototype.listenerCount=function(t){if(!this.provider)return 0;var e=this._getEventFilter(t);return this._events.filter((function(t){return t.eventFilter.eventTag===e.eventTag})).length},A.prototype.listeners=function(t){if(!this.provider)return[];var e=this._getEventFilter(t);return this._events.filter((function(t){return t.eventFilter.eventTag===e.eventTag})).map((function(t){return t.listener}))},A.prototype.removeAllListeners=function(t){var e=this;if(!this.provider)return this;var r=this._getEventFilter(t);return this._events=this._events.filter((function(t){return t.eventFilter.eventTag!==r.eventTag||(e.provider.removeListener(t.eventFilter.filter,t.wrappedListener),!1)})),this},A.prototype.removeListener=function(t,e){var r=this;if(!this.provider)return this;var n=!1,i=this._getEventFilter(t);return this._events=this._events.filter((function(t){return t.eventFilter.eventTag!==i.eventTag||t.listener!==e||(r.provider.removeListener(t.eventFilter.filter,t.wrappedListener),!!n||!(n=!0))})),this},A);function A(t,e,r){var n=this;if(u.checkNew(this,A),d.Interface.isInterface(e)?p.defineReadOnly(this,"interface",e):p.defineReadOnly(this,"interface",new d.Interface(e)),g.Signer.isSigner(r)?(p.defineReadOnly(this,"provider",r.provider),p.defineReadOnly(this,"signer",r)):m.Provider.isProvider(r)?(p.defineReadOnly(this,"provider",r),p.defineReadOnly(this,"signer",null)):u.throwError("invalid signer or provider",u.INVALID_ARGUMENT,{arg:"signerOrProvider",value:r}),p.defineReadOnly(this,"estimate",{}),p.defineReadOnly(this,"functions",{}),p.defineReadOnly(this,"filters",{}),Object.keys(this.interface.events).forEach((function(t){var e=n.interface.events[t];p.defineReadOnly(n.filters,t,(function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return{address:n.address,topics:e.encodeTopics(t)}}))})),this._events=[],p.defineReadOnly(this,"address",t),this.provider)p.defineReadOnly(this,"addressPromise",this.provider.resolveName(t).then((function(t){if(null==t)throw new Error("name not found");return t})).catch((function(t){throw t})));else try{p.defineReadOnly(this,"addressPromise",Promise.resolve(l.getAddress(t)))}catch(e){u.throwError("provider is required to use non-address contract address",u.INVALID_ARGUMENT,{argument:"addressOrName",value:t})}Object.keys(this.interface.functions).forEach((function(t){var e=b(n,t,!1);null==n[t]?p.defineReadOnly(n,t,e):u.warn("WARNING: Multiple definitions for "+t),null==n.functions[t]&&(p.defineReadOnly(n.functions,t,e),p.defineReadOnly(n.estimate,t,b(n,t,!0)))}))}function E(t,e,r){var n=null;"string"==typeof e?n=e:c.isArrayish(e)?n=c.hexlify(e):"string"==typeof e.object?n=e.object:u.throwError("bytecode must be a valid hex string",u.INVALID_ARGUMENT,{arg:"bytecode",value:e}),"0x"!==n.substring(0,2)&&(n="0x"+n),c.isHexString(n)||u.throwError("bytecode must be a valid hex string",u.INVALID_ARGUMENT,{arg:"bytecode",value:e}),n.length%2!=0&&u.throwError("bytecode must be valid data (even length)",u.INVALID_ARGUMENT,{arg:"bytecode",value:e}),p.defineReadOnly(this,"bytecode",n),d.Interface.isInterface(t)?p.defineReadOnly(this,"interface",t):p.defineReadOnly(this,"interface",new d.Interface(t)),r&&!g.Signer.isSigner(r)&&u.throwError("invalid signer",u.INVALID_ARGUMENT,{arg:"signer",value:null}),p.defineReadOnly(this,"signer",r||null)}r.Contract=_,E.prototype.getDeployTransaction=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r={};if(t.length===this.interface.deployFunction.inputs.length+1)for(var n in r=p.shallowCopy(t.pop()))if(!w[n])throw new Error("unknown transaction override "+n);return["data","from","to"].forEach((function(t){null!=r[t]&&u.throwError("cannot override "+t,u.UNSUPPORTED_OPERATION,{operation:t})})),u.checkArgumentCount(t.length,this.interface.deployFunction.inputs.length," in Contract constructor"),r.data=this.interface.deployFunction.encode(this.bytecode,t),r},E.prototype.deploy=function(){for(var t=this,e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var n=this.getDeployTransaction.apply(this,e);return this.signer.sendTransaction(n).then((function(e){var r=new _(l.getContractAddress(e),t.interface,t.signer);return p.defineReadOnly(r,"deployTransaction",e),r}))},E.prototype.attach=function(t){return new _(t,this.interface,this.signer)},E.prototype.connect=function(t){return new E(this.interface,this.bytecode,t)},E.fromSolidity=function(t,e){null==t&&u.throwError("missing compiler output",u.MISSING_ARGUMENT,{argument:"compilerOutput"});var r=(t="string"==typeof t?JSON.parse(t):t).abi,n=null;return t.bytecode?n=t.bytecode:t.evm&&t.evm.bytecode&&(n=t.evm.bytecode),new E(r,n,e)},i=E,r.ContractFactory=i},{"./abstract-signer":2,"./constants":3,"./errors":5,"./providers/abstract-provider":50,"./utils/abi-coder":59,"./utils/address":60,"./utils/bignumber":63,"./utils/bytes":64,"./utils/interface":69,"./utils/properties":74}],5:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./_version");r.UNKNOWN_ERROR="UNKNOWN_ERROR",r.NOT_IMPLEMENTED="NOT_IMPLEMENTED",r.MISSING_NEW="MISSING_NEW",r.CALL_EXCEPTION="CALL_EXCEPTION",r.INVALID_ARGUMENT="INVALID_ARGUMENT",r.MISSING_ARGUMENT="MISSING_ARGUMENT",r.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",r.NUMERIC_FAULT="NUMERIC_FAULT",r.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",r.NONCE_EXPIRED="NONCE_EXPIRED",r.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED";var i=!(r.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION"),o=!1;function s(t,e,i){if(o)throw new Error("unknown error");e=e||r.UNKNOWN_ERROR,i=i||{};var s=[];Object.keys(i).forEach((function(t){try{s.push(t+"="+JSON.stringify(i[t]))}catch(e){s.push(t+"="+JSON.stringify(i[t].toString()))}})),s.push("version="+n.version);var a=t;s.length&&(t+=" ("+s.join(", ")+")");var u=new Error(t);throw u.reason=a,u.code=e,Object.keys(i).forEach((function(t){u[t]=i[t]})),u}r.throwError=s,r.checkNew=function(t,e){t instanceof e||s("missing new",r.MISSING_NEW,{name:e.name})},r.checkArgumentCount=function(t,e,n){n=n||"",t<e&&s("missing argument"+n,r.MISSING_ARGUMENT,{count:t,expectedCount:e}),e<t&&s("too many arguments"+n,r.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})},r.setCensorship=function(t,e){i&&s("error censorship permanent",r.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),o=!!t,i=!!e},r.checkNormalize=function(){try{if(["NFD","NFC","NFKD","NFKC"].forEach((function(t){try{"test".normalize(t)}catch(e){throw new Error("missing "+t)}})),String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){s("platform missing String.prototype.normalize",r.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:t.message})}};var a={debug:1,default:2,info:2,warn:3,error:4,off:5},u=a.default;function h(t,e){u>a[t]||console.log.apply(console,e)}function l(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];h("warn",t)}r.setLogLevel=function(t){var e=a[t];null!=e?u=e:l("invliad log level - "+t)},r.warn=l,r.info=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];h("info",t)}},{"./_version":1}],6:[function(t,e,r){"use strict";var n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var i=t("./contract");r.Contract=i.Contract,r.ContractFactory=i.ContractFactory,r.VoidSigner=i.VoidSigner,i=t("./abstract-signer"),r.Signer=i.Signer,i=t("./wallet"),r.Wallet=i.Wallet,i=n(t("./constants")),r.constants=i;var o=n(t("./errors"));r.errors=o;var s=n(t("./providers"));r.providers=s;var a=n(t("./utils"));r.utils=a,n=n(t("./wordlists")),r.wordlists=n,n=t("./utils/shims"),r.platform=n.platform,t=t("./_version"),r.version=t.version,r.getDefaultProvider=function(t){var e=a.getNetwork(t=null==t?"homestead":t);return e&&e._defaultProvider||o.throwError("unsupported getDefaultProvider network",o.UNSUPPORTED_OPERATION,{operation:"getDefaultProvider",network:t}),e._defaultProvider(s)}},{"./_version":1,"./abstract-signer":2,"./constants":3,"./contract":4,"./errors":5,"./providers":54,"./utils":68,"./utils/shims":80,"./wallet":88,"./wordlists":89}],7:[function(t,e,r){"use strict";var n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0}),n=n(t("./ethers")),r.ethers=n,function(t){for(var e in t)r.hasOwnProperty(e)||(r[e]=t[e])}(t("./ethers"))},{"./ethers":6}],8:[function(t,e,r){"use strict";!function(t){function n(t){return parseInt(t)===t}function i(t){if(n(t.length)){for(var e=0;e<t.length;e++)if(!n(t[e])||t[e]<0||255<t[e])return;return 1}}function o(t,e){if(t.buffer&&ArrayBuffer.isView(t)&&"Uint8Array"===t.name)return e?t.slice?t.slice():Array.prototype.slice.call(t):t;if(Array.isArray(t)){if(!i(t))throw new Error("Array contains invalid value: "+t);return new Uint8Array(t)}if(n(t.length)&&i(t))return new Uint8Array(t);throw new Error("unsupported array-like object")}function s(t){return new Uint8Array(t)}function a(t,e,r,n,i){null==n&&null==i||(t=t.slice?t.slice(n,i):Array.prototype.slice.call(t,n,i)),e.set(t,r)}var u,h={toBytes:function(t){var e=[],r=0;for(t=encodeURI(t);r<t.length;){var n=t.charCodeAt(r++);37===n?(e.push(parseInt(t.substr(r,2),16)),r+=2):e.push(n)}return o(e)},fromBytes:function(t){for(var e=[],r=0;r<t.length;){var n=t[r];n<128?(e.push(String.fromCharCode(n)),r++):191<n&&n<224?(e.push(String.fromCharCode((31&n)<<6|63&t[r+1])),r+=2):(e.push(String.fromCharCode((15&n)<<12|(63&t[r+1])<<6|63&t[r+2])),r+=3)}return e.join("")}},l=(u="0123456789abcdef",{toBytes:function(t){for(var e=[],r=0;r<t.length;r+=2)e.push(parseInt(t.substr(r,2),16));return e},fromBytes:function(t){for(var e=[],r=0;r<t.length;r++){var n=t[r];e.push(u[(240&n)>>4]+u[15&n])}return e.join("")}}),f={16:10,24:12,32:14},c=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],d=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],p=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],m=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],g=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],y=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],v=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],w=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],b=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],M=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],_=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],A=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],E=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],x=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],S=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function N(t){for(var e=[],r=0;r<t.length;r+=4)e.push(t[r]<<24|t[r+1]<<16|t[r+2]<<8|t[r+3]);return e}var k=function(t){if(!(this instanceof k))throw Error("AES must be instanitated with `new`");Object.defineProperty(this,"key",{value:o(t,!0)}),this._prepare()};k.prototype._prepare=function(){var t=f[this.key.length];if(null==t)throw new Error("invalid key size (must be 16, 24 or 32 bytes)");this._Ke=[],this._Kd=[];for(var e=0;e<=t;e++)this._Ke.push([0,0,0,0]),this._Kd.push([0,0,0,0]);var r,n=4*(t+1),i=this.key.length/4,o=N(this.key);for(e=0;e<i;e++)this._Ke[r=e>>2][e%4]=o[e],this._Kd[t-r][e%4]=o[e];for(var s,a=0,u=i;u<n;){if(s=o[i-1],o[0]^=d[s>>16&255]<<24^d[s>>8&255]<<16^d[255&s]<<8^d[s>>24&255]^c[a]<<24,a+=1,8!=i)for(e=1;e<i;e++)o[e]^=o[e-1];else{for(e=1;e<i/2;e++)o[e]^=o[e-1];for(s=o[i/2-1],o[i/2]^=d[255&s]^d[s>>8&255]<<8^d[s>>16&255]<<16^d[s>>24&255]<<24,e=i/2+1;e<i;e++)o[e]^=o[e-1]}for(e=0;e<i&&u<n;)this._Ke[h=u>>2][l=u%4]=o[e],this._Kd[t-h][l]=o[e++],u++}for(var h=1;h<t;h++)for(var l=0;l<4;l++)s=this._Kd[h][l],this._Kd[h][l]=A[s>>24&255]^E[s>>16&255]^x[s>>8&255]^S[255&s]},k.prototype.encrypt=function(t){if(16!=t.length)throw new Error("invalid plaintext size (must be 16 bytes)");for(var e=this._Ke.length-1,r=[0,0,0,0],n=N(t),i=0;i<4;i++)n[i]^=this._Ke[0][i];for(var o=1;o<e;o++){for(i=0;i<4;i++)r[i]=m[n[i]>>24&255]^g[n[(i+1)%4]>>16&255]^y[n[(i+2)%4]>>8&255]^v[255&n[(i+3)%4]]^this._Ke[o][i];n=r.slice()}var a,u=s(16);for(i=0;i<4;i++)a=this._Ke[e][i],u[4*i]=255&(d[n[i]>>24&255]^a>>24),u[4*i+1]=255&(d[n[(i+1)%4]>>16&255]^a>>16),u[4*i+2]=255&(d[n[(i+2)%4]>>8&255]^a>>8),u[4*i+3]=255&(d[255&n[(i+3)%4]]^a);return u},k.prototype.decrypt=function(t){if(16!=t.length)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var e=this._Kd.length-1,r=[0,0,0,0],n=N(t),i=0;i<4;i++)n[i]^=this._Kd[0][i];for(var o=1;o<e;o++){for(i=0;i<4;i++)r[i]=w[n[i]>>24&255]^b[n[(i+3)%4]>>16&255]^M[n[(i+2)%4]>>8&255]^_[255&n[(i+1)%4]]^this._Kd[o][i];n=r.slice()}var a,u=s(16);for(i=0;i<4;i++)a=this._Kd[e][i],u[4*i]=255&(p[n[i]>>24&255]^a>>24),u[4*i+1]=255&(p[n[(i+3)%4]>>16&255]^a>>16),u[4*i+2]=255&(p[n[(i+2)%4]>>8&255]^a>>8),u[4*i+3]=255&(p[255&n[(i+1)%4]]^a);return u};var T=function(t){if(!(this instanceof T))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new k(t)};T.prototype.encrypt=function(t){if((t=o(t)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var e=s(t.length),r=s(16),n=0;n<t.length;n+=16)a(t,r,0,n,n+16),a(r=this._aes.encrypt(r),e,n);return e},T.prototype.decrypt=function(t){if((t=o(t)).length%16!=0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var e=s(t.length),r=s(16),n=0;n<t.length;n+=16)a(t,r,0,n,n+16),a(r=this._aes.decrypt(r),e,n);return e};var P=function(t,e){if(!(this instanceof P))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Block Chaining",this.name="cbc",e){if(16!=e.length)throw new Error("invalid initialation vector size (must be 16 bytes)")}else e=s(16);this._lastCipherblock=o(e,!0),this._aes=new k(t)};P.prototype.encrypt=function(t){if((t=o(t)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var e=s(t.length),r=s(16),n=0;n<t.length;n+=16){a(t,r,0,n,n+16);for(var i=0;i<16;i++)r[i]^=this._lastCipherblock[i];this._lastCipherblock=this._aes.encrypt(r),a(this._lastCipherblock,e,n)}return e},P.prototype.decrypt=function(t){if((t=o(t)).length%16!=0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var e=s(t.length),r=s(16),n=0;n<t.length;n+=16){a(t,r,0,n,n+16),r=this._aes.decrypt(r);for(var i=0;i<16;i++)e[n+i]=r[i]^this._lastCipherblock[i];a(t,this._lastCipherblock,0,n,n+16)}return e};var I=function(t,e,r){if(!(this instanceof I))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Feedback",this.name="cfb",e){if(16!=e.length)throw new Error("invalid initialation vector size (must be 16 size)")}else e=s(16);this.segmentSize=r=r||1,this._shiftRegister=o(e,!0),this._aes=new k(t)};I.prototype.encrypt=function(t){if(t.length%this.segmentSize!=0)throw new Error("invalid plaintext size (must be segmentSize bytes)");for(var e=o(t,!0),r=0;r<e.length;r+=this.segmentSize){for(var n=this._aes.encrypt(this._shiftRegister),i=0;i<this.segmentSize;i++)e[r+i]^=n[i];a(this._shiftRegister,this._shiftRegister,0,this.segmentSize),a(e,this._shiftRegister,16-this.segmentSize,r,r+this.segmentSize)}return e},I.prototype.decrypt=function(t){if(t.length%this.segmentSize!=0)throw new Error("invalid ciphertext size (must be segmentSize bytes)");for(var e=o(t,!0),r=0;r<e.length;r+=this.segmentSize){for(var n=this._aes.encrypt(this._shiftRegister),i=0;i<this.segmentSize;i++)e[r+i]^=n[i];a(this._shiftRegister,this._shiftRegister,0,this.segmentSize),a(t,this._shiftRegister,16-this.segmentSize,r,r+this.segmentSize)}return e};var R=function(t,e){if(!(this instanceof R))throw Error("AES must be instanitated with `new`");if(this.description="Output Feedback",this.name="ofb",e){if(16!=e.length)throw new Error("invalid initialation vector size (must be 16 bytes)")}else e=s(16);this._lastPrecipher=o(e,!0),this._lastPrecipherIndex=16,this._aes=new k(t)};R.prototype.encrypt=function(t){for(var e=o(t,!0),r=0;r<e.length;r++)16===this._lastPrecipherIndex&&(this._lastPrecipher=this._aes.encrypt(this._lastPrecipher),this._lastPrecipherIndex=0),e[r]^=this._lastPrecipher[this._lastPrecipherIndex++];return e},R.prototype.decrypt=R.prototype.encrypt;var O=function(t){if(!(this instanceof O))throw Error("Counter must be instanitated with `new`");"number"==typeof(t=0===t||t?t:1)?(this._counter=s(16),this.setValue(t)):this.setBytes(t)};O.prototype.setValue=function(t){if("number"!=typeof t||parseInt(t)!=t)throw new Error("invalid counter value (must be an integer)");for(var e=15;0<=e;--e)this._counter[e]=t%256,t>>=8},O.prototype.setBytes=function(t){if(16!=(t=o(t,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=t},O.prototype.increment=function(){for(var t=15;0<=t;t--){if(255!==this._counter[t]){this._counter[t]++;break}this._counter[t]=0}};var C=function(t,e){if(!(this instanceof C))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",e instanceof O||(e=new O(e)),this._counter=e,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new k(t)};C.prototype.encrypt=function(t){for(var e=o(t,!0),r=0;r<e.length;r++)16===this._remainingCounterIndex&&(this._remainingCounter=this._aes.encrypt(this._counter._counter),this._remainingCounterIndex=0,this._counter.increment()),e[r]^=this._remainingCounter[this._remainingCounterIndex++];return e},C.prototype.decrypt=C.prototype.encrypt,h={AES:k,Counter:O,ModeOfOperation:{ecb:T,cbc:P,cfb:I,ofb:R,ctr:C},utils:{hex:l,utf8:h},padding:{pkcs7:{pad:function(t){var e=16-(t=o(t,!0)).length%16,r=s(t.length+e);a(t,r);for(var n=t.length;n<r.length;n++)r[n]=e;return r},strip:function(t){if((t=o(t,!0)).length<16)throw new Error("PKCS#7 invalid length");var e=t[t.length-1];if(16<e)throw new Error("PKCS#7 padding byte out of range");for(var r=t.length-e,n=0;n<e;n++)if(t[r+n]!==e)throw new Error("PKCS#7 invalid padding byte");var i=s(r);return a(t,i,0,0,r),i}}},_arrayTest:{coerceArray:o,createArray:s,copyArray:a}},void 0!==r?e.exports=h:(t.aesjs&&(h._aesjs=t.aesjs),t.aesjs=h)}(this)},{}],9:[function(t,e,r){!function(e,r){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){function r(){}t.super_=e,r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,(this.red=null)!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var s;"object"==typeof e?e.exports=o:r.BN=o,(o.BN=o).wordSize=26;try{s=("undefined"!=typeof window&&void 0!==window.Buffer?window:t("buffer")).Buffer}catch(e){}function a(t,e){return 65<=(e=t.charCodeAt(e))&&e<=70?e-55:97<=e&&e<=102?e-87:e-48&15}function u(t,e,r){var n=a(t,r);return e<=r-1&&(n|=a(t,r-1)<<4),n}function h(t,e,r,n){for(var i=0,o=Math.min(t.length,r),s=e;s<o;s++){var a=t.charCodeAt(s)-48;i*=n,i+=49<=a?a-49+10:17<=a?a-17+10:a}return i}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return 0<t.cmp(e)?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);n((e="hex"===e?16:e)===(0|e)&&2<=e&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<t.length&&(16===e?this._parseHex(t,i,r):(this._parseBase(t,e,i),"le"===r&&this._initArray(this.toArray(),e,r)))},o.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},o.prototype._initArray=function(t,e,r){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i,o,s=0;s<this.length;s++)this.words[s]=0;var a=0;if("be"===r)for(s=t.length-1,i=0;0<=s;s-=3)o=t[s]|t[s-1]<<8|t[s-2]<<16,this.words[i]|=o<<a&67108863,this.words[i+1]=o>>>26-a&67108863,26<=(a+=24)&&(a-=26,i++);else if("le"===r)for(i=s=0;s<t.length;s+=3)o=t[s]|t[s+1]<<8|t[s+2]<<16,this.words[i]|=o<<a&67108863,this.words[i+1]=o>>>26-a&67108863,26<=(a+=24)&&(a-=26,i++);return this.strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var i,o=0,s=0;if("be"===r)for(n=t.length-1;e<=n;n-=2)i=u(t,e,n)<<o,this.words[s]|=67108863&i,18<=o?(o-=18,this.words[s+=1]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n<t.length;n+=2)i=u(t,e,n)<<o,this.words[s]|=67108863&i,18<=o?(o-=18,this.words[s+=1]|=i>>>26):o+=8;this.strip()},o.prototype._parseBase=function(t,e,r){this.words=[0];for(var n=0,i=this.length=1;i<=67108863;i*=e)n++;i=i/e|0;for(var o=t.length-r,s=o%--n,a=Math.min(o,o-s)+r,u=0,l=r;l<a;l+=n)u=h(t,l,l+n,e),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!=s){var f=1;for(u=h(t,l,t.length,e),l=0;l<s;l++)f*=e;this.imuln(f),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},o.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},o.prototype.clone=function(){var t=new o(null);return this.copy(t),t},o.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;1<this.length&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var l=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],c=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0,i=(n=(r.length=n)-1|0,(s=(0|t.words[0])*(0|e.words[0]))/67108864|0);r.words[0]=67108863&s;for(var o=1;o<n;o++){for(var s,a=i>>>26,u=67108863&i,h=Math.min(o,e.length-1),l=Math.max(0,o-t.length+1);l<=h;l++)a+=(s=(0|t.words[o-l|0])*(0|e.words[l])+u)/67108864|0,u=67108863&s;r.words[o]=0|u,i=0|a}return 0!==i?r.words[o]=0|i:r.length--,r.strip()}o.prototype.toString=function(t,e){if(e=0|e||1,16===(t=t||10)||"hex"===t){u="";for(var r=0,i=0,o=0;o<this.length;o++){var s=this.words[o],a=(16777215&(s<<r|i)).toString(16),u=0!=(i=s>>>24-r&16777215)||o!==this.length-1?l[6-a.length]+a+u:a+u;26<=(r+=2)&&(r-=26,o--)}for(0!==i&&(u=i.toString(16)+u);u.length%e!=0;)u="0"+u;return 0!==this.negative?"-"+u:u}if(t===(0|t)&&2<=t&&t<=36){var h=f[t],d=c[t];for(u="",(p=this.clone()).negative=0;!p.isZero();){var p,m=p.modn(d).toString(t);u=(p=p.idivn(d)).isZero()?m+u:l[h-m.length]+m+u}for(this.isZero()&&(u="0"+u);u.length%e!=0;)u="0"+u;return 0!==this.negative?"-"+u:u}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]:2<this.length&&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,e){return n(void 0!==s),this.toArrayLike(s,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(0<o,"Requested array length <= 0"),this.strip(),e="le"===e;var s,a,u=new t(o),h=this.clone();if(e){for(a=0;!h.isZero();a++)s=h.andln(255),h.iushrn(8),u[a]=s;for(;a<o;a++)u[a]=0}else{for(a=0;a<o-i;a++)u[a]=0;for(a=0;!h.isZero();a++)s=h.andln(255),h.iushrn(8),u[o-a-1]=s}return u},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t;return t=0,4096<=e&&(t+=13,e>>>=13),64<=e&&(t+=7,e>>>=7),8<=e&&(t+=4,e>>>=4),2<=e&&(t+=2,e>>>=2),t+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t;return t=0,0==(8191&e)&&(t+=13,e>>>=13),0==(127&e)&&(t+=7,e>>>=7),0==(15&e)&&(t+=4,e>>>=4),0==(3&e)&&(t+=2,e>>>=2),0==(1&e)&&t++,t},o.prototype.bitLength=function(){var t=this.words[this.length-1];return t=this._countBits(t),26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},o.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},o.prototype.ior=function(t){return n(0==(this.negative|t.negative)),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){for(var e=this.length>t.length?t:this,r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this.strip()},o.prototype.iand=function(t){return n(0==(this.negative|t.negative)),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){for(var e,r=this.length>t.length?(e=this,t):(e=t,this),n=0;n<r.length;n++)this.words[n]=e.words[n]^r.words[n];if(this!==e)for(;n<e.length;n++)this.words[n]=e.words[n];return this.length=e.length,this.strip()},o.prototype.ixor=function(t){return n(0==(this.negative|t.negative)),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"==typeof t&&0<=t);var e=0|Math.ceil(t/26);t%=26,this._expand(e),0<t&&e--;for(var r=0;r<e;r++)this.words[r]=67108863&~this.words[r];return 0<t&&(this.words[r]=~this.words[r]&67108863>>26-t),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"==typeof t&&0<=t);var r=t/26|0;return t%=26,this._expand(1+r),this.words[r]=e?this.words[r]|1<<t:this.words[r]&~(1<<t),this.strip()},o.prototype.iadd=function(t){var e,r;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();for(var n=this.length>t.length?(r=this,t):(r=t,this),i=0,o=0;o<n.length;o++)e=(0|r.words[o])+(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<r.length;o++)e=(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},o.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;for(var i=0<n?(r=this,t):(r=t,this),o=0,s=0;s<i.length;s++)o=(e=(0|r.words[s])-(0|i.words[s])+o)>>26,this.words[s]=67108863&e;for(;0!==o&&s<r.length;s++)o=(e=(0|r.words[s])+o)>>26,this.words[s]=67108863&e;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(t){return this.clone().isub(t)};var p=function(t,e,r){var n,i,o,s=t.words,a=e.words,u=r.words,h=8191&(n=0|s[0]),l=n>>>13,f=8191&(V=0|s[1]),c=V>>>13,d=8191&(K=0|s[2]),p=K>>>13,m=8191&(i=0|s[3]),g=i>>>13,y=8191&(Z=0|s[4]),v=Z>>>13,w=8191&(W=0|s[5]),b=W>>>13,M=8191&(o=0|s[6]),_=o>>>13,A=8191&(J=0|s[7]),E=J>>>13,x=8191&($=0|s[8]),S=$>>>13,N=8191&(X=0|s[9]),k=X>>>13,T=8191&(Y=0|a[0]),P=Y>>>13,I=0|a[1],R=8191&I,O=I>>>13,C=0|a[2],B=8191&C,U=C>>>13,L=8191&(Q=0|a[3]),D=Q>>>13,j=0|a[4],F=8191&j,z=j>>>13,H=0|a[5],G=8191&H,q=H>>>13,V=8191&(n=0|a[6]),K=n>>>13,Z=8191&(i=0|a[7]),W=i>>>13,J=8191&(o=0|a[8]),$=o>>>13,X=8191&(s=0|a[9]),Y=s>>>13;r.negative=t.negative^e.negative,r.length=19;var Q=(0+Math.imul(h,T)|0)+((8191&(C=(C=Math.imul(h,P))+Math.imul(l,T)|0))<<13)|0,tt=((j=Math.imul(l,P))+(C>>>13)|0)+(Q>>>26)|0;return Q&=67108863,I=Math.imul(f,T),C=(C=Math.imul(f,P))+Math.imul(c,T)|0,j=Math.imul(c,P),H=(tt+(I+Math.imul(h,R)|0)|0)+((8191&(C=(C=C+Math.imul(h,O)|0)+Math.imul(l,R)|0))<<13)|0,tt=((j=j+Math.imul(l,O)|0)+(C>>>13)|0)+(H>>>26)|0,H&=67108863,I=Math.imul(d,T),C=(C=Math.imul(d,P))+Math.imul(p,T)|0,j=Math.imul(p,P),I=I+Math.imul(f,R)|0,C=(C=C+Math.imul(f,O)|0)+Math.imul(c,R)|0,j=j+Math.imul(c,O)|0,n=(tt+(I+Math.imul(h,B)|0)|0)+((8191&(C=(C=C+Math.imul(h,U)|0)+Math.imul(l,B)|0))<<13)|0,tt=((j=j+Math.imul(l,U)|0)+(C>>>13)|0)+(n>>>26)|0,n&=67108863,I=Math.imul(m,T),C=(C=Math.imul(m,P))+Math.imul(g,T)|0,j=Math.imul(g,P),I=I+Math.imul(d,R)|0,C=(C=C+Math.imul(d,O)|0)+Math.imul(p,R)|0,j=j+Math.imul(p,O)|0,I=I+Math.imul(f,B)|0,C=(C=C+Math.imul(f,U)|0)+Math.imul(c,B)|0,j=j+Math.imul(c,U)|0,i=(tt+(I+Math.imul(h,L)|0)|0)+((8191&(C=(C=C+Math.imul(h,D)|0)+Math.imul(l,L)|0))<<13)|0,tt=((j=j+Math.imul(l,D)|0)+(C>>>13)|0)+(i>>>26)|0,i&=67108863,I=Math.imul(y,T),C=(C=Math.imul(y,P))+Math.imul(v,T)|0,j=Math.imul(v,P),I=I+Math.imul(m,R)|0,C=(C=C+Math.imul(m,O)|0)+Math.imul(g,R)|0,j=j+Math.imul(g,O)|0,I=I+Math.imul(d,B)|0,C=(C=C+Math.imul(d,U)|0)+Math.imul(p,B)|0,j=j+Math.imul(p,U)|0,I=I+Math.imul(f,L)|0,C=(C=C+Math.imul(f,D)|0)+Math.imul(c,L)|0,j=j+Math.imul(c,D)|0,o=(tt+(I+Math.imul(h,F)|0)|0)+((8191&(C=(C=C+Math.imul(h,z)|0)+Math.imul(l,F)|0))<<13)|0,tt=((j=j+Math.imul(l,z)|0)+(C>>>13)|0)+(o>>>26)|0,o&=67108863,I=Math.imul(w,T),C=(C=Math.imul(w,P))+Math.imul(b,T)|0,j=Math.imul(b,P),I=I+Math.imul(y,R)|0,C=(C=C+Math.imul(y,O)|0)+Math.imul(v,R)|0,j=j+Math.imul(v,O)|0,I=I+Math.imul(m,B)|0,C=(C=C+Math.imul(m,U)|0)+Math.imul(g,B)|0,j=j+Math.imul(g,U)|0,I=I+Math.imul(d,L)|0,C=(C=C+Math.imul(d,D)|0)+Math.imul(p,L)|0,j=j+Math.imul(p,D)|0,I=I+Math.imul(f,F)|0,C=(C=C+Math.imul(f,z)|0)+Math.imul(c,F)|0,j=j+Math.imul(c,z)|0,a=(tt+(I+Math.imul(h,G)|0)|0)+((8191&(C=(C=C+Math.imul(h,q)|0)+Math.imul(l,G)|0))<<13)|0,tt=((j=j+Math.imul(l,q)|0)+(C>>>13)|0)+(a>>>26)|0,a&=67108863,I=Math.imul(M,T),C=(C=Math.imul(M,P))+Math.imul(_,T)|0,j=Math.imul(_,P),I=I+Math.imul(w,R)|0,C=(C=C+Math.imul(w,O)|0)+Math.imul(b,R)|0,j=j+Math.imul(b,O)|0,I=I+Math.imul(y,B)|0,C=(C=C+Math.imul(y,U)|0)+Math.imul(v,B)|0,j=j+Math.imul(v,U)|0,I=I+Math.imul(m,L)|0,C=(C=C+Math.imul(m,D)|0)+Math.imul(g,L)|0,j=j+Math.imul(g,D)|0,I=I+Math.imul(d,F)|0,C=(C=C+Math.imul(d,z)|0)+Math.imul(p,F)|0,j=j+Math.imul(p,z)|0,I=I+Math.imul(f,G)|0,C=(C=C+Math.imul(f,q)|0)+Math.imul(c,G)|0,j=j+Math.imul(c,q)|0,s=(tt+(I+Math.imul(h,V)|0)|0)+((8191&(C=(C=C+Math.imul(h,K)|0)+Math.imul(l,V)|0))<<13)|0,tt=((j=j+Math.imul(l,K)|0)+(C>>>13)|0)+(s>>>26)|0,s&=67108863,I=Math.imul(A,T),C=(C=Math.imul(A,P))+Math.imul(E,T)|0,j=Math.imul(E,P),I=I+Math.imul(M,R)|0,C=(C=C+Math.imul(M,O)|0)+Math.imul(_,R)|0,j=j+Math.imul(_,O)|0,I=I+Math.imul(w,B)|0,C=(C=C+Math.imul(w,U)|0)+Math.imul(b,B)|0,j=j+Math.imul(b,U)|0,I=I+Math.imul(y,L)|0,C=(C=C+Math.imul(y,D)|0)+Math.imul(v,L)|0,j=j+Math.imul(v,D)|0,I=I+Math.imul(m,F)|0,C=(C=C+Math.imul(m,z)|0)+Math.imul(g,F)|0,j=j+Math.imul(g,z)|0,I=I+Math.imul(d,G)|0,C=(C=C+Math.imul(d,q)|0)+Math.imul(p,G)|0,j=j+Math.imul(p,q)|0,I=I+Math.imul(f,V)|0,C=(C=C+Math.imul(f,K)|0)+Math.imul(c,V)|0,j=j+Math.imul(c,K)|0,t=(tt+(I+Math.imul(h,Z)|0)|0)+((8191&(C=(C=C+Math.imul(h,W)|0)+Math.imul(l,Z)|0))<<13)|0,tt=((j=j+Math.imul(l,W)|0)+(C>>>13)|0)+(t>>>26)|0,t&=67108863,I=Math.imul(x,T),C=(C=Math.imul(x,P))+Math.imul(S,T)|0,j=Math.imul(S,P),I=I+Math.imul(A,R)|0,C=(C=C+Math.imul(A,O)|0)+Math.imul(E,R)|0,j=j+Math.imul(E,O)|0,I=I+Math.imul(M,B)|0,C=(C=C+Math.imul(M,U)|0)+Math.imul(_,B)|0,j=j+Math.imul(_,U)|0,I=I+Math.imul(w,L)|0,C=(C=C+Math.imul(w,D)|0)+Math.imul(b,L)|0,j=j+Math.imul(b,D)|0,I=I+Math.imul(y,F)|0,C=(C=C+Math.imul(y,z)|0)+Math.imul(v,F)|0,j=j+Math.imul(v,z)|0,I=I+Math.imul(m,G)|0,C=(C=C+Math.imul(m,q)|0)+Math.imul(g,G)|0,j=j+Math.imul(g,q)|0,I=I+Math.imul(d,V)|0,C=(C=C+Math.imul(d,K)|0)+Math.imul(p,V)|0,j=j+Math.imul(p,K)|0,I=I+Math.imul(f,Z)|0,C=(C=C+Math.imul(f,W)|0)+Math.imul(c,Z)|0,j=j+Math.imul(c,W)|0,e=(tt+(I+Math.imul(h,J)|0)|0)+((8191&(C=(C=C+Math.imul(h,$)|0)+Math.imul(l,J)|0))<<13)|0,tt=((j=j+Math.imul(l,$)|0)+(C>>>13)|0)+(e>>>26)|0,e&=67108863,I=Math.imul(N,T),C=(C=Math.imul(N,P))+Math.imul(k,T)|0,j=Math.imul(k,P),I=I+Math.imul(x,R)|0,C=(C=C+Math.imul(x,O)|0)+Math.imul(S,R)|0,j=j+Math.imul(S,O)|0,I=I+Math.imul(A,B)|0,C=(C=C+Math.imul(A,U)|0)+Math.imul(E,B)|0,j=j+Math.imul(E,U)|0,I=I+Math.imul(M,L)|0,C=(C=C+Math.imul(M,D)|0)+Math.imul(_,L)|0,j=j+Math.imul(_,D)|0,I=I+Math.imul(w,F)|0,C=(C=C+Math.imul(w,z)|0)+Math.imul(b,F)|0,j=j+Math.imul(b,z)|0,I=I+Math.imul(y,G)|0,C=(C=C+Math.imul(y,q)|0)+Math.imul(v,G)|0,j=j+Math.imul(v,q)|0,I=I+Math.imul(m,V)|0,C=(C=C+Math.imul(m,K)|0)+Math.imul(g,V)|0,j=j+Math.imul(g,K)|0,I=I+Math.imul(d,Z)|0,C=(C=C+Math.imul(d,W)|0)+Math.imul(p,Z)|0,j=j+Math.imul(p,W)|0,I=I+Math.imul(f,J)|0,C=(C=C+Math.imul(f,$)|0)+Math.imul(c,J)|0,j=j+Math.imul(c,$)|0,h=(tt+(I+Math.imul(h,X)|0)|0)+((8191&(C=(C=C+Math.imul(h,Y)|0)+Math.imul(l,X)|0))<<13)|0,tt=((j=j+Math.imul(l,Y)|0)+(C>>>13)|0)+(h>>>26)|0,h&=67108863,I=Math.imul(N,R),C=(C=Math.imul(N,O))+Math.imul(k,R)|0,j=Math.imul(k,O),I=I+Math.imul(x,B)|0,C=(C=C+Math.imul(x,U)|0)+Math.imul(S,B)|0,j=j+Math.imul(S,U)|0,I=I+Math.imul(A,L)|0,C=(C=C+Math.imul(A,D)|0)+Math.imul(E,L)|0,j=j+Math.imul(E,D)|0,I=I+Math.imul(M,F)|0,C=(C=C+Math.imul(M,z)|0)+Math.imul(_,F)|0,j=j+Math.imul(_,z)|0,I=I+Math.imul(w,G)|0,C=(C=C+Math.imul(w,q)|0)+Math.imul(b,G)|0,j=j+Math.imul(b,q)|0,I=I+Math.imul(y,V)|0,C=(C=C+Math.imul(y,K)|0)+Math.imul(v,V)|0,j=j+Math.imul(v,K)|0,I=I+Math.imul(m,Z)|0,C=(C=C+Math.imul(m,W)|0)+Math.imul(g,Z)|0,j=j+Math.imul(g,W)|0,I=I+Math.imul(d,J)|0,C=(C=C+Math.imul(d,$)|0)+Math.imul(p,J)|0,j=j+Math.imul(p,$)|0,f=(tt+(I+Math.imul(f,X)|0)|0)+((8191&(C=(C=C+Math.imul(f,Y)|0)+Math.imul(c,X)|0))<<13)|0,tt=((j=j+Math.imul(c,Y)|0)+(C>>>13)|0)+(f>>>26)|0,f&=67108863,I=Math.imul(N,B),C=(C=Math.imul(N,U))+Math.imul(k,B)|0,j=Math.imul(k,U),I=I+Math.imul(x,L)|0,C=(C=C+Math.imul(x,D)|0)+Math.imul(S,L)|0,j=j+Math.imul(S,D)|0,I=I+Math.imul(A,F)|0,C=(C=C+Math.imul(A,z)|0)+Math.imul(E,F)|0,j=j+Math.imul(E,z)|0,I=I+Math.imul(M,G)|0,C=(C=C+Math.imul(M,q)|0)+Math.imul(_,G)|0,j=j+Math.imul(_,q)|0,I=I+Math.imul(w,V)|0,C=(C=C+Math.imul(w,K)|0)+Math.imul(b,V)|0,j=j+Math.imul(b,K)|0,I=I+Math.imul(y,Z)|0,C=(C=C+Math.imul(y,W)|0)+Math.imul(v,Z)|0,j=j+Math.imul(v,W)|0,I=I+Math.imul(m,J)|0,C=(C=C+Math.imul(m,$)|0)+Math.imul(g,J)|0,j=j+Math.imul(g,$)|0,d=(tt+(I+Math.imul(d,X)|0)|0)+((8191&(C=(C=C+Math.imul(d,Y)|0)+Math.imul(p,X)|0))<<13)|0,tt=((j=j+Math.imul(p,Y)|0)+(C>>>13)|0)+(d>>>26)|0,d&=67108863,I=Math.imul(N,L),C=(C=Math.imul(N,D))+Math.imul(k,L)|0,j=Math.imul(k,D),I=I+Math.imul(x,F)|0,C=(C=C+Math.imul(x,z)|0)+Math.imul(S,F)|0,j=j+Math.imul(S,z)|0,I=I+Math.imul(A,G)|0,C=(C=C+Math.imul(A,q)|0)+Math.imul(E,G)|0,j=j+Math.imul(E,q)|0,I=I+Math.imul(M,V)|0,C=(C=C+Math.imul(M,K)|0)+Math.imul(_,V)|0,j=j+Math.imul(_,K)|0,I=I+Math.imul(w,Z)|0,C=(C=C+Math.imul(w,W)|0)+Math.imul(b,Z)|0,j=j+Math.imul(b,W)|0,I=I+Math.imul(y,J)|0,C=(C=C+Math.imul(y,$)|0)+Math.imul(v,J)|0,j=j+Math.imul(v,$)|0,m=(tt+(I+Math.imul(m,X)|0)|0)+((8191&(C=(C=C+Math.imul(m,Y)|0)+Math.imul(g,X)|0))<<13)|0,tt=((j=j+Math.imul(g,Y)|0)+(C>>>13)|0)+(m>>>26)|0,m&=67108863,I=Math.imul(N,F),C=(C=Math.imul(N,z))+Math.imul(k,F)|0,j=Math.imul(k,z),I=I+Math.imul(x,G)|0,C=(C=C+Math.imul(x,q)|0)+Math.imul(S,G)|0,j=j+Math.imul(S,q)|0,I=I+Math.imul(A,V)|0,C=(C=C+Math.imul(A,K)|0)+Math.imul(E,V)|0,j=j+Math.imul(E,K)|0,I=I+Math.imul(M,Z)|0,C=(C=C+Math.imul(M,W)|0)+Math.imul(_,Z)|0,j=j+Math.imul(_,W)|0,I=I+Math.imul(w,J)|0,C=(C=C+Math.imul(w,$)|0)+Math.imul(b,J)|0,j=j+Math.imul(b,$)|0,y=(tt+(I+Math.imul(y,X)|0)|0)+((8191&(C=(C=C+Math.imul(y,Y)|0)+Math.imul(v,X)|0))<<13)|0,tt=((j=j+Math.imul(v,Y)|0)+(C>>>13)|0)+(y>>>26)|0,y&=67108863,I=Math.imul(N,G),C=(C=Math.imul(N,q))+Math.imul(k,G)|0,j=Math.imul(k,q),I=I+Math.imul(x,V)|0,C=(C=C+Math.imul(x,K)|0)+Math.imul(S,V)|0,j=j+Math.imul(S,K)|0,I=I+Math.imul(A,Z)|0,C=(C=C+Math.imul(A,W)|0)+Math.imul(E,Z)|0,j=j+Math.imul(E,W)|0,I=I+Math.imul(M,J)|0,C=(C=C+Math.imul(M,$)|0)+Math.imul(_,J)|0,j=j+Math.imul(_,$)|0,w=(tt+(I+Math.imul(w,X)|0)|0)+((8191&(C=(C=C+Math.imul(w,Y)|0)+Math.imul(b,X)|0))<<13)|0,tt=((j=j+Math.imul(b,Y)|0)+(C>>>13)|0)+(w>>>26)|0,w&=67108863,I=Math.imul(N,V),C=(C=Math.imul(N,K))+Math.imul(k,V)|0,j=Math.imul(k,K),I=I+Math.imul(x,Z)|0,C=(C=C+Math.imul(x,W)|0)+Math.imul(S,Z)|0,j=j+Math.imul(S,W)|0,I=I+Math.imul(A,J)|0,C=(C=C+Math.imul(A,$)|0)+Math.imul(E,J)|0,j=j+Math.imul(E,$)|0,M=(tt+(I+Math.imul(M,X)|0)|0)+((8191&(C=(C=C+Math.imul(M,Y)|0)+Math.imul(_,X)|0))<<13)|0,tt=((j=j+Math.imul(_,Y)|0)+(C>>>13)|0)+(M>>>26)|0,M&=67108863,I=Math.imul(N,Z),C=(C=Math.imul(N,W))+Math.imul(k,Z)|0,j=Math.imul(k,W),I=I+Math.imul(x,J)|0,C=(C=C+Math.imul(x,$)|0)+Math.imul(S,J)|0,j=j+Math.imul(S,$)|0,A=(tt+(I+Math.imul(A,X)|0)|0)+((8191&(C=(C=C+Math.imul(A,Y)|0)+Math.imul(E,X)|0))<<13)|0,tt=((j=j+Math.imul(E,Y)|0)+(C>>>13)|0)+(A>>>26)|0,A&=67108863,I=Math.imul(N,J),C=(C=Math.imul(N,$))+Math.imul(k,J)|0,j=Math.imul(k,$),x=(tt+(I+Math.imul(x,X)|0)|0)+((8191&(C=(C=C+Math.imul(x,Y)|0)+Math.imul(S,X)|0))<<13)|0,tt=((j=j+Math.imul(S,Y)|0)+(C>>>13)|0)+(x>>>26)|0,x&=67108863,X=(tt+Math.imul(N,X)|0)+((8191&(C=(C=Math.imul(N,Y))+Math.imul(k,X)|0))<<13)|0,tt=((j=Math.imul(k,Y))+(C>>>13)|0)+(X>>>26)|0,X&=67108863,u[0]=Q,u[1]=H,u[2]=n,u[3]=i,u[4]=o,u[5]=a,u[6]=s,u[7]=t,u[8]=e,u[9]=h,u[10]=f,u[11]=d,u[12]=m,u[13]=y,u[14]=w,u[15]=M,u[16]=A,u[17]=x,u[18]=X,0!=tt&&(u[19]=tt,r.length++),r};function m(t,e,r){return(new g).mulp(t,e,r)}function g(t,e){this.x=t,this.y=e}Math.imul||(p=d),o.prototype.mulTo=function(t,e){var r=this.length+t.length;return e=(10===this.length&&10===t.length?p:r<63?d:r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o<r.length-1;o++){for(var s=i,a=(i=0,67108863&n),u=Math.min(o,e.length-1),h=Math.max(0,o-t.length+1);h<=u;h++){var l,f=(0|t.words[o-h])*(0|e.words[h]);a=67108863&(l=(l=67108863&f)+a|0),i+=(s=(s=s+(f/67108864|0)|0)+(l>>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}:m)(this,t,e)},g.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n<t;n++)e[n]=this.revBin(n,r,t);return e},g.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var n=0,i=0;i<e;i++)n|=(1&t)<<e-i-1,t>>=1;return n},g.prototype.permute=function(t,e,r,n,i,o){for(var s=0;s<o;s++)n[s]=e[t[s]],i[s]=r[t[s]]},g.prototype.transform=function(t,e,r,n,i,o){this.permute(o,t,e,r,n,i);for(var s=1;s<i;s<<=1)for(var a=s<<1,u=Math.cos(2*Math.PI/a),h=Math.sin(2*Math.PI/a),l=0;l<i;l+=a)for(var f=u,c=h,d=0;d<s;d++){var p=r[l+d],m=n[l+d],g=r[l+d+s],y=f*g-c*(v=n[l+d+s]),v=f*v+c*g;r[l+d]=p+(g=y),n[l+d]=m+v,r[l+d+s]=p-g,n[l+d+s]=m-v,d!==a&&(y=u*f-h*c,c=u*c+h*f,f=y)}},g.prototype.guessLen13b=function(t,e){t=1&(n=1|Math.max(e,t));for(var r=0,n=n/2|0;n;n>>>=1)r++;return 1<<r+1+t},g.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var n=0;n<r/2;n++){var i=t[n];t[n]=t[r-n-1],t[r-n-1]=i,i=e[n],e[n]=-e[r-n-1],e[r-n-1]=-i}},g.prototype.normalize13b=function(t,e){for(var r=0,n=0;n<e/2;n++){var i=8192*Math.round(t[2*n+1]/e)+Math.round(t[2*n]/e)+r;t[n]=67108863&i,r=i<67108864?0:i/67108864|0}return t},g.prototype.convert13b=function(t,e,r,i){for(var o=0,s=0;s<e;s++)o+=0|t[s],r[2*s]=8191&o,r[2*s+1]=8191&(o>>>=13),o>>>=13;for(s=2*e;s<i;++s)r[s]=0;n(0===o),n(0==(-8192&o))},g.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},g.prototype.mulp=function(t,e,r){var n=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(n),o=this.stub(n),s=new Array(n),a=new Array(n),u=new Array(n),h=new Array(n),l=new Array(n),f=new Array(n),c=r.words;c.length=n,this.convert13b(t.words,t.length,s,n),this.convert13b(e.words,e.length,h,n),this.transform(s,o,a,u,n,i),this.transform(h,o,l,f,n,i);for(var d=0;d<n;d++){var p=a[d]*l[d]-u[d]*f[d];u[d]=a[d]*f[d]+u[d]*l[d],a[d]=p}return this.conjugate(a,u,n),this.transform(a,u,c,o,n,i),this.conjugate(c,o,n),this.normalize13b(c,n),r.negative=t.negative^e.negative,r.length=t.length+e.length,r.strip()},o.prototype.mul=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},o.prototype.mulf=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),m(this,t,e)},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 e=0,r=0;r<this.length;r++){var i=(0|this.words[r])*t,o=(67108863&i)+(67108863&e);e>>=26,e+=i/67108864|0,e+=o>>>26,this.words[r]=67108863&o}return 0!==e&&(this.words[r]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var n=r%26;e[r]=(t.words[r/26|0]&1<<n)>>>n}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n<e.length&&0===e[n];n++,r=r.sqr());if(++n<e.length)for(var i=r.sqr();n<e.length;n++,i=i.sqr())0!==e[n]&&(r=r.mul(i));return r},o.prototype.iushln=function(t){n("number"==typeof t&&0<=t);var e=t%26,r=(t-e)/26,i=67108863>>>26-e<<26-e;if(0!=e){for(var o=0,s=0;s<this.length;s++){var a=this.words[s]&i,u=(0|this.words[s])-a<<e;this.words[s]=u|o,o=a>>>26-e}o&&(this.words[s]=o,this.length++)}if(0!=r){for(s=this.length-1;0<=s;s--)this.words[s+r]=this.words[s];for(s=0;s<r;s++)this.words[s]=0;this.length+=r}return this.strip()},o.prototype.ishln=function(t){return n(0===this.negative),this.iushln(t)},o.prototype.iushrn=function(t,e,r){n("number"==typeof t&&0<=t);var i=e?(e-e%26)/26:0,o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,u=r;if(i-=s,i=Math.max(0,i),u){for(var h=0;h<s;h++)u.words[h]=this.words[h];u.length=s}if(0!==s)if(this.length>s)for(this.length-=s,h=0;h<this.length;h++)this.words[h]=this.words[h+s];else this.words[0]=0,this.length=1;var l=0;for(h=this.length-1;0<=h&&(0!==l||i<=h);h--){var f=0|this.words[h];this.words[h]=l<<26-o|f>>>o,l=f&a}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"==typeof t&&0<=t);var e=t%26;return t=(t-e)/26,!(this.length<=t||!(this.words[t]&1<<e))},o.prototype.imaskn=function(t){n("number"==typeof t&&0<=t);var e=t%26;return t=(t-e)/26,n(0===this.negative,"imaskn works only with positive numbers"),this.length<=t?this:(0!=e&&t++,this.length=Math.min(t,this.length),0!=e&&(this.words[this.length-1]&=67108863^67108863>>>e<<e),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.negative=0,this.isubn(t),this.negative=1),this):this._iaddn(t)},o.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&67108864<=this.words[e];e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,--this.words[e+1];return this.strip()},o.prototype.addn=function(t){return this.clone().iaddn(t)},o.prototype.subn=function(t){return this.clone().isubn(t)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(t,e,r){var i=t.length+r;this._expand(i);for(var o=0,s=0;s<t.length;s++){var a=(0|this.words[s+r])+o,u=(0|t.words[s])*e;o=((a-=67108863&u)>>26)-(u/67108864|0),this.words[s+r]=67108863&a}for(;s<this.length-r;s++)o=(a=(0|this.words[s+r])+o)>>26,this.words[s+r]=67108863&a;if(0===o)return this.strip();for(n(-1===o),s=o=0;s<this.length;s++)o=(a=-(0|this.words[s])+o)>>26,this.words[s]=67108863&a;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var r=this.length-t.length,n=this.clone(),i=t,s=0|i.words[i.length-1];0!=(r=26-this._countBits(s))&&(i=i.ushln(r),n.iushln(r),s=0|i.words[i.length-1]);var a,u=n.length-i.length;if("mod"!==e){(a=new o(null)).length=1+u,a.words=new Array(a.length);for(var h=0;h<a.length;h++)a.words[h]=0}0===(t=n.clone()._ishlnsubmul(i,1,u)).negative&&(n=t,a&&(a.words[u]=1));for(var l=u-1;0<=l;l--){var f=67108864*(0|n.words[i.length+l])+(0|n.words[i.length+l-1]);for(f=Math.min(f/s|0,67108863),n._ishlnsubmul(i,f,l);0!==n.negative;)f--,n.negative=0,n._ishlnsubmul(i,1,l),n.isZero()||(n.negative^=1);a&&(a.words[l]=f)}return a&&a.strip(),n.strip(),"div"!==e&&0!=r&&n.iushrn(r),{div:a||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),{div:i="mod"!==e?a.div.neg():i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1);return t=t.andln(1),(n=r.cmp(n))<0||1===t&&0===n?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){n(t<=67108863);for(var e=(1<<26)%t,r=0,i=this.length-1;0<=i;i--)r=(e*r+(0|this.words[i]))%t;return r},o.prototype.idivn=function(t){n(t<=67108863);for(var e=0,r=this.length-1;0<=r;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=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());for(var e=this,r=t.clone(),i=(e=0!==e.negative?e.umod(t):e.clone(),new o(1)),s=new o(0),a=new o(0),u=new o(1),h=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++h;for(var l=r.clone(),f=e.clone();!e.isZero();){for(var c=0,d=1;0==(e.words[0]&d)&&c<26;++c,d<<=1);if(0<c)for(e.iushrn(c);0<c--;)(i.isOdd()||s.isOdd())&&(i.iadd(l),s.isub(f)),i.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(0<p)for(r.iushrn(p);0<p--;)(a.isOdd()||u.isOdd())&&(a.iadd(l),u.isub(f)),a.iushrn(1),u.iushrn(1);0<=e.cmp(r)?(e.isub(r),i.isub(a),s.isub(u)):(r.isub(e),a.isub(i),u.isub(s))}return{a:a,b:u,gcd:r.iushln(h)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());for(var e,r=this,i=t.clone(),s=(r=0!==r.negative?r.umod(t):r.clone(),new o(1)),a=new o(0),u=i.clone();0<r.cmpn(1)&&0<i.cmpn(1);){for(var h=0,l=1;0==(r.words[0]&l)&&h<26;++h,l<<=1);if(0<h)for(r.iushrn(h);0<h--;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var f=0,c=1;0==(i.words[0]&c)&&f<26;++f,c<<=1);if(0<f)for(i.iushrn(f);0<f--;)a.isOdd()&&a.iadd(u),a.iushrn(1);0<=r.cmp(i)?(r.isub(i),s.isub(a)):(i.isub(r),a.isub(s))}return(e=0===r.cmpn(1)?s:a).cmpn(0)<0&&e.iadd(t),e},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0;for(var n=r.negative=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"==typeof t),t=(t-(e=t%26))/26;var e=1<<e;if(this.length<=t)return this._expand(1+t),this.words[t]|=e,this;for(var r=e,i=t;0!==r&&i<this.length;i++){var o=0|this.words[i];r=(o+=r)>>>26,o&=67108863,this.words[i]=o}return 0!==r&&(this.words[i]=r,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e=t<0;return 0===this.negative||e?0===this.negative&&e?1:(this.strip(),t=1<this.length?1:(n((t=e?-t:t)<=67108863,"Number is too big"),(e=0|this.words[0])===t?0:e<t?-1:1),0!==this.negative?0|-t:t):-1},o.prototype.cmp=function(t){return 0!==this.negative&&0===t.negative?-1:0===this.negative&&0!==t.negative?1:(t=this.ucmp(t),0!==this.negative?0|-t:t)},o.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;0<=r;r--){var n=0|this.words[r],i=0|t.words[r];if(n!=i){n<i?e=-1:i<n&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return 0<=this.cmpn(t)},o.prototype.gte=function(t){return 0<=this.cmp(t)},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 A(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 y={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function b(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function M(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(t){var e;"string"==typeof t?(e=o._prime(t),this.m=e.p,this.prime=e):(n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null)}function E(t){A.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){for(var e,r=t;this.split(r,this.tmp),(e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength())>this.n;);return 0===(t=e<this.n?-1:r.ucmp(this.p))?(r.words[0]=0,r.length=1):0<t?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},i(w,v),w.prototype.split=function(t,e){for(var r=Math.min(t.length,9),n=0;n<r;n++)e.words[n]=t.words[n];if(e.length=r,t.length<=9)return t.words[0]=0,void(t.length=1);var i=t.words[9];for(e.words[e.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}0==(t.words[n-10]=i>>>=22)&&10<t.length?t.length-=10:t.length-=9},w.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var n=0|t.words[r];e+=977*n,t.words[r]=67108863&e,e=64*n+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(b,v),i(M,v),i(_,v),_.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var n=19*(0|t.words[r])+e,i=67108863&n;n>>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(y[t])return y[t];var e;if("k256"===t)e=new w;else if("p224"===t)e=new b;else if("p192"===t)e=new M;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new _}return y[t]=e},A.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},A.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},A.prototype.imod=function(t){return(this.prime?this.prime.ireduce(t):t.umod(this.m))._forceRed(this)},A.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},A.prototype.add=function(t,e){return this._verify2(t,e),0<=(e=t.add(e)).cmp(this.m)&&e.isub(this.m),e._forceRed(this)},A.prototype.iadd=function(t,e){return this._verify2(t,e),0<=(e=t.iadd(e)).cmp(this.m)&&e.isub(this.m),e},A.prototype.sub=function(t,e){return this._verify2(t,e),(e=t.sub(e)).cmpn(0)<0&&e.iadd(this.m),e._forceRed(this)},A.prototype.isub=function(t,e){return this._verify2(t,e),(e=t.isub(e)).cmpn(0)<0&&e.iadd(this.m),e},A.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},A.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},A.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},A.prototype.isqr=function(t){return this.imul(t,t.clone())},A.prototype.sqr=function(t){return this.mul(t,t)},A.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e)return e=this.m.add(new o(1)).iushrn(2),this.pow(t,e);for(var r=this.m.subn(1),i=0;!r.isZero()&&0===r.andln(1);)i++,r.iushrn(1);n(!r.isZero());for(var s=new o(1).toRed(this),a=s.redNeg(),u=this.m.subn(1).iushrn(1),h=new o(2*(h=this.m.bitLength())*h).toRed(this);0!==this.pow(h,u).cmp(a);)h.redIAdd(a);for(var l=this.pow(h,r),f=this.pow(t,r.addn(1).iushrn(1)),c=this.pow(t,r),d=i;0!==c.cmp(s);){for(var p=c,m=0;0!==p.cmp(s);m++)p=p.redSqr();n(m<d);var g=this.pow(l,new o(1).iushln(d-m-1));f=f.redMul(g),l=g.redSqr(),c=c.redMul(l),d=m}return f},A.prototype.invm=function(t){return 0!==(t=t._invmp(this.m)).negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},A.prototype.pow=function(t,e){if(e.isZero())return new o(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new o(1).toRed(this),r[1]=t;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],t);var i=r[0],s=0,a=0,u=e.bitLength()%26;for(0===u&&(u=26),n=e.length-1;0<=n;n--){for(var h=e.words[n],l=u-1;0<=l;l--){var f=h>>l&1;i!==r[0]&&(i=this.sqr(i)),0!=f||0!==s?(s<<=1,s|=f,(4==++a||0===n&&0===l)&&(i=this.mul(i,r[s]),s=a=0)):a=0}u=26}return i},A.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},A.prototype.convertFrom=function(t){return(t=t.clone()).red=null,t},o.mont=function(t){return new E(t)},i(E,A),E.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},E.prototype.convertFrom=function(t){return(t=this.imod(t.mul(this.rinv))).red=null,t},E.prototype.imul=function(t,e){return t.isZero()||e.isZero()?(t.words[0]=0,t.length=1,t):(e=(t=t.imul(e)).maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),e=t=t.isub(e).iushrn(this.shift),0<=t.cmp(this.m)?e=t.isub(this.m):t.cmpn(0)<0&&(e=t.iadd(this.m)),e._forceRed(this))},E.prototype.mul=function(t,e){return t.isZero()||e.isZero()?new o(0)._forceRed(this):(e=(t=t.mul(e)).maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),e=t=t.isub(e).iushrn(this.shift),0<=t.cmp(this.m)?e=t.isub(this.m):t.cmpn(0)<0&&(e=t.iadd(this.m)),e._forceRed(this))},E.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===e||e,this)},{buffer:11}],10:[function(t,r,n){(function(t){(function(){r.exports=function(e){return e=new Uint8Array(e),(t.crypto||t.msCrypto).getRandomValues(e),e}}).call(this)}).call(this,void 0!==e?e:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],11:[function(t,e,r){},{}],12:[function(t,e,r){"use strict";r.version=t("../package.json").version,r.utils=t("./elliptic/utils"),r.rand=t("brorand"),r.curve=t("./elliptic/curve"),r.curves=t("./elliptic/curves"),r.ec=t("./elliptic/ec"),r.eddsa=t("./elliptic/eddsa")},{"../package.json":25,"./elliptic/curve":15,"./elliptic/curves":18,"./elliptic/ec":19,"./elliptic/eddsa":22,"./elliptic/utils":24,brorand:10}],13:[function(t,e,r){"use strict";var n=t("bn.js"),i=t("../utils"),o=i.getNAF,s=i.getJSF,a=i.assert;function u(t,e){this.type=t,this.p=new n(e.p,16),this.red=e.prime?n.red(e.prime):n.mont(this.p),this.zero=new n(0).toRed(this.red),this.one=new n(1).toRed(this.red),this.two=new n(2).toRed(this.red),this.n=e.n&&new n(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0,!(e=this.n&&this.p.div(this.n))||0<e.cmpn(100)?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function h(t,e){this.curve=t,this.type=e,this.precomputed=null}(e.exports=u).prototype.point=function(){throw new Error("Not implemented")},u.prototype.validate=function(){throw new Error("Not implemented")},u.prototype._fixedNafMul=function(t,e){a(t.precomputed);var r=t._getDoubles(),n=o(e,1,this._bitLength);e=(1<<r.step+1)-(r.step%2==0?2:1),e/=3;for(var i=[],s=0;s<n.length;s+=r.step){for(var u=0,h=s+r.step-1;s<=h;h--)u=(u<<1)+n[h];i.push(u)}for(var l=this.jpoint(null,null,null),f=this.jpoint(null,null,null),c=e;0<c;c--){for(s=0;s<i.length;s++)(u=i[s])===c?f=f.mixedAdd(r.points[s]):u===-c&&(f=f.mixedAdd(r.points[s].neg()));l=l.add(f)}return l.toP()},u.prototype._wnafMul=function(t,e){for(var r=t._getNAFPoints(4),n=r.wnd,i=r.points,s=o(e,n,this._bitLength),u=this.jpoint(null,null,null),h=s.length-1;0<=h;h--){for(var l=0;0<=h&&0===s[h];h--)l++;if(0<=h&&l++,u=u.dblp(l),h<0)break;var f=s[h];a(0!==f),u="affine"===t.type?0<f?u.mixedAdd(i[f-1>>1]):u.mixedAdd(i[-f-1>>1].neg()):0<f?u.add(i[f-1>>1]):u.add(i[-f-1>>1].neg())}return"affine"===t.type?u.toP():u},u.prototype._wnafMulAdd=function(t,e,r,n,i){for(var a=this._wnafT1,u=this._wnafT2,h=this._wnafT3,l=0,f=0;f<n;f++){var c,d=(c=e[f])._getNAFPoints(t);a[f]=d.wnd,u[f]=d.points}for(f=n-1;1<=f;f-=2){var p=f-1,m=f;if(1===a[p]&&1===a[m]){var g=[e[p],null,null,e[m]];0===e[p].y.cmp(e[m].y)?(g[1]=e[p].add(e[m]),g[2]=e[p].toJ().mixedAdd(e[m].neg())):0===e[p].y.cmp(e[m].y.redNeg())?(g[1]=e[p].toJ().mixedAdd(e[m]),g[2]=e[p].add(e[m].neg())):(g[1]=e[p].toJ().mixedAdd(e[m]),g[2]=e[p].toJ().mixedAdd(e[m].neg()));var y=[-3,-1,-5,-7,0,7,5,1,3],v=s(r[p],r[m]);for(l=Math.max(v[0].length,l),h[p]=new Array(l),h[m]=new Array(l),x=0;x<l;x++){var w=0|v[0][x],b=0|v[1][x];h[p][x]=y[3*(1+w)+(1+b)],h[m][x]=0,u[p]=g}}else h[p]=o(r[p],a[p],this._bitLength),h[m]=o(r[m],a[m],this._bitLength),l=Math.max(h[p].length,l),l=Math.max(h[m].length,l)}var M=this.jpoint(null,null,null),_=this._wnafT4;for(f=l;0<=f;f--){for(var A=0;0<=f;){for(var E=!0,x=0;x<n;x++)_[x]=0|h[x][f],0!==_[x]&&(E=!1);if(!E)break;A++,f--}if(0<=f&&A++,M=M.dblp(A),f<0)break;for(x=0;x<n;x++){var S=_[x];0!==S&&(0<S?c=u[x][S-1>>1]:S<0&&(c=u[x][-S-1>>1].neg()),M="affine"===c.type?M.mixedAdd(c):M.add(c))}}for(f=0;f<n;f++)u[f]=null;return i?M:M.toP()},(u.BasePoint=h).prototype.eq=function(){throw new Error("Not implemented")},h.prototype.validate=function(){return this.curve.validate(this)},u.prototype.decodePoint=function(t,e){if(t=i.toArray(t,e),e=this.p.byteLength(),(4===t[0]||6===t[0]||7===t[0])&&t.length-1==2*e)return 6===t[0]?a(t[t.length-1]%2==0):7===t[0]&&a(t[t.length-1]%2==1),this.point(t.slice(1,1+e),t.slice(1+e,1+2*e));if((2===t[0]||3===t[0])&&t.length-1===e)return this.pointFromX(t.slice(1,1+e),3===t[0]);throw new Error("Unknown point format")},h.prototype.encodeCompressed=function(t){return this.encode(t,!0)},h.prototype._encode=function(t){var e=this.curve.p.byteLength(),r=this.getX().toArray("be",e);return t?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",e))},h.prototype.encode=function(t,e){return i.encode(this._encode(e),t)},h.prototype.precompute=function(t){if(this.precomputed)return this;var e={doubles:null,naf:null,beta:null};return e.naf=this._getNAFPoints(8),e.doubles=this._getDoubles(4,t),e.beta=this._getBeta(),this.precomputed=e,this},h.prototype._hasDoubles=function(t){if(!this.precomputed)return!1;var e=this.precomputed.doubles;return!!e&&e.points.length>=Math.ceil((t.bitLength()+1)/e.step)},h.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i<e;i+=t){for(var o=0;o<t;o++)n=n.dbl();r.push(n)}return{step:t,points:r}},h.prototype._getNAFPoints=function(t){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var e=[this],r=(1<<t)-1,n=1==r?null:this.dbl(),i=1;i<r;i++)e[i]=e[i-1].add(n);return{wnd:t,points:e}},h.prototype._getBeta=function(){return null},h.prototype.dblp=function(t){for(var e=this,r=0;r<t;r++)e=e.dbl();return e}},{"../utils":24,"bn.js":9}],14:[function(t,e,r){e.exports={}},{}],15:[function(t,e,r){"use strict";r.base=t("./base"),r.short=t("./short"),r.mont=t("./mont"),r.edwards=t("./edwards")},{"./base":13,"./edwards":14,"./mont":16,"./short":17}],16:[function(t,e,r){arguments[4][14][0].apply(r,arguments)},{dup:14}],17:[function(t,e,r){"use strict";var n=t("../utils"),i=t("bn.js"),o=t("inherits"),s=t("./base"),a=n.assert;function u(t){s.call(this,"short",t),this.a=new i(t.a,16).toRed(this.red),this.b=new i(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function h(t,e,r,n){s.BasePoint.call(this,t,"affine"),null===e&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new i(e,16),this.y=new i(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function l(t,e,r,n){s.BasePoint.call(this,t,"jacobian"),null===e&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new i(0)):(this.x=new i(e,16),this.y=new i(r,16),this.z=new i(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}o(u,s),(e.exports=u).prototype._getEndomorphism=function(t){var e,r,n;if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3))return r=(t.beta?new i(t.beta,16):r=(n=this._getEndoRoots(this.p))[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red),t.lambda?e=new i(t.lambda,16):(n=this._getEndoRoots(this.n),0===this.g.mul(n[0]).x.cmp(this.g.x.redMul(r))?e=n[0]:(e=n[1],a(0===this.g.mul(e).x.cmp(this.g.x.redMul(r))))),{beta:r,lambda:e,basis:t.basis?t.basis.map((function(t){return{a:new i(t.a,16),b:new i(t.b,16)}})):this._getEndoBasis(e)}},u.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:i.mont(t),r=(t=(r=new i(2).toRed(e).redInvm()).redNeg(),new i(3).toRed(e).redNeg().redSqrt().redMul(r));return[t.redAdd(r).fromRed(),t.redSub(r).fromRed()]},u.prototype._getEndoBasis=function(t){for(var e,r,n,o,s,a=this.n.ushrn(Math.floor(this.n.bitLength()/2)),u=t,h=this.n.clone(),l=new i(1),f=new i(0),c=new i(0),d=new i(1),p=0;0!==u.cmpn(0);){var m=h.div(u),g=h.sub(m.mul(u)),y=c.sub(m.mul(l));if(m=d.sub(m.mul(f)),!n&&g.cmp(a)<0)e=s.neg(),r=l,n=g.neg(),o=y;else if(n&&2==++p)break;h=u,u=s=g,c=l,l=y,d=f,f=m}var v=g.neg(),w=y;return t=n.sqr().add(o.sqr()),0<=v.sqr().add(w.sqr()).cmp(t)&&(v=e,w=r),n.negative&&(n=n.neg(),o=o.neg()),v.negative&&(v=v.neg(),w=w.neg()),[{a:n,b:o},{a:v,b:w}]},u.prototype._endoSplit=function(t){var e=(o=this.endo.basis)[0],r=(s=o[1]).b.mul(t).divRound(this.n),n=e.b.neg().mul(t).divRound(this.n),i=r.mul(e.a),o=n.mul(s.a),s=(e=r.mul(e.b),n.mul(s.b));return{k1:t.sub(i).sub(o),k2:e.add(s).neg()}},u.prototype.pointFromX=function(t,e){var r=(t=(t=new i(t,16)).red?t:t.toRed(this.red)).redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");return r=n.fromRed().isOdd(),(e&&!r||!e&&r)&&(n=n.redNeg()),this.point(t,n)},u.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y;return t=this.a.redMul(e),t=e.redSqr().redMul(e).redIAdd(t).redIAdd(this.b),0===r.redSqr().redISub(t).cmpn(0)},u.prototype._endoWnafMulAdd=function(t,e,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o<t.length;o++){var s=this._endoSplit(e[o]),a=t[o],u=a._getBeta();s.k1.negative&&(s.k1.ineg(),a=a.neg(!0)),s.k2.negative&&(s.k2.ineg(),u=u.neg(!0)),n[2*o]=a,n[2*o+1]=u,i[2*o]=s.k1,i[2*o+1]=s.k2}r=this._wnafMulAdd(1,n,i,2*o,r);for(var h=0;h<2*o;h++)n[h]=null,i[h]=null;return r},o(h,s.BasePoint),u.prototype.point=function(t,e,r){return new h(this,t,e,r)},u.prototype.pointFromJSON=function(t,e){return h.fromJSON(this,t,e)},h.prototype._getBeta=function(){if(this.curve.endo){var t=this.precomputed;if(t&&t.beta)return t.beta;var e,r,n=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);return t&&(e=this.curve,r=function(t){return e.point(t.x.redMul(e.endo.beta),t.y)},(t.beta=n).precomputed={beta:null,naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(r)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(r)}}),n}},h.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},h.fromJSON=function(t,e,r){"string"==typeof e&&(e=JSON.parse(e));var n=t.point(e[0],e[1],r);if(!e[2])return n;function i(e){return t.point(e[0],e[1],r)}return e=e[2],n.precomputed={beta:null,doubles:e.doubles&&{step:e.doubles.step,points:[n].concat(e.doubles.points.map(i))},naf:e.naf&&{wnd:e.naf.wnd,points:[n].concat(e.naf.points.map(i))}},n},h.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},h.prototype.isInfinity=function(){return this.inf},h.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);t=(e=0!==(e=this.y.redSub(t.y)).cmpn(0)?e.redMul(this.x.redSub(t.x).redInvm()):e).redSqr().redISub(this.x).redISub(t.x);var e=e.redMul(this.x.redSub(t)).redISub(this.y);return this.curve.point(t,e)},h.prototype.dbl=function(){if(this.inf)return this;if(0===(r=this.y.redAdd(this.y)).cmpn(0))return this.curve.point(null,null);var t=this.curve.a,e=this.x.redSqr(),r=r.redInvm();return r=(t=e.redAdd(e).redIAdd(e).redIAdd(t).redMul(r)).redSqr().redISub(this.x.redAdd(this.x)),t=t.redMul(this.x.redSub(r)).redISub(this.y),this.curve.point(r,t)},h.prototype.getX=function(){return this.x.fromRed()},h.prototype.getY=function(){return this.y.fromRed()},h.prototype.mul=function(t){return t=new i(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},h.prototype.mulAdd=function(t,e,r){return e=[this,e],r=[t,r],this.curve.endo?this.curve._endoWnafMulAdd(e,r):this.curve._wnafMulAdd(1,e,r,2)},h.prototype.jmulAdd=function(t,e,r){return e=[this,e],r=[t,r],this.curve.endo?this.curve._endoWnafMulAdd(e,r,!0):this.curve._wnafMulAdd(1,e,r,2,!0)},h.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},h.prototype.neg=function(t){if(this.inf)return this;var e,r=this.curve.point(this.x,this.y.redNeg());return t&&this.precomputed&&(e=this.precomputed,t=function(t){return t.neg()},r.precomputed={naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(t)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(t)}}),r},h.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},o(l,s.BasePoint),u.prototype.jpoint=function(t,e,r){return new l(this,t,e,r)},l.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=(r=this.z.redInvm()).redSqr(),e=this.x.redMul(t),r=this.y.redMul(t).redMul(r);return this.curve.point(e,r)},l.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},l.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(e),i=t.x.redMul(r),o=this.y.redMul(e.redMul(t.z)),s=t.y.redMul(r.redMul(this.z));return e=n.redSub(i),r=o.redSub(s),0===e.cmpn(0)?0!==r.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl():(s=(i=e.redSqr()).redMul(e),n=n.redMul(i),i=r.redSqr().redIAdd(s).redISub(n).redISub(n),s=r.redMul(n.redISub(i)).redISub(o.redMul(s)),e=this.z.redMul(t.z).redMul(e),this.curve.jpoint(i,s,e))},l.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,n=t.x.redMul(e),i=this.y,o=t.y.redMul(e).redMul(this.z);return t=r.redSub(n),e=i.redSub(o),0===t.cmpn(0)?0!==e.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl():(o=(n=t.redSqr()).redMul(t),r=r.redMul(n),n=e.redSqr().redIAdd(o).redISub(r).redISub(r),o=e.redMul(r.redISub(n)).redISub(i.redMul(o)),t=this.z.redMul(t),this.curve.jpoint(n,o,t))},l.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var e=this,r=0;r<t;r++)e=e.dbl();return e}var n=this.curve.a,i=this.curve.tinv,o=this.x,s=this.y,a=this.z,u=a.redSqr().redSqr(),h=s.redAdd(s);for(r=0;r<t;r++){var l=o.redSqr(),f=(d=h.redSqr()).redSqr(),c=l.redAdd(l).redIAdd(l).redIAdd(n.redMul(u)),d=(l=o.redMul(d),c.redSqr().redISub(l.redAdd(l)));l=l.redISub(d),c=(c=c.redMul(l)).redIAdd(c).redISub(f),l=h.redMul(a),r+1<t&&(u=u.redMul(f)),o=d,a=l,h=c}return this.curve.jpoint(o,h.redMul(i),a)},l.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},l.prototype._zeroDbl=function(){var t,e,r,n,i,o=this.zOne?(r=this.x.redSqr(),t=(n=this.y.redSqr()).redSqr(),i=(i=this.x.redAdd(n).redSqr().redISub(r).redISub(t)).redIAdd(i),n=(e=r.redAdd(r).redIAdd(r)).redSqr().redISub(i).redISub(i),r=(r=(r=t.redIAdd(t)).redIAdd(r)).redIAdd(r),e=e.redMul(i.redISub(t=n)).redISub(r),this.y.redAdd(this.y)):(i=this.x.redSqr(),o=(n=this.y.redSqr()).redSqr(),r=(r=this.x.redAdd(n).redSqr().redISub(i).redISub(o)).redIAdd(r),i=(n=i.redAdd(i).redIAdd(i)).redSqr(),o=(o=(o=o.redIAdd(o)).redIAdd(o)).redIAdd(o),t=i.redISub(r).redISub(r),e=n.redMul(r.redISub(t)).redISub(o),(o=this.y.redMul(this.z)).redIAdd(o));return this.curve.jpoint(t,e,o)},l.prototype._threeDbl=function(){var t,e,r,n,i,o,s,a;return this.zOne?(s=this.x.redSqr(),r=(t=this.y.redSqr()).redSqr(),o=(o=this.x.redAdd(t).redSqr().redISub(s).redISub(r)).redIAdd(o),e=n=(a=s.redAdd(s).redIAdd(s).redIAdd(this.curve.a)).redSqr().redISub(o).redISub(o),i=(i=(i=r.redIAdd(r)).redIAdd(i)).redIAdd(i),t=a.redMul(o.redISub(n)).redISub(i),s=this.y.redAdd(this.y)):(r=this.z.redSqr(),a=this.y.redSqr(),o=this.x.redMul(a),n=(n=this.x.redSub(r).redMul(this.x.redAdd(r))).redAdd(n).redIAdd(n),o=(i=(i=o.redIAdd(o)).redIAdd(i)).redAdd(i),e=n.redSqr().redISub(o),s=this.y.redAdd(this.z).redSqr().redISub(a).redISub(r),a=(a=(a=(a=a.redSqr()).redIAdd(a)).redIAdd(a)).redIAdd(a),t=n.redMul(i.redISub(e)).redISub(a)),this.curve.jpoint(e,t,s)},l.prototype._dbl=function(){var t=this.curve.a,e=this.x,r=this.y,n=this.z,i=n.redSqr().redSqr(),o=e.redSqr(),s=r.redSqr();return t=o.redAdd(o).redIAdd(o).redIAdd(t.redMul(i)),e=(i=(i=e.redAdd(e)).redIAdd(i)).redMul(s),i=t.redSqr().redISub(e.redAdd(e)),e=e.redISub(i),s=(s=(s=(s=s.redSqr()).redIAdd(s)).redIAdd(s)).redIAdd(s),s=t.redMul(e).redISub(s),n=r.redAdd(r).redMul(n),this.curve.jpoint(i,s,n)},l.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr(),n=e.redSqr(),i=t.redAdd(t).redIAdd(t),o=i.redSqr(),s=this.x.redAdd(e).redSqr().redISub(t).redISub(n);return t=(s=(s=(s=s.redIAdd(s)).redAdd(s).redIAdd(s)).redISub(o)).redSqr(),n=(n=(n=(n=n.redIAdd(n)).redIAdd(n)).redIAdd(n)).redIAdd(n),o=i.redIAdd(s).redSqr().redISub(o).redISub(t).redISub(n),e=(e=(e=e.redMul(o)).redIAdd(e)).redIAdd(e),e=(e=(e=this.x.redMul(t).redISub(e)).redIAdd(e)).redIAdd(e),o=(o=(o=(o=this.y.redMul(o.redMul(n.redISub(o)).redISub(s.redMul(t)))).redIAdd(o)).redIAdd(o)).redIAdd(o),t=this.z.redAdd(s).redSqr().redISub(r).redISub(t),this.curve.jpoint(e,o,t)},l.prototype.mul=function(t,e){return t=new i(t,e),this.curve._wnafMul(this,t)},l.prototype.eq=function(t){if("affine"===t.type)return this.eq(t.toJ());if(this===t)return!0;var e=this.z.redSqr(),r=t.z.redSqr();return 0===this.x.redMul(r).redISub(t.x.redMul(e)).cmpn(0)&&(e=e.redMul(this.z),r=r.redMul(t.z),0===this.y.redMul(r).redISub(t.y.redMul(e)).cmpn(0))},l.prototype.eqXToP=function(t){var e=this.z.redSqr(),r=t.toRed(this.curve.red).redMul(e);if(0===this.x.cmp(r))return!0;for(var n=t.clone(),i=this.curve.redN.redMul(e);;){if(n.iadd(this.curve.n),0<=n.cmp(this.curve.p))return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},l.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},l.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},{"../utils":24,"./base":13,"bn.js":9,inherits:39}],18:[function(t,e,r){"use strict";var n,i=r,o=(r=t("hash.js"),t("./curve")),s=t("./utils").assert;function a(t){"short"===t.type?this.curve=new o.short(t):"edwards"===t.type?this.curve=new o.edwards(t):this.curve=new o.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function u(t,e){Object.defineProperty(i,t,{configurable:!0,enumerable:!0,get:function(){var r=new a(e);return Object.defineProperty(i,t,{configurable:!0,enumerable:!0,value:r}),r}})}i.PresetCurve=a,u("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:r.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),u("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:r.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),u("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:r.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),u("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:r.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),u("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:r.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),u("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["9"]}),u("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{n=t("./precomputed/secp256k1")}catch(t){n=void 0}u("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:r.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",n]})},{"./curve":15,"./precomputed/secp256k1":23,"./utils":24,"hash.js":26}],19:[function(t,e,r){"use strict";var n=t("bn.js"),i=t("hmac-drbg"),o=t("../utils"),s=t("../curves"),a=t("brorand"),u=o.assert,h=t("./key"),l=t("./signature");function f(t){if(!(this instanceof f))return new f(t);"string"==typeof t&&(u(Object.prototype.hasOwnProperty.call(s,t),"Unknown curve "+t),t=s[t]),t instanceof s.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}(e.exports=f).prototype.keyPair=function(t){return new h(this,t)},f.prototype.keyFromPrivate=function(t,e){return h.fromPrivate(this,t,e)},f.prototype.keyFromPublic=function(t,e){return h.fromPublic(this,t,e)},f.prototype.genKeyPair=function(t){for(var e=new i({hash:this.hash,pers:(t=t||{}).pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||a(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),o=this.n.sub(new n(2));;){var s=new n(e.generate(r));if(!(0<s.cmp(o)))return s.iaddn(1),this.keyFromPrivate(s)}},f.prototype._truncateToN=function(t,e){var r=8*t.byteLength()-this.n.bitLength();return 0<r&&(t=t.ushrn(r)),!e&&0<=t.cmp(this.n)?t.sub(this.n):t},f.prototype.sign=function(t,e,r,o){"object"==typeof r&&(o=r,r=null),o=o||{},e=this.keyFromPrivate(e,r),t=this._truncateToN(new n(t,16));for(var s=this.n.byteLength(),a=(r=e.getPrivate().toArray("be",s),s=t.toArray("be",s),new i({hash:this.hash,entropy:r,nonce:s,pers:o.pers,persEnc:o.persEnc||"utf8"})),u=this.n.sub(new n(1)),h=0;;h++){var f=o.k?o.k(h):new n(a.generate(this.n.byteLength()));if(!((f=this._truncateToN(f,!0)).cmpn(1)<=0||0<=f.cmp(u))){var c=this.g.mul(f);if(!c.isInfinity()){var d=c.getX(),p=d.umod(this.n);if(0!==p.cmpn(0)&&0!==(f=(f=f.invm(this.n).mul(p.mul(e.getPrivate()).iadd(t))).umod(this.n)).cmpn(0))return d=(c.getY().isOdd()?1:0)|(0!==d.cmp(p)?2:0),o.canonical&&0<f.cmp(this.nh)&&(f=this.n.sub(f),d^=1),new l({r:p,s:f,recoveryParam:d})}}}},f.prototype.verify=function(t,e,r,i){return t=this._truncateToN(new n(t,16)),r=this.keyFromPublic(r,i),i=(e=new l(e,"hex")).r,e=e.s,!(i.cmpn(1)<0||0<=i.cmp(this.n))&&!(e.cmpn(1)<0||0<=e.cmp(this.n))&&(t=(e=e.invm(this.n)).mul(t).umod(this.n),e=e.mul(i).umod(this.n),this.curve._maxwellTrick?!(o=this.g.jmulAdd(t,r.getPublic(),e)).isInfinity()&&o.eqXToP(i):!(o=this.g.mulAdd(t,r.getPublic(),e)).isInfinity()&&0===o.getX().umod(this.n).cmp(i));var o},f.prototype.recoverPubKey=function(t,e,r,i){u((3&r)===r,"The recovery param is more than two bits"),e=new l(e,i);var o=this.n,s=new n(t),a=e.r;if(i=e.s,t=1&r,r>>=1,0<=a.cmp(this.curve.p.umod(this.curve.n))&&r)throw new Error("Unable to find sencond key candinate");return a=r?this.curve.pointFromX(a.add(this.curve.n),t):this.curve.pointFromX(a,t),e=e.r.invm(o),s=o.sub(s).mul(e).umod(o),o=i.mul(e).umod(o),this.g.mulAdd(s,a,o)},f.prototype.getKeyRecoveryParam=function(t,e,r,n){if(null!==(e=new l(e,n)).recoveryParam)return e.recoveryParam;for(var i,o=0;o<4;o++){try{i=this.recoverPubKey(t,e,o)}catch(t){continue}if(i.eq(r))return o}throw new Error("Unable to find valid recovery factor")}},{"../curves":18,"../utils":24,"./key":20,"./signature":21,"bn.js":9,brorand:10,"hmac-drbg":38}],20:[function(t,e,r){"use strict";var n=t("bn.js"),i=t("../utils").assert;function o(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}(e.exports=o).fromPublic=function(t,e,r){return e instanceof o?e:new o(t,{pub:e,pubEnc:r})},o.fromPrivate=function(t,e,r){return e instanceof o?e:new o(t,{priv:e,privEnc:r})},o.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},o.prototype.getPublic=function(t,e){return"string"==typeof t&&(e=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),e?this.pub.encode(e,t):this.pub},o.prototype.getPrivate=function(t){return"hex"===t?this.priv.toString(16,2):this.priv},o.prototype._importPrivate=function(t,e){this.priv=new n(t,e||16),this.priv=this.priv.umod(this.ec.curve.n)},o.prototype._importPublic=function(t,e){if(t.x||t.y)return"mont"===this.ec.curve.type?i(t.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||i(t.x&&t.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(t.x,t.y));this.pub=this.ec.curve.decodePoint(t,e)},o.prototype.derive=function(t){return t.validate()||i(t.validate(),"public point not validated"),t.mul(this.priv).getX()},o.prototype.sign=function(t,e,r){return this.ec.sign(t,this,e,r)},o.prototype.verify=function(t,e){return this.ec.verify(t,e,this)},o.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"}},{"../utils":24,"bn.js":9}],21:[function(t,e,r){"use strict";var n=t("bn.js"),i=t("../utils"),o=i.assert;function s(t,e){if(t instanceof s)return t;this._importDER(t,e)||(o(t.r&&t.s,"Signature without r or s"),this.r=new n(t.r,16),this.s=new n(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}function a(){this.place=0}function u(t,e){var r=t[e.place++];if(!(128&r))return r;var n=15&r;if(0==n||4<n)return!1;for(var i=0,o=0,s=e.place;o<n;o++,s++)i<<=8,i|=t[s],i>>>=0;return!(i<=127)&&(e.place=s,i)}function h(t){for(var e=0,r=t.length-1;!t[e]&&!(128&t[e+1])&&e<r;)e++;return 0===e?t:t.slice(e)}function l(t,e){if(e<128)t.push(e);else{var r=1+(Math.log(e)/Math.LN2>>>3);for(t.push(128|r);--r;)t.push(e>>>(r<<3)&255);t.push(e)}}(e.exports=s).prototype._importDER=function(t,e){t=i.toArray(t,e);var r=new a;if(48!==t[r.place++])return!1;var o=u(t,r);if(!1===o)return!1;if(o+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;if(!1===(e=u(t,r)))return!1;if(o=t.slice(r.place,e+r.place),r.place+=e,2!==t[r.place++])return!1;if(!1===(e=u(t,r)))return!1;if(t.length!==e+r.place)return!1;if(r=t.slice(r.place,e+r.place),0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===r[0]){if(!(128&r[1]))return!1;r=r.slice(1)}return this.r=new n(o),this.s=new n(r),!(this.recoveryParam=null)},s.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&r[0]&&(r=[0].concat(r)),e=h(e),r=h(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];return l(n,e.length),(n=n.concat(e)).push(2),l(n,r.length),e=n.concat(r),l(n=[48],e.length),n=n.concat(e),i.encode(n,t)}},{"../utils":24,"bn.js":9}],22:[function(t,e,r){arguments[4][14][0].apply(r,arguments)},{dup:14}],23:[function(t,e,r){e.exports=void 0},{}],24:[function(t,e,r){"use strict";var n=r,i=t("bn.js");r=t("minimalistic-assert"),t=t("minimalistic-crypto-utils"),n.assert=r,n.toArray=t.toArray,n.zero2=t.zero2,n.toHex=t.toHex,n.encode=t.encode,n.getNAF=function(t,e,r){var n=new Array(Math.max(t.bitLength(),r)+1);n.fill(0);for(var i=1<<e+1,o=t.clone(),s=0;s<n.length;s++){var a,u=o.andln(i-1);o.isOdd()?o.isubn(a=(i>>1)-1<u?(i>>1)-u:u):a=0,n[s]=a,o.iushrn(1)}return n},n.getJSF=function(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var n,i=0,o=0;0<t.cmpn(-i)||0<e.cmpn(-o);){var s,a=t.andln(3)+i&3,u=e.andln(3)+o&3;3===u&&(u=-1),s=0==(1&(a=3===a?-1:a))?0:3!=(n=t.andln(7)+i&7)&&5!==n||2!==u?a:-a,r[0].push(s),u=0==(1&u)?0:3!=(n=e.andln(7)+o&7)&&5!==n||2!==a?u:-u,r[1].push(u),2*i===s+1&&(i=1-i),2*o===u+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return r},n.cachedProperty=function(t,e,r){var n="_"+e;t.prototype[e]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},n.parseBytes=function(t){return"string"==typeof t?n.toArray(t,"hex"):t},n.intFromLE=function(t){return new i(t,"hex","le")}},{"bn.js":9,"minimalistic-assert":41,"minimalistic-crypto-utils":42}],25:[function(t,e,r){e.exports={version:"6.5.4"}},{}],26:[function(t,e,r){r.utils=t("./hash/utils"),r.common=t("./hash/common"),r.sha=t("./hash/sha"),r.ripemd=t("./hash/ripemd"),r.hmac=t("./hash/hmac"),r.sha1=r.sha.sha1,r.sha256=r.sha.sha256,r.sha224=r.sha.sha224,r.sha384=r.sha.sha384,r.sha512=r.sha.sha512,r.ripemd160=r.ripemd.ripemd160},{"./hash/common":27,"./hash/hmac":28,"./hash/ripemd":29,"./hash/sha":30,"./hash/utils":37}],27:[function(t,e,r){"use strict";var n=t("./utils"),i=t("minimalistic-assert");function o(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}(r.BlockHash=o).prototype.update=function(t,e){if(t=n.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){e=(t=this.pending).length%this._delta8,this.pending=t.slice(t.length-e,t.length),0===this.pending.length&&(this.pending=null),t=n.join32(t,0,t.length-e,this.endian);for(var r=0;r<t.length;r+=this._delta32)this._update(t,r,r+this._delta32)}return this},o.prototype.digest=function(t){return this.update(this._pad()),i(null===this.pending),this._digest(t)},o.prototype._pad=function(){var t=this.pendingTotal,e=this._delta8,r=e-(t+this.padLength)%e,n=new Array(r+this.padLength);n[0]=128;for(var i=1;i<r;i++)n[i]=0;if(t<<=3,"big"===this.endian){for(var o=8;o<this.padLength;o++)n[i++]=0;n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=t>>>24&255,n[i++]=t>>>16&255,n[i++]=t>>>8&255,n[i++]=255&t}else for(n[i++]=255&t,n[i++]=t>>>8&255,n[i++]=t>>>16&255,n[i++]=t>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,o=8;o<this.padLength;o++)n[i++]=0;return n}},{"./utils":37,"minimalistic-assert":41}],28:[function(t,e,r){"use strict";var n=t("./utils"),i=t("minimalistic-assert");function o(t,e,r){if(!(this instanceof o))return new o(t,e,r);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(n.toArray(e,r))}(e.exports=o).prototype._init=function(t){t.length>this.blockSize&&(t=(new this.Hash).update(t).digest()),i(t.length<=this.blockSize);for(var e=t.length;e<this.blockSize;e++)t.push(0);for(e=0;e<t.length;e++)t[e]^=54;for(this.inner=(new this.Hash).update(t),e=0;e<t.length;e++)t[e]^=106;this.outer=(new this.Hash).update(t)},o.prototype.update=function(t,e){return this.inner.update(t,e),this},o.prototype.digest=function(t){return this.outer.update(this.inner.digest()),this.outer.digest(t)}},{"./utils":37,"minimalistic-assert":41}],29:[function(t,e,r){"use strict";var n=t("./utils"),i=(t=t("./common"),n.rotl32),o=n.sum32,s=n.sum32_3,a=n.sum32_4,u=t.BlockHash;function h(){if(!(this instanceof h))return new h;u.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function l(t,e,r,n){return t<=15?e^r^n:t<=31?e&r|~e&n:t<=47?(e|~r)^n:t<=63?e&n|r&~n:e^(r|~n)}n.inherits(h,u),(r.ripemd160=h).blockSize=512,h.outSize=160,h.hmacStrength=192,h.padLength=64,h.prototype._update=function(t,e){for(var r,n=w=this.h[0],u=A=this.h[1],h=_=this.h[2],m=M=this.h[3],g=b=this.h[4],y=0;y<80;y++){var v=o(i(a(w,l(y,A,_,M),t[f[y]+e],(r=y)<=15?0:r<=31?1518500249:r<=47?1859775393:r<=63?2400959708:2840853838),d[y]),b),w=b,b=M,M=i(_,10),_=A,A=v;v=o(i(a(n,l(79-y,u,h,m),t[c[y]+e],(r=y)<=15?1352829926:r<=31?1548603684:r<=47?1836072691:r<=63?2053994217:0),p[y]),g),n=g,g=m,m=i(h,10),h=u,u=v}v=s(this.h[1],_,m),this.h[1]=s(this.h[2],M,g),this.h[2]=s(this.h[3],b,n),this.h[3]=s(this.h[4],w,u),this.h[4]=s(this.h[0],A,h),this.h[0]=v},h.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h,"little"):n.split32(this.h,"little")};var f=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],c=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],d=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],p=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]},{"./common":27,"./utils":37}],30:[function(t,e,r){"use strict";r.sha1=t("./sha/1"),r.sha224=t("./sha/224"),r.sha256=t("./sha/256"),r.sha384=t("./sha/384"),r.sha512=t("./sha/512")},{"./sha/1":31,"./sha/224":32,"./sha/256":33,"./sha/384":34,"./sha/512":35}],31:[function(t,e,r){arguments[4][14][0].apply(r,arguments)},{dup:14}],32:[function(t,e,r){arguments[4][14][0].apply(r,arguments)},{dup:14}],33:[function(t,e,r){"use strict";var n=t("../utils"),i=t("../common"),o=t("./common"),s=t("minimalistic-assert"),a=n.sum32,u=n.sum32_4,h=n.sum32_5,l=o.ch32,f=o.maj32,c=o.s0_256,d=o.s1_256,p=o.g0_256,m=o.g1_256,g=i.BlockHash,y=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function v(){if(!(this instanceof v))return new v;g.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=y,this.W=new Array(64)}n.inherits(v,g),(e.exports=v).blockSize=512,v.outSize=256,v.hmacStrength=192,v.padLength=64,v.prototype._update=function(t,e){for(var r=this.W,n=0;n<16;n++)r[n]=t[e+n];for(;n<r.length;n++)r[n]=u(m(r[n-2]),r[n-7],p(r[n-15]),r[n-16]);var i=this.h[0],o=this.h[1],g=this.h[2],y=this.h[3],v=this.h[4],w=this.h[5],b=this.h[6],M=this.h[7];for(s(this.k.length===r.length),n=0;n<r.length;n++){var _=h(M,d(v),l(v,w,b),this.k[n],r[n]),A=a(c(i),f(i,o,g));M=b,b=w,w=v,v=a(y,_),y=g,g=o,o=i,i=a(_,A)}this.h[0]=a(this.h[0],i),this.h[1]=a(this.h[1],o),this.h[2]=a(this.h[2],g),this.h[3]=a(this.h[3],y),this.h[4]=a(this.h[4],v),this.h[5]=a(this.h[5],w),this.h[6]=a(this.h[6],b),this.h[7]=a(this.h[7],M)},v.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h,"big"):n.split32(this.h,"big")}},{"../common":27,"../utils":37,"./common":36,"minimalistic-assert":41}],34:[function(t,e,r){arguments[4][14][0].apply(r,arguments)},{dup:14}],35:[function(t,e,r){"use strict";var n=t("../utils"),i=t("../common"),o=t("minimalistic-assert"),s=n.rotr64_hi,a=n.rotr64_lo,u=n.shr64_hi,h=n.shr64_lo,l=n.sum64,f=n.sum64_hi,c=n.sum64_lo,d=n.sum64_4_hi,p=n.sum64_4_lo,m=n.sum64_5_hi,g=n.sum64_5_lo,y=i.BlockHash,v=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function w(){if(!(this instanceof w))return new w;y.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=v,this.W=new Array(160)}n.inherits(w,y),(e.exports=w).blockSize=1024,w.outSize=512,w.hmacStrength=192,w.padLength=128,w.prototype._prepareBlock=function(t,e){for(var r=this.W,n=0;n<32;n++)r[n]=t[e+n];for(;n<r.length;n+=2){var i=function(t,e){return(e=s(t,e,19)^s(e,t,29)^(e=u(t,e,6)))<0&&(e+=4294967296),e}(r[n-4],r[n-3]),o=function(t,e){return(e=a(t,e,19)^a(e,t,29)^(e=h(t,e,6)))<0&&(e+=4294967296),e}(r[n-4],r[n-3]),l=r[n-14],f=r[n-13],c=function(t,e){return(e=s(t,e,1)^s(t,e,8)^(e=u(t,e,7)))<0&&(e+=4294967296),e}(r[n-30],r[n-29]),m=function(t,e){return(e=a(t,e,1)^a(t,e,8)^(e=h(t,e,7)))<0&&(e+=4294967296),e}(r[n-30],r[n-29]),g=r[n-32],y=r[n-31];r[n]=d(i,o,l,f,c,m,g,y),r[n+1]=p(i,o,l,f,c,m,g,y)}},w.prototype._update=function(t,e){this._prepareBlock(t,e);var r=this.W,n=this.h[0],i=this.h[1],u=this.h[2],h=this.h[3],d=this.h[4],p=this.h[5],y=this.h[6],v=this.h[7],w=this.h[8],b=this.h[9],M=this.h[10],_=this.h[11],A=this.h[12],E=this.h[13],x=this.h[14],S=this.h[15];o(this.k.length===r.length);for(var N=0;N<r.length;N+=2){var k=x,T=S,P=function(t,e){return(t=s(t,e,14)^s(t,e,18)^(t=s(e,t,9)))<0&&(t+=4294967296),t}(w,b),I=function(t,e){return(t=a(t,e,14)^a(t,e,18)^(t=a(e,t,9)))<0&&(t+=4294967296),t}(w,b),R=function(t,e,r){return(r=t&e^~t&r)<0&&(r+=4294967296),r}(w,M,A),O=function(t,e,r){return(r=t&e^~t&r)<0&&(r+=4294967296),r}(b,_,E),C=this.k[N],B=this.k[N+1],U=r[N],L=r[N+1],D=m(k,T,P,I,R,O,C,B,U,L);U=g(k,T,P,I,R,O,C,B,U,L),k=function(t,e){return(t=s(t,e,28)^s(e,t,2)^(t=s(e,t,7)))<0&&(t+=4294967296),t}(n,i),T=function(t,e){return(t=a(t,e,28)^a(e,t,2)^(t=a(e,t,7)))<0&&(t+=4294967296),t}(n,i),P=function(t,e,r){return(r=t&e^t&r^e&r)<0&&(r+=4294967296),r}(n,u,d),I=function(t,e,r){return(r=t&e^t&r^e&r)<0&&(r+=4294967296),r}(i,h,p),L=f(k,T,P,I),I=c(k,T,P,I),x=A,S=E,A=M,E=_,M=w,_=b,w=f(y,v,D,U),b=c(v,v,D,U),y=d,v=p,d=u,p=h,u=n,h=i,n=f(D,U,L,I),i=c(D,U,L,I)}l(this.h,0,n,i),l(this.h,2,u,h),l(this.h,4,d,p),l(this.h,6,y,v),l(this.h,8,w,b),l(this.h,10,M,_),l(this.h,12,A,E),l(this.h,14,x,S)},w.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h,"big"):n.split32(this.h,"big")}},{"../common":27,"../utils":37,"minimalistic-assert":41}],36:[function(t,e,r){"use strict";var n=t("../utils").rotr32;function i(t,e,r){return t&e^~t&r}function o(t,e,r){return t&e^t&r^e&r}function s(t,e,r){return t^e^r}r.ft_1=function(t,e,r,n){return 0===t?i(e,r,n):1===t||3===t?e^r^n:2===t?o(e,r,n):void 0},r.ch32=i,r.maj32=o,r.p32=s,r.s0_256=function(t){return n(t,2)^n(t,13)^n(t,22)},r.s1_256=function(t){return n(t,6)^n(t,11)^n(t,25)},r.g0_256=function(t){return n(t,7)^n(t,18)^t>>>3},r.g1_256=function(t){return n(t,17)^n(t,19)^t>>>10}},{"../utils":37}],37:[function(t,e,r){"use strict";var n=t("minimalistic-assert");function i(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function o(t){return 1===t.length?"0"+t:t}function s(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}t=t("inherits"),r.inherits=t,r.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),n=0;n<t.length;n+=2)r.push(parseInt(t[n]+t[n+1],16))}else for(var n=0;n<t.length;n++){var i=(o=t.charCodeAt(n))>>8,o=255&o;i?r.push(i,o):r.push(o)}else for(n=0;n<t.length;n++)r[n]=0|t[n];return r},r.toHex=function(t){for(var e="",r=0;r<t.length;r++)e+=o(t[r].toString(16));return e},r.htonl=i,r.toHex32=function(t,e){for(var r="",n=0;n<t.length;n++){var o=t[n];r+=s((o="little"===e?i(o):o).toString(16))}return r},r.zero2=o,r.zero8=s,r.join32=function(t,e,r,i){n((r-=e)%4==0);for(var o=new Array(r/4),s=0,a=e;s<o.length;s++,a+=4){var u="big"===i?t[a]<<24|t[a+1]<<16|t[a+2]<<8|t[a+3]:t[a+3]<<24|t[a+2]<<16|t[a+1]<<8|t[a];o[s]=u>>>0}return o},r.split32=function(t,e){for(var r=new Array(4*t.length),n=0,i=0;n<t.length;n++,i+=4){var o=t[n];"big"===e?(r[i]=o>>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=255&o):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=255&o)}return r},r.rotr32=function(t,e){return t>>>e|t<<32-e},r.rotl32=function(t,e){return t<<e|t>>>32-e},r.sum32=function(t,e){return t+e>>>0},r.sum32_3=function(t,e,r){return t+e+r>>>0},r.sum32_4=function(t,e,r,n){return t+e+r+n>>>0},r.sum32_5=function(t,e,r,n,i){return t+e+r+n+i>>>0},r.sum64=function(t,e,r,n){var i=t[e],o=n+t[e+1]>>>0;t[e]=(o<n?1:0)+r+i>>>0,t[e+1]=o},r.sum64_hi=function(t,e,r,n){return(e+n>>>0<e?1:0)+t+r>>>0},r.sum64_lo=function(t,e,r,n){return e+n>>>0},r.sum64_4_hi=function(t,e,r,n,i,o,s,a){var u=0,h=e;return u+=(h=e+n>>>0)<e?1:0,u+=(h=h+o>>>0)<o?1:0,t+r+i+s+(u+=(h=h+a>>>0)<a?1:0)>>>0},r.sum64_4_lo=function(t,e,r,n,i,o,s,a){return e+n+o+a>>>0},r.sum64_5_hi=function(t,e,r,n,i,o,s,a,u,h){var l=0,f=e;return l+=(f=e+n>>>0)<e?1:0,l+=(f=f+o>>>0)<o?1:0,l+=(f=f+a>>>0)<a?1:0,t+r+i+s+u+(l+=(f=f+h>>>0)<h?1:0)>>>0},r.sum64_5_lo=function(t,e,r,n,i,o,s,a,u,h){return e+n+o+a+h>>>0},r.rotr64_hi=function(t,e,r){return(e<<32-r|t>>>r)>>>0},r.rotr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0},r.shr64_hi=function(t,e,r){return t>>>r},r.shr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0}},{inherits:39,"minimalistic-assert":41}],38:[function(t,e,r){"use strict";var n=t("hash.js"),i=t("minimalistic-crypto-utils"),o=t("minimalistic-assert");function s(t){if(!(this instanceof s))return new s(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=i.toArray(t.entropy,t.entropyEnc||"hex"),r=i.toArray(t.nonce,t.nonceEnc||"hex");t=i.toArray(t.pers,t.persEnc||"hex"),o(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,t)}(e.exports=s).prototype._init=function(t,e,r){r=t.concat(e).concat(r),this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var n=0;n<this.V.length;n++)this.K[n]=0,this.V[n]=1;this._update(r),this._reseed=1,this.reseedInterval=281474976710656},s.prototype._hmac=function(){return new n.hmac(this.hash,this.K)},s.prototype._update=function(t){var e=this._hmac().update(this.V).update([0]);t&&(e=e.update(t)),this.K=e.digest(),this.V=this._hmac().update(this.V).digest(),t&&(this.K=this._hmac().update(this.V).update([1]).update(t).digest(),this.V=this._hmac().update(this.V).digest())},s.prototype.reseed=function(t,e,r,n){"string"!=typeof e&&(n=r,r=e,e=null),t=i.toArray(t,e),r=i.toArray(r,n),o(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},s.prototype.generate=function(t,e,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(n=r,r=e,e=null),r&&(r=i.toArray(r,n||"hex"),this._update(r));for(var o=[];o.length<t;)this.V=this._hmac().update(this.V).digest(),o=o.concat(this.V);return n=o.slice(0,t),this._update(r),this._reseed++,i.encode(n,e)}},{"hash.js":26,"minimalistic-assert":41,"minimalistic-crypto-utils":42}],39:[function(t,e,r){"function"==typeof Object.create?e.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(t,e){var r;e&&(t.super_=e,(r=function(){}).prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t)}},{}],40:[function(t,r,n){(function(t,e){(function(){!function(){"use strict";for(var n="object"==typeof window?window:{},i=!(n=!n.JS_SHA3_NO_NODE_JS&&"object"==typeof t&&t.versions&&t.versions.node?e:n).JS_SHA3_NO_COMMON_JS&&"object"==typeof r&&r.exports,o="0123456789abcdef".split(""),s=[0,8,16,24],a=[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],u=[224,256,384,512],h=["hex","buffer","arrayBuffer","array"],l=function(t,e,r){return function(n){return new M(t,e,t).update(n)[r]()}},f=function(t,e,r){return function(n,i){return new M(t,e,i).update(n)[r]()}},c=function(t,e){var r=l(t,e,"hex");r.create=function(){return new M(t,e,t)},r.update=function(t){return r.create().update(t)};for(var n=0;n<h.length;++n){var i=h[n];r[i]=l(t,e,i)}return r},d=[{name:"keccak",padding:[1,256,65536,16777216],bits:u,createMethod:c},{name:"sha3",padding:[6,1536,393216,100663296],bits:u,createMethod:c},{name:"shake",padding:[31,7936,2031616,520093696],bits:[128,256],createMethod:function(t,e){var r=f(t,e,"hex");r.create=function(r){return new M(t,e,r)},r.update=function(t,e){return r.create(e).update(t)};for(var n=0;n<h.length;++n){var i=h[n];r[i]=f(t,e,i)}return r}}],p={},m=[],g=0;g<d.length;++g)for(var y=d[g],v=y.bits,w=0;w<v.length;++w){var b=y.name+"_"+v[w];m.push(b),p[b]=y.createMethod(v[w],y.padding)}function M(t,e,r){this.blocks=[],this.s=[],this.padding=e,this.outputBits=r,this.reset=!0,this.block=0,this.start=0,this.blockCount=1600-(t<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}M.prototype.update=function(t){for(var e,r,n="string"!=typeof t,i=(t=n&&t.constructor===ArrayBuffer?new Uint8Array(t):t).length,o=this.blocks,a=this.byteCount,u=this.blockCount,h=0,l=this.s;h<i;){if(this.reset)for(this.reset=!1,o[0]=this.block,e=1;e<u+1;++e)o[e]=0;if(n)for(e=this.start;h<i&&e<a;++h)o[e>>2]|=t[h]<<s[3&e++];else for(e=this.start;h<i&&e<a;++h)(r=t.charCodeAt(h))<128?o[e>>2]|=r<<s[3&e++]:(r<2048?o[e>>2]|=(192|r>>6)<<s[3&e++]:(r<55296||57344<=r?o[e>>2]|=(224|r>>12)<<s[3&e++]:(r=65536+((1023&r)<<10|1023&t.charCodeAt(++h)),o[e>>2]|=(240|r>>18)<<s[3&e++],o[e>>2]|=(128|r>>12&63)<<s[3&e++]),o[e>>2]|=(128|r>>6&63)<<s[3&e++]),o[e>>2]|=(128|63&r)<<s[3&e++]);if(a<=(this.lastByteIndex=e)){for(this.start=e-a,this.block=o[u],e=0;e<u;++e)l[e]^=o[e];_(l),this.reset=!0}else this.start=e}return this},M.prototype.finalize=function(){var t=this.blocks,e=this.lastByteIndex,r=this.blockCount,n=this.s;if(t[e>>2]|=this.padding[3&e],this.lastByteIndex===this.byteCount)for(t[0]=t[r],e=1;e<r+1;++e)t[e]=0;for(t[r-1]|=2147483648,e=0;e<r;++e)n[e]^=t[e];_(n)},M.prototype.toString=M.prototype.hex=function(){this.finalize();for(var t,e=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,s=0,a=0,u="";a<n;){for(s=0;s<e&&a<n;++s,++a)t=r[s],u+=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];a%e==0&&(_(r),s=0)}return i&&(t=r[s],0<i&&(u+=o[t>>4&15]+o[15&t]),1<i&&(u+=o[t>>12&15]+o[t>>8&15]),2<i&&(u+=o[t>>20&15]+o[t>>16&15])),u},M.prototype.arrayBuffer=function(){this.finalize();for(var t=this.blockCount,e=this.s,r=this.outputBlocks,n=this.extraBytes,i=0,o=0,s=this.outputBits>>3,a=n?new ArrayBuffer(r+1<<2):new ArrayBuffer(s),u=new Uint32Array(a);o<r;){for(i=0;i<t&&o<r;++i,++o)u[o]=e[i];o%t==0&&_(e)}return n&&(u[i]=e[i],a=a.slice(0,s)),a},M.prototype.buffer=M.prototype.arrayBuffer,M.prototype.digest=M.prototype.array=function(){this.finalize();for(var t,e,r=this.blockCount,n=this.s,i=this.outputBlocks,o=this.extraBytes,s=0,a=0,u=[];a<i;){for(s=0;s<r&&a<i;++s,++a)e=n[s],u[t=a<<2]=255&e,u[t+1]=e>>8&255,u[t+2]=e>>16&255,u[t+3]=e>>24&255;a%r==0&&_(n)}return o&&(t=a<<2,e=n[s],0<o&&(u[t]=255&e),1<o&&(u[t+1]=e>>8&255),2<o&&(u[t+2]=e>>16&255)),u};var _=function(t){for(var e,r,n,i,o,s,u,h,l,f,c,d,p,m,g,y,v,w,b,M,_,A,E,x,S,N,k,T,P,I,R,O,C,B,U,L,D,j,F,z,H,G,q,V,K,Z,W,J,$,X,Y=0;Y<48;Y+=2)k=t[0]^t[10]^t[20]^t[30]^t[40],T=t[1]^t[11]^t[21]^t[31]^t[41],z=t[2]^t[12]^t[22]^t[32]^t[42],F=t[3]^t[13]^t[23]^t[33]^t[43],O=t[4]^t[14]^t[24]^t[34]^t[44],R=t[5]^t[15]^t[25]^t[35]^t[45],Z=t[6]^t[16]^t[26]^t[36]^t[46],K=t[7]^t[17]^t[27]^t[37]^t[47],p=t[8]^t[18]^t[28]^t[38]^t[48],f=(m=t[9]^t[19]^t[29]^t[39]^t[49])^(F<<1|z>>>31),t[0]^=l=p^(z<<1|F>>>31),t[1]^=f,t[10]^=l,t[11]^=f,t[20]^=l,t[21]^=f,t[30]^=l,t[31]^=f,t[40]^=l,t[41]^=f,f=T^(R<<1|O>>>31),t[2]^=l=k^(O<<1|R>>>31),t[3]^=f,t[12]^=l,t[13]^=f,t[22]^=l,t[23]^=f,t[32]^=l,t[33]^=f,t[42]^=l,t[43]^=f,f=F^(K<<1|Z>>>31),t[4]^=l=z^(Z<<1|K>>>31),t[5]^=f,t[14]^=l,t[15]^=f,t[24]^=l,t[25]^=f,t[34]^=l,t[35]^=f,t[44]^=l,t[45]^=f,f=R^(m<<1|p>>>31),t[6]^=l=O^(p<<1|m>>>31),t[7]^=f,t[16]^=l,t[17]^=f,t[26]^=l,t[27]^=f,t[36]^=l,t[37]^=f,t[46]^=l,t[47]^=f,f=K^(T<<1|k>>>31),t[8]^=l=Z^(k<<1|T>>>31),t[9]^=f,t[18]^=l,t[19]^=f,t[28]^=l,t[29]^=f,t[38]^=l,t[39]^=f,t[48]^=l,t[49]^=f,e=t[0],r=t[1],C=t[11]<<4|t[10]>>>28,B=t[10]<<4|t[11]>>>28,g=t[20]<<3|t[21]>>>29,y=t[21]<<3|t[20]>>>29,W=t[31]<<9|t[30]>>>23,J=t[30]<<9|t[31]>>>23,P=t[40]<<18|t[41]>>>14,I=t[41]<<18|t[40]>>>14,_=t[2]<<1|t[3]>>>31,A=t[3]<<1|t[2]>>>31,n=t[13]<<12|t[12]>>>20,i=t[12]<<12|t[13]>>>20,U=t[22]<<10|t[23]>>>22,L=t[23]<<10|t[22]>>>22,v=t[33]<<13|t[32]>>>19,w=t[32]<<13|t[33]>>>19,$=t[42]<<2|t[43]>>>30,X=t[43]<<2|t[42]>>>30,H=t[5]<<30|t[4]>>>2,G=t[4]<<30|t[5]>>>2,E=t[14]<<6|t[15]>>>26,x=t[15]<<6|t[14]>>>26,o=t[25]<<11|t[24]>>>21,s=t[24]<<11|t[25]>>>21,D=t[34]<<15|t[35]>>>17,j=t[35]<<15|t[34]>>>17,b=t[45]<<29|t[44]>>>3,M=t[44]<<29|t[45]>>>3,c=t[6]<<28|t[7]>>>4,d=t[7]<<28|t[6]>>>4,q=t[17]<<23|t[16]>>>9,V=t[16]<<23|t[17]>>>9,S=t[26]<<25|t[27]>>>7,N=t[27]<<25|t[26]>>>7,u=t[36]<<21|t[37]>>>11,h=t[37]<<21|t[36]>>>11,F=t[47]<<24|t[46]>>>8,z=t[46]<<24|t[47]>>>8,R=t[8]<<27|t[9]>>>5,O=t[9]<<27|t[8]>>>5,p=t[18]<<20|t[19]>>>12,m=t[19]<<20|t[18]>>>12,K=t[29]<<7|t[28]>>>25,Z=t[28]<<7|t[29]>>>25,k=t[38]<<8|t[39]>>>24,T=t[39]<<8|t[38]>>>24,l=t[48]<<14|t[49]>>>18,f=t[49]<<14|t[48]>>>18,t[0]=e^~n&o,t[1]=r^~i&s,t[10]=c^~p&g,t[11]=d^~m&y,t[20]=_^~E&S,t[21]=A^~x&N,t[30]=R^~C&U,t[31]=O^~B&L,t[40]=H^~q&K,t[41]=G^~V&Z,t[2]=n^~o&u,t[3]=i^~s&h,t[12]=p^~g&v,t[13]=m^~y&w,t[22]=E^~S&k,t[23]=x^~N&T,t[32]=C^~U&D,t[33]=B^~L&j,t[42]=q^~K&W,t[43]=V^~Z&J,t[4]=o^~u&l,t[5]=s^~h&f,t[14]=g^~v&b,t[15]=y^~w&M,t[24]=S^~k&P,t[25]=N^~T&I,t[34]=U^~D&F,t[35]=L^~j&z,t[44]=K^~W&$,t[45]=Z^~J&X,t[6]=u^~l&e,t[7]=h^~f&r,t[16]=v^~b&c,t[17]=w^~M&d,t[26]=k^~P&_,t[27]=T^~I&A,t[36]=D^~F&R,t[37]=j^~z&O,t[46]=W^~$&H,t[47]=J^~X&G,t[8]=l^~e&n,t[9]=f^~r&i,t[18]=b^~c&p,t[19]=M^~d&m,t[28]=P^~_&E,t[29]=I^~A&x,t[38]=F^~R&C,t[39]=z^~O&B,t[48]=$^~H&q,t[49]=X^~G&V,t[0]^=a[Y],t[1]^=a[Y+1]};if(i)r.exports=p;else for(g=0;g<m.length;++g)n[m[g]]=p[m[g]]}()}).call(this)}).call(this,t("_process"),void 0!==e?e:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:43}],41:[function(t,e,r){function n(t,e){if(!t)throw new Error(e||"Assertion failed")}(e.exports=n).equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)}},{}],42:[function(t,e,r){"use strict";function n(t){return 1===t.length?"0"+t:t}function i(t){for(var e="",r=0;r<t.length;r++)e+=n(t[r].toString(16));return e}r.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"!=typeof t){for(var n=0;n<t.length;n++)r[n]=0|t[n];return r}if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),n=0;n<t.length;n+=2)r.push(parseInt(t[n]+t[n+1],16));else for(n=0;n<t.length;n++){var i=(o=t.charCodeAt(n))>>8,o=255&o;i?r.push(i,o):r.push(o)}return r},r.zero2=n,r.toHex=i,r.encode=function(t,e){return"hex"===e?i(t):t}},{}],43:[function(t,e,r){e.exports={browser:!0}},{}],44:[function(t,e,r){(function(t){(function(){"use strict";function n(t){var e=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],r=1779033703,n=3144134277,i=1013904242,o=2773480762,s=1359893119,a=2600822924,u=528734635,h=1541459225,l=new Array(64);function f(t){for(var f=0,c=t.length;64<=c;){for(var d,p,m,g,y=r,v=n,w=i,b=o,M=s,_=a,A=u,E=h,x=0;x<16;x++)l[x]=(255&t[p=f+4*x])<<24|(255&t[p+1])<<16|(255&t[p+2])<<8|255&t[p+3];for(x=16;x<64;x++)m=((d=l[x-2])>>>17|d<<15)^(d>>>19|d<<13)^d>>>10,d=l[x-15],l[x]=(m+l[x-7]|0)+((g=(d>>>7|d<<25)^(d>>>18|d<<14)^d>>>3)+l[x-16]|0)|0;for(x=0;x<64;x++)m=(((M>>>6|M<<26)^(M>>>11|M<<21)^(M>>>25|M<<7))+(M&_^~M&A)|0)+(E+(e[x]+l[x]|0)|0)|0,g=((y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10))+(y&v^y&w^v&w)|0,E=A,A=_,_=M,M=b+m|0,b=w,w=v,v=y,y=m+g|0;r=r+y|0,n=n+v|0,i=i+w|0,o=o+b|0,s=s+M|0,a=a+_|0,u=u+A|0,h=h+E|0,f+=64,c-=64}}f(t);var c,d=t.length%64,p=t.length/536870912|0,m=t.length<<3,g=d<56?56:120,y=t.slice(t.length-d,t.length);for(y.push(128),c=1+d;c<g;c++)y.push(0);return y.push(p>>>24&255),y.push(p>>>16&255),y.push(p>>>8&255),y.push(p>>>0&255),y.push(m>>>24&255),y.push(m>>>16&255),y.push(m>>>8&255),y.push(m>>>0&255),f(y),[r>>>24&255,r>>>16&255,r>>>8&255,r>>>0&255,n>>>24&255,n>>>16&255,n>>>8&255,n>>>0&255,i>>>24&255,i>>>16&255,i>>>8&255,i>>>0&255,o>>>24&255,o>>>16&255,o>>>8&255,o>>>0&255,s>>>24&255,s>>>16&255,s>>>8&255,s>>>0&255,a>>>24&255,a>>>16&255,a>>>8&255,a>>>0&255,u>>>24&255,u>>>16&255,u>>>8&255,u>>>0&255,h>>>24&255,h>>>16&255,h>>>8&255,h>>>0&255]}function i(t,e,r){t=t.length<=64?t:n(t);for(var i=64+e.length+4,o=new Array(i),s=new Array(64),a=[],u=0;u<64;u++)o[u]=54;for(u=0;u<t.length;u++)o[u]^=t[u];for(u=0;u<e.length;u++)o[64+u]=e[u];for(u=i-4;u<i;u++)o[u]=0;for(u=0;u<64;u++)s[u]=92;for(u=0;u<t.length;u++)s[u]^=t[u];function h(){for(var t=i-1;i-4<=t;t--){if(o[t]++,o[t]<=255)return;o[t]=0}}for(;32<=r;)h(),a=a.concat(n(s.concat(n(o)))),r-=32;return 0<r&&(h(),a=a.concat(n(s.concat(n(o))).slice(0,r))),a}function o(t,e,r,n,i){var o;for(u(t,16*(2*r-1),i,0,16),o=0;o<2*r;o++)a(t,16*o,i,16),function(t,e){u(t,0,e,0,16);for(var r=8;0<r;r-=2)e[4]^=s(e[0]+e[12],7),e[8]^=s(e[4]+e[0],9),e[12]^=s(e[8]+e[4],13),e[0]^=s(e[12]+e[8],18),e[9]^=s(e[5]+e[1],7),e[13]^=s(e[9]+e[5],9),e[1]^=s(e[13]+e[9],13),e[5]^=s(e[1]+e[13],18),e[14]^=s(e[10]+e[6],7),e[2]^=s(e[14]+e[10],9),e[6]^=s(e[2]+e[14],13),e[10]^=s(e[6]+e[2],18),e[3]^=s(e[15]+e[11],7),e[7]^=s(e[3]+e[15],9),e[11]^=s(e[7]+e[3],13),e[15]^=s(e[11]+e[7],18),e[1]^=s(e[0]+e[3],7),e[2]^=s(e[1]+e[0],9),e[3]^=s(e[2]+e[1],13),e[0]^=s(e[3]+e[2],18),e[6]^=s(e[5]+e[4],7),e[7]^=s(e[6]+e[5],9),e[4]^=s(e[7]+e[6],13),e[5]^=s(e[4]+e[7],18),e[11]^=s(e[10]+e[9],7),e[8]^=s(e[11]+e[10],9),e[9]^=s(e[8]+e[11],13),e[10]^=s(e[9]+e[8],18),e[12]^=s(e[15]+e[14],7),e[13]^=s(e[12]+e[15],9),e[14]^=s(e[13]+e[12],13),e[15]^=s(e[14]+e[13],18);for(r=0;r<16;++r)t[r]+=e[r]}(i,n),u(i,0,t,e+16*o,16);for(o=0;o<r;o++)u(t,e+2*o*16,t,16*o,16);for(o=0;o<r;o++)u(t,e+16*(2*o+1),t,16*(o+r),16)}function s(t,e){return t<<e|t>>>32-e}function a(t,e,r,n){for(var i=0;i<n;i++)r[i]^=t[e+i]}function u(t,e,r,n,i){for(;i--;)r[n++]=t[e++]}function h(t){if(t&&"number"==typeof t.length){for(var e=0;e<t.length;e++){if("number"!=typeof t[e])return;var r=parseInt(t[e]);if(r!=t[e]||r<0||256<=r)return}return 1}}function l(t,e){var r=parseInt(t);if(t!=r)throw new Error("invalid "+e);return r}function f(e,r,n,s,f,c,p){if(!p)throw new Error("missing callback");if(n=l(n,"N"),s=l(s,"r"),f=l(f,"p"),c=l(c,"dkLen"),0===n||0!=(n&n-1))throw new Error("N must be power of 2");if(d/128/s<n)throw new Error("N too large");if(d/128/f<s)throw new Error("r too large");if(!h(e))throw new Error("password must be an array or buffer");if(e=Array.prototype.slice.call(e),!h(r))throw new Error("salt must be an array or buffer");r=Array.prototype.slice.call(r);for(var m=i(e,r,128*f*s),g=new Uint32Array(32*f*s),y=0;y<g.length;y++){var v=4*y;g[y]=(255&m[3+v])<<24|(255&m[2+v])<<16|(255&m[1+v])<<8|(255&m[0+v])<<0}var w,b,M=new Uint32Array(64*s),_=new Uint32Array(32*s*n),A=32*s,E=new Uint32Array(16),x=new Uint32Array(16),S=f*n*2,N=0,k=null,T=!1,P=0,I=0,R=parseInt(1e3/s),O=void 0!==t?t:setTimeout,C=function(){if(T)return p(new Error("cancelled"),N/S);switch(P){case 0:u(g,b=32*I*s,M,0,A),P=1,w=0;case 1:R<(r=n-w)&&(r=R);for(var t=0;t<r;t++)u(M,0,_,(w+t)*A,A),o(M,A,s,E,x);if(w+=r,N+=r,(l=parseInt(1e3*N/S))!==k){if(T=p(null,N/S))break;k=l}if(w<n)break;w=0,P=2;case 2:var r;for(R<(r=n-w)&&(r=R),t=0;t<r;t++){var h=M[16*(2*s-1)]&n-1;a(_,h*A,M,A),o(M,A,s,E,x)}if(w+=r,N+=r,(l=parseInt(1e3*N/S))!==k){if(T=p(null,N/S))break;k=l}if(w<n)break;if(u(M,0,g,b,A),++I<f){P=0;break}for(m=[],t=0;t<g.length;t++)m.push(g[t]>>0&255),m.push(g[t]>>8&255),m.push(g[t]>>16&255),m.push(g[t]>>24&255);var l=i(e,m,c);return p(null,1,l)}O(C)};C()}var c,d;c=this,d=2147483647,void 0!==r?e.exports=f:c&&(c.scrypt&&(c._scrypt=c.scrypt),c.scrypt=f)}).call(this)}).call(this,t("timers").setImmediate)},{timers:46}],45:[function(t,r,n){(function(t,e,r){(function(){!function(e,r){"use strict";var n,i,o,s,a,u,h,l;function f(t){return i[n]=c.apply(r,t),n++}function c(t){var e=[].slice.call(arguments,1);return function(){"function"==typeof t?t.apply(r,e):new Function(""+t)()}}function d(t){if(o)setTimeout(c(d,t),0);else{var e=i[t];if(e){o=!0;try{e()}finally{p(t),o=!1}}}}function p(t){delete i[t]}function m(){function t(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(r)&&d(+t.data.slice(r.length))}var r="setImmediate$"+Math.random()+"$";e.addEventListener?e.addEventListener("message",t,!1):e.attachEvent("onmessage",t),a=function(){var t=f(arguments);return e.postMessage(r+t,"*"),t}}e.setImmediate||(n=1,o=!(i={}),s=e.document,l=(l=Object.getPrototypeOf&&Object.getPrototypeOf(e))&&l.setTimeout?l:e,"[object process]"==={}.toString.call(e.process)?a=function(){var e=f(arguments);return t.nextTick(c(d,e)),e}:function(){if(e.postMessage&&!e.importScripts){var t=!0,r=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=r,t}}()?m():a=e.MessageChannel?((h=new MessageChannel).port1.onmessage=function(t){d(t.data)},function(){var t=f(arguments);return h.port2.postMessage(t),t}):s&&"onreadystatechange"in s.createElement("script")?(u=s.documentElement,function(){var t=f(arguments),e=s.createElement("script");return e.onreadystatechange=function(){d(t),e.onreadystatechange=null,u.removeChild(e),e=null},u.appendChild(e),t}):function(){var t=f(arguments);return setTimeout(c(d,t),0),t},l.setImmediate=a,l.clearImmediate=p)}("undefined"==typeof self?void 0===e?this:e:self)}).call(this)}).call(this,t("_process"),void 0!==e?e:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("timers").clearImmediate)},{_process:43,timers:46}],46:[function(t,r,n){(function(t){(function(){r.exports={setImmediate:t.setImmediate}}).call(this)}).call(this,void 0!==e?e:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],47:[function(t,r,n){(function(t){(function(){var e,n,i;t.crypto&&crypto.getRandomValues&&(e=new Uint8Array(16),n=function(){return crypto.getRandomValues(e),e}),n||(i=new Array(16),n=function(){for(var t,e=0;e<16;e++)0==(3&e)&&(t=4294967296*Math.random()),i[e]=t>>>((3&e)<<3)&255;return i}),r.exports=n}).call(this)}).call(this,void 0!==e?e:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],48:[function(t,e,r){for(var n=t("./rng"),i=[],o={},s=0;s<256;s++)i[s]=(s+256).toString(16).substr(1),o[i[s]]=s;function a(t,e){return e=e||0,i[t[e++]]+i[t[e++]]+i[t[e++]]+i[t[e++]]+"-"+i[t[e++]]+i[t[e++]]+"-"+i[t[e++]]+i[t[e++]]+"-"+i[t[e++]]+i[t[e++]]+"-"+i[t[e++]]+i[t[e++]]+i[t[e++]]+i[t[e++]]+i[t[e++]]+i[t[e++]]}var u=[1|(t=n())[0],t[1],t[2],t[3],t[4],t[5]],h=16383&(t[6]<<8|t[7]),l=0,f=0;function c(t,e,r){var i=e&&r||0;"string"==typeof t&&(e="binary"==t?new Array(16):null,t=null);var o=(t=t||{}).random||(t.rng||n)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,e)for(var s=0;s<16;s++)e[i+s]=o[s];return e||a(o)}(t=c).v1=function(t,e,r){var n=e&&r||0,i=e||[],o=void 0!==(t=t||{}).clockseq?t.clockseq:h,s=void 0!==t.msecs?t.msecs:(new Date).getTime(),c=void 0!==t.nsecs?t.nsecs:f+1;if((r=s-l+(c-f)/1e4)<0&&void 0===t.clockseq&&(o=o+1&16383),1e4<=(c=(r<0||l<s)&&void 0===t.nsecs?0:c))throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");l=s,h=o,c=(1e4*(268435455&(s+=122192928e5))+(f=c))%4294967296,i[n++]=c>>>24&255,i[n++]=c>>>16&255,i[n++]=c>>>8&255,i[n++]=255&c,s=s/4294967296*1e4&268435455,i[n++]=s>>>8&255,i[n++]=255&s,i[n++]=s>>>24&15|16,i[n++]=s>>>16&255,i[n++]=o>>>8|128,i[n++]=255&o;for(var d=t.node||u,p=0;p<6;p++)i[n+p]=d[p];return e||a(i)},t.v4=c,t.parse=function(t,e,r){var n=e&&r||0,i=0;for(e=e||[],t.toLowerCase().replace(/[0-9a-f]{2}/g,(function(t){i<16&&(e[n+i++]=o[t])}));i<16;)e[n+i++]=0;return e},t.unparse=a,e.exports=t},{"./rng":47}],49:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});try{e.exports.XMLHttpRequest=XMLHttpRequest}catch(t){console.log("Warning: XMLHttpRequest is not defined"),e.exports.XMLHttpRequest=null}},{}],50:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("../utils/properties");function i(){n.setType(this,"Provider")}i.isProvider=function(t){return n.isType(t,"Provider")},t=i,r.Provider=t},{"../utils/properties":74}],51:[function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var s=t("../utils/address"),a=t("../utils/bignumber"),u=t("../utils/bytes"),h=t("../constants"),l=t("../utils/hash"),f=t("../utils/networks"),c=t("../utils/properties"),d=t("../utils/rlp"),p=t("../utils/transaction"),m=t("../utils/utf8"),g=t("../utils/web"),y=o(t("../errors")),v=t("./abstract-provider");function w(t,e){var r,n={};for(r in t)try{var i=t[r](e[r]);void 0!==i&&(n[r]=i)}catch(t){throw t.checkKey=r,t.checkValue=e[r],t}return n}function b(t,e){return function(r){return null==r?e:t(r)}}function M(t){return function(e){if(!Array.isArray(e))throw new Error("not an array");var r=[];return e.forEach((function(e){r.push(t(e))})),r}}function _(t,e){return"string"==typeof t&&(e||"0x"===t.substring(0,2)||(t="0x"+t),32===u.hexDataLength(t))?t.toLowerCase():(y.throwError("invalid hash",y.INVALID_ARGUMENT,{arg:"hash",value:t}),null)}function A(t){return a.bigNumberify(t).toNumber()}function E(t){if(!u.isHexString(t))throw new Error("invalid uint256");for(;t.length<66;)t="0x0"+t.substring(2);return t}function x(t){if(null==t)return"latest";if("earliest"===t)return"0x0";if("latest"===t||"pending"===t)return t;if("number"==typeof t)return u.hexStripZeros(u.hexlify(t));if(u.isHexString(t))return u.hexStripZeros(t);throw new Error("invalid blockTag")}var S={hash:_,blockHash:b(_,null),blockNumber:b(A,null),transactionIndex:b(A,null),confirmations:b(A,null),from:s.getAddress,gasPrice:a.bigNumberify,gasLimit:a.bigNumberify,to:b(s.getAddress,null),value:a.bigNumberify,nonce:A,data:u.hexlify,r:b(E),s:b(E),v:b(A),creates:b(s.getAddress,null),raw:b(u.hexlify)};function N(t){null!=t.gas&&null==t.gasLimit&&(t.gasLimit=t.gas),t.to&&a.bigNumberify(t.to).isZero()&&(t.to="0x0000000000000000000000000000000000000000"),null!=t.input&&null==t.data&&(t.data=t.input),null==t.to&&null==t.creates&&(t.creates=s.getContractAddress(t)),t.raw||t.v&&t.r&&t.s&&(r=[u.stripZeros(u.hexlify(t.nonce)),u.stripZeros(u.hexlify(t.gasPrice)),u.stripZeros(u.hexlify(t.gasLimit)),t.to||"0x",u.stripZeros(u.hexlify(t.value||"0x")),u.hexlify(t.data||"0x"),u.stripZeros(u.hexlify(t.v||"0x")),u.stripZeros(u.hexlify(t.r)),u.stripZeros(u.hexlify(t.s))],t.raw=d.encode(r));var e=w(S,t),r=t.networkId;return null!=t.chainId&&null==r&&null==e.v&&(r=t.chainId),"number"!=typeof(r=u.isHexString(r)?a.bigNumberify(r).toNumber():r)&&null!=e.v&&((r=(e.v-35)/2)<0&&(r=0),r=parseInt(r)),e.networkId=r="number"!=typeof r?0:r,null==e.chainId&&null!=r&&(e.chainId=r),e.blockHash&&"x"===e.blockHash.replace(/0/g,"")&&(e.blockHash=null),e}var k={hash:_,parentHash:_,number:A,timestamp:A,nonce:b(u.hexlify),difficulty:function(t){t=a.bigNumberify(t);try{return t.toNumber()}catch(t){}return null},gasLimit:a.bigNumberify,gasUsed:a.bigNumberify,miner:s.getAddress,extraData:u.hexlify,transactions:b(M(_))},T=c.shallowCopy(k);function P(t,e){return null!=t.author&&null==t.miner&&(t.miner=t.author),w(e?T:k,t)}T.transactions=b(M(N));var I={from:b(s.getAddress),nonce:b(A),gasLimit:b(a.bigNumberify),gasPrice:b(a.bigNumberify),to:b(s.getAddress),value:b(a.bigNumberify),data:b(u.hexlify)};function R(t){return w(I,t)}var O={transactionLogIndex:b(A),transactionIndex:A,blockNumber:A,transactionHash:_,address:s.getAddress,topics:M(_),data:u.hexlify,logIndex:A,blockHash:_},C={to:b(s.getAddress,null),from:b(s.getAddress,null),contractAddress:b(s.getAddress,null),transactionIndex:A,root:b(_),gasUsed:a.bigNumberify,logsBloom:b(u.hexlify),blockHash:_,transactionHash:_,logs:M((function(t){return w(O,t)})),blockNumber:A,confirmations:b(A,null),cumulativeGasUsed:a.bigNumberify,status:b(A)};function B(t){return Array.isArray(t)?t.forEach((function(t){B(t)})):null!=t&&_(t),t}var U,L,D,j={fromBlock:b(x,void 0),toBlock:b(x,void 0),address:b(s.getAddress,void 0),topics:b(B,void 0)},F={blockHash:b(_,void 0),address:b(s.getAddress,void 0),topics:b(B,void 0)},z={blockNumber:b(A),blockHash:b(_),transactionIndex:A,removed:b((function(t){if("boolean"==typeof t)return t;if("string"==typeof t){if("true"===t)return!0;if("false"===t)return!1}throw new Error("invaid boolean - "+t)})),address:s.getAddress,data:(U=u.hexlify,L="0x",function(t){return t?U(t):L}),topics:M(_),transactionHash:_,logIndex:A};function H(t){return w(z,t)}function G(t){return t.map((function(t){return"string"==typeof t?t:Array.isArray(t)?(t.forEach((function(t){null!==t&&32!==u.hexDataLength(t)&&y.throwError("invalid topic",y.INVALID_ARGUMENT,{argument:"topic",value:t})})),t.join(",")):null===t?"":y.throwError("invalid topic value",y.INVALID_ARGUMENT,{argument:"topic",value:t})})).join("&")}function q(t){if("string"==typeof t){if(20===u.hexDataLength(t))return"address:"+s.getAddress(t);if(t=t.toLowerCase(),32===u.hexDataLength(t))return"tx:"+t;if(-1===t.indexOf(":"))return t}else{if(Array.isArray(t))return"filter::"+G(t);if(t&&"object"==typeof t)return"filter:"+(t.address||"")+":"+G(t.topics||[])}throw new Error("invalid event - "+t)}function V(){return(new Date).getTime()}function K(t){var e,r=D.call(this)||this;return y.checkNew(r,v.Provider),t instanceof Promise?(c.defineReadOnly(r,"ready",t.then((function(t){return c.defineReadOnly(r,"_network",t),t}))),r.ready.catch((function(t){}))):(e=f.getNetwork(null==t?"homestead":t))?(c.defineReadOnly(r,"_network",e),c.defineReadOnly(r,"ready",Promise.resolve(r._network))):y.throwError("invalid network",y.INVALID_ARGUMENT,{arg:"network",value:t}),r._lastBlockNumber=-2,r._balances={},r._events=[],r._pollingInterval=4e3,r._emitted={block:-2},r._fastQueryDate=0,r}i(K,D=v.Provider),K.prototype._doPoll=function(){var t=this;this.getBlockNumber().then((function(e){if(t.polling&&(t._setFastBlockNumber(e),e!==t._lastBlockNumber)){-2===t._emitted.block&&(t._emitted.block=e-1);for(var r=t._emitted.block+1;r<=e;r++)t.emit("block",r);t._emitted.block!==e&&(t._emitted.block=e,Object.keys(t._emitted).forEach((function(r){var n;"block"===r||"pending"!==(n=t._emitted[r])&&12<e-n&&delete t._emitted[r]}))),-2===t._lastBlockNumber&&(t._lastBlockNumber=e-1);var n={},i={};return t._events.forEach((function(t){i[t.tag]=!0})),Object.keys(i).forEach((function(r){var i=r.split(":");switch(i[0]){case"tx":var o=i[1];t.getTransactionReceipt(o).then((function(e){return e&&null!=e.blockNumber&&(t._emitted["t:"+o]=e.blockNumber,t.emit(o,e)),null})).catch((function(e){t.emit("error",e)}));break;case"address":var s=i[1];t._balances[s]&&(n[s]=t._balances[s]),t.getBalance(s,"latest").then((function(e){var r=t._balances[s];if(!r||!e.eq(r))return t._balances[s]=e,t.emit(s,e),null})).catch((function(e){t.emit("error",e)}));break;case"filter":var a=i[2].split(/&/g).map((function(t){var e=t.split(",");return 1===e.length?""===e[0]?null:t:e.map((function(t){return""===t?null:t}))})),u={address:i[1],fromBlock:t._lastBlockNumber+1,toBlock:e,topics:a};u.address||delete u.address,t.getLogs(u).then((function(e){if(0!==e.length)return e.forEach((function(e){t._emitted["b:"+e.blockHash]=e.blockNumber,t._emitted["t:"+e.transactionHash]=e.blockNumber,t.emit(u,e)})),null})).catch((function(e){t.emit("error",e)}))}})),t._lastBlockNumber=e,t._balances=n,null}})).catch((function(t){})),this.doPoll()},K.prototype.resetEventsBlock=function(t){this._lastBlockNumber=t-1,this.polling&&this._doPoll()},Object.defineProperty(K.prototype,"network",{get:function(){return this._network},enumerable:!0,configurable:!0}),K.prototype.getNetwork=function(){return this.ready},Object.defineProperty(K.prototype,"blockNumber",{get:function(){return this._fastBlockNumber},enumerable:!0,configurable:!0}),Object.defineProperty(K.prototype,"polling",{get:function(){return null!=this._poller},set:function(t){var e=this;setTimeout((function(){t&&!e._poller?(e._poller=setInterval(e._doPoll.bind(e),e.pollingInterval),e._doPoll()):!t&&e._poller&&(clearInterval(e._poller),e._poller=null)}),0)},enumerable:!0,configurable:!0}),Object.defineProperty(K.prototype,"pollingInterval",{get:function(){return this._pollingInterval},set:function(t){var e=this;if("number"!=typeof t||t<=0||parseInt(String(t))!=t)throw new Error("invalid polling interval");this._pollingInterval=t,this._poller&&(clearInterval(this._poller),this._poller=setInterval((function(){e._doPoll()}),this._pollingInterval))},enumerable:!0,configurable:!0}),K.prototype._getFastBlockNumber=function(){var t=this,e=V();return e-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=e,this._fastBlockNumberPromise=this.getBlockNumber().then((function(e){return(null==t._fastBlockNumber||e>t._fastBlockNumber)&&(t._fastBlockNumber=e),t._fastBlockNumber}))),this._fastBlockNumberPromise},K.prototype._setFastBlockNumber=function(t){null!=this._fastBlockNumber&&t<this._fastBlockNumber||(this._fastQueryDate=V(),(null==this._fastBlockNumber||t>this._fastBlockNumber)&&(this._fastBlockNumber=t,this._fastBlockNumberPromise=Promise.resolve(t)))},K.prototype.waitForTransaction=function(t,e){var r=this;return null==e&&(e=1),this.getTransactionReceipt(t).then((function(n){return 0===e||n&&n.confirmations>=e?n:new Promise((function(n){var i=function(o){o.confirmations<e||(r.removeListener(t,i),n(o))};r.on(t,i)}))}))},K.prototype.getBlockNumber=function(){var t=this;return this.ready.then((function(){return t.perform("getBlockNumber",{}).then((function(e){var r=parseInt(e);if(r!=e)throw new Error("invalid response - getBlockNumber");return t._setFastBlockNumber(r),r}))}))},K.prototype.getGasPrice=function(){var t=this;return this.ready.then((function(){return t.perform("getGasPrice",{}).then((function(t){return a.bigNumberify(t)}))}))},K.prototype.getBalance=function(t,e){var r=this;return this.ready.then((function(){return c.resolveProperties({addressOrName:t,blockTag:e}).then((function(t){var e=t.addressOrName,n=t.blockTag;return r._getAddress(e).then((function(t){return t={address:t,blockTag:x(n)},r.perform("getBalance",t).then((function(t){return a.bigNumberify(t)}))}))}))}))},K.prototype.getTransactionCount=function(t,e){var r=this;return this.ready.then((function(){return c.resolveProperties({addressOrName:t,blockTag:e}).then((function(t){var e=t.addressOrName,n=t.blockTag;return r._getAddress(e).then((function(t){return t={address:t,blockTag:x(n)},r.perform("getTransactionCount",t).then((function(t){return a.bigNumberify(t).toNumber()}))}))}))}))},K.prototype.getCode=function(t,e){var r=this;return this.ready.then((function(){return c.resolveProperties({addressOrName:t,blockTag:e}).then((function(t){var e=t.addressOrName,n=t.blockTag;return r._getAddress(e).then((function(t){return t={address:t,blockTag:x(n)},r.perform("getCode",t).then((function(t){return u.hexlify(t)}))}))}))}))},K.prototype.getStorageAt=function(t,e,r){var n=this;return this.ready.then((function(){return c.resolveProperties({addressOrName:t,position:e,blockTag:r}).then((function(t){var e=t.addressOrName,r=t.position,i=t.blockTag;return n._getAddress(e).then((function(t){return t={address:t,blockTag:x(i),position:u.hexStripZeros(u.hexlify(r))},n.perform("getStorageAt",t).then((function(t){return u.hexlify(t)}))}))}))}))},K.prototype.sendTransaction=function(t){var e=this;return this.ready.then((function(){return c.resolveProperties({signedTransaction:t}).then((function(t){var r=t.signedTransaction;return t={signedTransaction:u.hexlify(r)},e.perform("sendTransaction",t).then((function(t){return e._wrapTransaction(p.parse(r),t)}),(function(t){throw t.transaction=p.parse(r),t.transaction.hash&&(t.transactionHash=t.transaction.hash),t}))}))}))},K.prototype._wrapTransaction=function(t,e){var r=this;if(null!=e&&32!==u.hexDataLength(e))throw new Error("invalid response - sendTransaction");var n=t;return null!=e&&t.hash!==e&&y.throwError("Transaction hash mismatch from Provider.sendTransaction.",y.UNKNOWN_ERROR,{expectedHash:t.hash,returnedHash:e}),n.wait=function(e){return 0!==e&&(r._emitted["t:"+t.hash]="pending"),r.waitForTransaction(t.hash,e).then((function(n){return null==n&&0===e?null:(r._emitted["t:"+t.hash]=n.blockNumber,0===n.status&&y.throwError("transaction failed",y.CALL_EXCEPTION,{transactionHash:t.hash,transaction:t}),n)}))},n},K.prototype.call=function(t,e){var r=this,n=c.shallowCopy(t);return this.ready.then((function(){return c.resolveProperties({blockTag:e,tx:n}).then((function(t){var e=t.blockTag;return t=t.tx,r._resolveNames(t,["to","from"]).then((function(t){return t={blockTag:x(e),transaction:R(t)},r.perform("call",t).then((function(t){return u.hexlify(t)}))}))}))}))},K.prototype.estimateGas=function(t){var e=this,r={to:t.to,from:t.from,data:t.data,gasPrice:t.gasPrice,value:t.value};return this.ready.then((function(){return c.resolveProperties(r).then((function(t){return e._resolveNames(t,["to","from"]).then((function(t){return t={transaction:R(t)},e.perform("estimateGas",t).then((function(t){return a.bigNumberify(t)}))}))}))}))},K.prototype.getBlock=function(t,e){var r=this;return this.ready.then((function(){return c.resolveProperties({blockHashOrBlockTag:t}).then((function(t){t=t.blockHashOrBlockTag;try{var n=u.hexlify(t);if(32===u.hexDataLength(n))return g.poll((function(){return r.perform("getBlock",{blockHash:n,includeTransactions:!!e}).then((function(t){return null==t?null==r._emitted["b:"+n]?null:void 0:P(t,e)}))}),{onceBlock:r})}catch(t){}try{var i=-128,o=x(t);return u.isHexString(o)&&(i=parseInt(o.substring(2),16)),g.poll((function(){return r.perform("getBlock",{blockTag:o,includeTransactions:!!e}).then((function(t){return null==t?i<=r._emitted.block?void 0:null:P(t,e)}))}),{onceBlock:r})}catch(t){}throw new Error("invalid block hash or block tag")}))}))},K.prototype.getTransaction=function(t){var e=this;return this.ready.then((function(){return c.resolveProperties({transactionHash:t}).then((function(t){var r=t.transactionHash,n={transactionHash:_(r,!0)};return g.poll((function(){return e.perform("getTransaction",n).then((function(t){if(null==t)return null==e._emitted["t:"+r]?null:void 0;var n=K.checkTransactionResponse(t);if(null==n.blockNumber)n.confirmations=0;else if(null==n.confirmations)return e._getFastBlockNumber().then((function(t){return t=t-n.blockNumber+1,n.confirmations=t=t<=0?1:t,e._wrapTransaction(n)}));return e._wrapTransaction(n)}))}),{onceBlock:e})}))}))},K.prototype.getTransactionReceipt=function(t){var e=this;return this.ready.then((function(){return c.resolveProperties({transactionHash:t}).then((function(t){var r=t.transactionHash,n={transactionHash:_(r,!0)};return g.poll((function(){return e.perform("getTransactionReceipt",n).then((function(t){if(null==t)return null==e._emitted["t:"+r]?null:void 0;if(null!=t.blockHash){var n,i=((t=w(C,n=t)).logs.forEach((function(t,e){null==t.transactionLogIndex&&(t.transactionLogIndex=e)})),null!=n.status&&(t.byzantium=!0),t);if(null==i.blockNumber)i.confirmations=0;else if(null==i.confirmations)return e._getFastBlockNumber().then((function(t){return t=t-i.blockNumber+1,i.confirmations=t=t<=0?1:t,i}));return i}}))}),{onceBlock:e})}))}))},K.prototype.getLogs=function(t){var e=this;return this.ready.then((function(){return c.resolveProperties(t).then((function(t){return e._resolveNames(t,["address"]).then((function(t){return t={filter:(t=t)&&t.blockHash?w(F,t):w(j,t)},e.perform("getLogs",t).then((function(t){return M(H)(t)}))}))}))}))},K.prototype.getEtherPrice=function(){var t=this;return this.ready.then((function(){return t.perform("getEtherPrice",{}).then((function(t){return t}))}))},K.prototype._getAddress=function(t){return this.resolveName(t).then((function(e){return null==e&&y.throwError("ENS name not configured",y.UNSUPPORTED_OPERATION,{operation:"resolveName("+JSON.stringify(t)+")"}),e}))},K.prototype._resolveNames=function(t,e){var r=[],n=c.shallowCopy(t);return e.forEach((function(t){null!=n[t]&&r.push(this._getAddress(n[t]).then((function(e){n[t]=e})))}),this),Promise.all(r).then((function(){return n}))},K.prototype._getResolver=function(t){var e=this;return this.getNetwork().then((function(r){r.ensAddress||y.throwError("network does not support ENS",y.UNSUPPORTED_OPERATION,{operation:"ENS",network:r.name});var n="0x0178b8bf"+l.namehash(t).substring(2);return n={to:r.ensAddress,data:n},e.call(n).then((function(t){return 32!==u.hexDataLength(t)||(t=s.getAddress(u.hexDataSlice(t,12)))===h.AddressZero?null:t}))}))},K.prototype.resolveName=function(t){var e=this;if(t instanceof Promise)return t.then((function(t){return e.resolveName(t)}));try{return Promise.resolve(s.getAddress(t))}catch(e){if(u.isHexString(t))throw e}var r=this,n=l.namehash(t);return this._getResolver(t).then((function(t){if(null==t)return null;var e="0x3b3b57de"+n.substring(2);return r.call({to:t,data:e})})).then((function(t){return 32!==u.hexDataLength(t)||(t=s.getAddress(u.hexDataSlice(t,12)))===h.AddressZero?null:t}))},K.prototype.lookupAddress=function(t){var e=this;if(t instanceof Promise)return t.then((function(t){return e.lookupAddress(t)}));var r=(t=s.getAddress(t)).substring(2)+".addr.reverse",n=l.namehash(r),i=this;return this._getResolver(r).then((function(t){if(!t)return null;var e="0x691f3431"+n.substring(2);return i.call({to:t,data:e})})).then((function(e){if(null==e)return null;if((e=e.substring(2)).length<64)return null;if((e=e.substring(64)).length<64)return null;var r=a.bigNumberify("0x"+e.substring(0,64)).toNumber();if(2*r>(e=e.substring(64)).length)return null;var n=m.toUtf8String("0x"+e.substring(0,2*r));return i.resolveName(n).then((function(e){return e!=t?null:n}))}))},K.checkTransactionResponse=N,K.prototype.doPoll=function(){},K.prototype.perform=function(t,e){return y.throwError(t+" not implemented",y.NOT_IMPLEMENTED,{operation:t}),null},K.prototype._startPending=function(){y.warn("WARNING: this provider does not support pending events")},K.prototype._stopPending=function(){},K.prototype._addEventListener=function(t,e,r){this._events.push({tag:q(t),listener:e,once:r}),"pending"===t&&this._startPending(),this.polling=!0},K.prototype.on=function(t,e){return this._addEventListener(t,e,!1),this},K.prototype.once=function(t,e){return this._addEventListener(t,e,!0),this},K.prototype.addEventListener=function(t,e){return this.on(t,e)},K.prototype.emit=function(t){for(var e=this,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var i=!1,o=q(t);return this._events=this._events.filter((function(t){return t.tag!==o||(setTimeout((function(){t.listener.apply(e,r)}),0),i=!0,!t.once)})),0===this.listenerCount()&&(this.polling=!1),i},K.prototype.listenerCount=function(t){if(!t)return this._events.length;var e=q(t);return this._events.filter((function(t){return t.tag===e})).length},K.prototype.listeners=function(t){var e=q(t);return this._events.filter((function(t){return t.tag===e})).map((function(t){return t.listener}))},K.prototype.removeAllListeners=function(t){var e;return null==t?(this._events=[],this._stopPending()):(e=q(t),this._events=this._events.filter((function(t){return t.tag!==e})),"pending"===t&&this._stopPending()),0===this._events.length&&(this.polling=!1),this},K.prototype.removeListener=function(t,e){var r=!1,n=q(t);return this._events=this._events.filter((function(t){return t.tag!==n||t.listener!=e||!!r||!(r=!0)})),"pending"===t&&0===this.listenerCount("pending")&&this._stopPending(),0===this.listenerCount()&&(this.polling=!1),this},i=K,r.BaseProvider=i,c.defineReadOnly(v.Provider,"inherits",c.inheritable(v.Provider))},{"../constants":3,"../errors":5,"../utils/address":60,"../utils/bignumber":63,"../utils/bytes":64,"../utils/hash":65,"../utils/networks":72,"../utils/properties":74,"../utils/rlp":76,"../utils/transaction":83,"../utils/utf8":85,"../utils/web":86,"./abstract-provider":50}],52:[function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var s=t("./base-provider"),a=t("../utils/bytes"),u=t("../utils/properties"),h=t("../utils/web"),l=o(t("../errors"));function f(t){var e,r,n=[];for(e in t)null!=t[e]&&(r=a.hexlify(t[e]),{gasLimit:!0,gasPrice:!0,nonce:!0,value:!0}[e]&&(r=a.hexStripZeros(r)),n.push(e+"="+r));return n.join("&")}function c(t){if(0==t.status&&("No records found"===t.message||"No transactions found"===t.message))return t.result;if(1==t.status&&"OK"==t.message)return t.result;var e=new Error("invalid response");throw e.result=JSON.stringify(t),e}function d(t){if("2.0"!=t.jsonrpc)throw(e=new Error("invalid response")).result=JSON.stringify(t),e;if(t.error){var e=new Error(t.error.message||"unknown error");throw t.error.code&&(e.code=t.error.code),t.error.data&&(e.data=t.error.data),e}return t.result}function p(t){if("pending"===t)throw new Error("pending not supported");return"latest"===t?t:parseInt(t.substring(2),16)}var m,g="8FG3JMZ9USS4NTA6YKEKHINU56SEPPVBJR";function y(t,e){var r=m.call(this,t)||this;l.checkNew(r,y),t="invalid";var n=null;switch(t=r.network?r.network.name:t){case"homestead":n="https://api.etherscan.io";break;case"ropsten":n="https://api-ropsten.etherscan.io";break;case"rinkeby":n="https://api-rinkeby.etherscan.io";break;case"kovan":n="https://api-kovan.etherscan.io";break;case"goerli":n="https://api-goerli.etherscan.io";break;default:throw new Error("unsupported network")}return u.defineReadOnly(r,"baseUrl",n),u.defineReadOnly(r,"apiKey",e||g),r}i(y,m=s.BaseProvider),y.prototype.perform=function(t,e){var r,n=this,i=this.baseUrl,o="";function s(t,e){return h.fetchJson(t,null,e||d).then((function(e){return n.emit("debug",{action:"perform",request:t,response:e,provider:n}),e}))}switch(this.apiKey&&(o+="&apikey="+this.apiKey),t){case"getBlockNumber":return s(i+="/api?module=proxy&action=eth_blockNumber"+o);case"getGasPrice":return s(i+="/api?module=proxy&action=eth_gasPrice"+o);case"getBalance":return i+="/api?module=account&action=balance&address="+e.address,s(i+="&tag="+e.blockTag+o,c);case"getTransactionCount":return i+="/api?module=proxy&action=eth_getTransactionCount&address="+e.address,s(i+="&tag="+e.blockTag+o);case"getCode":return i+="/api?module=proxy&action=eth_getCode&address="+e.address,s(i+="&tag="+e.blockTag+o,d);case"getStorageAt":return i+="/api?module=proxy&action=eth_getStorageAt&address="+e.address,i+="&position="+e.position,s(i+="&tag="+e.blockTag+o,d);case"sendTransaction":return i+="/api?module=proxy&action=eth_sendRawTransaction&hex="+e.signedTransaction,s(i+=o).catch((function(t){throw t.responseText&&(0<=t.responseText.toLowerCase().indexOf("insufficient funds")&&l.throwError("insufficient funds",l.INSUFFICIENT_FUNDS,{}),0<=t.responseText.indexOf("same hash was already imported")&&l.throwError("nonce has already been used",l.NONCE_EXPIRED,{}),0<=t.responseText.indexOf("another transaction with same nonce")&&l.throwError("replacement fee too low",l.REPLACEMENT_UNDERPRICED,{})),t}));case"getBlock":return e.blockTag?(i+="/api?module=proxy&action=eth_getBlockByNumber&tag="+e.blockTag,e.includeTransactions?i+="&boolean=true":i+="&boolean=false",s(i+=o)):Promise.reject(new Error("getBlock by blockHash not implemeneted"));case"getTransaction":return i+="/api?module=proxy&action=eth_getTransactionByHash&txhash="+e.transactionHash,s(i+=o);case"getTransactionReceipt":return i+="/api?module=proxy&action=eth_getTransactionReceipt&txhash="+e.transactionHash,s(i+=o);case"call":return i+="/api?module=proxy&action=eth_call"+(r=(r=f(e.transaction))&&"&"+r),"latest"!==e.blockTag?Promise.reject(new Error("EtherscanProvider does not support blockTag for call")):s(i+=o);case"estimateGas":return i+="/api?module=proxy&action=eth_estimateGas&"+(r=(r=f(e.transaction))&&"&"+r),s(i+=o);case"getLogs":i+="/api?module=logs&action=getLogs";try{if(e.filter.fromBlock&&(i+="&fromBlock="+p(e.filter.fromBlock)),e.filter.toBlock&&(i+="&toBlock="+p(e.filter.toBlock)),e.filter.blockHash)try{l.throwError("Etherscan does not support blockHash filters",l.UNSUPPORTED_OPERATION,{operation:"getLogs(blockHash)"})}catch(t){return Promise.reject(t)}if(e.filter.address&&(i+="&address="+e.filter.address),e.filter.topics&&0<e.filter.topics.length){if(1<e.filter.topics.length)throw new Error("unsupported topic format");var a=e.filter.topics[0];if("string"!=typeof a||66!==a.length)throw new Error("unsupported topic0 format");i+="&topic0="+a}}catch(t){return Promise.reject(t)}var u=this;return s(i+=o,c).then((function(t){var e={},r=Promise.resolve();return t.forEach((function(t){r=r.then((function(){return null!=t.blockHash?null:(t.blockHash=e[t.transactionHash],null==t.blockHash?u.getTransaction(t.transactionHash).then((function(r){return e[t.transactionHash]=r.blockHash,t.blockHash=r.blockHash,null})):null)}))})),r.then((function(){return t}))}));case"getEtherPrice":return"homestead"!==this.network.name?Promise.resolve(0):(i+="/api?module=stats&action=ethprice",s(i+=o,c).then((function(t){return parseFloat(t.ethusd)})))}return m.prototype.perform.call(this,t,e)},y.prototype.getHistory=function(t,e,r){var n=this,i=this.baseUrl,o="";return this.apiKey&&(o+="&apikey="+this.apiKey),null==e&&(e=0),null==r&&(r=99999999),this.resolveName(t).then((function(t){return i+="/api?module=account&action=txlist&address="+t,i+="&startblock="+e,i+="&endblock="+r,i+="&sort=asc"+o,h.fetchJson(i,null,c).then((function(t){n.emit("debug",{action:"getHistory",request:i,response:t,provider:n});var e=[];return t.forEach((function(t){["contractAddress","to"].forEach((function(e){""==t[e]&&delete t[e]})),null==t.creates&&null!=t.contractAddress&&(t.creates=t.contractAddress);var r=s.BaseProvider.checkTransactionResponse(t);t.timeStamp&&(r.timestamp=parseInt(t.timeStamp)),e.push(r)})),e}))}))},i=y,r.EtherscanProvider=i},{"../errors":5,"../utils/bytes":64,"../utils/properties":74,"../utils/web":86,"./base-provider":51}],53:[function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var s,a=t("./base-provider"),u=o(t("../errors"));function h(t){var e=!0,r=null;return t.forEach((function(n){null!=n?null!=r?r.name===n.name&&r.chainId===n.chainId&&(r.ensAddress===n.ensAddress||null==r.ensAddress&&null==n.ensAddress)||u.throwError("provider mismatch",u.INVALID_ARGUMENT,{arg:"networks",value:t}):r=n:e=!1})),e}function l(t){var e,r=this;if(0===t.length)throw new Error("no providers");return r=h(t.map((function(t){return t.network})))?s.call(this,t[0].network)||this:(e=Promise.all(t.map((function(t){return t.getNetwork()}))).then((function(t){return h(t)||u.throwError("getNetwork returned null",u.UNKNOWN_ERROR,{}),t[0]})),s.call(this,e)||this),u.checkNew(r,l),r._providers=t.slice(0),r}i(l,s=a.BaseProvider),Object.defineProperty(l.prototype,"providers",{get:function(){return this._providers.slice(0)},enumerable:!0,configurable:!0}),l.prototype.perform=function(t,e){var r=this.providers;return new Promise((function(n,i){var o=null;!function s(){r.length?r.shift().perform(t,e).then((function(t){return n(t)})).catch((function(t){o=o||t,setTimeout(s,0)})):i(o)}()}))},i=l,r.FallbackProvider=i},{"../errors":5,"./base-provider":51}],54:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./abstract-provider");r.Provider=n.Provider,n=t("./base-provider"),r.BaseProvider=n.BaseProvider,n=t("./etherscan-provider"),r.EtherscanProvider=n.EtherscanProvider,n=t("./fallback-provider"),r.FallbackProvider=n.FallbackProvider,n=t("./ipc-provider"),r.IpcProvider=n.IpcProvider,n=t("./infura-provider"),r.InfuraProvider=n.InfuraProvider,n=t("./json-rpc-provider"),r.JsonRpcProvider=n.JsonRpcProvider,r.JsonRpcSigner=n.JsonRpcSigner,t=t("./web3-provider"),r.Web3Provider=t.Web3Provider},{"./abstract-provider":50,"./base-provider":51,"./etherscan-provider":52,"./fallback-provider":53,"./infura-provider":55,"./ipc-provider":56,"./json-rpc-provider":57,"./web3-provider":58}],55:[function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var s,a=t("./json-rpc-provider"),u=t("../utils/bytes"),h=t("../utils/networks"),l=t("../utils/properties"),f=o(t("../errors")),c="7d0d81d0919f4f05b9ab6634be01ee73";function d(t,e){var r=this,n=h.getNetwork(null==t?"homestead":t);null==e&&(e=c);var i=null;switch(n.name){case"homestead":i="mainnet.infura.io";break;case"ropsten":i="ropsten.infura.io";break;case"rinkeby":i="rinkeby.infura.io";break;case"goerli":i="goerli.infura.io";break;case"kovan":i="kovan.infura.io";break;default:f.throwError("unsupported network",f.INVALID_ARGUMENT,{argument:"network",value:t})}return u.isHexString("0x"+e,16)?(r=s.call(this,"https://"+i+"/v3/"+e,n)||this,l.defineReadOnly(r,"apiAccessToken",null),l.defineReadOnly(r,"projectId",e)):(f.warn("The legacy INFURA apiAccesToken API is deprecated; please upgrade to a Project ID instead (see INFURA dshboard; https://infura.io)"),r=s.call(this,"https://"+i+"/"+e,n)||this,l.defineReadOnly(r,"apiAccessToken",e),l.defineReadOnly(r,"projectId",null)),f.checkNew(r,d),r}i(d,s=a.JsonRpcProvider),d.prototype._startPending=function(){f.warn("WARNING: INFURA does not support pending filters")},d.prototype.getSigner=function(t){return f.throwError("INFURA does not support signing",f.UNSUPPORTED_OPERATION,{operation:"getSigner"})},d.prototype.listAccounts=function(){return Promise.resolve([])},i=d,r.InfuraProvider=i},{"../errors":5,"../utils/bytes":64,"../utils/networks":72,"../utils/properties":74,"./json-rpc-provider":57}],56:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0})},{}],57:[function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var s=t("./base-provider"),a=t("../abstract-signer"),u=o(t("../errors")),h=t("../utils/address"),l=t("../utils/bytes"),f=t("../utils/networks"),c=t("../utils/properties"),d=t("../utils/utf8"),p=t("../utils/web");function m(t){if(t.error){var e=new Error(t.error.message);throw e.code=t.error.code,e.data=t.error.data,e}return t.result}function g(t){return t&&t.toLowerCase()}var y,v={},w=42,b=(i(M,y=a.Signer),M.prototype.getAddress=function(){var t=this;return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then((function(e){return e.length<=t._index&&u.throwError("unknown account #"+t._index,u.UNSUPPORTED_OPERATION,{operation:"getAddress"}),t._address=h.getAddress(e[t._index]),t._address}))},M.prototype.getBalance=function(t){return this.provider.getBalance(this.getAddress(),t)},M.prototype.getTransactionCount=function(t){return this.provider.getTransactionCount(this.getAddress(),t)},M.prototype.sendUncheckedTransaction=function(t){var e=this;t=c.shallowCopy(t);var r,n=this.getAddress().then((function(t){return t&&t.toLowerCase()}));return null==t.gasLimit&&((r=c.shallowCopy(t)).from=n,t.gasLimit=this.provider.estimateGas(r)),Promise.all([c.resolveProperties(t),n]).then((function(t){var r=t[0],n=E.hexlifyTransaction(r);return n.from=t[1],e.provider.send("eth_sendTransaction",[n]).then((function(t){return t}),(function(t){throw t.responseText&&(0<=t.responseText.indexOf("insufficient funds")&&u.throwError("insufficient funds",u.INSUFFICIENT_FUNDS,{transaction:r}),0<=t.responseText.indexOf("nonce too low")&&u.throwError("nonce has already been used",u.NONCE_EXPIRED,{transaction:r}),0<=t.responseText.indexOf("replacement transaction underpriced")&&u.throwError("replacement fee too low",u.REPLACEMENT_UNDERPRICED,{transaction:r})),t}))}))},M.prototype.sendTransaction=function(t){var e=this;return this.sendUncheckedTransaction(t).then((function(t){return p.poll((function(){return e.provider.getTransaction(t).then((function(r){if(null!==r)return e.provider._wrapTransaction(r,t)}))}),{fastRetry:250,onceBlock:e.provider}).catch((function(e){throw e.transactionHash=t,e}))}))},M.prototype.signMessage=function(t){var e=this,r="string"==typeof t?d.toUtf8Bytes(t):t;return this.getAddress().then((function(t){return e.provider.send("eth_sign",[t.toLowerCase(),l.hexlify(r)])}))},M.prototype.unlock=function(t){var e=this.provider;return this.getAddress().then((function(r){return e.send("personal_unlockAccount",[r.toLowerCase(),t,null])}))},M);function M(t,e,r){var n=y.call(this)||this;if(u.checkNew(n,M),t!==v)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");return c.defineReadOnly(n,"provider",e),r?"string"==typeof r?c.defineReadOnly(n,"_address",h.getAddress(r)):"number"==typeof r?c.defineReadOnly(n,"_index",r):u.throwError("invalid address or index",u.INVALID_ARGUMENT,{argument:"addressOrIndex",value:r}):c.defineReadOnly(n,"_index",0),n}r.JsonRpcSigner=b;var _,A={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0},E=(i(x,_=s.BaseProvider),x.prototype.getSigner=function(t){return new b(v,this,t)},x.prototype.listAccounts=function(){return this.send("eth_accounts",[]).then((function(t){return t.map((function(t){return h.getAddress(t)}))}))},x.prototype.send=function(t,e){var r=this,n={method:t,params:e,id:w++,jsonrpc:"2.0"};return p.fetchJson(this.connection,JSON.stringify(n),m).then((function(t){return r.emit("debug",{action:"send",request:n,response:t,provider:r}),t}))},x.prototype.perform=function(t,e){switch(t){case"getBlockNumber":return this.send("eth_blockNumber",[]);case"getGasPrice":return this.send("eth_gasPrice",[]);case"getBalance":return this.send("eth_getBalance",[g(e.address),e.blockTag]);case"getTransactionCount":return this.send("eth_getTransactionCount",[g(e.address),e.blockTag]);case"getCode":return this.send("eth_getCode",[g(e.address),e.blockTag]);case"getStorageAt":return this.send("eth_getStorageAt",[g(e.address),e.position,e.blockTag]);case"sendTransaction":return this.send("eth_sendRawTransaction",[e.signedTransaction]).catch((function(t){throw t.responseText&&(0<t.responseText.indexOf("insufficient funds")&&u.throwError("insufficient funds",u.INSUFFICIENT_FUNDS,{}),0<t.responseText.indexOf("nonce too low")&&u.throwError("nonce has already been used",u.NONCE_EXPIRED,{}),0<t.responseText.indexOf("replacement transaction underpriced")&&u.throwError("replacement fee too low",u.REPLACEMENT_UNDERPRICED,{})),t}));case"getBlock":return e.blockTag?this.send("eth_getBlockByNumber",[e.blockTag,!!e.includeTransactions]):e.blockHash?this.send("eth_getBlockByHash",[e.blockHash,!!e.includeTransactions]):Promise.reject(new Error("invalid block tag or block hash"));case"getTransaction":return this.send("eth_getTransactionByHash",[e.transactionHash]);case"getTransactionReceipt":return this.send("eth_getTransactionReceipt",[e.transactionHash]);case"call":return this.send("eth_call",[x.hexlifyTransaction(e.transaction,{from:!0}),e.blockTag]);case"estimateGas":return this.send("eth_estimateGas",[x.hexlifyTransaction(e.transaction,{from:!0})]);case"getLogs":return e.filter&&null!=e.filter.address&&(e.filter.address=g(e.filter.address)),this.send("eth_getLogs",[e.filter])}return u.throwError(t+" not implemented",u.NOT_IMPLEMENTED,{operation:t}),null},x.prototype._startPending=function(){var t,e;null==this._pendingFilter&&(e=(t=this).send("eth_newPendingTransactionFilter",[]),(this._pendingFilter=e).then((function(r){return function n(){t.send("eth_getFilterChanges",[r]).then((function(r){if(t._pendingFilter!=e)return null;var n=Promise.resolve();return r.forEach((function(e){t._emitted["t:"+e.toLowerCase()]="pending",n=n.then((function(){return t.getTransaction(e).then((function(e){return t.emit("pending",e),null}))}))})),n.then((function(){return t=1e3,new Promise((function(e){setTimeout((function(){e()}),t)}));var t}))})).then((function(){return t._pendingFilter==e?(setTimeout((function(){n()}),0),null):void t.send("eth_uninstallFilter",[r])})).catch((function(t){}))}(),r})).catch((function(t){})))},x.prototype._stopPending=function(){this._pendingFilter=null},x.hexlifyTransaction=function(t,e){var r=c.shallowCopy(A);if(e)for(var n in e)e[n]&&(r[n]=!0);c.checkProperties(t,r);var i={};return["gasLimit","gasPrice","nonce","value"].forEach((function(e){var r;null!=t[e]&&(r=l.hexStripZeros(l.hexlify(t[e])),i[e="gasLimit"===e?"gas":e]=r)})),["from","to","data"].forEach((function(e){null!=t[e]&&(i[e]=l.hexlify(t[e]))})),i},x);function x(t,e){var r=this;return"string"==typeof t&&null===e&&f.getNetwork(t)&&(e=t,t=null),e||(e=new Promise((function(t,e){setTimeout((function(){r.send("net_version",[]).then((function(e){return t(f.getNetwork(parseInt(e)))})).catch((function(t){e(t)}))}))}))),r=_.call(this,e)||this,u.checkNew(r,x),r.connection="string"==typeof(t=t||"http://localhost:8545")?{url:t}:t,r}r.JsonRpcProvider=E},{"../abstract-signer":2,"../errors":5,"../utils/address":60,"../utils/bytes":64,"../utils/networks":72,"../utils/properties":74,"../utils/utf8":85,"../utils/web":86,"./base-provider":51}],58:[function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var s,a=t("./json-rpc-provider"),u=t("../utils/properties"),h=o(t("../errors")),l=42;function f(t,e){return e=s.call(this,t.host||t.path||"",e)||this,h.checkNew(e,f),t&&(t.sendAsync?e._sendAsync=t.sendAsync.bind(t):t.send&&(e._sendAsync=t.send.bind(t))),t&&e._sendAsync||h.throwError("invalid web3Provider",h.INVALID_ARGUMENT,{arg:"web3Provider",value:t}),u.defineReadOnly(e,"_web3Provider",t),u.defineReadOnly(e,"provider",t),e}i(f,s=a.JsonRpcProvider),f.prototype.send=function(t,e){var r=this;return"eth_sign"==t&&this._web3Provider.isMetaMask&&(t="personal_sign",e=[e[1],e[0]]),new Promise((function(n,i){var o={method:t,params:e,id:l++,jsonrpc:"2.0"};r._sendAsync(o,(function(t,e){if(t)i(t);else{if(e.error)return(t=new Error(e.error.message)).code=e.error.code,t.data=e.error.data,void i(t);n(e.result)}}))}))},i=f,r.Web3Provider=i},{"../errors":5,"../utils/properties":74,"./json-rpc-provider":57}],59:[function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var s=t("../constants"),a=o(t("../errors")),u=t("./address"),h=t("./bignumber"),l=t("./bytes"),f=t("./utf8"),c=t("./properties"),d=new RegExp(/^bytes([0-9]*)$/),p=new RegExp(/^(u?int)([0-9]*)$/),m=new RegExp(/^(.*)\[([0-9]*)\]$/);r.defaultCoerceFunc=function(t,e){return(t=t.match(p))&&parseInt(t[2])<=48?e.toNumber():e};var g=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$"),y=new RegExp("^[A-Za-z_][A-Za-z0-9_]*$");function v(t){return t.match(/^uint($|[^1-9])/)?t="uint256"+t.substring(4):t.match(/^int($|[^1-9])/)&&(t="int256"+t.substring(3)),t}function w(t,e){var r=t;function n(t){throw new Error('unexpected character "'+r[t]+'" at position '+t+' in "'+r+'"')}t=t.replace(/\s/g," ");for(var i={type:"",name:"",state:{allowType:!0}},o=i,s=0;s<t.length;s++){var a=t[s];switch(a){case"(":o.state.allowParams||n(s),o.state.allowType=!1,o.type=v(o.type),o.components=[{type:"",name:"",parent:o,state:{allowType:!0}}],o=o.components[0];break;case")":delete o.state,e&&"indexed"===o.name&&(o.indexed=!0,o.name=""),o.type=v(o.type);var u=o;(o=o.parent)||n(s),delete u.parent,o.state.allowParams=!1,o.state.allowName=!0,o.state.allowArray=!0;break;case",":delete o.state,e&&"indexed"===o.name&&(o.indexed=!0,o.name=""),o.type=v(o.type),u={type:"",name:"",parent:o.parent,state:{allowType:!0}},o.parent.components.push(u),delete o.parent,o=u;break;case" ":o.state.allowType&&""!==o.type&&(o.type=v(o.type),delete o.state.allowType,o.state.allowName=!0,o.state.allowParams=!0),o.state.allowName&&""!==o.name&&(e&&"indexed"===o.name?(o.indexed=!0,o.name=""):o.state.allowName=!1);break;case"[":o.state.allowArray||n(s),o.type+=a,o.state.allowArray=!1,o.state.allowName=!1,o.state.readArray=!0;break;case"]":o.state.readArray||n(s),o.type+=a,o.state.readArray=!1,o.state.allowArray=!0,o.state.allowName=!0;break;default:o.state.allowType?(o.type+=a,o.state.allowParams=!0,o.state.allowArray=!0):o.state.allowName?(o.name+=a,delete o.state.allowArray):o.state.readArray?o.type+=a:n(s)}}if(o.parent)throw new Error("unexpected eof");return delete i.state,e&&"indexed"===o.name&&(o.indexed=!0,o.name=""),i.type=v(i.type),i}function b(t){return it(r.defaultCoerceFunc,t).type}function M(t,e,r,n,i){this.coerceFunc=t,this.name=e,this.type=r,this.localName=n,this.dynamic=i}r.parseParamType=function(t){return w(t,!0)},r.formatParamType=b,r.formatSignature=function(t){return t.name+"("+t.inputs.map(b).join(",")+")"},r.parseSignature=function(t){if("string"==typeof t)return"event "===(t=(t=(t=t.replace(/\s/g," ")).replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," ")).trim()).substring(0,6)?function(t){var e={anonymous:!1,inputs:[],name:"",type:"event"},r=t.match(g);if(!r)throw new Error("invalid event: "+t);if(e.name=r[1].trim(),rt(r[2]).forEach((function(t){(t=w(t,!0)).indexed=!!t.indexed,e.inputs.push(t)})),r[3].split(" ").forEach((function(t){switch(t){case"anonymous":e.anonymous=!0;break;case"":break;default:a.info("unknown modifier: "+t)}})),e.name&&!e.name.match(y))throw new Error('invalid identifier: "'+e.name+'"');return e}(t.substring(6).trim()):function(t){var e={constant:!1,gas:null,inputs:[],name:"",outputs:[],payable:!1,stateMutability:null,type:"function"},r=t.split("@");if(1!==r.length){if(2<r.length)throw new Error("invalid signature");if(!r[1].match(/^[0-9]+$/))throw new Error("invalid signature gas");e.gas=h.bigNumberify(r[1]),t=r[0]}if(!(t=(r=t.split(" returns "))[0].match(g)))throw new Error("invalid signature");if(e.name=t[1].trim(),!e.name.match(y))throw new Error('invalid identifier: "'+t[1]+'"');if(rt(t[2]).forEach((function(t){e.inputs.push(w(t))})),t[3].split(" ").forEach((function(t){switch(t){case"constant":e.constant=!0;break;case"payable":e.payable=!0,e.stateMutability="payable";break;case"pure":e.constant=!0,e.stateMutability="pure";break;case"view":e.constant=!0,e.stateMutability="view";break;case"external":case"public":case"":break;default:a.info("unknown modifier: "+t)}})),1<r.length){if(""!=(r=r[1].match(g))[1].trim()||""!=r[3].trim())throw new Error("unexpected tokens");rt(r[2]).forEach((function(t){e.outputs.push(w(t))}))}if("constructor"===e.name){if(e.type="constructor",e.outputs.length)throw new Error("constructor may not have outputs");delete e.name,delete e.outputs}return e}((t="function "===t.substring(0,9)?t.substring(9):t).trim());throw new Error("unknown signature")};var _,A=(i(E,_=M),E.prototype.encode=function(t){return this.coder.encode(t)},E.prototype.decode=function(t,e){return this.coder.decode(t,e)},E);function E(t){var e=_.call(this,t.coerceFunc,t.name,t.type,void 0,t.dynamic)||this;return c.defineReadOnly(e,"coder",t),e}var x,S=(i(N,x=M),N.prototype.encode=function(t){return l.arrayify([])},N.prototype.decode=function(t,e){if(e>t.length)throw new Error("invalid null");return{consumed:0,value:this.coerceFunc("null",void 0)}},N);function N(t,e){return x.call(this,t,"null","",e,!1)||this}var k,T=(i(P,k=M),P.prototype.encode=function(t){try{var e=h.bigNumberify(t);if(this.signed){var r=s.MaxUint256.maskn(8*this.size-1);if(e.gt(r))throw new Error("out-of-bounds");if(r=r.add(s.One).mul(s.NegativeOne),e.lt(r))throw new Error("out-of-bounds")}else if(e.lt(s.Zero)||e.gt(s.MaxUint256.maskn(8*this.size)))throw new Error("out-of-bounds");return e=e.toTwos(8*this.size).maskn(8*this.size),this.signed&&(e=e.fromTwos(8*this.size).toTwos(256)),l.padZeros(l.arrayify(e),32)}catch(e){a.throwError("invalid number value",a.INVALID_ARGUMENT,{arg:this.localName,coderType:this.name,value:t})}return null},P.prototype.decode=function(t,e){t.length<e+32&&a.throwError("insufficient data for "+this.name+" type",a.INVALID_ARGUMENT,{arg:this.localName,coderType:this.name,value:l.hexlify(t.slice(e,e+32))});var r=32-this.size;return e=h.bigNumberify(t.slice(e+r,e+32)),e=this.signed?e.fromTwos(8*this.size):e.maskn(8*this.size),{consumed:32,value:this.coerceFunc(this.name,e)}},P);function P(t,e,r,n){var i=this,o=(r?"int":"uint")+8*e;return(i=k.call(this,t,o,o,n,!1)||this).size=e,i.signed=r,i}var I,R=new T((function(t,e){return e}),32,!1,"none"),O=(i(C,I=M),C.prototype.encode=function(t){return R.encode(t?1:0)},C.prototype.decode=function(t,e){try{var r=R.decode(t,e)}catch(t){throw"insufficient data for uint256 type"===t.reason&&a.throwError("insufficient data for boolean type",a.INVALID_ARGUMENT,{arg:this.localName,coderType:"boolean",value:t.value}),t}return{consumed:r.consumed,value:this.coerceFunc("bool",!r.value.isZero())}},C);function C(t,e){return I.call(this,t,"bool","bool",e,!1)||this}var B,U=(i(L,B=M),L.prototype.encode=function(t){var e=new Uint8Array(32);try{var r=l.arrayify(t);if(r.length!==this.length)throw new Error("incorrect data length");e.set(r)}catch(e){a.throwError("invalid "+this.name+" value",a.INVALID_ARGUMENT,{arg:this.localName,coderType:this.name,value:e.value||t})}return e},L.prototype.decode=function(t,e){return t.length<e+32&&a.throwError("insufficient data for "+this.name+" type",a.INVALID_ARGUMENT,{arg:this.localName,coderType:this.name,value:l.hexlify(t.slice(e,e+32))}),{consumed:32,value:this.coerceFunc(this.name,l.hexlify(t.slice(e,e+this.length)))}},L);function L(t,e,r){var n=this,i="bytes"+e;return(n=B.call(this,t,i,i,r,!1)||this).length=e,n}var D,j,F,z=(i(H,D=M),H.prototype.encode=function(t){var e=new Uint8Array(32);try{e.set(l.arrayify(u.getAddress(t)),12)}catch(e){a.throwError("invalid address",a.INVALID_ARGUMENT,{arg:this.localName,coderType:"address",value:t})}return e},H.prototype.decode=function(t,e){return t.length<e+32&&a.throwError("insufficient data for address type",a.INVALID_ARGUMENT,{arg:this.localName,coderType:"address",value:l.hexlify(t.slice(e,e+32))}),{consumed:32,value:this.coerceFunc("address",u.getAddress(l.hexlify(t.slice(e+12,e+32))))}},H);function H(t,e){return D.call(this,t,"address","address",e,!1)||this}function G(t){var e=32*Math.ceil(t.length/32);return e=new Uint8Array(e-t.length),l.concat([R.encode(t.length),t,e])}function q(t,e,r){t.length<e+32&&a.throwError("insufficient data for dynamicBytes length",a.INVALID_ARGUMENT,{arg:r,coderType:"dynamicBytes",value:l.hexlify(t.slice(e,e+32))});var n=R.decode(t,e).value;try{n=n.toNumber()}catch(t){a.throwError("dynamic bytes count too large",a.INVALID_ARGUMENT,{arg:r,coderType:"dynamicBytes",value:n.toString()})}return t.length<e+32+n&&a.throwError("insufficient data for dynamicBytes type",a.INVALID_ARGUMENT,{arg:r,coderType:"dynamicBytes",value:l.hexlify(t.slice(e,e+32+n))}),{consumed:32+32*Math.ceil(n/32),value:t.slice(e+32,e+32+n)}}function V(t,e){return j.call(this,t,"bytes","bytes",e,!0)||this}function K(t,e){return F.call(this,t,"string","string",e,!0)||this}function Z(t){return 32*Math.ceil(t/32)}function W(t,e){var r;Array.isArray(e)||(e&&"object"==typeof e?(r=[],t.forEach((function(t){r.push(e[t.localName])})),e=r):a.throwError("invalid tuple value",a.INVALID_ARGUMENT,{coderType:"tuple",value:e})),t.length!==e.length&&a.throwError("types/value length mismatch",a.INVALID_ARGUMENT,{coderType:"tuple",value:e});var n=[];t.forEach((function(t,r){n.push({dynamic:t.dynamic,value:t.encode(e[r])})}));var i=0,o=0;n.forEach((function(t){t.dynamic?(i+=32,o+=Z(t.value.length)):i+=Z(t.value.length)}));var s=0,u=i,h=new Uint8Array(i+o);return n.forEach((function(t){t.dynamic?(h.set(R.encode(u),s),s+=32,h.set(t.value,u),u+=Z(t.value.length)):(h.set(t.value,s),s+=Z(t.value.length))})),h}function J(t,e,r){var n=r,i=0,o=[];return t.forEach((function(t){var s,a;t.dynamic?(s=R.decode(e,r),(a=t.decode(e,n+s.value.toNumber())).consumed=s.consumed):a=t.decode(e,r),null!=a.value&&o.push(a.value),r+=a.consumed,i+=a.consumed})),t.forEach((function(t,e){(t=t.localName)&&null==o[t="length"===t?"_length":t]&&(o[t]=o[e])})),{value:o,consumed:i}}i(V,j=M),V.prototype.encode=function(t){try{return G(l.arrayify(t))}catch(t){a.throwError("invalid bytes value",a.INVALID_ARGUMENT,{arg:this.localName,coderType:"bytes",value:t.value})}return null},V.prototype.decode=function(t,e){return(e=q(t,e,this.localName)).value=this.coerceFunc("bytes",l.hexlify(e.value)),e},o=V,i(K,F=M),K.prototype.encode=function(t){return"string"!=typeof t&&a.throwError("invalid string value",a.INVALID_ARGUMENT,{arg:this.localName,coderType:"string",value:t}),G(f.toUtf8Bytes(t))},K.prototype.decode=function(t,e){return(e=q(t,e,this.localName)).value=this.coerceFunc("string",f.toUtf8String(e.value)),e},t=K;var $,X=(i(Y,$=M),Y.prototype.encode=function(t){Array.isArray(t)||a.throwError("expected array value",a.INVALID_ARGUMENT,{arg:this.localName,coderType:"array",value:t});var e=this.length,r=new Uint8Array(0);-1===e&&(e=t.length,r=R.encode(e)),a.checkArgumentCount(e,t.length," in coder array"+(this.localName?" "+this.localName:""));for(var n=[],i=0;i<t.length;i++)n.push(this.coder);return l.concat([r,W(n,t)])},Y.prototype.decode=function(t,e){var r=0,n=this.length;if(-1===n){try{var i=R.decode(t,e)}catch(t){a.throwError("insufficient data for dynamic array length",a.INVALID_ARGUMENT,{arg:this.localName,coderType:"array",value:t.value})}try{n=i.value.toNumber()}catch(t){a.throwError("array count too large",a.INVALID_ARGUMENT,{arg:this.localName,coderType:"array",value:i.value.toString()})}r+=i.consumed,e+=i.consumed}for(var o=[],s=0;s<n;s++)o.push(new A(this.coder));return(e=J(o,t,e)).consumed+=r,e.value=this.coerceFunc(this.type,e.value),e},Y);function Y(t,e,r,n){var i=this,o=e.type+"["+(0<=r?r:"")+"]",s=-1===r||e.dynamic;return(i=$.call(this,t,"array",o,n,s)||this).coder=e,i.length=r,i}var Q,tt=(i(et,Q=M),et.prototype.encode=function(t){return W(this.coders,t)},et.prototype.decode=function(t,e){return(e=J(this.coders,t,e)).value=this.coerceFunc(this.type,e.value),e},et);function et(t,e,r){var n=this,i=!1,o=[];e.forEach((function(t){t.dynamic&&(i=!0),o.push(t.type)}));var s="tuple("+o.join(",")+")";return(n=Q.call(this,t,"tuple",s,r,i)||this).coders=e,n}function rt(t){t=t.trim();for(var e=[],r="",n=0,i=0;i<t.length;i++){var o=t[i];if(","===o&&0===n)e.push(r),r="";else if(r+=o,"("===o)n++;else if(")"===o&&-1==--n)throw new Error("unbalanced parenthsis")}return r&&e.push(r),e}var nt={address:z,bool:O,string:t,bytes:o};function it(t,e){var r,n,i;if(i=nt[e.type])return new i(t,e.name);if(i=e.type.match(p))return(0===(o=parseInt(i[2]||"256"))||256<o||o%8!=0)&&a.throwError("invalid "+i[1]+" bit length",a.INVALID_ARGUMENT,{arg:"param",value:e}),new T(t,o/8,"int"===i[1],e.name);if(i=e.type.match(d))return(0===(o=parseInt(i[1]))||32<o)&&a.throwError("invalid bytes length",a.INVALID_ARGUMENT,{arg:"param",value:e}),new U(t,o,e.name);if(i=e.type.match(m)){var o=parseInt(i[2]||"-1");return(e=c.shallowCopy(e)).type=i[1],e=c.deepCopy(e),new X(t,it(t,e),o,e.name)}return"tuple"===e.type.substring(0,5)?(r=t,i=e.components,o=e.name,n=[],(i=i||[]).forEach((function(t){n.push(it(r,t))})),new tt(r,n,o)):""===e.type?new S(t,e.name):(a.throwError("invalid type",a.INVALID_ARGUMENT,{arg:"type",value:e.type}),null)}function ot(t){a.checkNew(this,ot),t=t||r.defaultCoerceFunc,c.defineReadOnly(this,"coerceFunc",t)}ot.prototype.encode=function(t,e){t.length!==e.length&&a.throwError("types/values length mismatch",a.INVALID_ARGUMENT,{count:{types:t.length,values:e.length},value:{types:t,values:e}});var r=[];return t.forEach((function(t){var e=null;e="string"==typeof t?w(t):t,r.push(it(this.coerceFunc,e))}),this),l.hexlify(new tt(this.coerceFunc,r,"_").encode(e))},ot.prototype.decode=function(t,e){var r=[];return t.forEach((function(t){var e=null;e="string"==typeof t?w(t):c.deepCopy(t),r.push(it(this.coerceFunc,e))}),this),new tt(this.coerceFunc,r,"_").decode(l.arrayify(e),0).value},o=ot,r.AbiCoder=o,r.defaultAbiCoder=new o},{"../constants":3,"../errors":5,"./address":60,"./bignumber":63,"./bytes":64,"./properties":74,"./utf8":85}],60:[function(t,e,r){"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(t("bn.js")),o=t("./bytes"),s=t("./keccak256"),a=t("./rlp"),u=t("../errors");function h(t){"string"==typeof t&&t.match(/^0x[0-9A-Fa-f]{40}$/)||u.throwError("invalid address",u.INVALID_ARGUMENT,{arg:"address",value:t});for(var e=(t=t.toLowerCase()).substring(2).split(""),r=new Uint8Array(40),n=0;n<40;n++)r[n]=e[n].charCodeAt(0);r=o.arrayify(s.keccak256(r));for(var i=0;i<40;i+=2)8<=r[i>>1]>>4&&(e[i]=e[i].toUpperCase()),8<=(15&r[i>>1])&&(e[i+1]=e[i+1].toUpperCase());return"0x"+e.join("")}for(var l={},f=0;f<10;f++)l[String(f)]=String(f);for(f=0;f<26;f++)l[String.fromCharCode(65+f)]=String(10+f);var c,d=Math.floor((c=9007199254740991,Math.log10?Math.log10(c):Math.log(c)/Math.LN10));function p(t){t=(t=t.toUpperCase()).substring(4)+t.substring(0,2)+"00";var e="";for(t.split("").forEach((function(t){e+=l[t]}));e.length>=d;){var r=e.substring(0,d);e=parseInt(r,10)%97+e.substring(r.length)}for(var n=String(98-parseInt(e,10)%97);n.length<2;)n="0"+n;return n}function m(t){var e=null;if("string"!=typeof t&&u.throwError("invalid address",u.INVALID_ARGUMENT,{arg:"address",value:t}),t.match(/^(0x)?[0-9a-fA-F]{40}$/))e=h(t="0x"!==t.substring(0,2)?"0x"+t:t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&u.throwError("bad address checksum",u.INVALID_ARGUMENT,{arg:"address",value:t});else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==p(t)&&u.throwError("bad icap checksum",u.INVALID_ARGUMENT,{arg:"address",value:t}),e=new i.default.BN(t.substring(4),36).toString(16);e.length<40;)e="0"+e;e=h("0x"+e)}else u.throwError("invalid address",u.INVALID_ARGUMENT,{arg:"address",value:t});return e}r.getAddress=m,r.getIcapAddress=function(t){for(var e=new i.default.BN(m(t).substring(2),16).toString(36).toUpperCase();e.length<30;)e="0"+e;return"XE"+p("XE00"+e)+e},r.getContractAddress=function(t){if(!t.from)throw new Error("missing from address");var e=t.nonce;return m("0x"+s.keccak256(a.encode([m(t.from),o.stripZeros(o.hexlify(e))])).substring(26))},r.getCreate2Address=function(t){var e=t.initCodeHash;t.initCode&&(e?s.keccak256(t.initCode)!==e&&u.throwError("initCode/initCodeHash mismatch",u.INVALID_ARGUMENT,{arg:"options",value:t}):e=s.keccak256(t.initCode)),e||u.throwError("missing initCode or initCodeHash",u.INVALID_ARGUMENT,{arg:"options",value:t});var r=m(t.from),n=o.arrayify(t.salt);return 32!==n.length&&u.throwError("invalid salt",u.INVALID_ARGUMENT,{arg:"options",value:t}),m("0x"+s.keccak256(o.concat(["0xff",r,n,e])).substring(26))}},{"../errors":5,"./bytes":64,"./keccak256":71,"./rlp":76,"bn.js":9}],61:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("../utils/bytes");e.exports={decode:function(t){t=atob(t);for(var e=[],r=0;r<t.length;r++)e.push(t.charCodeAt(r));return n.arrayify(e)},encode:function(t){t=n.arrayify(t);for(var e="",r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return btoa(e)}}},{"../utils/bytes":64}],62:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./bytes"),i=t("./properties"),o=(s.prototype.encode=function(t){var e=n.arrayify(t);if(0===e.length)return"";for(var r=[0],i=0;i<e.length;++i){for(var o=e[i],s=0;s<r.length;++s)o+=r[s]<<8,r[s]=o%this.base,o=o/this.base|0;for(;0<o;)r.push(o%this.base),o=o/this.base|0}for(var a="",u=0;0===e[u]&&u<e.length-1;++u)a+=this._leader;for(var h=r.length-1;0<=h;--h)a+=this.alphabet[r[h]];return a},s.prototype.decode=function(t){if("string"!=typeof t)throw new TypeError("Expected String");var e=[];if(0===t.length)return new Uint8Array(e);e.push(0);for(var r=0;r<t.length;r++){var i=this._alphabetMap[t[r]];if(void 0===i)throw new Error("Non-base"+this.base+" character");for(var o=i,s=0;s<e.length;++s)o+=e[s]*this.base,e[s]=255&o,o>>=8;for(;0<o;)e.push(255&o),o>>=8}for(var a=0;t[a]===this._leader&&a<t.length-1;++a)e.push(0);return n.arrayify(new Uint8Array(e.reverse()))},s);function s(t){i.defineReadOnly(this,"alphabet",t),i.defineReadOnly(this,"base",t.length),i.defineReadOnly(this,"_alphabetMap",{}),i.defineReadOnly(this,"_leader",t.charAt(0));for(var e=0;e<t.length;e++)this._alphabetMap[t.charAt(e)]=e}t=new(r.BaseX=o)("abcdefghijklmnopqrstuvwxyz234567"),r.Base32=t,o=new o("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),r.Base58=o},{"./bytes":64,"./properties":74}],63:[function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var o=n(t("bn.js")),s=t("./bytes"),a=t("./properties"),u=i(t("../errors")),h=new o.default.BN(-1);function l(t){return"-"===(t=t.toString(16))[0]?t.length%2==0?"-0x0"+t.substring(1):"-0x"+t.substring(1):t.length%2==1?"0x0"+t:"0x"+t}function f(t){return d(g(t))}function c(t){return new p(l(t))}function d(t){return"-"===(t=t._hex)[0]?new o.default.BN(t.substring(3),16).mul(h):new o.default.BN(t.substring(2),16)}var p=(m.prototype.fromTwos=function(t){return c(d(this).fromTwos(t))},m.prototype.toTwos=function(t){return c(d(this).toTwos(t))},m.prototype.abs=function(){return"-"===this._hex[0]?c(d(this).mul(h)):this},m.prototype.add=function(t){return c(d(this).add(f(t)))},m.prototype.sub=function(t){return c(d(this).sub(f(t)))},m.prototype.div=function(t){return g(t).isZero()&&u.throwError("division by zero",u.NUMERIC_FAULT,{operation:"divide",fault:"division by zero"}),c(d(this).div(f(t)))},m.prototype.mul=function(t){return c(d(this).mul(f(t)))},m.prototype.mod=function(t){return c(d(this).mod(f(t)))},m.prototype.pow=function(t){return c(d(this).pow(f(t)))},m.prototype.maskn=function(t){return c(d(this).maskn(t))},m.prototype.eq=function(t){return d(this).eq(f(t))},m.prototype.lt=function(t){return d(this).lt(f(t))},m.prototype.lte=function(t){return d(this).lte(f(t))},m.prototype.gt=function(t){return d(this).gt(f(t))},m.prototype.gte=function(t){return d(this).gte(f(t))},m.prototype.isZero=function(){return d(this).isZero()},m.prototype.toNumber=function(){try{return d(this).toNumber()}catch(t){u.throwError("overflow",u.NUMERIC_FAULT,{operation:"setValue",fault:"overflow",details:t.message})}return null},m.prototype.toString=function(){return d(this).toString(10)},m.prototype.toHexString=function(){return this._hex},m.isBigNumber=function(t){return a.isType(t,"BigNumber")},m);function m(t){if(u.checkNew(this,m),a.setType(this,"BigNumber"),"string"==typeof t)s.isHexString(t)?a.defineReadOnly(this,"_hex",t="0x"==t?"0x0":t):"-"===t[0]&&s.isHexString(t.substring(1))?a.defineReadOnly(this,"_hex",t):t.match(/^-?[0-9]*$/)?a.defineReadOnly(this,"_hex",l(new o.default.BN(t=""==t?"0":t))):u.throwError("invalid BigNumber string value",u.INVALID_ARGUMENT,{arg:"value",value:t});else if("number"==typeof t){parseInt(String(t))!==t&&u.throwError("underflow",u.NUMERIC_FAULT,{operation:"setValue",fault:"underflow",value:t,outputValue:parseInt(String(t))});try{a.defineReadOnly(this,"_hex",l(new o.default.BN(t)))}catch(t){u.throwError("overflow",u.NUMERIC_FAULT,{operation:"setValue",fault:"overflow",details:t.message})}}else t instanceof m?a.defineReadOnly(this,"_hex",t._hex):t.toHexString?a.defineReadOnly(this,"_hex",l(f(t.toHexString()))):t._hex&&s.isHexString(t._hex)?a.defineReadOnly(this,"_hex",t._hex):s.isArrayish(t)?a.defineReadOnly(this,"_hex",l(new o.default.BN(s.hexlify(t).substring(2),16))):u.throwError("invalid BigNumber value",u.INVALID_ARGUMENT,{arg:"value",value:t})}function g(t){return p.isBigNumber(t)?t:new p(t)}r.BigNumber=p,r.bigNumberify=g},{"../errors":5,"./bytes":64,"./properties":74,"bn.js":9}],64:[function(t,e,r){"use strict";var n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var i=n(t("../errors"));function o(t){return!!t.toHexString}function s(t){return t.slice||(t.slice=function(){var e=Array.prototype.slice.call(arguments);return s(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function a(t){if(!t||parseInt(String(t.length))!=t.length||"string"==typeof t)return!1;for(var e=0;e<t.length;e++){var r=t[e];if(r<0||256<=r||parseInt(String(r))!=r)return!1}return!0}function u(t){if(null==t&&i.throwError("cannot convert null value to array",i.INVALID_ARGUMENT,{arg:"value",value:t}),"string"!=typeof(t=o(t)?t.toHexString():t))return a(t)?s(new Uint8Array(t)):(i.throwError("invalid arrayify value",null,{arg:"value",value:t,type:typeof t}),null);var e=t.match(/^(0x)?[0-9a-fA-F]*$/);e||i.throwError("invalid hexidecimal string",i.INVALID_ARGUMENT,{arg:"value",value:t}),"0x"!==e[1]&&i.throwError("hex string must have 0x prefix",i.INVALID_ARGUMENT,{arg:"value",value:t}),(t=t.substring(2)).length%2&&(t="0"+t);for(var r=[],n=0;n<t.length;n+=2)r.push(parseInt(t.substr(n,2),16));return s(new Uint8Array(r))}function h(t){for(var e=[],r=0,n=0;n<t.length;n++){var i=u(t[n]);e.push(i),r+=i.length}var o=new Uint8Array(r),a=0;for(n=0;n<e.length;n++)o.set(e[n],a),a+=e[n].length;return s(o)}function l(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}r.isHexable=o,r.isArrayish=a,r.arrayify=u,r.concat=h,r.stripZeros=function(t){var e=u(t);if(0===e.length)return e;for(var r=0;0===e[r];)r++;return r?e.slice(r):e},r.padZeros=function(t,e){if(e<(t=u(t)).length)throw new Error("cannot pad");var r=new Uint8Array(e);return r.set(t,e-t.length),s(r)},r.isHexString=l;var f="0123456789abcdef";function c(t){if(o(t))return t.toHexString();if("number"==typeof t){t<0&&i.throwError("cannot hexlify negative value",i.INVALID_ARGUMENT,{arg:"value",value:t}),9007199254740991<=t&&i.throwError("out-of-range",i.NUMERIC_FAULT,{operartion:"hexlify",fault:"out-of-safe-range"});for(var e="";t;)e=f[15&t]+e,t=Math.floor(t/16);return e.length?"0x"+(e=e.length%2?"0"+e:e):"0x00"}if("string"==typeof t){var r=t.match(/^(0x)?[0-9a-fA-F]*$/);return r||i.throwError("invalid hexidecimal string",i.INVALID_ARGUMENT,{arg:"value",value:t}),"0x"!==r[1]&&i.throwError("hex string must have 0x prefix",i.INVALID_ARGUMENT,{arg:"value",value:t}),t.length%2?"0x0"+t.substring(2):t}if(a(t)){for(var n=[],s=0;s<t.length;s++){var u=t[s];n.push(f[(240&u)>>4]+f[15&u])}return"0x"+n.join("")}return i.throwError("invalid hexlify value",null,{arg:"value",value:t}),"never"}function d(t,e){for(l(t)||i.throwError("invalid hex string",i.INVALID_ARGUMENT,{arg:"value",value:t});t.length<2*e+2;)t="0x0"+t.substring(2);return t}function p(t){var e=0,r="0x",n="0x";if((o=t)&&null!=o.r&&null!=o.s){null==t.v&&null==t.recoveryParam&&i.throwError("at least on of recoveryParam or v must be specified",i.INVALID_ARGUMENT,{argument:"signature",value:t}),r=d(t.r,32),n=d(t.s,32),"string"==typeof(e=t.v)&&(e=parseInt(e,16));var o=t.recoveryParam;e=27+(o=null==o&&null!=t.v?1-e%2:o)}else{if(65!==(t=u(t)).length)throw new Error("invalid signature");r=c(t.slice(0,32)),n=c(t.slice(32,64)),27!==(e=t[64])&&28!==e&&(e=27+e%2)}return{r:r,s:n,recoveryParam:e-27,v:e}}r.hexlify=c,r.hexDataLength=function(t){return l(t)&&t.length%2==0?(t.length-2)/2:null},r.hexDataSlice=function(t,e,r){return l(t)||i.throwError("invalid hex data",i.INVALID_ARGUMENT,{arg:"value",value:t}),t.length%2!=0&&i.throwError("hex data length must be even",i.INVALID_ARGUMENT,{arg:"value",value:t}),e=2+2*e,null!=r?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)},r.hexStripZeros=function(t){for(l(t)||i.throwError("invalid hex string",i.INVALID_ARGUMENT,{arg:"value",value:t});3<t.length&&"0x0"===t.substring(0,3);)t="0x"+t.substring(3);return t},r.hexZeroPad=d,r.splitSignature=p,r.joinSignature=function(t){return c(h([(t=p(t)).r,t.s,t.recoveryParam?"0x1c":"0x1b"]))}},{"../errors":5}],65:[function(t,e,r){"use strict";var n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var i=n(t("../errors")),o=t("./bytes"),s=t("./utf8"),a=t("./keccak256"),u=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),h=new RegExp("^((.*)\\.)?([^.]+)$"),l=new RegExp("^[a-z0-9.-]*$");r.namehash=function(t){"string"!=typeof t&&i.throwError("invalid address - "+String(t),i.INVALID_ARGUMENT,{argument:"name",value:t}),(t=t.toLowerCase()).match(l)||i.throwError("contains invalid UseSTD3ASCIIRules characters",i.INVALID_ARGUMENT,{argument:"name",value:t});for(var e=u;t.length;){var r=t.match(h),n=s.toUtf8Bytes(r[3]);e=a.keccak256(o.concat([e,a.keccak256(n)])),t=r[2]||""}return o.hexlify(e)},r.id=function(t){return a.keccak256(s.toUtf8Bytes(t))},r.hashMessage=function(t){return a.keccak256(o.concat([s.toUtf8Bytes("Ethereum Signed Message:\n"),s.toUtf8Bytes(String(t.length)),"string"==typeof t?s.toUtf8Bytes(t):t]))}},{"../errors":5,"./bytes":64,"./keccak256":71,"./utf8":85}],66:[function(t,e,r){"use strict";var n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var i=n(t("../errors")),o=t("../wordlists/lang-en"),s=t("./basex"),a=t("./bytes"),u=t("./bignumber"),h=t("./utf8"),l=t("./pbkdf2"),f=t("./hmac"),c=t("./properties"),d=t("./secp256k1"),p=t("./sha2"),m=u.bigNumberify("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),g=h.toUtf8Bytes("Bitcoin seed"),y=2147483648;function v(t){return(1<<t)-1<<8-t}function w(t){return a.hexZeroPad(a.hexlify(t),32)}function b(t){var e=a.hexDataSlice(p.sha256(p.sha256(t)),0,4);return s.Base58.encode(a.concat([t,e]))}var M={};r.defaultPath="m/44'/60'/0'/0/0";var _=(Object.defineProperty(A.prototype,"extendedKey",{get:function(){if(256<=this.depth)throw new Error("Depth too large!");return b(a.concat([null!=this.privateKey?"0x0488ADE4":"0x0488B21E",a.hexlify(this.depth),this.parentFingerprint,a.hexZeroPad(a.hexlify(this.index),4),this.chainCode,null!=this.privateKey?a.concat(["0x00",this.privateKey]):this.publicKey]))},enumerable:!0,configurable:!0}),A.prototype.neuter=function(){return new A(M,null,this.publicKey,this.parentFingerprint,this.chainCode,this.index,this.depth,null,this.path)},A.prototype._derive=function(t){if(4294967295<t)throw new Error("invalid index - "+String(t));var e=this.path;e&&(e+="/"+(t&~y));var r=new Uint8Array(37);if(t&y){if(!this.privateKey)throw new Error("cannot derive child of neutered node");r.set(a.arrayify(this.privateKey),1),e&&(e+="'")}else r.set(a.arrayify(this.publicKey));for(var n=24;0<=n;n-=8)r[33+(n>>3)]=t>>24-n&255;var i=(h=f.computeHmac(f.SupportedAlgorithms.sha512,this.chainCode,r)).slice(0,32),o=h.slice(32),s=null,h=null;return this.privateKey?s=w(u.bigNumberify(i).add(this.privateKey).mod(m)):h=new d.KeyPair(a.hexlify(i))._addPoint(this.publicKey),new A(M,s,h,this.fingerprint,w(o),t,this.depth+1,this.mnemonic,e)},A.prototype.derivePath=function(t){var e=t.split("/");if(0===e.length||"m"===e[0]&&0!==this.depth)throw new Error("invalid path - "+t);"m"===e[0]&&e.shift();for(var r=this,n=0;n<e.length;n++){var i=e[n];if(i.match(/^[0-9]+'$/)){var o=parseInt(i.substring(0,i.length-1));if(y<=o)throw new Error("invalid path index - "+i);r=r._derive(y+o)}else{if(!i.match(/^[0-9]+$/))throw new Error("invalid path component - "+i);if(o=parseInt(i),y<=o)throw new Error("invalid path index - "+i);r=r._derive(o)}}return r},A.isHDNode=function(t){return c.isType(t,"HDNode")},A);function A(t,e,r,n,o,s,u,h,l){if(i.checkNew(this,A),t!==M)throw new Error("HDNode constructor cannot be called directly");e?(e=new d.KeyPair(e),c.defineReadOnly(this,"privateKey",e.privateKey),c.defineReadOnly(this,"publicKey",e.compressedPublicKey)):(c.defineReadOnly(this,"privateKey",null),c.defineReadOnly(this,"publicKey",a.hexlify(r))),c.defineReadOnly(this,"parentFingerprint",n),c.defineReadOnly(this,"fingerprint",a.hexDataSlice(p.ripemd160(p.sha256(this.publicKey)),0,4)),c.defineReadOnly(this,"address",d.computeAddress(this.publicKey)),c.defineReadOnly(this,"chainCode",o),c.defineReadOnly(this,"index",s),c.defineReadOnly(this,"depth",u),c.defineReadOnly(this,"mnemonic",h),c.defineReadOnly(this,"path",l),c.setType(this,"HDNode")}function E(t,e){if((t=a.arrayify(t)).length<16||64<t.length)throw new Error("invalid seed");return t=a.arrayify(f.computeHmac(f.SupportedAlgorithms.sha512,g,t)),new _(M,w(t.slice(0,32)),null,"0x00000000",w(t.slice(32)),0,0,e,"m")}function x(t,e){return e=h.toUtf8Bytes("mnemonic"+(e=e||""),h.UnicodeNormalizationForm.NFKD),a.hexlify(l.pbkdf2(h.toUtf8Bytes(t,h.UnicodeNormalizationForm.NFKD),e,2048,64,"sha512"))}function S(t,e){e=e||o.langEn,i.checkNormalize();var r=e.split(t);if(r.length%3!=0)throw new Error("invalid mnemonic");for(var n=a.arrayify(new Uint8Array(Math.ceil(11*r.length/8))),s=0,u=0;u<r.length;u++){var h=e.getWordIndex(r[u].normalize("NFKD"));if(-1===h)throw new Error("invalid mnemonic");for(var l=0;l<11;l++)h&1<<10-l&&(n[s>>3]|=1<<7-s%8),s++}var f=32*r.length/3,c=v(r.length/3);if(t=a.arrayify(p.sha256(n.slice(0,f/8)))[0],(t&=c)!=(n[n.length-1]&c))throw new Error("invalid checksum");return a.hexlify(n.slice(0,f/8))}function N(t,e){if((t=a.arrayify(t)).length%4!=0||t.length<16||32<t.length)throw new Error("invalid entropy");for(var r=[0],n=11,i=0;i<t.length;i++)8<n?(r[r.length-1]<<=8,r[r.length-1]|=t[i],n-=8):(r[r.length-1]<<=n,r[r.length-1]|=t[i]>>8-n,r.push(t[i]&(1<<8-n)-1),n+=3);var s=a.arrayify(p.sha256(t))[0],u=t.length/4;return s&=v(u),r[r.length-1]<<=u,r[r.length-1]|=s>>8-u,(e=e||o.langEn).join(r.map((function(t){return e.getWord(t)})))}r.HDNode=_,r.fromExtendedKey=function(t){var e=s.Base58.decode(t);82===e.length&&b(e.slice(0,78))===t||i.throwError("invalid extended key",i.INVALID_ARGUMENT,{argument:"extendedKey",value:"[REDACTED]"});var r=e[4],n=a.hexlify(e.slice(5,9)),o=parseInt(a.hexlify(e.slice(9,13)).substring(2),16),u=a.hexlify(e.slice(13,45)),h=e.slice(45,78);switch(a.hexlify(e.slice(0,4))){case"0x0488b21e":case"0x043587cf":return new _(M,null,a.hexlify(h),n,u,o,r,null,null);case"0x0488ade4":case"0x04358394":if(0!==h[0])break;return new _(M,a.hexlify(h.slice(1)),null,n,u,o,r,null,null)}return i.throwError("invalid extended key",i.INVALID_ARGUMENT,{argument:"extendedKey",value:"[REDACTED]"})},r.fromMnemonic=function(t,e,r){return E(x(t=N(S(t,e),e),r),t)},r.fromSeed=function(t){return E(t,null)},r.mnemonicToSeed=x,r.mnemonicToEntropy=S,r.entropyToMnemonic=N,r.isValidMnemonic=function(t,e){try{return S(t,e),!0}catch(t){}return!1}},{"../errors":5,"../wordlists/lang-en":90,"./basex":62,"./bignumber":63,"./bytes":64,"./hmac":67,"./pbkdf2":73,"./properties":74,"./secp256k1":77,"./sha2":79,"./utf8":85}],67:[function(t,e,r){"use strict";var n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var i,o=n(t("hash.js")),s=t("../utils/bytes"),a=n(t("../errors"));(t=i=r.SupportedAlgorithms||(r.SupportedAlgorithms={})).sha256="sha256",t.sha512="sha512",r.computeHmac=function(t,e,r){return i[t]||a.throwError("unsupported algorithm "+t,a.UNSUPPORTED_OPERATION,{operation:"hmac",algorithm:t}),s.arrayify(o.hmac(o[t],s.arrayify(e)).update(s.arrayify(r)).digest())}},{"../errors":5,"../utils/bytes":64,"hash.js":26}],68:[function(t,e,r){"use strict";var n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var i=t("./abi-coder");r.AbiCoder=i.AbiCoder,r.defaultAbiCoder=i.defaultAbiCoder,r.formatSignature=i.formatSignature,r.formatParamType=i.formatParamType,r.parseSignature=i.parseSignature,r.parseParamType=i.parseParamType,i=t("./address"),r.getAddress=i.getAddress,r.getContractAddress=i.getContractAddress,r.getCreate2Address=i.getCreate2Address,r.getIcapAddress=i.getIcapAddress,i=n(t("./base64")),r.base64=i,i=t("./bignumber"),r.BigNumber=i.BigNumber,r.bigNumberify=i.bigNumberify,i=t("./bytes"),r.arrayify=i.arrayify,r.concat=i.concat,r.hexDataSlice=i.hexDataSlice,r.hexDataLength=i.hexDataLength,r.hexlify=i.hexlify,r.hexStripZeros=i.hexStripZeros,r.hexZeroPad=i.hexZeroPad,r.isHexString=i.isHexString,r.joinSignature=i.joinSignature,r.padZeros=i.padZeros,r.splitSignature=i.splitSignature,r.stripZeros=i.stripZeros,i=t("./hash"),r.hashMessage=i.hashMessage,r.id=i.id,r.namehash=i.namehash,i=n(t("./hdnode")),r.HDNode=i,i=t("./interface"),r.Interface=i.Interface,i=t("./json-wallet"),r.getJsonWalletAddress=i.getJsonWalletAddress,i=t("./keccak256"),r.keccak256=i.keccak256,i=t("./sha2"),r.sha256=i.sha256,i=t("./solidity"),r.solidityKeccak256=i.keccak256,r.solidityPack=i.pack,r.soliditySha256=i.sha256,i=t("./random-bytes"),r.randomBytes=i.randomBytes,i=t("./networks"),r.getNetwork=i.getNetwork,i=t("./properties"),r.checkProperties=i.checkProperties,r.deepCopy=i.deepCopy,r.defineReadOnly=i.defineReadOnly,r.resolveProperties=i.resolveProperties,r.shallowCopy=i.shallowCopy,n=n(t("./rlp")),r.RLP=n,n=t("./secp256k1"),r.computeAddress=n.computeAddress,r.computePublicKey=n.computePublicKey,r.recoverAddress=n.recoverAddress,r.recoverPublicKey=n.recoverPublicKey,r.verifyMessage=n.verifyMessage,n=t("./signing-key"),r.SigningKey=n.SigningKey,n=t("./transaction"),r.populateTransaction=n.populateTransaction,n=t("./transaction"),r.parseTransaction=n.parse,r.serializeTransaction=n.serialize,n=t("./utf8"),r.formatBytes32String=n.formatBytes32String,r.parseBytes32String=n.parseBytes32String,r.toUtf8Bytes=n.toUtf8Bytes,r.toUtf8String=n.toUtf8String,n=t("./units"),r.commify=n.commify,r.formatEther=n.formatEther,r.parseEther=n.parseEther,r.formatUnits=n.formatUnits,r.parseUnits=n.parseUnits,n=t("./web"),r.fetchJson=n.fetchJson,r.poll=n.poll,n=t("./hmac"),r.SupportedAlgorithms=n.SupportedAlgorithms,n=t("./utf8"),r.UnicodeNormalizationForm=n.UnicodeNormalizationForm,t=t("./wordlist"),r.Wordlist=t.Wordlist},{"./abi-coder":59,"./address":60,"./base64":61,"./bignumber":63,"./bytes":64,"./hash":65,"./hdnode":66,"./hmac":67,"./interface":69,"./json-wallet":70,"./keccak256":71,"./networks":72,"./properties":74,"./random-bytes":75,"./rlp":76,"./secp256k1":77,"./sha2":79,"./signing-key":81,"./solidity":82,"./transaction":83,"./units":84,"./utf8":85,"./web":86,"./wordlist":87}],69:[function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var s,a=t("./address"),u=t("./abi-coder"),h=t("./bignumber"),l=t("./bytes"),f=t("./hash"),c=t("./keccak256"),d=t("./properties"),p=o(t("../errors")),m=function(t){d.setType(this,"Indexed"),d.defineReadOnly(this,"hash",t)},g=(i(y,s=t=function(t){for(var e in d.setType(this,"Description"),t)d.defineReadOnly(this,e,d.deepCopy(t[e],!0));Object.freeze(this)}),y.prototype.encode=function(t,e){l.isHexString(t)||p.throwError("invalid contract bytecode",p.INVALID_ARGUMENT,{arg:"bytecode",value:t}),p.checkArgumentCount(e.length,this.inputs.length," in Interface constructor");try{return t+u.defaultAbiCoder.encode(this.inputs,e).substring(2)}catch(t){p.throwError("invalid constructor argument",p.INVALID_ARGUMENT,{arg:t.arg,reason:t.reason,value:t.value})}return null},y);function y(){return null!==s&&s.apply(this,arguments)||this}var v,w=(i(b,v=t),b.prototype.encode=function(t){p.checkArgumentCount(t.length,this.inputs.length," in interface function "+this.name);try{return this.sighash+u.defaultAbiCoder.encode(this.inputs,t).substring(2)}catch(t){p.throwError("invalid input argument",p.INVALID_ARGUMENT,{arg:t.arg,reason:t.reason,value:t.value})}return null},b.prototype.decode=function(t){try{return u.defaultAbiCoder.decode(this.outputs,l.arrayify(t))}catch(e){p.throwError("invalid data for function output",p.INVALID_ARGUMENT,{arg:"data",errorArg:e.arg,errorValue:e.value,value:t,reason:e.reason})}},b);function b(){return null!==v&&v.apply(this,arguments)||this}var M,_=(i(A,M=t),A);function A(){return null!==M&&M.apply(this,arguments)||this}var E,x=(i(S,E=t),S.prototype.encodeTopics=function(t){var e=this;t.length>this.inputs.length&&p.throwError("too many arguments for "+this.name,p.UNEXPECTED_ARGUMENT,{maxCount:t.length,expectedCount:this.inputs.length});var r=[];for(this.anonymous||r.push(this.topic),t.forEach((function(t,n){var i=e.inputs[n];i.indexed?null==t?r.push(null):"string"===i.type?r.push(f.id(t)):"bytes"===i.type?r.push(c.keccak256(t)):-1!==i.type.indexOf("[")||"tuple"===i.type.substring(0,5)?p.throwError("filtering with tuples or arrays not implemented yet; bug us on GitHub",p.NOT_IMPLEMENTED,{operation:"filter(array|tuple)"}):("address"===i.type&&a.getAddress(t),r.push(l.hexZeroPad(l.hexlify(t),32).toLowerCase())):null!=t&&p.throwError("cannot filter non-indexed parameters; must be null",p.INVALID_ARGUMENT,{argument:i.name||n,value:t})}));r.length&&null===r[r.length-1];)r.pop();return r},S.prototype.decode=function(t,e){null==e||this.anonymous||(e=e.slice(1));var r,n=[],i=[],o=[];this.inputs.forEach((function(t,e){t.indexed?"string"===t.type||"bytes"===t.type||0<=t.type.indexOf("[")||"tuple"===t.type.substring(0,5)?(n.push({type:"bytes32",name:t.name||""}),o.push(!0)):(n.push(t),o.push(!1)):(i.push(t),o.push(!1))})),null!=e&&(r=u.defaultAbiCoder.decode(n,l.concat(e)));var s=u.defaultAbiCoder.decode(i,l.arrayify(t)),a={},h=0,f=0;return this.inputs.forEach((function(t,n){t.indexed?null==e?a[n]=new m(null):o[n]?a[n]=new m(r[f++]):a[n]=r[f++]:a[n]=s[h++],t.name&&(a[t.name]=a[n])})),a.length=this.inputs.length,new _(a)},S);function S(){return null!==E&&E.apply(this,arguments)||this}var N,k=(i(T,N=t),T);function T(){return null!==N&&N.apply(this,arguments)||this}var P,I=(i(R,P=t),R);function R(){return null!==P&&P.apply(this,arguments)||this}function O(t){switch(t.type){case"constructor":var e=new g({inputs:t.inputs,payable:null==t.payable||!!t.payable});this.deployFunction||(this.deployFunction=e);break;case"function":var r=u.formatSignature(t).replace(/tuple/g,""),n=f.id(r).substring(0,10),i=!1;null!=t.constant?i=t.constant:null!=t.stateMutability&&(i="view"==t.stateMutability||"pure"==t.stateMutability),e=new w({inputs:t.inputs,outputs:t.outputs,gas:t.gas,payable:null==t.payable||!!t.payable,type:i?"call":"transaction",name:t.name,signature:r,sighash:n}),t.name&&(null==this.functions[t.name]?d.defineReadOnly(this.functions,t.name,e):p.warn("WARNING: Multiple definitions for "+t.name)),null==this.functions[e.signature]&&d.defineReadOnly(this.functions,e.signature,e);break;case"event":r=u.formatSignature(t).replace(/tuple/g,""),e=new x({name:t.name,signature:r,inputs:t.inputs,topic:f.id(r),anonymous:!!t.anonymous}),t.name&&null==this.events[t.name]&&d.defineReadOnly(this.events,t.name,e),null==this.events[e.signature]&&d.defineReadOnly(this.events,e.signature,e);break;case"receive":case"fallback":break;default:p.warn("WARNING: unsupported ABI type - "+t.type)}}function C(t){if(p.checkNew(this,C),"string"==typeof t){try{t=JSON.parse(t)}catch(e){p.throwError("could not parse ABI JSON",p.INVALID_ARGUMENT,{arg:"abi",errorMessage:e.message,value:t})}if(!Array.isArray(t))return p.throwError("invalid abi",p.INVALID_ARGUMENT,{arg:"abi",value:t}),null}d.defineReadOnly(this,"functions",{}),d.defineReadOnly(this,"events",{});var e=[];t.forEach((function(t){"string"==typeof t&&(t=u.parseSignature(t)),e.push(t)})),d.defineReadOnly(this,"abi",d.deepCopy(e,!0)),e.forEach(O,this),this.deployFunction||O.call(this,{type:"constructor",inputs:[]}),d.setType(this,"Interface")}C.prototype.parseTransaction=function(t){var e,r=t.data.substring(0,10).toLowerCase();for(e in this.functions)if(-1!==e.indexOf("(")){var n=this.functions[e];if(n.sighash===r){var i=u.defaultAbiCoder.decode(n.inputs,"0x"+t.data.substring(10));return new k({args:i,decode:n.decode,name:n.name,signature:n.signature,sighash:n.sighash,value:h.bigNumberify(t.value||"0")})}}return null},C.prototype.parseLog=function(t){for(var e in this.events)if(-1!==e.indexOf("(")&&!(e=this.events[e]).anonymous&&e.topic===t.topics[0])return new I({decode:e.decode,name:e.name,signature:e.signature,topic:e.topic,values:e.decode(t.data,t.topics)});return null},C.isInterface=function(t){return d.isType(t,"Interface")},C.isIndexed=function(t){return d.isType(t,"Indexed")},t=C,r.Interface=t},{"../errors":5,"./abi-coder":59,"./address":60,"./bignumber":63,"./bytes":64,"./hash":65,"./keccak256":71,"./properties":74}],70:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./address");function i(t){try{var e=JSON.parse(t)}catch(t){return!1}return e.encseed&&e.ethaddr}function o(t){try{var e=JSON.parse(t)}catch(t){return!1}return!(!e.version||parseInt(e.version)!==e.version||3!==parseInt(e.version))}r.isCrowdsaleWallet=i,r.isSecretStorageWallet=o,r.getJsonWalletAddress=function(t){if(i(t))try{return n.getAddress(JSON.parse(t).ethaddr)}catch(t){return null}if(o(t))try{return n.getAddress(JSON.parse(t).address)}catch(t){return null}return null}},{"./address":60}],71:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("js-sha3"),i=t("./bytes");r.keccak256=function(t){return"0x"+n.keccak_256(i.arrayify(t))}},{"./bytes":64,"js-sha3":40}],72:[function(t,e,r){"use strict";var n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var i=n(t("../errors"));function o(t){return function(e){var r=[];return e.InfuraProvider&&r.push(new e.InfuraProvider(t)),e.EtherscanProvider&&r.push(new e.EtherscanProvider(t)),0===r.length?null:e.FallbackProvider?new e.FallbackProvider(r):r[0]}}function s(t,e){return function(r){return r.JsonRpcProvider?new r.JsonRpcProvider(t,e):null}}var a={unspecified:{chainId:0,name:"unspecified"},homestead:n={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:o("homestead")},mainnet:n,morden:{chainId:2,name:"morden"},ropsten:t={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:o("ropsten")},testnet:t,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:o("rinkeby")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:o("goerli")},kovan:{chainId:42,name:"kovan",_defaultProvider:o("kovan")},classic:{chainId:61,name:"classic",_defaultProvider:s("https://web3.gastracker.io","classic")},classicTestnet:{chainId:62,name:"classicTestnet",_defaultProvider:s("https://web3.gastracker.io/morden","classicTestnet")}};r.getNetwork=function(t){if(null==t)return null;if("number"==typeof t){for(var e in a)if((e=a[e]).chainId===t)return{name:e.name,chainId:e.chainId,ensAddress:e.ensAddress||null,_defaultProvider:e._defaultProvider||null};return{chainId:t,name:"unknown"}}if("string"!=typeof t)return(r=a[t.name])?(0!==t.chainId&&t.chainId!==r.chainId&&i.throwError("network chainId mismatch",i.INVALID_ARGUMENT,{arg:"network",value:t}),{name:t.name,chainId:r.chainId,ensAddress:t.ensAddress||r.ensAddress||null,_defaultProvider:t._defaultProvider||r._defaultProvider||null}):("number"!=typeof t.chainId&&i.throwError("invalid network chainId",i.INVALID_ARGUMENT,{arg:"network",value:t}),t);var r=a[t];return null==r?null:{name:r.name,chainId:r.chainId,ensAddress:r.ensAddress,_defaultProvider:r._defaultProvider||null}}},{"../errors":5}],73:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("../utils/bytes"),i=t("./hmac");r.pbkdf2=function(t,e,r,o,s){var a;t=n.arrayify(t),e=n.arrayify(e);var u,h,l=1,f=new Uint8Array(o),c=new Uint8Array(e.length+4);c.set(e);for(var d=1;d<=l;d++){c[e.length]=d>>24&255,c[e.length+1]=d>>16&255,c[e.length+2]=d>>8&255,c[e.length+3]=255&d;var p=i.computeHmac(s,t,c);a||(a=p.length,h=new Uint8Array(a),u=o-((l=Math.ceil(o/a))-1)*a),h.set(p);for(var m=1;m<r;m++){p=i.computeHmac(s,t,p);for(var g=0;g<a;g++)h[g]^=p[g]}var y=(d-1)*a,v=d===l?u:a;f.set(n.arrayify(h).slice(0,v),y)}return n.arrayify(f)}},{"../utils/bytes":64,"./hmac":67}],74:[function(t,e,r){"use strict";var n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var i=n(t("../errors"));function o(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}function s(t,e){return t&&t._ethersType===e}r.defineReadOnly=o,r.setType=function(t,e){Object.defineProperty(t,"_ethersType",{configurable:!1,value:e,writable:!1})},r.isType=s,r.resolveProperties=function(t){var e={},r=[];return Object.keys(t).forEach((function(n){var i=t[n];i instanceof Promise?r.push(i.then((function(t){return e[n]=t,null}))):e[n]=i})),Promise.all(r).then((function(){return e}))},r.checkProperties=function(t,e){t&&"object"==typeof t||i.throwError("invalid object",i.INVALID_ARGUMENT,{argument:"object",value:t}),Object.keys(t).forEach((function(r){e[r]||i.throwError("invalid object key - "+r,i.INVALID_ARGUMENT,{argument:"transaction",value:t,key:r})}))},r.shallowCopy=function(t){var e,r={};for(e in t)r[e]=t[e];return r};var a={boolean:!0,number:!0,string:!0};r.deepCopy=function t(e,r){if(null==e||a[typeof e])return e;if(Array.isArray(e)){var n=e.map((function(e){return t(e,r)}));return r&&Object.freeze(n),n}if("object"==typeof e){if(s(e,"BigNumber"))return e;if(s(e,"Description"))return e;if(s(e,"Indexed"))return e;var i;for(i in n={},e){var u=e[i];void 0!==u&&o(n,i,t(u,r))}return r&&Object.freeze(n),n}if("function"==typeof e)return e;throw new Error("Cannot deepCopy "+typeof e)},r.inheritable=function t(e){return function(r){var n,i;i=e,(n=r).super_=i,n.prototype=Object.create(i.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),o(r,"inherits",t(r))}}},{"../errors":5}],75:[function(t,r,n){(function(e){(function(){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=t("../utils/bytes"),i=t("../utils/properties"),o=e.crypto||e.msCrypto;function s(t){if(t<=0||1024<t||parseInt(String(t))!=t)throw new Error("invalid length");return t=new Uint8Array(t),o.getRandomValues(t),r.arrayify(t)}o&&o.getRandomValues||(console.log("WARNING: Missing strong random number source; using weak randomBytes"),o={getRandomValues:function(t){for(var e=0;e<20;e++)for(var r=0;r<t.length;r++)e?t[r]^=Math.trunc(256*Math.random()):t[r]=Math.trunc(256*Math.random());return t},_weakCrypto:!0}),n.randomBytes=s,!0===o._weakCrypto&&i.defineReadOnly(s,"_weakCrypto",!0)}).call(this)}).call(this,void 0!==e?e:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../utils/bytes":64,"../utils/properties":74}],76:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./bytes");function i(t){for(var e=[];t;)e.unshift(255&t),t>>=8;return e}function o(t,e,r){for(var n=0,i=0;i<r;i++)n=256*n+t[e+i];return n}function s(t,e,r,n){for(var i=[];r<e+1+n;){var o=a(t,r);if(i.push(o.result),e+1+n<(r+=o.consumed))throw new Error("invalid rlp")}return{consumed:1+n,result:i}}function a(t,e){if(0===t.length)throw new Error("invalid rlp data");if(248<=t[e]){if(e+1+(r=t[e]-247)>t.length)throw new Error("too short");if(e+1+r+(i=o(t,e+1,r))>t.length)throw new Error("to short");return s(t,e,e+1+r,r+i)}if(192<=t[e]){if(e+1+(i=t[e]-192)>t.length)throw new Error("invalid rlp data");return s(t,e,e+1,i)}if(184<=t[e]){var r;if(e+1+(r=t[e]-183)>t.length)throw new Error("invalid rlp data");if(e+1+r+(i=o(t,e+1,r))>t.length)throw new Error("invalid rlp data");return{consumed:1+r+i,result:n.hexlify(t.slice(e+1+r,e+1+r+i))}}if(128<=t[e]){var i;if(e+1+(i=t[e]-128)>t.length)throw new Error("invalid rlp data");return{consumed:1+i,result:n.hexlify(t.slice(e+1,e+1+i))}}return{consumed:1,result:n.hexlify(t[e])}}r.encode=function(t){return n.hexlify(function t(e){if(Array.isArray(e)){var r=[];return e.forEach((function(e){r=r.concat(t(e))})),r.length<=55?(r.unshift(192+r.length),r):((o=i(r.length)).unshift(247+o.length),o.concat(r))}var o;return 1===(e=Array.prototype.slice.call(n.arrayify(e))).length&&e[0]<=127?e:e.length<=55?(e.unshift(128+e.length),e):((o=i(e.length)).unshift(183+o.length),o.concat(e))}(t))},r.decode=function(t){var e=n.arrayify(t);if((t=a(e,0)).consumed!==e.length)throw new Error("invalid rlp data");return t.result}},{"./bytes":64}],77:[function(t,e,r){"use strict";var n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var i=t("elliptic"),o=t("./address"),s=t("./bytes"),a=t("./hash"),u=t("./keccak256"),h=t("./properties"),l=n(t("../errors")),f=null;function c(){return f=f||new i.ec("secp256k1")}var d=(p.prototype.sign=function(t){return{recoveryParam:(t=c().keyFromPrivate(s.arrayify(this.privateKey)).sign(s.arrayify(t),{canonical:!0})).recoveryParam,r:s.hexZeroPad("0x"+t.r.toString(16),32),s:s.hexZeroPad("0x"+t.s.toString(16),32),v:27+t.recoveryParam}},p.prototype.computeSharedSecret=function(t){var e=c().keyFromPrivate(s.arrayify(this.privateKey));return t=c().keyFromPublic(s.arrayify(m(t))),s.hexZeroPad("0x"+e.derive(t.getPublic()).toString(16),32)},p.prototype._addPoint=function(t){var e=c().keyFromPublic(s.arrayify(this.publicKey));return t=c().keyFromPublic(s.arrayify(t)),"0x"+e.pub.add(t.pub).encodeCompressed("hex")},p);function p(t){t=c().keyFromPrivate(s.arrayify(t)),h.defineReadOnly(this,"privateKey",s.hexlify(t.priv.toArray("be",32))),h.defineReadOnly(this,"publicKey","0x"+t.getPublic(!1,"hex")),h.defineReadOnly(this,"compressedPublicKey","0x"+t.getPublic(!0,"hex")),h.defineReadOnly(this,"publicKeyBytes",t.getPublic().encode(null,!0))}function m(t,e){return 32!==(t=s.arrayify(t)).length?33===t.length?e?s.hexlify(t):"0x"+c().keyFromPublic(t).getPublic(!1,"hex"):65===t.length?e?"0x"+c().keyFromPublic(t).getPublic(!0,"hex"):s.hexlify(t):(l.throwError("invalid public or private key",l.INVALID_ARGUMENT,{arg:"key",value:"[REDACTED]"}),null):(t=new d(t),e?t.compressedPublicKey:t.publicKey)}function g(t){return t="0x"+m(t).slice(4),o.getAddress("0x"+u.keccak256(t).substring(26))}function y(t,e){var r=s.splitSignature(e);return e={r:s.arrayify(r.r),s:s.arrayify(r.s)},"0x"+c().recoverPubKey(s.arrayify(t),e,r.recoveryParam).encode("hex",!1)}function v(t,e){return g(y(s.arrayify(t),e))}r.KeyPair=d,r.computePublicKey=m,r.computeAddress=g,r.recoverPublicKey=y,r.recoverAddress=v,r.verifyMessage=function(t,e){return v(a.hashMessage(t),e)}},{"../errors":5,"./address":60,"./bytes":64,"./hash":65,"./keccak256":71,"./properties":74,elliptic:12}],78:[function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var o=n(t("aes-js")),s=n(t("scrypt-js")),a=n(t("uuid")),u=t("./signing-key"),h=i(t("./hdnode")),l=t("./address"),f=t("./bytes"),c=t("./pbkdf2"),d=t("./keccak256"),p=t("./utf8"),m=t("./random-bytes");function g(t){return"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),f.arrayify(t)}function y(t,e){for(t=String(t);t.length<e;)t="0"+t;return t}function v(t){return"string"==typeof t?p.toUtf8Bytes(t,p.UnicodeNormalizationForm.NFKC):f.arrayify(t)}function w(t,e){for(var r=t,n=e.toLowerCase().split("/"),i=0;i<n.length;i++){var o,s=null;for(o in r)if(o.toLowerCase()===n[i]){s=r[o];break}if(null===s)return null;r=s}return r}r.decryptCrowdsale=function(t,e){var r=JSON.parse(t);e=v(e);var n=l.getAddress(w(r,"ethaddr"));if(!(t=g(w(r,"encseed")))||t.length%16!=0)throw new Error("invalid encseed");r=c.pbkdf2(e,e,2e3,32,"sha256").slice(0,16),e=t.slice(0,16),t=t.slice(16),e=new o.default.ModeOfOperation.cbc(r,e);for(var i=f.arrayify(e.decrypt(t)),s=(i=o.default.padding.pkcs7.strip(i),""),a=0;a<i.length;a++)s+=String.fromCharCode(i[a]);if(t=p.toUtf8Bytes(s),(t=new u.SigningKey(d.keccak256(t))).address!==n)throw new Error("corrupt crowdsale wallet");return t},r.decrypt=function(t,e,r){function n(t,e){var r=g(w(i,"crypto/ciphertext"));if(f.hexlify((a=t.slice(16,32),d.keccak256(f.concat([a,r])))).substring(2)!==w(i,"crypto/mac").toLowerCase())return e(new Error("invalid password")),null;var n=function(t,e){if("aes-128-ctr"!==w(i,"crypto/cipher"))return null;var r=g(w(i,"crypto/cipherparams/iv"));return r=new o.default.Counter(r),r=new o.default.ModeOfOperation.ctr(t,r),f.arrayify(r.decrypt(e))}(t.slice(0,16),r),s=t.slice(32,64);if(!n)return e(new Error("unsupported cipher")),null;var a=new u.SigningKey(n);if(i.address&&a.address!==l.getAddress(i.address))return e(new Error("address mismatch")),null;if(r=w(i,"x-ethers/locale"),"0.1"===w(i,"x-ethers/version")&&(null==r||"en"===r)){if(t=g(w(i,"x-ethers/mnemonicCiphertext")),r=g(w(i,"x-ethers/mnemonicCounter")),r=new o.default.Counter(r),s=new o.default.ModeOfOperation.ctr(s,r),r=w(i,"x-ethers/path")||h.defaultPath,t=f.arrayify(s.decrypt(t)),t=h.entropyToMnemonic(t),(r=h.fromMnemonic(t).derivePath(r)).privateKey!=f.hexlify(n))return e(new Error("mnemonic mismatch")),null;a=new u.SigningKey(r)}return a}var i=JSON.parse(t),a=v(e);return new Promise((function(t,e){if((p=w(i,"crypto/kdf"))&&"string"==typeof p)if("scrypt"===p.toLowerCase()){var o=g(w(i,"crypto/kdfparams/salt")),u=parseInt(w(i,"crypto/kdfparams/n")),h=parseInt(w(i,"crypto/kdfparams/r")),l=parseInt(w(i,"crypto/kdfparams/p"));u&&h&&l?0==(u&u-1)?32===(d=parseInt(w(i,"crypto/kdfparams/dklen")))?(r&&r(0),s.default(a,o,u,h,l,64,(function(i,o,s){if(i)i.progress=o,e(i);else if(s)(s=n(s=f.arrayify(s),e))&&(r&&r(1),t(s));else if(r)return r(o)}))):e(new Error("unsupported key-derivation derived-key length")):e(new Error("unsupported key-derivation function parameter value for N")):e(new Error("unsupported key-derivation function parameters"))}else if("pbkdf2"===p.toLowerCase()){if(o=g(w(i,"crypto/kdfparams/salt")),l=null,"hmac-sha256"===(p=w(i,"crypto/kdfparams/prf")))l="sha256";else{if("hmac-sha512"!==p)return void e(new Error("unsupported prf"));l="sha512"}var d,p=parseInt(w(i,"crypto/kdfparams/c"));32===(d=parseInt(w(i,"crypto/kdfparams/dklen")))?(l=n(l=c.pbkdf2(a,o,p,d,l),e))&&t(l):e(new Error("unsupported key-derivation derived-key length"))}else e(new Error("unsupported key-derivation function"));else e(new Error("unsupported key-derivation function"))}))},r.encrypt=function(t,e,r,n){"function"!=typeof r||n||(n=r,r={}),r=r||{};var i=null;if(32!==(i=u.SigningKey.isSigningKey(t)?f.arrayify(t.privateKey):f.arrayify(t)).length)throw new Error("invalid private key");var l=v(e),c=null;if(r.entropy&&(c=f.arrayify(r.entropy)),r.mnemonic)if(c){if(h.entropyToMnemonic(c)!==r.mnemonic)throw new Error("entropy and mnemonic mismatch")}else c=f.arrayify(h.mnemonicToEntropy(r.mnemonic,r.wordlist));var p=r.path;c&&!p&&(p=h.defaultPath);var g=(g=r.client)||"ethers.js",w=null,b=(w=r.salt?f.arrayify(r.salt):m.randomBytes(32),null);if(r.iv){if(16!==(b=f.arrayify(r.iv)).length)throw new Error("invalid iv")}else b=m.randomBytes(16);var M=null;if(r.uuid){if(16!==(M=f.arrayify(r.uuid)).length)throw new Error("invalid uuid")}else M=m.randomBytes(16);var _=1<<17,A=8,E=1;return r.scrypt&&(r.scrypt.N&&(_=r.scrypt.N),r.scrypt.r&&(A=r.scrypt.r),r.scrypt.p&&(E=r.scrypt.p)),new Promise((function(t,e){n&&n(0),s.default(l,w,_,A,E,64,(function(s,h,l){if(s)s.progress=h,e(s);else if(l){var v=(l=f.arrayify(l)).slice(0,16),x=l.slice(16,32),S=l.slice(32,64);s=new u.SigningKey(i).address,l=new o.default.Counter(b),l=new o.default.ModeOfOperation.ctr(v,l),l=f.arrayify(l.encrypt(i)),x=d.keccak256(f.concat([x,l])),s={address:s.substring(2).toLowerCase(),id:a.default.v4({random:M}),version:3,Crypto:{cipher:"aes-128-ctr",cipherparams:{iv:f.hexlify(b).substring(2)},ciphertext:f.hexlify(l).substring(2),kdf:"scrypt",kdfparams:{salt:f.hexlify(w).substring(2),n:_,dklen:32,p:E,r:A},mac:x.substring(2)}},c&&(l=m.randomBytes(16),x=new o.default.Counter(l),S=new o.default.ModeOfOperation.ctr(S,x),x=f.arrayify(S.encrypt(c)),S=(S=new Date).getUTCFullYear()+"-"+y(S.getUTCMonth()+1,2)+"-"+y(S.getUTCDate(),2)+"T"+y(S.getUTCHours(),2)+"-"+y(S.getUTCMinutes(),2)+"-"+y(S.getUTCSeconds(),2)+".0Z",s["x-ethers"]={client:g,gethFilename:"UTC--"+S+"--"+s.address,mnemonicCounter:f.hexlify(l).substring(2),mnemonicCiphertext:f.hexlify(x).substring(2),path:p,version:"0.1"},r.wordlist&&"string"==typeof r.wordlist.locale&&(s["x-ethers"].locale=r.wordlist.locale)),n&&n(1),t(JSON.stringify(s))}else if(n)return n(h)}))}))}},{"./address":60,"./bytes":64,"./hdnode":66,"./keccak256":71,"./pbkdf2":73,"./random-bytes":75,"./signing-key":81,"./utf8":85,"aes-js":8,"scrypt-js":44,uuid:48}],79:[function(t,e,r){"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(t("hash.js")),o=t("./bytes");r.ripemd160=function(t){return"0x"+i.default.ripemd160().update(o.arrayify(t)).digest("hex")},r.sha256=function(t){return"0x"+i.default.sha256().update(o.arrayify(t)).digest("hex")},r.sha512=function(t){return"0x"+i.default.sha512().update(o.arrayify(t)).digest("hex")}},{"./bytes":64,"hash.js":26}],80:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),t("setimmediate"),r.platform="browser"},{setimmediate:45}],81:[function(t,e,r){"use strict";var n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var i=t("./hdnode"),o=t("./bytes"),s=t("./properties"),a=t("./secp256k1"),u=n(t("../errors"));function h(t){u.checkNew(this,h);var e=null;e=i.HDNode.isHDNode(t)?(s.defineReadOnly(this,"mnemonic",t.mnemonic),s.defineReadOnly(this,"path",t.path),o.arrayify(t.privateKey)):("string"==typeof t&&t.match(/^[0-9a-f]*$/i)&&64===t.length&&(t="0x"+t),o.arrayify(t));try{32!==e.length&&u.throwError("exactly 32 bytes required",u.INVALID_ARGUMENT,{arg:"privateKey",value:"[REDACTED]"})}catch(e){t={arg:"privateKey",reason:e.reason,value:"[REDACTED]"},e.value&&("number"==typeof e.value.length&&(t.length=e.value.length),t.type=typeof e.value),u.throwError("invalid private key",e.code,t)}s.defineReadOnly(this,"privateKey",o.hexlify(e)),s.defineReadOnly(this,"keyPair",new a.KeyPair(e)),s.defineReadOnly(this,"publicKey",this.keyPair.publicKey),s.defineReadOnly(this,"address",a.computeAddress(this.keyPair.publicKey)),s.setType(this,"SigningKey")}h.prototype.signDigest=function(t){return this.keyPair.sign(t)},h.prototype.computeSharedSecret=function(t){return this.keyPair.computeSharedSecret(o.arrayify(t))},h.isSigningKey=function(t){return s.isType(t,"SigningKey")},t=h,r.SigningKey=t},{"../errors":5,"./bytes":64,"./hdnode":66,"./properties":74,"./secp256k1":77}],82:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./bignumber"),i=t("./bytes"),o=t("./utf8"),s=t("./keccak256"),a=t("./sha2"),u=new RegExp("^bytes([0-9]+)$"),h=new RegExp("^(u?int)([0-9]*)$"),l=new RegExp("^(.*)\\[([0-9]*)\\]$"),f="0000000000000000000000000000000000000000000000000000000000000000";function c(t,e){if(t.length!=e.length)throw new Error("type/value count mismatch");var r=[];return t.forEach((function(t,s){r.push(function t(e,r,s){switch(e){case"address":return s?i.padZeros(r,32):i.arrayify(r);case"string":return o.toUtf8Bytes(r);case"bytes":return i.arrayify(r);case"bool":return r=r?"0x01":"0x00",s?i.padZeros(r,32):i.arrayify(r)}var a=e.match(h);if(a){if((c=parseInt(a[2]||"256"))%8!=0||0===c||256<c)throw new Error("invalid number type - "+e);return s&&(c=256),r=n.bigNumberify(r).toTwos(c),i.padZeros(r,c/8)}if(a=e.match(u)){var c=parseInt(a[1]);if(String(c)!=a[1]||0===c||32<c)throw new Error("invalid number type - "+e);if(i.arrayify(r).byteLength!==c)throw new Error("invalid value for "+e);return s?i.arrayify((r+f).substring(0,66)):r}if((a=e.match(l))&&Array.isArray(r)){var d=a[1];if(parseInt(a[2]||String(r.length))!=r.length)throw new Error("invalid value for "+e);var p=[];return r.forEach((function(e){p.push(t(d,e,!0))})),i.concat(p)}throw new Error("unknown type - "+e)}(t,e[s]))})),i.hexlify(i.concat(r))}r.pack=c,r.keccak256=function(t,e){return s.keccak256(c(t,e))},r.sha256=function(t,e){return a.sha256(c(t,e))}},{"./bignumber":63,"./bytes":64,"./keccak256":71,"./sha2":79,"./utf8":85}],83:[function(t,e,r){"use strict";var n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var i=t("../constants"),o=n(t("../errors")),s=t("./secp256k1"),a=t("./address"),u=t("./bignumber"),h=t("./bytes"),l=t("./keccak256"),f=t("./properties"),c=n(t("./rlp")),d=t("../providers/abstract-provider");function p(t){return"0x"===t?i.Zero:u.bigNumberify(t)}var m=[{name:"nonce",maxLength:32},{name:"gasPrice",maxLength:32},{name:"gasLimit",maxLength:32},{name:"to",length:20},{name:"value",maxLength:32},{name:"data"}],g={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0};r.serialize=function(t,e){f.checkProperties(t,g);var r=[];m.forEach((function(e){var n=t[e.name]||[];n=h.arrayify(h.hexlify(n)),e.length&&n.length!==e.length&&0<n.length&&o.throwError("invalid length for "+e.name,o.INVALID_ARGUMENT,{arg:"transaction"+e.name,value:n}),e.maxLength&&(n=h.stripZeros(n)).length>e.maxLength&&o.throwError("invalid length for "+e.name,o.INVALID_ARGUMENT,{arg:"transaction"+e.name,value:n}),r.push(h.hexlify(n))})),null!=t.chainId&&0!==t.chainId&&(r.push(h.hexlify(t.chainId)),r.push("0x"),r.push("0x"));var n=c.encode(r);return e?(e=27+(n=h.splitSignature(e)).recoveryParam,9===r.length&&(r.pop(),r.pop(),r.pop(),e+=2*t.chainId+8),r.push(h.hexlify(e)),r.push(h.stripZeros(h.arrayify(n.r))),r.push(h.stripZeros(h.arrayify(n.s))),c.encode(r)):n},r.parse=function(t){9!==(n=c.decode(t)).length&&6!==n.length&&o.throwError("invalid raw transaction",o.INVALID_ARGUMENT,{arg:"rawTransactin",value:t});var e={nonce:p(n[0]).toNumber(),gasPrice:p(n[1]),gasLimit:p(n[2]),to:"0x"===(r=n[3])?null:a.getAddress(r),value:p(n[4]),data:n[5],chainId:0};if(6===n.length)return e;try{e.v=u.bigNumberify(n[6]).toNumber()}catch(t){return o.info(t),e}if(e.r=h.hexZeroPad(n[7],32),e.s=h.hexZeroPad(n[8],32),u.bigNumberify(e.r).isZero()&&u.bigNumberify(e.s).isZero())e.chainId=e.v,e.v=0;else{e.chainId=Math.floor((e.v-35)/2),e.chainId<0&&(e.chainId=0);var r=e.v-27,n=n.slice(0,6);0!==e.chainId&&(n.push(h.hexlify(e.chainId)),n.push("0x"),n.push("0x"),r-=2*e.chainId+8),n=l.keccak256(c.encode(n));try{e.from=s.recoverAddress(n,{r:h.hexlify(e.r),s:h.hexlify(e.s),recoveryParam:r})}catch(t){o.info(t)}e.hash=l.keccak256(t)}return e},r.populateTransaction=function(t,e,r){d.Provider.isProvider(e)||o.throwError("missing provider",o.INVALID_ARGUMENT,{argument:"provider",value:e}),f.checkProperties(t,g);var n=f.shallowCopy(t);return null!=n.to&&(n.to=e.resolveName(n.to)),null==n.gasPrice&&(n.gasPrice=e.getGasPrice()),null==n.nonce&&(n.nonce=e.getTransactionCount(r)),null==n.gasLimit&&((t=f.shallowCopy(n)).from=r,n.gasLimit=e.estimateGas(t)),null==n.chainId&&(n.chainId=e.getNetwork().then((function(t){return t.chainId}))),f.resolveProperties(n)}},{"../constants":3,"../errors":5,"../providers/abstract-provider":50,"./address":60,"./bignumber":63,"./bytes":64,"./keccak256":71,"./properties":74,"./rlp":76,"./secp256k1":77}],84:[function(t,e,r){"use strict";var n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var i,o=t("../constants"),s=n(t("../errors")),a=t("./bignumber"),u={};function h(t){return{decimals:t.length-1,tenPower:a.bigNumberify(t)}}function l(t){var e=u[String(t).toLowerCase()];if(!e&&"number"==typeof t&&parseInt(String(t))==t&&0<=t&&t<=256){for(var r="1",n=0;n<t;n++)r+="0";e=h(r)}return e||s.throwError("invalid unitType",s.INVALID_ARGUMENT,{argument:"name",value:t}),e}function f(t,e){for(var r=l(e),n=(e=(t=a.bigNumberify(t)).lt(o.Zero),(t=e?t.mul(o.NegativeOne):t).mod(r.tenPower).toString());n.length<r.decimals;)n="0"+n;return n=n.match(/^([0-9]*[1-9]|0)(0*)/)[1],t=t.div(r.tenPower).toString()+"."+n,e?"-"+t:t}function c(t,e){var r=l(e=null==e?18:e);if("string"==typeof t&&t.match(/^-?[0-9.,]+$/)||s.throwError("invalid decimal value",s.INVALID_ARGUMENT,{arg:"value",value:t}),0===r.decimals)return a.bigNumberify(t);var n="-"===t.substring(0,1);"."===(t=n?t.substring(1):t)&&s.throwError("missing value",s.INVALID_ARGUMENT,{arg:"value",value:t}),2<(e=t.split(".")).length&&s.throwError("too many decimal points",s.INVALID_ARGUMENT,{arg:"value",value:t}),t=e[0];var i=e[1];for(t=t||"0",(i=i||"0").length>r.decimals&&s.throwError("underflow occurred",s.NUMERIC_FAULT,{operation:"division",fault:"underflow"});i.length<r.decimals;)i+="0";return e=a.bigNumberify(t),t=a.bigNumberify(i),t=e.mul(r.tenPower).add(t),n?t.mul(o.NegativeOne):t}i="1",["wei","kwei","Mwei","Gwei","szabo","finney","ether"].forEach((function(t){var e=h(i);u[t.toLowerCase()]=e,u[String(e.decimals)]=e,i+="000"})),r.commify=function(t){var e=String(t).split(".");(2<e.length||!e[0].match(/^-?[0-9]*$/)||e[1]&&!e[1].match(/^[0-9]*$/)||"."===t||"-."===t)&&s.throwError("invalid value",s.INVALID_ARGUMENT,{argument:"value",value:t});var r=e[0],n="";for("-"===r.substring(0,1)&&(n="-",r=r.substring(1));"0"===r.substring(0,1);)r=r.substring(1);""===r&&(r="0"),t="",2===e.length&&(t="."+(e[1]||"0"));for(var i=[];r.length;){if(r.length<=3){i.unshift(r);break}var o=r.length-3;i.unshift(r.substring(o)),r=r.substring(0,o)}return n+i.join(",")+t},r.formatUnits=f,r.parseUnits=c,r.formatEther=function(t){return f(t,18)},r.parseEther=function(t){return c(t,18)}},{"../constants":3,"../errors":5,"./bignumber":63}],85:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n,i=t("../constants"),o=t("../errors"),s=t("./bytes");function a(t,e){(e=void 0===e?n.current:e)!=n.current&&(o.checkNormalize(),t=t.normalize(e));for(var r=[],i=0;i<t.length;i++){var a=t.charCodeAt(i);if(a<128)r.push(a);else if(a<2048)r.push(a>>6|192),r.push(63&a|128);else if(55296==(64512&a)){i++;var u=t.charCodeAt(i);if(i>=t.length||56320!=(64512&u))throw new Error("invalid utf-8 string");r.push((a=65536+((1023&a)<<10)+(1023&u))>>18|240),r.push(a>>12&63|128),r.push(a>>6&63|128),r.push(63&a|128)}else r.push(a>>12|224),r.push(a>>6&63|128),r.push(63&a|128)}return s.arrayify(r)}function u(t,e){t=s.arrayify(t);for(var r="",n=0;n<t.length;){var i=t[n++];if(i>>7!=0){var o=null,a=null;if(192==(224&i))o=1,a=127;else if(224==(240&i))o=2,a=2047;else{if(240!=(248&i)){if(e)continue;if(128==(192&i))throw new Error("invalid utf8 byte sequence; unexpected continuation byte");throw new Error("invalid utf8 byte sequence; invalid prefix")}o=3,a=65535}if(n+o>t.length){if(!e)throw new Error("invalid utf8 byte sequence; too short");for(;n<t.length&&t[n]>>6==2;n++);}else{for(var u=i&(1<<8-o-1)-1,h=0;h<o;h++){var l=t[n];if(128!=(192&l)){u=null;break}u=u<<6|63&l,n++}if(null!==u)if(u<=a){if(!e)throw new Error("invalid utf8 byte sequence; overlong")}else if(1114111<u){if(!e)throw new Error("invalid utf8 byte sequence; out-of-range")}else if(55296<=u&&u<=57343){if(!e)throw new Error("invalid utf8 byte sequence; utf-16 surrogate")}else u<=65535?r+=String.fromCharCode(u):(u-=65536,r+=String.fromCharCode(55296+(u>>10&1023),56320+(1023&u)));else if(!e)throw new Error("invalid utf8 byte sequence; invalid continuation byte")}}else r+=String.fromCharCode(i)}return r}(t=n=r.UnicodeNormalizationForm||(r.UnicodeNormalizationForm={})).current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD",r.toUtf8Bytes=a,r.toUtf8String=u,r.formatBytes32String=function(t){if(31<(t=a(t)).length)throw new Error("bytes32 string must be less than 32 bytes");return s.hexlify(s.concat([t,i.HashZero]).slice(0,32))},r.parseBytes32String=function(t){var e=s.arrayify(t);if(32!==e.length)throw new Error("invalid bytes32 - not 32 bytes long");if(0!==e[31])throw new Error("invalid bytes32 string - no null terminator");for(var r=31;0===e[r-1];)r--;return u(e.slice(0,r))}},{"../constants":3,"../errors":5,"./bytes":64}],86:[function(t,e,r){"use strict";var n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var i=t("xmlhttprequest"),o=t("./base64"),s=t("./properties"),a=t("./utf8"),u=n(t("../errors"));r.fetchJson=function(t,e,r){var n,s={},h=null,l=12e4;if("string"==typeof t)h=t;else if("object"==typeof t){if(null==t.url&&u.throwError("missing URL",u.MISSING_ARGUMENT,{arg:"url"}),h=t.url,"number"==typeof t.timeout&&0<t.timeout&&(l=t.timeout),t.headers)for(var f in t.headers)s[f.toLowerCase()]={key:f,value:String(t.headers[f])};null!=t.user&&null!=t.password&&("https:"!==h.substring(0,6)&&!0!==t.allowInsecure&&u.throwError("basic authentication requires a secure https url",u.INVALID_ARGUMENT,{arg:"url",url:h,user:t.user,password:"[REDACTED]"}),n=t.user+":"+t.password,s.authorization={key:"Authorization",value:"Basic "+o.encode(a.toUtf8Bytes(n))})}return new Promise((function(t,n){function o(){null!=u&&(clearTimeout(u),u=null)}var a=new i.XMLHttpRequest,u=null;u=setTimeout((function(){null!=u&&(u=null,n(new Error("timeout")),setTimeout((function(){a.abort()}),0))}),l),e?(a.open("POST",h,!0),s["content-type"]={key:"Content-Type",value:"application/json"}):a.open("GET",h,!0),Object.keys(s).forEach((function(t){t=s[t],a.setRequestHeader(t.key,t.value)})),a.onreadystatechange=function(){if(4===a.readyState){if(200!=a.status){o();var i=new Error("invalid response - "+a.status);return i.statusCode=a.status,a.responseText&&(i.responseText=a.responseText),void n(i)}var s=null;try{s=JSON.parse(a.responseText)}catch(i){o();var u=new Error("invalid json response");return u.orginialError=i,u.responseText=a.responseText,null!=e&&(u.requestBody=e),u.url=h,void n(u)}if(r)try{s=r(s)}catch(i){return o(),i.url=h,i.body=e,i.responseText=a.responseText,void n(i)}o(),t(s)}},a.onerror=function(t){o(),n(t)};try{null!=e?a.send(e):a.send()}catch(u){o();var f=new Error("connection error");f.error=u,n(f)}}))},r.poll=function(t,e){return e=e||{},null==(e=s.shallowCopy(e)).floor&&(e.floor=0),null==e.ceiling&&(e.ceiling=1e4),null==e.interval&&(e.interval=250),new Promise((function(r,n){var i=null,o=!1,s=function(){return!o&&(o=!0,i&&clearTimeout(i),!0)};e.timeout&&(i=setTimeout((function(){s()&&n(new Error("timeout"))}),e.timeout));var a=e.fastRetry||null,u=0;!function i(){return t().then((function(t){return void 0!==t?s()&&r(t):e.onceBlock?e.onceBlock.once("block",i):o||(u++,(t=(t=e.interval*parseInt(String(Math.random()*Math.pow(2,u))))<e.floor?e.floor:t)>e.ceiling&&(t=e.ceiling),a&&(u--,t=a,a=null),setTimeout(i,t)),null}),(function(t){s()&&n(t)}))}()}))}},{"../errors":5,"./base64":61,"./properties":74,"./utf8":85,xmlhttprequest:49}],87:[function(t,r,n){(function(e){(function(){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var e=t("../utils/hash"),r=t("../utils/properties");n.check=function(t){for(var r=[],n=0;n<2048;n++){var i=t.getWord(n);if(n!==t.getWordIndex(i))return"0x";r.push(i)}return e.id(r.join("\n")+"\n")};var i=(o.prototype.split=function(t){return t.toLowerCase().split(/ +/g)},o.prototype.join=function(t){return t.join(" ")},o);function o(t){r.defineReadOnly(this,"locale",t)}n.Wordlist=i,n.register=function(t,e){e=e||t.locale}}).call(this)}).call(this,void 0!==e?e:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../utils/hash":65,"../utils/properties":74}],88:[function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var s,a=t("./utils/bytes"),u=t("./utils/hash"),h=t("./utils/hdnode"),l=t("./utils/json-wallet"),f=t("./utils/keccak256"),c=t("./utils/properties"),d=t("./utils/random-bytes"),p=o(t("./utils/secret-storage")),m=t("./utils/signing-key"),g=t("./utils/transaction"),y=t("./abstract-signer"),v=t("./providers/abstract-provider"),w=o(t("./errors"));function b(t,e){var r=s.call(this)||this;return w.checkNew(r,b),m.SigningKey.isSigningKey(t)?c.defineReadOnly(r,"signingKey",t):c.defineReadOnly(r,"signingKey",new m.SigningKey(t)),c.defineReadOnly(r,"provider",e),r}i(b,s=y.Signer),Object.defineProperty(b.prototype,"address",{get:function(){return this.signingKey.address},enumerable:!0,configurable:!0}),Object.defineProperty(b.prototype,"mnemonic",{get:function(){return this.signingKey.mnemonic},enumerable:!0,configurable:!0}),Object.defineProperty(b.prototype,"path",{get:function(){return this.signingKey.path},enumerable:!0,configurable:!0}),Object.defineProperty(b.prototype,"privateKey",{get:function(){return this.signingKey.privateKey},enumerable:!0,configurable:!0}),b.prototype.connect=function(t){return v.Provider.isProvider(t)||w.throwError("invalid provider",w.INVALID_ARGUMENT,{argument:"provider",value:t}),new b(this.signingKey,t)},b.prototype.getAddress=function(){return Promise.resolve(this.address)},b.prototype.sign=function(t){var e=this;return c.resolveProperties(t).then((function(t){var r=g.serialize(t);return r=e.signingKey.signDigest(f.keccak256(r)),g.serialize(t,r)}))},b.prototype.signMessage=function(t){return Promise.resolve(a.joinSignature(this.signingKey.signDigest(u.hashMessage(t))))},b.prototype.getBalance=function(t){if(!this.provider)throw new Error("missing provider");return this.provider.getBalance(this.address,t)},b.prototype.getTransactionCount=function(t){if(!this.provider)throw new Error("missing provider");return this.provider.getTransactionCount(this.address,t)},b.prototype.sendTransaction=function(t){var e=this;if(!this.provider)throw new Error("missing provider");return null==t.nonce&&((t=c.shallowCopy(t)).nonce=this.getTransactionCount("pending")),g.populateTransaction(t,this.provider,this.address).then((function(t){return e.sign(t).then((function(t){return e.provider.sendTransaction(t)}))}))},b.prototype.encrypt=function(t,e,r){if("function"!=typeof e||r||(r=e,e={}),r&&"function"!=typeof r)throw new Error("invalid callback");return e=e||{},this.mnemonic&&((e=c.shallowCopy(e)).mnemonic=this.mnemonic,e.path=this.path),p.encrypt(this.privateKey,t,e,r)},b.createRandom=function(t){var e=d.randomBytes(16);return(t=t||{}).extraEntropy&&(e=a.arrayify(f.keccak256(a.concat([e,t.extraEntropy])).substring(0,34))),e=h.entropyToMnemonic(e,t.locale),b.fromMnemonic(e,t.path,t.locale)},b.fromEncryptedJson=function(t,e,r){if(l.isCrowdsaleWallet(t))try{r&&r(0);var n=p.decryptCrowdsale(t,e);return r&&r(1),Promise.resolve(new b(n))}catch(t){return Promise.reject(t)}else if(l.isSecretStorageWallet(t))return p.decrypt(t,e,r).then((function(t){return new b(t)}));return Promise.reject("invalid wallet JSON")},b.fromMnemonic=function(t,e,r){return e=e||h.defaultPath,new b(h.fromMnemonic(t,r).derivePath(e))},i=b,r.Wallet=i},{"./abstract-signer":2,"./errors":5,"./providers/abstract-provider":50,"./utils/bytes":64,"./utils/hash":65,"./utils/hdnode":66,"./utils/json-wallet":70,"./utils/keccak256":71,"./utils/properties":74,"./utils/random-bytes":75,"./utils/secret-storage":78,"./utils/signing-key":81,"./utils/transaction":83}],89:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),t=t("../wordlists/lang-en").langEn,r.en=t},{"../wordlists/lang-en":90}],90:[function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o,s=t("../utils/wordlist"),a="AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo",u=null;function h(t){if(null==u&&(u=a.replace(/([A-Z])/g," $1").toLowerCase().substring(1).split(" "),"0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60"!==s.check(t)))throw u=null,new Error("BIP39 Wordlist for en (English) FAILED")}function l(){return o.call(this,"en")||this}i=new(i(l,o=s.Wordlist),l.prototype.getWord=function(t){return h(this),u[t]},l.prototype.getWordIndex=function(t){return h(this),u.indexOf(t)},l),r.langEn=i,s.register(i)},{"../utils/wordlist":87}]},{},[7])(7)}).call(this,r(4))},function(t,e,r){const{sha3:n,BN:i}=r(16),o=r(59),s={savedABIs:[],methodIDs:{},keepNonDecodedLogs:!1};function a(t){return"tuple"===t.type?"("+t.components.map(a).join(",")+")":t.type}t.exports={getABIs:function(){return s.savedABIs},addABI:function(t){if(!Array.isArray(t))throw new Error("Expected ABI array, got "+typeof t);t.map((function(t){if(t.name){const e=n(t.name+"("+t.inputs.map(a).join(",")+")");"event"===t.type?s.methodIDs[e.slice(2)]=t:s.methodIDs[e.slice(2,10)]=t}})),s.savedABIs=s.savedABIs.concat(t)},getMethodIDs:function(){return s.methodIDs},decodeMethod:function(t){const e=t.slice(2,10),r=s.methodIDs[e];if(r){let e=o.decodeParameters(r.inputs,t.slice(10)),n={name:r.name,params:[]};for(let t=0;t<e.__length__;t++){let o=e[t],s=o;const a=0===r.inputs[t].type.indexOf("uint"),u=0===r.inputs[t].type.indexOf("int"),h=0===r.inputs[t].type.indexOf("address");if(a||u){s=Array.isArray(o)?o.map((t=>new i(t).toString())):new i(o).toString()}if(h){s=Array.isArray(o)?o.map((t=>t.toLowerCase())):o.toLowerCase()}n.params.push({name:r.inputs[t].name,value:s,type:r.inputs[t].type})}return n}},decodeLogs:function(t){return t.filter((t=>t.topics.length>0)).map((t=>{const e=t.topics[0].slice(2),r=s.methodIDs[e];if(r){const e=t.data;let n=[],s=0,a=1,u=[];r.inputs.map((function(t){t.indexed||u.push(t.type)}));const h=o.decodeParameters(u,e.slice(2));return r.inputs.map((function(e){let r={name:e.name,type:e.type};if(e.indexed?(r.value=t.topics[a],a++):(r.value=h[s],s++),"address"===e.type&&(r.value=r.value.toLowerCase(),r.value.length>42)){let t=r.value.length-42,e=r.value.split("");e.splice(2,t),r.value=e.join("")}"uint256"!==e.type&&"uint8"!==e.type&&"int"!==e.type||("string"==typeof r.value&&r.value.startsWith("0x")?r.value=new i(r.value.slice(2),16).toString(10):r.value=new i(r.value).toString(10)),n.push(r)})),{name:r.name,events:n,address:t.address}}})).filter((t=>s.keepNonDecodedLogs||t))},removeABI:function(t){if(!Array.isArray(t))throw new Error("Expected ABI array, got "+typeof t);t.map((function(t){if(t.name){const e=n(t.name+"("+t.inputs.map((function(t){return t.type})).join(",")+")");"event"===t.type?s.methodIDs[e.slice(2)]&&delete s.methodIDs[e.slice(2)]:s.methodIDs[e.slice(2,10)]&&delete s.methodIDs[e.slice(2,10)]}}))},keepNonDecodedLogs:function(){s.keepNonDecodedLogs=!0},discardNonDecodedLogs:function(){s.keepNonDecodedLogs=!1}}},function(t,e,r){"use strict";var n=r(43),i=r(17),o=new n(0),s=new n(-1),a={noether:"0",wei:"1",kwei:"1000",Kwei:"1000",babbage:"1000",femtoether:"1000",mwei:"1000000",Mwei:"1000000",lovelace:"1000000",picoether:"1000000",gwei:"1000000000",Gwei:"1000000000",shannon:"1000000000",nanoether:"1000000000",nano:"1000000000",szabo:"1000000000000",microether:"1000000000000",micro:"1000000000000",finney:"1000000000000000",milliether:"1000000000000000",milli:"1000000000000000",ether:"1000000000000000000",kether:"1000000000000000000000",grand:"1000000000000000000000",mether:"1000000000000000000000000",gether:"1000000000000000000000000000",tether:"1000000000000000000000000000000"};function u(t){var e=t?t.toLowerCase():"ether",r=a[e];if("string"!=typeof r)throw new Error("[ethjs-unit] the unit provided "+t+" doesn't exists, please use the one of the following units "+JSON.stringify(a,null,2));return new n(r,10)}function h(t){if("string"==typeof t){if(!t.match(/^-?[0-9.]+$/))throw new Error("while converting number to string, invalid number value '"+t+"', should be a number matching (^-?[0-9.]+).");return t}if("number"==typeof t)return String(t);if("object"==typeof t&&t.toString&&(t.toTwos||t.dividedToIntegerBy))return t.toPrecision?String(t.toPrecision()):t.toString(10);throw new Error("while converting number to string, invalid number value '"+t+"' type "+typeof t+".")}t.exports={unitMap:a,numberToString:h,getValueOfUnit:u,fromWei:function(t,e,r){var n=i(t),h=n.lt(o),l=u(e),f=a[e].length-1||1,c=r||{};h&&(n=n.mul(s));for(var d=n.mod(l).toString(10);d.length<f;)d="0"+d;c.pad||(d=d.match(/^([0-9]*[1-9]|0)(0*)/)[1]);var p=n.div(l).toString(10);c.commify&&(p=p.replace(/\B(?=(\d{3})+(?!\d))/g,","));var m=p+("0"==d?"":"."+d);return h&&(m="-"+m),m},toWei:function(t,e){var r=h(t),i=u(e),o=a[e].length-1||1,l="-"===r.substring(0,1);if(l&&(r=r.substring(1)),"."===r)throw new Error("[ethjs-unit] while converting number "+t+" to wei, invalid value");var f=r.split(".");if(f.length>2)throw new Error("[ethjs-unit] while converting number "+t+" to wei,  too many decimal points");var c=f[0],d=f[1];if(c||(c="0"),d||(d="0"),d.length>o)throw new Error("[ethjs-unit] while converting number "+t+" to wei, too many decimal places");for(;d.length<o;)d+="0";c=new n(c),d=new n(d);var p=c.mul(i).add(d);return l&&(p=p.mul(s)),new n(p.toString(10),10)}}},function(t,e,r){(function(t){!function(t,e){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var s;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{s=r(2).Buffer}catch(t){}function a(t,e,r){for(var n=0,i=Math.min(t.length,r),o=e;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 u(t,e,r,n){for(var i=0,o=Math.min(t.length,r),s=e;s<o;s++){var a=t.charCodeAt(s)-48;i*=n,i+=a>=49?a-49+10:a>=17?a-17+10:a}return i}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&i++,16===e?this._parseHex(t,i):this._parseBase(t,e,i),"-"===t[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},o.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},o.prototype._initArray=function(t,e,r){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,s,a=0;if("be"===r)for(i=t.length-1,o=0;i>=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i<t.length;i+=3)s=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var n,i,o=0;for(r=t.length-6,n=0;r>=e;r-=6)i=a(t,r,r+6),this.words[n]|=i<<o&67108863,this.words[n+1]|=i>>>26-o&4194303,(o+=24)>=26&&(o-=26,n++);r+6!==e&&(i=a(t,e,r+6),this.words[n]|=i<<o&67108863,this.words[n+1]|=i>>>26-o&4194303),this.strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,h=0,l=r;l<a;l+=n)h=u(t,l,l+n,e),this.imuln(i),this.words[0]+h<67108864?this.words[0]+=h:this._iaddn(h);if(0!==s){var f=1;for(h=u(t,l,t.length,e),l=0;l<s;l++)f*=e;this.imuln(f),this.words[0]+h<67108864?this.words[0]+=h:this._iaddn(h)}},o.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},o.prototype.clone=function(){var t=new o(null);return this.copy(t),t},o.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var h=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function c(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var h=1;h<n;h++){for(var l=u>>>26,f=67108863&u,c=Math.min(h,e.length-1),d=Math.max(0,h-t.length+1);d<=c;d++){var p=h-d|0;l+=(s=(i=0|t.words[p])*(o=0|e.words[d])+f)/67108864|0,f=67108863&s}r.words[h]=0|f,u=0|l}return 0!==u?r.words[h]=0|u:r.length--,r.strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,s=0;s<this.length;s++){var a=this.words[s],u=(16777215&(a<<i|o)).toString(16);r=0!==(o=a>>>24-i&16777215)||s!==this.length-1?h[6-u.length]+u+r:u+r,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var c=l[t],d=f[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?m+r:h[c-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},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,e){return n(void 0!==s),this.toArrayLike(s,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0"),this.strip();var s,a,u="le"===e,h=new t(o),l=this.clone();if(u){for(a=0;!l.isZero();a++)s=l.andln(255),l.iushrn(8),h[a]=s;for(;a<o;a++)h[a]=0}else{for(a=0;a<o-i;a++)h[a]=0;for(a=0;!l.isZero();a++)s=l.andln(255),l.iushrn(8),h[o-a-1]=s}return h},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},o.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},o.prototype.ior=function(t){return n(0==(this.negative|t.negative)),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this.strip()},o.prototype.iand=function(t){return n(0==(this.negative|t.negative)),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;n<r.length;n++)this.words[n]=e.words[n]^r.words[n];if(this!==e)for(;n<e.length;n++)this.words[n]=e.words[n];return this.length=e.length,this.strip()},o.prototype.ixor=function(t){return n(0==(this.negative|t.negative)),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i<e;i++)this.words[i]=67108863&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<<i:this.words[r]&~(1<<i),this.strip()},o.prototype.iadd=function(t){var e,r,n;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o<n.length;o++)e=(0|r.words[o])+(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<r.length;o++)e=(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},o.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,s=0;s<n.length;s++)o=(e=(0|r.words[s])-(0|n.words[s])+o)>>26,this.words[s]=67108863&e;for(;0!==o&&s<r.length;s++)o=(e=(0|r.words[s])+o)>>26,this.words[s]=67108863&e;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(t){return this.clone().isub(t)};var d=function(t,e,r){var n,i,o,s=t.words,a=e.words,u=r.words,h=0,l=0|s[0],f=8191&l,c=l>>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],y=8191&g,v=g>>>13,w=0|s[3],b=8191&w,M=w>>>13,_=0|s[4],A=8191&_,E=_>>>13,x=0|s[5],S=8191&x,N=x>>>13,k=0|s[6],T=8191&k,P=k>>>13,I=0|s[7],R=8191&I,O=I>>>13,C=0|s[8],B=8191&C,U=C>>>13,L=0|s[9],D=8191&L,j=L>>>13,F=0|a[0],z=8191&F,H=F>>>13,G=0|a[1],q=8191&G,V=G>>>13,K=0|a[2],Z=8191&K,W=K>>>13,J=0|a[3],$=8191&J,X=J>>>13,Y=0|a[4],Q=8191&Y,tt=Y>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,ht=at>>>13,lt=0|a[8],ft=8191&lt,ct=lt>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(h+(n=Math.imul(f,z))|0)+((8191&(i=(i=Math.imul(f,H))+Math.imul(c,z)|0))<<13)|0;h=((o=Math.imul(c,H))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(p,z),i=(i=Math.imul(p,H))+Math.imul(m,z)|0,o=Math.imul(m,H);var yt=(h+(n=n+Math.imul(f,q)|0)|0)+((8191&(i=(i=i+Math.imul(f,V)|0)+Math.imul(c,q)|0))<<13)|0;h=((o=o+Math.imul(c,V)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(y,z),i=(i=Math.imul(y,H))+Math.imul(v,z)|0,o=Math.imul(v,H),n=n+Math.imul(p,q)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(m,q)|0,o=o+Math.imul(m,V)|0;var vt=(h+(n=n+Math.imul(f,Z)|0)|0)+((8191&(i=(i=i+Math.imul(f,W)|0)+Math.imul(c,Z)|0))<<13)|0;h=((o=o+Math.imul(c,W)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(b,z),i=(i=Math.imul(b,H))+Math.imul(M,z)|0,o=Math.imul(M,H),n=n+Math.imul(y,q)|0,i=(i=i+Math.imul(y,V)|0)+Math.imul(v,q)|0,o=o+Math.imul(v,V)|0,n=n+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,W)|0;var wt=(h+(n=n+Math.imul(f,$)|0)|0)+((8191&(i=(i=i+Math.imul(f,X)|0)+Math.imul(c,$)|0))<<13)|0;h=((o=o+Math.imul(c,X)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(A,z),i=(i=Math.imul(A,H))+Math.imul(E,z)|0,o=Math.imul(E,H),n=n+Math.imul(b,q)|0,i=(i=i+Math.imul(b,V)|0)+Math.imul(M,q)|0,o=o+Math.imul(M,V)|0,n=n+Math.imul(y,Z)|0,i=(i=i+Math.imul(y,W)|0)+Math.imul(v,Z)|0,o=o+Math.imul(v,W)|0,n=n+Math.imul(p,$)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,X)|0;var bt=(h+(n=n+Math.imul(f,Q)|0)|0)+((8191&(i=(i=i+Math.imul(f,tt)|0)+Math.imul(c,Q)|0))<<13)|0;h=((o=o+Math.imul(c,tt)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(S,z),i=(i=Math.imul(S,H))+Math.imul(N,z)|0,o=Math.imul(N,H),n=n+Math.imul(A,q)|0,i=(i=i+Math.imul(A,V)|0)+Math.imul(E,q)|0,o=o+Math.imul(E,V)|0,n=n+Math.imul(b,Z)|0,i=(i=i+Math.imul(b,W)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,W)|0,n=n+Math.imul(y,$)|0,i=(i=i+Math.imul(y,X)|0)+Math.imul(v,$)|0,o=o+Math.imul(v,X)|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 Mt=(h+(n=n+Math.imul(f,rt)|0)|0)+((8191&(i=(i=i+Math.imul(f,nt)|0)+Math.imul(c,rt)|0))<<13)|0;h=((o=o+Math.imul(c,nt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(T,z),i=(i=Math.imul(T,H))+Math.imul(P,z)|0,o=Math.imul(P,H),n=n+Math.imul(S,q)|0,i=(i=i+Math.imul(S,V)|0)+Math.imul(N,q)|0,o=o+Math.imul(N,V)|0,n=n+Math.imul(A,Z)|0,i=(i=i+Math.imul(A,W)|0)+Math.imul(E,Z)|0,o=o+Math.imul(E,W)|0,n=n+Math.imul(b,$)|0,i=(i=i+Math.imul(b,X)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,X)|0,n=n+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,nt)|0;var _t=(h+(n=n+Math.imul(f,ot)|0)|0)+((8191&(i=(i=i+Math.imul(f,st)|0)+Math.imul(c,ot)|0))<<13)|0;h=((o=o+Math.imul(c,st)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(R,z),i=(i=Math.imul(R,H))+Math.imul(O,z)|0,o=Math.imul(O,H),n=n+Math.imul(T,q)|0,i=(i=i+Math.imul(T,V)|0)+Math.imul(P,q)|0,o=o+Math.imul(P,V)|0,n=n+Math.imul(S,Z)|0,i=(i=i+Math.imul(S,W)|0)+Math.imul(N,Z)|0,o=o+Math.imul(N,W)|0,n=n+Math.imul(A,$)|0,i=(i=i+Math.imul(A,X)|0)+Math.imul(E,$)|0,o=o+Math.imul(E,X)|0,n=n+Math.imul(b,Q)|0,i=(i=i+Math.imul(b,tt)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,tt)|0,n=n+Math.imul(y,rt)|0,i=(i=i+Math.imul(y,nt)|0)+Math.imul(v,rt)|0,o=o+Math.imul(v,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 At=(h+(n=n+Math.imul(f,ut)|0)|0)+((8191&(i=(i=i+Math.imul(f,ht)|0)+Math.imul(c,ut)|0))<<13)|0;h=((o=o+Math.imul(c,ht)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(B,z),i=(i=Math.imul(B,H))+Math.imul(U,z)|0,o=Math.imul(U,H),n=n+Math.imul(R,q)|0,i=(i=i+Math.imul(R,V)|0)+Math.imul(O,q)|0,o=o+Math.imul(O,V)|0,n=n+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,W)|0)+Math.imul(P,Z)|0,o=o+Math.imul(P,W)|0,n=n+Math.imul(S,$)|0,i=(i=i+Math.imul(S,X)|0)+Math.imul(N,$)|0,o=o+Math.imul(N,X)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,tt)|0,n=n+Math.imul(b,rt)|0,i=(i=i+Math.imul(b,nt)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,nt)|0,n=n+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,st)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,st)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ht)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ht)|0;var Et=(h+(n=n+Math.imul(f,ft)|0)|0)+((8191&(i=(i=i+Math.imul(f,ct)|0)+Math.imul(c,ft)|0))<<13)|0;h=((o=o+Math.imul(c,ct)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(D,z),i=(i=Math.imul(D,H))+Math.imul(j,z)|0,o=Math.imul(j,H),n=n+Math.imul(B,q)|0,i=(i=i+Math.imul(B,V)|0)+Math.imul(U,q)|0,o=o+Math.imul(U,V)|0,n=n+Math.imul(R,Z)|0,i=(i=i+Math.imul(R,W)|0)+Math.imul(O,Z)|0,o=o+Math.imul(O,W)|0,n=n+Math.imul(T,$)|0,i=(i=i+Math.imul(T,X)|0)+Math.imul(P,$)|0,o=o+Math.imul(P,X)|0,n=n+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,nt)|0,n=n+Math.imul(b,ot)|0,i=(i=i+Math.imul(b,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|0,n=n+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ht)|0)+Math.imul(v,ut)|0,o=o+Math.imul(v,ht)|0,n=n+Math.imul(p,ft)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(m,ft)|0,o=o+Math.imul(m,ct)|0;var xt=(h+(n=n+Math.imul(f,pt)|0)|0)+((8191&(i=(i=i+Math.imul(f,mt)|0)+Math.imul(c,pt)|0))<<13)|0;h=((o=o+Math.imul(c,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(D,q),i=(i=Math.imul(D,V))+Math.imul(j,q)|0,o=Math.imul(j,V),n=n+Math.imul(B,Z)|0,i=(i=i+Math.imul(B,W)|0)+Math.imul(U,Z)|0,o=o+Math.imul(U,W)|0,n=n+Math.imul(R,$)|0,i=(i=i+Math.imul(R,X)|0)+Math.imul(O,$)|0,o=o+Math.imul(O,X)|0,n=n+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,tt)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,tt)|0,n=n+Math.imul(S,rt)|0,i=(i=i+Math.imul(S,nt)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,nt)|0,n=n+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,st)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,st)|0,n=n+Math.imul(b,ut)|0,i=(i=i+Math.imul(b,ht)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ht)|0,n=n+Math.imul(y,ft)|0,i=(i=i+Math.imul(y,ct)|0)+Math.imul(v,ft)|0,o=o+Math.imul(v,ct)|0;var St=(h+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;h=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(D,Z),i=(i=Math.imul(D,W))+Math.imul(j,Z)|0,o=Math.imul(j,W),n=n+Math.imul(B,$)|0,i=(i=i+Math.imul(B,X)|0)+Math.imul(U,$)|0,o=o+Math.imul(U,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(T,rt)|0,i=(i=i+Math.imul(T,nt)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,nt)|0,n=n+Math.imul(S,ot)|0,i=(i=i+Math.imul(S,st)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,st)|0,n=n+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,ht)|0)+Math.imul(E,ut)|0,o=o+Math.imul(E,ht)|0,n=n+Math.imul(b,ft)|0,i=(i=i+Math.imul(b,ct)|0)+Math.imul(M,ft)|0,o=o+Math.imul(M,ct)|0;var Nt=(h+(n=n+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,mt)|0)+Math.imul(v,pt)|0))<<13)|0;h=((o=o+Math.imul(v,mt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(D,$),i=(i=Math.imul(D,X))+Math.imul(j,$)|0,o=Math.imul(j,X),n=n+Math.imul(B,Q)|0,i=(i=i+Math.imul(B,tt)|0)+Math.imul(U,Q)|0,o=o+Math.imul(U,tt)|0,n=n+Math.imul(R,rt)|0,i=(i=i+Math.imul(R,nt)|0)+Math.imul(O,rt)|0,o=o+Math.imul(O,nt)|0,n=n+Math.imul(T,ot)|0,i=(i=i+Math.imul(T,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,n=n+Math.imul(S,ut)|0,i=(i=i+Math.imul(S,ht)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ht)|0,n=n+Math.imul(A,ft)|0,i=(i=i+Math.imul(A,ct)|0)+Math.imul(E,ft)|0,o=o+Math.imul(E,ct)|0;var kt=(h+(n=n+Math.imul(b,pt)|0)|0)+((8191&(i=(i=i+Math.imul(b,mt)|0)+Math.imul(M,pt)|0))<<13)|0;h=((o=o+Math.imul(M,mt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(D,Q),i=(i=Math.imul(D,tt))+Math.imul(j,Q)|0,o=Math.imul(j,tt),n=n+Math.imul(B,rt)|0,i=(i=i+Math.imul(B,nt)|0)+Math.imul(U,rt)|0,o=o+Math.imul(U,nt)|0,n=n+Math.imul(R,ot)|0,i=(i=i+Math.imul(R,st)|0)+Math.imul(O,ot)|0,o=o+Math.imul(O,st)|0,n=n+Math.imul(T,ut)|0,i=(i=i+Math.imul(T,ht)|0)+Math.imul(P,ut)|0,o=o+Math.imul(P,ht)|0,n=n+Math.imul(S,ft)|0,i=(i=i+Math.imul(S,ct)|0)+Math.imul(N,ft)|0,o=o+Math.imul(N,ct)|0;var Tt=(h+(n=n+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,mt)|0)+Math.imul(E,pt)|0))<<13)|0;h=((o=o+Math.imul(E,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(D,rt),i=(i=Math.imul(D,nt))+Math.imul(j,rt)|0,o=Math.imul(j,nt),n=n+Math.imul(B,ot)|0,i=(i=i+Math.imul(B,st)|0)+Math.imul(U,ot)|0,o=o+Math.imul(U,st)|0,n=n+Math.imul(R,ut)|0,i=(i=i+Math.imul(R,ht)|0)+Math.imul(O,ut)|0,o=o+Math.imul(O,ht)|0,n=n+Math.imul(T,ft)|0,i=(i=i+Math.imul(T,ct)|0)+Math.imul(P,ft)|0,o=o+Math.imul(P,ct)|0;var Pt=(h+(n=n+Math.imul(S,pt)|0)|0)+((8191&(i=(i=i+Math.imul(S,mt)|0)+Math.imul(N,pt)|0))<<13)|0;h=((o=o+Math.imul(N,mt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(D,ot),i=(i=Math.imul(D,st))+Math.imul(j,ot)|0,o=Math.imul(j,st),n=n+Math.imul(B,ut)|0,i=(i=i+Math.imul(B,ht)|0)+Math.imul(U,ut)|0,o=o+Math.imul(U,ht)|0,n=n+Math.imul(R,ft)|0,i=(i=i+Math.imul(R,ct)|0)+Math.imul(O,ft)|0,o=o+Math.imul(O,ct)|0;var It=(h+(n=n+Math.imul(T,pt)|0)|0)+((8191&(i=(i=i+Math.imul(T,mt)|0)+Math.imul(P,pt)|0))<<13)|0;h=((o=o+Math.imul(P,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(D,ut),i=(i=Math.imul(D,ht))+Math.imul(j,ut)|0,o=Math.imul(j,ht),n=n+Math.imul(B,ft)|0,i=(i=i+Math.imul(B,ct)|0)+Math.imul(U,ft)|0,o=o+Math.imul(U,ct)|0;var Rt=(h+(n=n+Math.imul(R,pt)|0)|0)+((8191&(i=(i=i+Math.imul(R,mt)|0)+Math.imul(O,pt)|0))<<13)|0;h=((o=o+Math.imul(O,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(D,ft),i=(i=Math.imul(D,ct))+Math.imul(j,ft)|0,o=Math.imul(j,ct);var Ot=(h+(n=n+Math.imul(B,pt)|0)|0)+((8191&(i=(i=i+Math.imul(B,mt)|0)+Math.imul(U,pt)|0))<<13)|0;h=((o=o+Math.imul(U,mt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863;var Ct=(h+(n=Math.imul(D,pt))|0)+((8191&(i=(i=Math.imul(D,mt))+Math.imul(j,pt)|0))<<13)|0;return h=((o=Math.imul(j,mt))+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,u[0]=gt,u[1]=yt,u[2]=vt,u[3]=wt,u[4]=bt,u[5]=Mt,u[6]=_t,u[7]=At,u[8]=Et,u[9]=xt,u[10]=St,u[11]=Nt,u[12]=kt,u[13]=Tt,u[14]=Pt,u[15]=It,u[16]=Rt,u[17]=Ot,u[18]=Ct,0!==h&&(u[19]=h,r.length++),r};function p(t,e,r){return(new m).mulp(t,e,r)}function m(t,e){this.x=t,this.y=e}Math.imul||(d=c),o.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?d(this,t,e):r<63?c(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o<r.length-1;o++){var s=i;i=0;for(var a=67108863&n,u=Math.min(o,e.length-1),h=Math.max(0,o-t.length+1);h<=u;h++){var l=o-h,f=(0|t.words[l])*(0|e.words[h]),c=67108863&f;a=67108863&(c=c+a|0),i+=(s=(s=s+(f/67108864|0)|0)+(c>>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,t,e):p(this,t,e)},m.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n<t;n++)e[n]=this.revBin(n,r,t);return e},m.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var n=0,i=0;i<e;i++)n|=(1&t)<<e-i-1,t>>=1;return n},m.prototype.permute=function(t,e,r,n,i,o){for(var s=0;s<o;s++)n[s]=e[t[s]],i[s]=r[t[s]]},m.prototype.transform=function(t,e,r,n,i,o){this.permute(o,t,e,r,n,i);for(var s=1;s<i;s<<=1)for(var a=s<<1,u=Math.cos(2*Math.PI/a),h=Math.sin(2*Math.PI/a),l=0;l<i;l+=a)for(var f=u,c=h,d=0;d<s;d++){var p=r[l+d],m=n[l+d],g=r[l+d+s],y=n[l+d+s],v=f*g-c*y;y=f*y+c*g,g=v,r[l+d]=p+g,n[l+d]=m+y,r[l+d+s]=p-g,n[l+d+s]=m-y,d!==a&&(v=u*f-h*c,c=u*c+h*f,f=v)}},m.prototype.guessLen13b=function(t,e){var r=1|Math.max(e,t),n=1&r,i=0;for(r=r/2|0;r;r>>>=1)i++;return 1<<i+1+n},m.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var n=0;n<r/2;n++){var i=t[n];t[n]=t[r-n-1],t[r-n-1]=i,i=e[n],e[n]=-e[r-n-1],e[r-n-1]=-i}},m.prototype.normalize13b=function(t,e){for(var r=0,n=0;n<e/2;n++){var i=8192*Math.round(t[2*n+1]/e)+Math.round(t[2*n]/e)+r;t[n]=67108863&i,r=i<67108864?0:i/67108864|0}return t},m.prototype.convert13b=function(t,e,r,i){for(var o=0,s=0;s<e;s++)o+=0|t[s],r[2*s]=8191&o,o>>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s<i;++s)r[s]=0;n(0===o),n(0==(-8192&o))},m.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},m.prototype.mulp=function(t,e,r){var n=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(n),o=this.stub(n),s=new Array(n),a=new Array(n),u=new Array(n),h=new Array(n),l=new Array(n),f=new Array(n),c=r.words;c.length=n,this.convert13b(t.words,t.length,s,n),this.convert13b(e.words,e.length,h,n),this.transform(s,o,a,u,n,i),this.transform(h,o,l,f,n,i);for(var d=0;d<n;d++){var p=a[d]*l[d]-u[d]*f[d];u[d]=a[d]*f[d]+u[d]*l[d],a[d]=p}return this.conjugate(a,u,n),this.transform(a,u,c,o,n,i),this.conjugate(c,o,n),this.normalize13b(c,n),r.negative=t.negative^e.negative,r.length=t.length+e.length,r.strip()},o.prototype.mul=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},o.prototype.mulf=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),p(this,t,e)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.prototype.imuln=function(t){n("number"==typeof t),n(t<67108864);for(var e=0,r=0;r<this.length;r++){var i=(0|this.words[r])*t,o=(67108863&i)+(67108863&e);e>>=26,e+=i/67108864|0,e+=o>>>26,this.words[r]=67108863&o}return 0!==e&&(this.words[r]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var n=r/26|0,i=r%26;e[r]=(t.words[n]&1<<i)>>>i}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n<e.length&&0===e[n];n++,r=r.sqr());if(++n<e.length)for(var i=r.sqr();n<e.length;n++,i=i.sqr())0!==e[n]&&(r=r.mul(i));return r},o.prototype.iushln=function(t){n("number"==typeof t&&t>=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,u=(0|this.words[e])-a<<r;this.words[e]=u|s,s=a>>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this.strip()},o.prototype.ishln=function(t){return n(0===this.negative),this.iushln(t)},o.prototype.iushrn=function(t,e,r){var i;n("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,u=r;if(i-=s,i=Math.max(0,i),u){for(var h=0;h<s;h++)u.words[h]=this.words[h];u.length=s}if(0===s);else if(this.length>s)for(this.length-=s,h=0;h<this.length;h++)this.words[h]=this.words[h+s];else this.words[0]=0,this.length=1;var l=0;for(h=this.length-1;h>=0&&(0!==l||h>=i);h--){var f=0|this.words[h];this.words[h]=l<<26-o|f>>>o,l=f&a}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<<e;return!(this.length<=r)&&!!(this.words[r]&i)},o.prototype.imaskn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<<e;this.words[this.length-1]&=i}return this.strip()},o.prototype.maskn=function(t){return this.clone().imaskn(t)},o.prototype.iaddn=function(t){return n("number"==typeof t),n(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},o.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this.strip()},o.prototype.addn=function(t){return this.clone().iaddn(t)},o.prototype.subn=function(t){return this.clone().isubn(t)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(t,e,r){var i,o,s=t.length+r;this._expand(s);var a=0;for(i=0;i<t.length;i++){o=(0|this.words[i+r])+a;var u=(0|t.words[i])*e;a=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i<this.length-r;i++)a=(o=(0|this.words[i+r])+a)>>26,this.words[i+r]=67108863&o;if(0===a)return this.strip();for(n(-1===a),a=0,i=0;i<this.length;i++)a=(o=-(0|this.words[i])+a)>>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,s=0|i.words[i.length-1];0!==(r=26-this._countBits(s))&&(i=i.ushln(r),n.iushln(r),s=0|i.words[i.length-1]);var a,u=n.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var h=0;h<a.length;h++)a.words[h]=0}var l=n.clone()._ishlnsubmul(i,1,u);0===l.negative&&(n=l,a&&(a.words[u]=1));for(var f=u-1;f>=0;f--){var c=67108864*(0|n.words[i.length+f])+(0|n.words[i.length+f-1]);for(c=Math.min(c/s|0,67108863),n._ishlnsubmul(i,c,f);0!==n.negative;)c--,n.negative=0,n._ishlnsubmul(i,1,f),n.isZero()||(n.negative^=1);a&&(a.words[f]=c)}return a&&a.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){n(t<=67108863);for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},o.prototype.idivn=function(t){n(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),s=new o(0),a=new o(0),u=new o(1),h=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++h;for(var l=r.clone(),f=e.clone();!e.isZero();){for(var c=0,d=1;0==(e.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(l),s.isub(f)),i.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(l),u.isub(f)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),s.isub(u)):(r.isub(e),a.isub(i),u.isub(s))}return{a:a,b:u,gcd:r.iushln(h)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,s=new o(1),a=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var h=0,l=1;0==(e.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(e.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var f=0,c=1;0==(r.words[0]&c)&&f<26;++f,c<<=1);if(f>0)for(r.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<<e;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var o=i,s=r;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:i<t?-1:1}return 0!==this.negative?0|-e:e},o.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},o.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){n<i?e=-1:n>i&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new _(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 y(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function v(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function b(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function M(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function _(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function A(t){_.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}y.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},y.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):r.strip(),r},y.prototype.split=function(t,e){t.iushrn(this.n,0,e)},y.prototype.imulK=function(t){return t.imul(this.k)},i(v,y),v.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i<n;i++)e.words[i]=t.words[i];if(e.length=n,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,i=10;i<t.length;i++){var s=0|t.words[i];t.words[i-10]=(s&r)<<4|o>>>22,o=s}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},v.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var n=0|t.words[r];e+=977*n,t.words[r]=67108863&e,e=64*n+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(w,y),i(b,y),i(M,y),M.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var n=19*(0|t.words[r])+e,i=67108863&n;n>>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(g[t])return g[t];var e;if("k256"===t)e=new v;else if("p224"===t)e=new w;else if("p192"===t)e=new b;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new M}return g[t]=e,e},_.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},_.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},_.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},_.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},_.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},_.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},_.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},_.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},_.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},_.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},_.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},_.prototype.isqr=function(t){return this.imul(t,t.clone())},_.prototype.sqr=function(t){return this.mul(t,t)},_.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),h=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,h).cmp(u);)l.redIAdd(u);for(var f=this.pow(l,i),c=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();n(g<p);var y=this.pow(f,new o(1).iushln(p-g-1));c=c.redMul(y),f=y.redSqr(),d=d.redMul(f),p=g}return c},_.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},_.prototype.pow=function(t,e){if(e.isZero())return new o(1);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new o(1).toRed(this),r[1]=t;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],t);var i=r[0],s=0,a=0,u=e.bitLength()%26;for(0===u&&(u=26),n=e.length-1;n>=0;n--){for(var h=e.words[n],l=u-1;l>=0;l--){var f=h>>l&1;i!==r[0]&&(i=this.sqr(i)),0!==f||0!==s?(s<<=1,s|=f,(4===++a||0===n&&0===l)&&(i=this.mul(i,r[s]),a=0,s=0)):a=0}u=26}return i},_.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},_.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new A(t)},i(A,_),A.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},A.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},A.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},A.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},A.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,r(6)(t))},function(t,e,r){"use strict";e.byteLength=function(t){var e=h(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){var e,r,n=h(t),s=n[0],a=n[1],u=new o(function(t,e,r){return 3*(e+r)/4-r}(0,s,a)),l=0,f=a>0?s-4:s;for(r=0;r<f;r+=4)e=i[t.charCodeAt(r)]<<18|i[t.charCodeAt(r+1)]<<12|i[t.charCodeAt(r+2)]<<6|i[t.charCodeAt(r+3)],u[l++]=e>>16&255,u[l++]=e>>8&255,u[l++]=255&e;2===a&&(e=i[t.charCodeAt(r)]<<2|i[t.charCodeAt(r+1)]>>4,u[l++]=255&e);1===a&&(e=i[t.charCodeAt(r)]<<10|i[t.charCodeAt(r+1)]<<4|i[t.charCodeAt(r+2)]>>2,u[l++]=e>>8&255,u[l++]=255&e);return u},e.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],s=16383,a=0,u=r-i;a<u;a+=s)o.push(l(t,a,a+s>u?u:a+s));1===i?(e=t[r-1],o.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return o.join("")};for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=s.length;a<u;++a)n[a]=s[a],i[s.charCodeAt(a)]=a;function h(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function l(t,e,r){for(var i,o,s=[],a=e;a<r;a+=3)i=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+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,e){e.read=function(t,e,r,n,i){var o,s,a=8*i-n-1,u=(1<<a)-1,h=u>>1,l=-7,f=r?i-1:0,c=r?-1:1,d=t[e+f];for(f+=c,o=d&(1<<-l)-1,d>>=-l,l+=a;l>0;o=256*o+t[e+f],f+=c,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=n;l>0;s=256*s+t[e+f],f+=c,l-=8);if(0===o)o=1-h;else{if(o===u)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,n),o-=h}return(d?-1:1)*s*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var s,a,u,h=8*o-i-1,l=(1<<h)-1,f=l>>1,c=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=l):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+f>=1?c/u:c*Math.pow(2,1-f))*u>=2&&(s++,u/=2),s+f>=l?(a=0,s=l):s+f>=1?(a=(e*u-1)*Math.pow(2,i),s+=f):(a=e*Math.pow(2,f-1)*Math.pow(2,i),s=0));i>=8;t[r+d]=255&a,d+=p,a/=256,i-=8);for(s=s<<i|a,h+=i;h>0;t[r+d]=255&s,d+=p,s/=256,h-=8);t[r+d-p]|=128*m}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e,r){(function(t){!function(t,e){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var s;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{s=r(2).Buffer}catch(t){}function a(t,e,r){for(var n=0,i=Math.min(t.length,r),o=e;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 u(t,e,r,n){for(var i=0,o=Math.min(t.length,r),s=e;s<o;s++){var a=t.charCodeAt(s)-48;i*=n,i+=a>=49?a-49+10:a>=17?a-17+10:a}return i}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&i++,16===e?this._parseHex(t,i):this._parseBase(t,e,i),"-"===t[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},o.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},o.prototype._initArray=function(t,e,r){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,s,a=0;if("be"===r)for(i=t.length-1,o=0;i>=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i<t.length;i+=3)s=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var n,i,o=0;for(r=t.length-6,n=0;r>=e;r-=6)i=a(t,r,r+6),this.words[n]|=i<<o&67108863,this.words[n+1]|=i>>>26-o&4194303,(o+=24)>=26&&(o-=26,n++);r+6!==e&&(i=a(t,e,r+6),this.words[n]|=i<<o&67108863,this.words[n+1]|=i>>>26-o&4194303),this.strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,h=0,l=r;l<a;l+=n)h=u(t,l,l+n,e),this.imuln(i),this.words[0]+h<67108864?this.words[0]+=h:this._iaddn(h);if(0!==s){var f=1;for(h=u(t,l,t.length,e),l=0;l<s;l++)f*=e;this.imuln(f),this.words[0]+h<67108864?this.words[0]+=h:this._iaddn(h)}},o.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},o.prototype.clone=function(){var t=new o(null);return this.copy(t),t},o.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var h=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function c(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var h=1;h<n;h++){for(var l=u>>>26,f=67108863&u,c=Math.min(h,e.length-1),d=Math.max(0,h-t.length+1);d<=c;d++){var p=h-d|0;l+=(s=(i=0|t.words[p])*(o=0|e.words[d])+f)/67108864|0,f=67108863&s}r.words[h]=0|f,u=0|l}return 0!==u?r.words[h]=0|u:r.length--,r.strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,s=0;s<this.length;s++){var a=this.words[s],u=(16777215&(a<<i|o)).toString(16);r=0!==(o=a>>>24-i&16777215)||s!==this.length-1?h[6-u.length]+u+r:u+r,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var c=l[t],d=f[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?m+r:h[c-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},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,e){return n(void 0!==s),this.toArrayLike(s,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0"),this.strip();var s,a,u="le"===e,h=new t(o),l=this.clone();if(u){for(a=0;!l.isZero();a++)s=l.andln(255),l.iushrn(8),h[a]=s;for(;a<o;a++)h[a]=0}else{for(a=0;a<o-i;a++)h[a]=0;for(a=0;!l.isZero();a++)s=l.andln(255),l.iushrn(8),h[o-a-1]=s}return h},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},o.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},o.prototype.ior=function(t){return n(0==(this.negative|t.negative)),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this.strip()},o.prototype.iand=function(t){return n(0==(this.negative|t.negative)),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;n<r.length;n++)this.words[n]=e.words[n]^r.words[n];if(this!==e)for(;n<e.length;n++)this.words[n]=e.words[n];return this.length=e.length,this.strip()},o.prototype.ixor=function(t){return n(0==(this.negative|t.negative)),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i<e;i++)this.words[i]=67108863&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<<i:this.words[r]&~(1<<i),this.strip()},o.prototype.iadd=function(t){var e,r,n;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o<n.length;o++)e=(0|r.words[o])+(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<r.length;o++)e=(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},o.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,s=0;s<n.length;s++)o=(e=(0|r.words[s])-(0|n.words[s])+o)>>26,this.words[s]=67108863&e;for(;0!==o&&s<r.length;s++)o=(e=(0|r.words[s])+o)>>26,this.words[s]=67108863&e;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(t){return this.clone().isub(t)};var d=function(t,e,r){var n,i,o,s=t.words,a=e.words,u=r.words,h=0,l=0|s[0],f=8191&l,c=l>>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],y=8191&g,v=g>>>13,w=0|s[3],b=8191&w,M=w>>>13,_=0|s[4],A=8191&_,E=_>>>13,x=0|s[5],S=8191&x,N=x>>>13,k=0|s[6],T=8191&k,P=k>>>13,I=0|s[7],R=8191&I,O=I>>>13,C=0|s[8],B=8191&C,U=C>>>13,L=0|s[9],D=8191&L,j=L>>>13,F=0|a[0],z=8191&F,H=F>>>13,G=0|a[1],q=8191&G,V=G>>>13,K=0|a[2],Z=8191&K,W=K>>>13,J=0|a[3],$=8191&J,X=J>>>13,Y=0|a[4],Q=8191&Y,tt=Y>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,ht=at>>>13,lt=0|a[8],ft=8191&lt,ct=lt>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(h+(n=Math.imul(f,z))|0)+((8191&(i=(i=Math.imul(f,H))+Math.imul(c,z)|0))<<13)|0;h=((o=Math.imul(c,H))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(p,z),i=(i=Math.imul(p,H))+Math.imul(m,z)|0,o=Math.imul(m,H);var yt=(h+(n=n+Math.imul(f,q)|0)|0)+((8191&(i=(i=i+Math.imul(f,V)|0)+Math.imul(c,q)|0))<<13)|0;h=((o=o+Math.imul(c,V)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(y,z),i=(i=Math.imul(y,H))+Math.imul(v,z)|0,o=Math.imul(v,H),n=n+Math.imul(p,q)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(m,q)|0,o=o+Math.imul(m,V)|0;var vt=(h+(n=n+Math.imul(f,Z)|0)|0)+((8191&(i=(i=i+Math.imul(f,W)|0)+Math.imul(c,Z)|0))<<13)|0;h=((o=o+Math.imul(c,W)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(b,z),i=(i=Math.imul(b,H))+Math.imul(M,z)|0,o=Math.imul(M,H),n=n+Math.imul(y,q)|0,i=(i=i+Math.imul(y,V)|0)+Math.imul(v,q)|0,o=o+Math.imul(v,V)|0,n=n+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,W)|0;var wt=(h+(n=n+Math.imul(f,$)|0)|0)+((8191&(i=(i=i+Math.imul(f,X)|0)+Math.imul(c,$)|0))<<13)|0;h=((o=o+Math.imul(c,X)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(A,z),i=(i=Math.imul(A,H))+Math.imul(E,z)|0,o=Math.imul(E,H),n=n+Math.imul(b,q)|0,i=(i=i+Math.imul(b,V)|0)+Math.imul(M,q)|0,o=o+Math.imul(M,V)|0,n=n+Math.imul(y,Z)|0,i=(i=i+Math.imul(y,W)|0)+Math.imul(v,Z)|0,o=o+Math.imul(v,W)|0,n=n+Math.imul(p,$)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,X)|0;var bt=(h+(n=n+Math.imul(f,Q)|0)|0)+((8191&(i=(i=i+Math.imul(f,tt)|0)+Math.imul(c,Q)|0))<<13)|0;h=((o=o+Math.imul(c,tt)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(S,z),i=(i=Math.imul(S,H))+Math.imul(N,z)|0,o=Math.imul(N,H),n=n+Math.imul(A,q)|0,i=(i=i+Math.imul(A,V)|0)+Math.imul(E,q)|0,o=o+Math.imul(E,V)|0,n=n+Math.imul(b,Z)|0,i=(i=i+Math.imul(b,W)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,W)|0,n=n+Math.imul(y,$)|0,i=(i=i+Math.imul(y,X)|0)+Math.imul(v,$)|0,o=o+Math.imul(v,X)|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 Mt=(h+(n=n+Math.imul(f,rt)|0)|0)+((8191&(i=(i=i+Math.imul(f,nt)|0)+Math.imul(c,rt)|0))<<13)|0;h=((o=o+Math.imul(c,nt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(T,z),i=(i=Math.imul(T,H))+Math.imul(P,z)|0,o=Math.imul(P,H),n=n+Math.imul(S,q)|0,i=(i=i+Math.imul(S,V)|0)+Math.imul(N,q)|0,o=o+Math.imul(N,V)|0,n=n+Math.imul(A,Z)|0,i=(i=i+Math.imul(A,W)|0)+Math.imul(E,Z)|0,o=o+Math.imul(E,W)|0,n=n+Math.imul(b,$)|0,i=(i=i+Math.imul(b,X)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,X)|0,n=n+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,nt)|0;var _t=(h+(n=n+Math.imul(f,ot)|0)|0)+((8191&(i=(i=i+Math.imul(f,st)|0)+Math.imul(c,ot)|0))<<13)|0;h=((o=o+Math.imul(c,st)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(R,z),i=(i=Math.imul(R,H))+Math.imul(O,z)|0,o=Math.imul(O,H),n=n+Math.imul(T,q)|0,i=(i=i+Math.imul(T,V)|0)+Math.imul(P,q)|0,o=o+Math.imul(P,V)|0,n=n+Math.imul(S,Z)|0,i=(i=i+Math.imul(S,W)|0)+Math.imul(N,Z)|0,o=o+Math.imul(N,W)|0,n=n+Math.imul(A,$)|0,i=(i=i+Math.imul(A,X)|0)+Math.imul(E,$)|0,o=o+Math.imul(E,X)|0,n=n+Math.imul(b,Q)|0,i=(i=i+Math.imul(b,tt)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,tt)|0,n=n+Math.imul(y,rt)|0,i=(i=i+Math.imul(y,nt)|0)+Math.imul(v,rt)|0,o=o+Math.imul(v,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 At=(h+(n=n+Math.imul(f,ut)|0)|0)+((8191&(i=(i=i+Math.imul(f,ht)|0)+Math.imul(c,ut)|0))<<13)|0;h=((o=o+Math.imul(c,ht)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(B,z),i=(i=Math.imul(B,H))+Math.imul(U,z)|0,o=Math.imul(U,H),n=n+Math.imul(R,q)|0,i=(i=i+Math.imul(R,V)|0)+Math.imul(O,q)|0,o=o+Math.imul(O,V)|0,n=n+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,W)|0)+Math.imul(P,Z)|0,o=o+Math.imul(P,W)|0,n=n+Math.imul(S,$)|0,i=(i=i+Math.imul(S,X)|0)+Math.imul(N,$)|0,o=o+Math.imul(N,X)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,tt)|0,n=n+Math.imul(b,rt)|0,i=(i=i+Math.imul(b,nt)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,nt)|0,n=n+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,st)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,st)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ht)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ht)|0;var Et=(h+(n=n+Math.imul(f,ft)|0)|0)+((8191&(i=(i=i+Math.imul(f,ct)|0)+Math.imul(c,ft)|0))<<13)|0;h=((o=o+Math.imul(c,ct)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(D,z),i=(i=Math.imul(D,H))+Math.imul(j,z)|0,o=Math.imul(j,H),n=n+Math.imul(B,q)|0,i=(i=i+Math.imul(B,V)|0)+Math.imul(U,q)|0,o=o+Math.imul(U,V)|0,n=n+Math.imul(R,Z)|0,i=(i=i+Math.imul(R,W)|0)+Math.imul(O,Z)|0,o=o+Math.imul(O,W)|0,n=n+Math.imul(T,$)|0,i=(i=i+Math.imul(T,X)|0)+Math.imul(P,$)|0,o=o+Math.imul(P,X)|0,n=n+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,nt)|0,n=n+Math.imul(b,ot)|0,i=(i=i+Math.imul(b,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|0,n=n+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ht)|0)+Math.imul(v,ut)|0,o=o+Math.imul(v,ht)|0,n=n+Math.imul(p,ft)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(m,ft)|0,o=o+Math.imul(m,ct)|0;var xt=(h+(n=n+Math.imul(f,pt)|0)|0)+((8191&(i=(i=i+Math.imul(f,mt)|0)+Math.imul(c,pt)|0))<<13)|0;h=((o=o+Math.imul(c,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(D,q),i=(i=Math.imul(D,V))+Math.imul(j,q)|0,o=Math.imul(j,V),n=n+Math.imul(B,Z)|0,i=(i=i+Math.imul(B,W)|0)+Math.imul(U,Z)|0,o=o+Math.imul(U,W)|0,n=n+Math.imul(R,$)|0,i=(i=i+Math.imul(R,X)|0)+Math.imul(O,$)|0,o=o+Math.imul(O,X)|0,n=n+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,tt)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,tt)|0,n=n+Math.imul(S,rt)|0,i=(i=i+Math.imul(S,nt)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,nt)|0,n=n+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,st)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,st)|0,n=n+Math.imul(b,ut)|0,i=(i=i+Math.imul(b,ht)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ht)|0,n=n+Math.imul(y,ft)|0,i=(i=i+Math.imul(y,ct)|0)+Math.imul(v,ft)|0,o=o+Math.imul(v,ct)|0;var St=(h+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;h=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(D,Z),i=(i=Math.imul(D,W))+Math.imul(j,Z)|0,o=Math.imul(j,W),n=n+Math.imul(B,$)|0,i=(i=i+Math.imul(B,X)|0)+Math.imul(U,$)|0,o=o+Math.imul(U,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(T,rt)|0,i=(i=i+Math.imul(T,nt)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,nt)|0,n=n+Math.imul(S,ot)|0,i=(i=i+Math.imul(S,st)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,st)|0,n=n+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,ht)|0)+Math.imul(E,ut)|0,o=o+Math.imul(E,ht)|0,n=n+Math.imul(b,ft)|0,i=(i=i+Math.imul(b,ct)|0)+Math.imul(M,ft)|0,o=o+Math.imul(M,ct)|0;var Nt=(h+(n=n+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,mt)|0)+Math.imul(v,pt)|0))<<13)|0;h=((o=o+Math.imul(v,mt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(D,$),i=(i=Math.imul(D,X))+Math.imul(j,$)|0,o=Math.imul(j,X),n=n+Math.imul(B,Q)|0,i=(i=i+Math.imul(B,tt)|0)+Math.imul(U,Q)|0,o=o+Math.imul(U,tt)|0,n=n+Math.imul(R,rt)|0,i=(i=i+Math.imul(R,nt)|0)+Math.imul(O,rt)|0,o=o+Math.imul(O,nt)|0,n=n+Math.imul(T,ot)|0,i=(i=i+Math.imul(T,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,n=n+Math.imul(S,ut)|0,i=(i=i+Math.imul(S,ht)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ht)|0,n=n+Math.imul(A,ft)|0,i=(i=i+Math.imul(A,ct)|0)+Math.imul(E,ft)|0,o=o+Math.imul(E,ct)|0;var kt=(h+(n=n+Math.imul(b,pt)|0)|0)+((8191&(i=(i=i+Math.imul(b,mt)|0)+Math.imul(M,pt)|0))<<13)|0;h=((o=o+Math.imul(M,mt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(D,Q),i=(i=Math.imul(D,tt))+Math.imul(j,Q)|0,o=Math.imul(j,tt),n=n+Math.imul(B,rt)|0,i=(i=i+Math.imul(B,nt)|0)+Math.imul(U,rt)|0,o=o+Math.imul(U,nt)|0,n=n+Math.imul(R,ot)|0,i=(i=i+Math.imul(R,st)|0)+Math.imul(O,ot)|0,o=o+Math.imul(O,st)|0,n=n+Math.imul(T,ut)|0,i=(i=i+Math.imul(T,ht)|0)+Math.imul(P,ut)|0,o=o+Math.imul(P,ht)|0,n=n+Math.imul(S,ft)|0,i=(i=i+Math.imul(S,ct)|0)+Math.imul(N,ft)|0,o=o+Math.imul(N,ct)|0;var Tt=(h+(n=n+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,mt)|0)+Math.imul(E,pt)|0))<<13)|0;h=((o=o+Math.imul(E,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(D,rt),i=(i=Math.imul(D,nt))+Math.imul(j,rt)|0,o=Math.imul(j,nt),n=n+Math.imul(B,ot)|0,i=(i=i+Math.imul(B,st)|0)+Math.imul(U,ot)|0,o=o+Math.imul(U,st)|0,n=n+Math.imul(R,ut)|0,i=(i=i+Math.imul(R,ht)|0)+Math.imul(O,ut)|0,o=o+Math.imul(O,ht)|0,n=n+Math.imul(T,ft)|0,i=(i=i+Math.imul(T,ct)|0)+Math.imul(P,ft)|0,o=o+Math.imul(P,ct)|0;var Pt=(h+(n=n+Math.imul(S,pt)|0)|0)+((8191&(i=(i=i+Math.imul(S,mt)|0)+Math.imul(N,pt)|0))<<13)|0;h=((o=o+Math.imul(N,mt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(D,ot),i=(i=Math.imul(D,st))+Math.imul(j,ot)|0,o=Math.imul(j,st),n=n+Math.imul(B,ut)|0,i=(i=i+Math.imul(B,ht)|0)+Math.imul(U,ut)|0,o=o+Math.imul(U,ht)|0,n=n+Math.imul(R,ft)|0,i=(i=i+Math.imul(R,ct)|0)+Math.imul(O,ft)|0,o=o+Math.imul(O,ct)|0;var It=(h+(n=n+Math.imul(T,pt)|0)|0)+((8191&(i=(i=i+Math.imul(T,mt)|0)+Math.imul(P,pt)|0))<<13)|0;h=((o=o+Math.imul(P,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(D,ut),i=(i=Math.imul(D,ht))+Math.imul(j,ut)|0,o=Math.imul(j,ht),n=n+Math.imul(B,ft)|0,i=(i=i+Math.imul(B,ct)|0)+Math.imul(U,ft)|0,o=o+Math.imul(U,ct)|0;var Rt=(h+(n=n+Math.imul(R,pt)|0)|0)+((8191&(i=(i=i+Math.imul(R,mt)|0)+Math.imul(O,pt)|0))<<13)|0;h=((o=o+Math.imul(O,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(D,ft),i=(i=Math.imul(D,ct))+Math.imul(j,ft)|0,o=Math.imul(j,ct);var Ot=(h+(n=n+Math.imul(B,pt)|0)|0)+((8191&(i=(i=i+Math.imul(B,mt)|0)+Math.imul(U,pt)|0))<<13)|0;h=((o=o+Math.imul(U,mt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863;var Ct=(h+(n=Math.imul(D,pt))|0)+((8191&(i=(i=Math.imul(D,mt))+Math.imul(j,pt)|0))<<13)|0;return h=((o=Math.imul(j,mt))+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,u[0]=gt,u[1]=yt,u[2]=vt,u[3]=wt,u[4]=bt,u[5]=Mt,u[6]=_t,u[7]=At,u[8]=Et,u[9]=xt,u[10]=St,u[11]=Nt,u[12]=kt,u[13]=Tt,u[14]=Pt,u[15]=It,u[16]=Rt,u[17]=Ot,u[18]=Ct,0!==h&&(u[19]=h,r.length++),r};function p(t,e,r){return(new m).mulp(t,e,r)}function m(t,e){this.x=t,this.y=e}Math.imul||(d=c),o.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?d(this,t,e):r<63?c(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o<r.length-1;o++){var s=i;i=0;for(var a=67108863&n,u=Math.min(o,e.length-1),h=Math.max(0,o-t.length+1);h<=u;h++){var l=o-h,f=(0|t.words[l])*(0|e.words[h]),c=67108863&f;a=67108863&(c=c+a|0),i+=(s=(s=s+(f/67108864|0)|0)+(c>>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,t,e):p(this,t,e)},m.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n<t;n++)e[n]=this.revBin(n,r,t);return e},m.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var n=0,i=0;i<e;i++)n|=(1&t)<<e-i-1,t>>=1;return n},m.prototype.permute=function(t,e,r,n,i,o){for(var s=0;s<o;s++)n[s]=e[t[s]],i[s]=r[t[s]]},m.prototype.transform=function(t,e,r,n,i,o){this.permute(o,t,e,r,n,i);for(var s=1;s<i;s<<=1)for(var a=s<<1,u=Math.cos(2*Math.PI/a),h=Math.sin(2*Math.PI/a),l=0;l<i;l+=a)for(var f=u,c=h,d=0;d<s;d++){var p=r[l+d],m=n[l+d],g=r[l+d+s],y=n[l+d+s],v=f*g-c*y;y=f*y+c*g,g=v,r[l+d]=p+g,n[l+d]=m+y,r[l+d+s]=p-g,n[l+d+s]=m-y,d!==a&&(v=u*f-h*c,c=u*c+h*f,f=v)}},m.prototype.guessLen13b=function(t,e){var r=1|Math.max(e,t),n=1&r,i=0;for(r=r/2|0;r;r>>>=1)i++;return 1<<i+1+n},m.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var n=0;n<r/2;n++){var i=t[n];t[n]=t[r-n-1],t[r-n-1]=i,i=e[n],e[n]=-e[r-n-1],e[r-n-1]=-i}},m.prototype.normalize13b=function(t,e){for(var r=0,n=0;n<e/2;n++){var i=8192*Math.round(t[2*n+1]/e)+Math.round(t[2*n]/e)+r;t[n]=67108863&i,r=i<67108864?0:i/67108864|0}return t},m.prototype.convert13b=function(t,e,r,i){for(var o=0,s=0;s<e;s++)o+=0|t[s],r[2*s]=8191&o,o>>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s<i;++s)r[s]=0;n(0===o),n(0==(-8192&o))},m.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},m.prototype.mulp=function(t,e,r){var n=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(n),o=this.stub(n),s=new Array(n),a=new Array(n),u=new Array(n),h=new Array(n),l=new Array(n),f=new Array(n),c=r.words;c.length=n,this.convert13b(t.words,t.length,s,n),this.convert13b(e.words,e.length,h,n),this.transform(s,o,a,u,n,i),this.transform(h,o,l,f,n,i);for(var d=0;d<n;d++){var p=a[d]*l[d]-u[d]*f[d];u[d]=a[d]*f[d]+u[d]*l[d],a[d]=p}return this.conjugate(a,u,n),this.transform(a,u,c,o,n,i),this.conjugate(c,o,n),this.normalize13b(c,n),r.negative=t.negative^e.negative,r.length=t.length+e.length,r.strip()},o.prototype.mul=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},o.prototype.mulf=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),p(this,t,e)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.prototype.imuln=function(t){n("number"==typeof t),n(t<67108864);for(var e=0,r=0;r<this.length;r++){var i=(0|this.words[r])*t,o=(67108863&i)+(67108863&e);e>>=26,e+=i/67108864|0,e+=o>>>26,this.words[r]=67108863&o}return 0!==e&&(this.words[r]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var n=r/26|0,i=r%26;e[r]=(t.words[n]&1<<i)>>>i}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n<e.length&&0===e[n];n++,r=r.sqr());if(++n<e.length)for(var i=r.sqr();n<e.length;n++,i=i.sqr())0!==e[n]&&(r=r.mul(i));return r},o.prototype.iushln=function(t){n("number"==typeof t&&t>=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,u=(0|this.words[e])-a<<r;this.words[e]=u|s,s=a>>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this.strip()},o.prototype.ishln=function(t){return n(0===this.negative),this.iushln(t)},o.prototype.iushrn=function(t,e,r){var i;n("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,u=r;if(i-=s,i=Math.max(0,i),u){for(var h=0;h<s;h++)u.words[h]=this.words[h];u.length=s}if(0===s);else if(this.length>s)for(this.length-=s,h=0;h<this.length;h++)this.words[h]=this.words[h+s];else this.words[0]=0,this.length=1;var l=0;for(h=this.length-1;h>=0&&(0!==l||h>=i);h--){var f=0|this.words[h];this.words[h]=l<<26-o|f>>>o,l=f&a}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<<e;return!(this.length<=r)&&!!(this.words[r]&i)},o.prototype.imaskn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<<e;this.words[this.length-1]&=i}return this.strip()},o.prototype.maskn=function(t){return this.clone().imaskn(t)},o.prototype.iaddn=function(t){return n("number"==typeof t),n(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},o.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this.strip()},o.prototype.addn=function(t){return this.clone().iaddn(t)},o.prototype.subn=function(t){return this.clone().isubn(t)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(t,e,r){var i,o,s=t.length+r;this._expand(s);var a=0;for(i=0;i<t.length;i++){o=(0|this.words[i+r])+a;var u=(0|t.words[i])*e;a=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i<this.length-r;i++)a=(o=(0|this.words[i+r])+a)>>26,this.words[i+r]=67108863&o;if(0===a)return this.strip();for(n(-1===a),a=0,i=0;i<this.length;i++)a=(o=-(0|this.words[i])+a)>>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,s=0|i.words[i.length-1];0!==(r=26-this._countBits(s))&&(i=i.ushln(r),n.iushln(r),s=0|i.words[i.length-1]);var a,u=n.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var h=0;h<a.length;h++)a.words[h]=0}var l=n.clone()._ishlnsubmul(i,1,u);0===l.negative&&(n=l,a&&(a.words[u]=1));for(var f=u-1;f>=0;f--){var c=67108864*(0|n.words[i.length+f])+(0|n.words[i.length+f-1]);for(c=Math.min(c/s|0,67108863),n._ishlnsubmul(i,c,f);0!==n.negative;)c--,n.negative=0,n._ishlnsubmul(i,1,f),n.isZero()||(n.negative^=1);a&&(a.words[f]=c)}return a&&a.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){n(t<=67108863);for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},o.prototype.idivn=function(t){n(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),s=new o(0),a=new o(0),u=new o(1),h=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++h;for(var l=r.clone(),f=e.clone();!e.isZero();){for(var c=0,d=1;0==(e.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(l),s.isub(f)),i.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(l),u.isub(f)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),s.isub(u)):(r.isub(e),a.isub(i),u.isub(s))}return{a:a,b:u,gcd:r.iushln(h)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,s=new o(1),a=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var h=0,l=1;0==(e.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(e.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var f=0,c=1;0==(r.words[0]&c)&&f<26;++f,c<<=1);if(f>0)for(r.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<<e;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var o=i,s=r;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:i<t?-1:1}return 0!==this.negative?0|-e:e},o.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},o.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){n<i?e=-1:n>i&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new _(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 y(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function v(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function b(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function M(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function _(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function A(t){_.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}y.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},y.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):r.strip(),r},y.prototype.split=function(t,e){t.iushrn(this.n,0,e)},y.prototype.imulK=function(t){return t.imul(this.k)},i(v,y),v.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i<n;i++)e.words[i]=t.words[i];if(e.length=n,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,i=10;i<t.length;i++){var s=0|t.words[i];t.words[i-10]=(s&r)<<4|o>>>22,o=s}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},v.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var n=0|t.words[r];e+=977*n,t.words[r]=67108863&e,e=64*n+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(w,y),i(b,y),i(M,y),M.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var n=19*(0|t.words[r])+e,i=67108863&n;n>>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(g[t])return g[t];var e;if("k256"===t)e=new v;else if("p224"===t)e=new w;else if("p192"===t)e=new b;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new M}return g[t]=e,e},_.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},_.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},_.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},_.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},_.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},_.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},_.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},_.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},_.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},_.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},_.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},_.prototype.isqr=function(t){return this.imul(t,t.clone())},_.prototype.sqr=function(t){return this.mul(t,t)},_.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),h=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,h).cmp(u);)l.redIAdd(u);for(var f=this.pow(l,i),c=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();n(g<p);var y=this.pow(f,new o(1).iushln(p-g-1));c=c.redMul(y),f=y.redSqr(),d=d.redMul(f),p=g}return c},_.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},_.prototype.pow=function(t,e){if(e.isZero())return new o(1);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new o(1).toRed(this),r[1]=t;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],t);var i=r[0],s=0,a=0,u=e.bitLength()%26;for(0===u&&(u=26),n=e.length-1;n>=0;n--){for(var h=e.words[n],l=u-1;l>=0;l--){var f=h>>l&1;i!==r[0]&&(i=this.sqr(i)),0!==f||0!==s?(s<<=1,s|=f,(4===++a||0===n&&0===l)&&(i=this.mul(i,r[s]),a=0,s=0)):a=0}u=26}return i},_.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},_.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new A(t)},i(A,_),A.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},A.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},A.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},A.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},A.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,r(6)(t))},function(t,e,r){var n=r(49);t.exports=function(t){return"string"!=typeof t?t:n(t)?t.slice(2):t}},function(t,e){t.exports=function(t){if("string"!=typeof t)throw new Error("[is-hex-prefixed] value must be type 'string', is currently type "+typeof t+", while checking isHexPrefixed.");return"0x"===t.slice(0,2)}},function(t,e){},function(t,e,r){!function(t){var e,r,n,i=String.fromCharCode;function o(t){for(var e,r,n=[],i=0,o=t.length;i<o;)(e=t.charCodeAt(i++))>=55296&&e<=56319&&i<o?56320==(64512&(r=t.charCodeAt(i++)))?n.push(((1023&e)<<10)+(1023&r)+65536):(n.push(e),i--):n.push(e);return n}function s(t){if(t>=55296&&t<=57343)throw Error("Lone surrogate U+"+t.toString(16).toUpperCase()+" is not a scalar value")}function a(t,e){return i(t>>e&63|128)}function u(t){if(0==(4294967168&t))return i(t);var e="";return 0==(4294965248&t)?e=i(t>>6&31|192):0==(4294901760&t)?(s(t),e=i(t>>12&15|224),e+=a(t,6)):0==(4292870144&t)&&(e=i(t>>18&7|240),e+=a(t,12),e+=a(t,6)),e+=i(63&t|128)}function h(){if(n>=r)throw Error("Invalid byte index");var t=255&e[n];if(n++,128==(192&t))return 63&t;throw Error("Invalid continuation byte")}function l(){var t,i;if(n>r)throw Error("Invalid byte index");if(n==r)return!1;if(t=255&e[n],n++,0==(128&t))return t;if(192==(224&t)){if((i=(31&t)<<6|h())>=128)return i;throw Error("Invalid continuation byte")}if(224==(240&t)){if((i=(15&t)<<12|h()<<6|h())>=2048)return s(i),i;throw Error("Invalid continuation byte")}if(240==(248&t)&&(i=(7&t)<<18|h()<<12|h()<<6|h())>=65536&&i<=1114111)return i;throw Error("Invalid UTF-8 detected")}t.version="3.0.0",t.encode=function(t){for(var e=o(t),r=e.length,n=-1,i="";++n<r;)i+=u(e[n]);return i},t.decode=function(t){e=o(t),r=e.length,n=0;for(var s,a=[];!1!==(s=l());)a.push(s);return function(t){for(var e,r=t.length,n=-1,o="";++n<r;)(e=t[n])>65535&&(o+=i((e-=65536)>>>10&1023|55296),e=56320|1023&e),o+=i(e);return o}(a)}}(e)},function(t,e){const r="0123456789abcdef".split(""),n=[1,256,65536,16777216],i=[0,8,16,24],o=[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],s=t=>{var e,r,n,i,s,a,u,h,l,f,c,d,p,m,g,y,v,w,b,M,_,A,E,x,S,N,k,T,P,I,R,O,C,B,U,L,D,j,F,z,H,G,q,V,K,Z,W,J,$,X,Y,Q,tt,et,rt,nt,it,ot,st,at,ut,ht,lt;for(n=0;n<48;n+=2)i=t[0]^t[10]^t[20]^t[30]^t[40],s=t[1]^t[11]^t[21]^t[31]^t[41],a=t[2]^t[12]^t[22]^t[32]^t[42],u=t[3]^t[13]^t[23]^t[33]^t[43],h=t[4]^t[14]^t[24]^t[34]^t[44],l=t[5]^t[15]^t[25]^t[35]^t[45],f=t[6]^t[16]^t[26]^t[36]^t[46],c=t[7]^t[17]^t[27]^t[37]^t[47],e=(d=t[8]^t[18]^t[28]^t[38]^t[48])^(a<<1|u>>>31),r=(p=t[9]^t[19]^t[29]^t[39]^t[49])^(u<<1|a>>>31),t[0]^=e,t[1]^=r,t[10]^=e,t[11]^=r,t[20]^=e,t[21]^=r,t[30]^=e,t[31]^=r,t[40]^=e,t[41]^=r,e=i^(h<<1|l>>>31),r=s^(l<<1|h>>>31),t[2]^=e,t[3]^=r,t[12]^=e,t[13]^=r,t[22]^=e,t[23]^=r,t[32]^=e,t[33]^=r,t[42]^=e,t[43]^=r,e=a^(f<<1|c>>>31),r=u^(c<<1|f>>>31),t[4]^=e,t[5]^=r,t[14]^=e,t[15]^=r,t[24]^=e,t[25]^=r,t[34]^=e,t[35]^=r,t[44]^=e,t[45]^=r,e=h^(d<<1|p>>>31),r=l^(p<<1|d>>>31),t[6]^=e,t[7]^=r,t[16]^=e,t[17]^=r,t[26]^=e,t[27]^=r,t[36]^=e,t[37]^=r,t[46]^=e,t[47]^=r,e=f^(i<<1|s>>>31),r=c^(s<<1|i>>>31),t[8]^=e,t[9]^=r,t[18]^=e,t[19]^=r,t[28]^=e,t[29]^=r,t[38]^=e,t[39]^=r,t[48]^=e,t[49]^=r,m=t[0],g=t[1],Z=t[11]<<4|t[10]>>>28,W=t[10]<<4|t[11]>>>28,T=t[20]<<3|t[21]>>>29,P=t[21]<<3|t[20]>>>29,at=t[31]<<9|t[30]>>>23,ut=t[30]<<9|t[31]>>>23,G=t[40]<<18|t[41]>>>14,q=t[41]<<18|t[40]>>>14,B=t[2]<<1|t[3]>>>31,U=t[3]<<1|t[2]>>>31,y=t[13]<<12|t[12]>>>20,v=t[12]<<12|t[13]>>>20,J=t[22]<<10|t[23]>>>22,$=t[23]<<10|t[22]>>>22,I=t[33]<<13|t[32]>>>19,R=t[32]<<13|t[33]>>>19,ht=t[42]<<2|t[43]>>>30,lt=t[43]<<2|t[42]>>>30,et=t[5]<<30|t[4]>>>2,rt=t[4]<<30|t[5]>>>2,L=t[14]<<6|t[15]>>>26,D=t[15]<<6|t[14]>>>26,w=t[25]<<11|t[24]>>>21,b=t[24]<<11|t[25]>>>21,X=t[34]<<15|t[35]>>>17,Y=t[35]<<15|t[34]>>>17,O=t[45]<<29|t[44]>>>3,C=t[44]<<29|t[45]>>>3,x=t[6]<<28|t[7]>>>4,S=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,F=t[27]<<25|t[26]>>>7,M=t[36]<<21|t[37]>>>11,_=t[37]<<21|t[36]>>>11,Q=t[47]<<24|t[46]>>>8,tt=t[46]<<24|t[47]>>>8,V=t[8]<<27|t[9]>>>5,K=t[9]<<27|t[8]>>>5,N=t[18]<<20|t[19]>>>12,k=t[19]<<20|t[18]>>>12,ot=t[29]<<7|t[28]>>>25,st=t[28]<<7|t[29]>>>25,z=t[38]<<8|t[39]>>>24,H=t[39]<<8|t[38]>>>24,A=t[48]<<14|t[49]>>>18,E=t[49]<<14|t[48]>>>18,t[0]=m^~y&w,t[1]=g^~v&b,t[10]=x^~N&T,t[11]=S^~k&P,t[20]=B^~L&j,t[21]=U^~D&F,t[30]=V^~Z&J,t[31]=K^~W&$,t[40]=et^~nt&ot,t[41]=rt^~it&st,t[2]=y^~w&M,t[3]=v^~b&_,t[12]=N^~T&I,t[13]=k^~P&R,t[22]=L^~j&z,t[23]=D^~F&H,t[32]=Z^~J&X,t[33]=W^~$&Y,t[42]=nt^~ot&at,t[43]=it^~st&ut,t[4]=w^~M&A,t[5]=b^~_&E,t[14]=T^~I&O,t[15]=P^~R&C,t[24]=j^~z&G,t[25]=F^~H&q,t[34]=J^~X&Q,t[35]=$^~Y&tt,t[44]=ot^~at&ht,t[45]=st^~ut&lt,t[6]=M^~A&m,t[7]=_^~E&g,t[16]=I^~O&x,t[17]=R^~C&S,t[26]=z^~G&B,t[27]=H^~q&U,t[36]=X^~Q&V,t[37]=Y^~tt&K,t[46]=at^~ht&et,t[47]=ut^~lt&rt,t[8]=A^~m&y,t[9]=E^~g&v,t[18]=O^~x&N,t[19]=C^~S&k,t[28]=G^~B&L,t[29]=q^~U&D,t[38]=Q^~V&Z,t[39]=tt^~K&W,t[48]=ht^~et&nt,t[49]=lt^~rt&it,t[0]^=o[n],t[1]^=o[n+1]},a=t=>e=>{var o;if("0x"===e.slice(0,2)){o=[];for(var a=2,u=e.length;a<u;a+=2)o.push(parseInt(e.slice(a,a+2),16))}else o=e;return((t,e)=>{for(var o,a=e.length,u=t.blocks,h=t.blockCount<<2,l=t.blockCount,f=t.outputBlocks,c=t.s,d=0;d<a;){if(t.reset)for(t.reset=!1,u[0]=t.block,g=1;g<l+1;++g)u[g]=0;if("string"!=typeof e)for(g=t.start;d<a&&g<h;++d)u[g>>2]|=e[d]<<i[3&g++];else for(g=t.start;d<a&&g<h;++d)(o=e.charCodeAt(d))<128?u[g>>2]|=o<<i[3&g++]:o<2048?(u[g>>2]|=(192|o>>6)<<i[3&g++],u[g>>2]|=(128|63&o)<<i[3&g++]):o<55296||o>=57344?(u[g>>2]|=(224|o>>12)<<i[3&g++],u[g>>2]|=(128|o>>6&63)<<i[3&g++],u[g>>2]|=(128|63&o)<<i[3&g++]):(o=65536+((1023&o)<<10|1023&e.charCodeAt(++d)),u[g>>2]|=(240|o>>18)<<i[3&g++],u[g>>2]|=(128|o>>12&63)<<i[3&g++],u[g>>2]|=(128|o>>6&63)<<i[3&g++],u[g>>2]|=(128|63&o)<<i[3&g++]);if(t.lastByteIndex=g,g>=h){for(t.start=g-h,t.block=u[l],g=0;g<l;++g)c[g]^=u[g];s(c),t.reset=!0}else t.start=g}if(u[(g=t.lastByteIndex)>>2]|=n[3&g],t.lastByteIndex===h)for(u[0]=u[l],g=1;g<l+1;++g)u[g]=0;for(u[l-1]|=2147483648,g=0;g<l;++g)c[g]^=u[g];s(c);for(var p,m="",g=0,y=0;y<f;){for(g=0;g<l&&y<f;++g,++y)p=c[g],m+=r[p>>4&15]+r[15&p]+r[p>>12&15]+r[p>>8&15]+r[p>>20&15]+r[p>>16&15]+r[p>>28&15]+r[p>>24&15];y%l==0&&(s(c),g=0)}return"0x"+m})((t=>{return{blocks:[],reset:!0,block:0,start:0,blockCount:1600-(t<<1)>>5,outputBlocks:t>>5,s:(e=[0,0,0,0,0,0,0,0,0,0],[].concat(e,e,e,e,e))};var e})(t),o)};t.exports={keccak256:a(256),keccak512:a(512),keccak256s:a(256),keccak512s:a(512)}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(54);function i(t){return"string"==typeof t&&(!!/^(0x)?[0-9a-f]{512}$/i.test(t)&&!(!/^(0x)?[0-9a-f]{512}$/.test(t)&&!/^(0x)?[0-9A-F]{512}$/.test(t)))}function o(t,e){"object"==typeof e&&e.constructor===Uint8Array&&(e=n.bytesToHex(e));const r=n.keccak256(e).replace("0x","");for(let e=0;e<12;e+=4){const n=(parseInt(r.substr(e,2),16)<<8)+parseInt(r.substr(e+2,2),16)&2047,i=1<<n%4;if((s(t.charCodeAt(t.length-1-Math.floor(n/4)))&i)!==i)return!1}return!0}function s(t){if(t>=48&&t<=57)return t-48;if(t>=65&&t<=70)return t-55;if(t>=97&&t<=102)return t-87;throw new Error("invalid bloom")}function a(t){return"string"==typeof t&&(!!/^(0x)?[0-9a-f]{64}$/i.test(t)&&!(!/^(0x)?[0-9a-f]{64}$/.test(t)&&!/^(0x)?[0-9A-F]{64}$/.test(t)))}function u(t){return"string"==typeof t&&(!!t.match(/^(0x)?[0-9a-fA-F]{40}$/)||!!t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/))}e.isBloom=i,e.isInBloom=o,e.isUserEthereumAddressInBloom=function(t,e){if(!i(t))throw new Error("Invalid bloom given");if(!u(e))throw new Error(`Invalid ethereum address given: "${e}"`);return o(t,n.padLeft(e,64))},e.isContractAddressInBloom=function(t,e){if(!i(t))throw new Error("Invalid bloom given");if(!u(e))throw new Error(`Invalid contract address given: "${e}"`);return o(t,e)},e.isTopicInBloom=function(t,e){if(!i(t))throw new Error("Invalid bloom given");if(!a(e))throw new Error("Invalid topic");return o(t,e)},e.isTopic=a,e.isAddress=u},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(7);function i(t){if(null==t)throw new Error("cannot convert null value to array");if("string"==typeof t){const e=t.match(/^(0x)?[0-9a-fA-F]*$/);if(!e)throw new Error("invalid hexidecimal string");if("0x"!==e[1])throw new Error("hex string must have 0x prefix");(t=t.substring(2)).length%2&&(t="0"+t);const r=[];for(let e=0;e<t.length;e+=2)r.push(parseInt(t.substr(e,2),16));return o(new Uint8Array(r))}if(function(t){if(!t||parseInt(String(t.length))!=t.length||"string"==typeof t)return!1;for(let e=0;e<t.length;e++){const r=t[e];if(r<0||r>=256||parseInt(String(r))!=r)return!1}return!0}(t))return o(new Uint8Array(t));throw new Error("invalid arrayify value")}function o(t){return void 0!==t.slice||(t.slice=()=>{const e=Array.prototype.slice.call(arguments);return o(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}e.keccak256=function(t){return"0x"+n.keccak_256(i(t))},e.padLeft=(t,e)=>{const r=/^0x/i.test(t)||"number"==typeof t,n=e-(t=t.toString().replace(/^0x/i,"")).length+1>=0?e-t.length+1:0;return(r?"0x":"")+new Array(n).join("0")+t},e.bytesToHex=function(t){const e=[];for(let r=0;r<t.length;r++)e.push((t[r]>>>4).toString(16)),e.push((15&t[r]).toString(16));return`0x${e.join("").replace(/^0+/,"")}`},e.toByteArray=i},function(t,e){(function(e){t.exports=e}).call(this,{})},function(t,e,r){var n=r(3),i=r(18),o=function(t){var e=typeof t;if("string"===e)return i.isHexStrict(t)?new n(t.replace(/0x/i,""),16):new n(t,10);if("number"===e)return new n(t);if(i.isBigNumber(t))return new n(t.toString(10));if(i.isBN(t))return t;throw new Error(t+" is not a number")},s=function(t,e,r){var s,a,u;if("bytes"===(t=(u=t).startsWith("int[")?"int256"+u.slice(3):"int"===u?"int256":u.startsWith("uint[")?"uint256"+u.slice(4):"uint"===u?"uint256":u.startsWith("fixed[")?"fixed128x128"+u.slice(5):"fixed"===u?"fixed128x128":u.startsWith("ufixed[")?"ufixed128x128"+u.slice(6):"ufixed"===u?"ufixed128x128":u)){if(e.replace(/^0x/i,"").length%2!=0)throw new Error("Invalid bytes characters "+e.length);return e}if("string"===t)return i.utf8ToHex(e);if("bool"===t)return e?"01":"00";if(t.startsWith("address")){if(s=r?64:40,!i.isAddress(e))throw new Error(e+" is not a valid address, or the checksum is invalid.");return i.leftPad(e.toLowerCase(),s)}if(s=function(t){var e=/^\D+(\d+).*$/.exec(t);return e?parseInt(e[1],10):null}(t),t.startsWith("bytes")){if(!s)throw new Error("bytes[] not yet supported in solidity");if(r&&(s=32),s<1||s>32||s<e.replace(/^0x/i,"").length/2)throw new Error("Invalid bytes"+s+" for "+e);return i.rightPad(e,2*s)}if(t.startsWith("uint")){if(s%8||s<8||s>256)throw new Error("Invalid uint"+s+" size");if((a=o(e)).bitLength()>s)throw new Error("Supplied uint exceeds width: "+s+" vs "+a.bitLength());if(a.lt(new n(0)))throw new Error("Supplied uint "+a.toString()+" is negative");return s?i.leftPad(a.toString("hex"),s/8*2):a}if(t.startsWith("int")){if(s%8||s<8||s>256)throw new Error("Invalid int"+s+" size");if((a=o(e)).bitLength()>s)throw new Error("Supplied int exceeds width: "+s+" vs "+a.bitLength());return a.lt(new n(0))?a.toTwos(s).toString("hex"):s?i.leftPad(a.toString("hex"),s/8*2):a}throw new Error("Unsupported or invalid type: "+t)},a=function(t){if(Array.isArray(t))throw new Error("Autodetection of array types is not supported.");var e,r,o="";if(t&&"object"==typeof t&&(t.hasOwnProperty("v")||t.hasOwnProperty("t")||t.hasOwnProperty("value")||t.hasOwnProperty("type"))?(e=t.hasOwnProperty("t")?t.t:t.type,o=t.hasOwnProperty("v")?t.v:t.value):(e=i.toHex(t,!0),o=i.toHex(t),e.startsWith("int")||e.startsWith("uint")||(e="bytes")),!e.startsWith("int")&&!e.startsWith("uint")||"string"!=typeof o||/^(-)?0x/i.test(o)||(o=new n(o)),Array.isArray(o)){if((r=function(t){var e=/^\D+\d*\[(\d+)\]$/.exec(t);return e?parseInt(e[1],10):null}(e))&&o.length!==r)throw new Error(e+" is not matching the given array "+JSON.stringify(o));r=o.length}return Array.isArray(o)?o.map((function(t){return s(e,t,r).toString("hex").replace("0x","")})).join(""):s(e,o,r).toString("hex").replace("0x","")};t.exports={soliditySha3:function(){var t=Array.prototype.slice.call(arguments),e=t.map(a);return i.sha3("0x"+e.join(""))},soliditySha3Raw:function(){return i.sha3Raw("0x"+Array.prototype.slice.call(arguments).map(a).join(""))},encodePacked:function(){var t=Array.prototype.slice.call(arguments),e=t.map(a);return"0x"+e.join("").toLowerCase()}}},function(t,e,r){"use strict";(function(e,n){var i=65536,o=4294967295;var s=r(58).Buffer,a=e.crypto||e.msCrypto;a&&a.getRandomValues?t.exports=function(t,e){if(t>o)throw new RangeError("requested too many random bytes");var r=s.allocUnsafe(t);if(t>0)if(t>i)for(var u=0;u<t;u+=i)a.getRandomValues(r.slice(u,u+i));else a.getRandomValues(r);if("function"==typeof e)return n.nextTick((function(){e(null,r)}));return r}:t.exports=function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}}).call(this,r(4),r(5))},function(t,e,r){var n=r(2),i=n.Buffer;function o(t,e){for(var r in t)e[r]=t[r]}function s(t,e,r){return i(t,e,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=n:(o(n,e),e.Buffer=s),s.prototype=Object.create(i.prototype),o(i,s),s.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,r)},s.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var n=i(t);return void 0!==e?"string"==typeof r?n.fill(e,r):n.fill(e):n.fill(0),n},s.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},s.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n.SlowBuffer(t)}},function(t,e,r){var n=r(2).Buffer,i=r(16),o=r(19).AbiCoder,s=r(19).ParamType,a=new o((function(t,e){return!t.match(/^u?int/)||Array.isArray(e)||e&&"object"==typeof e&&"BN"===e.constructor.name?e:e.toString()}));function u(){}var h=function(){};h.prototype.encodeFunctionSignature=function(t){return("function"==typeof t||"object"==typeof t&&t)&&(t=i._jsonInterfaceMethodToString(t)),i.sha3(t).slice(0,10)},h.prototype.encodeEventSignature=function(t){return("function"==typeof t||"object"==typeof t&&t)&&(t=i._jsonInterfaceMethodToString(t)),i.sha3(t)},h.prototype.encodeParameter=function(t,e){return this.encodeParameters([t],[e])},h.prototype.encodeParameters=function(t,e){var r=this;return t=r.mapTypes(t),e=e.map((function(e,n){let i=t[n];if("object"==typeof i&&i.type&&(i=i.type),e=r.formatParam(i,e),"string"==typeof i&&i.includes("tuple")){const t=a._getCoder(s.from(i)),n=(t,e)=>{if("array"===t.name)return e.map((e=>n(a._getCoder(s.from(t.type.replace("[]",""))),e)));t.coders.forEach(((t,i)=>{"tuple"===t.name?n(t,e[i]):e[i]=r.formatParam(t.name,e[i])}))};n(t,e)}return e})),a.encode(t,e)},h.prototype.mapTypes=function(t){var e=this,r=[];return t.forEach((function(t){if("object"==typeof t&&"function"===t.type&&(t=Object.assign({},t,{type:"bytes24"})),e.isSimplifiedStructFormat(t)){var n=Object.keys(t)[0];r.push(Object.assign(e.mapStructNameAndType(n),{components:e.mapStructToCoderFormat(t[n])}))}else r.push(t)})),r},h.prototype.isSimplifiedStructFormat=function(t){return"object"==typeof t&&void 0===t.components&&void 0===t.name},h.prototype.mapStructNameAndType=function(t){var e="tuple";return t.indexOf("[]")>-1&&(e="tuple[]",t=t.slice(0,-2)),{type:e,name:t}},h.prototype.mapStructToCoderFormat=function(t){var e=this,r=[];return Object.keys(t).forEach((function(n){"object"!=typeof t[n]?r.push({name:n,type:t[n]}):r.push(Object.assign(e.mapStructNameAndType(n),{components:e.mapStructToCoderFormat(t[n])}))})),r},h.prototype.formatParam=function(t,e){const r=new RegExp(/^bytes([0-9]*)$/),o=new RegExp(/^bytes([0-9]*)\[\]$/),s=new RegExp(/^(u?int)([0-9]*)$/),a=new RegExp(/^(u?int)([0-9]*)\[\]$/);if(i.isBN(e)||i.isBigNumber(e))return e.toString(10);if(t.match(o)||t.match(a))return e.map((e=>this.formatParam(t.replace("[]",""),e)));let u=t.match(s);if(u){let t=parseInt(u[2]||"256");t/8<e.length&&(e=i.leftPad(e,t))}if(u=t.match(r),u){n.isBuffer(e)&&(e=i.toHex(e));let t=parseInt(u[1]);if(t){let r=2*t;"0x"===e.substring(0,2)&&(r+=2),e.length<r&&(e=i.rightPad(e,2*t))}e.length%2==1&&(e="0x0"+e.substring(2))}return e},h.prototype.encodeFunctionCall=function(t,e){return this.encodeFunctionSignature(t)+this.encodeParameters(t.inputs,e).replace("0x","")},h.prototype.decodeParameter=function(t,e){return this.decodeParameters([t],e)[0]},h.prototype.decodeParameters=function(t,e){return this.decodeParametersWith(t,e,!1)},h.prototype.decodeParametersWith=function(t,e,r){if(t.length>0&&(!e||"0x"===e||"0X"===e))throw new Error("Returned values aren't valid, did it run Out of Gas? You might also see this error if you are not using the correct ABI for the contract you are retrieving data from, requesting data from a block number that does not exist, or querying a node which is not fully synced.");var n=a.decode(this.mapTypes(t),"0x"+e.replace(/0x/i,""),r),i=new u;return i.__length__=0,t.forEach((function(t,e){var r=n[i.__length__];r="0x"===r?null:r,i[e]=r,("function"==typeof t||t&&"object"==typeof t)&&t.name&&(i[t.name]=r),i.__length__++})),i},h.prototype.decodeLog=function(t,e,r){var n=this;r=Array.isArray(r)?r:[r],e=e||"";var i=[],o=[],s=0;t.forEach((function(t,e){t.indexed?(o[e]=["bool","int","uint","address","fixed","ufixed"].find((function(e){return-1!==t.type.indexOf(e)}))?n.decodeParameter(t.type,r[s]):r[s],s++):i[e]=t}));var a=e,h=a?this.decodeParametersWith(i,a,!0):[],l=new u;return l.__length__=0,t.forEach((function(t,e){l[e]="string"===t.type?"":null,void 0!==h[e]&&(l[e]=h[e]),void 0!==o[e]&&(l[e]=o[e]),t.name&&(l[t.name]=l[e]),l.__length__++})),l};var l=new h;t.exports=l}])}));